Bladeren bron

feat:新增多表单表格组共通解析处理逻辑,更正表单类型、撤销审批接口、审批流程执行接口相关接口等

韩帛霖 1 jaar geleden
bovenliggende
commit
05ed4f1a0b
19 gewijzigde bestanden met toevoegingen van 1129 en 131 verwijderingen
  1. 52 0
      zkqy-admin/src/main/java/com/zkqy/web/ljj.java
  2. 99 15
      zkqy-business/src/main/java/com/zkqy/business/controller/CommonBtnController.java
  3. 23 1
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/controller/BpmRunController.java
  4. 2 1
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/BpmApprovalStatus.java
  5. 4 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/BpmExecuteNodeLog.java
  6. 142 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/DragFormGroup.java
  7. 19 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/BpmApprovalStatusMapper.java
  8. 34 8
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/BpmExecuteProcessMapper.java
  9. 71 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/DragFormGroupMapper.java
  10. 181 55
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/runbpm/PreExecutionToolClass.java
  11. 34 9
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IBpmApprovalStatusService.java
  12. 29 3
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IBpmExecuteProcessService.java
  13. 71 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IDragFormGroupService.java
  14. 15 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/BpmApprovalStatusServiceImpl.java
  15. 48 18
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/BpmExecuteProcessServiceImpl.java
  16. 102 0
      zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/DragFormGroupServiceImpl.java
  17. 39 21
      zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmApprovalStatusMapper.xml
  18. 25 0
      zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteProcessMapper.xml
  19. 139 0
      zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/DragFormGroupMapper.xml

+ 52 - 0
zkqy-admin/src/main/java/com/zkqy/web/ljj.java

@@ -1,13 +1,32 @@
 package com.zkqy.web;
 
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map;
+
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
 import com.zkqy.common.annotation.Anonymous;
+import com.zkqy.common.exception.file.FileException;
+import lombok.val;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
+import springfox.documentation.spring.web.json.Json;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Arrays;
+import java.util.Map;
 import java.util.concurrent.CompletableFuture;
 
 
