新增教务空间、学校空间;新增定稿功能

This commit is contained in:
cjw 2024-07-17 10:27:05 +08:00
parent 4b2bc5ccc5
commit f756d27590
8 changed files with 55 additions and 10 deletions

View File

@ -150,4 +150,15 @@ public class SysOssTextbookController extends BaseController {
public R<String> preview(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception { public R<String> preview(@NotNull(message = "主键不能为空") @PathVariable Long id) throws Exception {
return R.ok("操作成功", sysOssTextbookService.preview(id)); return R.ok("操作成功", sysOssTextbookService.preview(id));
} }
/**
* 定稿
*
* @param bo 主键串
*/
@SaCheckPermission("file:textbook:finalize")
@Log(title = "【定稿】", businessType = BusinessType.UPDATE)
@PutMapping("/finalize")
public R<Void> finalize(@RequestBody SysOssTextbookBo bo) {
return toAjax(sysOssTextbookService.moveByBo(bo));
}
} }

View File

@ -51,6 +51,11 @@ public class SysOssTextbook extends TenantEntity {
*/ */
private Integer type; private Integer type;
/**
* 1教务空间 2学校空间
*/
private Integer ossType;
/** /**
* 状态 * 状态
*/ */

View File

@ -43,6 +43,9 @@ public class SysOssTextbookBo extends BaseEntity {
@NotNull(message = "资源类型不能为空", groups = {AddGroup.class, EditGroup.class}) @NotNull(message = "资源类型不能为空", groups = {AddGroup.class, EditGroup.class})
private Integer type; private Integer type;
@NotNull(message = "空间类型不能为空", groups = {AddGroup.class, EditGroup.class})
private Integer ossType;
/** /**
* 状态 0失败 1成功 * 状态 0失败 1成功
*/ */

View File

@ -57,6 +57,11 @@ public class SysOssTextbookVo implements Serializable {
*/ */
private Integer type; private Integer type;
/**
* 1教务空间 2学校空间
*/
private Integer ossType;
/** /**
* 状态 * 状态
*/ */

View File

@ -101,4 +101,6 @@ public interface ISysOssTextbookService {
SysOssTextbookVo browseById(Long id); SysOssTextbookVo browseById(Long id);
Boolean finalize(SysOssTextbookBo bo);
} }

View File

@ -32,7 +32,6 @@ import org.dromara.system.service.ISysOssService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection; import java.util.Collection;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -238,9 +237,10 @@ public class SysOssPersonServiceImpl implements ISysOssPersonService {
date.setFileSuffix(ossPerson.getFileSuffix()); date.setFileSuffix(ossPerson.getFileSuffix());
date.setFilePath(path); date.setFilePath(path);
date.setType(ossPerson.getType()); date.setType(ossPerson.getType());
date.setOssType(1);
date.setCreateDept(ossPerson.getCreateDept()); date.setCreateDept(ossPerson.getCreateDept());
date.setCreateBy(ossPerson.getCreateBy()); date.setCreateBy(ossPerson.getCreateBy());
date.setCreateTime(new Date()); date.setUpdateBy(ossPerson.getCreateBy());
return textbookMapper.insert(date) > 0; return textbookMapper.insert(date) > 0;
} }
} }

View File

@ -15,6 +15,7 @@ import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery; import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo; import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.mybatis.helper.DataBaseHelper; import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.system.domain.SysCatalogResource; import org.dromara.system.domain.SysCatalogResource;
import org.dromara.system.domain.SysOssResource; import org.dromara.system.domain.SysOssResource;
import org.dromara.system.domain.bo.SysOssResourceBo; import org.dromara.system.domain.bo.SysOssResourceBo;
@ -259,6 +260,9 @@ public class SysOssResourceServiceImpl implements ISysOssResourceService {
date.setFileSuffix(ossResource.getFileSuffix()); date.setFileSuffix(ossResource.getFileSuffix());
date.setFilePath(path); date.setFilePath(path);
date.setStatus(ossResource.getStatus()); date.setStatus(ossResource.getStatus());
date.setCreateDept(ossResource.getCreateDept());
date.setCreateBy(ossResource.getCreateBy());
date.setUpdateBy(LoginHelper.getUserId());
return date; return date;
} }

