|
|
|
@ -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<Void> 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<String, Object> 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(); |
|
|
|
|