浏览代码

代码优化

wangliang 1 年之前
父节点
当前提交
f083879ae9

+ 0 - 2
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -177,8 +177,6 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                         }
                     }
                     d.setTaskId(Long.parseLong(taskIds));
-                } else {
-                    d.setMyself(false);
                 }
             }
         }

+ 9 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBProjectExchangeServiceImpl.java

@@ -20,6 +20,7 @@ import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.IdentityLink;
 import org.activiti.engine.task.Task;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -126,6 +127,14 @@ public class TBProjectExchangeServiceImpl extends ServiceImpl<TBProjectExchangeM
         DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
         IPage<ProjectExchangeResult> list = this.baseMapper.list(iPage, serviceId, createUserId, Objects.nonNull(type) ? type.name() : null, Objects.nonNull(customType) ? customType.name() : null, Objects.nonNull(flowStatus) ? flowStatus.name() : null, customName, exchangeNo, startTime, endTime, dpr);
         for (ProjectExchangeResult p : list.getRecords()) {
+            TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLog(p.getFlowId());
+            if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getPendApproveId())) {
+                List<SysUser> sysUserList = sysUserService.listByIds(Arrays.asList(tfFlowLog.getPendApproveId().split(",")));
+                List<String> userName = sysUserList.stream().map(s -> s.getRealName()).collect(Collectors.toList());
+                p.setApproveUsersName(StringUtils.join(userName, ","));
+            } else {
+                p.setApproveUsersName("--");
+            }
             if (Objects.nonNull(p.getTaskId())) {
                 Task task = taskService.createTaskQuery().taskId(String.valueOf(p.getTaskId())).singleResult();
                 if (Objects.nonNull(task.getAssignee()) && task.getAssignee().equals(requestUser.getId().toString())) {

+ 13 - 4
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBQualityProblemApplyServiceImpl.java

@@ -13,10 +13,7 @@ import com.qmth.sop.business.bean.result.FlowFormWidgetResult;
 import com.qmth.sop.business.bean.result.FlowResult;
 import com.qmth.sop.business.bean.result.FlowTaskResult;
 import com.qmth.sop.business.bean.result.TBQualityProblemApplyResult;
-import com.qmth.sop.business.entity.SysUser;
-import com.qmth.sop.business.entity.TBQualityProblemApply;
-import com.qmth.sop.business.entity.TFCustomFlowAllocation;
-import com.qmth.sop.business.entity.TFCustomFlowEntity;
+import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.mapper.TBQualityProblemApplyMapper;
 import com.qmth.sop.business.service.*;
 import com.qmth.sop.common.contant.SystemConstant;
@@ -26,6 +23,7 @@ import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.IdentityLink;
 import org.activiti.engine.task.Task;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
@@ -67,6 +65,9 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
     @Resource
     TFCustomFlowAllocationService tfCustomFlowAllocationService;
 
+    @Resource
+    TFFlowLogService tfFlowLogService;
+
     /**
      * 查询列表
      *
@@ -94,6 +95,14 @@ public class TBQualityProblemApplyServiceImpl extends ServiceImpl<TBQualityProbl
                     }
                 }
             }
+            TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLog(p.getFlowId());
+            if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getPendApproveId())) {
+                List<SysUser> sysUserList = sysUserService.listByIds(Arrays.asList(tfFlowLog.getPendApproveId().split(",")));
+                List<String> userName = sysUserList.stream().map(s -> s.getRealName()).collect(Collectors.toList());
+                p.setPendApproveUsers(StringUtils.join(userName, ","));
+            } else {
+                p.setPendApproveUsers("--");
+            }
         }
         return resultIPage;
     }

+ 11 - 0
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBSopInfoServiceImpl.java

@@ -21,6 +21,7 @@ import com.qmth.sop.common.util.ServletUtil;
 import org.activiti.engine.TaskService;
 import org.activiti.engine.task.IdentityLink;
 import org.activiti.engine.task.Task;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -468,6 +469,16 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                 }
             }
 
+            String flowId = (String) m.get("flowId");
+            TFFlowLog tfFlowLog = tfFlowLogService.findByLastFlowLog(Long.parseLong(flowId));
+            if (Objects.nonNull(tfFlowLog) && Objects.nonNull(tfFlowLog.getPendApproveId())) {
+                List<SysUser> sysUserList = sysUserService.listByIds(Arrays.asList(tfFlowLog.getPendApproveId().split(",")));
+                List<String> userName = sysUserList.stream().map(s -> s.getRealName()).collect(Collectors.toList());
+                m.put("pendApproveName", StringUtils.join(userName, ","));
+            } else {
+                m.put("pendApproveName", "--");
+            }
+
             String taskIds = (String) m.get("taskId");
             if (Objects.nonNull(taskIds) && taskIds.contains(",")) {
                 String[] taskStrs = taskIds.split(",");

+ 3 - 3
sop-business/src/main/resources/mapper/TBProjectExchangeMapper.xml

@@ -32,9 +32,9 @@
             tfcfe.t_f_custom_flow_id as customFlowId,
             tfcf.flow_deployment_id as flowDeploymentId,
             tfcfe.id as customFlowEntityid,
-            tffa.update_time as flowTime,
-            IFNULL((select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
-             where find_in_set(us1.id, (select tffl.pend_approve_id from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1))),'--') as approveUsersName
+            tffa.update_time as flowTime
+--             IFNULL((select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
+--              where find_in_set(us1.id, (select tffl.pend_approve_id from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1))),'--') as approveUsersName
         from t_b_project_exchange tbpe
                  left join t_f_custom_flow_entity tfcfe on tfcfe.code = tbpe.exchange_no
                  left join t_f_flow_approve tffa on tffa.flow_id = tfcfe.flow_id

+ 1 - 5
sop-business/src/main/resources/mapper/TBQualityProblemApplyMapper.xml

@@ -16,11 +16,7 @@
         fe.flow_id as flowId,
         art.NAME_ as taskName,
         art.TASK_DEF_KEY_ as taskDefKey,
-        (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = fa.flow_id) as taskId,
-        (select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
-        where find_in_set(us1.id, a.user_ids)) user_names,
-        IFNULL((select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
-        where find_in_set(us1.id, (select tffl.pend_approve_id from t_f_flow_log tffl where tffl.flow_id = fe.flow_id order by tffl.create_time desc limit 1))),'--') pend_approve_users
+        (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = fa.flow_id) as taskId
         FROM
         t_b_quality_problem_apply a
         LEFT JOIN t_b_sop_info si on si.sop_no = a.sop_no

+ 4 - 4
sop-business/src/main/resources/mapper/TBSopInfoMapper.xml

@@ -74,10 +74,10 @@
                tfcf.version,
                cast(tfcf.flow_deployment_id as char) as flowDeploymentId,
                art.NAME_ as taskName,
-               art.TASK_DEF_KEY_ as taskDefKey,
-               (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = tffa.flow_id) as taskId,
-               IFNULL((select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
-                where find_in_set(us1.id, (select tffl.pend_approve_id from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1))),'--') as pendApproveName
+               art.TASK_DEF_KEY_ as taskDefKey
+--                (select group_concat(cast(art.ID_ as char)) from ACT_RU_TASK art where art.PROC_INST_ID_ = tffa.flow_id) as taskId,
+--                IFNULL((select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
+--                 where find_in_set(us1.id, (select tffl.pend_approve_id from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1))),'--') as pendApproveName
                 <if test="fieldName != null and fieldName != ''">
                     ,${fieldName}
                 </if>