From 64f30a971e70f6afda4d4bce9605bbf1327a850a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Mon, 19 Jun 2023 14:13:46 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9EDefectProcessServiceImpl?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E5=B7=A5=E4=BD=9C=E7=A5=A8=EF=BC=8C?= =?UTF-8?q?=E6=93=8D=E4=BD=9C=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../process/constant/TicketProcessConstant.java | 6 + .../serviceimpl/DefectProcessServiceImpl.java | 67 +++++++ .../MachineryTicketProcessServiceImpl.java | 8 +- .../OperationTicketProcessServiceImpl.java | 8 +- .../service/impl/OperationTicketServiceImpl.java | 21 +-- .../controller/TicketProcessController.java | 1 + .../service/impl/TicketProcessServiceImpl.java | 200 +++++++++------------ 7 files changed, 175 insertions(+), 136 deletions(-) create mode 100644 hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java diff --git a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java index 23c173e..7770383 100644 --- a/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java +++ b/hzims-service-api/middle-api/src/main/java/com/hnac/hzims/middle/process/constant/TicketProcessConstant.java @@ -29,4 +29,10 @@ public class TicketProcessConstant { * 日常维护 */ public static final String MAINTENANCE_KEY = "maintenance"; + + + /** + * 消缺流程 + */ + public static final String DEFECT_KEY = "defectDealty"; } diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java new file mode 100644 index 0000000..95bab8f --- /dev/null +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/DefectProcessServiceImpl.java @@ -0,0 +1,67 @@ +package com.hnac.hzims.middle.processflow.strategy.serviceimpl; + +import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; +import com.hnac.hzims.middle.processflow.service.ProcessDictService; +import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; +import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import com.hnac.hzims.operational.defect.feign.IOperDefectClient; +import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.springblade.core.log.exception.ServiceException; +import org.springblade.core.tool.api.R; +import org.springframework.stereotype.Service; +import static com.hnac.hzims.middle.process.constant.TicketProcessConstant.DEFECT_KEY; + + +/** + * 消缺工作流实现类 + * + * @Author dfy + * @Version v1.0 + * @Serial 1.0 + * @Date 2023/3/28 8:47 + */ +@Slf4j +@Service +@RequiredArgsConstructor +public class DefectProcessServiceImpl extends ProcessAbstractService { + + + private final IOperDefectClient defectClient; + + + private final ProcessDictService processDictService; + + + /** + * 设置执行那种实现类 + * + * @param flowQueue + * @return + */ + @Override + public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { + log.info("是否执行消缺工作流实流程环节操作~~~~,流程ticket: {}", flowQueue); + String dictValue = processDictService.selectDictValueByKey(DEFECT_KEY); + if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { + log.info("已执行消缺工作流程环节操作~~~~"); + return true; + } + log.error("未是否执行消缺工作流流程环节操作,请联系管理员~~~~"); + return false; + } + + /** + * 两票管理业务方法 + * + * @param response + */ + @Override + public void calculate(ProcessWorkFlowResponse response) { + R defect = defectClient.saveDefect(response); + if (!defect.isSuccess()) { + throw new ServiceException("消缺工作流程出现异常呢"); + + } + } +} diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java index ac68fc7..42d6ed1 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/MachineryTicketProcessServiceImpl.java @@ -4,7 +4,7 @@ import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.processflow.service.ProcessDictService; import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; -import com.hnac.hzims.ticket.ticketprocess.feign.OperationTicketFeignClient; +import com.hnac.hzims.ticket.ticketprocess.feign.TicketProcessFeignClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.log.exception.ServiceException; @@ -28,7 +28,7 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService { - private final OperationTicketFeignClient ticketProcessService; + private final TicketProcessFeignClient ticketProcessService; @@ -36,10 +36,6 @@ public class MachineryTicketProcessServiceImpl extends ProcessAbstractService { - - - - /** * 设置执行那种实现类 * diff --git a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java index f3ab75d..1d8d70b 100644 --- a/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java +++ b/hzims-service/hzims-middle/src/main/java/com/hnac/hzims/middle/processflow/strategy/serviceimpl/OperationTicketProcessServiceImpl.java @@ -4,6 +4,7 @@ import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; import com.hnac.hzims.middle.processflow.service.ProcessDictService; import com.hnac.hzims.middle.processflow.strategy.abstracts.ProcessAbstractService; import com.hnac.hzims.middle.processflow.strategy.entity.WorkflowQueue; +import com.hnac.hzims.ticket.ticketprocess.feign.OperationTicketFeignClient; import com.hnac.hzims.ticket.ticketprocess.feign.TicketProcessFeignClient; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; @@ -28,7 +29,7 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService { - private final TicketProcessFeignClient operationTicketService; + private final OperationTicketFeignClient operationTicketFeignClient; @@ -44,7 +45,7 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService { */ @Override public Boolean isWorkflowProcess(WorkflowQueue flowQueue) { - log.info("是否执行开操作票流程环节操作~~~~,流程flowQueue: {}", flowQueue); + log.info("是否执行操作票流程环节操作~~~~,流程flowQueue: {}", flowQueue); String dictValue = processDictService.selectDictValueByKey(OPERATION_TICKET_KEY); if (dictValue.equals(flowQueue.getProcessDefinitionKey())) { log.info("已执行操作票流程环节操作~~~~"); @@ -61,10 +62,9 @@ public class OperationTicketProcessServiceImpl extends ProcessAbstractService { */ @Override public void calculate(ProcessWorkFlowResponse response) { - Boolean pending = operationTicketService.findPending(response); + Boolean pending = operationTicketFeignClient.findPending(response); if (!pending) { throw new ServiceException("操作票流程出现异常呢"); - } } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java index 722c0d9..7b94004 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java @@ -77,7 +77,6 @@ public class OperationTicketServiceImpl implements OperationTicketService { private final ProcessDictFeignService processDictFeignService; - private final IFlowClient flowClient; @@ -158,7 +157,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { log.info("获取下一个审批人是: {} ", response.getNextStepOperator()); log.info("获取下一个用户Id是: {} ", response.getUserId()); log.info("获取当前任务名称是: {} ", response.getTaskName()); - log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType()); + log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType()); //json转换表单 String formData = JSON.toJSONString(response.getVariables()); log.info("获取表单的数据:{}", formData); @@ -168,9 +167,9 @@ public class OperationTicketServiceImpl implements OperationTicketService { standardTicketInfoVo = JSONObject.toJavaObject(jsonObject, StandardTicketInfoVo.class); } catch (Exception e) { log.error("获取表单出现异常了~~~~"); + e.printStackTrace(); throw new IllegalArgumentException(e.getMessage()); } - //1.查询操作票信息 Long id = NumberUtils.toLong(response.getBusinessKey()); StandardTicketInfoEntity standardTicketInfoEntity = standardTicketInfoService.getById(id); @@ -197,8 +196,6 @@ public class OperationTicketServiceImpl implements OperationTicketService { }).collect(Collectors.toList()); standardTicketMeasureService.updateBatchById(standardTicketMeasureEntities); } - - //推送消息 if (response.getTaskId() != null) { MessagePushRecordDto message = new MessagePushRecordDto(); @@ -238,6 +235,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { messageClient.sendMessage(message); } } + } @@ -379,8 +377,6 @@ public class OperationTicketServiceImpl implements OperationTicketService { } - - /** * 新预览 * @@ -398,7 +394,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { StandardTicketInfoVo standardTicketInfoVo = standardTicketInfoService.selectDetailsById(ticketId); //将查询的数据转换为map Map workTicketInfoMap = this.convertMap(standardTicketInfoVo); - //导入下在word + //导入下在word Map resultMap = OperationWordHelper.resultMap(workTicketInfoMap); String workTicketStatus = OperationWordHelper.getWorkTicketStatus(status); String os = TicketConstant.OS_NAME; @@ -421,6 +417,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { /** * 将查询的数据转换为map + * * @param standardTicketInfoVo * @return */ @@ -439,17 +436,17 @@ public class OperationTicketServiceImpl implements OperationTicketService { map.put("index", index.get()); map.put("status", TicketConstants.MATTER_FINISH_STATUS.equals(measure.getStatus()) ? "√" : ""); map.put("operationTime", measure.getOperationTime()); - map.put("hello",""); - map.put("hello1",""); + map.put("hello", ""); + map.put("hello1", ""); index.getAndIncrement(); measureMapLists.add(map); } result.put("measureMapList", measureMapLists); - }else { + } else { result.put("measureMapList", new ArrayList<>()); } - WordMapUtils.newMapWithList("measureMapList",result,false,17,null); + WordMapUtils.newMapWithList("measureMapList", result, false, 17, null); return result; } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java index 2a18960..c0d95ca 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/controller/TicketProcessController.java @@ -58,6 +58,7 @@ public class TicketProcessController { ticketProcessService.findPending(response); return true; } catch (Exception e) { + e.printStackTrace(); throw new ServiceException("工作票待处理:" + e.getMessage()); } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 2b71d51..eed6a7e 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -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 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 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 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 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 ticketInfoDangers = workTicketVo.getTicketInfoDangers(); - if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { - List collect = ticketInfoDangers.stream().map(item -> { - item.setTicketId(workTicketInfo.getId()); - return item; - }).collect(Collectors.toList()); + if (workTicket.getIsHazard()) { + List ticketInfoDangers = workTicketVo.getTicketInfoDangers(); + if (CollectionUtils.isNotEmpty(ticketInfoDangers)) { + List 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(); } From 75f744ee1c95a6d9a5e0260c29dd6b59e3073cfc Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 19 Jun 2023 15:56:09 +0800 Subject: [PATCH 2/3] =?UTF-8?q?#=E5=AE=9A=E6=97=B6=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=8A=BD=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ecology/entity/EcologyFlowStationEntity.java | 2 ++ .../operational/main/vo/AppHydropowerDeviceVo.java | 4 ++++ .../operational/main/vo/HydropowerUnitRealVo.java | 3 +++ .../operation/impl/RealTargetServiceImpl.java | 2 +- .../ecology/controller/EcologyController.java | 10 +++++----- .../ecology/service/EcologyFlowStationService.java | 4 ++-- .../service/impl/EcologyFlowStationServiceImpl.java | 20 ++++++++++++++------ .../main/scheduled/ScheduledCreateTask.java | 7 ++----- .../main/service/impl/HomeServiceImpl.java | 4 ++-- .../main/service/impl/HydropowerServiceImpl.java | 4 +++- 10 files changed, 38 insertions(+), 22 deletions(-) diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java index ce4d7e8..48ee5b1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/ecology/entity/EcologyFlowStationEntity.java @@ -19,6 +19,8 @@ public class EcologyFlowStationEntity extends TenantEntity { private String stationName; + private String city; + private Long isOnLine; private Long isDemonstrate; diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java index 604bd60..20a1cd1 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/AppHydropowerDeviceVo.java @@ -2,6 +2,7 @@ package com.hnac.hzims.operational.main.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import io.swagger.models.auth.In; import lombok.Data; /** @@ -28,4 +29,7 @@ public class AppHydropowerDeviceVo { @ApiModelProperty(value = "负荷单位") private String loadUnit; + + @ApiModelProperty(value = "排序") + private Integer ord; } diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java index f4cf2f8..9784d6c 100644 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/main/vo/HydropowerUnitRealVo.java @@ -61,4 +61,7 @@ public class HydropowerUnitRealVo { @ApiModelProperty(value = "电流单位") private String currentUnit; + + @ApiModelProperty(value = "排序") + private Integer ord; } diff --git a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java index 55fb6d7..a008be8 100644 --- a/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java +++ b/hzims-service/hzims-scheduled/src/main/java/com/hnac/hzims/scheduled/service/operation/impl/RealTargetServiceImpl.java @@ -1186,7 +1186,7 @@ public class RealTargetServiceImpl implements RealTargetService { */ private int getPhotovoltaicState(EminfoAndEmParamVo device, Map map) { // 获取开关机监测点实时数据 - Double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY); + double value = this.getSignageValue(device, map, HomePageConstant.PV_JOINT_RELAY); // 开机状态 if (Math.abs(value) <= 0) { return 0; diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java index 3973568..f9f2e35 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/controller/EcologyController.java @@ -51,11 +51,11 @@ public class EcologyController extends BladeController { * 站点数据排行 * @return */ - @PostMapping("/station_top") + @PostMapping("/station_top") @ApiOperationSupport(order = 1) @ApiOperation(value = "站点数据及达标率排行", notes = "站点数据及达标率排行") - public R station_top() { - return R.data(stationService.station_top()); + public R station_top(@RequestParam String city) { + return R.data(stationService.station_top(city)); } /** @@ -65,8 +65,8 @@ public class EcologyController extends BladeController { @PostMapping("/trend_chart") @ApiOperationSupport(order = 1) @ApiOperation(value = "指标趋势图", notes = "指标趋势图") - public R trend_chart(@RequestParam String type) { - return R.data(stationService.trend_chart(type)); + public R trend_chart(@RequestParam String city,@RequestParam String type) { + return R.data(stationService.trend_chart(city,type)); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java index ba6ba2a..d129ab9 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/EcologyFlowStationService.java @@ -14,12 +14,12 @@ import java.util.List; */ public interface EcologyFlowStationService extends BaseService { - EcologFlowStationVo station_top(); + EcologFlowStationVo station_top(String city); Boolean generate(Long mon,String year); - List trend_chart(String type); + List trend_chart(String city,String type); List station(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java index bf9dbc4..fbbcda1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/ecology/service/impl/EcologyFlowStationServiceImpl.java @@ -98,8 +98,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl stations = this.list(); + public EcologFlowStationVo station_top(String city) { + List stations = this.list(Wrappers.lambdaQuery() + .eq(EcologyFlowStationEntity::getCity,city)); if(CollectionUtil.isEmpty(stations)){ return new EcologFlowStationVo(); } @@ -110,8 +111,9 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl o.getIsTimely().equals(1L)).count() / (double) stations.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); station.setCount(stations.size()); - List datas = dataService.list(Wrappers.lambdaQuery(). - like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM"))); + List datas = dataService.list(Wrappers.lambdaQuery() + .like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy-MM")) + .in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList()))); if(CollectionUtil.isEmpty(datas)){ return station; } @@ -132,8 +134,14 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl trend_chart(String type) { + public List trend_chart(String city,String type) { + List stations = this.list(Wrappers.lambdaQuery() + .eq(EcologyFlowStationEntity::getCity,city)); + if(CollectionUtil.isEmpty(stations)){ + return new ArrayList<>(); + } LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); + wrapper.in(EcologyFlowDataEntity::getStationId,stations.stream().map(EcologyFlowStationEntity::getStationId).collect(Collectors.toList())); if("0".equals(type)){ wrapper.like(EcologyFlowDataEntity::getMon, DateUtil.format(new Date(),"yyyy")); } @@ -179,7 +187,7 @@ public class EcologyFlowStationServiceImpl extends BaseServiceImpl station() { List stations = stationService.list(Wrappers.lambdaQuery() - .in(StationEntity::getCode,Arrays.asList("902400000054","902400052664"))); + .in(StationEntity::getCode,Arrays.asList("902400000054","902400052664","902400056791"))); if(CollectionUtil.isEmpty(stations)){ return new ArrayList<>(); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java index f7c04b5..9da5fac 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/scheduled/ScheduledCreateTask.java @@ -278,12 +278,9 @@ public class ScheduledCreateTask { /** * 水电站-机组实时加载 - * @return ReturnT */ - //@XxlJob(LOAD_HYDROPOWER_UNIT_REAL) - @Scheduled(cron = "0/40 * * * * ? ") - public ReturnT loadHydropowerUnitReal() throws Exception { - String param = ""; + @XxlJob(LOAD_HYDROPOWER_UNIT_REAL) + public ReturnT loadHydropowerReal(String param) { if (Func.isBlank(param)) { param = DateUtil.format(new Date(), "yyyy-MM"); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java index c2a247a..8373e6d 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HomeServiceImpl.java @@ -246,7 +246,7 @@ public class HomeServiceImpl implements HomeService { double plan = list.stream().mapToDouble(PowerEntity::getPlannedPowerMon).sum(); double pass = list.stream().mapToDouble(power -> Double.parseDouble(power.getDoubleQualifyRate())).sum(); // 装机容量 - target.setTaget_one(list.stream().map(PowerEntity::getInstalledCapacity).collect(Collectors.toSet()).stream().mapToDouble(Double::valueOf).sum()); + target.setTaget_one(list.get(0).getInstalledCapacity()); // 发电量 target.setTaget_two(list.stream().mapToDouble(PowerEntity::getPowerMon).sum()); if(Math.abs(plan) > 0){ @@ -254,7 +254,7 @@ public class HomeServiceImpl implements HomeService { target.setTaget_three(BigDecimal.valueOf(target.getTaget_two() / plan * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); } // 双票合格率 - target.setTaget_four(BigDecimal.valueOf(pass / list.size()).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + target.setTaget_four(BigDecimal.valueOf(pass / list.size() * 100).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); return target; } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java index 876c9e4..9377586 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/HydropowerServiceImpl.java @@ -153,6 +153,7 @@ public class HydropowerServiceImpl implements HydropowerService { HydropowerUnitRealVo real = new HydropowerUnitRealVo(); real.setDeptId(device.getCreateDept()); real.setDeviceCode(device.getEmCode()); + real.setOrd(device.getOrd()); real.setDeptName(device.getName()); real.setDeviceName(device.getName()); // 装机容量 @@ -1548,12 +1549,13 @@ public class HydropowerServiceImpl implements HydropowerService { AppHydropowerDeviceVo device = new AppHydropowerDeviceVo(); device.setDeviceCode(real.getDeviceCode()); device.setDeviceName(real.getDeviceName()); + device.setOrd(real.getOrd()); device.setState(real.getState()); device.setLoadUnit(Optional.ofNullable(real.getPowerUnit()).orElse("kW")); device.setCapacity(real.getInstalledCapacity()); device.setLoad(real.getActivePower()); return device; - }).collect(Collectors.toList())); + }).sorted(Comparator.comparing(AppHydropowerDeviceVo::getOrd)).collect(Collectors.toList())); hydropower.setLoadUnit(hydropower.getDevices().get(0).getLoadUnit()); } return hydropower; From face537c384af8546ecab7aec634052355180be3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AE=B5=E9=A3=9E=E5=AE=87?= <2684146481@qq.com> Date: Tue, 20 Jun 2023 12:27:27 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=93=8D=E4=BD=9C?= =?UTF-8?q?=E7=A5=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/OperationTicketController.java | 1 + .../controller/StandardTicketInfoController.java | 1 - .../service/impl/OperationTicketServiceImpl.java | 21 +++++++++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java index 2ef7a12..7669242 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/OperationTicketController.java @@ -54,6 +54,7 @@ public class OperationTicketController { operationTicketService.findPending(response); return true; } catch (Exception e) { + e.printStackTrace(); throw new ServiceException("操作票待处理:" + e.getMessage()); } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java index af1d2bc..f2e930b 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/controller/StandardTicketInfoController.java @@ -113,7 +113,6 @@ public class StandardTicketInfoController extends BladeController { /** * 根据月份,区域 获取操作详情数据 - * * @return */ @GetMapping("/areaMonthlyWithOperation/{page}/{size}") diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java index 7b94004..ed73e0c 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/OperationTicketServiceImpl.java @@ -41,6 +41,7 @@ import org.springblade.system.feign.ISysClient; import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springframework.beans.BeanUtils; +import org.springframework.beans.BeansException; import org.springframework.stereotype.Service; import javax.servlet.ServletOutputStream; @@ -157,7 +158,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { log.info("获取下一个审批人是: {} ", response.getNextStepOperator()); log.info("获取下一个用户Id是: {} ", response.getUserId()); log.info("获取当前任务名称是: {} ", response.getTaskName()); - log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType()); + log.info("获取根据handleType区分是用户还是候选组角色: {}", response.getHandleType()); //json转换表单 String formData = JSON.toJSONString(response.getVariables()); log.info("获取表单的数据:{}", formData); @@ -177,6 +178,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { log.error("获取操作票不存在"); return; } + //设置id StandardTicketInfoEntity newStandardTicketInfoEntity = new StandardTicketInfoEntity(); BeanUtils.copyProperties(standardTicketInfoVo, newStandardTicketInfoEntity); @@ -186,6 +188,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { newStandardTicketInfoEntity.setProcessInstanceId(response.getProcessInstanceId()); standardTicketInfoService.updateById(newStandardTicketInfoEntity); + //更新安全措施 List standardTicketMeasureVos = standardTicketInfoVo.getStandardTicketMeasureVos(); if (CollectionUtils.isNotEmpty(standardTicketMeasureVos)) { @@ -196,6 +199,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { }).collect(Collectors.toList()); standardTicketMeasureService.updateBatchById(standardTicketMeasureEntities); } + //推送消息 if (response.getTaskId() != null) { MessagePushRecordDto message = new MessagePushRecordDto(); @@ -236,6 +240,7 @@ public class OperationTicketServiceImpl implements OperationTicketService { } } + } @@ -247,19 +252,23 @@ public class OperationTicketServiceImpl implements OperationTicketService { */ private void saveStandardTicketInfoEntity(StandardTicketInfoEntity newStandardTicketInfoEntity, ProcessWorkFlowResponse response) { String flowDescription = ""; - //如果response.getHandleType() 是0使用户 - newStandardTicketInfoEntity.setFlowUserId(response.getUserId()); - newStandardTicketInfoEntity.setNextStepOperator(response.getNextStepOperator()); - flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(response.getNextStepOperator()).concat("审批"); + + if (response.getNextStepOperator() != null) { + flowDescription = "审批中,当前环节是".concat(response.getTaskName()).concat(",待").concat(response.getNextStepOperator()).concat("审批"); + } //如果taskId为空 String taskId = response.getTaskId(); - if (StringUtils.isEmpty(taskId)) { + log.info("StringUtils.isBlank(taskId) = " + StringUtils.isBlank(taskId)); + if (StringUtils.isBlank(taskId)) { newStandardTicketInfoEntity.setFlowDescription("结束"); newStandardTicketInfoEntity.setFlowTaskId(" "); newStandardTicketInfoEntity.setFlowTaskName("结束"); newStandardTicketInfoEntity.setNextStepOperator(" "); newStandardTicketInfoEntity.setFlowStatus(999); } else { + //如果response.getHandleType() 是0使用户 + newStandardTicketInfoEntity.setFlowUserId(response.getUserId()); + newStandardTicketInfoEntity.setNextStepOperator(response.getNextStepOperator()); newStandardTicketInfoEntity.setFlowTaskId(taskId); newStandardTicketInfoEntity.setFlowTaskName(response.getTaskName()); newStandardTicketInfoEntity.setFlowDescription(flowDescription);