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