Selaa lähdekoodia

工作流功能节点一些查询接口修改,表单编辑器接口调整

chenc 3 vuotta sitten
vanhempi
commit
ca70800631

+ 2 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/entity/ProcessInsVo.java

@@ -44,6 +44,8 @@ public class ProcessInsVo {
 
     private String applyer;
 
+    private Integer idInteger;
+
     public ProcessInsVo(ProcessInstance pi){
         this.id = pi.getId();
         this.name = pi.getName();

+ 7 - 6
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/service/Impl/ActBusinessServiceImpl.java

@@ -58,13 +58,14 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
                 StringBuilder filedsB = new StringBuilder("id");
                 StringBuilder filedsVB = new StringBuilder("'"+tableId+"'");
                 for (String filed : fileds) {
-                    filedsB.append(","+filed);
-                    if(!request.getParameter(filed).equals("")){
-                        filedsVB.append(",'"+getValueString(request.getParameter(filed))+"'");
-                    }else{
-                        filedsVB.append(",'"+getValueString(request.getParameter(filed+"[]"))+"'");
+                    if(!((request.getParameter(filed)==null||request.getParameter(filed).equals("null"))&&(request.getParameter(filed+"[]")==null||request.getParameter(filed+"[]").equals("null")))){
+                        filedsB.append(","+filed);
+                        if(!request.getParameter(filed).equals("")){
+                            filedsVB.append(",'"+getValueString(request.getParameter(filed))+"'");
+                        }else{
+                            filedsVB.append(",'"+getValueString(request.getParameter(filed+"[]"))+"'");
+                        }
                     }
-
                 }
             this.baseMapper.insertBusiData(String.format("INSERT INTO %s (%s) VALUES (%s)",tableName,filedsB.toString(),filedsVB.toString()));
 

+ 22 - 5
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActProcessInsController.java

@@ -21,10 +21,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -87,7 +84,6 @@ public class ActProcessInsController {
         if(StrUtil.isNotBlank(key)) {
             query.processDefinitionKey(key);
         }
-
         List<ProcessInstance> processInstanceList = query.list();
         processInstanceList.forEach(e -> {
             list.add(new ProcessInsVo(e));
@@ -126,6 +122,27 @@ public class ActProcessInsController {
                 e.setTableName(actBusiness.getTableName());
             }
         });
+        //判断是否查询出数据
+        if(list!=null&&list.size()>0){
+            for(ProcessInsVo processInsVo:list){
+                processInsVo.setIdInteger(Integer.valueOf(processInsVo.getId()));
+            }
+            //根据流程id排倒序
+            Collections.sort(list, new Comparator(){
+                @Override
+                public int compare(Object o1, Object o2) {
+                    ProcessInsVo stu1=(ProcessInsVo)o1;
+                    ProcessInsVo stu2=(ProcessInsVo)o2;
+                    if(stu2.getIdInteger()>stu1.getIdInteger()){
+                        return 1;
+                    }else if(stu2.getIdInteger()==stu1.getIdInteger()){
+                        return 0;
+                    }else{
+                        return -1;
+                    }
+                }
+            });
+        }
         return Result.ok(list);
     }
     /*通过id删除运行中的实例*/

+ 28 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/TbTableInfoController.java

@@ -127,6 +127,34 @@ public class TbTableInfoController {
         return Result.ok(tableInfo);
     }
 
+    /**
+    * @Author chenchuang
+    * @Description //TODO 编辑器通过数据表名查询表单集合
+    * @Date 2021/7/28 13:40
+    * @Param [businessTable]
+    * @return org.jeecg.common.api.vo.Result<java.lang.Object>
+    */
+    @RequestMapping("/editorQuery")
+    public Result<Object> editorQuery(String businessTable){
+        TbTableInfo tableInfo=new TbTableInfo();
+        QueryWrapper<TbTableInfo> queryWrapper2 = new QueryWrapper<TbTableInfo>().eq("business_table", businessTable).eq("del_flag","0").orderByAsc("create_time");
+        List<TbTableInfo> tbTableInfoList=tbTableInfoService.list(queryWrapper2);
+        if(tbTableInfoList!=null){
+            for(TbTableInfo t:tbTableInfoList){
+                Object obj2 = JSONObject.parseObject(t.getContent());
+                t.setJsonContent(obj2);
+            }
+            //如果查询出来只有一条则返回对象不包含集合
+            if(tbTableInfoList.size()==1){
+                tableInfo=tbTableInfoList.get(0);
+            }else{
+                //反之则包含对象
+                tableInfo.setTbTableInfoList(tbTableInfoList);
+            }
+        }
+        return Result.ok(tableInfo);
+    }
+
     /**
     * @Author chenchuang
     * @Description //TODO 获取表名和表注释