Browse Source

add:档案作废验证

caozixuan 1 year ago
parent
commit
c7ef782813

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

@@ -54,6 +54,8 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
     private TBUserArchivesService tbUserArchivesService;
     @Resource
     private SequenceService sequenceService;
+    @Resource
+    private TBSopInfoService tbSopInfoService;
 
     @Override
     public IPage<UserArchivesResult> findUserArchivesPage(String city, Long supplierId, String archivesName, RoleTypeEnum roleType, Boolean authenticationStatus, Long archivesTimeStart, Long archivesTimeEnd, Integer remainValidDay, Integer pageNumber, Integer pageSize) throws Exception {
@@ -376,7 +378,13 @@ public class TBUserArchivesServiceImpl extends ServiceImpl<TBUserArchivesMapper,
                 if (validTime != null && currentTime < validTime) {
                     throw ExceptionResultEnum.ERROR.exception(String.format("[%s]的认证状态为有效,不能作废", userArchivesResult.getName()));
                 }
-                // 作废校验2 - 为空闲状态
+                // 作废校验2 - 没有进行中的SOP
+                List<SopInfoResult> sopInfoResultList = tbSopInfoService.findFlowByServiceId(null,userArchivesResult.getUserId());
+                if (CollectionUtils.isNotEmpty(sopInfoResultList)){
+                    throw ExceptionResultEnum.ERROR.exception("该用户存在正在进行的SOP不能作废");
+                }
+
+                // 作废校验3 - 为空闲状态
                 UserArchivesStatusEnum status = userArchivesResult.getStatus();
                 Long userId = userArchivesResult.getUserId();
                 boolean isCoordinator = sysUserRoleService.userContainsRoles(userId, RoleTypeEnum.REGION_COORDINATOR);