wangliang 9 maanden geleden
bovenliggende
commit
8d010b2f53

+ 17 - 18
sop-business/src/main/java/com/qmth/sop/business/service/impl/TBDingApplyServiceImpl.java

@@ -15,7 +15,6 @@ import com.qmth.sop.business.bean.result.*;
 import com.qmth.sop.business.entity.*;
 import com.qmth.sop.business.mapper.TBDingApplyMapper;
 import com.qmth.sop.business.service.*;
-import com.qmth.sop.common.contant.SpringContextHolder;
 import com.qmth.sop.common.contant.SystemConstant;
 import com.qmth.sop.common.enums.*;
 import com.qmth.sop.common.util.DateDisposeUtils;
@@ -112,7 +111,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         String sopNo = Objects.nonNull(tbDing) ? tbDing.getSopNo() : tbDingApply.getSopNo();
 
         String crmNo = Objects.nonNull(tbDing) ? tbDing.getCrmNo() : tbDingApply.getCrmNo();
-        if (!SystemConstant.strNotNull(crmNo)){
+        if (!SystemConstant.strNotNull(crmNo)) {
             crmNo = "-1";
         }
         Long serviceId = Objects.nonNull(tbDing) ? tbDing.getServiceId() : tbDingApply.getServiceId();
@@ -122,7 +121,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
             throw ExceptionResultEnum.ERROR.exception("该用户剩余补卡次数为0");
         }
         List<String> approveUserIds = new ArrayList<>();
