基础信息提交
This commit is contained in:
32
.gitignore
vendored
32
.gitignore
vendored
@@ -1,6 +1,9 @@
|
||||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
*.iml
|
||||
*.idea
|
||||
target/
|
||||
logs/
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
@@ -14,13 +17,34 @@
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
*velocity.log*
|
||||
|
||||
# Eclipse #
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
|
||||
.DS_Store
|
||||
|
||||
_dockerCerts/
|
||||
|
||||
.factorypath
|
||||
|
||||
node_modules/
|
||||
package-lock.json
|
||||
yarn.lock
|
||||
|
||||
rebel.xml
|
||||
|
||||
!DmJdbcDriver18.jar
|
||||
!kingbase8-8.6.0.jar
|
||||
/.fastRequest/collections/Root/Default Group/directory.json
|
||||
/.fastRequest/collections/Root/directory.json
|
||||
/.fastRequest/config/fastRequestCurrentProjectConfig.json
|
||||
|
||||
113
njcn-common/pom.xml
Normal file
113
njcn-common/pom.xml
Normal file
@@ -0,0 +1,113 @@
|
||||
<?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">
|
||||
<parent>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>BasicDependVersion</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>njcn-common</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<packaging>jar</packaging>
|
||||
<name>聚合所有服务模块公共信息</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<lombok.version>1.18.18</lombok.version>
|
||||
<hutool.version>5.8.25</hutool.version>
|
||||
<commons-lang3.version>3.12.0</commons-lang3.version>
|
||||
<commons-io.version>2.8.0</commons-io.version>
|
||||
<commons-codec.version>1.15</commons-codec.version>
|
||||
<bcprov-jdk15on.version>1.68</bcprov-jdk15on.version>
|
||||
<jackson.version>2.13.4.1</jackson.version>
|
||||
<jackson.jsr310.version>2.17.0</jackson.jsr310.version>
|
||||
<slf4j.version>1.7.32</slf4j.version>
|
||||
<logback.version>1.2.12</logback.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 日志依赖 -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${slf4j.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!--java简化开发工具-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--java工具包-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- commons通用包 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>${commons-lang3.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>${commons-codec.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--国密加解密工具包-->
|
||||
<dependency>
|
||||
<groupId>org.bouncycastle</groupId>
|
||||
<artifactId>bcprov-jdk15on</artifactId>
|
||||
<version>${bcprov-jdk15on.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--jackson依赖-->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>${jackson.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.datatype</groupId>
|
||||
<artifactId>jackson-datatype-jsr310</artifactId>
|
||||
<version>${jackson.jsr310.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--springboot相关-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.njcn.common.bean;
|
||||
|
||||
import cn.hutool.cache.CacheUtil;
|
||||
import cn.hutool.cache.impl.TimedCache;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
@Component(value = "internalStorageCache")
|
||||
public class CustomCacheUtil {
|
||||
|
||||
public static final String CACHE_NAME = "internalStorageCache";
|
||||
|
||||
public TimedCache<String, String> timedCache;
|
||||
|
||||
public CustomCacheUtil() {
|
||||
//初始化一个定时缓存
|
||||
this.timedCache = initTimedCache();
|
||||
//启动定时任务,每60秒清理一次过期条目
|
||||
this.timedCache.schedulePrune(60*1000);
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认缓存30分钟
|
||||
*/
|
||||
public static TimedCache<String, String> initTimedCache() {
|
||||
return CacheUtil.newTimedCache(DateUnit.MINUTE.getMillis() * 30);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加缓存
|
||||
* 采用默认缓存时间
|
||||
*/
|
||||
public void put(String key, String value) {
|
||||
if (Objects.isNull(timedCache)) {
|
||||
//初始化一个定时缓存
|
||||
this.timedCache = initTimedCache();
|
||||
//启动定时任务,每60秒清理一次过期条目
|
||||
timedCache.schedulePrune(60*1000);
|
||||
}
|
||||
timedCache.put(key, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加缓存
|
||||
* 指定缓存时间 毫秒级别
|
||||
*/
|
||||
public void putWithExpireTime(String key, String value, long expireTime) {
|
||||
if (Objects.isNull(timedCache)) {
|
||||
//初始化一个定时缓存
|
||||
this.timedCache = initTimedCache();
|
||||
//启动定时任务,每60秒清理一次过期条目
|
||||
timedCache.schedulePrune(60*1000);
|
||||
}
|
||||
timedCache.put(key, value, expireTime);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取缓存值,
|
||||
* @param key 缓存key
|
||||
* @param flush 是否重置生命周期 true 重置,false 不重置
|
||||
*/
|
||||
public String get(String key,boolean flush) {
|
||||
if (Objects.isNull(timedCache)) {
|
||||
//初始化一个定时缓存
|
||||
this.timedCache = initTimedCache();
|
||||
//启动定时任务,每60秒清理一次过期条目
|
||||
timedCache.schedulePrune(60*1000);
|
||||
}
|
||||
return timedCache.get(key,flush);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.common.pojo.annotation;
|
||||
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年07月07日 15:51
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface OperateInfo {
|
||||
|
||||
/**
|
||||
* 默认为业务事件类型,严重度为普通
|
||||
*/
|
||||
LogEnum info() default LogEnum.BUSINESS_COMMON;
|
||||
|
||||
/**
|
||||
* 默认为查询操作类型
|
||||
*/
|
||||
String operateType() default OperateType.QUERY;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.common.pojo.constant;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年10月10日 09:30
|
||||
*/
|
||||
public interface BizParamConstant {
|
||||
|
||||
/**
|
||||
* 前端查询时间类型
|
||||
* 1年 2季度 3月份 4周 5日
|
||||
*/
|
||||
String STAT_BIZ_YEAR = "1";
|
||||
String STAT_BIZ_QUARTER = "2";
|
||||
String STAT_BIZ_MONTH = "3";
|
||||
String STAT_BIZ_WEEK = "4";
|
||||
String STAT_BIZ_DAY = "5";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.common.pojo.constant;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年07月07日 15:33
|
||||
*/
|
||||
public interface LogInfo {
|
||||
|
||||
String UNKNOWN_OPERATE = "unknown operate";
|
||||
|
||||
String UNKNOWN_USER = "unknown user";
|
||||
/*解析登陆角色jsonarray转list*/
|
||||
String UNKNOWN_ROLE = "[\"unknown role\"]";
|
||||
|
||||
String UNKNOWN_IP = "unknown IP";
|
||||
|
||||
String UNKNOWN_CLIENT = "unknown client";
|
||||
|
||||
String UNKNOWN_SERVER = "unknown sever";
|
||||
|
||||
String UNKNOWN_DEPT = "unknown department";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.common.pojo.constant;
|
||||
|
||||
/**
|
||||
* 系统操作类型
|
||||
*
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年07月08日 17:56
|
||||
*/
|
||||
public interface OperateType {
|
||||
|
||||
String QUERY = "查询";
|
||||
|
||||
String ADD = "新增";
|
||||
|
||||
String DELETE = "删除";
|
||||
|
||||
String UPDATE = "更新";
|
||||
|
||||
String AUTHENTICATE = "认证";
|
||||
|
||||
String LOGOUT = "注销";
|
||||
|
||||
String UPLOAD = "上传";
|
||||
|
||||
String DOWNLOAD = "下载";
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,256 @@
|
||||
package com.njcn.common.pojo.constant;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年05月19日 12:52
|
||||
*/
|
||||
public interface PatternRegex {
|
||||
|
||||
/**
|
||||
* URL
|
||||
*/
|
||||
String URL_REGEX = "[a-zA-z]+://[^\\s]*";
|
||||
|
||||
/**
|
||||
* 密码需要包含特殊字符字母数字,长度为8-16
|
||||
*/
|
||||
String PASSWORD_REGEX = "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[\\=\\[\\]\\{\\}\\.\\,\\。\\、\\@\\#\\_\\!\\$\\%\\^\\&\\*\\(\\)\\?\\<\\>\\/\\|\\~,\\-\\+]).{8,16}$";
|
||||
|
||||
/**
|
||||
* APP密码,长度为8-16
|
||||
*/
|
||||
String APP_PASSWORD_REGEX = "^.{8,16}$";
|
||||
|
||||
|
||||
/**
|
||||
* 手机的密码
|
||||
*/
|
||||
String PASSWORD_PHONE_REGEX = "^.{6,18}$";
|
||||
|
||||
/**
|
||||
* 用户名中英文,长度1-16
|
||||
*/
|
||||
String USERNAME_REGEX = "^[\\u4e00-\\u9fffa-zA-Z]{1,16}$";
|
||||
|
||||
/**
|
||||
* 概览配置界面名称
|
||||
*/
|
||||
String HOMEPAGE_REGEX = "^[\\u4e00-\\u9fa5]{1,10}$";
|
||||
|
||||
/**
|
||||
* 登录名只能输入3-16位的英文字母或数字
|
||||
*/
|
||||
String LOGIN_NAME_REGEX = "^[a-zA-Z_.]{1}[a-zA-Z0-9_.]{2,15}$";
|
||||
|
||||
/**
|
||||
* 手机号必须有11位,并且为数字,是正常的手机·号码开头
|
||||
*/
|
||||
String PHONE_REGEX = "(?:0|86|\\+86)?1[3-9]\\d{9}";
|
||||
|
||||
/**
|
||||
* 手机号码可以为空,如果输入手机号就要正则匹配
|
||||
*/
|
||||
String PHONE_REGEX_OR_NULL = "^\\s{0}$|(?:0|86|\\+86)?1[3-9]\\d{9}";
|
||||
|
||||
/**
|
||||
* 邮箱含有@ .在@后,以.com、.con结尾(qq,163等)
|
||||
*/
|
||||
String EMAIL_REGEX = "^([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+\\.(?:com|cn)$";
|
||||
|
||||
/**
|
||||
* 邮箱可以为空,如果输入邮箱就要进行正则匹配,邮箱含有@ .在@后,以.com、.con结尾(qq,163等)
|
||||
*/
|
||||
String EMAIL_REGEX_OR_NULL = "^\\s{0}$|([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|_|.]?)*[a-zA-Z0-9]+\\.(?:com|cn)$";
|
||||
|
||||
/**
|
||||
* IP v4
|
||||
*/
|
||||
String IP_REGEX = "\\b((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\.((?!\\d\\d\\d)\\d+|1\\d\\d|2[0-4]\\d|25[0-5])\\b";
|
||||
|
||||
/**
|
||||
* 角色名由数字、字母组成且长度为2-50
|
||||
*/
|
||||
String ROLE_REGEX = "^[a-zA-Z][a-zA-Z0-9]{2,50}$";
|
||||
|
||||
/**
|
||||
* 部门名称由汉字组成,长度为0-20
|
||||
*/
|
||||
String DEPT_NAME_REGEX = "^[\\u4e00-\\u9fa5]{1,20}$";
|
||||
|
||||
/**
|
||||
* 字典名称包括中文、数字、字母、罗马数字、括号以及点号
|
||||
*/
|
||||
String DIC_REGEX = "^[\\w\\u4E00-\\u9FA5()()_/、/, /,\\- ]+\\.?[\\w\\u4E00-\\u9FA5()()I II III IV V /]{0,125}$";
|
||||
|
||||
/**
|
||||
* 密码有效期(月)1-3月
|
||||
*/
|
||||
String PASS_MONTH_REGEX = "^[1-3]{1}$";
|
||||
|
||||
/**
|
||||
* 密码错误次数 1-10次
|
||||
*/
|
||||
String PASS_ERROR_REGEX = "^([1-9]|10)$";
|
||||
|
||||
/**
|
||||
* 最大并发数 1-99次
|
||||
*/
|
||||
String MAX_NUM_REGEX = "^([1-9]{1}|[0-9]{2})$";
|
||||
|
||||
/**
|
||||
* 闲置用户_修改密码 6-12
|
||||
*/
|
||||
String PASS_UPW_REGEX = "^([6-9]{1}|10|11|12)$";
|
||||
|
||||
/**
|
||||
* 临时账户休眠 1-12
|
||||
*/
|
||||
String FREE_MONTH_REGEX = "^([1-9]{1}|10|11|12)$";
|
||||
|
||||
/**
|
||||
* 审计存储空间 1-2G
|
||||
*/
|
||||
String LOG_SIZE_REGEX = "^[1-2]{1}$";
|
||||
|
||||
/**
|
||||
* 用户锁定时长20-60min
|
||||
*/
|
||||
String USER_LOCK_REGEX = "^[2-5][0-9]|60$";
|
||||
|
||||
/**
|
||||
* 台账名称 前置机名称 供电公司 变电站
|
||||
*/
|
||||
String DEV_NAME_REGEX = "[\\u4E00-\\u9FA5A-Za-z0-9ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ_\\s+\\#\\-]{1,32}$";
|
||||
|
||||
/**
|
||||
* 浮点数
|
||||
*/
|
||||
String FLOAT_REGEX = "[0-9]*(\\.?)[0-9]*";
|
||||
|
||||
/**
|
||||
* 识别码秘钥
|
||||
*/
|
||||
String SERIES_REGEX = "[^\\u4e00-\\u9fa5]{0,20}$";
|
||||
|
||||
/**
|
||||
* ip分段
|
||||
*/
|
||||
String SIP_REGEX = "[0-9]{1,3}$";
|
||||
|
||||
/**
|
||||
* 端口号
|
||||
*/
|
||||
String PORT_REGEX = "[0-9]{1,10}$";
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String REMARK_REGEX = "[\\u4E00-\\u9FA5A-Za-z0-9_]{0,255}$";
|
||||
|
||||
/**
|
||||
* 国网平台监测点号
|
||||
*/
|
||||
String MONITOR_ID_REGEX = "[A-Za-z0-9]{0,255}$";
|
||||
|
||||
/**
|
||||
* 变压器名称
|
||||
*/
|
||||
String TRANS_NAME_REGEX = "^[0-9a-zA-Z\\u0391-\\uFFE5]{1,50}$";
|
||||
|
||||
/**
|
||||
* 变压器策略名称
|
||||
*/
|
||||
String TF_NAME_REGEX = "^[0-9a-zA-Z\\u0391-\\uFFE5]{1,16}$";
|
||||
|
||||
/**
|
||||
* 字典类型名称
|
||||
*/
|
||||
String TYPE_REGEX = "^[0-9a-zA-Z\\u0391-\\uFFE5]{1,100}$";
|
||||
|
||||
/**
|
||||
* 描述64
|
||||
*/
|
||||
String DES64_REGEX = "^.{0,64}$";
|
||||
|
||||
/**
|
||||
* 描述200
|
||||
*/
|
||||
String DES200_REGEX = "^.{0,200}$";
|
||||
|
||||
/**
|
||||
* 描述500
|
||||
*/
|
||||
String DES500_REGEX = "^.{0,500}$";
|
||||
|
||||
/**
|
||||
* mac地址
|
||||
*/
|
||||
String MAC_REGEX = "((?:[A-F0-9]{1,2}[:-]){5}[A-F0-9]{1,2})|(?:0x)(\\d{12})(?:.+ETHER)";
|
||||
|
||||
/**
|
||||
* 流量套餐
|
||||
*/
|
||||
String DATA_PLAN_REGEX = "[0-9]{0,6}$";
|
||||
|
||||
/**
|
||||
* 十六进制颜色
|
||||
*/
|
||||
String COLOR_REGEX = "^#([a-fA-F\\d]{3}|[a-fA-F\\d]{6})$";
|
||||
|
||||
/**
|
||||
* 描述64
|
||||
*/
|
||||
String DES10_REGEX = "^.{1,10}$";
|
||||
|
||||
/**
|
||||
* 大于0的正整数
|
||||
*/
|
||||
String POSITIVE = "^[0-9].*$";
|
||||
|
||||
/**
|
||||
* 资源名称
|
||||
*/
|
||||
String FUNCTION_NAME = "^[\\u4e00-\\u9fa5A-Za-z0-9_]+$";
|
||||
|
||||
/**
|
||||
* 资源路径
|
||||
*/
|
||||
String FUNCTION_URL = "^[A-Za-z0-9\\/\\-]+$";
|
||||
|
||||
/**
|
||||
* 匹配数字、字母、中文
|
||||
*/
|
||||
String NORMAL = "^[A-Za-z0-9\\u4e00-\\u9fa5]+$";
|
||||
|
||||
|
||||
/**
|
||||
* 任意字符,长度在1-20位,常用于名称、编码等常规录入
|
||||
*/
|
||||
String ALL_CHAR_1_20 = "^[-_A-Za-z0-9\\u4e00-\\u9fa5]{1,20}$";
|
||||
|
||||
/**
|
||||
* uuid 32位正则,数字 、 字母
|
||||
*/
|
||||
String SYSTEM_ID = "^[A-Za-z0-9]{32}$";
|
||||
|
||||
/**
|
||||
* 1-32位正则,数字 、 字母
|
||||
*/
|
||||
String SYSTEMS_ID = "^[A-Za-z0-9]{1,32}$";
|
||||
|
||||
/**
|
||||
* decimal(10,6) 10位数字,小数点最多6位(坐标)
|
||||
*/
|
||||
String COORDINATE="^([0-9]{1,4})([.][0-9]{1,6})?$";
|
||||
|
||||
/**
|
||||
* 时间正则(日期)
|
||||
*/
|
||||
String TIME_FORMAT = "^$|(([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29)$";
|
||||
|
||||
/**
|
||||
* 时间正则(秒)
|
||||
*/
|
||||
String TIME_SECOND_FORMAT = "^((([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8]))))|((([0-9]{2})(0[48]|[2468][048]|[13579][26])|((0[48]|[2468][048]|[3579][26])00))-02-29))\\s+([0-1]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$";
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
package com.njcn.common.pojo.constant;
|
||||
|
||||
/**
|
||||
* 认证业务用到的常量定义
|
||||
*
|
||||
* @author hongawen
|
||||
*/
|
||||
public interface SecurityConstants {
|
||||
|
||||
/**
|
||||
* 认证请求头key
|
||||
* 1. 获取token时,Authorization的内容是client:secret的base64的密文
|
||||
* 2. 已经认证后,Authorization的内容是access_token内容
|
||||
*/
|
||||
String AUTHORIZATION_KEY = "Authorization";
|
||||
|
||||
/**
|
||||
* JWT令牌前缀
|
||||
*/
|
||||
String AUTHORIZATION_PREFIX = "bearer ";
|
||||
|
||||
/**
|
||||
* Basic认证前缀
|
||||
*/
|
||||
String BASIC_PREFIX = "Basic ";
|
||||
|
||||
/**
|
||||
* JWT载体key
|
||||
*/
|
||||
String JWT_PAYLOAD_KEY = "payload";
|
||||
|
||||
/**
|
||||
* JWT ID 唯一标识
|
||||
*/
|
||||
String JWT_JTI = "jti";
|
||||
|
||||
/**
|
||||
* JWT ID 超时key
|
||||
*/
|
||||
String JWT_EXP = "exp";
|
||||
|
||||
/**
|
||||
* 认证成功后,返回信息包含的内容-
|
||||
*/
|
||||
String USER_INDEX_KEY = "userIndex";
|
||||
String USER_TYPE = "userType";
|
||||
String USER_NAME_KEY = "user_name";
|
||||
String USER_HEAD_KEY = "headSculpture";
|
||||
String USER_NICKNAME_KEY = "nickname";
|
||||
String CLIENT_ID_KEY = "client_id";
|
||||
String DEPT_INDEX_KEY = "deptIndex";
|
||||
|
||||
/**
|
||||
* 认证方式
|
||||
*/
|
||||
String AUTHENTICATION_METHOD = "authenticationMethod";
|
||||
|
||||
/**
|
||||
* JWT存储权限前缀
|
||||
*/
|
||||
String AUTHORITY_PREFIX = "ROLE_";
|
||||
|
||||
/**
|
||||
* JWT存储权限属性
|
||||
*/
|
||||
String JWT_AUTHORITIES_KEY = "authorities";
|
||||
|
||||
String GRANT_TYPE_KEY = "grant_type";
|
||||
|
||||
String REFRESH_TOKEN_KEY = "refresh_token";
|
||||
|
||||
/**
|
||||
* 黑名单token前缀
|
||||
*/
|
||||
String TOKEN_BLACKLIST_PREFIX = "auth:token:black:";
|
||||
|
||||
/**
|
||||
* 认证后token前缀
|
||||
*/
|
||||
String TOKEN_ONLINE_PREFIX = "auth:token:online:";
|
||||
|
||||
|
||||
/**
|
||||
* 真实客户端IP地址
|
||||
*/
|
||||
String REQUEST_HEADER_KEY_CLIENT_REAL_IP = "realClientIp";
|
||||
|
||||
|
||||
/**
|
||||
* 认证需要的各项参数名
|
||||
*/
|
||||
String GRANT_TYPE = "grant_type";
|
||||
String CLIENT_ID = "client_id";
|
||||
String CLIENT_SECRET = "client_secret";
|
||||
String REFRESH_TOKEN = "refresh_token";
|
||||
String USERNAME = "username";
|
||||
String PASSWORD = "password";
|
||||
String PHONE = "phone";
|
||||
String SMS_CODE = "smsCode";
|
||||
String IMAGE_CODE = "imageCode";
|
||||
String VERIFY_CODE = "verifyCode";
|
||||
|
||||
|
||||
/**
|
||||
* 认证阶段保存的用户登录名
|
||||
*/
|
||||
String AUTHENTICATE_USERNAME = "authenticateUserName";
|
||||
|
||||
/**
|
||||
* 上游服务器模块名称
|
||||
*/
|
||||
String SERVER_NAME = "serverName";
|
||||
|
||||
|
||||
/**
|
||||
* 接口文档 Knife4j 测试客户端ID
|
||||
*/
|
||||
String TEST_CLIENT_ID = "client";
|
||||
|
||||
|
||||
/**
|
||||
* 授权码模式
|
||||
*/
|
||||
String GRANT_AUTHORIZATION_CODE = "authorization_code";
|
||||
|
||||
/**
|
||||
* 验证码授权模式
|
||||
*/
|
||||
String GRANT_CAPTCHA = "captcha";
|
||||
|
||||
/**
|
||||
* 密码模式
|
||||
*/
|
||||
String GRANT_PASSWORD = "password";
|
||||
|
||||
/**
|
||||
* 刷新token模式
|
||||
*/
|
||||
String GRANT_REFRESH_TOKEN = "refresh_token";
|
||||
|
||||
/**
|
||||
* 短信模式
|
||||
*/
|
||||
String GRANT_SMS_CODE = "sms_code";
|
||||
|
||||
/**
|
||||
* 微信模式
|
||||
*/
|
||||
String GRANT_WECHAT = "wechat";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.common.pojo.constant;
|
||||
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月15日 13:39
|
||||
*/
|
||||
public interface ServerInfo {
|
||||
|
||||
String GATEWAY = "pqs-gateway";
|
||||
String OAUTH = "pqs-auth";
|
||||
String APP = "pqs-app";
|
||||
String SUPERVISE = "pqs-supervise";
|
||||
String COMMON = "pqs-common";
|
||||
String DEVICE = "device-boot";
|
||||
String EVENT = "event-boot";
|
||||
String SUPERVISION = "supervision-boot";
|
||||
String BPM = "bpm-boot";
|
||||
String HARMONIC = "harmonic-boot";
|
||||
String REPORT = "report-boot";
|
||||
String SYSTEM = "system-boot";
|
||||
String ENERGY = "energy-boot";
|
||||
String JOB_ADMIN = "job-admin";
|
||||
String USER = "user-boot";
|
||||
String JOB = "job-admin";
|
||||
String QUALITY = "quality-boot";
|
||||
String PROCESS = "process-boot";
|
||||
String PREPARE_BOOT = "prepare-boot";
|
||||
String ALGORITHM_BOOT = "algorithm-boot";
|
||||
|
||||
String CS_DEVICE_BOOT = "cs-device-boot";
|
||||
|
||||
String CS_SYSTEM_BOOT = "cs-system-boot";
|
||||
|
||||
String CS_WARN_BOOT = "cs-warn-boot";
|
||||
|
||||
String CS_EVENT_BOOT = "cs-event-boot";
|
||||
|
||||
String CS_HARMONIC_BOOT = "cs-harmonic-boot";
|
||||
|
||||
String CS_REPORT_BOOT = "cs-report-boot";
|
||||
|
||||
String ACCESS_BOOT = "access-boot";
|
||||
|
||||
String CS_STAT_BOOT = "stat-boot";
|
||||
|
||||
String CS_RT_BOOT = "rt-boot";
|
||||
|
||||
String CS_ZL_EVENT_BOOT = "zl-event-boot";
|
||||
|
||||
String ADVANCE_BOOT = "advance-boot";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
package com.njcn.common.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年07月08日 20:03
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class LogInfoDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 登录名
|
||||
*/
|
||||
private String loginName;
|
||||
|
||||
/**
|
||||
* 用户已登录:用户名
|
||||
*/
|
||||
private String userName;
|
||||
|
||||
|
||||
private String ip;
|
||||
|
||||
private String operate;
|
||||
|
||||
private String operateType;
|
||||
|
||||
/**
|
||||
* 操作结果 0.失败 1.成功
|
||||
*/
|
||||
private Integer result;
|
||||
|
||||
/**
|
||||
* 失败原因
|
||||
*/
|
||||
private String failReason;
|
||||
|
||||
/**
|
||||
* 严重度 0.普通 1.中等 2.严重
|
||||
*/
|
||||
private Integer level;
|
||||
|
||||
/**
|
||||
* 事件类型 0.业务事件 1.系统事件
|
||||
*/
|
||||
private Integer type;
|
||||
|
||||
private String serviceName;
|
||||
|
||||
/**
|
||||
* 0 未登录; 1 已登录
|
||||
*/
|
||||
private String userIndex;
|
||||
|
||||
/**
|
||||
* 0 未登录; 1 已登录
|
||||
*/
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime createTime;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.common.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年07月25日 09:40
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class SelectOption implements Serializable {
|
||||
|
||||
private String name;
|
||||
|
||||
private String value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.common.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年03月11日 11:29
|
||||
*/
|
||||
@Data
|
||||
public class UserTokenInfo implements Serializable {
|
||||
|
||||
/**
|
||||
* 通行token
|
||||
*/
|
||||
private String accessTokenJti;
|
||||
|
||||
/**
|
||||
* 刷新token
|
||||
*/
|
||||
private String refreshToken;
|
||||
|
||||
|
||||
/**
|
||||
* refreshToken的生命周期结点
|
||||
*/
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime refreshTokenExpire;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.njcn.common.pojo.enums.auth;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月15日 15:55
|
||||
*/
|
||||
@Getter
|
||||
public enum AuthenticationMethodEnum {
|
||||
|
||||
/**
|
||||
* 认证的方式
|
||||
*/
|
||||
USERNAME("username", "用户名"),
|
||||
MOBILE("mobile", "手机号"),
|
||||
OPENID("openId", "开放式认证系统唯一身份标识");
|
||||
|
||||
private final String value;
|
||||
|
||||
private final String label;
|
||||
|
||||
AuthenticationMethodEnum(String value, String label) {
|
||||
this.value = value;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public static AuthenticationMethodEnum getByValue(String value) {
|
||||
AuthenticationMethodEnum authenticationMethodEnum = null;
|
||||
for (AuthenticationMethodEnum item : values()) {
|
||||
if (item.getValue().equals(value)) {
|
||||
authenticationMethodEnum = item;
|
||||
}
|
||||
}
|
||||
return authenticationMethodEnum;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.common.pojo.enums.auth;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2022年02月10日 14:50
|
||||
*/
|
||||
@Getter
|
||||
public enum ClientEnum {
|
||||
|
||||
/**
|
||||
* 客户端,目前仅分为web端、大屏端、移动端
|
||||
*/
|
||||
WEB_CLIENT("njcn", "web"),
|
||||
WEB_CLIENT_TEST("njcntest", "web"),
|
||||
SCREEN_CLIENT("screen", "screen"),
|
||||
APP_CLIENT("app", "app"),
|
||||
WE_CHAT_APP_CLIENT("wx", "app");
|
||||
|
||||
private final String clientId;
|
||||
|
||||
private final String clientType;
|
||||
|
||||
ClientEnum(String clientId, String clientType) {
|
||||
this.clientId = clientId;
|
||||
this.clientType = clientType;
|
||||
}
|
||||
|
||||
public static String getClientType(String clientId) {
|
||||
for (ClientEnum item : values()) {
|
||||
if (item.getClientId().equals(clientId)) {
|
||||
return item.getClientType();
|
||||
}
|
||||
}
|
||||
//默认为web端
|
||||
return "web";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.common.pojo.enums.auth;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月15日 14:03
|
||||
*/
|
||||
@Getter
|
||||
public enum PasswordEncoderTypeEnum {
|
||||
|
||||
/**
|
||||
* 密码加密类型
|
||||
*/
|
||||
BCRYPT("{bcrypt}","BCRYPT加密"),
|
||||
|
||||
NOOP("{noop}","无加密明文");
|
||||
|
||||
private final String prefix;
|
||||
|
||||
private final String desc;
|
||||
|
||||
PasswordEncoderTypeEnum(String prefix, String desc){
|
||||
this.prefix=prefix;
|
||||
this.desc = desc;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.common.pojo.enums.common;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月15日 11:37
|
||||
*/
|
||||
@Getter
|
||||
public enum DataStateEnum {
|
||||
/**
|
||||
* 正常
|
||||
*/
|
||||
ENABLE(1, "正常"),
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETED(0, "删除");
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String message;
|
||||
|
||||
DataStateEnum(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.common.pojo.enums.common;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年07月07日 15:37
|
||||
*/
|
||||
@Getter
|
||||
public enum LogEnum {
|
||||
|
||||
/**
|
||||
* 日志类型分为业务事件、系统事件
|
||||
* 严重度分为 严重 中等 普通
|
||||
*/
|
||||
BUSINESS_SERIOUS("业务事件", "严重"),
|
||||
BUSINESS_MEDIUM("业务事件", "中等"),
|
||||
BUSINESS_COMMON("业务事件", "普通"),
|
||||
|
||||
SYSTEM_SERIOUS("系统事件", "严重"),
|
||||
SYSTEM_MEDIUM("系统事件", "中等"),
|
||||
SYSTEM_COMMON("系统事件", "普通");
|
||||
|
||||
|
||||
private final String operateType;
|
||||
|
||||
private final String operateLevel;
|
||||
|
||||
LogEnum(String operateType, String operateLevel) {
|
||||
this.operateType = operateType;
|
||||
this.operateLevel = operateLevel;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.common.pojo.enums.common;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年09月06日 14:00
|
||||
*/
|
||||
@Getter
|
||||
public enum ServerEnum {
|
||||
|
||||
/**
|
||||
* 微服务模块的枚举信息
|
||||
*/
|
||||
APP("pqs-app", "APP服务模块"),
|
||||
DEVICE("device-boot", "终端服务模块"),
|
||||
EVENT("event-boot", "暂降服务模块"),
|
||||
GATEWAY("pqs-gateway", "网关服务模块"),
|
||||
HARMONIC("harmonic-boot", "谐波监测服务模块"),
|
||||
OAUTH("pqs-auth", "认证服务模块"),
|
||||
REPORT("report-boot", "报表服务模块"),
|
||||
SUPERVISE("pqs-supervise", "技术监督管理服务模块"),
|
||||
SYSTEM("system-boot", "系统配置服务模块"),
|
||||
USER("user-boot", "用户服务模块"),
|
||||
ENERGY("energy-boot", "用能服务模块"),
|
||||
QUALITY("quality-boot", "电能质量服务模块"),
|
||||
EVENT_PREPARE("event-prepare","暂态模块预处理"),
|
||||
HARMONIC_PREPARE("harmonic-prepare","谐波模块预处理"),
|
||||
COMMON("pqs-common", "通用服务模块");
|
||||
|
||||
private final String name;
|
||||
|
||||
private final String serverInfo;
|
||||
|
||||
ServerEnum(String name, String serverInfo) {
|
||||
this.name = name;
|
||||
this.serverInfo = serverInfo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package com.njcn.common.pojo.enums.response;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年04月13日 10:33
|
||||
*/
|
||||
@Getter
|
||||
public enum CommonResponseEnum {
|
||||
|
||||
/**
|
||||
* A0000 ~ A0099 作用于通用业务枚举
|
||||
* 通用业务的响应枚举
|
||||
*/
|
||||
SUCCESS("A0000", "成功"),
|
||||
|
||||
NO_DATA("A0001", "数据为空"),
|
||||
|
||||
FAIL("A0002", "失败"),
|
||||
|
||||
INTERNAL_ERROR("A0003", "系统内部异常"),
|
||||
|
||||
SERVICE_FALLBACK("A0004", "服务访问降级"),
|
||||
|
||||
INVALID_PARAMETER("A0005", "请求参数非法"),
|
||||
|
||||
INVALID_MEDIA("A0006", "请求参数媒体不支持"),
|
||||
|
||||
ENUM_ERROR("A0007", "枚举解析异常"),
|
||||
|
||||
NULL_POINTER_EXCEPTION("A0008", "空指针异常"),
|
||||
|
||||
ARITHMETIC_EXCEPTION("A0009", "算数运算异常"),
|
||||
|
||||
CLASS_CAST_EXCEPTION("A0010", "类型转换异常"),
|
||||
|
||||
INDEX_OUT_OF_BOUNDS_EXCEPTION("A0011", "索引下标越界异常"),
|
||||
|
||||
HTTP_MEDIA_TYPE_NOT_SUPPORTED_EXCEPTION("A0012", "请求中参数的媒体方式不支持"),
|
||||
|
||||
METHOD_ARGUMENT_NOT_VALID_EXCEPTION("A0013", "参数校验异常"),
|
||||
|
||||
ILLEGAL_ARGUMENT_EXCEPTION("A0014", "参数校验异常"),
|
||||
|
||||
SM2_CIPHER_ERROR("A0015", "SM2获取秘钥对异常"),
|
||||
|
||||
UN_DECLARE("A0016", "后台接口异常"),
|
||||
|
||||
DIC_DATA("A0017", "获取字典数据失败"),
|
||||
|
||||
GET_MQTT_CLIENT_FAIL("A0018", "获取MQTT客户端失败"),
|
||||
|
||||
NO_MQTT_HANDLER("A0019", "MQTT中没有处理器Handler"),
|
||||
|
||||
NO_MQTT_PRODUCER("A0020", "MQTT没有生产者producer"),
|
||||
|
||||
JSON_CONVERT_EXCEPTION("A0021", "JSON转换异常"),
|
||||
|
||||
TOKEN_EXPIRE_JWT("A0024", "token已过期"),
|
||||
|
||||
PARSE_TOKEN_ERROR("A0025", "token解析异常"),
|
||||
|
||||
REFLECT_METHOD_EXCEPTION("A0026", "反射方法获取属性值异常"),
|
||||
|
||||
REQUEST_EMPTY("A0027", "当前请求web环境为空"),
|
||||
|
||||
EXPORT_FILE_ERROR("A0051","数据完整报表下载异常"),
|
||||
|
||||
PREPARE_RESPONSE_ENUM("A0089", "预处理响应枚举类型"),
|
||||
|
||||
USER_RESPONSE_ENUM("A0090", "用户响应枚举类型"),
|
||||
|
||||
GATEWAY_RESPONSE_ENUM("A0091", "网关响应枚举类型"),
|
||||
|
||||
DEVICE_RESPONSE_ENUM("A0092", "终端响应枚举类型"),
|
||||
|
||||
SYSTEM_RESPONSE_ENUM("A0093", "系统响应枚举类型"),
|
||||
|
||||
DELETE_PID_EXIST("A0094", "存在子节点"),
|
||||
|
||||
DELETE_PID_UNEXIST("A0095", "不存在子节点"),
|
||||
|
||||
FILE_EXIST("A0096", "文件已存在"),
|
||||
|
||||
FILE_SIZE_ERROR("A0096", "文件过大"),
|
||||
|
||||
FILE_XLSX_ERROR("A0096", "请上传excel文件"),
|
||||
|
||||
DEPT_EXIST("A0097", "部门id已存在"),
|
||||
|
||||
DEPT_NOT_EXIST("A0098", "部门id不存在"),
|
||||
|
||||
DEPT_BINDED("A0099", "部门id已绑定"),
|
||||
|
||||
ID_NOT_EXIST("A0100", "id不存在"),
|
||||
|
||||
TIME_ERROR("A0101","时间格式有误"),
|
||||
CLOSE_RESOURCE_ERROR("A0102","关闭资源有误"),
|
||||
MATH_ERROR("A0103","比例总和大于100%"),
|
||||
CS_DEVICE_RESPONSE_ENUM("A0104", "治理终端响应枚举类型"),
|
||||
|
||||
ADVANCE_RESPONSE_ENUM("A00105", "终端响应枚举类型"),
|
||||
|
||||
DYNAMIC_RESPONSE_ENUM("A00002", "动态枚举内容"),
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
private String message;
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
CommonResponseEnum(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.njcn.common.pojo.exception;
|
||||
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年04月20日 14:48
|
||||
*/
|
||||
@Data
|
||||
@Slf4j
|
||||
@NoArgsConstructor
|
||||
public class BusinessException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = -1;
|
||||
|
||||
public static final String GET_CODE_METHOD = "getCode";
|
||||
|
||||
public static final String GET_MESSAGE_METHOD = "getMessage";
|
||||
|
||||
/**
|
||||
* 异常码
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 异常提示信息
|
||||
*/
|
||||
private String message;
|
||||
|
||||
/**
|
||||
* 构造器内的枚举
|
||||
*/
|
||||
private Enum<?> anEnum;
|
||||
|
||||
/**
|
||||
* openfeign请求,返回的非常规结果集
|
||||
*/
|
||||
private HttpResult result;
|
||||
|
||||
public BusinessException(Enum<?> eEnum) {
|
||||
anEnum = eEnum;
|
||||
try {
|
||||
Method codeMethod = eEnum.getClass().getMethod(GET_CODE_METHOD);
|
||||
Method messageMethod = eEnum.getClass().getMethod(GET_MESSAGE_METHOD);
|
||||
this.code = (String) codeMethod.invoke(eEnum);
|
||||
this.message = (String) messageMethod.invoke(eEnum);
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 针对批量操作的业务返回
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2021/7/7
|
||||
*/
|
||||
public BusinessException(Enum<?> eEnum, String msg) {
|
||||
anEnum = eEnum;
|
||||
try {
|
||||
Method codeMethod = eEnum.getClass().getMethod(GET_CODE_METHOD);
|
||||
Method messageMethod = eEnum.getClass().getMethod(GET_MESSAGE_METHOD);
|
||||
this.code = (String) codeMethod.invoke(eEnum);
|
||||
this.message = (String) messageMethod.invoke(eEnum);
|
||||
this.message = this.message.concat(": " + msg);
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public BusinessException(HttpResult result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public BusinessException(String message) {
|
||||
super(message);
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.common.pojo.response;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年03月25日 15:38
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class HttpResult<T> implements Serializable {
|
||||
|
||||
/**状态码*/
|
||||
private String code;
|
||||
|
||||
/**回执信息*/
|
||||
private String message;
|
||||
|
||||
/**响应数据*/
|
||||
private T data;
|
||||
|
||||
public HttpResult(String code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public HttpResult(Integer code, String message) {
|
||||
this.code = String.valueOf(code);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public HttpResult(T content) {
|
||||
this.code = CommonResponseEnum.SUCCESS.getCode();
|
||||
this.data = content;
|
||||
}
|
||||
}
|
||||
77
njcn-db/mybatis-plus/pom.xml
Normal file
77
njcn-db/mybatis-plus/pom.xml
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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.njcn</groupId>
|
||||
<artifactId>njcn-db</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>mybatis-plus</artifactId>
|
||||
<version>0.0.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<mybatis.version>2.1.3</mybatis.version>
|
||||
<mybatis-plus.version>3.4.2</mybatis-plus.version>
|
||||
<jeffrey-mybatis-plus.version>1.5.1-RELEASE</jeffrey-mybatis-plus.version>
|
||||
<druid.version>1.2.5</druid.version>
|
||||
<mysql.version>8.0.19</mysql.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--公共依赖-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>njcn-common</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--mybatis基础工具-->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<exclusions>
|
||||
<!-- 排除默认的 HikariCP 数据源 -->
|
||||
<exclusion>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<version>${mybatis.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--mybatis增强工具-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--mybatis-plus 额外补充功能-->
|
||||
<dependency>
|
||||
<groupId>com.github.jeffreyning</groupId>
|
||||
<artifactId>mybatisplus-plus</artifactId>
|
||||
<version>${jeffrey-mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--druid连接池-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--mysql驱动-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.njcn.db.mybatisplus.bo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月13日 10:18
|
||||
*/
|
||||
@Data
|
||||
public class BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 创建用户
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
private String createBy;
|
||||
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
/**
|
||||
* 更新用户
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
|
||||
@JsonSerialize(using = LocalDateTimeSerializer.class)
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.db.mybatisplus.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.njcn.db.mybatisplus.handler.AutoFillValueHandler;
|
||||
import com.njcn.db.mybatisplus.handler.BatchInjector;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月14日 16:43
|
||||
*/
|
||||
@Configuration
|
||||
public class MybatisConfig {
|
||||
|
||||
/**
|
||||
* 分页插件
|
||||
*/
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 自定义公共字段自动填充
|
||||
*/
|
||||
@Bean
|
||||
public AutoFillValueHandler autoFillValueHandler() {
|
||||
return new AutoFillValueHandler();
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 自定义注册器,处理批量插入
|
||||
* @author hongawen
|
||||
* @return BatchInjector
|
||||
*/
|
||||
@Bean
|
||||
public BatchInjector BatchInjector() {
|
||||
return new BatchInjector();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.db.mybatisplus.constant;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月20日 16:08
|
||||
*/
|
||||
public interface DbConstant {
|
||||
|
||||
/**
|
||||
* 正序标识
|
||||
*/
|
||||
String ASC = "asc";
|
||||
|
||||
/**
|
||||
* 倒序标识
|
||||
*/
|
||||
String DESC = "desc";
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.njcn.db.mybatisplus.constant;
|
||||
|
||||
public interface UserConstant {
|
||||
|
||||
String USER_ID = "userId";
|
||||
|
||||
String UNKNOWN_USER_ID = "未知用户";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.db.mybatisplus.handler;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.njcn.common.bean.CustomCacheUtil;
|
||||
import com.njcn.db.mybatisplus.constant.UserConstant;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* 数据自动填充处理器
|
||||
*
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2021年12月14日 16:36
|
||||
*/
|
||||
|
||||
public class AutoFillValueHandler implements MetaObjectHandler {
|
||||
|
||||
private static final String CREATE_USER = "createBy";
|
||||
|
||||
private static final String CREATE_TIME = "createTime";
|
||||
|
||||
private static final String UPDATE_USER = "updateBy";
|
||||
|
||||
private static final String UPDATE_TIME = "updateTime";
|
||||
|
||||
|
||||
/**
|
||||
* 执行元数据需要插入的值添加
|
||||
*/
|
||||
@Override
|
||||
public void insertFill(MetaObject metaObject) {
|
||||
Supplier<String> supplierUserId = getUserIdSupplier();
|
||||
this.strictInsertFill(metaObject, CREATE_TIME, LocalDateTime::now, LocalDateTime.class);
|
||||
this.strictInsertFill(metaObject, CREATE_USER, supplierUserId, String.class);
|
||||
this.strictInsertFill(metaObject, UPDATE_TIME, LocalDateTime::now, LocalDateTime.class);
|
||||
this.strictInsertFill(metaObject, UPDATE_USER, supplierUserId, String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行元数据需要更新的数据更新
|
||||
*/
|
||||
@Override
|
||||
public void updateFill(MetaObject metaObject) {
|
||||
Supplier<String> supplierUserId = getUserIdSupplier();
|
||||
this.strictInsertFill(metaObject, UPDATE_USER, supplierUserId, String.class);
|
||||
this.strictUpdateFill(metaObject, UPDATE_TIME, LocalDateTime::now, LocalDateTime.class);
|
||||
}
|
||||
|
||||
|
||||
public Supplier<String> getUserIdSupplier(){
|
||||
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
|
||||
String userId = customCacheUtil.get(UserConstant.USER_ID, false);
|
||||
final String actualUserId = StrUtil.isBlank(userId) ? UserConstant.UNKNOWN_USER_ID : userId;
|
||||
return () -> actualUserId;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.db.mybatisplus.handler;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.core.injector.AbstractMethod;
|
||||
import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
|
||||
import com.github.jeffreyning.mybatisplus.base.MppSqlInjector;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年05月30日 14:51
|
||||
*/
|
||||
public class BatchInjector extends MppSqlInjector {
|
||||
|
||||
@Override
|
||||
public List<AbstractMethod> getMethodList(Class<?> mapperClass) {
|
||||
List<AbstractMethod> methodList = super.getMethodList(mapperClass);
|
||||
//更新时自动填充的字段,不用插入值
|
||||
methodList.add(new InsertBatchSomeColumn(i -> i.getFieldFill() != FieldFill.UPDATE));
|
||||
return methodList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.db.mybatisplus.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年05月30日 14:54
|
||||
*/
|
||||
public interface BatchBaseMapper<T> extends BaseMapper<T> {
|
||||
|
||||
/**
|
||||
* 真正的批量插入
|
||||
*/
|
||||
int insertBatchSomeColumn(List<T> entityList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.db.mybatisplus.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年06月06日 18:14
|
||||
*/
|
||||
public interface IReplenishMybatisService<T> extends IService<T> {
|
||||
|
||||
/***
|
||||
* 当批量插入数据量过大时,可以指定尺寸交给mybatis,每次插入多少条记录
|
||||
* @author hongawen
|
||||
* @date 2023/6/6 9:33
|
||||
* @param data 数据集合
|
||||
* @param size 分片的尺寸
|
||||
*/
|
||||
void insertBatchBySlice(List<T> data, int size);
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.db.mybatisplus.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.db.mybatisplus.mapper.BatchBaseMapper;
|
||||
import com.njcn.db.mybatisplus.service.IReplenishMybatisService;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @version 1.0.0
|
||||
* @date 2023年06月06日 18:16
|
||||
*/
|
||||
public class ReplenishMybatisServiceImpl<M extends BatchBaseMapper<T>, T> extends ServiceImpl<BatchBaseMapper<T>, T> implements IReplenishMybatisService<T> {
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void insertBatchBySlice(List<T> data, int size) {
|
||||
try {
|
||||
int totalCount = data.size();
|
||||
int idxLimit = Math.min(size, totalCount);
|
||||
List<T> dataTemp = new ArrayList<>(data);
|
||||
//保存单批提交的数据集合
|
||||
if (idxLimit == size) {
|
||||
int times = totalCount / idxLimit + 1;
|
||||
for (int i = 1; i <= times; i++) {
|
||||
if (totalCount >= idxLimit) {
|
||||
List<T> temp = dataTemp.subList(0, idxLimit);
|
||||
this.baseMapper.insertBatchSomeColumn(temp);
|
||||
temp.clear();
|
||||
totalCount = totalCount - idxLimit;
|
||||
} else {
|
||||
if (CollectionUtil.isNotEmpty(dataTemp)) {
|
||||
this.baseMapper.insertBatchSomeColumn(dataTemp);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.baseMapper.insertBatchSomeColumn(dataTemp);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("分片批量插入数据异常,异常为:" + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
||||
com.njcn.db.mybatisplus.config.MybatisConfig
|
||||
|
||||
|
||||
25
njcn-db/pom.xml
Normal file
25
njcn-db/pom.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?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.njcn</groupId>
|
||||
<artifactId>BasicDependVersion</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<artifactId>njcn-db</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<description>数据库模块 管理多中ORM框架</description>
|
||||
<modules>
|
||||
<module>mybatis-plus</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
26
njcn-springboot/pom.xml
Normal file
26
njcn-springboot/pom.xml
Normal file
@@ -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.njcn</groupId>
|
||||
<artifactId>BasicDependVersion</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>njcn-springboot</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>整理springboot各大版本</name>
|
||||
<modules>
|
||||
<module>spingboot2.3.12</module>
|
||||
<module>spingboot2.7.11</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
80
njcn-springboot/spingboot2.3.12/pom.xml
Normal file
80
njcn-springboot/spingboot2.3.12/pom.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<?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.njcn</groupId>
|
||||
<artifactId>njcn-springboot</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<artifactId>spingboot2.3.12</artifactId>
|
||||
<version>2.3.12</version>
|
||||
<name>整理以2.3.12为基础版本的所有相关依赖</name>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<knife4j.version>3.0.2</knife4j.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--公共依赖-->
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>njcn-common</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<!--spring webmvc starter-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!-- Actuator监控当前应用的健康,虚拟机等信息,通过前端以可视化的界面展示出来 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!--避免idea后端配置类报红-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!--测试依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
<!--API接口文档-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-ui</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
72
njcn-springboot/spingboot2.7.11/pom.xml
Normal file
72
njcn-springboot/spingboot2.7.11/pom.xml
Normal file
@@ -0,0 +1,72 @@
|
||||
<?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.njcn</groupId>
|
||||
<artifactId>njcn-springboot</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
<artifactId>spingboot2.7.11</artifactId>
|
||||
<version>2.7.11</version>
|
||||
<name>整理以2.7.11为基础版本的所有相关依赖</name>
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-boot.version>2.7.11</spring-boot.version>
|
||||
<knife4j.version>3.0.2</knife4j.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-json</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!--spring webmvc starter-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!-- Actuator监控当前应用的健康,虚拟机等信息,通过前端以可视化的界面展示出来 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!--避免idea后端配置类报红-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
<!--测试依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--API接口文档-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-ui</artifactId>
|
||||
<version>${knife4j.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
66
pom.xml
Normal file
66
pom.xml
Normal file
@@ -0,0 +1,66 @@
|
||||
<?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>
|
||||
<!--灿能微服务生态系统-->
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>BasicDependVersion</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<modules>
|
||||
<module>njcn-common</module>
|
||||
<module>njcn-springboot</module>
|
||||
<module>njcn-db</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
<name>版本控制项目</name>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>nexus-releases</id>
|
||||
<name>Nexus Release Repository</name>
|
||||
<url>http://192.168.1.22:8001/nexus/content/repositories/releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<id>nexus-snapshots</id>
|
||||
<name>Nexus Snapshot Repository</name>
|
||||
<url>http://192.168.1.22:8001/nexus/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
<properties>
|
||||
<spring-boot.version>2.3.12.RELEASE</spring-boot.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.2.2.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork>
|
||||
<addResources>true</addResources>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
</project>
|
||||
Reference in New Issue
Block a user