|
@@ -1,7 +1,9 @@
|
|
|
package com.qmth.sop.business.activiti.listener;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.qmth.sop.business.bean.dto.FlowRejectSequenceDto;
|
|
|
import com.qmth.sop.business.bean.result.FlowFormWidgetResult;
|
|
|
import com.qmth.sop.business.bean.result.FlowResult;
|
|
|
import com.qmth.sop.business.bean.result.FlowTablePropResult;
|
|
@@ -99,11 +101,12 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
Iterator iterator = rootElement.elementIterator();
|
|
|
LinkedHashMap<String, FlowTaskResult> setupMap = new LinkedHashMap<>();//流程审批步骤map
|
|
|
TFCustomTypeEnum customTypeEnum = null;
|
|
|
+ Map<String, List<FlowRejectSequenceDto>> approveRejectMap = null;
|
|
|
while (iterator.hasNext()) {
|
|
|
Element element = (Element) iterator.next();
|
|
|
List<Attribute> attributes = element.attributes();
|
|
|
for (Attribute attr : attributes) {
|
|
|
-// log.info("属性:{},---值:{}", attr.getName(), attr.getValue());
|
|
|
+ log.info("属性:{},---值:{}", attr.getName(), attr.getValue());
|
|
|
if (Objects.equals(attr.getName(), SystemConstant.ID) &&
|
|
|
(Objects.equals(attr.getValue(), TFCustomTypeEnum.OFFICE_SOP_FLOW.name())
|
|
|
|| Objects.equals(attr.getValue(), TFCustomTypeEnum.CLOUD_MARK_SOP_FLOW.name())
|
|
@@ -119,36 +122,51 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
FlowTaskResult flowTaskResult = new FlowTaskResult();
|
|
|
Element node = (Element) itt.next();
|
|
|
attributes = node.attributes();
|
|
|
-// log.info("节点:{},---值:{}", node.getName(), node.getStringValue());
|
|
|
- if (Objects.equals(node.getName(), SystemConstant.USER_TASK) || Objects.equals(node.getName(), SystemConstant.END_EVENT)) {
|
|
|
+ log.info("节点:{},---值:{}", node.getName(), node.getStringValue());
|
|
|
+ if (Objects.equals(node.getName(), SystemConstant.USER_TASK) || Objects.equals(node.getName(), SystemConstant.START_EVENT) || Objects.equals(node.getName(), SystemConstant.END_EVENT)) {
|
|
|
for (Attribute attr : attributes) {
|
|
|
-// log.info("节点属性:{},---节点值:{}", attr.getName(), attr.getValue());
|
|
|
- if (Objects.equals(attr.getName(), SystemConstant.ID)) {
|
|
|
- flowTaskResult.setTaskKey(attr.getValue());
|
|
|
- flowTaskResult.setSetup(Integer.valueOf(attr.getValue().substring(attr.getValue().length() - 1, attr.getValue().length())));
|
|
|
- setupMap.put(attr.getValue(), flowTaskResult);
|
|
|
- } else if (Objects.equals(attr.getName(), SystemConstant.NAME)) {
|
|
|
- flowTaskResult.setTaskName(attr.getValue());
|
|
|
- }
|
|
|
-// else if (Objects.equals(attr.getName(), SystemConstant.ASSIGNEE_USER)) {
|
|
|
-// flowTaskResult.setFlowTaskVar(attr.getValue().replaceAll("\\$\\{", "").replaceAll("\\}", ""));
|
|
|
-// }
|
|
|
- else if (Objects.equals(attr.getName(), SystemConstant.FORM_KEY) && SystemConstant.FLOW_MAP.containsKey(resourceEntity.getDeploymentId() + SystemConstant.FLOW_FORM_ID_SPACE + attr.getValue())) {
|
|
|
- flowTaskResult.setFormKey(attr.getValue());
|
|
|
+ log.info("节点属性:{},---节点值:{}", attr.getName(), attr.getValue());
|
|
|
+ if (Objects.equals(node.getName(), SystemConstant.USER_TASK) || Objects.equals(node.getName(), SystemConstant.END_EVENT)) {
|
|
|
+ if (Objects.equals(attr.getName(), SystemConstant.ID)) {
|
|
|
+ flowTaskResult.setTaskKey(attr.getValue());
|
|
|
+ flowTaskResult.setSetup(Integer.valueOf(attr.getValue().substring(attr.getValue().length() - 1, attr.getValue().length())));
|
|
|
+ setupMap.put(attr.getValue(), flowTaskResult);
|
|
|
+ } else if (Objects.equals(attr.getName(), SystemConstant.NAME)) {
|
|
|
+ flowTaskResult.setTaskName(attr.getValue());
|
|
|
+ } else if (Objects.equals(attr.getName(), SystemConstant.FORM_KEY) && SystemConstant.FLOW_MAP.containsKey(resourceEntity.getDeploymentId() + SystemConstant.FLOW_FORM_ID_SPACE + attr.getValue())) {
|
|
|
+ if (Objects.equals(node.getName(), SystemConstant.USER_TASK) || Objects.equals(node.getName(), SystemConstant.END_EVENT)) {
|
|
|
+ flowTaskResult.setFormKey(attr.getValue());
|
|
|
+ List<String> list = SystemConstant.FLOW_MAP.get(resourceEntity.getDeploymentId() + SystemConstant.FLOW_FORM_ID_SPACE + attr.getValue());
|
|
|
+ String data = list.get(list.size() - 1);
|
|
|
+ List<FlowFormWidgetResult> listData = JSONArray.parseArray(data, FlowFormWidgetResult.class);
|
|
|
+ for (FlowFormWidgetResult f : listData) {
|
|
|
+ f.setFormId(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + f.getFormId());
|
|
|
+ f.setFormName(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + f.getFormName());
|
|
|
+ if (!CollectionUtils.isEmpty(f.getTablePropList())) {
|
|
|
+ for (FlowTablePropResult t : f.getTablePropList()) {
|
|
|
+ t.setTdId(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + t.getWidgetId() + SystemConstant.FLOW_FORM_ID_SPACE + t.getTdId());
|
|
|
+ t.setTdName(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + t.getWidgetId() + SystemConstant.FLOW_FORM_ID_SPACE + t.getTdName());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ flowTaskResult.setFormProperty(listData);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
List<String> list = SystemConstant.FLOW_MAP.get(resourceEntity.getDeploymentId() + SystemConstant.FLOW_FORM_ID_SPACE + attr.getValue());
|
|
|
- String data = list.get(list.size() - 1);
|
|
|
- List<FlowFormWidgetResult> listData = JSONArray.parseArray(data, FlowFormWidgetResult.class);
|
|
|
- for (FlowFormWidgetResult f : listData) {
|
|
|
- f.setFormId(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + f.getFormId());
|
|
|
- f.setFormName(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + f.getFormName());
|
|
|
- if (!CollectionUtils.isEmpty(f.getTablePropList())) {
|
|
|
- for (FlowTablePropResult t : f.getTablePropList()) {
|
|
|
- t.setTdId(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + t.getWidgetId() + SystemConstant.FLOW_FORM_ID_SPACE + t.getTdId());
|
|
|
- t.setTdName(flowTaskResult.getTaskKey() + SystemConstant.FLOW_FORM_ID_SPACE + t.getWidgetId() + SystemConstant.FLOW_FORM_ID_SPACE + t.getTdName());
|
|
|
+ if (!CollectionUtils.isEmpty(list)) {
|
|
|
+ String data = list.get(list.size() - 1);
|
|
|
+ if (Objects.nonNull(data)) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(data);
|
|
|
+ if (Objects.nonNull(jsonObject.getJSONObject(SystemConstant.ARRROVE_REJECT_MAP))) {
|
|
|
+ JSONObject object = jsonObject.getJSONObject(SystemConstant.ARRROVE_REJECT_MAP);
|
|
|
+ approveRejectMap = new LinkedHashMap<>(object.size());
|
|
|
+ for (Map.Entry<String, Object> entry : object.entrySet()) {
|
|
|
+ approveRejectMap.put(entry.getKey(), (List<FlowRejectSequenceDto>) entry.getValue());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- flowTaskResult.setFormProperty(listData);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -173,10 +191,16 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
Map.Entry<String, FlowTaskResult> tmpEntry = null;
|
|
|
while (iter.hasNext()) {
|
|
|
tmpEntry = iter.next();
|
|
|
- setupMap.put(tmpEntry.getKey(), tmpEntry.getValue());
|
|
|
+ FlowTaskResult flowTaskResult = tmpEntry.getValue();
|
|
|
+ if (!CollectionUtils.isEmpty(approveRejectMap)) {
|
|
|
+ if (approveRejectMap.containsKey(tmpEntry.getKey())) {
|
|
|
+ flowTaskResult.setApproveRejectList(approveRejectMap.get(tmpEntry.getKey()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ setupMap.put(tmpEntry.getKey(), flowTaskResult);
|
|
|
}
|
|
|
FlowResult flowResult = new FlowResult(resourceEntity.getDeploymentId(), resourceEntity.getName(), setupMap);
|
|
|
-// log.info("flowResult:{}", JacksonUtil.parseJson(flowResult));
|
|
|
+ log.info("flowResult:{}", JacksonUtil.parseJson(flowResult));
|
|
|
TFCustomFlowService tfCustomFlowService = SpringContextHolder.getBean(TFCustomFlowService.class);
|
|
|
TFCustomFlow tfCustomFlow = tfCustomFlowService.getOne(new QueryWrapper<TFCustomFlow>().lambda().eq(TFCustomFlow::getFlowDeploymentId, flowResult.getFlowDeploymentId()));
|
|
|
if (Objects.isNull(tfCustomFlow)) {
|
|
@@ -194,6 +218,9 @@ public class ProcessEventListener implements ActivitiEventListener, Serializable
|
|
|
flowResult.setVersion(tfCustomFlow.getVersion());
|
|
|
tfCustomFlow.setUpdateTime(System.currentTimeMillis());
|
|
|
}
|
|
|
+// if (!CollectionUtils.isEmpty(approveRejectMap)) {
|
|
|
+// flowResult.setApproveRejectMap(approveRejectMap);
|
|
|
+// }
|
|
|
tfCustomFlow.setFlowProcessVar(JacksonUtil.parseJson(flowResult));
|
|
|
tfCustomFlowService.saveOrUpdate(tfCustomFlow);
|
|
|
} catch (DocumentException e) {
|