@@ -18,6 +37,39 @@ public class ljj {
     @Autowired
     private ThreadPoolTaskExecutor threadPoolTaskExecutor;
 
+    public static Map<String, Object> readJsonFileToMap(String filePath) throws IOException {
+        ObjectMapper objectMapper = new ObjectMapper(); // 创建一个ObjectMapper实例
+
+        File jsonFile = new File(filePath); // 获取文件对象
+        if (!jsonFile.exists() || !jsonFile.isFile()) {
+            throw new FileNotFoundException("Json file not found at " + filePath);
+        }
+
+        // 读取文件内容并转换为Map
+        @SuppressWarnings("unchecked")
+        Map<String, Object> map = objectMapper.readValue(jsonFile, Map.class);
+
+        return map;
+    }
+
+    public static void main(String[] args) throws IOException {
+        String filePath = "/Users/zrwj/Desktop/ZKQY_LJJ/Intelligent_manufacturing/MEC_CLIENT/zkqy-admin/src/main/resources/asd.json";
+        Map<String, Object> jsonDataAsMap = readJsonFileToMap(filePath);
+
+
+        ((Map) jsonDataAsMap.get("mainForm")).get("formKey");
+
+
+        System.out.println(((Map) jsonDataAsMap.get("mainForm")).get("formKey"));
+
+        ((ArrayList)jsonDataAsMap.get("subFormList")).forEach(item->{
+            System.out.println(((Map)item).get("formKey"));
+            System.out.println(((Map)item).put("123123","123123"));
+            System.out.println(item);
+        });
+
+    }
+
     @GetMapping("/asd")
     public void main11() {
         // 多线程调用

+ 99 - 15
zkqy-business/src/main/java/com/zkqy/business/controller/CommonBtnController.java

@@ -1,5 +1,6 @@
 package com.zkqy.business.controller;
 
+import com.alibaba.fastjson2.JSON;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.zkqy.business.entity.DragForm;
 import com.zkqy.business.entity.DragTableBtn;
@@ -10,16 +11,25 @@ import com.zkqy.common.annotation.Log;
 import com.zkqy.common.core.controller.BaseController;
 import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.common.enums.BusinessType;
+import com.zkqy.common.utils.StringUtils;
 import com.zkqy.common.utils.form.FromUtils;
+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.runbpm.PreExecutionToolClass;
 import com.zkqy.execution.produce.dispersed.runbpm.RunImplementationClass;
+import com.zkqy.execution.produce.dispersed.service.IBpmExecuteProcessService;
 import com.zkqy.execution.produce.dispersed.service.ICommonService;
+import com.zkqy.execution.produce.dispersed.service.IDragFormGroupService;
+import com.zkqy.execution.produce.utils.EchoNodeFormData;
 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;
 
 /**
@@ -52,6 +62,15 @@ public class CommonBtnController extends BaseController {
     @Resource
     private RunImplementationClass irunImplementationClass;
 
+    @Resource // 表单组
+    private IDragFormGroupService iDragFormGroupService;
+
+    @Autowired // 执行流程service
+    private IBpmExecuteProcessService iBpmExecuteProcessService;
+
+    @Autowired
+    private EchoNodeFormData echoNodeFormData;
+
     /**
      * 处理按钮通用接口(新增、修改、删除...)
      * 判断什么类型走什么接口: visible  false代表弹窗未开启时走回显表单模板及数据信息接口;true代表弹窗开启时走保存数据接口
@@ -74,7 +93,7 @@ public class CommonBtnController extends BaseController {
          */
         switch (btnType) {
             case "INSERT":
-                return insertBtn(commonEntity);
+                return insertBtn(commonEntity, dragTableBtn);
             case "UPDATE":
                 return updateBtn(commonEntity, dragTableBtn);
             case "DELETE":
@@ -94,12 +113,22 @@ public class CommonBtnController extends BaseController {
      * @param commonEntity
      * @return
      */
-    public AjaxResult insertBtn(CommonEntity commonEntity) throws JsonProcessingException {
+    public AjaxResult insertBtn(CommonEntity commonEntity, DragTableBtn dragTableBtn) throws JsonProcessingException {
         if (commonEntity.getBasicMap().get("visible").toString().equals("true")) {
-            return AjaxResult.btnMessage(commonService.batchInsert(commonEntity));
+            if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {
+                // 表格组添加逻辑
+                return AjaxResult.btnMessage(echoNodeFormData.handleSubmitForm((BpmRunNodeFormDateVo) commonEntity.getBasicMap().get("BpmRunNodeFormDateVo")));
+            } else {
+                return AjaxResult.btnMessage(commonService.batchInsert(commonEntity));
+            }
         } else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
-            String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
-            return success(dragFormService.selectDragFormBySqlKey(sqlKey));
+            if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {
+                return success(getFormGroupInfo(commonEntity, dragTableBtn));
+            } else {
+                String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
+                return success(dragFormService.selectDragFormBySqlKey(sqlKey));
+            }
+
         } else {
             return warn("暂不支持该操作!");
         }
@@ -136,19 +165,74 @@ public class CommonBtnController extends BaseController {
             commonEntity.getCommMap().putAll(commonEntity.getBtnParametersMap());
             return toAjax(commonService.edit(commonEntity));
         } else if (commonEntity.getBasicMap().get("visible").toString().equals("false")) {
-            Map<String, Object> map = new HashMap<>();
-            // 单纯是表格还是弹窗里有表格
-            String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
-            DragForm dragForm = dragFormService.selectDragFormBySqlKey(sqlKey);
-            map.put("template", dragForm);
-            // 返回结果
-            map.put("result", commonService.getInfoById(commonEntity));
-            return success(map);
+            if (dragTableBtn.getBtnFormType().equals("dragForm")) {
+                Map<String, Object> map = new HashMap<>();
+                String sqlKey = commonEntity.getBasicMap().get("sqlKey").toString();
+                DragForm dragForm = dragFormService.selectDragFormBySqlKey(sqlKey);
+                map.put("template", dragForm);
+                // 返回结果
+                map.put("result", commonService.getInfoById(commonEntity));
+                return success(map);
+            } else if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {
+
+                // 当前按钮绑定的是表单组
+                return success(getFormGroupInfo(commonEntity, dragTableBtn));
+            }
+            return null;
         } else {
             return warn("暂不支持该操作!");
         }
     }
 
+    // 解析表单组逻辑
+    public Map<String, Object> getFormGroupInfo(CommonEntity commonEntity, DragTableBtn dragTableBtn) {
+        // 得到当前表格组的信息
+        DragFormGroup dragFormGroup = iDragFormGroupService.selectDragFormGroupByKey(dragTableBtn.getBtnFormKey());
+        // 根据表单组中的keys信息 获取对应动态表单的信息
+
+        String[] formKeys = JSON.parseArray(dragFormGroup.getFormKeys()).toArray(String.class);
+        List<CommonEntity> commonEntityList = iBpmExecuteProcessService.getFromInfoByFormKeys(formKeys);
+
+        // 当前表单组关系
+        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"))) {
+                ((Map) relationJsonMap.get("mainForm")).put("showTemplate", ctem.getResultMap());
+            }
+        });
+        // 从表单增加模版信息
+        ((ArrayList) relationJsonMap.get("subFormList")).forEach(rtem -> {
+            ((Map) rtem).put("showTemplate", commonEntityList.stream().filter(ctem -> ctem.getResultMap().get("formKey").equals(((Map) rtem).get("formKey"))).findFirst().get().getResultMap());
+        });
+        // 表单组回显数据
+        String tableName = commonEntity.getBasicMap().get("tableName").toString();
+        // 通用查询方法
+        CommonEntity common = new CommonEntity();
+        common.getBasicMap().put("tableName", tableName);
+        commonEntity.getConditionMap().entrySet().forEach(item -> {
+            common.getQueryMap().put(item.getKey(), item.getValue());
+        });
+        //  主
+        List<CommonEntity> retCommonEntityList = commonService.selectList(common);
+        ((Map) relationJsonMap.get("mainForm")).put("showValue", retCommonEntityList);
+
+        // 从
+        ((ArrayList) relationJsonMap.get("subFormList")).forEach(item -> {
+            String[] congTableOInfo = ((Map) item).get("formItem").toString().split("\\.");
+            String[] zhuTableOWhere = ((Map) item).get("relateMainItem").toString().split("\\.");
+            CommonEntity congCommon = new CommonEntity();
+            congCommon.getBasicMap().put("tableName", congTableOInfo[0]);
+            Object val = retCommonEntityList.get(0).getResultMap().get(StringUtils.toCamelCase(zhuTableOWhere[1]));
+            congCommon.getQueryMap().put(congTableOInfo[1], val);
+            commonService.selectList(congCommon);
+            ((Map) item).put("showValue", commonService.selectList(congCommon));
+        });
+        return relationJsonMap;
+    }
+
     /**
      * 删除类型按钮
      *
@@ -214,7 +298,7 @@ public class CommonBtnController extends BaseController {
             DragForm dragForm;
             // 如果当前按钮绑定了表单则
             // 判断当前表单的类型
-            if (dragTableBtn.getBtnFormType().equals("single")) {  // 单个表单
+            if (dragTableBtn.getBtnFormType().equals("dragForm")) {  // 单个表单
                 // 目前只是单个表单的模版
                 dragForm = dragFormService.selectDragFormByformKey(dragTableBtn.getBtnFormKey());
                 // 查询当前表的条件
@@ -226,7 +310,7 @@ public class CommonBtnController extends BaseController {
                 map.put("template", dragForm);
                 // 展示当前按钮绑定的表单
                 return success(map);
-            } else if (dragTableBtn.getBtnFormType().equals("multiple")) {  // 多个表单
+            } else if (dragTableBtn.getBtnFormType().equals("dragFormGroup")) {  // 多个表单
 
             } else if (dragTableBtn.getBtnFormType().equals("other")) {// 其他表单
 

+ 23 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/controller/BpmRunController.java

@@ -96,9 +96,10 @@ public class BpmRunController extends BaseController {
 
     /**
      * 共通执行节点表单回显数据接口
+     * * 审批获取表单模板
      */
     @GetMapping("/processNodeFormTemplate")
-    public AjaxResult processNodeFormTemplate (BpmRunNodeFromVo bpmRunNodeFromVo) {
+    public AjaxResult processNodeFormTemplate(BpmRunNodeFromVo bpmRunNodeFromVo) {
         return AjaxResult.success(ipreExecutionToolClass.getProcessNodeFormTemplate(bpmRunNodeFromVo));
     }
 
@@ -122,5 +123,26 @@ public class BpmRunController extends BaseController {
         return toAjax(bpmExecuteNodeService.triggerExceptionNode(vo));
     }
 
+    /**
+     * 发起人撤销当前申请的数据条
+     *
+     * @param bpmRunNodeVo 当前节点信息
+     * @param fileXML      当前流程xml
+     * @return
+     */
+    @PostMapping("/revokeApplication")
+    public AjaxResult revokeApplication(BpmRunNodeVo bpmRunNodeVo, @RequestParam("fileXML") MultipartFile fileXML) {
+        if (!fileXML.isEmpty()) {
+            try {
+                // 解析得到当前文件中的内容
+                byte[] bytes = fileXML.getBytes();
+                String xmlContent = new String(bytes);
+                bpmRunNodeVo.setTaskProcessXmlContent(xmlContent);
+            } catch (IOException e) {
+                throw new RuntimeException(e);
+            }
+        }
+        return AjaxResult.success(ipreExecutionToolClass.revokeApplication(bpmRunNodeVo));
+    }
 
 }

+ 2 - 1
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/BpmApprovalStatus.java

@@ -34,7 +34,7 @@ public class BpmApprovalStatus extends BaseEntity {
     /**
      * 审批状态 (0:已提交、1:已通过、2:不通过、4:驳回、5:审批中)
      */
-    @Excel(name = "审批状态 (0:已提交、1:已通过、2:不通过、4:驳回、5:审批中)")
+    @Excel(name = "审批状态 (0:已提交、1:已通过、2:不通过、3:撤销、4:驳回、5:审批中)")
     private String approvalState;
 
     /**
@@ -43,6 +43,7 @@ public class BpmApprovalStatus extends BaseEntity {
     @Excel(name = "流程任务key")
     private String taskKey;
 
+    // 根据流程编号修改审批中间表状态
     public BpmApprovalStatus(String approvalState, String taskKey) {
         this.approvalState = approvalState;
         this.taskKey = taskKey;

+ 4 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/BpmExecuteNodeLog.java

@@ -185,6 +185,10 @@ public class BpmExecuteNodeLog extends BaseEntityPlus implements Serializable {
     public BpmExecuteNodeLog() {
     }
 
+    public BpmExecuteNodeLog(String taskProcessKey) {
+        this.taskProcessKey = taskProcessKey;
+    }
+
     public BpmExecuteNodeLog(BpmExecuteNode bpmExecuteNode) {
         this.id = bpmExecuteNode.getId();
         this.taskProcessKey = bpmExecuteNode.getTaskProcessKey();

+ 142 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/entity/DragFormGroup.java

@@ -0,0 +1,142 @@
+package com.zkqy.execution.produce.dispersed.entity;
+
+import com.zkqy.common.annotation.Excel;
+import com.zkqy.common.core.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 动态单组对象 drag_form_group
+ * 
+ * @author hzh
+ * @date 2024-01-26
+ */
+public class DragFormGroup extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    private Long id;
+
+    /** 表单组Key */
+    @Excel(name = "表单组Key")
+    private String groupKey;
+
+    /** 动态组名称 */
+    @Excel(name = "动态组名称")
+    private String fGName;
+
+    /** 当前表单组中所绑定的表单 */
+    @Excel(name = "当前表单组中所绑定的表单")
+    private String formKeys;
+
+    /** 表单组主表名称(tableName:formKey) */
+    @Excel(name = "表单组主表名称", readConverterExp = "t=ableName:formKey")
+    private String mainTable;
+
+    /** 各个表单之间的关系 */
+    @Excel(name = "各个表单之间的关系")
+    private String relationJson;
+
+    /** 回显数据sql */
+    @Excel(name = "回显数据sql")
+    private String showDataSql;
+
+
+    /** 逻辑删除 */
+    private String delFlag;
+
+    public void setId(Long id) 
+    {
+        this.id = id;
+    }
+
+    public Long getId() 
+    {
+        return id;
+    }
+    public void setGroupKey(String groupKey) 
+    {
+        this.groupKey = groupKey;
+    }
+
+    public String getGroupKey() 
+    {
+        return groupKey;
+    }
+    public void setfGName(String fGName) 
+    {
+        this.fGName = fGName;
+    }
+
+    public String getfGName() 
+    {
+        return fGName;
+    }
+    public void setFormKeys(String formKeys) 
+    {
+        this.formKeys = formKeys;
+    }
+
+    public String getFormKeys() 
+    {
+        return formKeys;
+    }
+    public void setMainTable(String mainTable) 
+    {
+        this.mainTable = mainTable;
+    }
+
+    public String getMainTable() 
+    {
+        return mainTable;
+    }
+    public void setRelationJson(String relationJson) 
+    {
+        this.relationJson = relationJson;
+    }
+
+    public String getRelationJson() 
+    {
+        return relationJson;
+    }
+    public void setShowDataSql(String showDataSql) 
+    {
+        this.showDataSql = showDataSql;
+    }
+
+    public String getShowDataSql() 
+    {
+        return showDataSql;
+    }
+    public void setDelFlag(String delFlag) 
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag() 
+    {
+        return delFlag;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("id", getId())
+            .append("groupKey", getGroupKey())
+            .append("fGName", getfGName())
+            .append("remark", getRemark())
+            .append("formKeys", getFormKeys())
+            .append("mainTable", getMainTable())
+            .append("relationJson", getRelationJson())
+            .append("showDataSql", getShowDataSql())
+            .append("updateTime", getUpdateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateById", getUpdateById())
+            .append("createTime", getCreateTime())
+            .append("createById", getCreateById())
+            .append("createBy", getCreateBy())
+            .append("delFlag", getDelFlag())
+            .toString();
+    }
+}

+ 19 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/BpmApprovalStatusMapper.java

@@ -1,6 +1,7 @@
 package com.zkqy.execution.produce.dispersed.mapper;
 
 import com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus;
+import io.lettuce.core.dynamic.annotation.Param;
 
 import java.util.List;
 
@@ -19,6 +20,14 @@ public interface BpmApprovalStatusMapper {
      */
     public BpmApprovalStatus selectBpmApprovalStatusById(Long id);
 
+    /**
+     * 查询审批数据条中间
+     *
+     * @param taskKey 流程任务key
+     * @return 审批数据条中间
+     */
+    public BpmApprovalStatus selectBpmApprovalStatusByTaskKey(String taskKey);
+
     /**
      * 查询审批数据条中间列表
      *
@@ -67,4 +76,14 @@ public interface BpmApprovalStatusMapper {
      * @return
      */
     public int updateBpmApprovalStatusByTaskKey(BpmApprovalStatus bpmApprovalStatus);
+
+    /**
+     * 修改用户业务表中审批数据条状态
+     *
+     * @param tableName 表名
+     * @param state     状态值
+     * @param where     条件
+     * @return
+     */
+    public int updateApprovalStatusByTableName(@Param("tableName") String tableName, @Param("approvalState") String state, @Param("where") String where);
 }

+ 34 - 8
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/BpmExecuteProcessMapper.java

@@ -1,9 +1,9 @@
 package com.zkqy.execution.produce.dispersed.mapper;
 
 
-
 import com.zkqy.execution.produce.dispersed.entity.BpmExecuteProcess;
 import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
+import com.zkqy.execution.produce.dispersed.entity.DragFormGroup;
 import io.lettuce.core.dynamic.annotation.Param;
 
 import java.util.List;
@@ -106,35 +106,61 @@ public interface BpmExecuteProcessMapper {
      * @param //taskNodeKey     当前流程被执行的最后一个节点
      * @param //taskNodeNextKey 下一个节点的标识
      * @param bpmExecuteProcess
-     * @return
-     * bpmExecuteProcess
+     * @return bpmExecuteProcess
      */
     int updateProcessNode(BpmExecuteProcess bpmExecuteProcess);
 
+    /**
+     * 通过fid查询表单信息
+     *
+     * @param fid
+     * @return
+     */
+    Map<String, String> getFromInfo(String fid);
+
     /**
      * 通过formKey查询表单信息
+     *
      * @param formKey
      * @return
      */
-    Map<String,String> getFromInfo(String formKey);
+    Map<String, String> getFromInfoByFormKey(String formKey);
+
+    /**
+     * 通过formKeys查询表单信息
+     *
+     * @param objectMap
+     * @return
+     */
+    List<CommonEntity>  getFromInfoByFormKeys(String[] formKeys);
+
 
     /**
      * 根据groupKey查询表格组信息
      */
-    Map<String,String> getGroupInfo(String groupKey);
+    Map<String, String> getGroupInfo(String groupKey);
 
     /**
      * 根据tableKey查询Table表格信息
      */
-    Map<String,String> getTableInfo(String tableKey);
+    Map<String, String> getTableInfo(String tableKey);
 
     /**
      * 根据tableKey查询Table表格信息
      */
-    Map<String,String> getTableSqlInfo(String sqlKey);
+    Map<String, String> getTableSqlInfo(String sqlKey);
 
     /**
      * 根据动态表格编号查询 drag_table_
      */
-    List<Map<String,String>> getTableCondition(String tId);
+    List<Map<String, String>> getTableCondition(String tId);
+
+    /**
+     * 根据当前执行的流程key修改当前执行流程状态
+     *
+     * @param taskProcessState 修改的状态
+     * @param taskKey          执行流程key
+     * @return
+     */
+    public int updateProcessStateByKey(String taskKey);
 }

+ 71 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/mapper/DragFormGroupMapper.java

@@ -0,0 +1,71 @@
+package com.zkqy.execution.produce.dispersed.mapper;
+
+import com.zkqy.execution.produce.dispersed.entity.DragFormGroup;
+
+import java.util.List;
+
+
+/**
+ * 动态表单组Mapper接口
+ * 
+ * @author hzh
+ * @date 2024-01-26
+ */
+public interface DragFormGroupMapper 
+{
+    /**
+     * 查询动态表单组
+     * 
+     * @param id 动态表单组主键
+     * @return 动态表单组
+     */
+    public DragFormGroup selectDragFormGroupById(Long id);
+
+    /**
+     * 查询动态表单组
+     *
+     * @param groupKey 动态表单组key
+     * @return 动态表单组
+     */
+    public DragFormGroup selectDragFormGroupByKey(String groupKey);
+
+    /**
+     * 查询动态表单组列表
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 动态表单组集合
+     */
+    public List<DragFormGroup> selectDragFormGroupList(DragFormGroup dragFormGroup);
+
+    /**
+     * 新增动态表单组
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 结果
+     */
+    public int insertDragFormGroup(DragFormGroup dragFormGroup);
+
+    /**
+     * 修改动态表单组
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 结果
+     */
+    public int updateDragFormGroup(DragFormGroup dragFormGroup);
+
+    /**
+     * 删除动态表单组
+     * 
+     * @param id 动态表单组主键
+     * @return 结果
+     */
+    public int deleteDragFormGroupById(Long id);
+
+    /**
+     * 批量删除动态表单组
+     * 
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteDragFormGroupByIds(Long[] ids);
+}

+ 181 - 55
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/runbpm/PreExecutionToolClass.java

@@ -16,16 +16,15 @@ import com.zkqy.common.utils.uuid.IdUtils;
 import com.zkqy.execution.produce.dispersed.entity.*;
 import com.zkqy.execution.produce.dispersed.entity.runbpm.*;
 import com.zkqy.execution.produce.dispersed.mapper.*;
-import com.zkqy.execution.produce.dispersed.service.IBpmApprovalStatusService;
-import com.zkqy.execution.produce.dispersed.service.IBpmExecuteNodeFormService;
-import com.zkqy.execution.produce.dispersed.service.IBpmExecuteNodeLogService;
-import com.zkqy.execution.produce.dispersed.service.IBpmExecuteProcessService;
+import com.zkqy.execution.produce.dispersed.service.*;
 import com.zkqy.execution.produce.utils.VerifyExecutionProcess;
+import lombok.val;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.EnableAsync;
 import org.springframework.stereotype.Component;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
 import java.util.*;
 
 
@@ -72,7 +71,7 @@ public class PreExecutionToolClass<R> {
     @Autowired // 校验执行流程的数据
     private VerifyExecutionProcess iVerifyExecutionProcess;
 
-    @Autowired  // 节点表单
+    @Autowired  // 节点
     private BpmExecuteNodeFormMapper executeNodeFormMapper;
 
     @Autowired  // 节点日志
@@ -81,8 +80,15 @@ public class PreExecutionToolClass<R> {
     @Autowired  // 审批流程中间表
     private IBpmApprovalStatusService iBpmApprovalStatusService;
 
+    @Autowired // 通用查询
+    private ICommonService commonService;
+
+    @Autowired // 表单组
+    private IDragFormGroupService iDragFormGroupService;
+
+
     /**
-     * 预执行流程自动执行开始节点
+     * 预执行流程自动执行开始节点
      *
      * @param commonEntity
      * @return
@@ -132,6 +138,14 @@ public class PreExecutionToolClass<R> {
             if (item.getNodeRolePermission() != null) {
                 bpmUserScriptVo.setBpmNodeHandleUserList(bpmNodeHandleUserMapper.selectBpmNodeHandleUserList(new BpmNodeHandleUser(item.getNodeRolePermission())));
             }
+            // 判断流程类型是否是审批类型
+            // 审批类型默认是没有脚本的
+//            if (bpmProcess.getProcessType().equals("1")) {
+//                bpmNodeScriptRelevanceList.addAll(bpmUserScriptVo.getBpmNodeScriptRelevanceList());
+//                bpmUserScriptVoList.add(bpmUserScriptVo);
+//            } else if (bpmProcess.getProcessType().equals("0")) {
+//
+//            }
             bpmUserScriptVo.setBpmNodeScriptRelevanceList(bpmNodeScriptRelevanceMapper.selectBpmNodeScriptRelevanceList(new BpmNodeScriptRelevance(item.getNodeKey())));
             bpmNodeScriptRelevanceList.addAll(bpmUserScriptVo.getBpmNodeScriptRelevanceList());
             bpmUserScriptVoList.add(bpmUserScriptVo);
@@ -323,6 +337,7 @@ public class PreExecutionToolClass<R> {
         return AjaxResult.success();
     }
 
+
     /**
      * 执行流程节点共通接口
      *
@@ -507,6 +522,7 @@ public class PreExecutionToolClass<R> {
 
     /**
      * 共通执行节点表单模版接口
+     * * 目前只有审批节点在调用这个接口
      */
     public List<Map> getProcessNodeFormTemplate(BpmRunNodeFromVo bpmRunNodeFromVo) {
         //任务流程key
@@ -532,10 +548,12 @@ public class PreExecutionToolClass<R> {
                 //得到sqlKey
                 String sqlKey = taskNodeFromContentJson.get("sqlKey").toString();
                 //根据sqlKey查询表单数据
-                if (!sqlKey.isEmpty()) {
-                    Map<String, String> tableSqlBySqlKey = executeNodeFormMapper.getTableSqlBySqlKey(sqlKey);
-                    hashMap.put("resultMap", tableSqlBySqlKey);
-                }
+
+//                if (!sqlKey.isEmpty()) {
+//                    Map<String, String> tableSqlBySqlKey = executeNodeFormMapper.getTableSqlBySqlKey(sqlKey);
+//                    hashMap.put("resultMap", tableSqlBySqlKey);
+//                }
+
                 //得到【df_form_sql】
                 String dfFormSql = taskNodeFromContentJson.get("dfFormSql").toString();
                 ObjectMapper objectMapper = new ObjectMapper();
@@ -552,37 +570,108 @@ public class PreExecutionToolClass<R> {
                 } catch (JsonProcessingException e) {
                     e.printStackTrace();
                 }
+                // 获取当前流程审批的表单数据关系
+                BpmApprovalStatus bpmApprovalStatus = iBpmApprovalStatusService.selectBpmApprovalStatusByTaskKey(bpmRunNodeFromVo.getTaskProcessKey());
+                // 通用查询方法
+                CommonEntity common = new CommonEntity();
+                common.getBasicMap().put("tableName", bpmApprovalStatus.getTableName());
+                common.getQueryMap().put(bpmApprovalStatus.getTableId().split("=")[0], bpmApprovalStatus.getTableId().split("=")[1]);
+                // 添加结果当前回显表单的数据信息
+                taskNodeFromContentJson.put("resultMap", commonService.selectList(common));
                 //表单结构信息
                 hashMap.put("template", taskNodeFromContentJson);
                 //添加到返回集合中
                 mapList.add(hashMap);
-            } else if (taskNodeFormType.equals("dragFormGroup")) { // 当前节点绑定的是表单组类型
+            } else if (taskNodeFormType.equals("dragFormGroup")) {  // 当前节点绑定的是表单组类型
+                // 查询表单组信息、
                 HashMap hashMap = new HashMap();
                 //解析存进去的表单信息【task_node_from_content】
                 JSONObject taskNodeFromContentJson = JSONObject.parseObject(taskNodeFormContent);
-                //得到sqlKey
-                String sqlKey = taskNodeFromContentJson.get("sqlKey").toString();
-                //根据sqlKey查询表单数据
-                if (!sqlKey.isEmpty()) {
-                    Map<String, String> tableSqlBySqlKey = executeNodeFormMapper.getTableSqlBySqlKey(sqlKey);
-                    hashMap.put("resultMap", tableSqlBySqlKey);
-                }
-                //得到【df_form_sql】
-                String dfFormSql = taskNodeFromContentJson.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);
+
+                // 主表单逻辑
+                if (taskNodeFromContentJson.get("mainForm") != null) {
+                    Map<String, Object> mianFormMap = (Map<String, Object>) ((Map) taskNodeFromContentJson.get("mainForm")).get("showTemplate");
+                    //得到sqlKey
+                    String sqlKey = mianFormMap.get("sqlKey").toString();
+                    //根据sqlKey查询表单数据
+                    if (!sqlKey.isEmpty()) {
+                        Map<String, String> tableSqlBySqlKey = executeNodeFormMapper.getTableSqlBySqlKey(sqlKey);
+                        hashMap.put("resultMap", tableSqlBySqlKey);
                     }
-                    //把原来的sql语句替换成下拉框数据
-                    taskNodeFromContentJson.put("dfFormSql", JSONObject.toJSONString(sqlMap));
-                } catch (JsonProcessingException e) {
-                    e.printStackTrace();
+                    //得到【df_form_sql】
+                    String dfFormSql = mianFormMap.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语句替换成下拉框数据
+                        mianFormMap.put("dfFormSql", JSONObject.toJSONString(sqlMap));
+                    } catch (JsonProcessingException e) {
+                        e.printStackTrace();
+                    }
+                }
+
+                // 从表单逻辑
+                if (taskNodeFromContentJson.get("subFormList") != null) {
+                    ((ArrayList) taskNodeFromContentJson.get("subFormList")).forEach(item -> {
+                        Map<String, Object> itemMap = (Map<String, Object>) ((Map) item).get("showTemplate");
+
+                        //得到sqlKey
+                        String sqlKey = itemMap.get("sqlKey").toString();
+
+                        //根据sqlKey查询表单数据
+                        if (!sqlKey.isEmpty()) {
+                            Map<String, String> tableSqlBySqlKey = executeNodeFormMapper.getTableSqlBySqlKey(sqlKey);
+                            hashMap.put("resultMap", tableSqlBySqlKey);
+                        }
+                        //得到【df_form_sql】
+                        String dfFormSql = itemMap.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语句替换成下拉框数据
+                            itemMap.put("dfFormSql", JSONObject.toJSONString(sqlMap));
+                        } catch (JsonProcessingException e) {
+                            e.printStackTrace();
+                        }
+                    });
                 }
+                // 获取当前流程审批的表单数据关系
+                BpmApprovalStatus bpmApprovalStatus = iBpmApprovalStatusService.selectBpmApprovalStatusByTaskKey(bpmRunNodeFromVo.getTaskProcessKey());
+                // 通用查询方法
+                CommonEntity common = new CommonEntity();
+                common.getBasicMap().put("tableName", bpmApprovalStatus.getTableName());
+                common.getQueryMap().put(bpmApprovalStatus.getTableId().split("=")[0], bpmApprovalStatus.getTableId().split("=")[1]);
+                // 添加结果当前回显表单的数据信息
+
+                //  主
+                List<CommonEntity> retCommonEntityList = commonService.selectList(common);
+
+                ((Map) taskNodeFromContentJson.get("mainForm")).put("showValue", retCommonEntityList);
+
+                // 从
+                ((ArrayList) taskNodeFromContentJson.get("subFormList")).forEach(item -> {
+                    String[] congTableOInfo = ((Map) item).get("formItem").toString().split("\\.");
+                    String[] zhuTableOWhere = ((Map) item).get("relateMainItem").toString().split("\\.");
+                    CommonEntity congCommon = new CommonEntity();
+                    congCommon.getBasicMap().put("tableName", congTableOInfo[0]);
+                    Object val = retCommonEntityList.get(0).getResultMap().get(StringUtils.toCamelCase(zhuTableOWhere[1]));
+                    congCommon.getQueryMap().put(congTableOInfo[1], val);
+                    commonService.selectList(congCommon);
+                    ((Map) item).put("showValue", commonService.selectList(congCommon));
+                });
+                taskNodeFromContentJson.put("resultMap", retCommonEntityList);
                 //表单结构信息
                 hashMap.put("template", taskNodeFromContentJson);
                 //添加到返回集合中
@@ -632,14 +721,29 @@ public class PreExecutionToolClass<R> {
         Map resultMap = new HashMap();
         nodeKey.forEach(item -> {
             if (nodeForm.get(item).equals("dragForm")) {  // 拖拽类型的表单
-                String fromInfo = iBpmExecuteProcessService.getFromInfo(item);
+                String fromInfo = iBpmExecuteProcessService.getFromInfoByFormKey(item);
                 resultMap.put(item, fromInfo);
             } else if (nodeForm.get(item).equals("dragFormGroup")) { // 拖拽的表单组
-
-                String groupTableInfo = iBpmExecuteProcessService.getGroupTableInfo(item);
-
-
-                resultMap.put(item, groupTableInfo);
+                // 得到当前表格组的信息
+                DragFormGroup dragFormGroup = iDragFormGroupService.selectDragFormGroupByKey(item);
+                // 根据表单组中的keys信息 获取对应动态表单的信息
+                String[] formKeys = JSON.parseArray(dragFormGroup.getFormKeys()).toArray(String.class);
+                List<CommonEntity> commonEntityList = iBpmExecuteProcessService.getFromInfoByFormKeys(formKeys);
+                // 当前表单组关系
+                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"))) {
+                        ((Map) relationJsonMap.get("mainForm")).put("showTemplate", ctem.getResultMap());
+                    }
+                });
+                // 从表单增加模版信息
+                ((ArrayList) relationJsonMap.get("subFormList")).forEach(rtem -> {
+                    ((Map) rtem).put("showTemplate", commonEntityList.stream().filter(ctem -> ctem.getResultMap().get("formKey").equals(((Map) rtem).get("formKey"))).findFirst().get().getResultMap());
+                });
+                resultMap.put(item, relationJsonMap.toString());
             } else if (nodeForm.get(item).equals("composeForm")) { // 组合类型的表单
                 String groupTableInfo = iBpmExecuteProcessService.getGroupTableInfo(item);
                 resultMap.put(item, groupTableInfo);
@@ -699,14 +803,11 @@ public class PreExecutionToolClass<R> {
      * @return
      */
     public AjaxResult approvalNode(BpmRunNodeVo bpmRunNodeVo) {
-
         /**
          * 不能确定某张表可以发起流程,也就是发起审批的这个条数据需要回传后台标识
          *
          * 表名以及当前数据条的主键,
          */
-
-
         /**
          * 1️⃣1️⃣1️⃣  准备执行节点所需数据
          * * 审批节点不过是通过、未通过、驳回等状态信息
@@ -719,8 +820,6 @@ public class PreExecutionToolClass<R> {
         String taskNextNodeKey = XmlDataParserUtils.getNextNodeKey(bpmRunNodeVo.getTaskProcessXmlContent(), taskNodeKey);
         // 获取当前节点的下个节点类型
         String taskNextNodeType = XmlDataParserUtils.getNodeType(bpmRunNodeVo.getTaskProcessXmlContent(), taskNextNodeKey);
-
-
         // 得到当前执行的流程信息
         BpmExecuteProcess currentBpmExecuteProcess = runBpmExecuteProcessMapper.selectBpmExecuteProcessByTaskKey(taskProcessKey);
         // 得到当前节点的所有信息-》审批类型节点会出现节点后给某张表插入数据
@@ -752,22 +851,21 @@ public class PreExecutionToolClass<R> {
         BpmExecuteNodeLog bpmExecuteNodeLog = new BpmExecuteNodeLog(currentBpmExecuteNode);
         iBpmExecuteNodeLogService.insertBpmExecuteNodeLog(bpmExecuteNodeLog);
 
-        // 4️⃣4️⃣4️⃣  判断是否结束审批流程
-        if (taskNextNodeType.equals("endEvent")) {
+        // 4️⃣4️⃣4️⃣  判断是否结束审批流程  || 不通过流程直接结束 || 驳回流程直接结束
+        if (approvalStatus.equals("noPass") || approvalStatus.equals("reject") || taskNextNodeType.equals("endEvent")) {
             // 当前节点是改流程的最后一个节点,默认执行结束节点
-            // 结束节点也是只修改状态
-            // runBpmExecuteProcessMapper.updateProcessNode();
 
             // 审批流程结束,修改当前审批关联数据条的关联数据条的状态(bpm_approval_status)
-            // 审批状态 (0:已提交、1:已通过、2:不通过、4:驳回、5:审批中)
-            // iBpmApprovalStatusService.updateBpmApprovalStatus();
-//            iBpmApprovalStatusService.updateBpmApprovalStatus();
-        }
+            // 具体修改数据条的状态应当是根据结束节点的上个节点的状态来判断
+            String status = getuApprovalStatus(approvalStatus);
 
-        /**
-         * €23092802001001001820€0990€23-0€0001€BTS高弹单丝轻网€100D/36f€001特黑€AA
-         */
+            // 更新审批的数据条状态
+            iBpmApprovalStatusService.updateBpmApprovalStatusByTaskKey(new BpmApprovalStatus(status, bpmRunNodeVo.getTaskProcessKey()));
 
+            // 结束当前流程
+            return AjaxResult.success(runBpmExecuteProcessMapper.endProcess(bpmRunNodeVo.getTaskProcessKey()));
+
+        }
 
         /* 审批的发起操作,相当于这个流程的开始
            那么用户首次调用当前接口,都会就是一级审批
@@ -780,11 +878,39 @@ public class PreExecutionToolClass<R> {
 
            流程发起时的表单数据开始存在用户的表中,所以同生产流程逻辑一样。
            在发起这个流程的时候记录当前的数据条的表名以及表主键
-
         */
 
 
         return AjaxResult.success();
     }
 
+
+    // 当前节点在操作最后一个审批节点时根据审批的节点状态来更改当前审批数据条的状态
+    public String getuApprovalStatus(String code) {
+        // 审批状态 pass:通过、noPass:不通过、reject:驳回
+        // '审批状态 (0:已提交、1:已通过、2:不通过、4:驳回、5:审批中)'
+        if ("pass".equals(code)) return "1";
+        if ("noPass".equals(code)) return "2";
+        if ("reject".equals(code)) return "4";
+        return "5";
+    }
+
+    // 撤销申请数据条操作
+    @Transactional
+    public AjaxResult revokeApplication(BpmRunNodeVo bpmRunNodeVo) {
+        // 当前执行流程编号
+        String taskKey = bpmRunNodeVo.getTaskProcessKey();
+        // 得到当前数据条的表信息,修改当前数据条的审批状态值
+        BpmApprovalStatus bpmApprovalStatus = iBpmApprovalStatusService.selectBpmApprovalStatusByTaskKey(taskKey);
+        // 删除申请流程(修改申请数据条的状态)
+        // 在流程状态中4 表示撤销
+        iBpmExecuteProcessService.updateProcessStateByKey("4", taskKey);
+        // 修改提交审批的数据条状态-》 调用共通接口执行
+        // 数据条审批状态(默认字段 0:未提交 1:已提交 2:已撤销 3:已通过)
+        iBpmApprovalStatusService.updateApprovalStatusByTableName(bpmApprovalStatus.getTableName(), "2", bpmApprovalStatus.getTableId());
+        // 修改中间表状态:撤回
+        iBpmApprovalStatusService.updateBpmApprovalStatusByTaskKey(new BpmApprovalStatus("3", taskKey));
+
+        return AjaxResult.success();
+    }
 }

+ 34 - 9
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IBpmApprovalStatusService.java

@@ -6,23 +6,30 @@ import java.util.List;
 
 /**
  * 审批数据条中间Service接口
- * 
+ *
  * @author hzh
  * @date 2024-01-31
  */
-public interface IBpmApprovalStatusService 
-{
+public interface IBpmApprovalStatusService {
     /**
      * 查询审批数据条中间
-     * 
+     *
      * @param id 审批数据条中间主键
      * @return 审批数据条中间
      */
     public BpmApprovalStatus selectBpmApprovalStatusById(Long id);
 
+    /**
+     * 查询审批数据条中间
+     *
+     * @param taskKey 流程任务key
+     * @return 审批数据条中间
+     */
+    public BpmApprovalStatus selectBpmApprovalStatusByTaskKey(String taskKey);
+
     /**
      * 查询审批数据条中间列表
-     * 
+     *
      * @param bpmApprovalStatus 审批数据条中间
      * @return 审批数据条中间集合
      */
@@ -30,7 +37,7 @@ public interface IBpmApprovalStatusService
 
     /**
      * 新增审批数据条中间
-     * 
+     *
      * @param bpmApprovalStatus 审批数据条中间
      * @return 结果
      */
@@ -38,7 +45,7 @@ public interface IBpmApprovalStatusService
 
     /**
      * 修改审批数据条中间
-     * 
+     *
      * @param bpmApprovalStatus 审批数据条中间
      * @return 结果
      */
@@ -46,7 +53,7 @@ public interface IBpmApprovalStatusService
 
     /**
      * 批量删除审批数据条中间
-     * 
+     *
      * @param ids 需要删除的审批数据条中间主键集合
      * @return 结果
      */
@@ -54,9 +61,27 @@ public interface IBpmApprovalStatusService
 
     /**
      * 删除审批数据条中间信息
-     * 
+     *
      * @param id 审批数据条中间主键
      * @return 结果
      */
     public int deleteBpmApprovalStatusById(Long id);
+
+    /**
+     * 修改当前审批条状态根据任务key
+     *
+     * @param bpmApprovalStatus
+     * @return
+     */
+    public int updateBpmApprovalStatusByTaskKey(BpmApprovalStatus bpmApprovalStatus);
+
+    /**
+     * 修改用户业务表中审批数据条状态
+     *
+     * @param tableName 表名
+     * @param state     状态值
+     * @param where     条件
+     * @return
+     */
+    public int updateApprovalStatusByTableName(String tableName, String state, String where);
 }

+ 29 - 3
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IBpmExecuteProcessService.java

@@ -1,12 +1,12 @@
 package com.zkqy.execution.produce.dispersed.service;
 
 
-
 import com.zkqy.common.core.domain.AjaxResult;
 import com.zkqy.execution.produce.dispersed.entity.BpmExecuteProcess;
 import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
 
 import java.util.List;
+import java.util.Map;
 
 /**
  * 流程执行任务Service接口
@@ -29,7 +29,7 @@ public interface IBpmExecuteProcessService {
      * @param bpmExecuteProcess 流程执行任务
      * @return 流程执行任务集合
      */
-     List<CommonEntity> selectBpmExecuteProcessList(BpmExecuteProcess bpmExecuteProcess) throws Exception;
+    List<CommonEntity> selectBpmExecuteProcessList(BpmExecuteProcess bpmExecuteProcess) throws Exception;
 
     /**
      * 查询流程执行记录log列表
@@ -78,15 +78,41 @@ public interface IBpmExecuteProcessService {
      * @param commonEntity 预执行流程任务实体
      * @return
      */
-    public AjaxResult productionScheduling(CommonEntity commonEntity)  ;
+    public AjaxResult productionScheduling(CommonEntity commonEntity);
 
     /**
      * 根据formId查询form表单信息
      */
     public String getFromInfo(String fid);
 
+
+    /**
+     * 通过formKey查询表单信息
+     *
+     * @param formKey
+     * @return
+     */
+    String getFromInfoByFormKey(String formKey);
+
+    /**
+     * 通过formKeys查询表单信息
+     *
+     * @param objectMap
+     * @return
+     */
+    List<CommonEntity>  getFromInfoByFormKeys(String[] formKeys);
+
     /**
      * 根据groupKey查询表格组对应的表格信息
      */
     public String getGroupTableInfo(String groupKey);
+
+    /**
+     * 根据当前执行的流程key修改当前执行流程状态
+     *
+     * @param taskProcessState 修改的状态
+     * @param taskKey          执行流程key
+     * @return
+     */
+    public int updateProcessStateByKey(String taskProcessState, String taskKey);
 }

+ 71 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/IDragFormGroupService.java

@@ -0,0 +1,71 @@
+package com.zkqy.execution.produce.dispersed.service;
+
+
+import com.zkqy.execution.produce.dispersed.entity.DragFormGroup;
+
+import java.util.List;
+
+/**
+ * 动态表单组Service接口
+ * 
+ * @author hzh
+ * @date 2024-01-26
+ */
+public interface IDragFormGroupService 
+{
+    /**
+     * 查询动态表单组
+     * 
+     * @param id 动态表单组主键
+     * @return 动态表单组
+     */
+    public DragFormGroup selectDragFormGroupById(Long id);
+
+    /**
+     * 查询动态表单组
+     *
+     * @param groupKey 动态表单组key
+     * @return 动态表单组
+     */
+    public DragFormGroup selectDragFormGroupByKey(String groupKey);
+
+    /**
+     * 查询动态表单组列表
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 动态表单组集合
+     */
+    public List<DragFormGroup> selectDragFormGroupList(DragFormGroup dragFormGroup);
+
+    /**
+     * 新增动态表单组
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 结果
+     */
+    public int insertDragFormGroup(DragFormGroup dragFormGroup);
+
+    /**
+     * 修改动态表单组
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 结果
+     */
+    public int updateDragFormGroup(DragFormGroup dragFormGroup);
+
+    /**
+     * 批量删除动态表单组
+     * 
+     * @param ids 需要删除的动态表单组主键集合
+     * @return 结果
+     */
+    public int deleteDragFormGroupByIds(Long[] ids);
+
+    /**
+     * 删除动态表单组信息
+     * 
+     * @param id 动态表单组主键
+     * @return 结果
+     */
+    public int deleteDragFormGroupById(Long id);
+}

+ 15 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/BpmApprovalStatusServiceImpl.java

@@ -32,6 +32,11 @@ public class BpmApprovalStatusServiceImpl implements IBpmApprovalStatusService
         return bpmApprovalStatusMapper.selectBpmApprovalStatusById(id);
     }
 
+    @Override
+    public BpmApprovalStatus selectBpmApprovalStatusByTaskKey(String taskKey) {
+        return bpmApprovalStatusMapper.selectBpmApprovalStatusByTaskKey(taskKey);
+    }
+
     /**
      * 查询审批数据条中间列表
      * 
@@ -91,4 +96,14 @@ public class BpmApprovalStatusServiceImpl implements IBpmApprovalStatusService
     {
         return bpmApprovalStatusMapper.deleteBpmApprovalStatusById(id);
     }
+
+    @Override
+    public int updateBpmApprovalStatusByTaskKey(BpmApprovalStatus bpmApprovalStatus) {
+        return bpmApprovalStatusMapper.updateBpmApprovalStatusByTaskKey(bpmApprovalStatus);
+    }
+
+    @Override
+    public int updateApprovalStatusByTableName(String tableName, String state, String where) {
+        return 0;
+    }
 }

+ 48 - 18
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/BpmExecuteProcessServiceImpl.java

@@ -11,6 +11,7 @@ import com.zkqy.common.utils.StringUtils;
 import com.zkqy.execution.produce.dispersed.entity.BpmExecuteNodeLog;
 import com.zkqy.execution.produce.dispersed.entity.BpmExecuteProcess;
 import com.zkqy.execution.produce.dispersed.entity.CommonEntity;
+import com.zkqy.execution.produce.dispersed.entity.DragFormGroup;
 import com.zkqy.execution.produce.dispersed.mapper.BpmExecuteProcessMapper;
 import com.zkqy.execution.produce.dispersed.runbpm.PreExecutionToolClass;
 import com.zkqy.execution.produce.dispersed.service.IBpmExecuteNodeLogService;
@@ -90,6 +91,13 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
             if (bpmExecuteProcess.getTaskProcessState() == 3L) {
                 // 首先根据当前登陆用户得到他可以执行的所有节点
                 List<CommonEntity> commonEntities = runBpmExecuteProcessMapper.queryExecuteProcessEnd(objectMap);
+                if (bpmExecuteProcess.getTaskProcessType().equals("1")) {
+                    // 审批类型得到当前节点前所执行过的日志
+                    commonEntities.forEach(item -> {
+                        List<BpmExecuteNodeLog> bpmExecuteNodeLogList = iBpmExecuteNodeLogService.selectBpmExecuteNodeLogList(new BpmExecuteNodeLog(item.getResultMap().get("bepTaskKey").toString()));
+                        item.getResultMap().put("nodeLog", bpmExecuteNodeLogList);
+                    });
+                }
                 return commonEntities;
             } else {
                 List<SysRole> sysRoles = SecurityUtils.getLoginUser().getUser().getRoles();
@@ -103,21 +111,30 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
                 objectMap.put("taskRealRoleList", roles);
                 // 首先根据当前登陆用户得到他可以执行的所有节点
                 List<CommonEntity> commonEntities = runBpmExecuteProcessMapper.queryExecuteProcess(objectMap);
-                // 查询异常脚本信息
-                List<CommonEntity> commonEntities1 = bpmExecuteNodeMiddleService.addExceptionScript(commonEntities);
-                commonEntities.forEach(item -> {
-                    String keyName = item.getResultMap().get("benTaskNodeKey").toString();
-                    String taskKey = item.getResultMap().get("bepTaskKey").toString();
-                    item.getResultMap().putAll(
-                            commonEntities1.stream()
-                                    .filter(ctem ->
-                                            ctem.getResultMap().get("benTaskNodeKey").equals(keyName)
-                                                    && ctem.getResultMap().get("bepTaskKey").equals(taskKey))
-                                    .findFirst()
-                                    .get()
-                                    .getResultMap()
-                    );
-                });
+                // 0 工业类型 1 审批类型
+                if (bpmExecuteProcess.getTaskProcessType().equals("1")) {
+                    // 审批类型得到当前节点前所执行过的日志
+                    commonEntities.forEach(item -> {
+                        List<BpmExecuteNodeLog> bpmExecuteNodeLogList = iBpmExecuteNodeLogService.selectBpmExecuteNodeLogList(new BpmExecuteNodeLog(item.getResultMap().get("bepTaskKey").toString()));
+                        item.getResultMap().put("nodeLog", bpmExecuteNodeLogList);
+                    });
+                } else if (bpmExecuteProcess.getTaskProcessType().equals("0")) {
+                    // 查询异常脚本信息
+                    List<CommonEntity> commonEntities1 = bpmExecuteNodeMiddleService.addExceptionScript(commonEntities);
+                    commonEntities.forEach(item -> {
+                        String keyName = item.getResultMap().get("benTaskNodeKey").toString();
+                        String taskKey = item.getResultMap().get("bepTaskKey").toString();
+                        item.getResultMap().putAll(
+                                commonEntities1.stream()
+                                        .filter(ctem ->
+                                                ctem.getResultMap().get("benTaskNodeKey").equals(keyName)
+                                                        && ctem.getResultMap().get("bepTaskKey").equals(taskKey))
+                                        .findFirst()
+                                        .get()
+                                        .getResultMap()
+                        );
+                    });
+                }
                 return commonEntities;
             }
         }
@@ -241,6 +258,17 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
         return JSONObject.toJSONString(fromInfo);
     }
 
+    @Override
+    public String getFromInfoByFormKey(String formKey) {
+        Map<String, String> fromInfo = runBpmExecuteProcessMapper.getFromInfoByFormKey(formKey);
+        return JSONObject.toJSONString(fromInfo);
+    }
+
+    @Override
+    public List<CommonEntity> getFromInfoByFormKeys(String[] formKeys) {
+        return runBpmExecuteProcessMapper.getFromInfoByFormKeys(formKeys);
+    }
+
 
     /**
      * 根据groupKey查询表格组对应的表格信息
@@ -292,6 +320,11 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
         return JSONObject.toJSONString(mapList);
     }
 
+    @Override
+    public int updateProcessStateByKey(String taskProcessState, String taskKey) {
+        return runBpmExecuteProcessMapper.updateProcessStateByKey(taskKey);
+    }
+
     // 将实体对象转换为Map的方法
     public static Map<String, Object> convertEntityToMap(Object entity) {
         Map<String, Object> map = new HashMap<>();
@@ -309,11 +342,8 @@ public class BpmExecuteProcessServiceImpl implements IBpmExecuteProcessService {
                 e.printStackTrace();
             }
         }
-
         return map;
     }
-
-
 }
 
 

+ 102 - 0
zkqy-process-execution/src/main/java/com/zkqy/execution/produce/dispersed/service/impl/DragFormGroupServiceImpl.java

@@ -0,0 +1,102 @@
+package com.zkqy.execution.produce.dispersed.service.impl;
+
+import com.zkqy.common.utils.DateUtils;
+import com.zkqy.execution.produce.dispersed.entity.DragFormGroup;
+import com.zkqy.execution.produce.dispersed.mapper.DragFormGroupMapper;
+import com.zkqy.execution.produce.dispersed.service.IDragFormGroupService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 动态表单组Service业务层处理
+ * 
+ * @author hzh
+ * @date 2024-01-26
+ */
+@Service
+public class DragFormGroupServiceImpl implements IDragFormGroupService
+{
+    @Autowired
+    private DragFormGroupMapper dragFormGroupMapper;
+
+    /**
+     * 查询动态表单组
+     * 
+     * @param id 动态表单组主键
+     * @return 动态表单组
+     */
+    @Override
+    public DragFormGroup selectDragFormGroupById(Long id)
+    {
+        return dragFormGroupMapper.selectDragFormGroupById(id);
+    }
+
+    @Override
+    public DragFormGroup selectDragFormGroupByKey(String groupKey) {
+        return dragFormGroupMapper.selectDragFormGroupByKey(groupKey);
+    }
+
+    /**
+     * 查询动态表单组列表
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 动态表单组
+     */
+    @Override
+    public List<DragFormGroup> selectDragFormGroupList(DragFormGroup dragFormGroup)
+    {
+        return dragFormGroupMapper.selectDragFormGroupList(dragFormGroup);
+    }
+
+    /**
+     * 新增动态表单组
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 结果
+     */
+    @Override
+    public int insertDragFormGroup(DragFormGroup dragFormGroup)
+    {
+        dragFormGroup.setCreateTime(DateUtils.getNowDate());
+        return dragFormGroupMapper.insertDragFormGroup(dragFormGroup);
+    }
+
+    /**
+     * 修改动态表单组
+     * 
+     * @param dragFormGroup 动态表单组
+     * @return 结果
+     */
+    @Override
+    public int updateDragFormGroup(DragFormGroup dragFormGroup)
+    {
+        dragFormGroup.setUpdateTime(DateUtils.getNowDate());
+        return dragFormGroupMapper.updateDragFormGroup(dragFormGroup);
+    }
+
+    /**
+     * 批量删除动态表单组
+     * 
+     * @param ids 需要删除的动态表单组主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDragFormGroupByIds(Long[] ids)
+    {
+        return dragFormGroupMapper.deleteDragFormGroupByIds(ids);
+    }
+
+    /**
+     * 删除动态表单组信息
+     * 
+     * @param id 动态表单组主键
+     * @return 结果
+     */
+    @Override
+    public int deleteDragFormGroupById(Long id)
+    {
+        return dragFormGroupMapper.deleteDragFormGroupById(id);
+    }
+}

+ 39 - 21
zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmApprovalStatusMapper.xml

@@ -1,37 +1,45 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.zkqy.execution.produce.dispersed.mapper.BpmApprovalStatusMapper">
-    
+
     <resultMap type="com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus" id="BpmApprovalStatusResult">
-        <result property="id"    column="id"    />
-        <result property="tableName"    column="table_name"    />
-        <result property="tableId"    column="table_id"    />
-        <result property="approvalState"    column="approval_state"    />
-        <result property="taskKey"    column="task_key"    />
+        <result property="id" column="id"/>
+        <result property="tableName" column="table_name"/>
+        <result property="tableId" column="table_id"/>
+        <result property="approvalState" column="approval_state"/>
+        <result property="taskKey" column="task_key"/>
     </resultMap>
 
     <sql id="selectBpmApprovalStatusVo">
-        select id, table_name, table_id, approval_state, task_key from {DBNAME}.bpm_approval_status
+        select id, table_name, table_id, approval_state, task_key
+        from {DBNAME}.bpm_approval_status
     </sql>
 
-    <select id="selectBpmApprovalStatusList" parameterType="com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus" resultMap="BpmApprovalStatusResult">
+    <select id="selectBpmApprovalStatusList"
+            parameterType="com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus"
+            resultMap="BpmApprovalStatusResult">
         <include refid="selectBpmApprovalStatusVo"/>
-        <where>  
-            <if test="tableName != null  and tableName != ''"> and table_name like concat('%', #{tableName}, '%')</if>
-            <if test="tableId != null  and tableId != ''"> and table_id = #{tableId}</if>
-            <if test="approvalState != null  and approvalState != ''"> and approval_state = #{approvalState}</if>
-            <if test="taskKey != null  and taskKey != ''"> and task_key = #{taskKey}</if>
+        <where>
+            <if test="tableName != null  and tableName != ''">and table_name like concat('%', #{tableName}, '%')</if>
+            <if test="tableId != null  and tableId != ''">and table_id = #{tableId}</if>
+            <if test="approvalState != null  and approvalState != ''">and approval_state = #{approvalState}</if>
+            <if test="taskKey != null  and taskKey != ''">and task_key = #{taskKey}</if>
         </where>
     </select>
-    
+
     <select id="selectBpmApprovalStatusById" parameterType="Long" resultMap="BpmApprovalStatusResult">
         <include refid="selectBpmApprovalStatusVo"/>
         where id = #{id}
     </select>
-        
-    <insert id="insertBpmApprovalStatus" parameterType="com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus" useGeneratedKeys="true" keyProperty="id">
+    <select id="selectBpmApprovalStatusByTaskKey" parameterType="String" resultMap="BpmApprovalStatusResult">
+        <include refid="selectBpmApprovalStatusVo"/>
+        where task_key = #{taskKey}
+    </select>
+
+    <insert id="insertBpmApprovalStatus" parameterType="com.zkqy.execution.produce.dispersed.entity.BpmApprovalStatus"
+            useGeneratedKeys="true" keyProperty="id">
         insert into {DBNAME}.bpm_approval_status
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="tableName != null">table_name,</if>
@@ -63,15 +71,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <trim prefix="SET" suffixOverrides=",">
             <if test="approvalState != null">approval_state = #{approvalState},</if>
         </trim>
-        where taskKey = #{taskKey}
+        where task_key = #{taskKey}
+    </update>
+
+    <update id="updateApprovalStatusByTableName">
+        update {DBNAME}.#{tableName}
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="approvalState != null">approval_state = #{approvalState},</if>
+        </trim>
+        where #{where}
     </update>
 
     <delete id="deleteBpmApprovalStatusById" parameterType="Long">
-        delete from bpm_approval_status where id = #{id}
+        delete
+        from bpm_approval_status
+        where id = #{id}
     </delete>
 
     <delete id="deleteBpmApprovalStatusByIds" parameterType="String">
-        delete from bpm_approval_status where id in 
+        delete from bpm_approval_status where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
             #{id}
         </foreach>

+ 25 - 0
zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/BpmExecuteProcessMapper.xml

@@ -297,6 +297,24 @@
         where f_id=#{fid}
     </select>
 
+    <select id="getFromInfoByFormKey" resultType="java.util.Map" parameterType="string">
+        select *
+        from {DBNAME}.drag_form
+        where form_key=#{formKey}
+    </select>
+
+    <select id="getFromInfoByFormKeys" resultMap="retMap">
+        select *
+        from {DBNAME}.drag_form
+        <where>
+            form_key in
+            <foreach item="processId" collection="array" open="(" separator="," close=")">
+                #{processId}
+            </foreach>
+        </where>
+    </select>
+
+
     <select id="getGroupInfo" resultType="java.util.Map" parameterType="string">
         select *
         from {DBNAME}.drag_table_group
@@ -396,5 +414,12 @@
     </select>
 
 
+    <update id="updateProcessStateByKey">
+        update {DBNAME}.bpm_execute_process
+        SET task_process_state = 4
+        where task_key = #{taskKey}
+    </update>
+
+
 </mapper>
 

+ 139 - 0
zkqy-process-execution/src/main/resources/mapper/bpm/dispersed/DragFormGroupMapper.xml

@@ -0,0 +1,139 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.zkqy.execution.produce.dispersed.mapper.DragFormGroupMapper">
+
+    <resultMap type="com.zkqy.execution.produce.dispersed.entity.DragFormGroup" id="DragFormGroupResult">
+        <result property="id" column="id"/>
+        <result property="groupKey" column="group_key"/>
+        <result property="fGName" column="f_g_name"/>
+        <result property="remark" column="remark"/>
+        <result property="formKeys" column="form_keys"/>
+        <result property="mainTable" column="main_table"/>
+        <result property="relationJson" column="relation_json"/>
+        <result property="showDataSql" column="show_data_sql"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="updateBy" column="update_by"/>
+        <result property="updateById" column="update_by_id"/>
+        <result property="createTime" column="create_time"/>
+        <result property="createById" column="create_by_id"/>
+        <result property="createBy" column="create_by"/>
+        <result property="delFlag" column="del_flag"/>
+    </resultMap>
+
+    <sql id="selectDragFormGroupVo">
+        select id,
+               group_key,
+               f_g_name,
+               remark,
+               form_keys,
+               main_table,
+               relation_json,
+               show_data_sql,
+               update_time,
+               update_by,
+               update_by_id,
+               create_time,
+               create_by_id,
+               create_by
+        from {DBNAME}.drag_form_group
+    </sql>
+
+    <select id="selectDragFormGroupList" parameterType="com.zkqy.execution.produce.dispersed.entity.DragFormGroup"
+            resultMap="DragFormGroupResult">
+        <include refid="selectDragFormGroupVo"/>
+        <where>
+            and del_flag = 0
+            <if test="groupKey != null  and groupKey != ''">and group_key = #{groupKey}</if>
+            <if test="fGName != null  and fGName != ''">and f_g_name like concat('%', #{fGName}, '%')</if>
+            <if test="formKeys != null  and formKeys != ''">and form_keys = #{formKeys}</if>
+            <if test="mainTable != null  and mainTable != ''">and main_table = #{mainTable}</if>
+            <if test="relationJson != null  and relationJson != ''">and relation_json = #{relationJson}</if>
+            <if test="showDataSql != null  and showDataSql != ''">and show_data_sql = #{showDataSql}</if>
+            <if test="updateById != null  and updateById != ''">and update_by_id = #{updateById}</if>
+            <if test="createById != null  and createById != ''">and create_by_id = #{createById}</if>
+        </where>
+    </select>
+
+    <select id="selectDragFormGroupById" parameterType="Long" resultMap="DragFormGroupResult">
+        <include refid="selectDragFormGroupVo"/>
+        where id = #{id}
+    </select>
+    <select id="selectDragFormGroupByKey" parameterType="string" resultMap="DragFormGroupResult">
+        <include refid="selectDragFormGroupVo"/>
+        where group_key = #{groupKey}
+    </select>
+
+    <insert id="insertDragFormGroup" parameterType="com.zkqy.execution.produce.dispersed.entity.DragFormGroup"
+            useGeneratedKeys="true" keyProperty="id">
+        insert into {DBNAME}.drag_form_group
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="groupKey != null">group_key,</if>
+            <if test="fGName != null">f_g_name,</if>
+            <if test="remark != null">remark,</if>
+            <if test="formKeys != null">form_keys,</if>
+            <if test="mainTable != null">main_table,</if>
+            <if test="relationJson != null">relation_json,</if>
+            <if test="showDataSql != null">show_data_sql,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateById != null">update_by_id,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="createById != null">create_by_id,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="delFlag != null">del_flag,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="groupKey != null">#{groupKey},</if>
+            <if test="fGName != null">#{fGName},</if>
+            <if test="remark != null">#{remark},</if>
+            <if test="formKeys != null">#{formKeys},</if>
+            <if test="mainTable != null">#{mainTable},</if>
+            <if test="relationJson != null">#{relationJson},</if>
+            <if test="showDataSql != null">#{showDataSql},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateById != null">#{updateById},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="createById != null">#{createById},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+        </trim>
+    </insert>
+
+    <update id="updateDragFormGroup" parameterType="com.zkqy.execution.produce.dispersed.entity.DragFormGroup">
+        update {DBNAME}.drag_form_group
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="groupKey != null">group_key = #{groupKey},</if>
+            <if test="fGName != null">f_g_name = #{fGName},</if>
+            <if test="remark != null">remark = #{remark},</if>
+            <if test="formKeys != null">form_keys = #{formKeys},</if>
+            <if test="mainTable != null">main_table = #{mainTable},</if>
+            <if test="relationJson != null">relation_json = #{relationJson},</if>
+            <if test="showDataSql != null">show_data_sql = #{showDataSql},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateById != null">update_by_id = #{updateById},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="createById != null">create_by_id = #{createById},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteDragFormGroupById" parameterType="Long">
+        update {DBNAME}.drag_form_group
+        set del_flag = 2
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteDragFormGroupByIds" parameterType="String">
+        update {DBNAME}.drag_form_group
+        set del_flag = 2 where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>