Compare commits

..

No commits in common. '2048ce356d158676d19b6897c7e77ac64d21983a' and 'a19770bfabe84c5fda129245f3eab4a638fd85cf' have entirely different histories.

@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.*;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* @author heqijun
@ -31,18 +30,12 @@ public class CacheController {
return redisClient.get(key);
}
@PostMapping("set/{key}/{value}")
@GetMapping("set/{key}/{value}")
public void set(@PathVariable String key, @PathVariable String value) {
log.info("【缓存模块】setkey = {}\nvalue = {}", key, value);
redisClient.set(key, value);
}
@PostMapping("setnx/{key}/{value}/{time}")
public boolean setnx(@PathVariable String key, @PathVariable String value, @PathVariable Long time) {
log.info("【缓存模块】setnxkey = {}\nvalue = {},time:{}", key, value, time);
return redisClient.setNx(key, value, time, TimeUnit.SECONDS);
}
@GetMapping("hget/{key}")
public Map hget(@PathVariable String key) {
log.info("【缓存模块】hgetkey={}", key);
@ -71,19 +64,19 @@ public class CacheController {
redisClient.hSet(key, hash);
}
@PostMapping("sadd/{key}")
@PostMapping("/sadd/{key}")
public void sadd(@PathVariable(value = "key") String key, @RequestBody Map<String, Object>... value) {
log.info("【缓存模块】sadd: key = {}\nvalue = {}", key, value);
redisClient.sAdd(key, value);
}
@PostMapping("saddstr/{key}")
@PostMapping("/saddstr/{key}")
public void saddStr(@PathVariable(value = "key") String key, @RequestBody String... value) {
log.info("【缓存模块】saddStr: key = {}\nvalue = {}", key, value);
redisClient.sAdd(key, value);
}
@PostMapping("sinterstr/{key}/{sinterkey}")
@PostMapping("/sinterstr/{key}/{sinterkey}")
public Set<Object> sinterStr(@PathVariable(value = "key") String key, @PathVariable String sinterkey, @RequestBody String... value) {
log.info("【缓存模块】sinterStr: key = {}sinterkey={}\nvalue = {}", key, sinterkey, value);
//1. 存入key和value
@ -98,7 +91,7 @@ public class CacheController {
return result;
}
@PostMapping("smember/{key}")
@PostMapping("/smember/{key}")
public Set smember(@PathVariable(value = "key") String key) {
log.info("【缓存模块】smember: key = {}", key);
Set value = redisClient.sMembers(key);
@ -106,31 +99,12 @@ public class CacheController {
return value;
}
@PostMapping("zadd/{key}/{member}/{score}")
public boolean zAdd(@PathVariable String key, @PathVariable String member, @PathVariable Long score) {
log.info("【缓存模块】zadd: key = {}member = {},score = {}", key, member, score);
return redisClient.zAdd(key, member, score);
}
@GetMapping("zrangebyscore/{key}/{start}/{end}")
public Set<Object> zRangeByScore(@PathVariable String key, @PathVariable long start, @PathVariable long end) {
log.info("【缓存模块】zrange: key = {}start = {},end = {}", key, start, end);
return redisClient.zRangeByScore(key, start, end);
}
@GetMapping("zremove/{key}/{member}/")
public long zRemove(@PathVariable String key, @PathVariable String member) {
Long l = redisClient.zRemove(key, member);
log.info("【缓存模块】zadd: key = {}member = {},编号 = {}", key, member, l);
return l;
}
/**
* String
*
* @param map keykeyvaluevalue
*/
@PostMapping("pipeline/string")
@PostMapping("/pipeline/string")
public void pipelineString(@RequestBody Map<String, String> map) {
log.info("【缓存模块】pipelineString: 数量 = {}", map.size());
long start = System.currentTimeMillis();

@ -8,7 +8,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
/**
* @author heqijun
@ -22,47 +21,35 @@ public interface BeaconCacheClient {
@GetMapping("cache/get/{key}")
String get(@PathVariable String key);
@PostMapping("cache/set/{key}/{value}")
@GetMapping("cache/set/{key}/{value}")
void set(@PathVariable String key, @PathVariable String value);
@PostMapping("cache/setnx/{key}/{value}/{time}")
boolean setnx(@PathVariable String key, @PathVariable String value, @PathVariable Long time);
@GetMapping("cache/hget/{key}")
Map hget(@PathVariable String key);
@GetMapping("cache/hget/{key}/{field}")
Object hget(@PathVariable String key, @PathVariable String field);
Object hget(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);
@GetMapping("cache/hgetString/{key}/{field}")
String hgetString(@PathVariable String key, @PathVariable String field);
String hgetString(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);
@GetMapping("cache/hget/{key}/{field}")
Integer hgetInteger(@PathVariable String key, @PathVariable String field);
Integer hgetInteger(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);
@PostMapping("cache/hset/{key}")
void hset(@PathVariable String key, @RequestBody Map hash);
@PostMapping("cache/sadd/{key}")
void sadd(@PathVariable String key, @RequestBody Map<String, Object>... value);
void sadd(@PathVariable(value = "key") String key, @RequestBody Map<String, Object>... value);
@PostMapping("cache/saddstr/{key}")
void saddStr(@PathVariable String key, @RequestBody String... value);
void saddStr(@PathVariable(value = "key") String key, @RequestBody String... value);
@PostMapping("cache/sinterstr/{key}/{sinterkey}")
Set<Object> sinterStr(@PathVariable String key, @PathVariable String sinterkey, @RequestBody String... value);
Set<Object> sinterStr(@PathVariable(value = "key") String key, @PathVariable String sinterkey, @RequestBody String... value);
@PostMapping("cache/smember/{key}")
Set smember(@PathVariable String key);
@PostMapping("cache/zadd/{key}/{member}/{score}")
boolean zAdd(@PathVariable String key, @PathVariable String member, @PathVariable Long score);
@GetMapping("cache/zrangebyscore/{key}/{start}/{end}")
Set<Object> zRangeByScore(@PathVariable String key, @PathVariable Long start, @PathVariable Long end);
@GetMapping("cache/zremove/{key}/{member}/")
long zRemove(@PathVariable String key, @PathVariable String member);
Set smember(@PathVariable(value = "key") String key);
/**
* String

@ -38,18 +38,4 @@ public class CacheConstant {
@Description("客户信息-回调地址")
public static final String CALLBACK_URL = "callbackUrl";
@Description("黑名单前缀")
public static final String BLACK = "black:";
@Description("冒号")
public static final String COLON = ":";
@Description("携号转网前缀")
public static final String TRANSFER = "transfer:";
@Description("分钟限流规则前缀")
public static final String LIMIT_MINUTE = "limit_minute:";
@Description("小时限流规则前缀")
public static final String LIMIT_HOUR = "limit_hour:";
}

@ -21,15 +21,11 @@ public enum ExceptionEnums {
SNOWFLAKE_OUT_OF_RANGE(-11, "机器id超过最大范围!"),
SNOWFLAKE_TIME_BACK(-12, "雪花算法出现时间回拨!!!"),
HAVE_DIRTY_WORD(-13, "短信中包含敏感词信息!!"),
BLACK_GLOBAL(-14, "手机号是全局黑名单!!"),
BLACK_CLIENT(-15, "手机号是客户黑名单!!"),
LIMIT_MINUTE(-16, "达到分钟限流阈值!!"),
LIMIT_HOUR(-17, "达到小时限流阈值!!"),
;
private final int code;
private int code;
private final String msg;
private String msg;
ExceptionEnums(int code, String msg) {
this.code = code;

@ -1,25 +0,0 @@
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;
}
}

@ -80,7 +80,4 @@ public class StandardSubmit implements Serializable {
@Description("state短信类型 0-验证码短信 1-通知类短信 2-营销类短信")
private Integer state;
@Description("是否携号转网")
private Boolean isTransfer;
}

@ -14,6 +14,6 @@ public interface StrategyFilter {
/**
*
*/
void strategy(StandardSubmit submit);
void strategy(StandardSubmit standardSubmit);
}

@ -29,8 +29,8 @@ public class StrategyFilterContext {
private final String CLIENT_FILTERS = "clientFilters";
public void strategy(StandardSubmit submit) {
String s = cacheClient.hgetString(CacheConstant.CLIENT_BUSINESS + submit.getApikey(), CLIENT_FILTERS);
public void strategy(StandardSubmit standardSubmit) {
String s = cacheClient.hgetString(CacheConstant.CLIENT_BUSINESS + standardSubmit.getApikey(), CLIENT_FILTERS);
if (StringUtils.isBlank(s)) {
log.info("【策略模块-策略为空】没有校验。。。");
return;
@ -39,7 +39,7 @@ public class StrategyFilterContext {
for (String strategyFilter : strategyFilterArr) {
StrategyFilter check = strategyFilters.get(strategyFilter);
if (check != null) {
check.strategy(submit);
check.strategy(standardSubmit);
}
}
}

@ -1,49 +0,0 @@
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);
}
}

@ -1,49 +0,0 @@
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);
}
}

@ -0,0 +1,23 @@
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("【策略模块-黑名单校验】。。。");
}
}

