Parcourir la source

继续服务/恢复服务

yang il y a 4 ans
Parent
commit
533caf17d1

+ 16 - 12
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/PlatformCompanyLiftRelevanceService.java

@@ -183,6 +183,10 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
         //根据项目id和公司id查询电梯列表
         List<ProjectLiftRelevance> liftList = projectLiftRelevanceService.findLiftList(mtCompanyId, projectId);
 
+        if (liftList.size() == 0) {
+            return null;
+        }
+
         List<Long> list = liftList.stream().map(ProjectLiftRelevance::getLiftId).collect(Collectors.toList());
 
         //查询公司电梯关联和平台电梯关联
@@ -291,20 +295,20 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
                     //电梯状态设置为正常
                     resultList.forEach(entry -> entry.setLiftCompanyStatus(CommonEnum.LiftStatus.NORMAL.getCode()));
                     boolean ret = updateBatchById(resultList);
-
-                    //查询项目的默认区域主管  老项目恢复需要默认关联区域主管(project_user)
-                    Long regionDirectorId = baseMapper.getRegionDirectorByProjectId(projectId);
-                    if (Objects.isNull(regionDirectorId) || regionDirectorId == 0) {
-                        throw new RuntimeException("项目ID查询区域主管ID失败!");
-                    }
-                    //维护project_user表数据
-                    maintain(projectId, mtCompanyId, regionDirectorId, projectUserService);
-
                     if (!ret) {
                         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
                         return RestResponse.fail(MessageUtils.get("msg.modify.batch.fail"));
                     }
                 }
+
+                //查询项目的默认区域主管  老项目恢复需要默认关联区域主管(project_user)
+                Long regionDirectorId = baseMapper.getRegionDirectorByProjectId(projectId);
+                if (Objects.isNull(regionDirectorId) || regionDirectorId == 0) {
+                    throw new RuntimeException("项目ID查询区域主管ID失败!");
+                }
+                //维护project_user表数据
+                maintain(projectId, mtCompanyId, regionDirectorId, projectUserService);
+
                 //恢复服务发送消息
                 sendRecoverMessage(projectId, mtCompanyId);
                 break;
@@ -343,12 +347,12 @@ public class PlatformCompanyLiftRelevanceService extends ServiceImpl<PlatformCom
             case 3:
 
                 //查询项目的默认区域主管  老项目恢复需要默认关联区域主管(project_user)
-                Long regionDirectorId = baseMapper.getRegionDirectorByProjectId(projectId);
-                if (Objects.isNull(regionDirectorId) || regionDirectorId == 0) {
+                Long regionDirectorId1 = baseMapper.getRegionDirectorByProjectId(projectId);
+                if (Objects.isNull(regionDirectorId1) || regionDirectorId1 == 0) {
                     throw new RuntimeException("项目ID查询区域主管ID失败!");
                 }
                 //维护project_user表数据
-                maintain(projectId, mtCompanyId, regionDirectorId, projectUserService);
+                maintain(projectId, mtCompanyId, regionDirectorId1, projectUserService);
 
                 project.setEndDate(request.getEndDate());
                 project.setProjectStatus(CommonEnum.ProjectStatus.IN_SERVICE.getCode());