Compare commits
No commits in common. '9b1336f40828f1a5ab1b5e5fd4bfb057f3c59a1e' and '02c744d8cad205001e0737468c4836e4eb994a59' have entirely different histories.
9b1336f408
...
02c744d8ca
@ -0,0 +1,42 @@
|
|||||||
|
package com.mashibing.api.feignClient;
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: BeaconCacheClient
|
||||||
|
* @Description: 缓存模块openFeignClient接口
|
||||||
|
* @date 2025/6/5 20:13
|
||||||
|
*/
|
||||||
|
|
||||||
|
@FeignClient("beacon-cache")
|
||||||
|
@RequestMapping("cache")
|
||||||
|
public interface CacheClient {
|
||||||
|
@GetMapping("get/{key}")
|
||||||
|
String get(@PathVariable String key);
|
||||||
|
|
||||||
|
@GetMapping("set/{key}/{value}")
|
||||||
|
void set(@PathVariable String key, @PathVariable String value);
|
||||||
|
|
||||||
|
@GetMapping("hget/{key}")
|
||||||
|
Map hget(@PathVariable String key);
|
||||||
|
|
||||||
|
@GetMapping("/hget/{key}/{field}")
|
||||||
|
Object hget(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);
|
||||||
|
|
||||||
|
@GetMapping("/hgetString/{key}/{field}")
|
||||||
|
String hgetString(@PathVariable(value = "key") String key, @PathVariable(value = "field") String field);
|
||||||
|
|
||||||
|
@PostMapping("hset/{key}")
|
||||||
|
void hset(@PathVariable String key, @RequestBody Map hash);
|
||||||
|
|
||||||
|
@PostMapping("/sadd/{key}")
|
||||||
|
void sadd(@PathVariable(value = "key") String key, @RequestBody Map<String, Object>... maps);
|
||||||
|
|
||||||
|
@PostMapping("/smember/{key}")
|
||||||
|
Set<Map> smember(@PathVariable(value = "key") String key);
|
||||||
|
}
|
@ -1,20 +0,0 @@
|
|||||||
package com.mashibing.api.feignclient;
|
|
||||||
|
|
||||||
import com.mashibing.common.clients.BeaconCacheClient;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: BeaconCacheClient
|
|
||||||
* @Description: 缓存模块openFeignClient接口
|
|
||||||
* @date 2025/6/5 20:13
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FeignClient("beacon-cache")
|
|
||||||
public interface CacheClient extends BeaconCacheClient {
|
|
||||||
|
|
||||||
}
|
|
@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>com.mashibing</groupId>
|
|
||||||
<artifactId>beacon-cloud</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
<relativePath>../pom.xml</relativePath>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>beacon-strategy</artifactId>
|
|
||||||
|
|
||||||
|
|
||||||
<dependencies>
|
|
||||||
<!-- web -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-web</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- nacos注册中心 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- nacos配置中心 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.cloud</groupId>
|
|
||||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- AMQP -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- 测试 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- lombok -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.projectlombok</groupId>
|
|
||||||
<artifactId>lombok</artifactId>
|
|
||||||
</dependency>
|
|
||||||
<!-- common公共组件 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.mashibing</groupId>
|
|
||||||
<artifactId>beacon-common</artifactId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
@ -1,22 +0,0 @@
|
|||||||
package com.mashibing.strategy;
|
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|
||||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
|
||||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: StragyApplication
|
|
||||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
|
||||||
* @date 2025/6/7 19:03
|
|
||||||
*/
|
|
||||||
|
|
||||||
@SpringBootApplication
|
|
||||||
@EnableFeignClients
|
|
||||||
@EnableDiscoveryClient
|
|
||||||
public class StragyApplication {
|
|
||||||
public static void main(String[] args) {
|
|
||||||
SpringApplication.run(StragyApplication.class, args);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,26 +0,0 @@
|
|||||||
package com.mashibing.strategy.config;
|
|
||||||
|
|
||||||
import com.mashibing.common.constant.RabbitMQConstant;
|
|
||||||
import org.springframework.amqp.core.Queue;
|
|
||||||
import org.springframework.amqp.core.QueueBuilder;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: RabbitMQConfig
|
|
||||||
* @Description: RabbitMQConfig
|
|
||||||
* @date 2025/6/8 17:46
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class RabbitMQConfig {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 构建策略模块发送【手机号归属地和运营商】到后台管理模块的队列名称
|
|
||||||
*/
|
|
||||||
@Bean
|
|
||||||
public Queue preSendQueue() {
|
|
||||||
return QueueBuilder.durable(RabbitMQConstant.MOBILE_AREA_OPERATOR).build();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,43 +0,0 @@
|
|||||||
package com.mashibing.strategy.config;
|
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.amqp.core.Message;
|
|
||||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
|
||||||
import org.springframework.amqp.rabbit.connection.CorrelationData;
|
|
||||||
import org.springframework.amqp.rabbit.core.RabbitTemplate;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: RabbitMQTemplateConfig
|
|
||||||
* @Description: 配置RabbitMQTemplate的confirm和return机制
|
|
||||||
* @date 2025/6/8 17:52
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
@Slf4j
|
|
||||||
public class RabbitMQTemplateConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
|
|
||||||
|
|
||||||
//设置connectionFactory
|
|
||||||
RabbitTemplate rabbitTemplate = new RabbitTemplate(connectionFactory);
|
|
||||||
|
|
||||||
//配置confirm机制回调
|
|
||||||
rabbitTemplate.setConfirmCallback((correlationData, ack, cause) -> {
|
|
||||||
//消息妹有发送到交换机
|
|
||||||
if (!ack) {
|
|
||||||
log.error("【策略模块-发送消息】消息没有发送到交换机。。。" +
|
|
||||||
"\n correlationData={},ack={},cause:{} ", correlationData, ack, cause);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
//配置return机制回调
|
|
||||||
rabbitTemplate.setReturnCallback((message, replyCode, replyText, exchange, routingKey) -> log.error("【策略模块-发送消息】消息没有路由到指定的队列。。。" +
|
|
||||||
"\nmessage={},exchange={},routingKey={}", new String(message.getBody()), exchange, routingKey));
|
|
||||||
|
|
||||||
return rabbitTemplate;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
package com.mashibing.strategy.config;
|
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
import org.springframework.web.client.RestTemplate;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: RestTemplateConfig
|
|
||||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
|
||||||
* @date 2025/6/8 16:33
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Configuration
|
|
||||||
public class RestTemplateConfig {
|
|
||||||
|
|
||||||
@Bean
|
|
||||||
public RestTemplate restTemplate() {
|
|
||||||
return new RestTemplate();
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
package com.mashibing.strategy.feignclient;
|
|
||||||
|
|
||||||
import com.mashibing.common.clients.BeaconCacheClient;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: BeaconCacheClient
|
|
||||||
* @Description: 缓存模块openFeignClient接口
|
|
||||||
* @date 2025/6/7 20:16
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FeignClient("beacon-cache")
|
|
||||||
public interface CacheClient extends BeaconCacheClient {
|
|
||||||
|
|
||||||
}
|
|
@ -1,31 +0,0 @@
|
|||||||
package com.mashibing.strategy.pojo;
|
|
||||||
|
|
||||||
import com.mashibing.common.annotation.Description;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: PhasePOJO
|
|
||||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
|
||||||
* @date 2025/6/8 16:39
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class PhasePojo {
|
|
||||||
|
|
||||||
@Description("目标手机号的运营商id")
|
|
||||||
private Integer operatorId;
|
|
||||||
|
|
||||||
@Description("目标手机号的运营商na")
|
|
||||||
private String operatorNa;
|
|
||||||
|
|
||||||
@Description("目标手机号的归属地 哈尔滨, 绥化~")
|
|
||||||
private String area;
|
|
||||||
|
|
||||||
public PhasePojo unknown() {
|
|
||||||
this.operatorId = 0;
|
|
||||||
this.operatorNa = "未知";
|
|
||||||
this.area = "未知 未知";
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.mashibing.strategy.service.strategyfilter;
|
|
||||||
|
|
||||||
import com.mashibing.common.pojo.StandardSubmit;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: StrategyFilter
|
|
||||||
* @Description: 策略校验父接口
|
|
||||||
* @date 2025/6/7 20:24
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface StrategyFilter {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 策略校验
|
|
||||||
*/
|
|
||||||
void strategy(StandardSubmit standardSubmit);
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.mashibing.strategy.service.strategyfilter;
|
|
||||||
|
|
||||||
import com.mashibing.common.constant.CacheConstant;
|
|
||||||
import com.mashibing.common.pojo.StandardSubmit;
|
|
||||||
import com.mashibing.strategy.feignclient.CacheClient;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: StrategyFilterContext
|
|
||||||
* @Description: 策略模块校验链的执行
|
|
||||||
* @date 2025/6/7 20:32
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
public class StrategyFilterContext {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private Map<String, StrategyFilter> strategyFilters;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CacheClient cacheClient;
|
|
||||||
|
|
||||||
private final String CLIENT_FILTERS = "clientFilters";
|
|
||||||
|
|
||||||
public void strategy(StandardSubmit standardSubmit) {
|
|
||||||
String s = cacheClient.hgetString(CacheConstant.CLIENT_BUSINESS + standardSubmit.getApikey(), CLIENT_FILTERS);
|
|
||||||
if (StringUtils.isBlank(s)) {
|
|
||||||
log.info("【策略模块-策略为空】没有校验。。。");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
String[] strategyFilterArr = s.split(",");
|
|
||||||
for (String strategyFilter : strategyFilterArr) {
|
|
||||||
StrategyFilter check = strategyFilters.get(strategyFilter);
|
|
||||||
if (check != null) {
|
|
||||||
check.strategy(standardSubmit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -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("【策略模块-黑名单校验】。。。");
|
|
||||||
}
|
|
||||||
}
|
|
@ -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: DirtyWordStrategyFilter
|
|
||||||
* @Description: 敏感词校验
|
|
||||||
* @date 2025/6/7 20:26
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service(value = "dirtyword")
|
|
||||||
public class DirtyWordStrategyFilter implements StrategyFilter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void strategy(StandardSubmit standardSubmit) {
|
|
||||||
log.info("【策略模块-敏感词校验】。。。");
|
|
||||||
}
|
|
||||||
}
|
|
@ -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: RouteStrategyFilter
|
|
||||||
* @Description: 路由校验
|
|
||||||
* @date 2025/6/7 20:26
|
|
||||||
*/
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@Service(value = "route")
|
|
||||||
public class RouteStrategyFilter implements StrategyFilter {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void strategy(StandardSubmit standardSubmit) {
|
|
||||||
log.info("【策略模块-路由校验】。。。");
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
# 服务名称
|
|
||||||
spring:
|
|
||||||
application:
|
|
||||||
name: beacon-strategy
|
|
||||||
# 多环境
|
|
||||||
profiles:
|
|
||||||
active: dev
|
|
||||||
# nacos注册中心地址
|
|
||||||
cloud:
|
|
||||||
nacos:
|
|
||||||
discovery:
|
|
||||||
server-addr: 192.168.1.13:8848
|
|
||||||
# nacos配置中心地址:
|
|
||||||
config:
|
|
||||||
server-addr: 192.168.1.13:8848
|
|
||||||
file-extension: yml
|
|
||||||
# beacon-strategy-dev.yml
|
|
@ -1,165 +0,0 @@
|
|||||||
package com.mashibing.test.entity;
|
|
||||||
|
|
||||||
public class MobileArea {
|
|
||||||
|
|
||||||
private long id;
|
|
||||||
|
|
||||||
private String mobileNumber;
|
|
||||||
|
|
||||||
private String mobileArea;
|
|
||||||
|
|
||||||
private String mobileType;
|
|
||||||
|
|
||||||
private String areaCode;
|
|
||||||
|
|
||||||
private String postCode;
|
|
||||||
|
|
||||||
private String provinceCode;
|
|
||||||
|
|
||||||
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 getMobileNumber() {
|
|
||||||
return mobileNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobileNumber(String mobileNumber) {
|
|
||||||
this.mobileNumber = mobileNumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobileArea() {
|
|
||||||
return mobileArea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobileArea(String mobileArea) {
|
|
||||||
this.mobileArea = mobileArea;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMobileType() {
|
|
||||||
return mobileType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMobileType(String mobileType) {
|
|
||||||
this.mobileType = mobileType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getAreaCode() {
|
|
||||||
return areaCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAreaCode(String areaCode) {
|
|
||||||
this.areaCode = areaCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPostCode() {
|
|
||||||
return postCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPostCode(String postCode) {
|
|
||||||
this.postCode = postCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getProvinceCode() {
|
|
||||||
return provinceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setProvinceCode(String provinceCode) {
|
|
||||||
this.provinceCode = provinceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
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,34 @@
|
|||||||
|
package com.mashibing.test.feignClient;
|
||||||
|
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author heqijun
|
||||||
|
* @ClassName: BeaconCacheClient
|
||||||
|
* @Description: 缓存模块openFeignClient接口
|
||||||
|
* @date 2025/6/5 20:13
|
||||||
|
*/
|
||||||
|
|
||||||
|
@FeignClient("beacon-cache")
|
||||||
|
@RequestMapping("cache")
|
||||||
|
public interface BeaconCacheClient {
|
||||||
|
@GetMapping("get/{key}")
|
||||||
|
public String get(@PathVariable String key);
|
||||||
|
|
||||||
|
@GetMapping("set/{key}/{value}")
|
||||||
|
public void set(@PathVariable String key, @PathVariable String value);
|
||||||
|
|
||||||
|
@GetMapping("hget/{key}")
|
||||||
|
public Map hget(@PathVariable String key);
|
||||||
|
|
||||||
|
@PostMapping("hset/{key}")
|
||||||
|
public void hset(@PathVariable String key, @RequestBody Map hash);
|
||||||
|
|
||||||
|
@PostMapping("/sadd/{key}")
|
||||||
|
public void sadd(@PathVariable(value = "key") String key, @RequestBody Map<String, Object>... maps);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -1,19 +0,0 @@
|
|||||||
package com.mashibing.test.feignClient;
|
|
||||||
|
|
||||||
import com.mashibing.common.clients.BeaconCacheClient;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: BeaconCacheClient
|
|
||||||
* @Description: 缓存模块openFeignClient接口
|
|
||||||
* @date 2025/6/5 20:13
|
|
||||||
*/
|
|
||||||
|
|
||||||
@FeignClient("beacon-cache")
|
|
||||||
public interface CacheClient extends BeaconCacheClient {
|
|
||||||
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
package com.mashibing.test.mapper;
|
|
||||||
|
|
||||||
import com.mashibing.test.entity.MobileArea;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: MobileAreaMapper
|
|
||||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
|
||||||
* @date 2025/6/8 14:47
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface MobileAreaMapper {
|
|
||||||
|
|
||||||
@Select("select mobile_number,mobile_area,mobile_type from mobile_area ")
|
|
||||||
List<MobileArea> findAllMobileArea();
|
|
||||||
}
|
|
@ -1,19 +0,0 @@
|
|||||||
package com.mashibing.test.mapper;
|
|
||||||
|
|
||||||
import com.mashibing.test.entity.MobileArea;
|
|
||||||
import org.apache.ibatis.annotations.Select;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author heqijun
|
|
||||||
* @ClassName: MobileAreaMapper
|
|
||||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
|
||||||
* @date 2025/6/8 14:47
|
|
||||||
*/
|
|
||||||
|
|
||||||
public interface MobileDirtywordMapper {
|
|
||||||
|
|
||||||
@Select("select dirtyword from mobile_dirtyword")
|
|
||||||
List<String> findAllDirtyword();
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
package com.mashibing.test.mapper;
|
|
||||||
|
|
||||||
import com.mashibing.test.entity.MobileArea;
|
|
||||||
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.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@SpringBootTest
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
class MobileAreaMapperTest {
|
|
||||||
@Autowired
|
|
||||||
CacheClient cacheClient;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
MobileAreaMapper mapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void findAllMobileArea() {
|
|
||||||
long startTime = System.currentTimeMillis();
|
|
||||||
List<MobileArea> allMobileArea = mapper.findAllMobileArea();
|
|
||||||
long endTime = System.currentTimeMillis();
|
|
||||||
log.info("【数据库查询耗时】: {} ms", endTime - startTime);
|
|
||||||
Map<String, String> map = new HashMap<>(allMobileArea.size());
|
|
||||||
startTime = System.currentTimeMillis();
|
|
||||||
allMobileArea.forEach(mobileArea -> {
|
|
||||||
map.put("phase:" + mobileArea.getMobileNumber(),
|
|
||||||
mobileArea.getMobileArea() + "," + mobileArea.getMobileType());
|
|
||||||
});
|
|
||||||
endTime = System.currentTimeMillis();
|
|
||||||
log.info("【List转Map耗时】: {} ms", endTime - startTime);
|
|
||||||
startTime = System.currentTimeMillis();
|
|
||||||
cacheClient.pipelineString(map);
|
|
||||||
endTime = System.currentTimeMillis();
|
|
||||||
log.info("【写入Redis耗时】: {} ms", endTime - startTime);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,34 +0,0 @@
|
|||||||
package com.mashibing.test.mapper;
|
|
||||||
|
|
||||||
import com.mashibing.common.constant.CacheConstant;
|
|
||||||
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.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static org.junit.jupiter.api.Assertions.*;
|
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@SpringBootTest
|
|
||||||
@RunWith(SpringRunner.class)
|
|
||||||
class MobileDirtywordMapperTest {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
CacheClient cacheClient;
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
MobileDirtywordMapper mapper;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void findAllDirtyword() {
|
|
||||||
|
|
||||||
List<String> dirtywords = mapper.findAllDirtyword();
|
|
||||||
cacheClient.saddStr(CacheConstant.DIRTY_WORD, dirtywords.toArray(new String[]{}));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in new issue