1. 初始化项目
This commit is contained in:
commit
2e3510e987
|
@ -0,0 +1,35 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
/logs/
|
||||
/cs-base/src/main/resources/git.properties
|
|
@ -0,0 +1,10 @@
|
|||
# Getting Started
|
||||
|
||||
### Reference Documentation
|
||||
|
||||
For further reference, please consider the following sections:
|
||||
|
||||
* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html)
|
||||
* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/3.2.3/maven-plugin/reference/html/)
|
||||
* [Create an OCI image](https://docs.spring.io/spring-boot/docs/3.2.3/maven-plugin/reference/html/#build-image)
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.cf.cs</groupId>
|
||||
<artifactId>IntegrateService</artifactId>
|
||||
<version>0.0.1-dev</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cs-base</artifactId>
|
||||
<name>cs-base</name>
|
||||
<description>cs-base</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.houkunlin</groupId>
|
||||
<artifactId>system-dict-starter</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>jakarta.servlet</groupId>
|
||||
<artifactId>jakarta.servlet-api</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.cf.cs.base;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CsBaseApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CsBaseApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.cf.cs.base.common;
|
||||
|
||||
public interface BaseEnum {
|
||||
Integer getValue();
|
||||
|
||||
String getDescription();
|
||||
}
|
|
@ -0,0 +1,297 @@
|
|||
package com.cf.cs.base.common;
|
||||
|
||||
import com.houkunlin.system.dict.starter.DictEnum;
|
||||
import com.houkunlin.system.dict.starter.json.DictType;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* The enum Error code.
|
||||
*
|
||||
* @author xajhuang @163.com
|
||||
*/
|
||||
@DictType(value = "ErrorCode", comment = "系统错误码")
|
||||
public enum ErrorCode implements BaseEnum, DictEnum<Integer> {
|
||||
|
||||
/**
|
||||
* Err ok error code.
|
||||
*/
|
||||
ERR_OK(0, "成功"),
|
||||
/**
|
||||
* Err password error code.
|
||||
*/
|
||||
ERR_PASSWORD(1, "密码错误"),
|
||||
/**
|
||||
* Err usernotfound error code.
|
||||
*/
|
||||
ERR_USERNOTFOUND(2, "用户不存在"),
|
||||
/**
|
||||
* Err passwordmore error code.
|
||||
*/
|
||||
ERR_PASSWORDMORE(3, "连续密码错误达上限,再次输入错误将锁定用户"),
|
||||
/**
|
||||
* Err userlock error code.
|
||||
*/
|
||||
ERR_USERLOCK(4, "密码错误达上限,用户被锁定"),
|
||||
/**
|
||||
* Err password expired error code.
|
||||
*/
|
||||
ERR_PASSWORD_EXPIRED(5, "密码已经过期"),
|
||||
/**
|
||||
* Err account error code.
|
||||
*/
|
||||
ERR_ACCOUNT(6, "用户账户异常"),
|
||||
/**
|
||||
* Err userexist error code.
|
||||
*/
|
||||
ERR_USEREXIST(7, "该用户已经存在"),
|
||||
/**
|
||||
* Err passwordsimple error code.
|
||||
*/
|
||||
ERR_PASSWORDSIMPLE(8, "用户密码强度不符合要求"),
|
||||
/**
|
||||
* Err inputformat error code.
|
||||
*/
|
||||
ERR_INPUTFORMAT(9, "输入信息格式有误"),
|
||||
/**
|
||||
* Err inputmiss error code.
|
||||
*/
|
||||
ERR_INPUTMISS(10, "缺少必要输入信息"),
|
||||
/**
|
||||
* Err permission error code.
|
||||
*/
|
||||
ERR_PERMISSION(11, "操作员权限不足"),
|
||||
/**
|
||||
* Err reqtimeout error code.
|
||||
*/
|
||||
ERR_REQTIMEOUT(12, "请求超时"),
|
||||
/**
|
||||
* Err params error code.
|
||||
*/
|
||||
ERR_PARAMS(13, "参数错误"),
|
||||
/**
|
||||
* Err systemexception error code.
|
||||
*/
|
||||
ERR_SYSTEMEXCEPTION(14, "系统异常"),
|
||||
/**
|
||||
* Err unknowncmd error code.
|
||||
*/
|
||||
ERR_UNKNOWNCMD(15, "未知命令"),
|
||||
/**
|
||||
* Err logout error code.
|
||||
*/
|
||||
ERR_LOGOUT(16, "用户未登录"),
|
||||
/**
|
||||
* Err tokentimeout error code.
|
||||
*/
|
||||
ERR_TOKENTIMEOUT(17, "Token超时"),
|
||||
/**
|
||||
* Err tokennotfound error code.
|
||||
*/
|
||||
ERR_TOKENNOTFOUND(18, "非法Token"),
|
||||
/**
|
||||
* Err token key error code.
|
||||
*/
|
||||
ERR_TOKEN_KEY(19, "Token 秘钥错误"),
|
||||
/**
|
||||
* Err missauthhead error code.
|
||||
*/
|
||||
ERR_MISSAUTHHEAD(20, "Http 请求缺少认证头部"),
|
||||
/**
|
||||
* Err nosuchitem error code.
|
||||
*/
|
||||
ERR_NOSUCHITEM(21, "没有该内容"),
|
||||
/**
|
||||
* Err itemexists error code.
|
||||
*/
|
||||
ERR_ITEMEXISTS(22, "该内容已经存在"),
|
||||
/**
|
||||
* Err paramexception error code.
|
||||
*/
|
||||
ERR_PARAMEXCEPTION(23, "参数异常"),
|
||||
/**
|
||||
* Err devicelocked error code.
|
||||
*/
|
||||
ERR_DEVICELOCKED(24, "设备已锁定"),
|
||||
/**
|
||||
* Err version error code.
|
||||
*/
|
||||
ERR_VERSION(25, "协议版本不兼容,请升级系统"),
|
||||
/**
|
||||
* Err nosuchtype error code.
|
||||
*/
|
||||
ERR_NOSUCHTYPE(26, "没有这个类型的设备"),
|
||||
/**
|
||||
* Err removemore error code.
|
||||
*/
|
||||
ERR_REMOVEMORE(27, "禁止同时删除多个设备"),
|
||||
/**
|
||||
* Err taskrunning error code.
|
||||
*/
|
||||
ERR_TASKRUNNING(28, "同类任务正在运行"),
|
||||
/**
|
||||
* Err unsupport error code.
|
||||
*/
|
||||
ERR_UNSUPPORT(29, "不支持的操作"),
|
||||
/**
|
||||
* Err interrupt error code.
|
||||
*/
|
||||
ERR_INTERRUPT(30, "操作中断"),
|
||||
/**
|
||||
* Err calldevice error code.
|
||||
*/
|
||||
ERR_CALLDEVICE(31, "调用设备失败"),
|
||||
/**
|
||||
* Err nosuchtask error code.
|
||||
*/
|
||||
ERR_NOSUCHTASK(32, "没有该任务"),
|
||||
/**
|
||||
* Err tasknotrunning error code.
|
||||
*/
|
||||
ERR_TASKNOTRUNNING(33, "该任务没有运行"),
|
||||
/**
|
||||
* Err requesttimeout error code.
|
||||
*/
|
||||
ERR_REQUESTTIMEOUT(34, "请求超时"),
|
||||
/**
|
||||
* Err unabledisposeip error code.
|
||||
*/
|
||||
ERR_UNABLEDISPOSEIP(35, "无法处置该IP"),
|
||||
/**
|
||||
* Err database error code.
|
||||
*/
|
||||
ERR_DATABASE(36, "操作数据库失败"),
|
||||
/**
|
||||
* Err untrusthost error code.
|
||||
*/
|
||||
ERR_UNTRUSTHOST(37, "未经授权的客户端"),
|
||||
/**
|
||||
* Err untrusttoken error code.
|
||||
*/
|
||||
ERR_UNTRUSTTOKEN(38, "未经授权的Token"),
|
||||
/**
|
||||
* Err unknowninterface error code.
|
||||
*/
|
||||
ERR_UNKNOWNINTERFACE(39, "未提供该接口"),
|
||||
/**
|
||||
* Err decrypt base 64 error code.
|
||||
*/
|
||||
ERR_DECRYPT_BASE64(40, "BASE64解密失败"),
|
||||
/**
|
||||
* Err encrypt base 64 error code.
|
||||
*/
|
||||
ERR_ENCRYPT_BASE64(41, "BASE64加密失败"),
|
||||
/**
|
||||
* Err decrypt aes 128 error code.
|
||||
*/
|
||||
ERR_DECRYPT_AES128(42, "AES128解密失败"),
|
||||
/**
|
||||
* Err encrypt aes 128 error code.
|
||||
*/
|
||||
ERR_ENCRYPT_AES128(43, "AES128加密失败"),
|
||||
/**
|
||||
* Err decrypt 3 des error code.
|
||||
*/
|
||||
ERR_DECRYPT_3DES(44, "3DES解密失败"),
|
||||
/**
|
||||
* Err encrypt 3 des error code.
|
||||
*/
|
||||
ERR_ENCRYPT_3DES(45, "3DES加密失败"),
|
||||
/**
|
||||
* Err decrypt unknown error code.
|
||||
*/
|
||||
ERR_DECRYPT_UNKNOWN(46, "不支持的解密算法"),
|
||||
/**
|
||||
* Err encrypt unknown error code.
|
||||
*/
|
||||
ERR_ENCRYPT_UNKNOWN(47, "不支持的加密算法"),
|
||||
/**
|
||||
* Err json encode error code.
|
||||
*/
|
||||
ERR_JSON_ENCODE(48, "Json 序列号错误"),
|
||||
/**
|
||||
* Err json decode error code.
|
||||
*/
|
||||
ERR_JSON_DECODE(49, "Json 反序列化错误"),
|
||||
/**
|
||||
* Err encrypt aes 256 error code.
|
||||
*/
|
||||
ERR_ENCRYPT_AES256(50, "AES256加密失败"),
|
||||
/**
|
||||
* Err decrypt aes 256 error code.
|
||||
*/
|
||||
ERR_DECRYPT_AES256(51, "AES256解密失败"),
|
||||
/**
|
||||
* Err crypto key error code.
|
||||
*/
|
||||
ERR_CRYPTO_KEY(52, "错误的秘钥"),
|
||||
|
||||
/**
|
||||
* Err user role notexists error code.
|
||||
*/
|
||||
ERR_USER_ROLE_NOTEXISTS(53, "用户角色不存在"),
|
||||
|
||||
/**
|
||||
* Err resource used error code.
|
||||
*/
|
||||
ERR_RESOURCE_USED(54, "资源被占用"),
|
||||
;
|
||||
|
||||
private final int errCode;
|
||||
private final String errMsg;
|
||||
|
||||
ErrorCode(int err, String msg) {
|
||||
this.errCode = err;
|
||||
this.errMsg = msg;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets code.
|
||||
*
|
||||
* @return the code
|
||||
*/
|
||||
public int getCode() {
|
||||
return errCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets http code.
|
||||
*
|
||||
* @return the http code
|
||||
*/
|
||||
public int getHttpCode() {
|
||||
return switch (this) {
|
||||
case ERR_OK -> HttpServletResponse.SC_OK;
|
||||
case ERR_SYSTEMEXCEPTION, ERR_PARAMEXCEPTION -> HttpServletResponse.SC_EXPECTATION_FAILED;
|
||||
case ERR_TOKENTIMEOUT, ERR_REQTIMEOUT -> HttpServletResponse.SC_REQUEST_TIMEOUT;
|
||||
case ERR_UNTRUSTTOKEN, ERR_UNTRUSTHOST, ERR_LOGOUT -> HttpServletResponse.SC_UNAUTHORIZED;
|
||||
case ERR_MISSAUTHHEAD, ERR_PARAMS, ERR_INPUTFORMAT, ERR_INPUTMISS -> HttpServletResponse.SC_BAD_REQUEST;
|
||||
case ERR_UNSUPPORT -> HttpServletResponse.SC_METHOD_NOT_ALLOWED;
|
||||
case ERR_UNKNOWNINTERFACE -> HttpServletResponse.SC_NOT_FOUND;
|
||||
default -> HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets string value.
|
||||
*
|
||||
* @return the string value
|
||||
*/
|
||||
public String getStringValue() {
|
||||
return this.name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getValue() {
|
||||
return this.errCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
return this.errMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return this.errMsg;
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.cf.cs.base;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class CsBaseApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.cf.cs</groupId>
|
||||
<artifactId>IntegrateService</artifactId>
|
||||
<version>0.0.1-dev</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>cs-restful</artifactId>
|
||||
<name>cs-restful</name>
|
||||
<description>cs-restful-api</description>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.cf.cs.restful;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class CsRestfulApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CsRestfulApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
|
|
@ -0,0 +1,13 @@
|
|||
package com.cf.cs.restful;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class CsRestfulApplicationTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.2.3</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
|
||||
<groupId>com.cf.cs</groupId>
|
||||
<artifactId>IntegrateService</artifactId>
|
||||
<version>0.0.1-dev</version>
|
||||
<name>IntegrateService</name>
|
||||
<description>IntegrateService</description>
|
||||
<packaging>pom</packaging>
|
||||
|
||||
<properties>
|
||||
<cs-package.version>0.0.1-dev</cs-package.version>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>cs-base</module>
|
||||
<module>cs-restful</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<version>2.2.19</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
Loading…
Reference in New Issue