فهرست منبع

考勤异常流程修改

wangliang 1 سال پیش
والد
کامیت
2cd81565e3

+ 4 - 0
sop-business/src/main/java/com/qmth/sop/business/activiti/service/impl/ActivitiServiceImpl.java

@@ -278,6 +278,8 @@ public class ActivitiServiceImpl implements ActivitiService {
                         } else {
                             if (tfCustomFlow.getType() == TFCustomTypeEnum.DING_EXCEPTION_FLOW && currSetup == 2 && Objects.nonNull(flowApproveParam.getApproveRemark()) && Objects.equals(DingExceptionApproveEnum.NO_PASS.getTitle(), flowApproveParam.getApproveRemark())) {
                                 currSetup = 0;
+                                nrOfCompletedInstances = nrOfInstances;
+                                multiInstance = false;
                             } else {
                                 currSetup = currSetup == setupMap.size() - 1 ? 0 : currSetup + 1;
                             }
@@ -1048,6 +1050,8 @@ public class ActivitiServiceImpl implements ActivitiService {
                             String approveRemark) {
         if (multiInstance) {
             map.computeIfAbsent(FlowApproveOperationEnum.REJECT.getId() + currFlowTaskResult.getSetup(), v -> 0);
+        } else {
+            map.computeIfAbsent(FlowApproveOperationEnum.REJECT.getId() + currFlowTaskResult.getSetup(), v -> 1);
         }
         if (currFlowTaskResult.getSetup().intValue() == setupMap.size() - 1) {
             if (multiInstance && Objects.nonNull(nrOfCompletedInstances)

+ 0 - 4
sop-business/src/main/java/com/qmth/sop/business/service/SysDingGroupService.java

@@ -1,7 +1,6 @@
 package com.qmth.sop.business.service;
 
 import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.qmth.sop.business.bean.result.SysDingGroupResult;
 import com.qmth.sop.business.entity.SysDingGroup;
@@ -47,7 +46,4 @@ public interface SysDingGroupService extends IService<SysDingGroup>{
     * @param id
     */
     void delete(Long id);
-
-
-
 }

+ 8 - 0
sop-business/src/main/java/com/qmth/sop/business/service/SysUserRoleService.java

@@ -67,4 +67,12 @@ public interface SysUserRoleService extends IService<SysUserRole> {
      * @return
      */
     List<UserDto> userListByRoleType(RoleTypeEnum roleTypeEnum);
+
+    /**
+     * 根据服务单元查找用户
+     *
+     * @param serviceId
+     * @return
+     */
+    List<SysUserRole> listByServiceId(Long serviceId);
 }

+ 37 - 7
sop-business/src/main/java/com/qmth/sop/business/service/impl/SysUserRoleServiceImpl.java

@@ -1,14 +1,17 @@
 package com.qmth.sop.business.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.qmth.sop.business.bean.dto.UserDto;
 import com.qmth.sop.business.bean.result.MenuResult;
 import com.qmth.sop.business.cache.CommonCacheService;
-import com.qmth.sop.business.entity.SysRole;
-import com.qmth.sop.business.entity.SysUser;
-import com.qmth.sop.business.entity.SysUserRole;
+import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.mapper.SysUserRoleMapper;
+import com.qmth.sop.business.service.SysDingGroupService;
+import com.qmth.sop.business.service.SysDingObjService;
 import com.qmth.sop.business.service.SysUserRoleService;
+import com.qmth.sop.common.enums.DingObjTypeEnum;
+import com.qmth.sop.common.enums.ExceptionResultEnum;
 import com.qmth.sop.common.enums.RoleTypeEnum;
 import com.qmth.sop.common.util.ServletUtil;
 import org.apache.commons.collections4.CollectionUtils;
@@ -16,10 +19,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
 import javax.annotation.Resource;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Objects;
+import java.util.*;
 import java.util.stream.Collectors;
 
 /**
@@ -36,6 +36,12 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
     @Resource
     CommonCacheService commonCacheService;
 
+    @Resource
+    SysDingGroupService sysDingGroupService;
+
+    @Resource
+    SysDingObjService sysDingObjService;
+
     /**
      * 获取用户菜单
      *
@@ -103,4 +109,28 @@ public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleMapper, SysUs
     public List<UserDto> userListByRoleType(RoleTypeEnum roleTypeEnum) {
         return this.baseMapper.userListByRoleType(Objects.nonNull(roleTypeEnum) ? roleTypeEnum.name() : null);
     }
+
+    /**
+     * 根据服务单元查找用户
+     *
+     * @param serviceId
+     * @return
+     */
+    @Override
+    public List<SysUserRole> listByServiceId(Long serviceId) {
+        SysDingGroup sysDingGroup = sysDingGroupService.getOne(new QueryWrapper<SysDingGroup>().lambda().eq(SysDingGroup::getServiceId, serviceId));
+        Optional.ofNullable(sysDingGroup).orElseThrow(() -> ExceptionResultEnum.SERVICE_DING_GROUP_NO_DATA.exception());
+
+        List<SysDingObj> sysDingObjList = sysDingObjService.list(new QueryWrapper<SysDingObj>().lambda().eq(SysDingObj::getDingGroupId, sysDingGroup.getId()).eq(SysDingObj::getType, DingObjTypeEnum.APPROVE));
+        if (CollectionUtils.isEmpty(sysDingObjList)) {
+            throw ExceptionResultEnum.SERVICE_DING_APPROVE_NO_DATA.exception();
+        }
+
+        List<Long> roleIsList = sysDingObjList.stream().map(s -> s.getRoleId()).collect(Collectors.toList());
+        List<SysUserRole> sysUserRoleList = this.list(new QueryWrapper<SysUserRole>().lambda().in(SysUserRole::getRoleId, roleIsList));
+        if (CollectionUtils.isEmpty(sysUserRoleList)) {
+            throw ExceptionResultEnum.SERVICE_DING_APPROVE_USER_NO_DATA.exception();
+        }
+        return sysUserRoleList;
+    }
 }

+ 9 - 5
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -28,6 +28,7 @@ import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -86,10 +87,11 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         String crmNo = Objects.nonNull(tbDing) ? tbDing.getCrmNo() : tbDingApply.getCrmNo();
         CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectBySopNoOrCrmNo(sopNo, crmNo);
         Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
-        Optional.ofNullable(crmProjectResult.getRegionManagerId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm大区经理数据为空"));
 
+        List<SysUserRole> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId());
+        Set<String> approveUserIdSet = sysUserRoleList.stream().map(s -> String.valueOf(s.getUserId())).collect(Collectors.toSet());
         List<String> approveUserIds = new ArrayList<>();
-        approveUserIds.add(crmProjectResult.getRegionManagerId().toString());
+        approveUserIds.addAll(approveUserIdSet);
         FlowApproveParam flowApproveParam = new FlowApproveParam(tbDingApply.getFlowDeploymentId(), FlowApprovePassEnum.START, approveUserIds, crmNo);
         flowApproveParam.setApproveRemark(FlowApprovePassEnum.START.getTitle());
         Map<String, Object> map = activitiService.taskApprove(flowApproveParam);
@@ -119,7 +121,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
 
-        IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, null, serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
+        IPage<DingApplyUnDoneResult> dingApplyUnDoneResultIPage = this.baseMapper.flowTaskUnDoneList(iPage, Arrays.asList(String.valueOf(requestUser.getId())), serviceId, name, supplierId, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
         if (Objects.nonNull(dingApplyUnDoneResultIPage) && !CollectionUtils.isEmpty(dingApplyUnDoneResultIPage.getRecords())) {
             for (DingApplyUnDoneResult d : dingApplyUnDoneResultIPage.getRecords()) {
                 if (Objects.nonNull(d.getAttachmentPaths())) {
@@ -171,7 +173,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
         DataPermissionDto dpr = sysUserService.buildUserDataPermission(requestUser.getId());
 
-        IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, null, serviceId, name, supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.getTitle() : null, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
+        IPage<DingApplyDoneResult> dingApplyDoneResultIPage = this.baseMapper.flowTaskDoneList(iPage, Arrays.asList(String.valueOf(requestUser.getId())), serviceId, name, supplierId, Objects.nonNull(dingExceptionApprove) ? dingExceptionApprove.getTitle() : null, customName, startTime, endTime, applyStartTime, applyEndTime, dpr);
         if (Objects.nonNull(dingApplyDoneResultIPage) && !CollectionUtils.isEmpty(dingApplyDoneResultIPage.getRecords())) {
             for (DingApplyDoneResult d : dingApplyDoneResultIPage.getRecords()) {
                 if (Objects.nonNull(d.getAttachmentPaths())) {
@@ -308,8 +310,10 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         Optional.ofNullable(crmProjectResult).orElseThrow(() -> ExceptionResultEnum.CRM_NO_NO_DATA.exception());
         Optional.ofNullable(crmProjectResult.getRegionCoordinatorId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("crm区域协调人数据为空"));
 
+        List<SysUserRole> sysUserRoleList = sysUserRoleService.listByServiceId(crmProjectResult.getServiceUnitId());
+        Set<String> approveUserIdSet = sysUserRoleList.stream().map(s -> String.valueOf(s.getUserId())).collect(Collectors.toSet());
         List<String> approveUserIds = new ArrayList<>();
-        approveUserIds.add(crmProjectResult.getRegionCoordinatorId().toString());
+        approveUserIds.addAll(approveUserIdSet);
         activitiService.taskApprove(new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, approveUserIds, tfCustomFlowEntity.getCrmNo(), dingExceptionApprove.getTitle()));
 
         TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);

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

@@ -1009,7 +1009,7 @@ public class TBSopInfoServiceImpl extends ServiceImpl<TBSopInfoMapper, TBSopInfo
                 break;
             }
         }
-        Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(fieldId + "处理时限时间为空"));
+        Optional.ofNullable(processLimitedTime).orElseThrow(() -> ExceptionResultEnum.ERROR.exception(ProcessLimitedEnum.convertKeyToEnum(fieldId).getTitle() + "处理时限时间为空"));
         return processLimitedTime;
     }
 

+ 127 - 123
sop-business/src/main/resources/mapper/TBDingApplyMapper.xml

@@ -3,132 +3,136 @@
 <mapper namespace="com.qmth.sop.business.mapper.TBDingApplyMapper">
 
     <select id="flowTaskUnDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyUnDoneResult">
+        select distinct t.* from(<include refid="flowTaskUnDoneListHeader"/>
+        where 1 = 1
+        <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
+            and art.ASSIGNEE_ IN
+            <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        <include refid="flowTaskUnDoneListFoot"/>
+        union all
+        <include refid="flowTaskUnDoneListHeader"/>
+        left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
+        where
+        1 = 1
+        and art.ASSIGNEE_ is null
+        <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
+            and ari.USER_ID_ IN
+            <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
+                #{item}
+            </foreach>
+        </if>
+        and ari.TYPE_ = 'candidate'
+        <include refid="flowTaskUnDoneListFoot" />) t
+    </select>
+
+    <sql id="flowTaskUnDoneListHeader">
         select
             distinct cast(art.ASSIGNEE_ as Decimal(24)) as userId,
-            tfcf.type,
-            tfcfe.code,
-            tffa.status,
-            tffa.setup,
-            tfcf.version,
-            tfcfe.obj_id as objId,
-            tfcfe.crm_no as crmNo,
-            tbc.name as crmName,
-            tbs.id as serviceId,
-            tbs.name as serviceName,
-            tbs.type as serviceType,
-            sc.id as customId,
-            sc.type as customType,
-            sc.name as customName,
-            tfcfe.create_id as createId,
-            su.real_name as createRealName,
-            art.PROC_INST_ID_ as flowId,
-            art.NAME_ as taskName,
-            art.TASK_DEF_KEY_ as taskDefKey,
-            art.ID_ as taskId,
-            tfcfe.flow_process_var as flowProcessVar,
-            tfcfe.t_f_custom_flow_id as customFlowId,
-            tfcf.flow_deployment_id as flowDeploymentId,
-            tfcfe.id as customFlowEntityid,
-            tbda.`type` as dingExceptionType,
-            tbd.sign_date as exceptionTime,
-            tbda.apply_time as applyTime,
-            tbda.reason,
-            (select group_concat(ba.`path` SEPARATOR ';') from basic_attachment ba where find_in_set(ba.id, tbda.attachment_ids)) as attachmentPaths,
-            tbda.create_time as createTime,
-            su1.real_name as approveUserName,
-            ss.name as supplierName,
-            ss.code as supplierCode,
-            tbs.service_lead_id as serviceUnitLeaderId,
-            tbc.lead_id as regionManagerId,
-            tbc.region_coordinator_id as coordinatorId
-            from ACT_RU_TASK art
-                 left join t_f_flow_approve tffa on art.PROC_INST_ID_ = tffa.flow_id
-                 left join t_f_custom_flow_entity tfcfe on tfcfe.flow_id = tffa.flow_id
-                 left join t_f_custom_flow tfcf on tfcf.id = tfcfe.t_f_custom_flow_id
-                 left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
-                 left join t_b_service tbs on tbs.id = tbc.service_id
-                 left join sys_custom sc on sc.id = tbc.custom_id
-                 left join t_b_ding_apply tbda on tbda.ding_exception_no = tfcfe.code
-                 left join t_b_ding tbd on tbd.id = tbda.ding_id
-                 left join sys_user su ON tbda.create_id = su.id
-                 left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
-                 left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
-                 left join sys_supplier ss on ss.id = tbuas.supplier_id
-                 left join sys_user su1 ON cast(art.ASSIGNEE_ as Decimal(24)) = su1.id
-                 left join act_ru_identitylink ari on ari.TASK_ID_ = art.ID_
-        <where> 1 = 1
-            and EXISTS(
-                    select t.* from(select cast(art.PROC_INST_ID_ as Decimal(24)) as flowId
-                                  from
-                                      ACT_RU_TASK art
-                                  where 1 = 1
-                                  <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
-                                      and art.ASSIGNEE_ IN
-                                      <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
-                                          #{item}
-                                      </foreach>
-                                  </if>
-                                  UNION ALL
-                                  select
-                                      art.PROC_INST_ID_ as flowId
-                                  from
-                                      ACT_RU_TASK art
-                                          left join act_ru_identitylink ari on
-                                          ari.TASK_ID_ = art.ID_
-                                  where
-                                      art.ASSIGNEE_ is null
-                                    <if test="userIdList != null and userIdList != '' and userIdList.size() > 0">
-                                        and ari.USER_ID_ IN
-                                        <foreach collection="userIdList" item="item" index="index" open="(" separator="," close=")">
-                                            #{item}
-                                        </foreach>
-                                    </if>
-                                    and ari.TYPE_ = 'candidate') t where t.flowId = art.PROC_INST_ID_)
-                and tfcf.type = 'DING_EXCEPTION_FLOW'
-            <if test="serviceId != null and serviceId != ''">
-                and tbs.id = #{serviceId}
-            </if>
-            <if test="name != null and name != ''">
-                and su.real_name like concat('%', #{name}, '%')
-            </if>
-            <if test="supplierId != null and supplierId != ''">
-                and ss.id = #{supplierId}
-            </if>
-            <if test="customName != null and customName != ''">
-                and sc.name like concat('%', #{customName}, '%')
-            </if>
-            <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
-                and ((tbd.sign_date <![CDATA[ >= ]]> #{startTime} or tbd.sign_date <![CDATA[ <= ]]> #{endTime}) and (tbd.sign_in_time is null or tbd.sign_out_time is null))
-            </if>
-            <if test="applyStartTime != null and applyStartTime != '' and applyEndTime != null and applyEndTime != ''">
-                and (tbda.apply_time <![CDATA[ >= ]]> #{applyStartTime} or tbda.apply_time <![CDATA[ <= ]]> #{applyEndTime})
-            </if>
-            <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
-                <choose>
-                    <when test="dpr.hasBusiness">
-                        AND tbs.service_lead_id = #{dpr.requestUserId}
-                    </when>
-                    <otherwise>
-                        <choose>
-                            <when test="dpr.hasRegionManager">
-                                AND tbc.lead_id = #{dpr.requestUserId}
-                            </when>
-                            <otherwise>
-                                <choose>
-                                    <when test="dpr.hasRegionCoordinator">
-                                        AND tbc.region_coordinator_id = #{dpr.requestUserId}
-                                    </when>
-                                </choose>
-                            </otherwise>
-                        </choose>
-                    </otherwise>
-                </choose>
-            </if>
-        </where>
-    </select>
+                     tfcf.type,
+                     tfcfe.code,
+                     tffa.status,
+                     tffa.setup,
+                     tfcf.version,
+                     tfcfe.obj_id as objId,
+                     tfcfe.crm_no as crmNo,
+                     tbc.name as crmName,
+                     tbs.id as serviceId,
+                     tbs.name as serviceName,
+                     tbs.type as serviceType,
+                     sc.id as customId,
+                     sc.type as customType,
+                     sc.name as customName,
+                     tfcfe.create_id as createId,
+                     su.real_name as createRealName,
+                     art.PROC_INST_ID_ as flowId,
+                     art.NAME_ as taskName,
+                     art.TASK_DEF_KEY_ as taskDefKey,
+                     art.ID_ as taskId,
+                     tfcfe.flow_process_var as flowProcessVar,
+                     tfcfe.t_f_custom_flow_id as customFlowId,
+                     tfcf.flow_deployment_id as flowDeploymentId,
+                     tfcfe.id as customFlowEntityid,
+                     tbda.`type` as dingExceptionType,
+                     tbd.sign_date as exceptionTime,
+                     tbda.apply_time as applyTime,
+                     tbda.reason,
+                     (select group_concat(ba.`path` SEPARATOR ';') from basic_attachment ba where find_in_set(ba.id, tbda.attachment_ids)) as attachmentPaths,
+                     tbda.create_time as createTime,
+                     su1.real_name as approveUserName,
+                     ss.name as supplierName,
+                     ss.code as supplierCode,
+                     tbs.service_lead_id as serviceUnitLeaderId,
+                     tbc.lead_id as regionManagerId,
+                     tbc.region_coordinator_id as coordinatorId
+        from
+            t_b_ding_apply tbda
+                left join t_f_custom_flow_entity tfcfe on
+                tfcfe.code = tbda.ding_exception_no
+                left join t_f_flow_approve tffa on
+                tfcfe.flow_id = tffa.flow_id
+                left join t_f_custom_flow tfcf on
+                tfcf.id = tfcfe.t_f_custom_flow_id
+                left join ACT_RU_TASK art on
+                art.PROC_INST_ID_ = tfcfe.flow_id
+                left join t_b_crm tbc on tbc.crm_no = tfcfe.crm_no
+                left join t_b_service tbs on tbs.id = tbc.service_id
+                left join sys_custom sc on sc.id = tbc.custom_id
+                left join t_b_ding tbd on tbd.id = tbda.ding_id
+                left join sys_user su ON tbda.create_id = su.id
+                left join t_b_user_archives tbua on tbua.mobile_number = su.mobile_number
+                left join t_b_user_archives_supplier tbuas on tbuas.user_archives_id = tbua.id
+                left join sys_supplier ss on ss.id = tbuas.supplier_id
+                left join sys_user su1 ON cast(art.ASSIGNEE_ as Decimal(24)) = su1.id
+    </sql>
+
+    <sql id="flowTaskUnDoneListFoot">
+        and tfcf.type = 'DING_EXCEPTION_FLOW'
+        <if test="serviceId != null and serviceId != ''">
+            and tbs.id = #{serviceId}
+        </if>
+        <if test="name != null and name != ''">
+            and su.real_name like concat('%', #{name}, '%')
+        </if>
+        <if test="supplierId != null and supplierId != ''">
+            and ss.id = #{supplierId}
+        </if>
+        <if test="customName != null and customName != ''">
+            and sc.name like concat('%', #{customName}, '%')
+        </if>
+        <if test="startTime != null and startTime != '' and endTime != null and endTime != ''">
+            and ((tbd.sign_date <![CDATA[ >= ]]> #{startTime} or tbd.sign_date <![CDATA[ <= ]]> #{endTime}) and (tbd.sign_in_time is null or tbd.sign_out_time is null))
+        </if>
+        <if test="applyStartTime != null and applyStartTime != '' and applyEndTime != null and applyEndTime != ''">
+            and (tbda.apply_time <![CDATA[ >= ]]> #{applyStartTime} or tbda.apply_time <![CDATA[ <= ]]> #{applyEndTime})
+        </if>
+        <if test="dpr != null and !dpr.hasAdmin and !dpr.hasPmo">
+            <choose>
+                <when test="dpr.hasBusiness">
+                    AND tbs.service_lead_id = #{dpr.requestUserId}
+                </when>
+                <otherwise>
+                    <choose>
+                        <when test="dpr.hasRegionManager">
+                            AND tbc.lead_id = #{dpr.requestUserId}
+                        </when>
+                        <otherwise>
+                            <choose>
+                                <when test="dpr.hasRegionCoordinator">
+                                    AND tbc.region_coordinator_id = #{dpr.requestUserId}
+                                </when>
+                            </choose>
+                        </otherwise>
+                    </choose>
+                </otherwise>
+            </choose>
+        </if>
+    </sql>
 
     <select id="flowTaskDoneList" resultType="com.qmth.sop.business.bean.result.DingApplyDoneResult">
-        select t.* from(select
+        select distinct t.* from(select
             distinct tfcf.type,
             tfcfe.code,
             tffa.status,
@@ -157,7 +161,7 @@
             tbda.create_time as createTime,
             (select CONCAT(tffl.approve_remark, ';' ,tffl.create_time) from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id order by tffl.create_time desc limit 1) as approveInfo,
             (select group_concat(us1.real_name SEPARATOR ';') from sys_user us1
-		where find_in_set(us1.id, (select group_concat(tffl.approve_id) from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id))) as approveUsersName,
+		where find_in_set(us1.id, (select group_concat(tffl.approve_id) from t_f_flow_log tffl where tffl.flow_id = tfcfe.flow_id and tffl.approve_setup > 1))) as approveUsersName,
             ss.id as supplierId,
             tbd.id as dingId,
             ss.name as supplierName,

+ 6 - 0
sop-common/src/main/java/com/qmth/sop/common/enums/ExceptionResultEnum.java

@@ -101,6 +101,12 @@ public enum ExceptionResultEnum {
 
     FLOW_SOP_DATA_NOT_ME(HttpStatus.INTERNAL_SERVER_ERROR, 5000037, "不能审批他人的sop数据"),
 
+    SERVICE_DING_GROUP_NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000038, "服务单元未设置考勤组"),
+
+    SERVICE_DING_APPROVE_NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000039, "服务单元未设置考勤审核角色"),
+
+    SERVICE_DING_APPROVE_USER_NO_DATA(HttpStatus.INTERNAL_SERVER_ERROR, 5000040, "服务单元未找到审核角色用户"),
+
     /**
      * 401
      */

+ 16 - 1
sop-common/src/main/java/com/qmth/sop/common/enums/ProcessLimitedEnum.java

@@ -29,12 +29,27 @@ public enum ProcessLimitedEnum {
 
     private String title;
 
-
     private ProcessLimitedEnum(String key, String title) {
         this.key = key;
         this.title = title;
     }
 
+    /**
+     * 根据key查找枚举类
+     *
+     * @param key
+     * @return
+     */
+    public static ProcessLimitedEnum convertKeyToEnum(String key) {
+        ProcessLimitedEnum res = null;
+        for (ProcessLimitedEnum value : ProcessLimitedEnum.values()) {
+            if (key.equals(value.getKey())) {
+                res = value;
+            }
+        }
+        return res;
+    }
+
     public String getKey() {
         return key;
     }