@ -1,90 +0,0 @@
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("【策略模块-小时限流校验】小时限流校验通过!!!");
}
}

@ -1,62 +0,0 @@
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);
}
}
}

@ -17,7 +17,7 @@ import org.springframework.stereotype.Service;
public class RouteStrategyFilter implements StrategyFilter {
@Override
public void strategy(StandardSubmit submit) {
public void strategy(StandardSubmit standardSubmit) {
log.info("【策略模块-路由校验】。。。");
}
}

@ -1,39 +0,0 @@
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("【策略模块-携号转网判断】结束=====================================");
}
}

@ -57,7 +57,6 @@ public class StrategyCheckFailedUtil {
* @param strategyName
*/
public void smsSendLog(StandardSubmit submit, String strategyName) {
submit.setReportState(2);
rabbitTemplate.convertAndSend(RabbitMQConstant.SMS_WRITE_LOG, submit);
log.error("【策略模块-{}校验】发送写日志消息到{}队列,消息:{}", strategyName, RabbitMQConstant.SMS_WRITE_LOG, submit);
}

@ -1,137 +0,0 @@
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;
}
}

@ -1,157 +0,0 @@
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;
}
}

@ -1,19 +0,0 @@
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();
}

@ -1,18 +0,0 @@
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();
}

@ -1,37 +0,0 @@
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");
}
}
}
}

@ -1,33 +0,0 @@
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…
Cancel
Save