commit
60ee08880c
@ -0,0 +1,8 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<excludeFromCompile>
|
||||
<directory url="file://$PROJECT_DIR$/src/main/resources/archetype-resources" includeSubdirectories="true" />
|
||||
</excludeFromCompile>
|
||||
<annotationProcessing>
|
||||
<profile default="true" name="Default" enabled="true" />
|
||||
<profile name="Maven default annotation processors profile" enabled="true">
|
||||
<sourceOutputDir name="target/generated-sources/annotations" />
|
||||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<module name="beacon-api" />
|
||||
<module name="beacon-common" />
|
||||
</profile>
|
||||
</annotationProcessing>
|
||||
</component>
|
||||
<component name="JavacSettings">
|
||||
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
|
||||
<module name="beacon-api" options="-parameters" />
|
||||
<module name="beacon-common" options="-parameters" />
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/beacon-api/beacon-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/beacon-api/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/beacon-api/src/main/resources" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/beacon-common/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,5 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RemoteRepositoriesConfiguration">
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Central Repository" />
|
||||
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public/" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="central" />
|
||||
<option name="name" value="Maven Central repository" />
|
||||
<option name="url" value="https://repo1.maven.org/maven2" />
|
||||
</remote-repository>
|
||||
<remote-repository>
|
||||
<option name="id" value="jboss.community" />
|
||||
<option name="name" value="JBoss Community repository" />
|
||||
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
|
||||
</remote-repository>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,65 @@
|
||||
<?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>
|
||||
</parent>
|
||||
|
||||
<artifactId>beacon-api</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>
|
||||
<!-- openFeign-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
<!-- RabbitMQ-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-amqp</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
<!-- 测试的依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 参数校验-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 公共的组件会放到common中-->
|
||||
<dependency>
|
||||
<groupId>com.mashibing</groupId>
|
||||
<artifactId>beacon-common</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,18 @@
|
||||
package com.mashibing;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 22:27
|
||||
*/
|
||||
@SpringBootApplication
|
||||
@EnableDiscoveryClient
|
||||
public class ApiStarterApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(ApiStarterApp.class,args);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.mashibing.api.controller;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilterContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:38
|
||||
*/
|
||||
@Controller
|
||||
public class ApiTestController {
|
||||
@Autowired
|
||||
private CheckFilterContext checkFilterContext;
|
||||
|
||||
@GetMapping("/api/test")
|
||||
public void test(){
|
||||
System.out.println("====================================");
|
||||
checkFilterContext.check(new Object());
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.mashibing.api.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 0:24
|
||||
* * 一些响应信息中code和msg的对应
|
||||
*/
|
||||
@Getter
|
||||
public enum SmsCodeEnum {
|
||||
PARAMETER_ERROR(-10, "参数不合法!");
|
||||
|
||||
private Integer code;
|
||||
private String msg;
|
||||
|
||||
SmsCodeEnum(Integer code, String msg) {
|
||||
this.code = code;
|
||||
this.msg = msg;
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package com.mashibing.api.filter;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:18
|
||||
*/
|
||||
public interface CheckFilter {
|
||||
|
||||
void check(Object obj);
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.mashibing.api.filter.impl;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:19/**
|
||||
* * @author zjw
|
||||
* * @description 校验客户的apikey是否合法
|
||||
* */
|
||||
|
||||
@Service(value = "apikey")
|
||||
@Slf4j
|
||||
public class ApiKeyCheckFilter implements CheckFilter {
|
||||
|
||||
@Override
|
||||
public void check(Object obj) {
|
||||
log.info("【接口模块-校验apikey】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.mashibing.api.filter.impl;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:24
|
||||
* 校验客户剩余的金额是否充足
|
||||
*/
|
||||
@Service(value = "fee")
|
||||
@Slf4j
|
||||
public class FeeCheckFilter implements CheckFilter {
|
||||
|
||||
|
||||
@Override
|
||||
public void check(Object obj) {
|
||||
log.info("【接口模块-校验客户余额】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.mashibing.api.filter.impl;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:21
|
||||
* 校验请求的ip地址是否是白名单
|
||||
*/
|
||||
@Service(value = "ip")
|
||||
@Slf4j
|
||||
public class IPCheckFilter implements CheckFilter {
|
||||
@Override
|
||||
public void check(Object obj) {
|
||||
log.info("【接口模块-校验ip】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.mashibing.api.filter.impl;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:23
|
||||
* 校验手机号的格式合法性
|
||||
*/
|
||||
@Service(value = "mobile")
|
||||
@Slf4j
|
||||
public class MobileCheckFilter implements CheckFilter {
|
||||
|
||||
|
||||
@Override
|
||||
public void check(Object obj) {
|
||||
log.info("【接口模块-校验手机号】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.mashibing.api.filter.impl;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:22
|
||||
* 校验短信的签名
|
||||
*/
|
||||
@Service(value = "sign")
|
||||
@Slf4j
|
||||
public class SignCheckFilter implements CheckFilter {
|
||||
|
||||
|
||||
@Override
|
||||
public void check(Object obj) {
|
||||
log.info("【接口模块-校验签名】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.mashibing.api.filter.impl;
|
||||
|
||||
import com.mashibing.api.filter.CheckFilter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:22
|
||||
* 校验短信的模板
|
||||
*/
|
||||
@Service(value = "template")
|
||||
@Slf4j
|
||||
public class TemplateCheckFilter implements CheckFilter {
|
||||
|
||||
|
||||
@Override
|
||||
public void check(Object obj) {
|
||||
log.info("【接口模块-校验模板】 校验ing…………");
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.mashibing.api.form;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 0:07
|
||||
*/
|
||||
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
|
||||
/**
|
||||
* @author zjw
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class SingleSendForm {
|
||||
|
||||
/**
|
||||
* 客户的apikey
|
||||
*/
|
||||
@NotBlank(message = "apikey不允许为空")
|
||||
private String apikey;
|
||||
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
@NotBlank(message = "手机号不允许为空")
|
||||
private String mobile;
|
||||
|
||||
/**
|
||||
* 短信内容
|
||||
*/
|
||||
@NotBlank(message = "短信内容不允许为空")
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* 客户业务内的uid
|
||||
*/
|
||||
private String uid;
|
||||
|
||||
/**
|
||||
* 0-验证码短信 1-通知类短信 2-营销类短信
|
||||
*/
|
||||
@Range(min = 0, max = 2, message = "只能是0-2的整数")
|
||||
@NotNull(message = "短信类型不允许为空")
|
||||
private Integer state;
|
||||
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.mashibing.api.util;
|
||||
|
||||
import com.mashibing.api.vo.ResultVO;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 0:10
|
||||
*/
|
||||
public class R {
|
||||
|
||||
public static ResultVO ok(){
|
||||
ResultVO r = new ResultVO();
|
||||
r.setCode(0);
|
||||
r.setMsg("接收成功");
|
||||
return r;
|
||||
}
|
||||
|
||||
public static ResultVO error(Integer code, String msg){
|
||||
ResultVO r = new ResultVO();
|
||||
r.setCode(code);
|
||||
r.setMsg(msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.mashibing.api.vo;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-19 0:09
|
||||
*/
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author zjw
|
||||
* @description
|
||||
*/
|
||||
@Data
|
||||
public class ResultVO {
|
||||
|
||||
private Integer code;
|
||||
|
||||
private String msg;
|
||||
|
||||
private Integer count;
|
||||
|
||||
private Long fee;
|
||||
|
||||
private String uid;
|
||||
|
||||
private String sid;
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
## 端口号
|
||||
#server:
|
||||
# port: 8080
|
||||
|
||||
# 服务名称
|
||||
spring:
|
||||
application:
|
||||
name: beacon-api
|
||||
# 多环境
|
||||
profiles:
|
||||
active: dev
|
||||
# nacos注册中心地址
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.43.132:8848
|
||||
# nacos配置中心地址:
|
||||
config:
|
||||
server-addr: 192.168.43.132:8848
|
||||
file-extension: yml
|
||||
# beacon-api-dev.yml
|
||||
|
||||
# # rabbitMQ连接信息
|
||||
# rabbitmq:
|
||||
# host: 192.168.43.132
|
||||
# port: 5672
|
||||
# username: root
|
||||
# password: 19970213Dch.
|
||||
# virtual-host: /
|
@ -0,0 +1,27 @@
|
||||
package com.mashibing.api.filter;
|
||||
|
||||
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 static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* @author dch
|
||||
* @create 2024-03-18 23:33
|
||||
*/
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
public class CheckFilterContextTest {
|
||||
|
||||
@Autowired
|
||||
private CheckFilterContext checkFilterContext;
|
||||
|
||||
@org.junit.Test
|
||||
public void check() {
|
||||
Object obj = new Object();
|
||||
checkFilterContext.check(obj);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
## 端口号
|
||||
#server:
|
||||
# port: 8080
|
||||
|
||||
# 服务名称
|
||||
spring:
|
||||
application:
|
||||
name: beacon-api
|
||||
# 多环境
|
||||
profiles:
|
||||
active: dev
|
||||
# nacos注册中心地址
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 192.168.43.132:8848
|
||||
# nacos配置中心地址:
|
||||
config:
|
||||
server-addr: 192.168.43.132:8848
|
||||
file-extension: yml
|
||||
# beacon-api-dev.yml
|
||||
|
||||
# # rabbitMQ连接信息
|
||||
# rabbitmq:
|
||||
# host: 192.168.43.132
|
||||
# port: 5672
|
||||
# username: root
|
||||
# password: 19970213Dch.
|
||||
# virtual-host: /
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,26 @@
|
||||
<?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>
|
||||
</parent>
|
||||
|
||||
<artifactId>beacon-common</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,45 @@
|
||||
<?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/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.3.12.RELEASE</version>
|
||||
</parent>
|
||||
|
||||
<groupId>com.mashibing</groupId>
|
||||
<artifactId>beacon-cloud</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>pom</packaging>
|
||||
<modules>
|
||||
|
||||
<module>beacon-api</module>
|
||||
<module>beacon-common</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<spring.cloud-version>Hoxton.SR12</spring.cloud-version>
|
||||
<spring.cloud.alibaba-version>2.2.6.RELEASE</spring.cloud.alibaba-version>
|
||||
</properties>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring.cloud-version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${spring.cloud.alibaba-version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
</project>
|
Loading…
Reference in new issue