yuansh vor 2 Jahren
Ursprung
Commit
6fef0e80ac

+ 3 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/entity/ActBusiness.java

@@ -33,6 +33,9 @@ public class ActBusiness {
 	/**表单路由*/
 	@TableField(exist=false)
 	private String routeName;
+	/**临时字段*/
+	@TableField(exist=false)
+	private String description;
 	/**流程名称*/
 	@TableField(exist=false)
     private String processName;

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

@@ -2,18 +2,27 @@ package org.jeecg.modules.activiti.service.Impl;
 
 import cn.hutool.core.map.MapUtil;
 import cn.hutool.core.util.IdUtil;
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.google.common.collect.Lists;
 import org.activiti.engine.delegate.DelegateExecution;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.SecurityUtils;
 import org.jeecg.common.system.vo.LoginUser;
+import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.activiti.entity.ActBusiness;
+import org.jeecg.modules.activiti.entity.ActZprocess;
+import org.jeecg.modules.activiti.entity.TbTableInfoPractice;
 import org.jeecg.modules.activiti.mapper.ActBusinessMapper;
+import org.jeecg.modules.activiti.mapper.ActZprocessMapper;
+import org.jeecg.modules.activiti.mapper.TbTableInfoPracticeMapper;
 import org.jeecg.modules.activiti.service.IActBusinessService;
+import org.jeecg.modules.activiti.service.IActZprocessService;
+import org.jeecg.modules.activiti.service.ITbTableInfoPracticeService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import javax.servlet.http.HttpServletRequest;
@@ -34,6 +43,10 @@ import java.util.Map;
 public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBusiness> implements IActBusinessService {
     @Autowired
     ActBusinessMapper actBusinessMapper;
+    @Autowired
+    ActZprocessMapper actZprocessMapper;
+    @Autowired
+    TbTableInfoPracticeMapper tbTableInfoPracticeMapper;
 
     public List<ActBusiness> findByProcDefId(String id) {
        return this.list(new LambdaQueryWrapper<ActBusiness>().eq(ActBusiness::getProcDefId,id));
@@ -51,6 +64,7 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
 //           String json = getRequestPostStr(request);
 //           JSONObject jsonObject = JSONObject.parseObject(json);
 
+
             String tableName = request.getParameter("tableName");
             String filedNames = request.getParameter("filedNames");
             //子表
@@ -67,7 +81,7 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
             Map<String, Object> busiData = this.baseMapper.getBusiData(tableId, tableName);
             String[] fileds = filedNames.split(",");
 
-        Date date = new Date();
+            Date date = new Date();
             if (MapUtil.isEmpty(busiData)){ //没有,新增逻辑
                 StringBuilder filedsB = new StringBuilder("id");
                 StringBuilder filedsVB = new StringBuilder("'"+tableId+"'");
@@ -259,6 +273,80 @@ public class ActBusinessServiceImpl extends ServiceImpl<ActBusinessMapper, ActBu
                     }
                 }
         }
+
+        StringBuilder sbExtraInfo = new StringBuilder();
+        if (MapUtil.isEmpty(busiData)) { //没有,新增逻辑
+
+            String procDefId = request.getParameter("procDefId");
+
+            ActZprocess actZprocess = actZprocessMapper.selectById(procDefId);
+            TbTableInfoPractice tableInfoPractice = null;
+
+            if (actZprocess != null) {
+
+                QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
+                practiceQueryWrapper.eq("business_table_id", tableId);
+                tableInfoPractice = tbTableInfoPracticeMapper.selectOne(practiceQueryWrapper);
+
+                String pattern = oConvertUtils.getString(actZprocess.getDescription());
+                if (oConvertUtils.isNotEmpty(pattern) && pattern.startsWith("(") && pattern.endsWith(")") && tableInfoPractice != null){
+                    pattern = pattern.replace("(","").replace(")","");
+                    if (oConvertUtils.isNotEmpty(pattern)){
+                        String[] arr = pattern.split(",");
+                        for (String str : arr){
+                            String par = request.getParameter(str);
+                            if(StringUtils.isBlank(par)){
+                                continue;
+                            }
+                            sbExtraInfo.append(par+" ");
+                        }
+                        if (sbExtraInfo.length()>0){
+                            tableInfoPractice.setExtraInfo(sbExtraInfo.toString());
+                            tbTableInfoPracticeMapper.updateById(tableInfoPractice);
+                        }
+                    }
+                }
+
+            }
+        }else{
+
+            String procDefId = request.getParameter("procDefId");
+            ActBusiness actBusiness = actBusinessMapper.selectById(procDefId);
+            if(actBusiness !=null ){
+                ActZprocess actZprocess = actZprocessMapper.selectById(actBusiness.getProcDefId());
+                TbTableInfoPractice tableInfoPractice = null;
+                if (actZprocess != null) {
+
+                    QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
+                    practiceQueryWrapper.eq("business_table_id", actBusiness.getTableId());
+                    tableInfoPractice = tbTableInfoPracticeMapper.selectOne(practiceQueryWrapper);
+
+                    String pattern = oConvertUtils.getString(actZprocess.getDescription());
+
+                    if (oConvertUtils.isNotEmpty(pattern) && pattern.startsWith("(") && pattern.endsWith(")") && tableInfoPractice != null){
+                        pattern = pattern.replace("(","").replace(")","");
+                        if (oConvertUtils.isNotEmpty(pattern)){
+                            String[] arr = pattern.split(",");
+                            for (String str : arr){
+                                String par = request.getParameter(str);
+                                if(StringUtils.isBlank(par)){
+                                    continue;
+                                }
+                                sbExtraInfo.append(par+" ");
+                            }
+                            if (sbExtraInfo.length()>0){
+                                tableInfoPractice.setExtraInfo(sbExtraInfo.toString());
+                                tbTableInfoPracticeMapper.updateById(tableInfoPractice);
+                            }
+                        }
+                    }
+
+                }
+            }
+        }
+
+
+
     }
 
     public String getValueString(String valueString){

+ 17 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActBusinessController.java

@@ -615,6 +615,23 @@ public class ActBusinessController {
                     e.setCurrTaskName(sb.toString());
                 }
             }
