lyhzzz 9 månader sedan
förälder
incheckning
c0e9eaa534

+ 14 - 2
src/main/java/com/fdkankan/manage/service/impl/JyUserPlatformServiceImpl.java

@@ -147,6 +147,7 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
     public Integer addPlatformUser(List<HashMap<Integer, String>> excelRowList) {
         List<JyUserPlatformAddParam> params = new ArrayList<>();
         List<Integer> errorIndex = new ArrayList<>();
+        List<Integer> updatePlatformUserList = new ArrayList<>();
         Integer index = 0;
         for (HashMap<Integer, String> map : excelRowList) {
             index++;
@@ -165,6 +166,9 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
                 continue;
             }
             JyUser user = jyUserService.getByNickName(name);
+            if(user != null && user.getPlatformId() == null){
+                updatePlatformUserList.add(user.getId());
+            }
             if(user != null ){
                 errorIndex.add(index -3 );
                 continue;
@@ -181,10 +185,18 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
         if(!errorIndex.isEmpty()){
             excelService.toExcelError(errorIndex);
         }
-        if(params.size() <=0){
+        if(params.size() <=0 && updatePlatformUserList.isEmpty()){
             throw new BusinessException(ResultCode.TEMPLATE_EMPTY);
         }
-        return this.addPlatformUsers(params);
+        Integer count = this.addPlatformUsers(params);
+        Integer count1 = 0;
+        for (Integer jyUserId : updatePlatformUserList) {
+            if(getLoginPlatformId() != null){
+                jyUserService.updatePlatformId(jyUserId,getLoginPlatformId());
+                count1 ++;
+            }
+        }
+        return count1 + count;
     }
 
     @Autowired