|
@@ -1,7 +1,9 @@
|
|
|
package com.zkqy.business.controller;
|
|
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
+import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
+import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
import com.zkqy.business.entity.DragForm;
|
|
|
import com.zkqy.business.entity.DragTableBtn;
|
|
|
import com.zkqy.business.service.IDragFormService;
|
|
@@ -17,6 +19,7 @@ import com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus;
|
|
|
import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
|
|
|
import com.zkqy.execution.produce.dispersed.entity.DragFormGroup;
|
|
|
import com.zkqy.execution.produce.dispersed.entity.runbpm.BpmRunNodeFormDateVo;
|
|
|
+import com.zkqy.execution.produce.dispersed.mapper.BpmExecuteNodeFormMapper;
|
|
|
import com.zkqy.execution.produce.dispersed.runbpm.PreExecutionToolClass;
|
|
|
import com.zkqy.execution.produce.dispersed.runbpm.RunImplementationClass;
|
|
|
import com.zkqy.execution.produce.dispersed.service.IBpmExecuteProcessService;
|
|
@@ -27,10 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* @author hanzihang
|
|
@@ -71,6 +71,9 @@ public class CommonBtnController extends BaseController {
|
|
|
@Autowired
|
|
|
private EchoNodeFormData echoNodeFormData;
|
|
|
|
|
|
+ @Autowired // 节点
|
|
|
+ private BpmExecuteNodeFormMapper executeNodeFormMapper;
|
|
|
+
|
|
|
/**
|
|
|
* 处理按钮通用接口(新增、修改、删除...)
|
|
|
* 判断什么类型走什么接口: visible false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
|
|
@@ -117,7 +120,8 @@ public class CommonBtnController extends BaseController {
|
|
|
if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
|
|
|
if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {
|
|
|
// 表格组添加逻辑
|
|
|
- return AjaxResult.btnMessage(echoNodeFormData.handleSubmitForm((BpmRunNodeFormDateVo) commonEntity.getBasicMap().get("BpmRunNodeFormDateVo")));
|
|
|
+ BpmRunNodeFormDateVo bpmRunNodeFormDateVo = JSON.parseObject(JSON.toJSONString(commonEntity.getBasicMap().get("BpmRunNodeFormDateVo")), BpmRunNodeFormDateVo.class);
|
|
|
+ return AjaxResult.btnMessage(echoNodeFormData.handleSubmitForm(bpmRunNodeFormDateVo));
|
|
|
} else {
|
|
|
return AjaxResult.btnMessage(commonService.batchInsert(commonEntity));
|
|
|
}
|
|
@@ -128,7 +132,6 @@ public class CommonBtnController extends BaseController {
|
|
|
String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
|
|
|
return success(dragFormService.selectDragFormBySqlKey(sqlKey));
|
|
|
}
|
|
|
-
|
|
|
} else {
|
|
|
return warn("暂不支持该操作!");
|
|
|
}
|
|
@@ -144,26 +147,33 @@ public class CommonBtnController extends BaseController {
|
|
|
public AjaxResult updateBtn(CommonEntity commonEntity, DragTableBtn dragTableBtn) throws JsonProcessingException {
|
|
|
//是否开启弹窗
|
|
|
if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
|
|
|
- if (commonEntity.getBasicMap().containsKey("btnKey")) { // 按钮提交时会触发别的操作
|
|
|
- // 根据流程的key判断当前按钮是否执行触发流程
|
|
|
- if (!dragTableBtn.getBtnProcessKey().isEmpty()) {
|
|
|
- // 调用发起流程接口
|
|
|
- //fromUtils.runBpmProductionScheduling(commonEntity);
|
|
|
- ipreExecutionToolClass.ReadyToExecute(commonEntity);
|
|
|
-// if (dragTableBtn.getBtnFormKey().isEmpty()) { // 校验当前按钮是否是直接触发流程 或者脚本 (新增按钮类型)
|
|
|
-// fromUtils.runBpmProductionScheduling(commonEntity);
|
|
|
-// }
|
|
|
- } else if (!dragTableBtn.getBtnScriptKey().isEmpty()) {
|
|
|
- // 调用执行脚本接口
|
|
|
- logger.info("执行脚本接口");
|
|
|
- fromUtils.triggerScript(commonEntity);
|
|
|
- //IScriptEntity iScriptEntity = new IScriptEntity();
|
|
|
- //iScriptEntity.setScriptFlowKey(commonEntity.toString()); // 脚本别名
|
|
|
- //irunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity,commonEntity.toString());
|
|
|
- }
|
|
|
+
|
|
|
+// if (commonEntity.getBasicMap().containsKey("btnKey")) { // 按钮提交时会触发别的操作
|
|
|
+// // 根据流程的key判断当前按钮是否执行触发流程
|
|
|
+// if (!dragTableBtn.getBtnProcessKey().isEmpty()) {
|
|
|
+// // 调用发起流程接口
|
|
|
+// //fromUtils.runBpmProductionScheduling(commonEntity);
|
|
|
+// ipreExecutionToolClass.ReadyToExecute(commonEntity);
|
|
|
+//// if (dragTableBtn.getBtnFormKey().isEmpty()) { // 校验当前按钮是否是直接触发流程 或者脚本 (新增按钮类型)
|
|
|
+//// fromUtils.runBpmProductionScheduling(commonEntity);
|
|
|
+//// }
|
|
|
+// } else if (!dragTableBtn.getBtnScriptKey().isEmpty()) {
|
|
|
+// // 调用执行脚本接口
|
|
|
+// logger.info("执行脚本接口");
|
|
|
+// fromUtils.triggerScript(commonEntity);
|
|
|
+// //IScriptEntity iScriptEntity = new IScriptEntity();
|
|
|
+// //iScriptEntity.setScriptFlowKey(commonEntity.toString()); // 脚本别名
|
|
|
+// //irunImplementationClass.RunScriptImplementationClassLogicCode(iScriptEntity,commonEntity.toString());
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {
|
|
|
+ // 表格组添加逻辑
|
|
|
+ BpmRunNodeFormDateVo bpmRunNodeFormDateVo = JSON.parseObject(JSON.toJSONString(commonEntity.getBasicMap().get("BpmRunNodeFormDateVo")), BpmRunNodeFormDateVo.class);
|
|
|
+ return AjaxResult.btnMessage(echoNodeFormData.handleSubmitForm(bpmRunNodeFormDateVo));
|
|
|
+ } else {
|
|
|
+ commonEntity.getCommMap().putAll(commonEntity.getBtnParametersMap());
|
|
|
+ return toAjax(commonService.edit(commonEntity));
|
|
|
}
|
|
|
- commonEntity.getCommMap().putAll(commonEntity.getBtnParametersMap());
|
|
|
- return toAjax(commonService.edit(commonEntity));
|
|
|
} else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
|
|
|
if (dragTableBtn.getBtnFormType().equals("dragForm")) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
@@ -197,6 +207,7 @@ public class CommonBtnController extends BaseController {
|
|
|
Map<String, Object> relationJsonMap = (Map<String, Object>) JSON.parse(dragFormGroup.getRelationJson());
|
|
|
// 得到当前主表单key
|
|
|
((Map) relationJsonMap.get("mainForm")).get("formKey");
|
|
|
+
|
|
|
// 主表单增加模版信息
|
|
|
commonEntityList.forEach(ctem -> {
|
|
|
if (ctem.getResultMap().get("formKey").equals(((Map) relationJsonMap.get("mainForm")).get("formKey"))) {
|
|
@@ -230,6 +241,41 @@ public class CommonBtnController extends BaseController {
|
|
|
commonService.selectList(congCommon);
|
|
|
((Map) item).put("showValue", commonService.selectList(congCommon));
|
|
|
});
|
|
|
+
|
|
|
+ //得到【df_form_sql】
|
|
|
+ String dfFormSql = ((Map) ((Map) relationJsonMap.get("mainForm")).get("showTemplate")).get("dfFormSql").toString();
|
|
|
+ ObjectMapper objectMapper = new ObjectMapper();
|
|
|
+ Map<String, Object> sqlMap = null;
|
|
|
+ try {
|
|
|
+ sqlMap = objectMapper.readValue(dfFormSql, Map.class);
|
|
|
+ //循环得到每一个sql语句返回结果
|
|
|
+ for (Map.Entry<String, Object> entry : sqlMap.entrySet()) {
|
|
|
+ List<Map<String, Object>> resultMap = executeNodeFormMapper.executeSql(entry.getValue().toString());
|
|
|
+ sqlMap.put(entry.getKey(), resultMap);
|
|
|
+ }
|
|
|
+ //把原来的sql语句替换成下拉框数据
|
|
|
+ ((Map) ((Map) relationJsonMap.get("mainForm")).get("showTemplate")).put("dfFormSql", JSONObject.toJSONString(sqlMap));
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ ((ArrayList) relationJsonMap.get("subFormList")).forEach(rtem -> {
|
|
|
+ String dfFormSql1 = ((Map) ((Map) rtem).get("showTemplate")).get("dfFormSql").toString();
|
|
|
+ ObjectMapper objectMapper1 = new ObjectMapper();
|
|
|
+ Map<String, Object> sqlMap1 = null;
|
|
|
+ try {
|
|
|
+ sqlMap1 = objectMapper.readValue(dfFormSql, Map.class);
|
|
|
+ //循环得到每一个sql语句返回结果
|
|
|
+ for (Map.Entry<String, Object> entry : sqlMap1.entrySet()) {
|
|
|
+ List<Map<String, Object>> resultMap = executeNodeFormMapper.executeSql(entry.getValue().toString());
|
|
|
+ sqlMap1.put(entry.getKey(), resultMap);
|
|
|
+ }
|
|
|
+ //把原来的sql语句替换成下拉框数据
|
|
|
+ ((Map) ((Map) rtem).get("showTemplate")).put("dfFormSql", JSONObject.toJSONString(sqlMap1));
|
|
|
+ } catch (JsonProcessingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ });
|
|
|
return relationJsonMap;
|
|
|
}
|
|
|
|
|
@@ -291,8 +337,15 @@ public class CommonBtnController extends BaseController {
|
|
|
// 执行当前按钮绑定的流程-》暂无直接执行流程
|
|
|
}
|
|
|
}
|
|
|
- toAjax(commonService.edit(commonEntity));
|
|
|
- return AjaxResult.success("启动流程成功!");
|
|
|
+ // 如果当前发起流程表单使用的是表单组
|
|
|
+ if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {
|
|
|
+ BpmRunNodeFormDateVo bpmRunNodeFormDateVo = JSON.parseObject(JSON.toJSONString(commonEntity.getBasicMap().get("BpmRunNodeFormDateVo")), BpmRunNodeFormDateVo.class);
|
|
|
+ echoNodeFormData.handleSubmitForm(bpmRunNodeFormDateVo);
|
|
|
+ return AjaxResult.success("启动流程成功!");
|
|
|
+ } else {
|
|
|
+ toAjax(commonService.edit(commonEntity));
|
|
|
+ return AjaxResult.success("启动流程成功!");
|
|
|
+ }
|
|
|
} else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
DragForm dragForm;
|
|
@@ -311,7 +364,7 @@ public class CommonBtnController extends BaseController {
|
|
|
// 展示当前按钮绑定的表单
|
|
|
return success(map);
|
|
|
} else if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) { // 多个表单
|
|
|
-
|
|
|
+ return success(getFormGroupInfo(commonEntity, dragTableBtn));
|
|
|
} else if (dragTableBtn.getBtnFormType().equals("other")) {// 其他表单
|
|
|
|
|
|
} else {
|
|
@@ -346,4 +399,5 @@ public class CommonBtnController extends BaseController {
|
|
|
return AjaxResult.success(dragTableGroupService.getProcessPopupTableList(commonEntity));
|
|
|
}
|
|
|
|
|
|
-}
|
|
|
+
|
|
|
+}
|