lyhzzz 9 miesięcy temu
rodzic
commit
061547fa27

+ 6 - 0
src/main/java/com/fdkankan/manage/controller/JyUserPlatformController.java

@@ -60,5 +60,11 @@ public class JyUserPlatformController {
         jyUserPlatformService.del(param);
         return ResultData.ok();
     }
+
+    @PostMapping("/addWaitUser")
+    public ResultData addWaitUser(@RequestBody JyUserPlatformAddParam param){
+        jyUserPlatformService.addWaitUser(param);
+        return ResultData.ok();
+    }
 }
 

+ 3 - 0
src/main/java/com/fdkankan/manage/entity/JyPlatformUserWait.java

@@ -31,6 +31,9 @@ public class JyPlatformUserWait implements Serializable {
     @TableField("name")
     private String name;
 
+    @TableField("id_card")
+    private String idCard;
+
     @TableField("platform_id")
     private Integer platformId;
 

+ 4 - 0
src/main/java/com/fdkankan/manage/mapper/IJyPlatformUserWaitMapper.java

@@ -3,6 +3,9 @@ package com.fdkankan.manage.mapper;
 import com.fdkankan.manage.entity.JyPlatformUserWait;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -15,4 +18,5 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IJyPlatformUserWaitMapper extends BaseMapper<JyPlatformUserWait> {
 
+    List<JyPlatformUserWait> getByQueryKey(@Param("queryKey") String queryKey);
 }

+ 2 - 0
src/main/java/com/fdkankan/manage/service/IJyPlatformUserWaitService.java

@@ -22,4 +22,6 @@ public interface IJyPlatformUserWaitService extends IService<JyPlatformUserWait>
     List<JyPlatformUserWait> getByQueryKey(String queryKey);
 
     void updatePlatformId(Integer id, Integer loginPlatformId);
+
+    JyPlatformUserWait getByIdCard(String idCard);
 }

+ 1 - 0
src/main/java/com/fdkankan/manage/service/IJyUserPlatformService.java

@@ -35,4 +35,5 @@ public interface IJyUserPlatformService extends IService<JyUserPlatform> {
 
     Integer getLoginPlatformId();
 
+    void addWaitUser(JyUserPlatformAddParam param);
 }

+ 8 - 3
src/main/java/com/fdkankan/manage/service/impl/JyPlatformUserWaitServiceImpl.java

@@ -29,6 +29,13 @@ public class JyPlatformUserWaitServiceImpl extends ServiceImpl<IJyPlatformUserWa
     }
 
     @Override
+    public JyPlatformUserWait getByIdCard(String idCard) {
+        LambdaQueryWrapper<JyPlatformUserWait> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyPlatformUserWait::getIdCard,idCard);
+        return this.getOne(wrapper);
+    }
+
+    @Override
     public void del(Integer id) {
         LambdaUpdateWrapper<JyPlatformUserWait> wrapper = new LambdaUpdateWrapper<>();
         wrapper.eq(JyPlatformUserWait::getId,id);
@@ -38,9 +45,7 @@ public class JyPlatformUserWaitServiceImpl extends ServiceImpl<IJyPlatformUserWa
 
     @Override
     public List<JyPlatformUserWait> getByQueryKey(String queryKey) {
-        LambdaQueryWrapper<JyPlatformUserWait> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(JyPlatformUserWait::getName,queryKey);
-        return this.list(wrapper);
+        return this.getBaseMapper().getByQueryKey(queryKey);
     }
 
     @Override

+ 35 - 9
src/main/java/com/fdkankan/manage/service/impl/JyUserPlatformServiceImpl.java

@@ -156,11 +156,13 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
                 sysRoles.forEach(e -> roleMap.put(e.getId(),e));
             }
         }
-        JyPlatformUserWait jyPlatformUserWait = platformUserWaitService.getByName(param.getQueryKey());
-        if(jyPlatformUserWait != null){
-            JyUserPlatform jyUserPlatform = new JyUserPlatform();
-            BeanUtils.copyProperties(jyPlatformUserWait,jyUserPlatform);
-            jyUserPlatforms.add(jyUserPlatform);
+        List<JyPlatformUserWait> jyPlatformUserWaits = platformUserWaitService.getByQueryKey(param.getQueryKey());
+        if(jyPlatformUserWaits.isEmpty()){
+            for (JyPlatformUserWait jyPlatformUserWait : jyPlatformUserWaits) {
+                JyUserPlatform jyUserPlatform = new JyUserPlatform();
+                BeanUtils.copyProperties(jyPlatformUserWait,jyUserPlatform);
+                jyUserPlatforms.add(jyUserPlatform);
+            }
         }
         List<Integer> collect = jyUserPlatforms.stream().map(JyUserPlatform::getPlatformId).filter(Objects::nonNull).collect(Collectors.toList());
         HashMap<Integer,JyPlatform> map = new HashMap<>();
@@ -220,11 +222,12 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
                 continue;
             }
             String name = map.get(0);
