add-定时任务,并推送到mq
This commit is contained in:
parent
d7c9100f8d
commit
2c578625c3
@ -22,9 +22,17 @@
|
|||||||
<groupId>cn.axzo.framework</groupId>
|
<groupId>cn.axzo.framework</groupId>
|
||||||
<artifactId>axzo-common-domain</artifactId>
|
<artifactId>axzo-common-domain</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>cn.axzo.framework.rocketmq</groupId>
|
||||||
|
<artifactId>axzo-common-rocketmq</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.servlet</groupId>
|
<groupId>jakarta.servlet</groupId>
|
||||||
<artifactId>jakarta.servlet-api</artifactId>
|
<artifactId>jakarta.servlet-api</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.cloud</groupId>
|
||||||
|
<artifactId>spring-cloud-context</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -0,0 +1,69 @@
|
|||||||
|
package cn.axzo.nanopart.api.constant.enums;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author zr
|
||||||
|
* @Date 2024/3/20 10:00
|
||||||
|
* @Description
|
||||||
|
**/
|
||||||
|
@Getter
|
||||||
|
public enum BlackModuleEnum {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 登录白名单
|
||||||
|
*/
|
||||||
|
ALL_LOGIN("all-login","登录白名单"),
|
||||||
|
/**
|
||||||
|
* 企业注册黑名单
|
||||||
|
*/
|
||||||
|
OU_REGISTER_BLACK_LIST("ou_register_black_list","企业注册黑名单"),
|
||||||
|
/**
|
||||||
|
* 白名单
|
||||||
|
*/
|
||||||
|
ATTENDANCE_PASS("attendance-pass","白名单"),
|
||||||
|
/**
|
||||||
|
* 产业工人黑名单
|
||||||
|
*/
|
||||||
|
GXJG_BLACKUSER_WORKER("gxjg-blackuser-worker","产业工人黑名单"),
|
||||||
|
/**
|
||||||
|
* 班组管理人员黑名单
|
||||||
|
*/
|
||||||
|
GXJG_BLACKUSER_TEAMLEADER("gxjg-blackuser-teamleader","班组管理人员黑名单"),
|
||||||
|
/**
|
||||||
|
* 项目管理人员黑名单
|
||||||
|
*/
|
||||||
|
GXJG_BLACKUSER_EMPLOYEE("gxjg-blackuser-employee","项目管理人员黑名单"),
|
||||||
|
/**
|
||||||
|
* 企业黑名单
|
||||||
|
*/
|
||||||
|
GXJG_BLACKCOMPANY("gxjg-blackcompany","企业黑名单"),
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
private final String description;
|
||||||
|
|
||||||
|
BlackModuleEnum(String value, String description) {
|
||||||
|
this.value = value;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static BlackModuleEnum getByValue(String value){
|
||||||
|
return Arrays.stream(values()).filter(l -> l.getValue().equals(value)).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<String> getValueList(List<BlackModuleEnum> enums){
|
||||||
|
if(enums == null){
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
return enums.stream().map(BlackModuleEnum::getValue).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package cn.axzo.nanopart.api.constant.enums;
|
||||||
|
|
||||||
|
import cn.axzo.framework.rocketmq.Event;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author zr
|
||||||
|
* @Date 2024/3/19 18:01
|
||||||
|
* @Description
|
||||||
|
**/
|
||||||
|
@Getter
|
||||||
|
public enum MQEventEnum {
|
||||||
|
|
||||||
|
GXJG_BLACKUSER_WORKER("plat-blacklist", "plat-blackuser-worker-list", "产业工人黑名单"),
|
||||||
|
GXJG_BLACKUSER_TEAMLEADER("plat-blacklist", "plat-blackuser-teamleader-list", "班组管理人员黑名单"),
|
||||||
|
GXJG_BLACKUSER_EMPLOYEE("plat-blacklist", "plat-blackuser-employee-list", "项目管理人员黑名单"),
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
private final String model;
|
||||||
|
private final String tag;
|
||||||
|
private final String desc;
|
||||||
|
private final Event.EventCode eventCode;
|
||||||
|
|
||||||
|
MQEventEnum(String model, String tag, String desc) {
|
||||||
|
this.eventCode = Event.EventCode.builder()
|
||||||
|
.module(model)
|
||||||
|
.name(tag)
|
||||||
|
.build();
|
||||||
|
this.model = model;
|
||||||
|
this.tag = tag;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static MQEventEnum getByName(String name){
|
||||||
|
return Arrays.stream(MQEventEnum.values()).filter(item -> item.name().equals(name)).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -41,5 +41,10 @@
|
|||||||
<groupId>cn.axzo.pokonyan</groupId>
|
<groupId>cn.axzo.pokonyan</groupId>
|
||||||
<artifactId>pokonyan</artifactId>
|
<artifactId>pokonyan</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.xuxueli</groupId>
|
||||||
|
<artifactId>xxl-job-core</artifactId>
|
||||||
|
<version>2.2.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -3,6 +3,9 @@ package cn.axzo.nanopart.server.dao.mapper;
|
|||||||
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: chenwenjian
|
* @author: chenwenjian
|
||||||
@ -13,4 +16,16 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
*/
|
*/
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface BlackAndWhiteListMapper extends BaseMapper<SaasBlackWhiteList> {
|
public interface BlackAndWhiteListMapper extends BaseMapper<SaasBlackWhiteList> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取getField中字段的值
|
||||||
|
*
|
||||||
|
* @param type
|
||||||
|
* @param getField 获取json中指定字段
|
||||||
|
* @param modules
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<String> getParamValue(@Param("type") Integer type,
|
||||||
|
@Param("getField") String getField,
|
||||||
|
@Param("modules") List<String> modules);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,16 +6,15 @@ import cn.axzo.nanopart.api.request.BlackAndWhiteListReq;
|
|||||||
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
||||||
import cn.axzo.nanopart.server.dao.mapper.BlackAndWhiteListMapper;
|
import cn.axzo.nanopart.server.dao.mapper.BlackAndWhiteListMapper;
|
||||||
import cn.azxo.framework.common.utils.StringUtils;
|
import cn.azxo.framework.common.utils.StringUtils;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.json.JSONObject;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -127,4 +126,20 @@ public class BlackAndWhiteListRepository extends ServiceImpl<BlackAndWhiteListMa
|
|||||||
.eq(SaasBlackWhiteList::getIsDelete, 0)
|
.eq(SaasBlackWhiteList::getIsDelete, 0)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据模块名获取名单
|
||||||
|
*
|
||||||
|
* @param type 名单类型
|
||||||
|
* @param modules 模块名
|
||||||
|
* @return 名单列表
|
||||||
|
*/
|
||||||
|
|
||||||
|
public List<SaasBlackWhiteList> listByModule(Integer type, List<String> modules) {
|
||||||
|
return lambdaQuery()
|
||||||
|
.eq(SaasBlackWhiteList::getType, type)
|
||||||
|
.in(CollUtil.isNotEmpty(modules),SaasBlackWhiteList::getModule, modules)
|
||||||
|
.eq(SaasBlackWhiteList::getIsDelete, 0)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
package cn.axzo.nanopart.server.job;
|
||||||
|
|
||||||
|
import cn.azxo.framework.common.logger.JobLoggerTemplate;
|
||||||
|
import com.xxl.job.core.biz.model.ReturnT;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author zr
|
||||||
|
* @Date 2024/3/20 16:28
|
||||||
|
* @Description
|
||||||
|
**/
|
||||||
|
public abstract class BaseJobHandler {
|
||||||
|
|
||||||
|
@Resource(name = "jobLoggerTemplate")
|
||||||
|
protected JobLoggerTemplate jobLoggerTemplate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 定时任务执行逻辑
|
||||||
|
*/
|
||||||
|
public abstract ReturnT<String> execute(String param) throws Exception;
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package cn.axzo.nanopart.server.job;
|
||||||
|
|
||||||
|
import cn.axzo.nanopart.api.constant.enums.BlackModuleEnum;
|
||||||
|
import cn.axzo.nanopart.api.constant.enums.MQEventEnum;
|
||||||
|
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
||||||
|
import cn.axzo.nanopart.server.mq.producer.BlackProducer;
|
||||||
|
import cn.axzo.nanopart.server.service.BlackAndWhiteListService;
|
||||||
|
import com.xxl.job.core.biz.model.ReturnT;
|
||||||
|
import com.xxl.job.core.handler.annotation.XxlJob;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author zr
|
||||||
|
* @Date 2024/3/20 16:26
|
||||||
|
* @Description 定时任务
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class BlackUserSyncJob extends BaseJobHandler{
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private BlackAndWhiteListService blackAndWhiteListService;
|
||||||
|
/**
|
||||||
|
* 定时任务执行逻辑
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
@XxlJob("blackUserSyncJob")
|
||||||
|
public ReturnT<String> execute(String param) throws Exception {
|
||||||
|
List<SaasBlackWhiteList> saasBlackWhiteLists = blackAndWhiteListService.listModuleBlackUser();
|
||||||
|
Map<String, List<SaasBlackWhiteList>> modulBlackMap = saasBlackWhiteLists.stream().collect(Collectors.groupingBy(SaasBlackWhiteList::getModule));
|
||||||
|
modulBlackMap.forEach((module, blackList) -> {
|
||||||
|
log.info("syncRockerMQ module:{} ,blackList.size:{}" ,module, blackList.size());
|
||||||
|
BlackModuleEnum blackModuleEnum = BlackModuleEnum.getByValue(module);
|
||||||
|
MQEventEnum event = MQEventEnum.getByName(blackModuleEnum.name());
|
||||||
|
if(Objects.nonNull(blackModuleEnum) && Objects.nonNull(event)){
|
||||||
|
BlackProducer.sendBatch(event, blackList);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return ReturnT.SUCCESS;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package cn.axzo.nanopart.server.mq;
|
||||||
|
|
||||||
|
import cn.axzo.framework.rocketmq.EventProducer;
|
||||||
|
import cn.axzo.framework.rocketmq.RocketMQEventProducer;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.apache.rocketmq.spring.core.RocketMQTemplate;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author zr
|
||||||
|
* @Date 2024/3/21 14:12
|
||||||
|
* @Description
|
||||||
|
**/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class RocketMQEventConfiguration {
|
||||||
|
|
||||||
|
@Value("${spring.profiles.active}")
|
||||||
|
private String profileActivity;
|
||||||
|
private final String serviceName = "nanopart";
|
||||||
|
private final String topic = "nanopart";
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public RocketMQTemplate ser(){
|
||||||
|
return new RocketMQTemplate();
|
||||||
|
}
|
||||||
|
@Bean
|
||||||
|
EventProducer eventProducer(RocketMQTemplate rocketMQTemplate) {
|
||||||
|
return new RocketMQEventProducer(rocketMQTemplate,
|
||||||
|
serviceName,
|
||||||
|
serviceName,
|
||||||
|
EventProducer.Context.<RocketMQEventProducer.RocketMQMessageMeta>builder()
|
||||||
|
.meta(RocketMQEventProducer.RocketMQMessageMeta.builder()
|
||||||
|
.topic(getTopic(topic))
|
||||||
|
.build())
|
||||||
|
.build(),
|
||||||
|
null
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getTopic(String topic) {
|
||||||
|
if (!StringUtils.isEmpty(topic)) {
|
||||||
|
topic = topic + "_" + profileActivity;
|
||||||
|
}
|
||||||
|
return topic;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,59 @@
|
|||||||
|
package cn.axzo.nanopart.server.mq.producer;
|
||||||
|
|
||||||
|
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||||
|
import cn.axzo.framework.domain.ServiceException;
|
||||||
|
import cn.axzo.framework.rocketmq.Event;
|
||||||
|
import cn.axzo.framework.rocketmq.EventProducer;
|
||||||
|
import cn.axzo.nanopart.api.constant.enums.MQEventEnum;
|
||||||
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
public class BlackProducer implements InitializingBean {
|
||||||
|
private static EventProducer<?> eventProducer;
|
||||||
|
|
||||||
|
public static void send(MQEventEnum mqEventEnum, BaseEntity<?> baseEntity, String operatorId){
|
||||||
|
log.info(JSON.toJSONString(baseEntity));
|
||||||
|
if(mqEventEnum == null){
|
||||||
|
throw new ServiceException("无法正确发送mq: mqEventEnum不能为空");
|
||||||
|
}
|
||||||
|
if(baseEntity == null){
|
||||||
|
log.error("消息实体为空不能发送mq mqEventEnum {}", mqEventEnum);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(baseEntity.getId() == null){
|
||||||
|
throw new ServiceException("无法正确发送mq: 主健id不能为空");
|
||||||
|
}
|
||||||
|
//生产消息
|
||||||
|
eventProducer.send(Event.builder()
|
||||||
|
.shardingKey(String.valueOf(baseEntity.getId()))
|
||||||
|
.targetId(String.valueOf(baseEntity.getId()))
|
||||||
|
.targetType(mqEventEnum.getModel())
|
||||||
|
.eventCode(new Event.EventCode(mqEventEnum.getModel(), mqEventEnum.getTag()))
|
||||||
|
.eventModule(mqEventEnum.getModel())
|
||||||
|
.eventName(mqEventEnum.getTag())
|
||||||
|
.operatorId(operatorId)
|
||||||
|
.data(baseEntity)
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void send(MQEventEnum mqEventEnum, BaseEntity<?> baseEntity){
|
||||||
|
send(mqEventEnum, baseEntity, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void sendBatch(MQEventEnum mqEventEnum, List<? extends BaseEntity<?>> baseEntities){
|
||||||
|
baseEntities.forEach(baseEntity -> send(mqEventEnum, baseEntity, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterPropertiesSet() {
|
||||||
|
eventProducer = SpringUtil.getBean(EventProducer.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -7,6 +7,7 @@ import cn.axzo.nanopart.api.request.BlackAndWhiteListPlatformSyncReq;
|
|||||||
import cn.axzo.nanopart.api.request.BlackAndWhiteListReq;
|
import cn.axzo.nanopart.api.request.BlackAndWhiteListReq;
|
||||||
import cn.axzo.nanopart.api.response.BlackAndWhiteListExcelImportResp;
|
import cn.axzo.nanopart.api.response.BlackAndWhiteListExcelImportResp;
|
||||||
import cn.axzo.nanopart.api.response.BlackAndWhiteListResp;
|
import cn.axzo.nanopart.api.response.BlackAndWhiteListResp;
|
||||||
|
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -36,4 +37,6 @@ public interface BlackAndWhiteListService {
|
|||||||
Boolean platformSync(BlackAndWhiteListPlatformSyncReq req);
|
Boolean platformSync(BlackAndWhiteListPlatformSyncReq req);
|
||||||
|
|
||||||
Long internalSync(BlackAndWhiteListInternalSyncReq req);
|
Long internalSync(BlackAndWhiteListInternalSyncReq req);
|
||||||
|
|
||||||
|
List<SaasBlackWhiteList> listModuleBlackUser();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,7 +2,9 @@ package cn.axzo.nanopart.server.service.impl;
|
|||||||
|
|
||||||
import cn.axzo.basics.common.BeanMapper;
|
import cn.axzo.basics.common.BeanMapper;
|
||||||
import cn.axzo.basics.common.exception.ServiceException;
|
import cn.axzo.basics.common.exception.ServiceException;
|
||||||
|
import cn.axzo.nanopart.api.constant.enums.BlackModuleEnum;
|
||||||
import cn.axzo.nanopart.api.constant.enums.ListTypeEnum;
|
import cn.axzo.nanopart.api.constant.enums.ListTypeEnum;
|
||||||
|
import cn.axzo.nanopart.api.constant.enums.MQEventEnum;
|
||||||
import cn.axzo.nanopart.api.request.BlackAndWhiteListInternalSyncReq;
|
import cn.axzo.nanopart.api.request.BlackAndWhiteListInternalSyncReq;
|
||||||
import cn.axzo.nanopart.api.request.BlackAndWhiteListPlatformSyncReq;
|
import cn.axzo.nanopart.api.request.BlackAndWhiteListPlatformSyncReq;
|
||||||
import cn.axzo.nanopart.api.request.BlackAndWhiteListReq;
|
import cn.axzo.nanopart.api.request.BlackAndWhiteListReq;
|
||||||
@ -11,9 +13,9 @@ import cn.axzo.nanopart.api.response.BlackAndWhiteListResp;
|
|||||||
import cn.axzo.nanopart.server.constant.BlackAndWhiteListConstant;
|
import cn.axzo.nanopart.server.constant.BlackAndWhiteListConstant;
|
||||||
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
import cn.axzo.nanopart.server.dao.entity.SaasBlackWhiteList;
|
||||||
import cn.axzo.nanopart.server.dao.repository.BlackAndWhiteListRepository;
|
import cn.axzo.nanopart.server.dao.repository.BlackAndWhiteListRepository;
|
||||||
|
import cn.axzo.nanopart.server.mq.producer.BlackProducer;
|
||||||
import cn.axzo.nanopart.server.service.BlackAndWhiteListService;
|
import cn.axzo.nanopart.server.service.BlackAndWhiteListService;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.event.AnalysisEventListener;
|
import com.alibaba.excel.event.AnalysisEventListener;
|
||||||
@ -376,4 +378,12 @@ public class BlackAndWhiteListServiceImpl implements BlackAndWhiteListService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
return blackAndWhiteListRepository.saveBatch(list);
|
return blackAndWhiteListRepository.saveBatch(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<SaasBlackWhiteList> listModuleBlackUser(){
|
||||||
|
// 同步到RockerMQ
|
||||||
|
ArrayList<BlackModuleEnum> models = Lists.newArrayList(BlackModuleEnum.GXJG_BLACKUSER_WORKER, BlackModuleEnum.GXJG_BLACKUSER_TEAMLEADER, BlackModuleEnum.GXJG_BLACKUSER_EMPLOYEE);
|
||||||
|
return blackAndWhiteListRepository.listByModule(ListTypeEnum.BLACK_LIST.getValue(), BlackModuleEnum.getValueList(models));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -28,6 +28,10 @@
|
|||||||
<groupId>cn.axzo.basics</groupId>
|
<groupId>cn.axzo.basics</groupId>
|
||||||
<artifactId>basics-common</artifactId>
|
<artifactId>basics-common</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.baomidou</groupId>
|
||||||
|
<artifactId>mybatis-plus-annotation</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
<?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="cn.axzo.nanopart.server.dao.mapper.BlackAndWhiteListMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getParamValue" resultType="java.lang.String">
|
||||||
|
SELECT `param` - > '$.#{getField}'
|
||||||
|
FROM `saas_black_white_list`
|
||||||
|
WHERE type = #{type}
|
||||||
|
<if test="modules !=null and modules.size > 0">
|
||||||
|
AND `module` in
|
||||||
|
<foreach collection="modules" open="(" close=")" separator="," item="module">
|
||||||
|
#{module}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
and `is_delete` = 0;
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue
Block a user