View File

@ -90,14 +90,6 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
.eq("ot.del_flag", 0) .eq("ot.del_flag", 0)
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix()) .eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName()) .like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName())
// .and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> {
// List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>()
// .select(SysCatalogTextbook::getCatalogId)
// .apply(DataBaseHelper.findInSet(bo.getCatalogId(), "ancestors")));
// List<Long> ids = StreamUtils.toList(list, SysCatalogTextbook::getCatalogId);
// ids.add(bo.getCatalogId());
// w.in("ot.catalog_id", ids);
// })
.orderByDesc("ot.create_time"); .orderByDesc("ot.create_time");
Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper); Page<SysOssTextbookVo> result = baseMapper.selectPageAwaitList(pageQuery.build(), wrapper);
return TableDataInfo.build(result); return TableDataInfo.build(result);
@ -131,6 +123,7 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
.eq(ObjectUtil.isNotNull(bo.getStatus()), "ot.status", bo.getStatus()) .eq(ObjectUtil.isNotNull(bo.getStatus()), "ot.status", bo.getStatus())
.eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix()) .eq(StringUtils.isNotEmpty(bo.getFileSuffix()), "ot.file_suffix", bo.getFileSuffix())
.eq(ObjectUtil.isNotNull(bo.getCreateBy()), "ot.create_by", bo.getCreateBy()) .eq(ObjectUtil.isNotNull(bo.getCreateBy()), "ot.create_by", bo.getCreateBy())
.eq(ObjectUtil.isNotNull(bo.getOssType()), "ot.oss_type", bo.getOssType())
.like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName()) .like(StringUtils.isNotEmpty(bo.getFileName()), "ot.file_name", bo.getFileName())
.and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> { .and(ObjectUtil.isNotNull(bo.getCatalogId()), w -> {
List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>() List<SysCatalogTextbook> list = catalogService.selectList(new LambdaQueryWrapper<SysCatalogTextbook>()
@ -285,7 +278,11 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
date.setFileSuffix(ossTextbook.getFileSuffix()); date.setFileSuffix(ossTextbook.getFileSuffix());
date.setFilePath(path); date.setFilePath(path);
date.setType(ossTextbook.getType()); date.setType(ossTextbook.getType());
date.setOssType(ossTextbook.getOssType());
date.setStatus(ossTextbook.getStatus()); date.setStatus(ossTextbook.getStatus());
date.setCreateDept(ossTextbook.getCreateDept());
date.setCreateBy(ossTextbook.getCreateBy());
date.setUpdateBy(LoginHelper.getUserId());
return date; return date;
} }
@ -356,6 +353,24 @@ public class SysOssTextbookServiceImpl implements ISysOssTextbookService {
return ossTextbookVo; return ossTextbookVo;
} }
@Override
public Boolean finalize(SysOssTextbookBo bo) {
SysOssTextbook ossTextbook = baseMapper.selectById(bo.getId());
SysOssTextbook date = new SysOssTextbook();
date.setOssId(ossTextbook.getOssId());
date.setCatalogId(ossTextbook.getCatalogId());
date.setFileName(ossTextbook.getFileName());
date.setFileSuffix(ossTextbook.getFileSuffix());
date.setFilePath(ossTextbook.getFilePath());
date.setType(ossTextbook.getType());
date.setOssType(2);
date.setStatus(ossTextbook.getStatus());
date.setCreateDept(ossTextbook.getCreateDept());
date.setCreateBy(ossTextbook.getCreateBy());
date.setUpdateBy(LoginHelper.getUserId());
return baseMapper.insert(date) > 0;
}
private LambdaQueryWrapper<SysTextbookRecord> buildRecordQueryWrapper(SysTextbookRecord data) { private LambdaQueryWrapper<SysTextbookRecord> buildRecordQueryWrapper(SysTextbookRecord data) {
return new LambdaQueryWrapper<SysTextbookRecord>() return new LambdaQueryWrapper<SysTextbookRecord>()
.eq(SysTextbookRecord::getOssTextbookId, data.getOssTextbookId()) .eq(SysTextbookRecord::getOssTextbookId, data.getOssTextbookId())