-            if(StringUtils.isBlank(name) ){
+            String idCard = map.get(1);
+            if(StringUtils.isBlank(name) || StringUtils.isNotBlank(idCard)){
                 errorIndex.add(index -3 );
                 continue;
             }
-            JyUser user = jyUserService.getByNickName(name);
+            JyUser user = jyUserService.getByIdCard(idCard);
             if(user != null && user.getPlatformId() == null){
                 updatePlatformUserList.add(user.getId());
                 continue;
@@ -233,18 +236,19 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
                 errorIndex.add(index -3 );
                 continue;
             }
-            JyPlatformUserWait jyPlatformUserWait = platformUserWaitService.getByName(name);
+            JyPlatformUserWait jyPlatformUserWait = platformUserWaitService.getByIdCard(idCard);
             if(jyPlatformUserWait != null ){
                 errorIndex.add(index -3 );
                 continue;
             }
-            List<JyUserPlatformAddParam> collect = params.stream().filter(e -> e.getName().equals(name)).collect(Collectors.toList());
+            List<JyUserPlatformAddParam> collect = params.stream().filter(e -> e.getIdCard().equals(idCard)).collect(Collectors.toList());
             if(!collect.isEmpty()){
                 errorIndex.add(index -3 );
                 continue;
             }
             JyUserPlatformAddParam param = new JyUserPlatformAddParam();
             param.setName(name);
+            param.setIdCard(idCard);
             params.add(param);
         }
         if(!errorIndex.isEmpty()){
@@ -271,10 +275,32 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
             JyPlatformUserWait jyPlatformUserWait = new JyPlatformUserWait();
             jyPlatformUserWait.setName(param.getName());
             jyPlatformUserWait.setPlatformId(this.getLoginPlatformId());
+            jyPlatformUserWait.setIdCard(param.getIdCard());
             platformUserWaitService.save(jyPlatformUserWait);
             count ++;
         }
         return count;
     }
 
+    @Override
+    public void addWaitUser(JyUserPlatformAddParam param) {
+        if(StringUtils.isBlank(param.getName()) || StringUtils.isBlank(param.getIdCard())) {
+            throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
+        }
+
+        JyPlatformUserWait byIdCard = platformUserWaitService.getByIdCard(param.getIdCard());
+        if(byIdCard != null){
+            throw new BusinessException(ResultCode.ID_CARD_EXIT);
+        }
+        JyUser byIdCard1 = jyUserService.getByIdCard(param.getIdCard());
+        if(byIdCard1 != null){
+            throw new BusinessException(ResultCode.ID_CARD_EXIT);
+        }
+
+        JyPlatformUserWait jyPlatformUserWait = new JyPlatformUserWait();
+        jyPlatformUserWait.setName(param.getName());
+        jyPlatformUserWait.setPlatformId(this.getLoginPlatformId());
+        jyPlatformUserWait.setIdCard(param.getIdCard());
+        platformUserWaitService.save(jyPlatformUserWait);
+    }
 }

+ 1 - 1
src/main/java/com/fdkankan/manage/service/impl/UserServiceImpl.java

@@ -242,7 +242,7 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         }
 
         if(param.getIsJm() != null  ){
-            JyPlatformUserWait platformUserWait = platformUserWaitService.getByName(jyUser.getRyNickName());
+            JyPlatformUserWait platformUserWait = platformUserWaitService.getByIdCard(jyUser.getIdCard());
             if(platformUserWait != null){
                 jyUser.setPlatformId(param.getIsJm() == 0?platformUserWait.getPlatformId():1);
                 platformUserWaitService.del(platformUserWait.getId());

+ 4 - 0
src/main/resources/mapper/manage/JyPlatformUserWaitMapper.xml

@@ -2,4 +2,8 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fdkankan.manage.mapper.IJyPlatformUserWaitMapper">
 
+    <select id="getByQueryKey" resultType="com.fdkankan.manage.entity.JyPlatformUserWait">
+        select  * from jy_platform_user_wait where rec_status = 'A'
+        and (name = #{queryKey} or id_card = #{queryKey})
+    </select>
 </mapper>

BIN
src/main/resources/template/platformUser.xlsx