Sfoglia il codice sorgente

转移项目参与人

cs 2 anni fa
parent
commit
3528c7266e

+ 16 - 1
fhKeeper/formulahousekeeper/management-platform/src/main/java/com/management/platform/service/impl/UserServiceImpl.java

@@ -180,6 +180,8 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
     private TaskExecutorService taskExecutorService;
     @Resource
     private TaskGroupService taskGroupService;
+    @Resource
+    private ParticipationService participationService;
 
     public static String provider_access_token = null;
     public static long providerTokenExpireTime = 0L;
@@ -682,7 +684,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             user.setCertList(certList);
             //获取相关日报数量
             Integer reportCount = reportMapper.selectCount(new QueryWrapper<Report>().eq("creator_id", user.getId()));
-            if (reportCount>0){
+            //获取是否存在任务
+            Integer taskExecutorCount = taskMapper.selectCount(new QueryWrapper<Task>().like("executor_id", user.getId()));
+            //获取是否存在项目
+            Integer projectInchargerList = projectMapper.selectCount(new QueryWrapper<Project>().eq("incharger_id", user.getId()));
+            if (reportCount>0 || taskExecutorCount>0 || projectInchargerList>0){
                 reportCount = 1;
             }
             user.setIsExistsReport(reportCount);
@@ -2674,6 +2680,15 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
             }
             taskGroupService.updateBatchById(taskGroupList);
         }
+
+        //转移项目参与人
+        List<Participation> participationList = participationMapper.selectList(new QueryWrapper<Participation>().eq("user_id", sourceUser.getId()));
+        if (participationList.size() != 0){
+            for (Participation participation : participationList) {
+                participation.setUserId(targetUser.getId());
+            }
+            participationService.updateBatchById(participationList);
+        }
         return httpRespMsg;
     }
 }