-        if (SystemConstant.strNotNull(sopNo)){
+        if (SystemConstant.strNotNull(sopNo)) {
             List<String> sysUserRoleList = sysUserRoleService.listByServiceId(serviceId, sysUser.getId(), sopNo);
             approveUserIds.addAll(sysUserRoleList);
         } else {
@@ -297,7 +296,6 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
             throws InterruptedException {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
-        TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
         return tbDingApplyService.taskApprove(taskId, userId, dingExceptionApprove);
     }
 
@@ -348,14 +346,15 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
             } else {
                 SysUser sysUser = sysUserService.getById(tbDingApply.getCreateId());
                 Optional.ofNullable(sysUser).orElseThrow(ExceptionResultEnum.USER_NO_EXISTS::exception);
-                UserArchivesResult userArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(null,sysUser.getId());
+                UserArchivesResult userArchivesResult = tbUserArchivesService.findUserArchivesByArchivesIdORUserId(null,
+                        sysUser.getId());
 
                 List<SysRole> sysRoleList = sysUserRoleService.listRoleByUserId(sysUser.getId());
                 if (CollectionUtils.isEmpty(sysRoleList)) {
                     throw ExceptionResultEnum.ERROR.exception("用户角色不存在");
                 }
                 String sopNo = tbDingApply.getSopNo();
-                if (SystemConstant.strNotNull(sopNo)){
+                if (SystemConstant.strNotNull(sopNo)) {
                     TFCustomFlowEntity tfCustomFlowEntity = tfCustomFlowEntityService.findByCode(sopNo);
 
                     List<SopRoleTypeEnum> roleType = tbUserArchivesAllocationService.findSopRoleTypeByUserSopNo(
@@ -368,9 +367,8 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
                             tfCustomFlowEntity.getFlowId());
                 } else {
                     // 区协
-                    tbDing = new TBDing(null, null, tbDingApply.getServiceId(),
-                            userArchivesResult.getUserArchivesId(), JSON.toJSONString(SopRoleTypeEnum.REGION_COORDINATOR), sysUser.getId(),
-                            null);
+                    tbDing = new TBDing(null, null, tbDingApply.getServiceId(), userArchivesResult.getUserArchivesId(),
+                            JSON.toJSONString(SopRoleTypeEnum.REGION_COORDINATOR), sysUser.getId(), null);
                 }
                 tbDing.setSignDate(
                         DateFormatUtils.format(tbDingApply.getApplyTime(), SystemConstant.DEFAULT_DATE_DAY_PATTERN));
@@ -409,7 +407,6 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
             throws InterruptedException {
         SysUser sysUser = (SysUser) ServletUtil.getRequestUser();
         userId = Objects.nonNull(sysUser) ? sysUser.getId() : userId;
-        TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
         for (Long l : taskIds) {
             tbDingApplyService.taskApprove(l, userId, dingExceptionApprove);
         }
@@ -447,7 +444,7 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
         Optional.ofNullable(tbDingApply).orElseThrow(() -> ExceptionResultEnum.DING_APPLY_NO_DATA.exception());
 
         List<String> approveUserIds = new ArrayList<>();
-        if (!Objects.equals(tfCustomFlowEntity.getCrmNo(), "-1")){
+        if (!Objects.equals(tfCustomFlowEntity.getCrmNo(), "-1")) {
             TBCrmDetail tbCrmDetail = tbCrmDetailService.findBySopNo(tfCustomFlowEntity.getCode());
             CrmProjectResult crmProjectResult = tbCrmService.findCrmProjectInfo(
                     Objects.nonNull(tbCrmDetail) ? tbCrmDetail.getSopNo() : null,
@@ -468,12 +465,9 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
             // 区协补卡的审核
             approveUserIds.addAll(Collections.singletonList(String.valueOf(sysUser.getId())));
         }
-
         activitiService.taskApprove(
                 new FlowApproveParam(taskId, FlowApprovePassEnum.PASS, approveUserIds, tfCustomFlowEntity.getCrmNo(),
                         dingExceptionApprove.getTitle()));
-
-        TBDingApplyService tbDingApplyService = SpringContextHolder.getBean(TBDingApplyService.class);
         return tbDingApplyService.updateDingExceptionTime(tbDingApply, dingExceptionApprove);
     }
 
@@ -557,11 +551,16 @@ public class TBDingApplyServiceImpl extends ServiceImpl<TBDingApplyMapper, TBDin
     @Override
     public List<SearchResult> findRegionCoordinatorAuditor(Long serviceId, Long userId) {
         List<SearchResult> result = new ArrayList<>();
-        List<TBUserArchivesAllocation> tbUserArchivesAllocationList = tbUserArchivesAllocationService.list(new QueryWrapper<TBUserArchivesAllocation>().lambda()
-                .eq(TBUserArchivesAllocation::getServiceId, serviceId).eq(TBUserArchivesAllocation::getUserId, userId).eq(TBUserArchivesAllocation::getSopRoleType, SopRoleTypeEnum.REGION_COORDINATOR));
-        List<String> crmNoList = tbUserArchivesAllocationList.stream().map(TBUserArchivesAllocation::getCrmNo).distinct().collect(Collectors.toList());
+        List<TBUserArchivesAllocation> tbUserArchivesAllocationList = tbUserArchivesAllocationService.list(
+                new QueryWrapper<TBUserArchivesAllocation>().lambda()
+                        .eq(TBUserArchivesAllocation::getServiceId, serviceId)
+                        .eq(TBUserArchivesAllocation::getUserId, userId)
+                        .eq(TBUserArchivesAllocation::getSopRoleType, SopRoleTypeEnum.REGION_COORDINATOR));
+        List<String> crmNoList = tbUserArchivesAllocationList.stream().map(TBUserArchivesAllocation::getCrmNo)
+                .distinct().collect(Collectors.toList());
         if (!CollectionUtils.isEmpty(crmNoList)) {
-            List<TBCrm> tbCrmList = tbCrmService.list(new QueryWrapper<TBCrm>().lambda().in(TBCrm::getCrmNo, crmNoList));
+            List<TBCrm> tbCrmList = tbCrmService.list(
+                    new QueryWrapper<TBCrm>().lambda().in(TBCrm::getCrmNo, crmNoList));
             List<Long> leaderIdList = tbCrmList.stream().map(TBCrm::getLeadId).distinct().collect(Collectors.toList());
             if (!CollectionUtils.isEmpty(leaderIdList)) {
                 result = sysUserService.listByIds(leaderIdList).stream().flatMap(e -> {