lyhzzz hace 9 meses
padre
commit
dbf3e22f46

+ 21 - 0
src/main/java/com/fdkankan/manage/controller/JyPlatformUserWaitController.java

@@ -0,0 +1,21 @@
+package com.fdkankan.manage.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-19
+ */
+@RestController
+@RequestMapping("/manage/jyPlatformUserWait")
+public class JyPlatformUserWaitController {
+
+}
+

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

@@ -0,0 +1,48 @@
+package com.fdkankan.manage.entity;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-19
+ */
+@Getter
+@Setter
+@TableName("jy_platform_user_wait")
+public class JyPlatformUserWait implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    @TableId(value = "id", type = IdType.AUTO)
+    private Integer id;
+
+    @TableField("name")
+    private String name;
+
+    @TableField("platform_id")
+    private Integer platformId;
+
+    @TableField("rec_status")
+    @TableLogic(value = "A",delval = "I")
+    private String recStatus;
+
+    @TableField("create_time")
+    private Date createTime;
+
+    @TableField("update_time")
+    private Date updateTime;
+
+
+}

+ 1 - 1
src/main/java/com/fdkankan/manage/generate/AutoGenerate.java

@@ -18,7 +18,7 @@ public class AutoGenerate {
         String path =System.getProperty("user.dir");
 
         generate(path,"manage", getTables(new String[]{
-                "jy_user_platform_user"
+                "jy_platform_user_wait"
         }));
 
 //        generate(path,"goods", getTables(new String[]{

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

@@ -0,0 +1,18 @@
+package com.fdkankan.manage.mapper;
+
+import com.fdkankan.manage.entity.JyPlatformUserWait;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-19
+ */
+@Mapper
+public interface IJyPlatformUserWaitMapper extends BaseMapper<JyPlatformUserWait> {
+
+}

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

@@ -0,0 +1,19 @@
+package com.fdkankan.manage.service;
+
+import com.fdkankan.manage.entity.JyPlatformUserWait;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ * <p>
+ *  服务类
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-19
+ */
+public interface IJyPlatformUserWaitService extends IService<JyPlatformUserWait> {
+
+    JyPlatformUserWait getByName(String name);
+
+    void del(Integer id);
+}

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

@@ -43,4 +43,6 @@ public interface IJyUserService extends IService<JyUser> {
     List<Long> getByUserIdPlatform(Integer loginPlatformId);
 
     void del(Integer id);
+
+    JyUser getByNickName(String name);
 }

+ 36 - 0
src/main/java/com/fdkankan/manage/service/impl/JyPlatformUserWaitServiceImpl.java

@@ -0,0 +1,36 @@
+package com.fdkankan.manage.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.fdkankan.manage.entity.JyPlatformUserWait;
+import com.fdkankan.manage.mapper.IJyPlatformUserWaitMapper;
+import com.fdkankan.manage.service.IJyPlatformUserWaitService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author 
+ * @since 2024-11-19
+ */
+@Service
+public class JyPlatformUserWaitServiceImpl extends ServiceImpl<IJyPlatformUserWaitMapper, JyPlatformUserWait> implements IJyPlatformUserWaitService {
+
+    @Override
+    public JyPlatformUserWait getByName(String name) {
+        LambdaQueryWrapper<JyPlatformUserWait> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyPlatformUserWait::getName,name);
+        return this.getOne(wrapper);
+    }
+
+    @Override
+    public void del(Integer id) {
+        LambdaUpdateWrapper<JyPlatformUserWait> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(JyPlatformUserWait::getId,id);
+        wrapper.set(JyPlatformUserWait::getRecStatus,id);
+        this.update(wrapper);
+    }
+}

+ 23 - 10
src/main/java/com/fdkankan/manage/service/impl/JyUserPlatformServiceImpl.java

@@ -3,9 +3,11 @@ package com.fdkankan.manage.service.impl;
 import cn.dev33.satoken.stp.StpUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fdkankan.manage.common.ExcelErrorUtil;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.common.ResultCode;
 import com.fdkankan.manage.entity.JyPlatform;
+import com.fdkankan.manage.entity.JyPlatformUserWait;
 import com.fdkankan.manage.entity.JyUser;
 import com.fdkankan.manage.entity.SysUser;
 import com.fdkankan.manage.service.*;
@@ -158,33 +160,44 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
                 continue;
             }
             String name = map.get(0);
-            String idCard = map.get(1);
-            if(StringUtils.isBlank(name) || StringUtils.isBlank(idCard)){
+            if(StringUtils.isBlank(name) ){
+                errorIndex.add(index -3 );
+                continue;
+            }
+            JyUser user = jyUserService.getByNickName(name);
+            if(user != null ){
+                errorIndex.add(index -3 );
+                continue;
+            }
+            JyPlatformUserWait jyPlatformUserWait = platformUserWaitService.getByName(name);
+            if(jyPlatformUserWait != null ){
                 errorIndex.add(index -3 );
                 continue;
             }
             JyUserPlatformAddParam param = new JyUserPlatformAddParam();
             param.setName(name);
-            param.setIdCard(idCard);
             params.add(param);
         }
