代码提交

This commit is contained in:
liang.chao 2025-09-18 09:35:25 +08:00
parent 18ba436a1d
commit 97f0609fac
4 changed files with 41 additions and 33 deletions

View File

@ -154,12 +154,6 @@ public class FileManagementController extends BaseController {
.collect(Collectors.toList()); .collect(Collectors.toList());
return R.fail(400, "参数验证失败: " + String.join(", ", errors)); return R.fail(400, "参数验证失败: " + String.join(", ", errors));
} }
if (dto.getParentId() == null) {
return R.fail("父级有误");
}
if (dto.getLevel() == null) {
return R.fail("级别有误");
}
// 查询档案名称是否重复 // 查询档案名称是否重复
Integer i = fileManageMapper.selectFileManage(dto); Integer i = fileManageMapper.selectFileManage(dto);
if (i > 0) { if (i > 0) {
@ -201,38 +195,28 @@ public class FileManagementController extends BaseController {
} }
} }
@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 = "修改档案") @ApiOperation(value = "修改档案")
@PostMapping("updateFileManageRight") @PostMapping("updateFileManageRight")
@SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1) @SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1)
@RequiresPermissions("file:manage:update") @RequiresPermissions("file:manage:update")
public R updateFileManage(@ModelAttribute @Validated DaKyProFilesContentsVo dto, @RequestParam("file") MultipartFile file) { public R updateFileManage(@RequestPart("file") MultipartFile file,
@RequestParam("params") String params) {
try { try {
ObjectMapper objectMapper = new ObjectMapper();
DaKyProFilesContentsVo dto = objectMapper.readValue(params, DaKyProFilesContentsVo.class);
// 手动验证
ValidatorFactory factory = Validation.buildDefaultValidatorFactory();
Validator validator = factory.getValidator();
Set<ConstraintViolation<DaKyProFilesContentsVo>> violations = validator.validate(dto);
if (!violations.isEmpty()) {
// 处理验证错误
List<String> errors = violations.stream()
.map(ConstraintViolation::getMessage)
.collect(Collectors.toList());
return R.fail(400, "参数验证失败: " + String.join(", ", errors));
}
dto.setUpdateUserId(getLoginUser().getUserId()); dto.setUpdateUserId(getLoginUser().getUserId());
dto.setUpdateUserName(getLoginUser().getUsername()); dto.setUpdateUserName(getLoginUser().getUsername());
Integer i = fileManageMapper.selectFileManage(dto); Integer i = fileManageMapper.selectFileManage(dto);
@ -265,6 +249,26 @@ public class FileManagementController extends BaseController {
} }
} }
@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 {
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 = "修改档案") @ApiOperation(value = "修改档案")
@PostMapping("updateFileManageLeft") @PostMapping("updateFileManageLeft")
@SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1) @SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1)

View File

@ -55,6 +55,7 @@ public class DaKyProFilesContentsDto {
/** /**
* 层级 * 层级
*/ */
@NotNull(message = "级别不能为空")
private Integer level; private Integer level;
/** /**

View File

@ -41,6 +41,7 @@ public class DaKyProFilesContentsVo {
/** /**
* 层级 * 层级
*/ */
@NotNull(message = "级别不能为空")
private Integer level; private Integer level;
/** /**
@ -71,6 +72,7 @@ public class DaKyProFilesContentsVo {
/** /**
* 归档责任单位 * 归档责任单位
*/ */
@NotBlank(message = "归档责任单位不能为空")
private String unitName; private String unitName;
/** /**

View File

@ -226,6 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
SELECT SELECT
dkpfc.*, dkpfc.*,
dkfs.id AS fileId, dkfs.id AS fileId,
dkfs.business_id AS businessId,
dkfs.file_name AS fileName, dkfs.file_name AS fileName,
CASE CASE
WHEN dkpfc.data_source = '1' THEN WHEN dkpfc.data_source = '1' THEN