lyhzzz 9 hónapja
szülő
commit
d78e9fd06b

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

@@ -57,6 +57,9 @@ public class JyPlatform implements Serializable {
     @TableField("id_card")
     private String idCard;
 
+    @TableField("status")
+    private Integer status;
+
 
     @TableField("rec_status")
     @TableLogic(value = "A",delval = "I")

+ 1 - 1
src/main/java/com/fdkankan/manage/mapper/IJyUserPlatformMapper.java

@@ -23,5 +23,5 @@ public interface IJyUserPlatformMapper extends BaseMapper<JyUserPlatform> {
 
     Page<JyUserPlatformVo> pageList(Page<Object> objectPage, JyUserPlatformParam param);
 
-    List<JyUserPlatform> queryByKey(@Param("queryKey") String queryKey);
+    List<JyUserPlatform> queryByKey(@Param("queryKey") String queryKey,@Param("noInIds") List<String> ids);
 }

+ 4 - 0
src/main/java/com/fdkankan/manage/service/IJyPlatformService.java

@@ -5,6 +5,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
 import com.fdkankan.manage.vo.request.JyPlatformParam;
 import com.fdkankan.manage.vo.request.JyPlatformVo;
 
+import java.util.List;
+
 /**
  * <p>
  *  服务类
@@ -26,4 +28,6 @@ public interface IJyPlatformService extends IService<JyPlatform> {
     void enable(JyPlatformVo param);
 
     void disable(JyPlatformVo param);
+
+    List<String> getIds();
 }

+ 23 - 0
src/main/java/com/fdkankan/manage/service/impl/JyPlatformServiceImpl.java

@@ -1,6 +1,7 @@
 package com.fdkankan.manage.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.fdkankan.manage.common.PageInfo;
 import com.fdkankan.manage.common.ResultCode;
@@ -19,8 +20,11 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
+import java.util.WeakHashMap;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -132,7 +136,14 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
         JyUserPlatform jyUserPlatform = jyUserPlatformService.getByIdCard(jyPlatform.getIdCard());
         JyUser jyUser = jyUserService.getById(jyUserPlatform.getJyUserId());
         sysUserService.updateRoleId(jyUser.getSysUserId(),48);
+        this.updateStatus(jyPlatform.getId(),0);
+    }
 
+    private void updateStatus(Integer id, Integer status) {
+        LambdaUpdateWrapper<JyPlatform> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.eq(JyPlatform::getId,id);
+        wrapper.set(JyPlatform::getStatus,status);
+        this.update(wrapper);
     }
 
     @Override
@@ -150,7 +161,19 @@ public class JyPlatformServiceImpl extends ServiceImpl<IJyPlatformMapper, JyPlat
         sysUserService.updateRoleId(jyUser.getSysUserId(),47);
 
         jyUserPlatformService.updatePlatformId(param.getId(),param.getToPlatformId());
+        this.updateStatus(jyPlatform.getId(),1);
+
 
+    }
 
+    @Override
+    public List<String> getIds() {
+        LambdaQueryWrapper<JyPlatform > wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(JyPlatform::getStatus,0);
+        List<JyPlatform> list = this.list();
+        if(list.isEmpty()){
+            return new ArrayList<>();
+        }
+        return list.stream().map(JyPlatform::getIdCard).collect(Collectors.toList());
     }
 }

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

@@ -11,6 +11,7 @@ import com.fdkankan.manage.entity.JyUserPlatform;
 import com.fdkankan.manage.exception.BusinessException;
 import com.fdkankan.manage.mapper.IJyUserPlatformMapper;
 import com.fdkankan.manage.service.IExcelService;
+import com.fdkankan.manage.service.IJyPlatformService;
 import com.fdkankan.manage.service.IJyUserPlatformService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fdkankan.manage.vo.request.*;
@@ -35,6 +36,8 @@ import java.util.List;
 @Slf4j
 public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper, JyUserPlatform> implements IJyUserPlatformService {
 
+    @Autowired
+    IJyPlatformService platformService;
     @Override
     public JyUserPlatform getByIdCard(String idCard) {
         LambdaQueryWrapper<JyUserPlatform> wrapper = new LambdaQueryWrapper<>();
@@ -103,7 +106,8 @@ public class JyUserPlatformServiceImpl extends ServiceImpl<IJyUserPlatformMapper
         if(StringUtils.isBlank(param.getQueryKey())){
             throw new BusinessException(ResultCode.MISSING_REQUIRED_PARAMETERS);
         }
-        return this.getBaseMapper().queryByKey(param.getQueryKey());
+        List<String> platformAdminIdCards = platformService.getIds();
+        return this.getBaseMapper().queryByKey(param.getQueryKey(),platformAdminIdCards);
     }
 
     @Override

+ 6 - 0
src/main/resources/mapper/manage/JyUserPlatformMapper.xml

@@ -29,5 +29,11 @@
         <if test="queryKey != null and queryKey !=''">
             and ( name = #{queryKey} or phone = #{queryKey} or id_card = #{queryKey}  )
         </if>
+        <if test="noInIds != null and noInIds.size >0">
+            and  id_card not in
+            <foreach collection="noInIds" item="idCard" open="(" close=")" separator=",">
+                #{idCard}
+            </foreach>
+        </if>
     </select>
 </mapper>