修改ai工单

This commit is contained in:
lcj
2025-09-04 22:25:10 +08:00
parent 3f3e20a64b
commit ab5cd491d6
2 changed files with 30 additions and 13 deletions

View File

@ -28,13 +28,11 @@ public class HseViolationRecordCreateHandlerReq implements Serializable {
/**
* 整改单位(1分包 2班组)
*/
@NotBlank(message = "整改单位为空")
private String rectificationUnit;
/**
* 整改单位id
*/
@NotNull(message = "整改单位id不能为空")
private Long rectificationId;
/**
@ -45,10 +43,13 @@ public class HseViolationRecordCreateHandlerReq implements Serializable {
/**
* 处理期限
*/
@NotNull(message = "处理期限不能为空")
@Future(message = "处理期限不能小于当前时间")
private LocalDate disposeDeadline;
/**
* 是否回复
*/
private String processType;
/**
* 备注
*/

View File

@ -222,16 +222,32 @@ public class HseViolationRecordServiceImpl extends ServiceImpl<HseViolationRecor
if (oldViolationRecord == null) {
throw new ServiceException("违规记录信息不存在", HttpStatus.NOT_FOUND);
}
String processType = req.getProcessType();
HseViolationRecord violationRecord = new HseViolationRecord();
if (Objects.equals(processType, "0")) {
// 仅通知
violationRecord.setProcessType(processType);
} else if (Objects.equals(processType, "1")) {
// 判断字段是否为空
if (StringUtils.isBlank(req.getRectificationUnit()) || req.getRectificationId() == null) {
throw new ServiceException("整改单位信息不能为空", HttpStatus.BAD_REQUEST);
}
LocalDate disposeDeadline = req.getDisposeDeadline();
if (disposeDeadline == null || disposeDeadline.isBefore(LocalDate.now())) {
throw new ServiceException("整改期限不能小于当前时间", HttpStatus.BAD_REQUEST);
}
// 整改
Long correctorId = req.getCorrectorId();
SysUserVo user = userService.selectUserById(correctorId);
if (user == null) {
throw new ServiceException("处理人信息不存在", HttpStatus.NOT_FOUND);
}
HseViolationRecord violationRecord = new HseViolationRecord();
violationRecord.setId(id);
violationRecord.setCorrectorId(correctorId);
violationRecord.setDisposeDeadline(req.getDisposeDeadline());
violationRecord.setDisposeDeadline(disposeDeadline);
violationRecord.setProcessType(processType);
violationRecord.setRemark(req.getRemark());
}
boolean result = this.updateById(violationRecord);
if (!result) {
throw new ServiceException("更新处理人操作失败", HttpStatus.ERROR);