From 230745e4a6e3a46c9331070abef4a04db45c9050 Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Mon, 28 Aug 2023 11:42:59 +0800 Subject: [PATCH] =?UTF-8?q?#=E9=A2=84=E8=AD=A6=E5=A4=84=E7=90=86=E8=BF=87?= =?UTF-8?q?=E6=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/StAlamRecordServiceImpl.java | 3 ++- .../scheduled/MaintenanceTaskCreateTask.java | 8 +++---- .../maintenance/service/MaintenanceService.java | 2 +- .../service/impl/MaintenanceServiceImpl.java | 27 +++++++++++++--------- .../impl/OperMaintenancePlanServiceImpl.java | 2 +- 5 files changed, 24 insertions(+), 18 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java index 96c0805..9865756 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/config/service/impl/StAlamRecordServiceImpl.java @@ -25,6 +25,7 @@ import com.hnac.hzims.operational.config.service.StAlamRecordService; import com.hnac.hzims.operational.config.service.StFocusPropertiesService; import com.hnac.hzims.operational.config.vo.*; import com.hnac.hzims.operational.main.service.IMainSystemMonitoringService; +import com.hnac.hzims.operational.main.vo.RealDeviceVo; import com.hnac.hzims.operational.main.vo.SoeDataVo; import com.hnac.hzims.operational.station.entity.StationEntity; import com.hnac.hzims.operational.station.service.IStationService; @@ -750,7 +751,7 @@ public class StAlamRecordServiceImpl extends BaseServiceImpl emCodeList = Arrays.asList(planEntity.getEmCode().split(",")); for(String emCode : emCodeList){ taskEntity.setEmCode(emCode); - maintenanceService.fillTask(taskEntity,planEntity); + maintenanceService.fillTask(taskEntity,planEntity,flag); } } else { - maintenanceService.fillTask(taskEntity,planEntity); + maintenanceService.fillTask(taskEntity,planEntity,flag); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java index c370508..d58df2a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/MaintenanceService.java @@ -38,5 +38,5 @@ public interface MaintenanceService { * @param taskEntity * @param finalPlanEntity */ - void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity); + void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java index db53664..a884ff5 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/MaintenanceServiceImpl.java @@ -271,10 +271,10 @@ public class MaintenanceServiceImpl implements MaintenanceService { String[] emCodeList = finalPlanEntity.getEmCode().split(","); for (String emCode : emCodeList) { taskEntity.setEmCode(emCode); - this.fillTask(taskEntity, finalPlanEntity); + this.fillTask(taskEntity, finalPlanEntity,false); } } else { - this.fillTask(taskEntity, finalPlanEntity); + this.fillTask(taskEntity, finalPlanEntity,false); } } @@ -286,7 +286,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { * @param taskEntity * @param finalPlanEntity */ - public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity) { + public void fillTask(OperMaintenanceTaskEntity taskEntity, OperMaintenancePlanEntity finalPlanEntity,Boolean flag) { DefaultTransactionDefinition defaultTransactionDefinition = new DefaultTransactionDefinition(); defaultTransactionDefinition.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRES_NEW); TransactionStatus transaction = dataSourceTransactionManager.getTransaction(defaultTransactionDefinition); @@ -322,7 +322,7 @@ public class MaintenanceServiceImpl implements MaintenanceService { taskService.save(taskEntity); dataSourceTransactionManager.commit(transaction); //启动流程 - String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity); + String processInstanceId = this.startProcess(finalPlanEntity.getProcDefId(), taskEntity,flag); //推送消息 CompletableFuture operMaintenanceTaskEntityCompletableFuture = CompletableFuture.runAsync(() -> { @@ -349,19 +349,24 @@ public class MaintenanceServiceImpl implements MaintenanceService { * * @author xiashandong **/ - private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity) { + private String startProcess(String processDefinitionKey, OperMaintenanceTaskEntity taskEntity,Boolean flag) { OperMaintenanceTaskEntityVo operMaintenanceTaskEntityVo = new OperMaintenanceTaskEntityVo(); BeanUtils.copyProperties(taskEntity, operMaintenanceTaskEntityVo); Map params = new HashMap<>(); params.put("taskId", taskEntity.getId()); - int index = 1; - for(String userId :taskEntity.getDisposer().split(",")){ - if(index > 1){ - params.put("initUserIds" + index , "taskUser_".concat(userId)); + if(flag){ + params.put("startFlowUserId", taskEntity.getCreateUser().toString()); + } + String[] userArr = taskEntity.getDisposer().split(","); + for(int index = 0; index < userArr.length ; index++){ + if(index > 4){ + continue; + } + if(index > 0){ + params.put("initUserIds" + index , "taskUser_".concat(userArr[index])); }else{ - params.put("initUserIds", "taskUser_".concat(userId)); + params.put("initUserIds", "taskUser_".concat(userArr[index])); } - index++; } params.put("operMaintenanceTaskEntityVo", operMaintenanceTaskEntityVo); return flowClient.startProcessInstanceContainNameByKey(processDefinitionKey, String.valueOf(taskEntity.getId()), taskEntity.getTitle(), params).getData().getProcessInstanceId(); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java index 59297a6..2099a87 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/maintenance/service/impl/OperMaintenancePlanServiceImpl.java @@ -108,7 +108,7 @@ public class OperMaintenancePlanServiceImpl extends BaseServiceImpl { try{ - schedule.generateTaskByPlan(planEntity); + schedule.generateTaskByPlan(planEntity,false); //更新任务派发时间 this.update(new LambdaUpdateWrapper().set(OperMaintenancePlanEntity::getCreateTaskTime,new Date()) .eq(OperMaintenancePlanEntity::getId,planEntity.getId()));