lyhzzz 9 months ago
parent
commit
abf83dfc34

+ 5 - 9
src/main/java/com/fdkankan/manage/service/impl/JyPlatformServiceImpl.java

@@ -69,6 +69,11 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
         }
         JyPlatform jyPlatform = null;
         JyUser jyUser = null;
+        jyUser = jyUserService.getByIdCard(param.getIdCard());
+        if(jyUser != null && jyUser.getPlatformId() != null  ){
+            throw new BusinessException(ResultCode.ID_CARD_EXIT);
+        }
+
         if(param.getId() == null){  //创建平台自动生成平台访问地址
             String uuid = UUID.randomUUID().toString().substring(0, 18).replace("-", "");
             param.setPlatformAddress(uuid);
@@ -77,10 +82,6 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
                 throw new BusinessException(ResultCode.ID_CARD_EXIT);
             }
             jyPlatform = new JyPlatform();
-            jyUser = jyUserService.getByIdCard(param.getIdCard());
-            if(jyUser != null && jyUser.getPlatformId() != null  ){
-                throw new BusinessException(ResultCode.ID_CARD_EXIT);
-            }
             BeanUtils.copyProperties(param,jyPlatform);
             this.save(jyPlatform);
 
@@ -89,16 +90,11 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
             if(jyPlatform == null){
                 throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
             }
-            JyPlatform jyPlatform2 = this.getByIdCard(param.getIdCard());
-            if(jyPlatform2 != null && !jyPlatform2.getId().equals(jyPlatform.getId())){
-                throw new BusinessException(ResultCode.ID_CARD_EXIT);
-            }
             if(!param.getIdCard().equals(jyPlatform.getIdCard())){
                 JyUser jyUser1 = jyUserService.getByIdCard(jyPlatform.getIdCard());
                 if(jyUser1 != null){
                     sysUserService.updateRoleId(jyUser1.getSysUserId(),47L);
                 }
-                jyUser = jyUserService.getByIdCard(param.getIdCard());
             }
             BeanUtils.copyProperties(param,jyPlatform);
             this.updateById(jyPlatform);