|
|
@ -276,98 +276,78 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
log.error("获取工作票的数据为不存在"); |
|
|
|
log.error("获取工作票的数据为不存在"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
//更新工作票
|
|
|
|
//更新工作票
|
|
|
|
workTicket.setId(workTicketInfo.getId()); |
|
|
|
workTicket.setId(workTicketInfo.getId()); |
|
|
|
//保存流程描述
|
|
|
|
//保存流程描述
|
|
|
|
workTicketInfo.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicketInfo.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicket.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
workTicket.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
saveWorkTicket(workTicket, response); |
|
|
|
saveWorkTicket(workTicket, response); |
|
|
|
//工作流ID
|
|
|
|
//工作流ID
|
|
|
|
workTicket.setProcessInstanceId(response.getProcessInstanceId()); |
|
|
|
workTicket.setProcessInstanceId(response.getProcessInstanceId()); |
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//更新安全措施
|
|
|
|
//更新安全措施
|
|
|
|
try { |
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
|
List<WorkTicketSafetyMeasureEntity> safetyMeasuresList = workTicketVo.getSafetyMeasuresList(); |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(safetyMeasuresList)) { |
|
|
|
log.info("获取安全措施的数据:{}", safetyMeasuresList); |
|
|
|
log.info("获取安全措施的数据:{}", safetyMeasuresList); |
|
|
|
for (WorkTicketSafetyMeasureEntity item : safetyMeasuresList) { |
|
|
|
for (WorkTicketSafetyMeasureEntity item : safetyMeasuresList) { |
|
|
|
if (ObjectUtils.isNotEmpty(item.getId())) { |
|
|
|
if (ObjectUtils.isNotEmpty(item.getId())) { |
|
|
|
workTicketSafetyMeasureService.updateById(item); |
|
|
|
workTicketSafetyMeasureService.updateById(item); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
item.setTicketId(workTicketInfo.getId()); |
|
|
|
item.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketSafetyMeasureService.save(item); |
|
|
|
workTicketSafetyMeasureService.save(item); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 第二种 工作票工作任务组
|
|
|
|
// 第二种 工作票工作任务组
|
|
|
|
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); |
|
|
|
List<WorkTicketContentEntity> workTicketContentDtoList = workTicketVo.getWorkTicketContentDtoList(); |
|
|
|
try { |
|
|
|
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { |
|
|
|
if (CollectionUtils.isNotEmpty(workTicketContentDtoList)) { |
|
|
|
log.info("获取工作票工作任务组:{}", workTicketContentDtoList); |
|
|
|
log.info("获取工作票工作任务组:{}", workTicketContentDtoList); |
|
|
|
workTicketContentDtoList.forEach(item -> { |
|
|
|
workTicketContentDtoList.forEach(item -> { |
|
|
|
if (ObjectUtils.isEmpty(item.getId())) { |
|
|
|
if (ObjectUtils.isEmpty(item.getId())) { |
|
|
|
contentService.save(item); |
|
|
|
contentService.save(item); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
contentService.updateById(item); |
|
|
|
contentService.updateById(item); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 工作票延期
|
|
|
|
// 工作票延期
|
|
|
|
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); |
|
|
|
WorkTicketDelayEntity workTicketDelay = workTicketVo.getWorkTicketDelay(); |
|
|
|
try { |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketDelay) && "延期".equals(workTicket.getInput())) { |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketDelay) && "延期".equals(workTicket.getInput())) { |
|
|
|
|
|
|
|
|
|
|
|
WorkTicketDelayEntity workTicketDelayEntity = workTicketDelayService.selectByTicketId(workTicketInfo.getId()); |
|
|
|
WorkTicketDelayEntity workTicketDelayEntity = workTicketDelayService.selectByTicketId(workTicketInfo.getId()); |
|
|
|
log.info("获取工作票延期:{}", workTicketDelay); |
|
|
|
log.info("获取工作票延期:{}", workTicketDelay); |
|
|
|
workTicketDelay.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicketDelay.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicketDelay.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketDelay.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketDelay.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
workTicketDelay.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
if (ObjectUtils.isEmpty(workTicketDelayEntity)) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketDelayEntity)) { |
|
|
|
log.info("正在保存工作票延期"); |
|
|
|
log.info("正在保存工作票延期"); |
|
|
|
workTicketDelayService.save(workTicketDelay); |
|
|
|
workTicketDelayService.save(workTicketDelay); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.info("正在更新工作票延期"); |
|
|
|
log.info("正在更新工作票延期"); |
|
|
|
workTicketDelayService.updateByTicketId(workTicketDelay); |
|
|
|
workTicketDelayService.updateByTicketId(workTicketDelay); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工作结束
|
|
|
|
//工作结束
|
|
|
|
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); |
|
|
|
WorkTicketFinish workTicketFinish = workTicketVo.getWorkTicketFinish(); |
|
|
|
try { |
|
|
|
log.info("工作结束==============>" + (workTicket.getFlowStatus().intValue())); |
|
|
|
log.info("工作结束==============>" + (workTicket.getFlowStatus().intValue())); |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketFinish)) { |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketFinish)) { |
|
|
|
WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId()); |
|
|
|
WorkTicketFinish ticketFinish = workTicketFinishService.selectByTicketId(workTicketInfo.getId()); |
|
|
|
log.info("获取工作结束:{}", workTicketFinish); |
|
|
|
log.info("获取工作结束:{}", workTicketFinish); |
|
|
|
if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketFinish.getId()) || ObjectUtils.isEmpty(ticketFinish)) { |
|
|
|
log.info("获取工作结束保存成功"); |
|
|
|
log.info("获取工作结束保存成功"); |
|
|
|
workTicketFinish.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketFinish.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketFinishService.save(workTicketFinish); |
|
|
|
workTicketFinishService.save(workTicketFinish); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.info("获取工作结束更新成功"); |
|
|
|
log.info("获取工作结束更新成功"); |
|
|
|
workTicketDelay.setInitialTime(LocalDateTime.now()); |
|
|
|
workTicketDelay.setInitialTime(LocalDateTime.now()); |
|
|
|
workTicketFinishService.updateByTicketId(workTicketFinish); |
|
|
|
workTicketFinishService.updateByTicketId(workTicketFinish); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 工作开始时间和结束时间
|
|
|
|
// 工作开始时间和结束时间
|
|
|
|
// List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
|
|
|
|
// List<WorkTicketOperateTimeEntity> workTicketOperateTimeEntities = workTicketVo.getWorkTicketOperateTimeEntities();
|
|
|
|
// if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) {
|
|
|
|
// if (CollectionUtils.isNotEmpty(workTicketOperateTimeEntities)) {
|
|
|
@ -376,58 +356,50 @@ public class TicketProcessServiceImpl implements TicketProcessService { |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
//工作票负责人变更
|
|
|
|
//工作票负责人变更
|
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); |
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChange = workTicketVo.getWorkTicketPrincipalChange(); |
|
|
|
try { |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && "转移".equals(workTicket.getInput())) { |
|
|
|
if (ObjectUtils.isNotEmpty(workTicketPrincipalChange) && "转移".equals(workTicket.getInput())) { |
|
|
|
log.info("工作票负责人变更: {}", workTicketPrincipalChange); |
|
|
|
log.info("工作票负责人变更: {}", workTicketPrincipalChange); |
|
|
|
//原来的负责人
|
|
|
|
//原来的负责人
|
|
|
|
User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal()); |
|
|
|
User user = UserCache.getUser(workTicketPrincipalChange.getInitialPrincipal()); |
|
|
|
//新的负责人
|
|
|
|
//新的负责人
|
|
|
|
User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
User newUser = UserCache.getUser(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
workTicketPrincipalChange.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicketPrincipalChange.setCreateDept(workTicketInfo.getCreateDept()); |
|
|
|
workTicketPrincipalChange.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketPrincipalChange.setTicketId(workTicketInfo.getId()); |
|
|
|
workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
workTicketPrincipalChange.setTenantId(workTicketInfo.getTenantId()); |
|
|
|
if (workTicketPrincipalChange.getFlowCode() == null) { |
|
|
|
if (workTicketPrincipalChange.getFlowCode() == null) { |
|
|
|
workTicketPrincipalChange.setFlowCode(IdWorker.getIdStr()); |
|
|
|
workTicketPrincipalChange.setFlowCode(IdWorker.getIdStr()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = workTicketPrincipalChangeService.selectByTicketId(workTicket.getId()); |
|
|
|
WorkTicketPrincipalChangeEntity workTicketPrincipalChangeEntity = workTicketPrincipalChangeService.selectByTicketId(workTicket.getId()); |
|
|
|
|
|
|
|
|
|
|
|
if (ObjectUtils.isEmpty(workTicketPrincipalChangeEntity)) { |
|
|
|
if (ObjectUtils.isEmpty(workTicketPrincipalChangeEntity)) { |
|
|
|
log.info("工作票负责人保存变更"); |
|
|
|
log.info("工作票负责人保存变更"); |
|
|
|
workTicketPrincipalChangeService.save(workTicketPrincipalChange); |
|
|
|
workTicketPrincipalChangeService.save(workTicketPrincipalChange); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
log.info("工作票负责人更新变更"); |
|
|
|
log.info("工作票负责人更新变更"); |
|
|
|
workTicketPrincipalChangeService.updateByTicketId(workTicketPrincipalChange); |
|
|
|
workTicketPrincipalChangeService.updateByTicketId(workTicketPrincipalChange); |
|
|
|
} |
|
|
|
|
|
|
|
log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName()); |
|
|
|
|
|
|
|
workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
|
|
|
|
workTicket.setPrincipalName(newUser.getName()); |
|
|
|
|
|
|
|
//更新工作票
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
log.info("工作负责人变更 原来的负责人 {},变更为 {}", user.getName(), newUser.getName()); |
|
|
|
e.printStackTrace(); |
|
|
|
workTicket.setPrincipal(workTicketPrincipalChange.getChangePrincipal()); |
|
|
|
|
|
|
|
workTicket.setPrincipalName(newUser.getName()); |
|
|
|
|
|
|
|
//更新工作票
|
|
|
|
|
|
|
|
workTicketInfoService.updateById(workTicket); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//工作票危险点分析及控制措施票
|
|
|
|
//工作票危险点分析及控制措施票
|
|
|
|
try { |
|
|
|
if (workTicket.getIsHazard()) { |
|
|
|
if (workTicket.getIsHazard()) { |
|
|
|
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers(); |
|
|
|
List<TicketInfoDanger> ticketInfoDangers = workTicketVo.getTicketInfoDangers(); |
|
|
|
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { |
|
|
|
if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { |
|
|
|
List<TicketInfoDanger> collect = ticketInfoDangers.stream().map(item -> { |
|
|
|
List<TicketInfoDanger> collect = ticketInfoDangers.stream().map(item -> { |
|
|
|
item.setTicketId(workTicketInfo.getId()); |
|
|
|
item.setTicketId(workTicketInfo.getId()); |
|
|
|
return item; |
|
|
|
return item; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
System.out.println("工作票危险点分析及控制措施票 : " + collect); |
|
|
|
System.out.println("工作票危险点分析及控制措施票 : " + collect); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ticketInfoDangerService.saveBatch(collect); |
|
|
|
ticketInfoDangerService.saveBatch(collect); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|