parent
6dcef0d351
commit
ce800117f6
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,28 @@
|
||||
package com.mashibing.common.constant;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-23 23:28
|
||||
* 通用的一些常量
|
||||
*/
|
||||
public interface SmsConstant {
|
||||
/**
|
||||
* 短信发送成功
|
||||
*/
|
||||
int REPORT_SUCCESS = 1;
|
||||
|
||||
/**
|
||||
* 短信发送失败
|
||||
*/
|
||||
|
||||
int REPORT_FAIL = 2;
|
||||
|
||||
/**
|
||||
* 验证码类型
|
||||
*/
|
||||
int CODE_TYPE = 0;
|
||||
|
||||
int NOTIFY_TYPE = 1;
|
||||
|
||||
int MARKETING_TYPE = 2;
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.mashibing.common.enums;
|
||||
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 22:17
|
||||
*/
|
||||
@Getter
|
||||
public enum MobileOperatorEnum {
|
||||
|
||||
CHINA_MOBILE(1,"移动"),
|
||||
CHINA_UNION(2,"联通"),
|
||||
CHINA_TELECOM(3,"电信"),
|
||||
UNKNOWN(4,"未知 未知,未知"),
|
||||
;
|
||||
|
||||
private Integer operatorId;
|
||||
|
||||
private String operatorName;
|
||||
|
||||
|
||||
/**
|
||||
* 通过运营商名称获取运营商id
|
||||
*/
|
||||
MobileOperatorEnum(Integer operatorId, String operatorName) {
|
||||
this.operatorId = operatorId;
|
||||
this.operatorName = operatorName;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.mashibing.common.exception;
|
||||
|
||||
import com.mashibing.common.enums.ExceptionEnums;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-20 12:15
|
||||
* 策略模块的异常对象
|
||||
*/
|
||||
@Getter
|
||||
public class StrategyException extends RuntimeException {
|
||||
|
||||
private Integer code;
|
||||
|
||||
public StrategyException(String message, Integer code) {
|
||||
super(message);
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
|
||||
public StrategyException(ExceptionEnums enums) {
|
||||
super(enums.getMsg());
|
||||
this.code = enums.getCode();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.mashibing.common.util;
|
||||
|
||||
import com.mashibing.common.enums.MobileOperatorEnum;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 22:22
|
||||
*/
|
||||
public class OperatorUtil {
|
||||
|
||||
private static Map<String,Integer> operators = new HashMap<>();
|
||||
|
||||
static {
|
||||
MobileOperatorEnum[] operatorEnums = MobileOperatorEnum.values();
|
||||
for (MobileOperatorEnum operatorEnum : operatorEnums){
|
||||
operators.put(operatorEnum.getOperatorName(),operatorEnum.getOperatorId());
|
||||
}
|
||||
}
|
||||
|
||||
public static Integer getOperatorIdByOperatorName(String operatorName){
|
||||
return operators.get(operatorName);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.mashibing.strategy.config;
|
||||
|
||||
import com.mashibing.common.constant.RabbitMQConstants;
|
||||
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 dch
|
||||
* @create 2024-03-22 23:16
|
||||
*/
|
||||
@Configuration
|
||||
public class RabbitMQConfig {
|
||||
/**
|
||||
* 策略模块发送手机号归属地&运营商到后台管理模块的队列
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Queue preSendQueue(){
|
||||
return QueueBuilder.durable(RabbitMQConstants.MOBILE_AREA_OPERATIR).build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 写日志的队列。
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public Queue writeLogQueue(){
|
||||
return QueueBuilder.durable(RabbitMQConstants.SMS_WRITE_LOG).build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Queue pushReportQueue(){
|
||||
return QueueBuilder.durable(RabbitMQConstants.SMS_PUSH_REPORT).build();
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
package com.mashibing.strategy.filter.impl;
|
||||
|
||||
import com.mashibing.common.model.StandardSubmit;
|
||||
import com.mashibing.strategy.filter.StrategyFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-21 10:20
|
||||
*/
|
||||
@Service(value = "black")
|
||||
@Slf4j
|
||||
public class BlackStrategyFilter implements StrategyFilter {
|
||||
@Override
|
||||
public void strategy(StandardSubmit submit) {
|
||||
log.info("【策略模块-黑名单校验】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mashibing.strategy.util;
|
||||
|
||||
import com.mashibing.common.model.StandardSubmit;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 通道转换留的口子,暂时什么都不做
|
||||
* @author dch
|
||||
* @create 2024-03-25 0:41
|
||||
*/
|
||||
public class ChannelTransferUtil {
|
||||
|
||||
public static Map transfer(StandardSubmit submit,Map channel){
|
||||
return channel;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.mashibing.strategy.util;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 22:29
|
||||
* 获取手机号归属地和运营商的工具
|
||||
*/
|
||||
@Component
|
||||
public class MobileOperatorUtil {
|
||||
|
||||
@Autowired
|
||||
private RestTemplate restTemplate;
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
private final String urll = "https://cx.shouji.360.cn/phonearea.php?number=";
|
||||
|
||||
private final String CODE = "code";
|
||||
private final String DATA = "data";
|
||||
private final String PROVINCE = "province";
|
||||
private final String CITY = "city";
|
||||
private final String SP = "sp";
|
||||
private final String SPACE = " ";
|
||||
private final String SEPARATE = ",";
|
||||
|
||||
|
||||
public String getMobileInfoBy360(String mobile) {
|
||||
String url = urll;
|
||||
//1.发送请求获取信息
|
||||
String mobileInfoJSON = restTemplate.getForObject(url + mobile, String.class);
|
||||
|
||||
//2.解析json
|
||||
Map map = null;
|
||||
try {
|
||||
map = objectMapper.readValue(mobileInfoJSON, Map.class);
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
Integer code = (Integer) map.get(CODE);
|
||||
if (code != 0) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> areaAndOperator = (Map<String, String>) map.get(DATA);
|
||||
String province = areaAndOperator.get(PROVINCE);
|
||||
String city = areaAndOperator.get(CITY);
|
||||
String sp = areaAndOperator.get(SP);
|
||||
|
||||
//3.封装为 省 市,运营商 的格式返回
|
||||
|
||||
return province + SPACE + city + SEPARATE + sp;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.mashibing.strategy.util;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationContextAware;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-23 10:50
|
||||
*/
|
||||
@Component
|
||||
public class SpringUtil implements ApplicationContextAware {
|
||||
|
||||
private static ApplicationContext applicationContext;
|
||||
|
||||
@Override
|
||||
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
|
||||
SpringUtil.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
public static Object getBeanByName(String beanName){
|
||||
return SpringUtil.applicationContext.getBean(beanName);
|
||||
}
|
||||
|
||||
public static Object getBeanByClass(Class clazz){
|
||||
return SpringUtil.applicationContext.getBean(clazz);
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 23:52
|
||||
*/
|
||||
public class Channel {
|
||||
private Long id;
|
||||
private String channelName;
|
||||
private Integer channelType;
|
||||
private String channelArea;
|
||||
private String channelAreaCode;
|
||||
private Long channelPrice;
|
||||
private Integer channelProtocal;
|
||||
private String channelIp;
|
||||
private Integer channelPort;
|
||||
private String channelUsername;
|
||||
private String channelPassword;
|
||||
private String channelNumber;
|
||||
private Integer isAvailable;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getChannelName() {
|
||||
return channelName;
|
||||
}
|
||||
|
||||
public void setChannelName(String channelName) {
|
||||
this.channelName = channelName;
|
||||
}
|
||||
|
||||
public Integer getChannelType() {
|
||||
return channelType;
|
||||
}
|
||||
|
||||
public void setChannelType(Integer channelType) {
|
||||
this.channelType = channelType;
|
||||
}
|
||||
|
||||
public String getChannelArea() {
|
||||
return channelArea;
|
||||
}
|
||||
|
||||
public void setChannelArea(String channelArea) {
|
||||
this.channelArea = channelArea;
|
||||
}
|
||||
|
||||
public String getChannelAreaCode() {
|
||||
return channelAreaCode;
|
||||
}
|
||||
|
||||
public void setChannelAreaCode(String channelAreaCode) {
|
||||
this.channelAreaCode = channelAreaCode;
|
||||
}
|
||||
|
||||
public Long getChannelPrice() {
|
||||
return channelPrice;
|
||||
}
|
||||
|
||||
public void setChannelPrice(Long channelPrice) {
|
||||
this.channelPrice = channelPrice;
|
||||
}
|
||||
|
||||
public Integer getChannelProtocal() {
|
||||
return channelProtocal;
|
||||
}
|
||||
|
||||
public void setChannelProtocal(Integer channelProtocal) {
|
||||
this.channelProtocal = channelProtocal;
|
||||
}
|
||||
|
||||
public String getChannelIp() {
|
||||
return channelIp;
|
||||
}
|
||||
|
||||
public void setChannelIp(String channelIp) {
|
||||
this.channelIp = channelIp;
|
||||
}
|
||||
|
||||
public Integer getChannelPort() {
|
||||
return channelPort;
|
||||
}
|
||||
|
||||
public void setChannelPort(Integer channelPort) {
|
||||
this.channelPort = channelPort;
|
||||
}
|
||||
|
||||
public String getChannelUsername() {
|
||||
return channelUsername;
|
||||
}
|
||||
|
||||
public void setChannelUsername(String channelUsername) {
|
||||
this.channelUsername = channelUsername;
|
||||
}
|
||||
|
||||
public String getChannelPassword() {
|
||||
return channelPassword;
|
||||
}
|
||||
|
||||
public void setChannelPassword(String channelPassword) {
|
||||
this.channelPassword = channelPassword;
|
||||
}
|
||||
|
||||
public String getChannelNumber() {
|
||||
return channelNumber;
|
||||
}
|
||||
|
||||
public void setChannelNumber(String channelNumber) {
|
||||
this.channelNumber = channelNumber;
|
||||
}
|
||||
|
||||
public Integer getIsAvailable() {
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
public void setIsAvailable(Integer isAvailable) {
|
||||
this.isAvailable = isAvailable;
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
|
||||
public class ClientChannel {
|
||||
private Long clientId;
|
||||
private Long channelId;
|
||||
private Integer clientChannelWeight;
|
||||
private String clientChannelNumber;
|
||||
private Integer isAvailable;
|
||||
|
||||
public Long getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(Long clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public Long getChannelId() {
|
||||
return channelId;
|
||||
}
|
||||
|
||||
public void setChannelId(Long channelId) {
|
||||
this.channelId = channelId;
|
||||
}
|
||||
|
||||
public Integer getClientChannelWeight() {
|
||||
return clientChannelWeight;
|
||||
}
|
||||
|
||||
public void setClientChannelWeight(Integer clientChannelWeight) {
|
||||
this.clientChannelWeight = clientChannelWeight;
|
||||
}
|
||||
|
||||
public String getClientChannelNumber() {
|
||||
return clientChannelNumber;
|
||||
}
|
||||
|
||||
public void setClientChannelNumber(String clientChannelNumber) {
|
||||
this.clientChannelNumber = clientChannelNumber;
|
||||
}
|
||||
|
||||
public Integer getIsAvailable() {
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
public void setIsAvailable(Integer isAvailable) {
|
||||
this.isAvailable = isAvailable;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 21:27
|
||||
*/
|
||||
public class MobileArea {
|
||||
|
||||
private String mobileNumber;
|
||||
private String mobileArea;
|
||||
private String mobileType;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 21:27
|
||||
*/
|
||||
public class MobileBlack {
|
||||
|
||||
private String blackNumber;
|
||||
|
||||
private Integer clientId;
|
||||
|
||||
public String getBlackNumber() {
|
||||
return blackNumber;
|
||||
}
|
||||
|
||||
public void setBlackNumber(String blackNumber) {
|
||||
this.blackNumber = blackNumber;
|
||||
}
|
||||
|
||||
public Integer getClientId() {
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setClientId(Integer clientId) {
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 19:27
|
||||
*/
|
||||
public class MobileTransfer {
|
||||
|
||||
private String transferNumber;
|
||||
|
||||
private Integer nowIsp;
|
||||
|
||||
public String getTransferNumber() {
|
||||
return transferNumber;
|
||||
}
|
||||
|
||||
public void setTransferNumber(String transferNumber) {
|
||||
this.transferNumber = transferNumber;
|
||||
}
|
||||
|
||||
public Integer getNowIsp() {
|
||||
return nowIsp;
|
||||
}
|
||||
|
||||
public void setNowIsp(Integer nowIsp) {
|
||||
this.nowIsp = nowIsp;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.Channel;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 23:54
|
||||
*/
|
||||
public interface ChannelMapper {
|
||||
@Select("select * from channel where is_delete = 0")
|
||||
List<Channel> findAll();
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.Channel;
|
||||
import com.mashibing.test.entity.ClientChannel;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 23:54
|
||||
*/
|
||||
public interface ClientChannelMapper {
|
||||
@Select("select * from client_channel where is_delete = 0")
|
||||
List<ClientChannel> findAll();
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.ClientTemplate;
|
||||
import com.mashibing.test.entity.MobileArea;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 21:26
|
||||
*/
|
||||
public interface MobileAreaMapper {
|
||||
@Select("select mobile_number,mobile_area,mobile_type from mobile_area")
|
||||
List<MobileArea> findAll();
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.MobileBlack;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 18:16
|
||||
*/
|
||||
public interface MobileBlackMapper {
|
||||
|
||||
@Select("select black_number,client_id from mobile_black where is_delete = 0")
|
||||
List<MobileBlack> findAll();
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-23 0:05
|
||||
*/
|
||||
public interface MobileDirtyWordMapper {
|
||||
|
||||
@Select("select dirtyword from mobile_dirtyword")
|
||||
List<String> findDirtyWord();
|
||||
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.MobileTransfer;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 19:26
|
||||
*/
|
||||
public interface MobileTransferMapper {
|
||||
|
||||
@Select("select transfer_number,now_isp from mobile_transfer where is_transfer = 1 and is_delete = 0")
|
||||
List<MobileTransfer> findAll();
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectReader;
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.Channel;
|
||||
import com.mashibing.test.entity.MobileBlack;
|
||||
import org.junit.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 javax.rmi.CORBA.ValueHandler;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 18:17
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ChannelMapperTest {
|
||||
|
||||
@Autowired
|
||||
private ChannelMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
|
||||
@Test
|
||||
public void findAll() throws JsonProcessingException {
|
||||
List<Channel> list = mapper.findAll();
|
||||
for (Channel channel : list) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map map = objectMapper.readValue(objectMapper.writeValueAsString(channel),Map.class);
|
||||
cacheClient.hmset("channel:"+channel.getId(),map);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.Channel;
|
||||
import com.mashibing.test.entity.ClientChannel;
|
||||
import org.junit.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 java.util.Map;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 18:17
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class ClientChannelMapperTest {
|
||||
|
||||
@Autowired
|
||||
private ClientChannelMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
|
||||
@Test
|
||||
public void findAll() throws JsonProcessingException {
|
||||
List<ClientChannel> list = mapper.findAll();
|
||||
for (ClientChannel clientChannel : list) {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
Map map = objectMapper.readValue(objectMapper.writeValueAsString(clientChannel),Map.class);
|
||||
cacheClient.sadd("client_channel:"+clientChannel.getClientId(),map);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.MobileArea;
|
||||
import org.junit.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;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-22 21:28
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class MobileAreaMapperTest {
|
||||
|
||||
@Autowired
|
||||
private MobileAreaMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
@Test
|
||||
public void findAll() {
|
||||
List<MobileArea> list = mapper.findAll();
|
||||
Map map = new HashMap(list.size());
|
||||
for(MobileArea mobileArea : list){
|
||||
map.put("phase:"+mobileArea.getMobileNumber(),mobileArea.getMobileArea()+","+mobileArea.getMobileType());
|
||||
}
|
||||
cacheClient.pipelineString(map);
|
||||
}
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.MobileBlack;
|
||||
import org.junit.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;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 18:17
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class MobileBlackMapperTest {
|
||||
|
||||
@Autowired
|
||||
private MobileBlackMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
|
||||
@Test
|
||||
public void findAll() {
|
||||
List<MobileBlack> mobileBlackList = mapper.findAll();
|
||||
for (MobileBlack mobileBlack : mobileBlackList) {
|
||||
if(mobileBlack.getClientId() == 0){
|
||||
// 平台级别的黑名单 black:手机号 作为key
|
||||
cacheClient.set("black:" + mobileBlack.getBlackNumber(),"1");
|
||||
}else{
|
||||
// 客户级别的黑名单 black:clientId:手机号
|
||||
cacheClient.set("black:" + mobileBlack.getClientId() + ":" +mobileBlack.getBlackNumber(),"1");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import org.junit.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.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-23 0:05
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class MobileDirtyWordMapperTest {
|
||||
|
||||
@Autowired
|
||||
private MobileDirtyWordMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
@Test
|
||||
public void findAll() {
|
||||
List<String> dirtyWords = mapper.findDirtyWord();
|
||||
|
||||
cacheClient.saddStr("dirty_word", dirtyWords.toArray(new String[]{}));
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.client.CacheClient;
|
||||
import com.mashibing.test.entity.MobileTransfer;
|
||||
import org.junit.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;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-24 19:33
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class MobileTransferMapperTest {
|
||||
|
||||
@Autowired
|
||||
private MobileTransferMapper mapper;
|
||||
|
||||
@Autowired
|
||||
private CacheClient cacheClient;
|
||||
|
||||
|
||||
@Test
|
||||
public void findAll() {
|
||||
List<MobileTransfer> list = mapper.findAll();
|
||||
|
||||
for (MobileTransfer mobileTransfer : list) {
|
||||
cacheClient.set("transfer:" + mobileTransfer.getTransferNumber(),mobileTransfer.getNowIsp());
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue