|
@@ -68,6 +68,7 @@ public class WorkflowServiceImpl extends BaseServiceImpl<WorkflowMapper, Workflo
|
|
|
// 解析json,生成workflowNode,发起表单或者其他审批根据workflowNode来生成任务
|
|
|
parseJson(array,flow,nodeList);
|
|
|
mapper.insert(flow);
|
|
|
+ workflowNodeMapper.insertListforComplex(nodeList);
|
|
|
return flow;
|
|
|
}
|
|
|
|
|
@@ -95,6 +96,7 @@ public class WorkflowServiceImpl extends BaseServiceImpl<WorkflowMapper, Workflo
|
|
|
workflow.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
workflow.setUpdateUserName(SecurityUtils.getUserInfo().getRealName());
|
|
|
mapper.updateByPrimaryKeySelective(workflow);
|
|
|
+ workflowNodeMapper.insertListforComplex(nodeList);
|
|
|
}
|
|
|
|
|
|
private void parseJson(JSONArray array,Workflow record,List<WorkflowNode> nodeList) {
|
|
@@ -105,34 +107,33 @@ public class WorkflowServiceImpl extends BaseServiceImpl<WorkflowMapper, Workflo
|
|
|
if(sortNum > maxNodeNum) {
|
|
|
maxNodeNum = sortNum;
|
|
|
}
|
|
|
- if(sortNum > 1) {
|
|
|
- int type = jsonObject.getInteger("type");
|
|
|
- // 存储节点
|
|
|
- WorkflowNode node = new WorkflowNode();
|
|
|
- node.setId(IdGeneratorUtils.getObjectId());
|
|
|
- node.setNodeLevel(sortNum);
|
|
|
- node.setType(type);
|
|
|
- node.setCreatedTime(LocalDateTime.now());
|
|
|
- node.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
- node.setCreatedUserName(SecurityUtils.getUserInfo().getRealName());
|
|
|
- node.setFrontId(jsonObject.getString("id"));
|
|
|
- node.setFrontParentId(jsonObject.getString("parentId"));
|
|
|
- switch(type) {
|
|
|
- case CommonConstants.CONDITION_TYPE: // 条件分支
|
|
|
- JSONObject condition = new JSONObject();
|
|
|
- condition.put("value", jsonObject.getString("handleConditionValue"));
|
|
|
- condition.put("symbol", jsonObject.getString("handleConditionType"));
|
|
|
- condition.put("fieldName",jsonObject.getString("titleColumnCode"));
|
|
|
- node.setSwitchJson(condition.toJSONString());
|
|
|
- node.setSwitchHandleId(jsonObject.getString("handleNameId"));
|
|
|
- break;
|
|
|
- case CommonConstants.VERIFY_USER_TYPE: // 审核人
|
|
|
- node.setUserId(jsonObject.getString("verifier"));
|
|
|
- node.setUserName(jsonObject.getString("userName"));
|
|
|
- break;
|
|
|
- }
|
|
|
- nodeList.add(node);
|
|
|
+ int type = jsonObject.getInteger("type");
|
|
|
+ // 存储节点
|
|
|
+ WorkflowNode node = new WorkflowNode();
|
|
|
+ node.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ node.setNodeLevel(sortNum);
|
|
|
+ node.setType(type);
|
|
|
+ node.setCreatedTime(LocalDateTime.now());
|
|
|
+ node.setCreatedUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
+ node.setCreatedUserName(SecurityUtils.getUserInfo().getRealName());
|
|
|
+ node.setFrontId(jsonObject.getString("id"));
|
|
|
+ node.setFrontParentId(jsonObject.getString("parentId"));
|
|
|
+ node.setFlowId(record.getId());
|
|
|
+ switch(type) {
|
|
|
+ case CommonConstants.CONDITION_TYPE: // 条件分支
|
|
|
+ JSONObject condition = new JSONObject();
|
|
|
+ condition.put("value", jsonObject.getString("handleConditionValue"));
|
|
|
+ condition.put("symbol", jsonObject.getString("handleConditionType"));
|
|
|
+ condition.put("fieldName",jsonObject.getString("titleColumnCode"));
|
|
|
+ node.setSwitchJson(condition.toJSONString());
|
|
|
+ node.setSwitchHandleId(jsonObject.getString("handleNameId"));
|
|
|
+ break;
|
|
|
+ case CommonConstants.VERIFY_USER_TYPE: // 审核人
|
|
|
+ node.setUserId(jsonObject.getString("verifier"));
|
|
|
+ node.setUserName(jsonObject.getString("userName"));
|
|
|
+ break;
|
|
|
}
|
|
|
+ nodeList.add(node);
|
|
|
}
|
|
|
record.setLevelNode(maxNodeNum);
|
|
|
}
|