|
|
@ -127,37 +127,16 @@ public class SafetyToolServiceImpl extends BaseServiceImpl<SafetyToolMapper, Saf |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void doBatchRecheck(SafetyToolBatchRecheckDTO req) { |
|
|
|
public void doBatchRecheck(SafetyToolBatchRecheckDTO req) { |
|
|
|
//更新工器具记录数据
|
|
|
|
//更新工器具记录数据
|
|
|
|
Date currentTime = new Date(); |
|
|
|
Date checkTime = Func.isNotEmpty(req.getCheckTime()) ? req.getCheckTime() : new Date(); |
|
|
|
Long userId = AuthUtil.getUserId(); |
|
|
|
Long userId = AuthUtil.getUserId(); |
|
|
|
String userName = AuthUtil.getUserName(); |
|
|
|
String userName = AuthUtil.getUserName(); |
|
|
|
List<SafetyToolEntity> safetyTools = safetyToolMapper.selectBatchIds(req.getToolIds()); |
|
|
|
List<SafetyToolEntity> safetyTools = safetyToolMapper.selectBatchIds(req.getToolIds()); |
|
|
|
for (SafetyToolEntity item : safetyTools) { |
|
|
|
for (SafetyToolEntity item : safetyTools) { |
|
|
|
item.setLastCheckTime(currentTime); |
|
|
|
item.setLastCheckTime(checkTime); |
|
|
|
item.setNextCheckTime(DateUtil.plusDays(currentTime, Long.valueOf(item.getSafeTime().toString()))); |
|
|
|
item.setNextCheckTime(DateUtil.plusDays(checkTime, 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); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
if (!super.updateBatchById(safetyTools)) { |
|
|
|
if (!super.updateBatchById(safetyTools)) { |
|
|
|
throw new RuntimeException("数据库update操作失败!"); |
|
|
|
throw new ServiceException("数据库update操作失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//插入复核记录
|
|
|
|
//插入复核记录
|
|
|
@ -167,15 +146,13 @@ public class SafetyToolServiceImpl extends BaseServiceImpl<SafetyToolMapper, Saf |
|
|
|
entity.setCheckUserName(userName); |
|
|
|
entity.setCheckUserName(userName); |
|
|
|
entity.setCheckUserId(userId); |
|
|
|
entity.setCheckUserId(userId); |
|
|
|
entity.setToolId(item.getId()); |
|
|
|
entity.setToolId(item.getId()); |
|
|
|
entity.setCheckTime(currentTime); |
|
|
|
entity.setCheckTime(checkTime); |
|
|
|
entity.setRemark(req.getRemark()); |
|
|
|
entity.setRemark(req.getRemark()); |
|
|
|
safetyToolRechecks.add(entity); |
|
|
|
safetyToolRechecks.add(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
if (safetyToolRecheckMapper.insertBatch(safetyToolRechecks) == 0) { |
|
|
|
if (safetyToolRecheckMapper.insertBatch(safetyToolRechecks) == 0) { |
|
|
|
throw new RuntimeException("数据库insert操作失败!"); |
|
|
|
throw new ServiceException("数据库insert操作失败!"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|