代码提交
This commit is contained in:
parent
18ba436a1d
commit
97f0609fac
|
|
@ -154,12 +154,6 @@ public class FileManagementController extends BaseController {
|
|||
.collect(Collectors.toList());
|
||||
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);
|
||||
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 = "修改档案")
|
||||
@PostMapping("updateFileManageRight")
|
||||
@SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1)
|
||||
@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 {
|
||||
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.setUpdateUserName(getLoginUser().getUsername());
|
||||
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 = "修改档案")
|
||||
@PostMapping("updateFileManageLeft")
|
||||
@SysLog(title = "修改档案", module = "档案管理->档案目录管理", businessType = OperaType.UPDATE, details = "修改档案", logType = 1)
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ public class DaKyProFilesContentsDto {
|
|||
/**
|
||||
* 层级
|
||||
*/
|
||||
@NotNull(message = "级别不能为空")
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ public class DaKyProFilesContentsVo {
|
|||
/**
|
||||
* 层级
|
||||
*/
|
||||
@NotNull(message = "级别不能为空")
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
|
|
@ -71,6 +72,7 @@ public class DaKyProFilesContentsVo {
|
|||
/**
|
||||
* 归档责任单位
|
||||
*/
|
||||
@NotBlank(message = "归档责任单位不能为空")
|
||||
private String unitName;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -226,6 +226,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
SELECT
|
||||
dkpfc.*,
|
||||
dkfs.id AS fileId,
|
||||
dkfs.business_id AS businessId,
|
||||
dkfs.file_name AS fileName,
|
||||
CASE
|
||||
WHEN dkpfc.data_source = '1' THEN
|
||||
|
|
|
|||
Loading…
Reference in New Issue