From 0bc016f7cad903d926ec9a9e1e9a4c32010c7689 Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Wed, 10 Jan 2024 17:03:32 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=A4=8D=E6=A0=B8=E9=80=BB=E8=BE=91?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../safeproduct/dto/SafetyToolBatchRecheckDTO.java | 5 ++++ .../service/impl/SafetyToolServiceImpl.java | 35 ++++------------------ 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/SafetyToolBatchRecheckDTO.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/SafetyToolBatchRecheckDTO.java index 57113f7..2f26f6f 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/SafetyToolBatchRecheckDTO.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/dto/SafetyToolBatchRecheckDTO.java @@ -7,6 +7,8 @@ import org.springblade.core.tool.utils.StringUtil; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotEmpty; import java.io.Serializable; +import java.time.LocalDateTime; +import java.util.Date; import java.util.Set; /** @@ -24,6 +26,9 @@ public class SafetyToolBatchRecheckDTO implements Serializable { @NotEmpty(message = "安全工器具ID集合不能为空") private Set toolIds; + @ApiModelProperty(value = "复核时间") + private Date checkTime; + @ApiModelProperty(value = "备注") @NotBlank(message = "备注不能为空") private String remark; diff --git a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java index bc335a6..3255a0d 100644 --- a/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java +++ b/hzims-service/safeproduct/src/main/java/com/hnac/hzims/safeproduct/service/impl/SafetyToolServiceImpl.java @@ -127,37 +127,16 @@ public class SafetyToolServiceImpl extends BaseServiceImpl safetyTools = safetyToolMapper.selectBatchIds(req.getToolIds()); for (SafetyToolEntity item : safetyTools) { - item.setLastCheckTime(currentTime); - item.setNextCheckTime(DateUtil.plusDays(currentTime, Long.valueOf(item.getSafeTime().toString()))); - - String noticeUsers = item.getNoticeUsers(); - if (!StringUtils.isEmpty(noticeUsers)) { - String[] split = noticeUsers.split(","); - for (String s : split) { - PlanMsgRecordDto planMsgRecordDtoDto = new PlanMsgRecordDto(); - planMsgRecordDtoDto.setTemplateId(item.getMessageTemplateId()); - planMsgRecordDtoDto.setTaskId(item.getId()); - planMsgRecordDtoDto.setDeptId(item.getCurSts()); - planMsgRecordDtoDto.setCreateUser(item.getCreateUser()); - planMsgRecordDtoDto.setReceiver(Long.valueOf(s)); - ZoneId zoneId = ZoneId.systemDefault(); - Date nextCheckTime = item.getNextCheckTime(); - planMsgRecordDtoDto.setPlanTime(nextCheckTime.toInstant().atZone(zoneId).toLocalDateTime()); - TemplateService templateService1 = - templateService.stream().filter(item1 -> item1.isTemplateStatus(1)).findFirst().orElse(null); - templateService1.execute(planMsgRecordDtoDto); - } - - } - + item.setLastCheckTime(checkTime); + item.setNextCheckTime(DateUtil.plusDays(checkTime, Long.valueOf(item.getSafeTime().toString()))); } if (!super.updateBatchById(safetyTools)) { - throw new RuntimeException("数据库update操作失败!"); + throw new ServiceException("数据库update操作失败!"); } //插入复核记录 @@ -167,15 +146,13 @@ public class SafetyToolServiceImpl extends BaseServiceImpl