-        excelService.toExcelError(errorIndex);
+        if(!errorIndex.isEmpty()){
+            excelService.toExcelError(errorIndex);
+        }
         if(params.size() <=0){
             throw new BusinessException(ResultCode.TEMPLATE_EMPTY);
         }
         return this.addPlatformUsers(params);
     }
 
+    @Autowired
+    IJyPlatformUserWaitService platformUserWaitService;
+
     private Integer addPlatformUsers(List<JyUserPlatformAddParam> params) {
         Integer count = 0;
         for (JyUserPlatformAddParam param : params) {
-            JyUser byIdCard = jyUserService.getByIdCard(param.getIdCard());
-            if(byIdCard == null){
-                continue;
-            }
+            JyPlatformUserWait jyPlatformUserWait = new JyPlatformUserWait();
+            jyPlatformUserWait.setName(param.getName());
+            jyPlatformUserWait.setPlatformId(this.getLoginPlatformId());
+            platformUserWaitService.save(jyPlatformUserWait);
             count ++;
-            param.setId(byIdCard.getId());
-            this.addByParam(param);
         }
         return count;
     }

+ 11 - 0
src/main/java/com/fdkankan/manage/service/impl/JyUserServiceImpl.java

@@ -146,4 +146,15 @@ public class JyUserServiceImpl extends ServiceImpl<IJyUserMapper, JyUser> implem
         wrapper.set(JyUser::getRecStatus,id);
         this.update(wrapper);
     }
+
+    @Override
+    public JyUser getByNickName(String name) {
+        LambdaQueryWrapper<JyUser> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyUser::getRyNickName,name);
+        List<JyUser> list = this.list(wrapper);
+        if(list.isEmpty()){
+            return null;
+        }
+        return list.get(0);
+    }
 }

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

@@ -169,6 +169,8 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         return true;
     }
 
+    @Autowired
+    IJyPlatformUserWaitService platformUserWaitService;
     @Override
     @Transactional(rollbackFor = Exception.class)
     public synchronized void addUcenterUser(UserParam param) {
@@ -204,6 +206,7 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         if(jyUser != null && jyUser2 != null && !jyUser2.getId().equals(jyUser.getId())){
             throw new BusinessException(ResultCode.RYNO_EXITS);
         }
+
         boolean init = false;
         if(jyUser == null){
             jyUser = new JyUser();
@@ -225,6 +228,13 @@ public class UserServiceImpl extends ServiceImpl<IUserMapper, User> implements I
         if(jyUser.getPlatformId() == null){
             jyUser.setPlatformId(param.getIsJm() != null && param.getIsJm() == 1? 1 : null);
         }
+        if(param.getIsJm() != null && param.getIsJm() ==0 ){
+            JyPlatformUserWait platformUserWait = platformUserWaitService.getByName(jyUser.getRyNickName());
+            if(platformUserWait != null){
+                jyUser.setPlatformId(platformUserWait.getPlatformId());
+                platformUserWaitService.del(platformUserWait.getId());
+            }
+        }
         jyUserService.saveOrUpdate(jyUser);
 
         if(init && StringUtils.isNotBlank(param.getIdCard()) && param.getIsJm()!=null && param.getIsJm() != 1){

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

@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-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">
+
+</mapper>

+ 19 - 2
src/main/resources/mapper/manage/JyUserPlatformMapper.xml

@@ -4,6 +4,7 @@
 
     <select id="pageList" resultType="com.fdkankan.manage.vo.request.JyUserPlatformVo">
         select up.id,up.ry_id,up.ry_no,up.id_card,up.ry_nick_name as name ,up.phone,up.platform_id,up.status,up.create_time from jy_user up
+
         where up.rec_status = 'A'
         <if test="param.name != null and param.name !=''">
             and up.ry_nick_name like concat ('%',#{param.name},'%')
@@ -20,8 +21,24 @@
         <if test="param.platformId != null ">
             and up.platform_id  = #{param.platformId}
         </if>
-        order by  up.id desc
-
+        UNION all SELECT null,null,null,null,name ,null,null,null,null from jy_platform_user_wait pw
+        WHERE pw.rec_status = 'A'
+        <if test="param.name != null and param.name !=''">
+            and pw.name like concat ('%',#{param.name},'%')
+        </if>
+        <if test="param.phone != null and param.phone !=''">
+            and pw.rec_status = 'AA'
+        </if>
+        <if test="param.idCard != null and param.idCard !=''">
+            and pw.rec_status = 'AA'
+        </if>
+        <if test="param.ryNo != null and param.ryNo !=''">
+            and pw.rec_status = 'AA'
+        </if>
+        <if test="param.platformId != null ">
+            and pw.platform_id  = #{param.platformId}
+        </if>
+        order by  create_time desc,id desc
     </select>
     <select id="queryByKey" resultType="com.fdkankan.manage.vo.JyUserPlatform">
         select  id,id_card,ry_nick_name as name ,phone,platform_id,status,create_time from  jy_user where rec_status = 'A' and status = 1

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