+
+            // 关联额外信息e
+            TbTableInfoPractice tbTableInfoPractice = tbTableInfoPracticeService.getById(e.getTableId());
+            if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())){
+                e.setDescription(tbTableInfoPractice.getExtraInfo());
+            }else{
+                QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
+                practiceQueryWrapper.eq("business_table_id", e.getTableId());
+                tbTableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
+                if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())){
+                    e.setDescription(tbTableInfoPractice.getExtraInfo());
+                }
+            }
+            if (e.getDescription() == null){
+                e.setDescription("");
+            }
+
         });
 
         return Result.ok(actBusinessList);

+ 23 - 0
jeecg-boot/jeecg-boot-module-activiti/src/main/java/org/jeecg/modules/activiti/web/ActTaskController.java

@@ -161,6 +161,13 @@ public class ActTaskController {
             TbTableInfoPractice tbTableInfoPractice = tbTableInfoPracticeService.getById(actBusiness.getTableId());
             if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())){
                 tv.setDescription(tbTableInfoPractice.getExtraInfo());
+            }else{
+                QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
+                practiceQueryWrapper.eq("business_table_id", actBusiness.getTableId());
+                tbTableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
+                if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())){
+                    tv.setDescription(tbTableInfoPractice.getExtraInfo());
+                }
             }
             if (tv.getDescription() == null){
             	tv.setDescription("");
@@ -770,6 +777,22 @@ public class ActTaskController {
             if(actBusiness!=null){
                 htv.setTableId(actBusiness.getTableId());
                 htv.setTableName(actBusiness.getTableName());
+
+                // 关联额外信息e
+                TbTableInfoPractice tbTableInfoPractice = tbTableInfoPracticeService.getById(actBusiness.getTableId());
+                if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())){
+                    htv.setDescription(tbTableInfoPractice.getExtraInfo());
+                }else{
+                    QueryWrapper<TbTableInfoPractice> practiceQueryWrapper = new QueryWrapper<>();
+                    practiceQueryWrapper.eq("business_table_id", actBusiness.getTableId());
+                    tbTableInfoPractice = tbTableInfoPracticeService.getOne(practiceQueryWrapper);
+                    if (tbTableInfoPractice != null && oConvertUtils.isNotEmpty(tbTableInfoPractice.getExtraInfo())){
+                        htv.setDescription(tbTableInfoPractice.getExtraInfo());
+                    }
+                }
+                if (htv.getDescription() == null){
+                    htv.setDescription("");
+                }
             }
 
             list.add(htv);