文件分类标记
This commit is contained in:
parent
5662b27adb
commit
9cb65dfa30
|
|
@ -8,11 +8,13 @@ import com.bonus.common.core.page.TableDataInfo;
|
|||
import com.bonus.common.enums.OperaType;
|
||||
import com.bonus.web.domain.DaKyProFilesContentsDto;
|
||||
import com.bonus.web.domain.ProjectDto;
|
||||
import com.bonus.web.domain.vo.DaKyProFilesContentsVo;
|
||||
import com.bonus.web.service.FileManageService;
|
||||
import com.bonus.web.service.ProjectService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -49,6 +51,7 @@ public class FileManagementController extends BaseController {
|
|||
return getDataTable(new ArrayList<>());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "档案管理树")
|
||||
@GetMapping("getFileManageTree")
|
||||
@SysLog(title = "档案管理树", module = "档案管理->档案左侧树", businessType = OperaType.QUERY, details = "档案管理树", logType = 1)
|
||||
|
|
@ -79,11 +82,11 @@ public class FileManagementController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "新增档案")
|
||||
@PostMapping("addFileManage")
|
||||
@SysLog(title = "新增档案目录", module = "档案管理->档案目录管理", businessType = OperaType.INSERT, details = "新增档案目录", logType = 1)
|
||||
@ApiOperation(value = "新增左侧档案树")
|
||||
@PostMapping("addFileManageRight")
|
||||
@SysLog(title = "新增左侧档案树", module = "档案管理->档案目录管理", businessType = OperaType.INSERT, details = "新增左侧档案树", logType = 1)
|
||||
@RequiresPermissions("file:manage:add")
|
||||
public R saveArchivalCatalogue(@RequestBody DaKyProFilesContentsDto dto) {
|
||||
public R saveArchivalCatalogue(@RequestBody @Validated DaKyProFilesContentsVo dto) {
|
||||
try {
|
||||
if (dto.getParentId() == null) {
|
||||
return R.fail("父级有误");
|
||||
|
|
@ -97,12 +100,37 @@ public class FileManagementController extends BaseController {
|
|||
return R.fail("请求出错了");
|
||||
}
|
||||
}
|
||||
@ApiOperation(value = "新增右侧档案列表")
|
||||
@PostMapping("addFileManageLeft")
|
||||
@SysLog(title = "新增右侧档案列表", module = "档案管理->档案目录管理", businessType = OperaType.INSERT, details = "新增右侧档案列表", logType = 1)
|
||||
@RequiresPermissions("file:manage:add")
|
||||
public R saveArchivalCatalogue(@RequestBody @Validated DaKyProFilesContentsDto dto) {
|
||||
try {
|
||||
if (dto.getParentId() == null) {
|
||||
return R.fail("父级有误");
|
||||
}
|
||||
if (dto.getLevel() == null) {
|
||||
return R.fail("级别有误");
|
||||
}
|
||||
Integer num = fileManageService.getMaxSort(dto);
|
||||
if (num == null) {
|
||||
num = 0;
|
||||
}
|
||||
if (dto.getSort() <= num) {
|
||||
return R.fail("排序序号需大于" + num);
|
||||
}
|
||||
return fileManageService.saveFileManage(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return R.fail("请求出错了");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "修改档案")
|
||||
@PostMapping("updateFileManage")
|
||||
@PostMapping("updateFileManageRight")
|
||||
@SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1)
|
||||
@RequiresPermissions("file:manage:update")
|
||||
public R updateFileManage(@RequestBody DaKyProFilesContentsDto dto) {
|
||||
public R updateFileManage(@RequestBody @Validated DaKyProFilesContentsVo dto) {
|
||||
try {
|
||||
return fileManageService.updateFileManage(dto);
|
||||
} catch (Exception e) {
|
||||
|
|
@ -110,6 +138,26 @@ public class FileManagementController extends BaseController {
|
|||
return R.fail("请求出错了");
|
||||
}
|
||||
}
|
||||
@ApiOperation(value = "修改档案")
|
||||
@PostMapping("updateFileManageLeft")
|
||||
@SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1)
|
||||
@RequiresPermissions("file:manage:update")
|
||||
public R updateFileManage(@RequestBody @Validated DaKyProFilesContentsDto dto) {
|
||||
try {
|
||||
Integer num = fileManageService.getMaxSort(dto);
|
||||
if (num == null) {
|
||||
num = 0;
|
||||
}
|
||||
int sort = fileManageService.getSortById(dto.getId());
|
||||
if (sort != dto.getSort() && dto.getSort() <= num) {
|
||||
return R.fail("排序序号需大于" + num);
|
||||
}
|
||||
return fileManageService.updateFileManage(dto);
|
||||
} catch (Exception e) {
|
||||
log.error(e.toString(), e);
|
||||
return R.fail("请求出错了");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除档案")
|
||||
@PostMapping("delFileManage")
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package com.bonus.web.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -24,11 +27,14 @@ public class DaKyProFilesContentsDto {
|
|||
/**
|
||||
* 分类名称/档案名称
|
||||
*/
|
||||
@NotBlank(message = "分类名称或文件题名不能为空")
|
||||
@Length(max = 64, message = "分类名称或文件题名长度不能超过64个字符")
|
||||
private String contentName;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
@NotNull(message = "上级节点不能为空")
|
||||
private Integer parentId;
|
||||
|
||||
/**
|
||||
|
|
@ -39,6 +45,7 @@ public class DaKyProFilesContentsDto {
|
|||
/**
|
||||
* 分类号/案卷排序号
|
||||
*/
|
||||
@NotNull(message = "分类号/案卷排序号不能为空")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,146 @@
|
|||
package com.bonus.web.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author:liang.chao
|
||||
* @Date:2025/9/11 - 11:05
|
||||
*/
|
||||
@Data
|
||||
public class DaKyProFilesContentsVo {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Integer id;
|
||||
|
||||
/**
|
||||
* 项目id
|
||||
*/
|
||||
private String proId;
|
||||
|
||||
/**
|
||||
* 分类名称/档案名称
|
||||
*/
|
||||
@NotBlank(message = "分类名称或文件题名不能为空")
|
||||
@Length(max = 64, message = "分类名称或文件题名长度不能超过64个字符")
|
||||
private String contentName;
|
||||
|
||||
/**
|
||||
* 父节点id
|
||||
*/
|
||||
@NotNull(message = "上级节点不能为空")
|
||||
private Integer parentId;
|
||||
|
||||
/**
|
||||
* 层级
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 分类号/案卷排序号
|
||||
*/
|
||||
@NotNull(message = "分类号/案卷排序号不能为空")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 档案标识代码
|
||||
*/
|
||||
private String markCode;
|
||||
|
||||
/**
|
||||
* 案卷期限
|
||||
*/
|
||||
private String term;
|
||||
|
||||
/**
|
||||
* 归档责任单位
|
||||
*/
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
* 来源 1.本系统上传 2.智慧现场
|
||||
*/
|
||||
private String dataSource;
|
||||
|
||||
/**
|
||||
* 是否独有 0.否 1.是
|
||||
*/
|
||||
private String isUnique;
|
||||
|
||||
/**
|
||||
* 完整性确认状态 0.未确认 1.已确认 ---确认后不能进行操作
|
||||
*/
|
||||
private String integrityStatus;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private String createTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private String updateTime;
|
||||
|
||||
/**
|
||||
* 创建人ID
|
||||
*/
|
||||
private Long createUserId;
|
||||
|
||||
/**
|
||||
* 创建人姓名
|
||||
*/
|
||||
private String createUserName;
|
||||
|
||||
/**
|
||||
* 修改人ID
|
||||
*/
|
||||
private Long updateUserId;
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String businessId;
|
||||
|
||||
/**
|
||||
* 修改人姓名
|
||||
*/
|
||||
private String updateUserName;
|
||||
/**
|
||||
* 文件id
|
||||
*/
|
||||
private String fileId;
|
||||
/**
|
||||
* 文件地址
|
||||
*/
|
||||
@NotBlank(message = "请上传文件")
|
||||
private String filePath;
|
||||
/**
|
||||
* 文件名称
|
||||
*/
|
||||
private String fileName;
|
||||
/**
|
||||
* 文件类型
|
||||
*/
|
||||
private String fileType;
|
||||
/**
|
||||
* 资源类型
|
||||
*/
|
||||
private String sourceType;
|
||||
/**
|
||||
* 文件源文件名
|
||||
*/
|
||||
private String sourceFileName;
|
||||
|
||||
/**
|
||||
* 是否删除 0.删除 1.未删除
|
||||
*/
|
||||
private String delFlag;
|
||||
|
||||
private List<DaKyProFilesContentsVo> children = new ArrayList<>();
|
||||
}
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.web.mapper;
|
||||
|
||||
import com.bonus.web.domain.DaKyProFilesContentsDto;
|
||||
import com.bonus.web.domain.vo.DaKyProFilesContentsVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
|
@ -16,8 +17,9 @@ public interface FileManageMapper {
|
|||
List<DaKyProFilesContentsDto> FileManage(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer saveFileManage(DaKyProFilesContentsDto dto);
|
||||
Integer saveFileManage(DaKyProFilesContentsVo dto);
|
||||
|
||||
Integer saveFileSource(DaKyProFilesContentsDto dto);
|
||||
Integer saveFileSource(DaKyProFilesContentsVo dto);
|
||||
|
||||
Integer updateFileManage(DaKyProFilesContentsDto dto);
|
||||
|
||||
|
|
@ -28,8 +30,15 @@ public interface FileManageMapper {
|
|||
Integer delFileManage(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer selectFileManage(DaKyProFilesContentsDto dto);
|
||||
Integer selectFileManage(DaKyProFilesContentsVo dto);
|
||||
|
||||
List<String> getFilesClassifyNameStandard();
|
||||
|
||||
Integer updateIntegrityStatus(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer getLevelById(Integer id);
|
||||
|
||||
Integer getMaxSort(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer getSortById(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.bonus.web.service;
|
|||
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.web.domain.DaKyProFilesContentsDto;
|
||||
import com.bonus.web.domain.vo.DaKyProFilesContentsVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -15,10 +16,16 @@ public interface FileManageService {
|
|||
List<DaKyProFilesContentsDto> FileManage(DaKyProFilesContentsDto dto);
|
||||
|
||||
R saveFileManage(DaKyProFilesContentsDto dto);
|
||||
R saveFileManage(DaKyProFilesContentsVo dto);
|
||||
|
||||
R updateFileManage(DaKyProFilesContentsDto dto);
|
||||
R updateFileManage(DaKyProFilesContentsVo dto);
|
||||
|
||||
Integer delFileManage(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer updateIntegrityStatus(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer getMaxSort(DaKyProFilesContentsDto dto);
|
||||
|
||||
Integer getSortById(Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
package com.bonus.web.service.impl;
|
||||
|
||||
import com.bonus.common.core.domain.R;
|
||||
import com.bonus.common.utils.SecurityUtils;
|
||||
import com.bonus.web.controller.tool.TreeBuilder;
|
||||
import com.bonus.web.domain.ArchivalCatalogueDto;
|
||||
import com.bonus.web.domain.DaKyProFilesContentsDto;
|
||||
import com.bonus.web.domain.vo.DaKyProFilesContentsVo;
|
||||
import com.bonus.web.mapper.FileManageMapper;
|
||||
import com.bonus.web.mapper.ProjectMapper;
|
||||
import com.bonus.web.service.FileManageService;
|
||||
|
|
@ -10,7 +13,9 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.bonus.common.utils.SecurityUtils.getLoginUser;
|
||||
|
||||
|
|
@ -29,6 +34,16 @@ public class FileManageServiceImpl implements FileManageService {
|
|||
@Override
|
||||
public List<DaKyProFilesContentsDto> list(DaKyProFilesContentsDto daKyProFilesContentsDto) {
|
||||
List<DaKyProFilesContentsDto> list = fileManageMapper.list(daKyProFilesContentsDto);
|
||||
if (daKyProFilesContentsDto.getId() != null) {
|
||||
list.removeIf(dto -> !"2".equals(dto.getDataSource()));
|
||||
Integer level = fileManageMapper.getLevelById(daKyProFilesContentsDto.getId());
|
||||
for (Iterator<DaKyProFilesContentsDto> it = list.iterator(); it.hasNext(); ) {
|
||||
DaKyProFilesContentsDto item = it.next();
|
||||
if (level <= item.getLevel()) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 构建树
|
||||
List<DaKyProFilesContentsDto> tree = TreeBuilder.buildTreeDaKyProFilesContents(list);
|
||||
return tree;
|
||||
|
|
@ -43,11 +58,27 @@ public class FileManageServiceImpl implements FileManageService {
|
|||
public R saveFileManage(DaKyProFilesContentsDto dto) {
|
||||
dto.setCreateUserId(getLoginUser().getUserId());
|
||||
dto.setCreateUserName(getLoginUser().getUsername());
|
||||
dto.setUpdateUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
dto.setUpdateUserName(SecurityUtils.getLoginUser().getUsername());
|
||||
// 查询档案名称是否重复
|
||||
Integer i = fileManageMapper.selectFileManage(dto);
|
||||
if (i > 0) {
|
||||
return R.fail("档案名称重复");
|
||||
}
|
||||
return R.ok(fileManageMapper.saveFileManage(dto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R saveFileManage(DaKyProFilesContentsVo dto) {
|
||||
// 查询档案名称是否重复
|
||||
Integer i = fileManageMapper.selectFileManage(dto);
|
||||
if (i > 0) {
|
||||
return R.fail("档案名称重复");
|
||||
}
|
||||
dto.setCreateUserId(getLoginUser().getUserId());
|
||||
dto.setCreateUserName(getLoginUser().getUsername());
|
||||
dto.setUpdateUserId(SecurityUtils.getLoginUser().getUserId());
|
||||
dto.setUpdateUserName(SecurityUtils.getLoginUser().getUsername());
|
||||
if (StringUtils.isNotBlank(dto.getFilePath())) {
|
||||
// 判断是否包含文件命名规范
|
||||
List<String> list = fileManageMapper.getFilesClassifyNameStandard();
|
||||
|
|
@ -58,6 +89,7 @@ public class FileManageServiceImpl implements FileManageService {
|
|||
}
|
||||
fileManageMapper.saveFileSource(dto);
|
||||
}
|
||||
|
||||
return R.ok(fileManageMapper.saveFileManage(dto));
|
||||
}
|
||||
|
||||
|
|
@ -76,6 +108,11 @@ public class FileManageServiceImpl implements FileManageService {
|
|||
return R.ok(fileManageMapper.updateFileManage(dto));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R updateFileManage(DaKyProFilesContentsVo dto) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer delFileManage(DaKyProFilesContentsDto dto) {
|
||||
fileManageMapper.delFileSource(dto);
|
||||
|
|
@ -87,4 +124,14 @@ public class FileManageServiceImpl implements FileManageService {
|
|||
fileManageMapper.updateIntegrityStatus(dto);
|
||||
return projectMapper.updateFileStatus(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getMaxSort(DaKyProFilesContentsDto dto) {
|
||||
return fileManageMapper.getMaxSort(dto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getSortById(Integer id) {
|
||||
return fileManageMapper.getSortById(id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,9 +167,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT
|
||||
count(*)
|
||||
FROM
|
||||
da_ky_pro_files_contents dkp
|
||||
WHERE
|
||||
dkp.del_flag = '1' and level = #{level}
|
||||
da_ky_pro_files_contents
|
||||
WHERE content_name = #{contentName}
|
||||
and parent_id = #{parentId}
|
||||
and del_flag = '1'
|
||||
<if test="id != null">
|
||||
and id != #{id}
|
||||
</if>
|
||||
|
|
@ -182,4 +183,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
WHERE
|
||||
dkfcns.del_flag = '1' and standard_type = '1'
|
||||
</select>
|
||||
<select id="getLevelById" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
dkp.level
|
||||
FROM
|
||||
da_ky_pro_files_contents dkp
|
||||
WHERE
|
||||
dkp.id = #{id}
|
||||
</select>
|
||||
<select id="getMaxSort" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
max(dkpfc.sort)
|
||||
FROM
|
||||
da_ky_pro_files_contents dkpfc
|
||||
WHERE
|
||||
dkpfc.del_flag = '1' and dkpfc.parent_id = #{parentId}
|
||||
</select>
|
||||
<select id="getSortById" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
dkpfc.sort
|
||||
FROM
|
||||
da_ky_pro_files_contents dkpfc
|
||||
WHERE
|
||||
dkpfc.id = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue