|
@@ -1,7 +1,10 @@
|
|
|
package com.xjrsoft.module.base.service.impl;
|
|
package com.xjrsoft.module.base.service.impl;
|
|
|
|
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
|
|
+import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
|
|
+import com.xjrsoft.common.utils.RedisUtil;
|
|
|
import com.xjrsoft.module.base.dto.WhitelistManagementPageDto;
|
|
import com.xjrsoft.module.base.dto.WhitelistManagementPageDto;
|
|
|
import com.xjrsoft.module.base.entity.TreeNode;
|
|
import com.xjrsoft.module.base.entity.TreeNode;
|
|
|
import com.xjrsoft.module.base.entity.WhiteBaseClass;
|
|
import com.xjrsoft.module.base.entity.WhiteBaseClass;
|
|
@@ -11,11 +14,14 @@ import com.xjrsoft.module.base.mapper.WhitelistManagementMapper;
|
|
|
import com.xjrsoft.module.base.service.IWhitelistManagementService;
|
|
import com.xjrsoft.module.base.service.IWhitelistManagementService;
|
|
|
import com.xjrsoft.module.base.vo.WhitelistManagementPageVo;
|
|
import com.xjrsoft.module.base.vo.WhitelistManagementPageVo;
|
|
|
import lombok.AllArgsConstructor;
|
|
import lombok.AllArgsConstructor;
|
|
|
-import lombok.Data;
|
|
|
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @title: 白名单管理
|
|
* @title: 白名单管理
|
|
@@ -23,11 +29,14 @@ import java.util.List;
|
|
|
* @Date: 2024-06-24
|
|
* @Date: 2024-06-24
|
|
|
* @Version 1.0
|
|
* @Version 1.0
|
|
|
*/
|
|
*/
|
|
|
|
|
+@Slf4j
|
|
|
@Service
|
|
@Service
|
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
|
public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<WhitelistManagementMapper, WhitelistManagement> implements IWhitelistManagementService {
|
|
public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<WhitelistManagementMapper, WhitelistManagement> implements IWhitelistManagementService {
|
|
|
private final WhitelistManagementMapper whitelistManagementMapper;
|
|
private final WhitelistManagementMapper whitelistManagementMapper;
|
|
|
|
|
|
|
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public Page<WhitelistManagementPageVo> getPage(Page<Object> objectPage, WhitelistManagementPageDto dto) {
|
|
public Page<WhitelistManagementPageVo> getPage(Page<Object> objectPage, WhitelistManagementPageDto dto) {
|
|
|
return whitelistManagementMapper.getPage(objectPage, dto);
|
|
return whitelistManagementMapper.getPage(objectPage, dto);
|
|
@@ -84,4 +93,16 @@ public class WhitelistManagementServiceImpl extends MPJBaseServiceImpl<Whitelist
|
|
|
|
|
|
|
|
return treeNodes;
|
|
return treeNodes;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 所有学生电信开卡用户缓存
|
|
|
|
|
+ */
|
|
|
|
|
+ @Async
|
|
|
|
|
+ public void loadCaches() {
|
|
|
|
|
+ log.info("XJRSOFT: 加载所有学生电信开卡用户缓存开始");
|
|
|
|
|
+ List<WhitelistManagement> list = whitelistManagementMapper.selectList(Wrappers.<WhitelistManagement>query().lambda().select(WhitelistManagement::getUserId));
|
|
|
|
|
+ Map<Long, Long> map = list.stream().collect(Collectors.toMap(WhitelistManagement::getUserId, WhitelistManagement::getUserId));
|
|
|
|
|
+ redisUtil.set(GlobalConstant.WHITE_MANAGEMENT_CACHE_KEY, map);
|
|
|
|
|
+ log.info("XJRSOFT: 加载所有学生电信开卡用户缓存结束");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|