Compare commits
4 Commits
a19770bfab
...
2048ce356d
Author | SHA1 | Date |
---|---|---|
|
2048ce356d | 3 months ago |
|
82174aa6c6 | 3 months ago |
|
f3c92a0c0f | 3 months ago |
|
6f0de2a319 | 3 months ago |
@ -0,0 +1,25 @@
|
|||||||
|
package com.mashibing.common.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: OperatorEnums
|
||||||
|
* @Description: 运营商id和名称的枚举
|
||||||
|
* @date 2025/6/10 18:25
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum OperatorEnums {
|
||||||
|
|
||||||
|
MOBILE(1, "移动"),
|
||||||
|
UNICOM(2, "联通"),
|
||||||
|
TELECOM(3, "电信"),
|
||||||
|
;
|
||||||
|
|
||||||
|
public final int operatorId;
|
||||||
|
|
||||||
|
public final String operatorName;
|
||||||
|
|
||||||
|
OperatorEnums(int operatorId, String operatorName) {
|
||||||
|
this.operatorId = operatorId;
|
||||||
|
this.operatorName = operatorName;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.mashibing.strategy.service.strategyfilter.impl;
|
||||||
|
|
||||||
|
import com.mashibing.common.constant.CacheConstant;
|
||||||
|
import com.mashibing.common.enums.ExceptionEnums;
|
||||||
|
import com.mashibing.common.exception.StrategyException;
|
||||||
|
import com.mashibing.common.pojo.StandardSubmit;
|
||||||
|
import com.mashibing.strategy.feignclient.CacheClient;
|
||||||
|
import com.mashibing.strategy.service.strategyfilter.StrategyFilter;
|
||||||
|
import com.mashibing.strategy.utils.StrategyCheckFailedUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: BlackClientStrategyFilter
|
||||||
|
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @date 2025/6/10 17:29
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service(value = "blackClient")
|
||||||
|
public class BlackClientStrategyFilter implements StrategyFilter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StrategyCheckFailedUtil strategyCheckFailedUtil;
|
||||||
|
|
||||||
|
private static final String STRATEGY_NAME = "客户黑名单";
|
||||||
|
|
||||||
|
private static final String IN_BLACK = "1";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strategy(StandardSubmit submit) {
|
||||||
|
log.info("【策略模块-客户黑名单校验】开始=====================================");
|
||||||
|
String mobile = submit.getMobile();
|
||||||
|
Long clientId = submit.getClientId();
|
||||||
|
String value = cacheClient.get(CacheConstant.BLACK + clientId + CacheConstant.COLON + mobile);
|
||||||
|
if (IN_BLACK.equals(value)) {
|
||||||
|
log.info("【策略模块-客户黑名单校验】当前手机号:{}是客户黑名单!", mobile);
|
||||||
|
strategyCheckFailedUtil.smsSendLog(submit, STRATEGY_NAME);
|
||||||
|
strategyCheckFailedUtil.smsPushReport(submit, STRATEGY_NAME);
|
||||||
|
throw new StrategyException(ExceptionEnums.BLACK_CLIENT);
|
||||||
|
}
|
||||||
|
log.info("【策略模块-客户黑名单校验】当前手机号:{}客户黑名单校验通过!!!", mobile);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,49 @@
|
|||||||
|
package com.mashibing.strategy.service.strategyfilter.impl;
|
||||||
|
|
||||||
|
import com.mashibing.common.constant.CacheConstant;
|
||||||
|
import com.mashibing.common.enums.ExceptionEnums;
|
||||||
|
import com.mashibing.common.exception.StrategyException;
|
||||||
|
import com.mashibing.common.pojo.StandardSubmit;
|
||||||
|
import com.mashibing.strategy.feignclient.CacheClient;
|
||||||
|
import com.mashibing.strategy.service.strategyfilter.StrategyFilter;
|
||||||
|
import com.mashibing.strategy.utils.StrategyCheckFailedUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: BlackStrategyFilter
|
||||||
|
* @Description: 黑名单校验
|
||||||
|
* @date 2025/6/7 20:26
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service(value = "blackGlobal")
|
||||||
|
public class BlackGlobalStrategyFilter implements StrategyFilter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StrategyCheckFailedUtil strategyCheckFailedUtil;
|
||||||
|
|
||||||
|
private static final String STRATEGY_NAME = "全局黑名单";
|
||||||
|
|
||||||
|
private static final String IN_BLACK = "1";
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strategy(StandardSubmit submit) {
|
||||||
|
log.info("【策略模块-全局黑名单校验】开始=====================================");
|
||||||
|
String mobile = submit.getMobile();
|
||||||
|
String value = cacheClient.get(CacheConstant.BLACK + mobile);
|
||||||
|
if (IN_BLACK.equals(value)) {
|
||||||
|
log.info("【策略模块-全局黑名单校验】当前手机号:{}是全局黑名单!", mobile);
|
||||||
|
strategyCheckFailedUtil.smsSendLog(submit, STRATEGY_NAME);
|
||||||
|
strategyCheckFailedUtil.smsPushReport(submit, STRATEGY_NAME);
|
||||||
|
throw new StrategyException(ExceptionEnums.BLACK_GLOBAL);
|
||||||
|
}
|
||||||
|
log.info("【策略模块-全局黑名单校验】当前手机号:{}全局黑名单校验通过!!!", mobile);
|
||||||
|
}
|
||||||
|
}
|
@ -1,23 +0,0 @@
|
|||||||
package com.mashibing.strategy.service.strategyfilter.impl;
|
|
||||||
|
|
||||||
import com.mashibing.common.pojo.StandardSubmit;
|
|
||||||
import com.mashibing.strategy.service.strategyfilter.StrategyFilter;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: BlackStrategyFilter
|
|
||||||
* @Description: 黑名单校验
|
|
||||||
* @date 2025/6/7 20:26
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service(value = "black")
|
|
||||||
public class BlackStrategyFilter implements StrategyFilter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void strategy(StandardSubmit standardSubmit) {
|
|
||||||
log.info("【策略模块-黑名单校验】。。。");
|
|
||||||
}
|
|
||||||
}
|
|
@ -0,0 +1,90 @@
|
|||||||
|
package com.mashibing.strategy.service.strategyfilter.impl;
|
||||||
|
|
||||||
|
import com.mashibing.common.constant.CacheConstant;
|
||||||
|
import com.mashibing.common.enums.ExceptionEnums;
|
||||||
|
import com.mashibing.common.exception.StrategyException;
|
||||||
|
import com.mashibing.common.pojo.StandardSubmit;
|
||||||
|
import com.mashibing.strategy.feignclient.CacheClient;
|
||||||
|
import com.mashibing.strategy.service.strategyfilter.StrategyFilter;
|
||||||
|
import com.mashibing.strategy.utils.StrategyCheckFailedUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZoneOffset;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static java.time.ZoneOffset.UTC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: LimitHourStrategyFilter
|
||||||
|
* @Description: 小时限流策略
|
||||||
|
* @date 2025/6/10 21:14
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service(value = "limitHour")
|
||||||
|
public class LimitHourStrategyFilter implements StrategyFilter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StrategyCheckFailedUtil strategyCheckFailedUtil;
|
||||||
|
|
||||||
|
private final long LIMIT_DURATION = 60 * 60 * 1000 - 1;
|
||||||
|
|
||||||
|
private final int LIMIT_COUNT = 3;
|
||||||
|
|
||||||
|
private static final String STRATEGY_NAME = "小时限流";
|
||||||
|
|
||||||
|
private static final int RETRY_MAX = 2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strategy(StandardSubmit submit) {
|
||||||
|
if (submit.getState() != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
log.info("【策略模块-小时限流校验】开始====================================");
|
||||||
|
Long clientId = submit.getClientId();
|
||||||
|
String mobile = submit.getMobile();
|
||||||
|
long sendTimeMilli = submit.getSendTime().toInstant(ZoneOffset.of("+8")).toEpochMilli();
|
||||||
|
String key = CacheConstant.LIMIT_HOUR + clientId + CacheConstant.COLON + mobile;
|
||||||
|
boolean isSucceed = cacheClient.zAdd(key, String.valueOf(sendTimeMilli), sendTimeMilli);
|
||||||
|
|
||||||
|
//插入失败,开始重试
|
||||||
|
int retryCount = 0;
|
||||||
|
if (!isSucceed) {
|
||||||
|
|
||||||
|
while (retryCount < RETRY_MAX) {
|
||||||
|
retryCount++;
|
||||||
|
if (cacheClient.zAdd(key, String.valueOf(sendTimeMilli + retryCount), sendTimeMilli)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//三次插入都失败,直接报错
|
||||||
|
if (retryCount == RETRY_MAX) {
|
||||||
|
log.error("【策略模块-小时限流校验】达到限流阈值,校验失败!!!");
|
||||||
|
strategyCheckFailedUtil.smsSendLog(submit, STRATEGY_NAME);
|
||||||
|
strategyCheckFailedUtil.smsPushReport(submit, STRATEGY_NAME);
|
||||||
|
throw new StrategyException(ExceptionEnums.LIMIT_HOUR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//插入成功或者重试成功,开始滑动时间窗口检验
|
||||||
|
Set<Object> counts = cacheClient.zRangeByScore(key, sendTimeMilli - LIMIT_DURATION, sendTimeMilli);
|
||||||
|
if (counts != null && counts.size() > LIMIT_COUNT) {
|
||||||
|
log.error("【策略模块-小时限流校验】达到限流阈值,校验失败!!!");
|
||||||
|
//插入成功但发送失败,需要删除
|
||||||
|
cacheClient.zRemove(key, String.valueOf(sendTimeMilli + retryCount));
|
||||||
|
strategyCheckFailedUtil.smsSendLog(submit, STRATEGY_NAME);
|
||||||
|
strategyCheckFailedUtil.smsPushReport(submit, STRATEGY_NAME);
|
||||||
|
throw new StrategyException(ExceptionEnums.LIMIT_HOUR);
|
||||||
|
}
|
||||||
|
|
||||||
|
//插入成功,并且没有达到限流阈值
|
||||||
|
log.info("【策略模块-小时限流校验】小时限流校验通过!!!");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
package com.mashibing.strategy.service.strategyfilter.impl;
|
||||||
|
|
||||||
|
import com.mashibing.common.constant.CacheConstant;
|
||||||
|
import com.mashibing.common.enums.ExceptionEnums;
|
||||||
|
import com.mashibing.common.exception.StrategyException;
|
||||||
|
import com.mashibing.common.pojo.StandardSubmit;
|
||||||
|
import com.mashibing.strategy.feignclient.CacheClient;
|
||||||
|
import com.mashibing.strategy.service.strategyfilter.StrategyFilter;
|
||||||
|
import com.mashibing.strategy.utils.StrategyCheckFailedUtil;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: LimitMinuteStrategyFilter
|
||||||
|
* @Description: 分钟限流策略
|
||||||
|
* @date 2025/6/10 20:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service(value = "limitMinute")
|
||||||
|
public class LimitMinuteStrategyFilter implements StrategyFilter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StrategyCheckFailedUtil strategyCheckFailedUtil;
|
||||||
|
|
||||||
|
private final String VALUE = "1";
|
||||||
|
|
||||||
|
private final long TIME_SECONDS = 60L;
|
||||||
|
|
||||||
|
private static final String STRATEGY_NAME = "分钟限流";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strategy(StandardSubmit submit) {
|
||||||
|
if (submit.getState() != 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//使用set nx达到控制效果
|
||||||
|
log.info("【策略模块-分钟限流校验】开始====================================");
|
||||||
|
Long clientId = submit.getClientId();
|
||||||
|
String mobile = submit.getMobile();
|
||||||
|
String key = CacheConstant.LIMIT_MINUTE + clientId + CacheConstant.COLON + mobile;
|
||||||
|
boolean isSucceed = cacheClient.setnx(key, VALUE, TIME_SECONDS);
|
||||||
|
//插入成功,校验通过
|
||||||
|
if (isSucceed) {
|
||||||
|
log.info("【策略模块-分钟限流校验】通过!!!");
|
||||||
|
} else {
|
||||||
|
//插入失败,报错
|
||||||
|
log.error("【策略模块-分钟限流校验】达到限流阈值,校验失败!!!");
|
||||||
|
strategyCheckFailedUtil.smsSendLog(submit, STRATEGY_NAME);
|
||||||
|
strategyCheckFailedUtil.smsPushReport(submit, STRATEGY_NAME);
|
||||||
|
throw new StrategyException(ExceptionEnums.LIMIT_MINUTE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
package com.mashibing.strategy.service.strategyfilter.impl;
|
||||||
|
|
||||||
|
import com.mashibing.common.constant.CacheConstant;
|
||||||
|
import com.mashibing.common.pojo.StandardSubmit;
|
||||||
|
import com.mashibing.strategy.feignclient.CacheClient;
|
||||||
|
import com.mashibing.strategy.service.strategyfilter.StrategyFilter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: TransferStrategyFilter
|
||||||
|
* @Description: 携号转网判断
|
||||||
|
* @date 2025/6/10 18:36
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service(value = "transfer")
|
||||||
|
public class TransferStrategyFilter implements StrategyFilter {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void strategy(StandardSubmit submit) {
|
||||||
|
log.info("【策略模块-携号转网判断】开始=====================================");
|
||||||
|
|
||||||
|
String mobile = submit.getMobile();
|
||||||
|
String value = cacheClient.get(CacheConstant.TRANSFER + mobile);
|
||||||
|
if (!StringUtils.isBlank(value)) {
|
||||||
|
submit.setOperatorId(Integer.valueOf(value));
|
||||||
|
submit.setIsTransfer(Boolean.TRUE);
|
||||||
|
log.info("【策略模块-携号转网判断】携号转网!!!手机号:{}", mobile);
|
||||||
|
}
|
||||||
|
log.info("【策略模块-携号转网判断】结束=====================================");
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,137 @@
|
|||||||
|
package com.mashibing.test.entity;
|
||||||
|
|
||||||
|
|
||||||
|
public class MobileBlack {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String blackNumber;
|
||||||
|
private long blackType;
|
||||||
|
private long clientId;
|
||||||
|
private java.sql.Timestamp created;
|
||||||
|
private long createId;
|
||||||
|
private java.sql.Timestamp updated;
|
||||||
|
private long updateId;
|
||||||
|
private long isDelete;
|
||||||
|
private String extend1;
|
||||||
|
private String extend2;
|
||||||
|
private String extend3;
|
||||||
|
private String extend4;
|
||||||
|
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getBlackNumber() {
|
||||||
|
return blackNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlackNumber(String blackNumber) {
|
||||||
|
this.blackNumber = blackNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getBlackType() {
|
||||||
|
return blackType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlackType(long blackType) {
|
||||||
|
this.blackType = blackType;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getClientId() {
|
||||||
|
return clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientId(long clientId) {
|
||||||
|
this.clientId = clientId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public java.sql.Timestamp getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreated(java.sql.Timestamp created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getCreateId() {
|
||||||
|
return createId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateId(long createId) {
|
||||||
|
this.createId = createId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public java.sql.Timestamp getUpdated() {
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdated(java.sql.Timestamp updated) {
|
||||||
|
this.updated = updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getUpdateId() {
|
||||||
|
return updateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateId(long updateId) {
|
||||||
|
this.updateId = updateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getIsDelete() {
|
||||||
|
return isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDelete(long isDelete) {
|
||||||
|
this.isDelete = isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend1() {
|
||||||
|
return extend1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend1(String extend1) {
|
||||||
|
this.extend1 = extend1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend2() {
|
||||||
|
return extend2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend2(String extend2) {
|
||||||
|
this.extend2 = extend2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend3() {
|
||||||
|
return extend3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend3(String extend3) {
|
||||||
|
this.extend3 = extend3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend4() {
|
||||||
|
return extend4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend4(String extend4) {
|
||||||
|
this.extend4 = extend4;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,157 @@
|
|||||||
|
package com.mashibing.test.entity;
|
||||||
|
|
||||||
|
|
||||||
|
public class MobileTransfer {
|
||||||
|
|
||||||
|
private long id;
|
||||||
|
private String transferNumber;
|
||||||
|
private String areaCode;
|
||||||
|
private long initIsp;
|
||||||
|
private long nowIsp;
|
||||||
|
private long isTransfer;
|
||||||
|
private java.sql.Timestamp created;
|
||||||
|
private long createId;
|
||||||
|
private java.sql.Timestamp updated;
|
||||||
|
private long updateId;
|
||||||
|
private long isDelete;
|
||||||
|
private String extend1;
|
||||||
|
private String extend2;
|
||||||
|
private String extend3;
|
||||||
|
private String extend4;
|
||||||
|
|
||||||
|
|
||||||
|
public long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getTransferNumber() {
|
||||||
|
return transferNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTransferNumber(String transferNumber) {
|
||||||
|
this.transferNumber = transferNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getAreaCode() {
|
||||||
|
return areaCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAreaCode(String areaCode) {
|
||||||
|
this.areaCode = areaCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getInitIsp() {
|
||||||
|
return initIsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInitIsp(long initIsp) {
|
||||||
|
this.initIsp = initIsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getNowIsp() {
|
||||||
|
return nowIsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNowIsp(long nowIsp) {
|
||||||
|
this.nowIsp = nowIsp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getIsTransfer() {
|
||||||
|
return isTransfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsTransfer(long isTransfer) {
|
||||||
|
this.isTransfer = isTransfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public java.sql.Timestamp getCreated() {
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreated(java.sql.Timestamp created) {
|
||||||
|
this.created = created;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getCreateId() {
|
||||||
|
return createId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateId(long createId) {
|
||||||
|
this.createId = createId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public java.sql.Timestamp getUpdated() {
|
||||||
|
return updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdated(java.sql.Timestamp updated) {
|
||||||
|
this.updated = updated;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getUpdateId() {
|
||||||
|
return updateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUpdateId(long updateId) {
|
||||||
|
this.updateId = updateId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public long getIsDelete() {
|
||||||
|
return isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIsDelete(long isDelete) {
|
||||||
|
this.isDelete = isDelete;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend1() {
|
||||||
|
return extend1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend1(String extend1) {
|
||||||
|
this.extend1 = extend1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend2() {
|
||||||
|
return extend2;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend2(String extend2) {
|
||||||
|
this.extend2 = extend2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend3() {
|
||||||
|
return extend3;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend3(String extend3) {
|
||||||
|
this.extend3 = extend3;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public String getExtend4() {
|
||||||
|
return extend4;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExtend4(String extend4) {
|
||||||
|
this.extend4 = extend4;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,19 @@
|
|||||||
|
package com.mashibing.test.mapper;
|
||||||
|
|
||||||
|
import com.mashibing.test.entity.MobileBlack;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: MobileBlackMapper
|
||||||
|
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @date 2025/6/10 17:00
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface MobileBlackMapper {
|
||||||
|
|
||||||
|
@Select("select black_number,client_id from mobile_black where is_delete = 0")
|
||||||
|
List<MobileBlack> findAll1();
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
package com.mashibing.test.mapper;
|
||||||
|
|
||||||
|
import com.mashibing.test.entity.MobileTransfer;
|
||||||
|
import org.apache.ibatis.annotations.Select;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: MobileTransferMapper
|
||||||
|
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||||
|
* @date 2025/6/10 18:14
|
||||||
|
*/
|
||||||
|
|
||||||
|
public interface MobileTransferMapper {
|
||||||
|
@Select("select transfer_number,now_isp from mobile_transfer where is_transfer = 1 and is_delete = 0")
|
||||||
|
List<MobileTransfer> findAll1();
|
||||||
|
}
|
@ -0,0 +1,37 @@
|
|||||||
|
package com.mashibing.test.mapper;
|
||||||
|
|
||||||
|
import com.mashibing.test.entity.MobileBlack;
|
||||||
|
import com.mashibing.test.feignClient.CacheClient;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
class MobileBlackMapperTest {
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MobileBlackMapper mapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findAll1() {
|
||||||
|
List<MobileBlack> mobileBlackList = mapper.findAll1();
|
||||||
|
for (MobileBlack mobileBlack : mobileBlackList) {
|
||||||
|
if (mobileBlack.getClientId() == 0) {
|
||||||
|
//平台级
|
||||||
|
cacheClient.set("black:" + mobileBlack.getBlackNumber(), "1");
|
||||||
|
}else {
|
||||||
|
cacheClient.set("black:" +mobileBlack.getClientId()+":"+ mobileBlack.getBlackNumber(), "1");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
package com.mashibing.test.mapper;
|
||||||
|
|
||||||
|
import com.mashibing.test.entity.MobileTransfer;
|
||||||
|
import com.mashibing.test.feignClient.CacheClient;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static org.junit.jupiter.api.Assertions.*;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
class MobileTransferMapperTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CacheClient cacheClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
MobileTransferMapper mapper;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void findAll1() {
|
||||||
|
List<MobileTransfer> mobileTransfers = mapper.findAll1();
|
||||||
|
for (MobileTransfer mobileTransfer : mobileTransfers) {
|
||||||
|
cacheClient.set("transfer:" + mobileTransfer.getTransferNumber(), String.valueOf(mobileTransfer.getNowIsp()));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in new issue