fix: 立项变更发起报错
This commit is contained in:
+27
-6
@@ -83,6 +83,33 @@ public class ActFlowCommonService {
|
|||||||
Optional.ofNullable(value).ifPresent(v -> map.put(key, v));
|
Optional.ofNullable(value).ifPresent(v -> map.put(key, v));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换逗号拼接为List
|
||||||
|
* @param map
|
||||||
|
* @param flowUserInfoVO
|
||||||
|
* @param key
|
||||||
|
*/
|
||||||
|
public void convertAndPutList(HashMap<String, Object> map, Map<String, Object> flowUserInfoVO, String key) {
|
||||||
|
Optional.ofNullable(flowUserInfoVO.get(key))
|
||||||
|
.map(Object::toString)
|
||||||
|
.map(s -> Arrays.asList(s.split(",")))
|
||||||
|
.ifPresent(list -> map.put(key, list));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 系统中保存选人信息 多实例节点需要将List转为逗号拼接
|
||||||
|
*/
|
||||||
|
public void convertListToString(Map<String, Object> variables) {
|
||||||
|
for (Map.Entry<String, Object> entry : variables.entrySet()) {
|
||||||
|
String key = entry.getKey();
|
||||||
|
if (key.endsWith("List")) {
|
||||||
|
List<String> list = (List<String>) entry.getValue();
|
||||||
|
String s = String.join(",", list);
|
||||||
|
variables.put(key, s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 循环设置流程变量
|
* 循环设置流程变量
|
||||||
*
|
*
|
||||||
@@ -92,12 +119,6 @@ public class ActFlowCommonService {
|
|||||||
public void setProcessVariables(String processInstanceId, Map<String, Object> variables) {
|
public void setProcessVariables(String processInstanceId, Map<String, Object> variables) {
|
||||||
for (Map.Entry<String, Object> entry : variables.entrySet()) {
|
for (Map.Entry<String, Object> entry : variables.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
if (key.endsWith("List")) {
|
|
||||||
String value = (String) entry.getValue();
|
|
||||||
List<String> valueList = Arrays.asList(value.split(","));
|
|
||||||
runtimeService.setVariable(processInstanceId, entry.getKey(), valueList);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
runtimeService.setVariable(processInstanceId, key, entry.getValue());
|
runtimeService.setVariable(processInstanceId, key, entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-18
@@ -73,10 +73,10 @@ public class ProcessEsAbolishServiceImpl extends ServiceImpl<ProcessEsAbolishMap
|
|||||||
CommonVO commonVO = abolishData.getCommon();
|
CommonVO commonVO = abolishData.getCommon();
|
||||||
// 人员数据
|
// 人员数据
|
||||||
Map<String, Object> variables = abolishData.getFlowUser();
|
Map<String, Object> variables = abolishData.getFlowUser();
|
||||||
// 设置流程变量
|
// 流程变量
|
||||||
this.setVariables(variables);
|
Map<String, Object> actVariables = this.setVariables(variables);
|
||||||
// 启动流程
|
// 启动流程
|
||||||
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, variables);
|
ProcessInstance processInstance = actFlowCommonService.startProcess(processDefinitionKey, actVariables);
|
||||||
// 获取流程实例ID
|
// 获取流程实例ID
|
||||||
String processDefinitionId = processInstance.getProcessDefinitionId();
|
String processDefinitionId = processInstance.getProcessDefinitionId();
|
||||||
String processInstanceId = processInstance.getId();
|
String processInstanceId = processInstance.getId();
|
||||||
@@ -99,25 +99,28 @@ public class ProcessEsAbolishServiceImpl extends ServiceImpl<ProcessEsAbolishMap
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> setVariables(Map<String, Object> flowUser) {
|
public Map<String, Object> setVariables(Map<String, Object> flowUser) {
|
||||||
HashMap<String, Object> map = new HashMap<>(this.setUserVariables(flowUser));
|
Map<String, Object> actVariables = new HashMap<>();
|
||||||
boolean counterSign = StrUtil.isNotBlank((String)flowUser.get("relatedUserList"));
|
if (flowUser.get("relatedUserList") == null || StrUtil.isBlank((String)flowUser.get("relatedUserList"))) {
|
||||||
actFlowCommonService.putIfNotNull(map, "counterSign", counterSign);
|
actFlowCommonService.putIfNotNull(actVariables, "countersign", false);
|
||||||
return map;
|
} else {
|
||||||
}
|
actFlowCommonService.putIfNotNull(actVariables, "countersign", true);
|
||||||
|
String relatedUsers = (String) flowUser.get("relatedUserList");
|
||||||
public Map<String, Object> setUserVariables(Map<String, Object> flowUser) {
|
// 将relatedUserList从逗号拼接转为List
|
||||||
HashMap<String, Object> map = new HashMap<>();
|
List<String> relatedUserList = StrUtil.split(relatedUsers, ',');
|
||||||
// 使用一个通用方法来只在不为空时添加键值对
|
actFlowCommonService.putIfNotNull(actVariables, "relatedUserList", relatedUserList);
|
||||||
actFlowCommonService.putIfNotNull(map, "createUser", flowUser.get("createUser"));
|
}
|
||||||
actFlowCommonService.putIfNotNull(map, "relatedUserList", flowUser.get("relatedUserList"));
|
for (Map.Entry<String, Object> entry : flowUser.entrySet()) {
|
||||||
actFlowCommonService.putIfNotNull(map, "leader", flowUser.get("leader"));
|
String key = entry.getKey();
|
||||||
actFlowCommonService.putIfNotNull(map, "standardizationApprovalUser", flowUser.get("standardizationApprovalUser"));
|
if (!key.equals("relatedUserList")) {
|
||||||
return map;
|
actVariables.put(key, entry.getValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return actVariables;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
||||||
variables.remove("pass");
|
variables.remove("pass");
|
||||||
variables.remove("counterSign");
|
variables.remove("countersign");
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+7
-10
@@ -94,7 +94,9 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
|||||||
// 保存到业务流程表
|
// 保存到业务流程表
|
||||||
saveBatch(esInitChangeList);
|
saveBatch(esInitChangeList);
|
||||||
// 保存选人信息
|
// 保存选人信息
|
||||||
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, this.getUserMap(variables));
|
// 人员
|
||||||
|
Map<String, Object> flowUserInfoVO = initChangeData.getFlowUserInfoVO();
|
||||||
|
processNodeLinkService.saveNodeUserLink(processDefinitionId, processInstanceId, flowUserInfoVO);
|
||||||
// 根据流程实例id更新流程总表
|
// 根据流程实例id更新流程总表
|
||||||
String prcName = commonVO.getPrcName();
|
String prcName = commonVO.getPrcName();
|
||||||
String prcMes = commonVO.getPrcMes();
|
String prcMes = commonVO.getPrcMes();
|
||||||
@@ -111,22 +113,17 @@ public class ProcessEsInitChangeServiceImpl extends ServiceImpl<ProcessEsInitCha
|
|||||||
actFlowCommonService.putIfNotNull(map, "applicationCategory", initChange.getApplicationCategory());
|
actFlowCommonService.putIfNotNull(map, "applicationCategory", initChange.getApplicationCategory());
|
||||||
actFlowCommonService.putIfNotNull(map, "projectType", initChange.getProjectType());
|
actFlowCommonService.putIfNotNull(map, "projectType", initChange.getProjectType());
|
||||||
// 添加列表类型的变量
|
// 添加列表类型的变量
|
||||||
convertAndPutList(map, flowUserInfoVO, "standardExpertList");
|
actFlowCommonService.convertAndPutList(map, flowUserInfoVO, "standardExpertList");
|
||||||
convertAndPutList(map, flowUserInfoVO, "relatedUserList");
|
actFlowCommonService.convertAndPutList(map, flowUserInfoVO, "relatedUserList");
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void convertAndPutList(HashMap<String, Object> map, Map<String, Object> flowUserInfoVO, String key) {
|
|
||||||
Optional.ofNullable(flowUserInfoVO.get(key))
|
|
||||||
.map(Object::toString)
|
|
||||||
.map(s -> Arrays.asList(s.split(",")))
|
|
||||||
.ifPresent(list -> map.put(key, list));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
private Map<String, Object> getUserMap(Map<String, Object> variables) {
|
||||||
variables.remove("pass");
|
variables.remove("pass");
|
||||||
variables.remove("applicationCategory");
|
variables.remove("applicationCategory");
|
||||||
variables.remove("projectType");
|
variables.remove("projectType");
|
||||||
|
// 转成逗号拼接
|
||||||
|
actFlowCommonService.convertListToString(variables);
|
||||||
return variables;
|
return variables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user