save code
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>digital-common</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>digital-base</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--集成springmvc框架 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<!--加载hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
</dependency>
|
||||
<!--加载beanutils-->
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,24 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 通过此注解声明的接口,自动实现字典翻译
|
||||
*
|
||||
* @Author scott
|
||||
* @email jeecgos@163.com
|
||||
* @Date 2022年01月05日
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AutoDict {
|
||||
|
||||
/**
|
||||
* 暂时无用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
import digital.base.constant.CommonConstant;
|
||||
import digital.base.enums.ModuleType;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 系统日志注解
|
||||
*
|
||||
* @Author scott
|
||||
* @email jeecgos@163.com
|
||||
* @Date 2019年1月14日
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AutoLog {
|
||||
|
||||
/**
|
||||
* 日志内容
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
/**
|
||||
* 日志类型
|
||||
*
|
||||
* @return 0:操作日志;1:登录日志;2:定时任务;
|
||||
*/
|
||||
int logType() default CommonConstant.LOG_TYPE_2;
|
||||
|
||||
/**
|
||||
* 操作日志类型
|
||||
*
|
||||
* @return (1查询,2添加,3修改,4删除)
|
||||
*/
|
||||
int operateType() default 0;
|
||||
|
||||
/**
|
||||
* 模块类型 默认为common
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ModuleType module() default ModuleType.COMMON;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
import digital.base.enums.LowAppAopEnum;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
* 自动注入low_app_id
|
||||
*
|
||||
* @Author scott
|
||||
* @email jeecgos@163.com
|
||||
* @Date 2022年01月05日
|
||||
*/
|
||||
@Target(ElementType.METHOD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
public @interface AutoLowApp {
|
||||
|
||||
/**
|
||||
* 切面类型(add、delete、db_import等其他操作)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
LowAppAopEnum action();
|
||||
|
||||
/**
|
||||
* 业务类型(cgform等)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String bizType();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* 字典注解
|
||||
*
|
||||
* @author: dangzhenghui
|
||||
* @date: 2019年03月17日-下午9:37:16
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Dict {
|
||||
/**
|
||||
* 方法描述: 数据code
|
||||
* 作 者: dangzhenghui
|
||||
* 日 期: 2019年03月17日-下午9:37:16
|
||||
*
|
||||
* @return 返回类型: String
|
||||
*/
|
||||
String dicCode();
|
||||
|
||||
/**
|
||||
* 方法描述: 数据Text
|
||||
* 作 者: dangzhenghui
|
||||
* 日 期: 2019年03月17日-下午9:37:16
|
||||
*
|
||||
* @return 返回类型: String
|
||||
*/
|
||||
String dicText() default "";
|
||||
|
||||
/**
|
||||
* 方法描述: 数据字典表
|
||||
* 作 者: dangzhenghui
|
||||
* 日 期: 2019年03月17日-下午9:37:16
|
||||
*
|
||||
* @return 返回类型: String
|
||||
*/
|
||||
String dictTable() default "";
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* online请求拦截专用注解
|
||||
*
|
||||
* @author: smcp
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface OnlineAuth {
|
||||
|
||||
/**
|
||||
* 请求关键字,在xxx/code之前的字符串
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value();
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 数据权限注解
|
||||
*
|
||||
* @Author taoyan
|
||||
* @Date 2019年4月11日
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.TYPE, ElementType.METHOD})
|
||||
@Documented
|
||||
public @interface PermissionData {
|
||||
/**
|
||||
* 暂时没用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
|
||||
/**
|
||||
* 配置菜单的组件路径,用于数据权限
|
||||
*/
|
||||
String pageComponent() default "";
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package digital.base.annotation;
|
||||
|
||||
|
||||
import org.springframework.core.annotation.AliasFor;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @Author:zyf
|
||||
* @Date:2019-07-31 10:43
|
||||
* @Description: 消息队列初始化注解
|
||||
**/
|
||||
@Documented
|
||||
@Inherited
|
||||
@Target({ElementType.TYPE})
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Component
|
||||
public @interface RabbitComponent {
|
||||
@AliasFor(
|
||||
annotation = Component.class
|
||||
)
|
||||
String value();
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* @author: huangxutao
|
||||
* @date: 2019-06-14
|
||||
* @description: 缓存常量
|
||||
*/
|
||||
public interface CacheConstant {
|
||||
|
||||
/**
|
||||
* 字典信息缓存(含禁用的字典项)
|
||||
*/
|
||||
public static final String SYS_DICT_CACHE = "sys:cache:dict";
|
||||
|
||||
/**
|
||||
* 字典信息缓存 status为有效的
|
||||
*/
|
||||
public static final String SYS_ENABLE_DICT_CACHE = "sys:cache:dictEnable";
|
||||
/**
|
||||
* 表字典信息缓存
|
||||
*/
|
||||
public static final String SYS_DICT_TABLE_CACHE = "sys:cache:dictTable";
|
||||
public static final String SYS_DICT_TABLE_BY_KEYS_CACHE = SYS_DICT_TABLE_CACHE + "ByKeys";
|
||||
|
||||
/**
|
||||
* 数据权限配置缓存
|
||||
*/
|
||||
public static final String SYS_DATA_PERMISSIONS_CACHE = "sys:cache:permission:datarules";
|
||||
|
||||
/**
|
||||
* 缓存用户信息
|
||||
*/
|
||||
public static final String SYS_USERS_CACHE = "sys:cache:user";
|
||||
|
||||
/**
|
||||
* 全部部门信息缓存
|
||||
*/
|
||||
public static final String SYS_DEPARTS_CACHE = "sys:cache:depart:alldata";
|
||||
|
||||
|
||||
/**
|
||||
* 全部部门ids缓存
|
||||
*/
|
||||
public static final String SYS_DEPART_IDS_CACHE = "sys:cache:depart:allids";
|
||||
|
||||
|
||||
/**
|
||||
* 测试缓存key
|
||||
*/
|
||||
public static final String TEST_DEMO_CACHE = "test:demo";
|
||||
|
||||
/**
|
||||
* 字典信息缓存
|
||||
*/
|
||||
public static final String SYS_DYNAMICDB_CACHE = "sys:cache:dbconnect:dynamic:";
|
||||
|
||||
/**
|
||||
* gateway路由缓存
|
||||
*/
|
||||
public static final String GATEWAY_ROUTES = "sys:cache:cloud:gateway_routes";
|
||||
|
||||
|
||||
/**
|
||||
* gateway路由 reload key
|
||||
*/
|
||||
public static final String ROUTE_JVM_RELOAD_TOPIC = "gateway_jvm_route_reload_topic";
|
||||
|
||||
/**
|
||||
* TODO 冗余代码 待删除
|
||||
*插件商城排行榜
|
||||
*/
|
||||
public static final String PLUGIN_MALL_RANKING = "pluginMall::rankingList";
|
||||
/**
|
||||
* TODO 冗余代码 待删除
|
||||
*插件商城排行榜
|
||||
*/
|
||||
public static final String PLUGIN_MALL_PAGE_LIST = "pluginMall::queryPageList";
|
||||
|
||||
|
||||
/**
|
||||
* online列表页配置信息缓存key
|
||||
*/
|
||||
public static final String ONLINE_LIST = "sys:cache:online:list";
|
||||
|
||||
/**
|
||||
* online表单页配置信息缓存key
|
||||
*/
|
||||
public static final String ONLINE_FORM = "sys:cache:online:form";
|
||||
|
||||
/**
|
||||
* online报表
|
||||
*/
|
||||
public static final String ONLINE_RP = "sys:cache:online:rp";
|
||||
|
||||
/**
|
||||
* online图表
|
||||
*/
|
||||
public static final String ONLINE_GRAPH = "sys:cache:online:graph";
|
||||
/**
|
||||
* 拖拽页面信息缓存
|
||||
*/
|
||||
public static final String DRAG_PAGE_CACHE = "drag:cache:page";
|
||||
}
|
||||
@@ -0,0 +1,391 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* @Description: 通用常量
|
||||
* @author: smcp
|
||||
*/
|
||||
public interface CommonConstant {
|
||||
|
||||
public static final Integer CALLBACK_SUCCESS = 0;
|
||||
|
||||
public static final Integer CALLBACK_FAIL = -1;
|
||||
|
||||
public static final String TRY_ON_TYPE_ALGO_CLOTH = "cloth";
|
||||
|
||||
public static final String TRY_ON_TYPE_ALGO_HAIR = "hair";
|
||||
|
||||
public static final String TRY_ON_TYPE_SINGLE = "single";
|
||||
|
||||
public static final String TRY_ON_TYPE_BATCH = "batch";
|
||||
|
||||
public static final String ROLE_TYPE_SUPER_ADMIN = "admin";
|
||||
|
||||
public static final String COMMON_YES = "yes";
|
||||
|
||||
public static final String COMMON_NO = "no";
|
||||
|
||||
public static final String EXCLUDE_SUIT = "excludeSuit";
|
||||
|
||||
public static final String TYPE_TOP_CLOTH = "topCloth";
|
||||
|
||||
public static final String TYPE_BOTTOM_CLOTH = "bottomCloth";
|
||||
|
||||
public static final String TYPE_DRESS = "dress";
|
||||
|
||||
//发型
|
||||
public static final String TYPE_HAIR = "hair";
|
||||
|
||||
//身材
|
||||
public static final String TYPE_FIGURE = "figure";
|
||||
|
||||
//内衣
|
||||
public static final String TYPE_UNDERWEAR = "underwear";
|
||||
|
||||
//试穿 生成中图片链接
|
||||
public static final String TRY_ON_IN_PROCESS = "https://digit-person.oss-cn-beijing.aliyuncs.com/digital_cloth/1720084773937.png";
|
||||
//试穿 生成失败图片链接
|
||||
public static final String TRY_ON_FAIL = "https://digit-person.oss-cn-beijing.aliyuncs.com/digital_cloth/1720084729963.png";
|
||||
/**
|
||||
* 短信验证码redis-key的前缀
|
||||
*/
|
||||
String PHONE_REDIS_KEY_PRE = "phone_msg";
|
||||
/**
|
||||
* 衣服
|
||||
*/
|
||||
public static final String CLOTH_FILE_TYPE = "clothType";
|
||||
/**
|
||||
* 模特
|
||||
*/
|
||||
public static final String MODEL_FILE_TYPE = "modelType";
|
||||
|
||||
/**
|
||||
* 发型
|
||||
*/
|
||||
public static final String HAIR_FILE_TYPE = "hairType";
|
||||
|
||||
/**
|
||||
* 超级管理员 tenantId 值
|
||||
*/
|
||||
String ADMIN_TENANT_ID = "0";
|
||||
|
||||
/**
|
||||
* 数字人审核 成功! 1 合格 0不 合格
|
||||
*/
|
||||
public static final Integer CUSTOM_CHECK_SUCCESS = 1;
|
||||
/**
|
||||
* 视频是否合格 1 合格 0不 合格
|
||||
*/
|
||||
public static final Integer VIDEO_CHECK_FAIL = 0;
|
||||
/**
|
||||
* 竖版
|
||||
*/
|
||||
public static final String picture_align_type_VERTICAL = "VERTICAL";
|
||||
|
||||
/**
|
||||
* :横版
|
||||
*/
|
||||
public static final String picture_align_type_HORIZONTAL = "HORIZONTAL";
|
||||
|
||||
/**
|
||||
* 上传视频管理 前缀
|
||||
*/
|
||||
public static final String FILE_VIRTUAL_HUMAN = "virtual_human";
|
||||
|
||||
public static final String DIGITAL_CLOTH = "digital_cloth";
|
||||
|
||||
/**
|
||||
* 文件状态 禁用
|
||||
*/
|
||||
public static final String FILE_STATUS_DISABLE = "disable";
|
||||
/**
|
||||
* 文件状态 失败
|
||||
*/
|
||||
public static final String FILE_STATUS_FAIL = "fail";
|
||||
/**
|
||||
* 文件状态可用
|
||||
*/
|
||||
public static final String FILE_STATUS_ENABLE = "enable";
|
||||
/**
|
||||
* 来源 第三方
|
||||
*/
|
||||
public static final String FILE_TYPE_VIDEO = "video";
|
||||
|
||||
public static final String PUTON_SWAP = "cloth_swap";
|
||||
|
||||
public static final String HAIR_SWAP = "hair";
|
||||
|
||||
public static final String FILE_TYPE_AUDIO = "audio";
|
||||
|
||||
public static final String FILE_TYPE_PICTURE = "picture";
|
||||
/**
|
||||
* 来源 自研
|
||||
*/
|
||||
public static final String SOURCE_TYPE_SELF_DEVELOP = "0";
|
||||
|
||||
/**
|
||||
* 来源 第三方
|
||||
*/
|
||||
public static final String SOURCE_TYPE_THIRD = "1";
|
||||
|
||||
public static final String CUSTOMIZED_TYPE = "CUSTOMIZED";
|
||||
|
||||
public static final String FREE_TYPE = "FREE";
|
||||
|
||||
public static final Integer CUSTOMIZED_TYPE_VALUE = 1;
|
||||
|
||||
public static final Integer FREE_TYPE_VALUE = 2;
|
||||
|
||||
|
||||
/**
|
||||
* 删除标志
|
||||
*/
|
||||
public static final Integer DEL_FLAG_1 = 1;
|
||||
|
||||
/**
|
||||
* 未删除
|
||||
*/
|
||||
public static final Integer DEL_FLAG_0 = 0;
|
||||
|
||||
|
||||
/**
|
||||
* 系统日志类型: 登录
|
||||
*/
|
||||
public static final int LOG_TYPE_1 = 1;
|
||||
|
||||
/**
|
||||
* 系统日志类型: 操作
|
||||
*/
|
||||
public static final int LOG_TYPE_2 = 2;
|
||||
|
||||
/**
|
||||
* 操作日志类型: 查询
|
||||
*/
|
||||
public static final int OPERATE_TYPE_1 = 1;
|
||||
|
||||
/**
|
||||
* 操作日志类型: 添加
|
||||
*/
|
||||
public static final int OPERATE_TYPE_2 = 2;
|
||||
|
||||
/**
|
||||
* 操作日志类型: 更新
|
||||
*/
|
||||
public static final int OPERATE_TYPE_3 = 3;
|
||||
|
||||
/**
|
||||
* 操作日志类型: 删除
|
||||
*/
|
||||
public static final int OPERATE_TYPE_4 = 4;
|
||||
|
||||
/**
|
||||
* 操作日志类型: 倒入
|
||||
*/
|
||||
public static final int OPERATE_TYPE_5 = 5;
|
||||
|
||||
/**
|
||||
* 操作日志类型: 导出
|
||||
*/
|
||||
public static final int OPERATE_TYPE_6 = 6;
|
||||
|
||||
|
||||
/**
|
||||
* {@code 500 Server Error} (HTTP/1.0 - RFC 1945)
|
||||
*/
|
||||
public static final Integer SC_INTERNAL_SERVER_ERROR_500 = 500;
|
||||
/**
|
||||
* {@code 200 OK} (HTTP/1.0 - RFC 1945)
|
||||
*/
|
||||
public static final Integer SC_OK_200 = 200;
|
||||
|
||||
/**
|
||||
* 访问权限认证未通过 510
|
||||
*/
|
||||
public static final Integer SC_JEECG_NO_AUTHZ = 510;
|
||||
|
||||
/**
|
||||
* 登录用户Shiro权限缓存KEY前缀
|
||||
*/
|
||||
public static String PREFIX_USER_SHIRO_CACHE = "shiro:cache:org.jeecg.config.shiro.ShiroRealm.authorizationCache:";
|
||||
/**
|
||||
* 登录用户Token令牌缓存KEY前缀
|
||||
*/
|
||||
public static final String PREFIX_USER_TOKEN = "prefix_user_token_";
|
||||
// /** Token缓存时间:3600秒即一小时 */
|
||||
// public static final int TOKEN_EXPIRE_TIME = 3600;
|
||||
|
||||
|
||||
/**
|
||||
* 0:一级菜单
|
||||
*/
|
||||
public static final Integer MENU_TYPE_0 = 0;
|
||||
/**
|
||||
* 1:子菜单
|
||||
*/
|
||||
public static final Integer MENU_TYPE_1 = 1;
|
||||
/**
|
||||
* 2:按钮权限
|
||||
*/
|
||||
public static final Integer MENU_TYPE_2 = 2;
|
||||
|
||||
/**
|
||||
* 通告对象类型(USER:指定用户,ALL:全体用户)
|
||||
*/
|
||||
public static final String MSG_TYPE_UESR = "USER";
|
||||
public static final String MSG_TYPE_ALL = "ALL";
|
||||
|
||||
/**
|
||||
* 发布状态(0未发布,1已发布,2已撤销)
|
||||
*/
|
||||
public static final String NO_SEND = "0";
|
||||
public static final String HAS_SEND = "1";
|
||||
public static final String HAS_CANCLE = "2";
|
||||
|
||||
/**
|
||||
* 阅读状态(0未读,1已读)
|
||||
*/
|
||||
public static final String HAS_READ_FLAG = "1";
|
||||
public static final String NO_READ_FLAG = "0";
|
||||
|
||||
/**
|
||||
* 优先级(L低,M中,H高)
|
||||
*/
|
||||
public static final String PRIORITY_L = "L";
|
||||
public static final String PRIORITY_M = "M";
|
||||
public static final String PRIORITY_H = "H";
|
||||
|
||||
/**
|
||||
* 短信模板方式 0 .登录模板、1.注册模板、2.忘记密码模板
|
||||
*/
|
||||
public static final String SMS_TPL_TYPE_0 = "0";
|
||||
public static final String SMS_TPL_TYPE_1 = "1";
|
||||
public static final String SMS_TPL_TYPE_2 = "2";
|
||||
|
||||
/**
|
||||
* 状态(0无效1有效)
|
||||
*/
|
||||
public static final String STATUS_0 = "0";
|
||||
public static final String STATUS_1 = "1";
|
||||
|
||||
/**
|
||||
* 同步工作流引擎1同步0不同步
|
||||
*/
|
||||
public static final Integer ACT_SYNC_1 = 1;
|
||||
public static final Integer ACT_SYNC_0 = 0;
|
||||
|
||||
/**
|
||||
* 消息类型1:通知公告2:系统消息
|
||||
*/
|
||||
public static final String MSG_CATEGORY_1 = "1";
|
||||
public static final String MSG_CATEGORY_2 = "2";
|
||||
|
||||
/**
|
||||
* 是否配置菜单的数据权限 1是0否
|
||||
*/
|
||||
public static final Integer RULE_FLAG_0 = 0;
|
||||
public static final Integer RULE_FLAG_1 = 1;
|
||||
|
||||
/**
|
||||
* 是否用户已被冻结 1正常(解冻) 2冻结
|
||||
*/
|
||||
public static final Integer USER_UNFREEZE = 1;
|
||||
public static final Integer USER_FREEZE = 2;
|
||||
|
||||
/**
|
||||
* 字典翻译文本后缀
|
||||
*/
|
||||
public static final String DICT_TEXT_SUFFIX = "_dictText";
|
||||
|
||||
|
||||
/**
|
||||
* 文件上传类型(本地:local,Minio:minio,阿里云:alioss)
|
||||
*/
|
||||
public static final String UPLOAD_TYPE_LOCAL = "local";
|
||||
public static final String UPLOAD_TYPE_MINIO = "minio";
|
||||
public static final String UPLOAD_TYPE_OSS = "alioss";
|
||||
|
||||
/**
|
||||
* sys_quartz_job 表 job_class_name 唯一键索引
|
||||
*/
|
||||
public static final String SQL_INDEX_UNIQ_JOB_CLASS_NAME = "uniq_job_class_name";
|
||||
/**
|
||||
* sys_position 表 code 唯一键索引
|
||||
*/
|
||||
public static final String SQL_INDEX_UNIQ_CODE = "uniq_code";
|
||||
/**
|
||||
* sys_role 表 code 唯一键索引
|
||||
*/
|
||||
public static final String SQL_INDEX_UNIQ_SYS_ROLE_CODE = "uniq_sys_role_role_code";
|
||||
/**
|
||||
* sys_depart 表 code 唯一键索引
|
||||
*/
|
||||
public static final String SQL_INDEX_UNIQ_DEPART_ORG_CODE = "uniq_depart_org_code";
|
||||
/**
|
||||
* sys_category 表 code 唯一键索引
|
||||
*/
|
||||
public static final String SQL_INDEX_UNIQ_CATEGORY_CODE = "idx_sc_code";
|
||||
|
||||
|
||||
public final static String X_ACCESS_TOKEN = "X-Access-Token";
|
||||
public final static String X_SIGN = "X-Sign";
|
||||
public final static String X_TIMESTAMP = "X-TIMESTAMP";
|
||||
public final static String TOKEN_IS_INVALID_MSG = "Token失效,请重新登录!";
|
||||
|
||||
/**
|
||||
* 多租户 请求头
|
||||
*/
|
||||
public final static String TENANT_ID = "tenant-id";
|
||||
|
||||
/**
|
||||
* 微服务读取配置文件属性 服务地址
|
||||
*/
|
||||
public final static String CLOUD_SERVER_KEY = "spring.cloud.nacos.discovery.server-addr";
|
||||
|
||||
/**
|
||||
* 第三方登录 验证密码/创建用户 都需要设置一个操作码 防止被恶意调用
|
||||
*/
|
||||
public final static String THIRD_LOGIN_CODE = "third_login_code";
|
||||
|
||||
|
||||
/**
|
||||
* ONLINE 报表权限用 从request中获取地址栏后的参数
|
||||
*/
|
||||
String ONL_REP_URL_PARAM_STR = "onlRepUrlParamStr";
|
||||
|
||||
/**
|
||||
* POST请求
|
||||
*/
|
||||
String HTTP_POST = "POST";
|
||||
|
||||
/**
|
||||
* PUT请求
|
||||
*/
|
||||
String HTTP_PUT = "PUT";
|
||||
|
||||
/**
|
||||
* PATCH请求
|
||||
*/
|
||||
String HTTP_PATCH = "PATCH";
|
||||
|
||||
/**
|
||||
* 未知的
|
||||
*/
|
||||
String UNKNOWN = "unknown";
|
||||
|
||||
/**
|
||||
* 字符串http
|
||||
*/
|
||||
String STR_HTTP = "http";
|
||||
|
||||
/**
|
||||
* String 类型的空值
|
||||
*/
|
||||
String STRING_NULL = "null";
|
||||
|
||||
|
||||
/**
|
||||
* .do
|
||||
*/
|
||||
String SPOT_DO = ".do";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* 系统通告 - 发布状态
|
||||
* @Author LeeShaoQing
|
||||
*
|
||||
*/
|
||||
public interface CommonSendStatus {
|
||||
|
||||
/**
|
||||
* 未发布
|
||||
*/
|
||||
public static final String UNPUBLISHED_STATUS_0 = "0";
|
||||
|
||||
/**
|
||||
* 已发布
|
||||
*/
|
||||
public static final String PUBLISHED_STATUS_1 = "1";
|
||||
|
||||
/**
|
||||
* 撤销
|
||||
*/
|
||||
public static final String REVOKE_STATUS_2 = "2";
|
||||
|
||||
/**
|
||||
* app端推送会话标识后缀
|
||||
*/
|
||||
public static final String APP_SESSION_SUFFIX = "_app";
|
||||
|
||||
|
||||
/**流程催办——系统通知消息模板*/
|
||||
public static final String TZMB_BPM_CUIBAN = "bpm_cuiban";
|
||||
/**标准模板—系统消息通知*/
|
||||
public static final String TZMB_SYS_TS_NOTE = "sys_ts_note";
|
||||
/**流程超时提醒——系统通知消息模板*/
|
||||
public static final String TZMB_BPM_CHAOSHI_TIP = "bpm_chaoshi_tip";
|
||||
}
|
||||
+156
@@ -0,0 +1,156 @@
|
||||
package digital.base.constant;
|
||||
/**
|
||||
* 数据库上下文常量
|
||||
* @author: smcp
|
||||
*/
|
||||
public interface DataBaseConstant {
|
||||
//*********数据库类型****************************************
|
||||
|
||||
/**MYSQL数据库*/
|
||||
public static final String DB_TYPE_MYSQL = "MYSQL";
|
||||
|
||||
/** ORACLE*/
|
||||
public static final String DB_TYPE_ORACLE = "ORACLE";
|
||||
|
||||
/**达梦数据库*/
|
||||
public static final String DB_TYPE_DM = "DM";
|
||||
|
||||
/**postgreSQL达梦数据库*/
|
||||
public static final String DB_TYPE_POSTGRESQL = "POSTGRESQL";
|
||||
|
||||
/**sqlserver数据库*/
|
||||
public static final String DB_TYPE_SQLSERVER = "SQLSERVER";
|
||||
|
||||
/**mariadb 数据库*/
|
||||
public static final String DB_TYPE_MARIADB = "MARIADB";
|
||||
|
||||
/**DB2 数据库*/
|
||||
public static final String DB_TYPE_DB2 = "DB2";
|
||||
|
||||
/**HSQL 数据库*/
|
||||
public static final String DB_TYPE_HSQL = "HSQL";
|
||||
|
||||
// // 数据库类型,对应 database_type 字典
|
||||
// public static final String DB_TYPE_MYSQL_NUM = "1";
|
||||
// public static final String DB_TYPE_MYSQL7_NUM = "6";
|
||||
// public static final String DB_TYPE_ORACLE_NUM = "2";
|
||||
// public static final String DB_TYPE_SQLSERVER_NUM = "3";
|
||||
// public static final String DB_TYPE_POSTGRESQL_NUM = "4";
|
||||
// public static final String DB_TYPE_MARIADB_NUM = "5";
|
||||
|
||||
//*********系统上下文变量****************************************
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_ORG_CODE = "sysOrgCode";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_ORG_CODE_TABLE = "sys_org_code";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_MULTI_ORG_CODE = "sysMultiOrgCode";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_MULTI_ORG_CODE_TABLE = "sys_multi_org_code";
|
||||
/**
|
||||
* 数据-系统用户编码(对应登录用户账号)
|
||||
*/
|
||||
public static final String SYS_USER_CODE = "sysUserCode";
|
||||
/**
|
||||
* 数据-系统用户编码(对应登录用户账号)
|
||||
*/
|
||||
public static final String SYS_USER_CODE_TABLE = "sys_user_code";
|
||||
|
||||
/**
|
||||
* 登录用户真实姓名
|
||||
*/
|
||||
public static final String SYS_USER_NAME = "sysUserName";
|
||||
/**
|
||||
* 登录用户真实姓名
|
||||
*/
|
||||
public static final String SYS_USER_NAME_TABLE = "sys_user_name";
|
||||
/**
|
||||
* 系统日期"yyyy-MM-dd"
|
||||
*/
|
||||
public static final String SYS_DATE = "sysDate";
|
||||
/**
|
||||
* 系统日期"yyyy-MM-dd"
|
||||
*/
|
||||
public static final String SYS_DATE_TABLE = "sys_date";
|
||||
/**
|
||||
* 系统时间"yyyy-MM-dd HH:mm"
|
||||
*/
|
||||
public static final String SYS_TIME = "sysTime";
|
||||
/**
|
||||
* 系统时间"yyyy-MM-dd HH:mm"
|
||||
*/
|
||||
public static final String SYS_TIME_TABLE = "sys_time";
|
||||
/**
|
||||
* 数据-所属机构编码
|
||||
*/
|
||||
public static final String SYS_BASE_PATH = "sys_base_path";
|
||||
//*********系统上下文变量****************************************
|
||||
|
||||
|
||||
//*********系统建表标准字段****************************************
|
||||
/**
|
||||
* 创建者登录名称
|
||||
*/
|
||||
public static final String CREATE_BY_TABLE = "create_by";
|
||||
/**
|
||||
* 创建者登录名称
|
||||
*/
|
||||
public static final String CREATE_BY = "createBy";
|
||||
/**
|
||||
* 创建日期时间
|
||||
*/
|
||||
public static final String CREATE_TIME_TABLE = "create_time";
|
||||
/**
|
||||
* 创建日期时间
|
||||
*/
|
||||
public static final String CREATE_TIME = "createTime";
|
||||
/**
|
||||
* 更新用户登录名称
|
||||
*/
|
||||
public static final String UPDATE_BY_TABLE = "update_by";
|
||||
/**
|
||||
* 更新用户登录名称
|
||||
*/
|
||||
public static final String UPDATE_BY = "updateBy";
|
||||
/**
|
||||
* 更新日期时间
|
||||
*/
|
||||
public static final String UPDATE_TIME = "updateTime";
|
||||
/**
|
||||
* 更新日期时间
|
||||
*/
|
||||
public static final String UPDATE_TIME_TABLE = "update_time";
|
||||
|
||||
/**
|
||||
* 业务流程状态
|
||||
*/
|
||||
public static final String BPM_STATUS = "bpmStatus";
|
||||
/**
|
||||
* 业务流程状态
|
||||
*/
|
||||
public static final String BPM_STATUS_TABLE = "bpm_status";
|
||||
//*********系统建表标准字段****************************************
|
||||
|
||||
|
||||
/**
|
||||
* 租户ID 实体字段名
|
||||
*/
|
||||
String TENANT_ID = "tenantId";
|
||||
/**
|
||||
* 租户ID 数据库字段名
|
||||
*/
|
||||
String TENANT_ID_TABLE = "tenant_id";
|
||||
|
||||
/**
|
||||
* sql语句 where
|
||||
*/
|
||||
String SQL_WHERE = "where";
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* author: smcp
|
||||
* date:2022-08-10 15:02
|
||||
* description:
|
||||
**/
|
||||
public interface DictConstants {
|
||||
|
||||
/**
|
||||
* 前端区域表信息查询
|
||||
*/
|
||||
public static final String FRONT_DICT_SMCP_AREA = "smcp_area";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 系统语言 中文
|
||||
*/
|
||||
public static final String CLIENT_SYSTEM_LANGUAGE_CHINESE = "1";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 系统语言 繁体
|
||||
*/
|
||||
public static final String CLIENT_SYSTEM_LANGUAGE_TRADITIONAL = "2";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 系统语言 英文
|
||||
*/
|
||||
public static final String CLIENT_SYSTEM_LANGUAGE_ENGLISH = "3";
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 客户端系统设置 系统语言 key
|
||||
*/
|
||||
public static final String CLIENT_SYSTEM_LANGUAGE_KEY = "system-language";
|
||||
|
||||
/**
|
||||
* 字典 系统语言 dict_code
|
||||
*/
|
||||
public static final String DCIT_SYSTEM_LANGUAGE_KEY = "sys_language";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 自动下载 key
|
||||
*/
|
||||
public static final String CLIENT_AUTOMATIC_DOWNLOAD_KEY = "auto-download";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 播放速度 key
|
||||
*/
|
||||
public static final String CLIENT_SWITCH_SPEED_KEY = "switch-speed";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 清理缓冲 key
|
||||
*/
|
||||
public static final String CLIENT_CLEAR_CACHE = "clear-cache";
|
||||
|
||||
|
||||
/**
|
||||
* 客户端系统设置 隐私条款 key
|
||||
*/
|
||||
public static final String CLIENT_PRIVACY_POLICY = "privacy-policy";
|
||||
|
||||
/**
|
||||
* 客户端系统设置 软件版本 key
|
||||
*/
|
||||
public static final String CLIENT_SOFTWARE_VERSION = "software-version";
|
||||
|
||||
/**
|
||||
* 播放速度 编号
|
||||
*/
|
||||
public static final String SWITCH_SPEED = "switch_speed";
|
||||
|
||||
/**
|
||||
* 自动下载 编号
|
||||
*/
|
||||
public static final String AUTOMATIC_DOWNLOAD = "auto-download";
|
||||
|
||||
/**
|
||||
* 系统语言 编号
|
||||
*/
|
||||
public static final String SYS_LANGUAGE = "sys_language";
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package digital.base.constant;
|
||||
|
||||
public interface Face3dSeverHTTPConstant {
|
||||
|
||||
public static final String SWAP_UNDERWEAR = "http://192.168.11.219:8009/cloth/swapInner";
|
||||
|
||||
public static final String FIGURE_UPLOAD = "http://service.aicloud.fit:6068/bodyManager";
|
||||
|
||||
public static final String HAIR_UPLOAD = "http://service.aicloud.fit:7393/api/uploadHair/v1";
|
||||
|
||||
public static final String SWAP_HAIR_v1 = "http://service.aicloud.fit:7393/api/swapHair/v1";
|
||||
|
||||
public static final String SWAP_HAIR_v2 = "http://service.aicloud.fit:7393/api/swapHair/v2";
|
||||
|
||||
public static final String CLOTH_UPLOAD = "http://192.168.11.219:8009/cloth/upload";
|
||||
|
||||
public static final String SWAP_CLOTH = "http://192.168.11.219:8009/cloth/swap";
|
||||
|
||||
public static final String SWAP_CLOTH_MALE = "http://192.168.11.219:8009/cloth/swapMan";
|
||||
|
||||
public static final String CRAWLER_VIP = "http://192.168.11.138:9100/api/crawler_vip/v1";
|
||||
|
||||
|
||||
/**
|
||||
* DRAFT:草稿 IN_PROGRESS:制作中 IN_PROGRESS_FAIL:制作中 SUCCESS:制作成功 FAIL:制作失败
|
||||
*/
|
||||
|
||||
public static final String CREATE_STATUS_CANCEL = "CANCEL";
|
||||
|
||||
public static final String CREATE_STATUS_DRAFT = "DRAFT";
|
||||
|
||||
public static final String CREATE_STATUS_IN_PROGRESS = "IN_PROGRESS";
|
||||
|
||||
/**
|
||||
* DRAFT:草稿 IN_PROGRESS:制作中 IN_PROGRESS_FAIL:制作中 SUCCESS:制作成功 FAIL:制作失败
|
||||
*/
|
||||
public static final String CREATE_STATUS_SUCCESS = "SUCCESS";
|
||||
/**
|
||||
* DRAFT:草稿 IN_PROGRESS:制作中 IN_PROGRESS_FAIL:制作中 SUCCESS:制作成功 FAIL:制作失败
|
||||
*/
|
||||
public static final String CREATE_STATUS_FAIL = "FAIL";
|
||||
|
||||
public static final String result_success = "success";
|
||||
|
||||
public static final String result_fail = "FAIL";
|
||||
|
||||
/**
|
||||
* 共享盘 存 衣服
|
||||
*/
|
||||
public static final String UPLOADED_FOLDER_CLOTH = "/cloth/";
|
||||
|
||||
/**
|
||||
* 共享盘 存 模特
|
||||
*/
|
||||
public static final String UPLOADED_FOLDER_MODEL = "/model/";
|
||||
|
||||
/**
|
||||
* 共享盘 存 平铺图
|
||||
*/
|
||||
public static final String UPLOADED_FOLDER_TILE = "/tile/";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* 规则值生成 编码常量类
|
||||
* @author: taoyan
|
||||
* @date: 2020年04月02日
|
||||
*/
|
||||
public class FillRuleConstant {
|
||||
|
||||
/**
|
||||
* 公文发文编码
|
||||
*/
|
||||
public static final String DOC_SEND = "doc_send_code";
|
||||
|
||||
/**
|
||||
* 部门编码
|
||||
*/
|
||||
public static final String DEPART = "org_num_role";
|
||||
|
||||
/**
|
||||
* 分类字典编码
|
||||
*/
|
||||
public static final String CATEGORY = "category_code_rule";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* @Description: GlobalConstants
|
||||
* @author: scott
|
||||
* @date: 2020/01/01 16:01
|
||||
*/
|
||||
public class GlobalConstants {
|
||||
|
||||
/**
|
||||
* 业务处理器beanName传递参数
|
||||
*/
|
||||
public static final String HANDLER_NAME = "handlerName";
|
||||
/**
|
||||
* 路由刷新触发器
|
||||
*/
|
||||
public static final String LODER_ROUDER_HANDLER = "loderRouderHandler";
|
||||
|
||||
/**
|
||||
* redis消息通道名称
|
||||
*/
|
||||
public static final String REDIS_TOPIC_NAME="jeecg_redis_topic";
|
||||
}
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* author: damao
|
||||
* date:2022-08-30 22:20
|
||||
* description:
|
||||
**/
|
||||
public interface LanguageTypeConstants {
|
||||
|
||||
|
||||
/**
|
||||
* 该值不可用,系统中已存在
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_DUPLICATE_CHECK = "该值不可用,系统中已存在!";
|
||||
/**
|
||||
* 添加成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_ADD_SUCCESS = "添加成功!";
|
||||
/**
|
||||
* 操作失败
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_OPERATE_FAIL = "操作失败!";
|
||||
/**
|
||||
* 操作成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_OPERATE_SUCCESS = "操作成功!";
|
||||
|
||||
/**
|
||||
* 编辑成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_EDIT_SUCCESS = "编辑成功!";
|
||||
/**
|
||||
* 删除成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_DELETE_SUCCESS = "删除成功!";
|
||||
/**
|
||||
* 批量删除成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_BATCH_DELETE_SUCCESS = "批量删除成功!";
|
||||
|
||||
/**
|
||||
* 未找到对应数据
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_NO_DATA = "未找到对应数据!";
|
||||
/**
|
||||
* 登录成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_LOGIN_SUCCESS = "登录成功!";
|
||||
|
||||
|
||||
/**
|
||||
* 退出登录成功
|
||||
*/
|
||||
public static final String LANGUAGE_TYPE_LOG_OUT_SUCCESSFULLY = "退出登录成功!";
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* author: damao
|
||||
* date:2022-08-27 17:12
|
||||
* description:
|
||||
**/
|
||||
public interface RoleConstant {
|
||||
|
||||
/**
|
||||
* 角色id 超级管理员
|
||||
*/
|
||||
public static final String SUPER_ADMIN_ROLE_ID = "1562999412925894658";
|
||||
|
||||
/**
|
||||
* 角色id 系统管理员
|
||||
*/
|
||||
public static final String SYS_ADMIN_ROLE_ID = "f6817f48af4fb3af11b9e8bf182f618b";
|
||||
|
||||
/**
|
||||
* 角色id 区域管理员
|
||||
*/
|
||||
public static final String AREA_ADMIN_ROLE_ID = "1559512408061796353";
|
||||
}
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
*
|
||||
* * Copyright (c) 2019-2020, 冷冷 (wangiegie@gmail.com).
|
||||
* * <p>
|
||||
* * Licensed under the GNU Lesser General Public License 3.0 (the "License");
|
||||
* * you may not use this file except in compliance with the License.
|
||||
* * You may obtain a copy of the License at
|
||||
* * <p>
|
||||
* * https://www.gnu.org/licenses/lgpl.html
|
||||
* * <p>
|
||||
* * Unless required by applicable law or agreed to in writing, software
|
||||
* * distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* * See the License for the specific language governing permissions and
|
||||
* * limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* @author scott
|
||||
* @date 2019年05月18日
|
||||
* 服务名称
|
||||
*/
|
||||
public interface ServiceNameConstants {
|
||||
|
||||
/**
|
||||
* 微服务名:系统管理模块
|
||||
*/
|
||||
String SERVICE_SYSTEM = "jeecg-system";
|
||||
/**
|
||||
* 微服务名:Demo模块
|
||||
*/
|
||||
String SERVICE_DEMO = "jeecg-demo";
|
||||
|
||||
/**
|
||||
* gateway通过header传递根路径 basePath
|
||||
*/
|
||||
String X_GATEWAY_BASE_PATH = "X_GATEWAY_BASE_PATH";
|
||||
|
||||
}
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package digital.base.constant;
|
||||
|
||||
public interface ShortVideoOfflineComConstant {
|
||||
|
||||
public static final String result_success = "success";
|
||||
|
||||
public static final String result_fail = "FAIL";
|
||||
|
||||
/**
|
||||
* 正常状态
|
||||
*/
|
||||
public static final String STATUS_NORMAL = "200";
|
||||
|
||||
// 数字人模型 1.1.1 数字人定制
|
||||
public static final String CREATE_DIGITAL_PERSON_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/customizeLiveModel";
|
||||
|
||||
// 数字人模型 1.1.2 音色定制
|
||||
public static final String CUSTOM_AUDIO_ASSET_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/audioCustomize";
|
||||
|
||||
// 数字人模型 1.1.3 数字人名称更新
|
||||
public static final String RENAME_PERSON_ASSET_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/updatePersonAssetName";
|
||||
|
||||
// 数字人模型 1.1.4 音色名称更新
|
||||
public static final String RENAME_AUDIO_ASSET_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/updateAudioAssetName";
|
||||
|
||||
// 数字人模型 1.1.5 删除定制模特
|
||||
public static final String DEL_PERSON_ASSET_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/deleteDigitalPersonAsset";
|
||||
|
||||
// 数字人模型 1.1.6 删除定制音色
|
||||
public static final String DEL_AUDIO_ASSET_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/deleteAudioAsset";
|
||||
|
||||
// 数字人模型 1.1.7 定制音色查询
|
||||
public static final String GET_AUDIO_ASSET_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/getAudioAssetsById";
|
||||
|
||||
// 数字人模型 1.1.8 定制音色列表查询
|
||||
public static final String GET_AUDIO_LIST_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/audioAssetsList";
|
||||
|
||||
// 数字人模型 1.1.9 定制数字人列表查询
|
||||
public static final String GET_CUSTOM_PERSON_LIST_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/customizeAssets";
|
||||
|
||||
// 数字人模型 1.1.10 免费数字人列表查询
|
||||
public static final String GET_FREE_PERSON_LIST_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/freeAssets";
|
||||
|
||||
// 短视频作品 1.3.1 创建视频合成-利用音频文件
|
||||
public static final String CREATE_WITH_AUDIO_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/composeWithAudio";
|
||||
|
||||
// 短视频作品 1.3.2 创建视频合成-利用tts
|
||||
public static final String CREATE_WITH_TTS_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/composeWithTTS";
|
||||
|
||||
// 短视频作品 1.3.3 更新视频作品名称
|
||||
public static final String RENAME_VIDEO_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/updateWorkName";
|
||||
|
||||
// 短视频作品 1.3.4 视频创建任务状态查询
|
||||
public static final String GET_VIDEO_STATUS_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/detail ";
|
||||
|
||||
// 短视频作品 1.3.5 视频作品列表
|
||||
public static final String GET_VIDEO_LIST_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/workList";
|
||||
|
||||
// 短视频作品 1.3.7 删除视频作品
|
||||
public static final String DEL_VIDEO_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/deleteWork";
|
||||
|
||||
// 短视频作品 1.3.8 复制视频作品
|
||||
public static final String COPY_VIDEO_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/copyWork";
|
||||
|
||||
// 短视频作品 1.3.9 视频作品统计
|
||||
public static final String COUNT_VIDEO_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/videoStatistics";
|
||||
|
||||
//========================================================下面是本地算法==============================================================
|
||||
|
||||
// 创建数字人定制任务-请求算法(新增)
|
||||
public static final String CUSTOM_CREATE_TASK_HTTP = "http://service.aicloud.fit:9008/train/v1";
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* @Description: 符号和特殊符号常用类
|
||||
* @author: wangshuai
|
||||
* @date: 2022年03月30日 17:44
|
||||
*/
|
||||
public class SymbolConstant {
|
||||
|
||||
/**
|
||||
* 符号:点
|
||||
*/
|
||||
public static final String SPOT = ".";
|
||||
|
||||
/**
|
||||
* 符号:双斜杠
|
||||
*/
|
||||
public static final String DOUBLE_BACKSLASH = "\\";
|
||||
|
||||
/**
|
||||
* 符号:冒号
|
||||
*/
|
||||
public static final String COLON = ":";
|
||||
|
||||
/**
|
||||
* 符号:逗号
|
||||
*/
|
||||
public static final String COMMA = ",";
|
||||
|
||||
/**
|
||||
* 符号:左花括号 }
|
||||
*/
|
||||
public static final String LEFT_CURLY_BRACKET = "{";
|
||||
|
||||
/**
|
||||
* 符号:右花括号 }
|
||||
*/
|
||||
public static final String RIGHT_CURLY_BRACKET = "}";
|
||||
|
||||
/**
|
||||
* 符号:井号 #
|
||||
*/
|
||||
public static final String WELL_NUMBER = "#";
|
||||
|
||||
/**
|
||||
* 符号:单斜杠
|
||||
*/
|
||||
public static final String SINGLE_SLASH = "/";
|
||||
|
||||
/**
|
||||
* 符号:双斜杠
|
||||
*/
|
||||
public static final String DOUBLE_SLASH = "//";
|
||||
|
||||
/**
|
||||
* 符号:感叹号
|
||||
*/
|
||||
public static final String EXCLAMATORY_MARK = "!";
|
||||
|
||||
/**
|
||||
* 符号:下划线
|
||||
*/
|
||||
public static final String UNDERLINE = "_";
|
||||
|
||||
/**
|
||||
* 符号:单引号
|
||||
*/
|
||||
public static final String SINGLE_QUOTATION_MARK = "'";
|
||||
|
||||
/**
|
||||
* 符号:星号
|
||||
*/
|
||||
public static final String ASTERISK = "*";
|
||||
|
||||
/**
|
||||
* 符号:百分号
|
||||
*/
|
||||
public static final String PERCENT_SIGN = "%";
|
||||
|
||||
/**
|
||||
* 符号:美元 $
|
||||
*/
|
||||
public static final String DOLLAR = "$";
|
||||
|
||||
/**
|
||||
* 符号:和 &
|
||||
*/
|
||||
public static final String AND = "&";
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* author: smcp
|
||||
* date:2022-08-26 9:41
|
||||
* description:
|
||||
**/
|
||||
public interface UserFileConstant {
|
||||
|
||||
/**
|
||||
* 是否是 临时文件 0 不是
|
||||
*
|
||||
*/
|
||||
public static final String IS_TEMP_NO = "0";
|
||||
|
||||
/**
|
||||
* 是否是 临时文件 1 是
|
||||
*
|
||||
*/
|
||||
public static final String IS_TEMP_YES = "1";
|
||||
/**
|
||||
* 文件类型 1 图片
|
||||
*
|
||||
*/
|
||||
public static final String FILE_TYPE_IMAGE = "1";
|
||||
/**
|
||||
* 文件类型 2 pdf
|
||||
*
|
||||
*/
|
||||
public static final String FILE_TYPE_PDF = "2";
|
||||
|
||||
/**
|
||||
* 是否是文件夹 0 不是
|
||||
*
|
||||
*/
|
||||
public static final Integer IS_DIR_NO = 0;
|
||||
|
||||
/**
|
||||
* 是否是文件夹 1 是文件夹
|
||||
*
|
||||
*/
|
||||
public static final Integer IS_DIR_YES = 1;
|
||||
|
||||
|
||||
/**
|
||||
* 文件下载状态 1开始下载
|
||||
*
|
||||
*/
|
||||
public static final String file_download_status_begin = "1";
|
||||
|
||||
/**
|
||||
*
|
||||
* 文件下载状态 2下载完成
|
||||
*/
|
||||
public static final String file_download_status_end = "2";
|
||||
|
||||
/**
|
||||
*
|
||||
* 文件下载状态 3下载失败
|
||||
*/
|
||||
public static final String file_download_status_error = "3";
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package digital.base.constant;
|
||||
|
||||
public interface VideoConstant {
|
||||
|
||||
public static final String result_success = "success";
|
||||
|
||||
public static final String result_fail = "fail";
|
||||
|
||||
public static final Integer source_type_0 = 0;
|
||||
|
||||
/**
|
||||
* 文本生成:1
|
||||
* 音频生成:2
|
||||
* 不同入参必传参数不一样
|
||||
*/
|
||||
|
||||
public static final String video_Type_text = "1";
|
||||
/**
|
||||
* 文本生成:1
|
||||
* 音频生成:2
|
||||
* 不同入参必传参数不一样
|
||||
*/
|
||||
|
||||
public static final String video_Type_audio = "2";
|
||||
/**
|
||||
* 正常状态
|
||||
*/
|
||||
public static final String STATUS_NORMAL = "200";
|
||||
|
||||
// 1.2.1 音色列表
|
||||
public static final String GET_VOICE_LIST_HTTP = "https://meta.yiwise.com/openApiDigitalPerson/customer/audioAssetsList";
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* VXESocket 常量
|
||||
*
|
||||
* update: 【类名改了大小写】 date: 2022-04-18
|
||||
* @author: smcp
|
||||
*/
|
||||
public class VxeSocketConst {
|
||||
|
||||
/**
|
||||
* 消息类型
|
||||
*/
|
||||
public static final String TYPE = "type";
|
||||
/**
|
||||
* 消息数据
|
||||
*/
|
||||
public static final String DATA = "data";
|
||||
|
||||
/**
|
||||
* 消息类型:心跳检测
|
||||
*/
|
||||
public static final String TYPE_HB = "heart_beat";
|
||||
/**
|
||||
* 消息类型:通用数据传递
|
||||
*/
|
||||
public static final String TYPE_CSD = "common_send_date";
|
||||
/**
|
||||
* 消息类型:更新vxe table数据
|
||||
*/
|
||||
public static final String TYPE_UVT = "update_vxe_table";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package digital.base.constant;
|
||||
|
||||
/**
|
||||
* @Description: Websocket常量类
|
||||
* @author: taoyan
|
||||
* @date: 2020年03月23日
|
||||
*/
|
||||
public class WebsocketConst {
|
||||
|
||||
|
||||
/**
|
||||
* 消息json key:cmd
|
||||
*/
|
||||
public static final String MSG_CMD = "cmd";
|
||||
|
||||
/**
|
||||
* 消息json key:msgId
|
||||
*/
|
||||
public static final String MSG_ID = "msgId";
|
||||
|
||||
/**
|
||||
* 消息json key:msgTxt
|
||||
*/
|
||||
public static final String MSG_TXT = "msgTxt";
|
||||
|
||||
/**
|
||||
* 消息json key:userId
|
||||
*/
|
||||
public static final String MSG_USER_ID = "userId";
|
||||
|
||||
/**
|
||||
* 消息类型 heartcheck
|
||||
*/
|
||||
public static final String CMD_CHECK = "heartcheck";
|
||||
|
||||
/**
|
||||
* 消息类型 user 用户消息
|
||||
*/
|
||||
public static final String CMD_USER = "user";
|
||||
|
||||
/**
|
||||
* 消息类型 topic 系统通知
|
||||
*/
|
||||
public static final String CMD_TOPIC = "topic";
|
||||
|
||||
/**
|
||||
* 消息类型 email
|
||||
*/
|
||||
public static final String CMD_EMAIL = "email";
|
||||
|
||||
/**
|
||||
* 消息类型 meetingsign 会议签到
|
||||
*/
|
||||
public static final String CMD_SIGN = "sign";
|
||||
|
||||
/**
|
||||
* 消息类型 新闻发布/取消
|
||||
*/
|
||||
public static final String NEWS_PUBLISH = "publish";
|
||||
|
||||
}
|
||||
+64
@@ -0,0 +1,64 @@
|
||||
package digital.base.constant;
|
||||
|
||||
public interface ZitaCommonConstant {
|
||||
|
||||
/**
|
||||
* 性别男
|
||||
*/
|
||||
public static final String sex_male = "male";
|
||||
|
||||
/**
|
||||
* 性别女
|
||||
*/
|
||||
public static final String sex_female = "female";
|
||||
|
||||
/**
|
||||
* 性别男 hairs
|
||||
*/
|
||||
public static final String sex_male_hairs = "[\"nan_tf_69\", \"nan_tf_92\", \"nan_tf_102\", \"nan_tf_142\", \"nan_tf_129\"]";
|
||||
|
||||
/**
|
||||
* 性别女 hairs
|
||||
*/
|
||||
public static final String sex_female_hairs ="[\"nv_tf_128\", \"nv_tf_175\", \"nv_tf_132\", \"nv_tf_159\", \"nv_tf_161\"]";
|
||||
|
||||
/**
|
||||
* 正常状态
|
||||
*/
|
||||
public static final String STATUS_NORMAL = "200";
|
||||
|
||||
/**
|
||||
* 生成图片和模型 1
|
||||
*/
|
||||
public static final String TASK_TYPE_PICTURE = "1";
|
||||
/**
|
||||
* 生成视频 2
|
||||
*/
|
||||
public static final String TASK_TYPE_VIDEO = "2";
|
||||
|
||||
/**
|
||||
* 新用户注册送5次试用机会
|
||||
*/
|
||||
public static final Integer New_register_member_try_times = 5;
|
||||
|
||||
/**
|
||||
* 购买卡类型-试用
|
||||
*/
|
||||
public static final String MEMBER_TYPE_TRY_CARD = "1";
|
||||
|
||||
/**
|
||||
* 购买卡类型-次卡
|
||||
*/
|
||||
public static final String MEMBER_TYPE_SUB_CARD = "2";
|
||||
|
||||
/**
|
||||
* 购买卡类型-月卡
|
||||
*/
|
||||
public static final String MEMBER_TYPE_MONTH_CARD = "3";
|
||||
|
||||
/**
|
||||
* 购买卡类型-年卡
|
||||
*/
|
||||
public static final String MEMBER_TYPE_YEAR_CARD = "4";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
package digital.base.enums;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* online表单枚举 代码生成器用到
|
||||
*
|
||||
* @author: smcp
|
||||
*/
|
||||
public enum CgformEnum {
|
||||
|
||||
/**
|
||||
* 单表
|
||||
*/
|
||||
ONE(1, "one", "/jeecg/code-template-online", "default.one", "经典风格"),
|
||||
/**
|
||||
* 多表
|
||||
*/
|
||||
MANY(2, "many", "/jeecg/code-template-online", "default.onetomany", "经典风格"),
|
||||
/**
|
||||
* 多表
|
||||
*/
|
||||
ERP(2, "erp", "/jeecg/code-template-online", "erp.onetomany", "ERP风格"),
|
||||
/**
|
||||
* 多表(jvxe风格)
|
||||
*/
|
||||
JVXE_TABLE(2, "jvxe", "/jeecg/code-template-online", "jvxe.onetomany", "JVXE风格"),
|
||||
/**
|
||||
* 多表(内嵌子表风格)
|
||||
*/
|
||||
INNER_TABLE(2, "innerTable", "/jeecg/code-template-online", "inner-table.onetomany", "内嵌子表风格"),
|
||||
/**
|
||||
* 多表(tab风格)
|
||||
*/
|
||||
TAB(2, "tab", "/jeecg/code-template-online", "tab.onetomany", "Tab风格"),
|
||||
/**
|
||||
* 树形列表
|
||||
*/
|
||||
TREE(3, "tree", "/jeecg/code-template-online", "default.tree", "树形列表");
|
||||
|
||||
/**
|
||||
* 类型 1/单表 2/一对多 3/树
|
||||
*/
|
||||
int type;
|
||||
/**
|
||||
* 编码标识
|
||||
*/
|
||||
String code;
|
||||
/**
|
||||
* 代码生成器模板路径
|
||||
*/
|
||||
String templatePath;
|
||||
/**
|
||||
* 代码生成器模板路径
|
||||
*/
|
||||
String stylePath;
|
||||
/**
|
||||
* 模板风格名称
|
||||
*/
|
||||
String note;
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param type 类型 1/单表 2/一对多 3/树
|
||||
* @param code 模板编码
|
||||
* @param templatePath 模板路径
|
||||
* @param stylePath 模板子路径
|
||||
* @param note
|
||||
*/
|
||||
CgformEnum(int type, String code, String templatePath, String stylePath, String note) {
|
||||
this.type = type;
|
||||
this.code = code;
|
||||
this.templatePath = templatePath;
|
||||
this.stylePath = stylePath;
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code获取模板路径
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static String getTemplatePathByConfig(String code) {
|
||||
return getCgformEnumByConfig(code).templatePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据code找枚举
|
||||
*
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public static CgformEnum getCgformEnumByConfig(String code) {
|
||||
for (CgformEnum e : CgformEnum.values()) {
|
||||
if (e.code.equals(code)) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据类型找所有
|
||||
*
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public static List<Map<String, Object>> getJspModelList(int type) {
|
||||
List<Map<String, Object>> ls = new ArrayList<Map<String, Object>>();
|
||||
for (CgformEnum e : CgformEnum.values()) {
|
||||
if (e.type == type) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("code", e.code);
|
||||
map.put("note", e.note);
|
||||
ls.add(map);
|
||||
}
|
||||
}
|
||||
return ls;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getTemplatePath() {
|
||||
return templatePath;
|
||||
}
|
||||
|
||||
public void setTemplatePath(String templatePath) {
|
||||
this.templatePath = templatePath;
|
||||
}
|
||||
|
||||
public String getStylePath() {
|
||||
return stylePath;
|
||||
}
|
||||
|
||||
public void setStylePath(String stylePath) {
|
||||
this.stylePath = stylePath;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package digital.base.enums;
|
||||
|
||||
/**
|
||||
* U CAN GET A CRAB WHEN U MEET US!
|
||||
* IF GET A QUESTION,PLEASE CONTACT US:
|
||||
* WEBSITE: www.crabholder.cn www.crabholder.com
|
||||
* EMAIL:crabholder@163.com.
|
||||
* CREATED ON 2020/7/13!
|
||||
*/
|
||||
public enum FileTypeEnum {
|
||||
picture_1("1", "bmp"),
|
||||
picture_2("1", "jpg"),
|
||||
picture_3("1", "png"),
|
||||
picture_4("1", "tif"),
|
||||
picture_5("1", "gif"),
|
||||
picture_6("1", "jpeg"),
|
||||
document_1("2", "pdf"),
|
||||
;
|
||||
|
||||
FileTypeEnum(String fileType, String extendName) {
|
||||
this.fileType = fileType;
|
||||
this.extendName = extendName;
|
||||
}
|
||||
|
||||
public String getFileType() {
|
||||
return fileType;
|
||||
}
|
||||
|
||||
public void setFileType(String fileType) {
|
||||
this.fileType = fileType;
|
||||
}
|
||||
|
||||
public String getExtendName() {
|
||||
return extendName;
|
||||
}
|
||||
|
||||
public void setExtendName(String extendName) {
|
||||
this.extendName = extendName;
|
||||
}
|
||||
|
||||
private String fileType;
|
||||
private String extendName;
|
||||
|
||||
|
||||
public static FileTypeEnum codeIn(String extendName) {
|
||||
if (extendName == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (FileTypeEnum em : FileTypeEnum.values()) {
|
||||
if (em.getExtendName().equals(extendName)) {
|
||||
return em;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package digital.base.enums;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* U CAN GET A CRAB WHEN U MEET US!
|
||||
* IF GET A QUESTION,PLEASE CONTACT US:
|
||||
* WEBSITE: www.crabholder.cn www.crabholder.com
|
||||
* EMAIL:crabholder@163.com.
|
||||
* CREATED ON 2020/7/13!
|
||||
*/
|
||||
public enum FileTypeKSFEnum {
|
||||
IDCACRD_1(1,"idcard1","sys_user","id","身份证正面"),
|
||||
IDCACRD_2(2,"idcard2","sys_user","id","身份证反面"),
|
||||
IMPORTPERSON(3,"importperson","sys_user","id",""),
|
||||
IMPORTENDRESULT(4,"importEndResult","insurance_case","id",""),
|
||||
EXPORTJT(5,"exportjt","insurance_case","id",""),
|
||||
EXPORTWT(6,"exportwt","insurance_case","id",""),
|
||||
USERCHANGE(7,"userchange","sys_user","id",""),
|
||||
CASEDETAILFILE(8,"casedetailfile","caseid","id",""),
|
||||
BANKFRONT(9,"bank1","sys_user","id","银行卡正面"),
|
||||
BANKBACk(10,"bank2","sys_user","id","银行卡反面"),
|
||||
;
|
||||
FileTypeKSFEnum(Integer key, String value, String tableName, String tableId, String name) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
this.tableName = tableName;
|
||||
this.tableId = tableId;
|
||||
this.name = name;
|
||||
}
|
||||
private Integer key;
|
||||
private String value;
|
||||
private String tableName;
|
||||
private String tableId;
|
||||
private String name;
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
public String getTableId() {
|
||||
return tableId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public static FileTypeKSFEnum codeIn(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (FileTypeKSFEnum em : FileTypeKSFEnum.values()) {
|
||||
if (em.getKey().equals(code)) {
|
||||
return em;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
public static List<Integer> getNeedIdCard(){
|
||||
return Arrays.asList(IDCACRD_1.getKey(),IDCACRD_2.getKey(),BANKBACk.getKey(),BANKFRONT.getKey());
|
||||
}
|
||||
|
||||
public static List<String> getUserPhotoTypes() {
|
||||
return Arrays.asList(IDCACRD_1.getKey().toString(), IDCACRD_2.getKey().toString(),BANKBACk.getKey().toString(),BANKFRONT.getKey().toString());
|
||||
}
|
||||
public static List<String> getUserEcportCards() {
|
||||
return Arrays.asList(IDCACRD_1.getKey().toString(), IDCACRD_2.getKey().toString(),BANKBACk.getKey().toString(),BANKFRONT.getKey().toString());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package digital.base.enums;
|
||||
|
||||
/**
|
||||
* LowApp 切面注解枚举
|
||||
*
|
||||
* @date 2022-1-5
|
||||
* @author: smcp
|
||||
*/
|
||||
public enum LowAppAopEnum {
|
||||
|
||||
/**
|
||||
* 新增方法
|
||||
*/
|
||||
ADD,
|
||||
/**
|
||||
* 删除方法(包含单个和批量删除)
|
||||
*/
|
||||
DELETE,
|
||||
|
||||
/**
|
||||
* Online表单专用:数据库表转Online表单
|
||||
*/
|
||||
CGFORM_DB_IMPORT
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package digital.base.enums;
|
||||
|
||||
/**
|
||||
* 日志按模块分类
|
||||
*
|
||||
* @author: smcp
|
||||
*/
|
||||
public enum ModuleType {
|
||||
|
||||
/**
|
||||
* 普通
|
||||
*/
|
||||
COMMON,
|
||||
|
||||
/**
|
||||
* online
|
||||
*/
|
||||
ONLINE;
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package digital.base.enums;
|
||||
|
||||
|
||||
import digital.base.constant.CommonConstant;
|
||||
|
||||
/**
|
||||
* @Description: 操作类型
|
||||
* @author: smcp
|
||||
* @date: 2022/3/31 10:05
|
||||
*/
|
||||
public enum OperateTypeEnum {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
LIST(CommonConstant.OPERATE_TYPE_1, "list"),
|
||||
|
||||
/**
|
||||
* 新增
|
||||
*/
|
||||
ADD(CommonConstant.OPERATE_TYPE_2, "add"),
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*/
|
||||
EDIT(CommonConstant.OPERATE_TYPE_3, "edit"),
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
DELETE(CommonConstant.OPERATE_TYPE_4, "delete"),
|
||||
|
||||
/**
|
||||
* 导入
|
||||
*/
|
||||
IMPORT(CommonConstant.OPERATE_TYPE_5, "import"),
|
||||
|
||||
/**
|
||||
* 导出
|
||||
*/
|
||||
EXPORT(CommonConstant.OPERATE_TYPE_6, "export");
|
||||
|
||||
/**
|
||||
* 类型 1列表,2新增,3编辑,4删除,5导入,6导出
|
||||
*/
|
||||
int type;
|
||||
|
||||
/**
|
||||
* 编码(请求方式)
|
||||
*/
|
||||
String code;
|
||||
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param type 类型
|
||||
* @param code 编码(请求方式)
|
||||
*/
|
||||
OperateTypeEnum(int type, String code) {
|
||||
this.type = type;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据请求名称匹配
|
||||
*
|
||||
* @param methodName 请求名称
|
||||
* @return Integer 类型
|
||||
*/
|
||||
public static Integer getTypeByMethodName(String methodName) {
|
||||
for (OperateTypeEnum e : OperateTypeEnum.values()) {
|
||||
if (methodName.startsWith(e.getCode())) {
|
||||
return e.getType();
|
||||
}
|
||||
}
|
||||
return CommonConstant.OPERATE_TYPE_1;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(int type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package digital.base.enums;
|
||||
|
||||
/**
|
||||
* 基础消息类
|
||||
* U CAN GET A CRAB WHEN U MEET US!
|
||||
* IF GET A QUESTION,PLEASE CONTACT US:
|
||||
* WEBSITE: www.crabholder.cn www.crabholder.com
|
||||
* EMAIL:crabholder@163.com.
|
||||
* CREATED ON 2020/6/27!
|
||||
*/
|
||||
public interface SMCodeMessage {
|
||||
Integer getKey();
|
||||
String getValue();
|
||||
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package digital.base.enums;
|
||||
|
||||
/**
|
||||
* @Description: 异常错误信息定义
|
||||
* @author: zyf
|
||||
* @date: 2022/4/14 10:05
|
||||
*/
|
||||
public enum SentinelErrorInfoEnum {
|
||||
|
||||
/**
|
||||
* 流控异常
|
||||
*/
|
||||
FlowException("访问频繁,请稍候再试"),
|
||||
|
||||
/**
|
||||
* 热点参数异常
|
||||
*/
|
||||
ParamFlowException("热点参数限流"),
|
||||
|
||||
/**
|
||||
* 系统规则限流或降级
|
||||
*/
|
||||
SystemBlockException("系统规则限流或降级"),
|
||||
|
||||
/**
|
||||
* 授权规则不通过
|
||||
*/
|
||||
AuthorityException("授权规则不通过"),
|
||||
|
||||
/**
|
||||
* 授权规则不通过
|
||||
*/
|
||||
UnknownError("未知异常"),
|
||||
|
||||
/**
|
||||
* 服务降级
|
||||
*/
|
||||
DegradeException("服务降级");
|
||||
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
*/
|
||||
String error;
|
||||
|
||||
/**
|
||||
* 错误代码
|
||||
*/
|
||||
Integer code;
|
||||
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
|
||||
public Integer getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(Integer code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param error 错误信息
|
||||
* @param code 错误代码
|
||||
*/
|
||||
SentinelErrorInfoEnum(String error, Integer code) {
|
||||
this.error = error;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器
|
||||
*
|
||||
* @param error 错误信息
|
||||
*/
|
||||
SentinelErrorInfoEnum(String error) {
|
||||
this.error = error;
|
||||
this.code = 500;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据异常名称匹配
|
||||
*
|
||||
* @param throwable 异常
|
||||
* @return String 错误信息
|
||||
*/
|
||||
public static SentinelErrorInfoEnum getErrorByException(Throwable throwable) {
|
||||
if(throwable==null){
|
||||
return null;
|
||||
}
|
||||
|
||||
String exceptionClass=throwable.getClass().getSimpleName();
|
||||
for (SentinelErrorInfoEnum e : SentinelErrorInfoEnum.values()) {
|
||||
if (exceptionClass.equals(e.name())) {
|
||||
return e;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package digital.base.enums;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
* @Date 2020/1/14 13:36
|
||||
* @Description: 请求URL与菜单路由URL转换规则(方便于采用菜单路由URL来配置数据权限规则)
|
||||
*/
|
||||
public enum UrlMatchEnum {
|
||||
/**求URL与菜单路由URL转换规则 /online/cgform/api/getData/ */
|
||||
CGFORM_DATA("/online/cgform/api/getData/", "/online/cgformList/"),
|
||||
/**求URL与菜单路由URL转换规则 /online/cgform/api/exportXls/ */
|
||||
CGFORM_EXCEL_DATA("/online/cgform/api/exportXls/", "/online/cgformList/"),
|
||||
/**求URL与菜单路由URL转换规则 /online/cgform/api/getTreeData/ */
|
||||
CGFORM_TREE_DATA("/online/cgform/api/getTreeData/", "/online/cgformList/"),
|
||||
/**求URL与菜单路由URL转换规则 /online/cgreport/api/getColumnsAndData/ */
|
||||
CGREPORT_DATA("/online/cgreport/api/getColumnsAndData/", "/online/cgreport/"),
|
||||
/**求URL与菜单路由URL转换规则 /online/cgreport/api/exportXls/ */
|
||||
CGREPORT_EXCEL_DATA("/online/cgreport/api/exportXls/", "/online/cgreport/"),
|
||||
/**求URL与菜单路由URL转换规则 /online/cgreport/api/exportManySheetXls/ */
|
||||
CGREPORT_EXCEL_DATA2("/online/cgreport/api/exportManySheetXls/", "/online/cgreport/");
|
||||
|
||||
UrlMatchEnum(String url, String matchUrl) {
|
||||
this.url = url;
|
||||
this.matchUrl = matchUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* Request 请求 URL前缀
|
||||
*/
|
||||
private String url;
|
||||
/**
|
||||
* 菜单路由 URL前缀 (对应菜单路径)
|
||||
*/
|
||||
private String matchUrl;
|
||||
|
||||
/**
|
||||
* 根据req url 获取到菜单配置路径(前端页面路由URL)
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public static String getMatchResultByUrl(String url) {
|
||||
//获取到枚举
|
||||
UrlMatchEnum[] values = UrlMatchEnum.values();
|
||||
//加强for循环进行遍历操作
|
||||
for (UrlMatchEnum lr : values) {
|
||||
//如果遍历获取的type和参数type一致
|
||||
if (url.indexOf(lr.url) != -1) {
|
||||
//返回type对象的desc
|
||||
return url.replace(lr.url, lr.matchUrl);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getMatchUrl() {
|
||||
return matchUrl;
|
||||
}
|
||||
// public static void main(String[] args) {
|
||||
// /**
|
||||
// * 比如request真实请求URL: /online/cgform/api/getData/81fcf7d8922d45069b0d5ba983612d3a
|
||||
// * 转换匹配路由URL后(对应配置的菜单路径):/online/cgformList/81fcf7d8922d45069b0d5ba983612d3a
|
||||
// */
|
||||
// System.out.println(UrlMatchEnum.getMatchResultByUrl("/online/cgform/api/getData/81fcf7d8922d45069b0d5ba983612d3a"));
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package digital.base.enums;
|
||||
|
||||
|
||||
/**
|
||||
* U CAN GET A CRAB WHEN U MEET US!
|
||||
* IF GET A QUESTION,PLEASE CONTACT US:
|
||||
* WEBSITE: www.crabholder.cn www.crabholder.com
|
||||
* EMAIL:crabholder@163.com.
|
||||
* CREATED ON 2020/6/27!
|
||||
*/
|
||||
public enum YesOrNoEnum implements SMCodeMessage{
|
||||
YES(1,"是"),
|
||||
NO(0,"否");
|
||||
YesOrNoEnum(Integer key, String value) {
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private Integer key;
|
||||
private String value;
|
||||
@Override
|
||||
public Integer getKey() {
|
||||
return key;
|
||||
}
|
||||
@Override
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
public static YesOrNoEnum codeIn(Integer code) {
|
||||
if (code == null) {
|
||||
return null;
|
||||
} else {
|
||||
for (YesOrNoEnum em : YesOrNoEnum.values()) {
|
||||
if (em.getKey().equals(code)) {
|
||||
return em;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package digital.base.handler;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
/**
|
||||
* 填值规则接口
|
||||
*
|
||||
* @author Yan_东
|
||||
* 如需使用填值规则功能,规则实现类必须实现此接口
|
||||
*/
|
||||
public interface IFillRuleHandler {
|
||||
|
||||
/**
|
||||
* 填值规则
|
||||
* @param params 页面配置固定参数
|
||||
* @param formData 动态表单参数
|
||||
* @return
|
||||
*/
|
||||
public Object execute(JSONObject params, JSONObject formData);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
package digital.base.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 在线用户信息
|
||||
* </p>
|
||||
*
|
||||
* @Author scott
|
||||
* @since 2018-12-20
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class LoginUser {
|
||||
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "discordId")
|
||||
private String discordId;
|
||||
|
||||
@ApiModelProperty(value = "roleType")
|
||||
private String roleType;
|
||||
|
||||
@ApiModelProperty(value = "appId")
|
||||
private String appId;
|
||||
|
||||
@ApiModelProperty(value = "姓名")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty(value = "剩下使用次数")
|
||||
private BigDecimal remainNum;
|
||||
|
||||
/**
|
||||
* 登录人名字
|
||||
*/
|
||||
private String realname;
|
||||
|
||||
/**
|
||||
* 登录人密码
|
||||
*/
|
||||
private String password;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
private String avatar;
|
||||
|
||||
private String roleId;
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
private Date birthday;
|
||||
|
||||
/**
|
||||
* 性别(1:男 2:女)
|
||||
*/
|
||||
private Integer sex;
|
||||
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
/**
|
||||
* 状态(1:正常 2:冻结 )
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
private String telephone;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,241 @@
|
||||
package digital.base.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import digital.base.constant.CommonConstant;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 接口返回数据格式
|
||||
*
|
||||
* @author scott
|
||||
* @email jeecgos@163.com
|
||||
* @date 2019年1月19日
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "接口返回对象", description = "接口返回对象")
|
||||
public class Result<T> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 成功标志
|
||||
*/
|
||||
@ApiModelProperty(value = "成功标志")
|
||||
private boolean success = true;
|
||||
|
||||
/**
|
||||
* 返回处理消息
|
||||
*/
|
||||
@ApiModelProperty(value = "返回处理消息")
|
||||
private String message = "";
|
||||
|
||||
@ApiModelProperty(value = "")
|
||||
private String requestId;
|
||||
|
||||
@ApiModelProperty(value = "处理中的数据条数")
|
||||
private Integer inProcessCount;
|
||||
|
||||
/**
|
||||
* 返回代码
|
||||
*/
|
||||
@ApiModelProperty(value = "返回代码")
|
||||
private Integer code = 0;
|
||||
|
||||
/**
|
||||
* 返回数据对象 data
|
||||
*/
|
||||
@ApiModelProperty(value = "返回数据对象")
|
||||
private T result;
|
||||
|
||||
/**
|
||||
* 时间戳
|
||||
*/
|
||||
@ApiModelProperty(value = "时间戳")
|
||||
private long timestamp = System.currentTimeMillis();
|
||||
@JsonIgnore
|
||||
private String onlTable;
|
||||
|
||||
public Result() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容VUE3版token失效不跳转登录页面
|
||||
*
|
||||
* @param code
|
||||
* @param message
|
||||
*/
|
||||
public Result(Integer code, String message) {
|
||||
this.code = code;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok() {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(String msg) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
//Result OK(String msg)方法会造成兼容性问题 issues/I4IP3D
|
||||
r.setResult((T) msg);
|
||||
r.setMessage(null);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(T data, String requestId) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
r.setRequestId(requestId);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(T data, String requestId, Integer inProcessCount) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
r.setRequestId(requestId);
|
||||
r.setInProcessCount(inProcessCount);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> ok(T data) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> OK() {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 此方法是为了兼容升级所创建
|
||||
*
|
||||
* @param msg
|
||||
* @param <T>
|
||||
* @return
|
||||
*/
|
||||
public static <T> Result<T> OK(String msg) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(msg);
|
||||
//Result OK(String msg)方法会造成兼容性问题 issues/I4IP3D
|
||||
r.setResult((T) msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> OK(T data) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> OK(T data, String taskId) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setRequestId(taskId);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> OK(String msg, String taskId) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setRequestId(taskId);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(msg);
|
||||
r.setResult((T) msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> OK(String msg, T data) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(true);
|
||||
r.setCode(CommonConstant.SC_OK_200);
|
||||
r.setMessage(msg);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg, T data) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(false);
|
||||
r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
|
||||
r.setMessage(msg);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(T data, String msg, String taskId) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setSuccess(false);
|
||||
r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
|
||||
r.setMessage(msg);
|
||||
r.setRequestId(taskId);
|
||||
r.setResult(data);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg) {
|
||||
return error(CommonConstant.SC_INTERNAL_SERVER_ERROR_500, msg);
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(int code, String msg) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setCode(code);
|
||||
r.setMessage(msg);
|
||||
r.setSuccess(false);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static <T> Result<T> error(String msg, String requestId) {
|
||||
Result<T> r = new Result<T>();
|
||||
r.setCode(CommonConstant.SC_INTERNAL_SERVER_ERROR_500);
|
||||
r.setMessage(msg);
|
||||
r.setRequestId(requestId);
|
||||
r.setSuccess(false);
|
||||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* 无权限访问返回结果
|
||||
*/
|
||||
public static <T> Result<T> noauth(String msg) {
|
||||
return error(CommonConstant.SC_JEECG_NO_AUTHZ, msg);
|
||||
}
|
||||
|
||||
public Result<T> success(String message) {
|
||||
this.message = message;
|
||||
this.code = CommonConstant.SC_OK_200;
|
||||
this.success = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result<T> error500(String message) {
|
||||
this.message = message;
|
||||
this.code = CommonConstant.SC_INTERNAL_SERVER_ERROR_500;
|
||||
this.success = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
package digital.base.vo;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 菜单权限规则表
|
||||
* </p>
|
||||
*
|
||||
* @Author huangzhilin
|
||||
* @since 2019-03-29
|
||||
*/
|
||||
public class SysPermissionDataRuleModel {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 对应的菜单id
|
||||
*/
|
||||
private String permissionId;
|
||||
|
||||
/**
|
||||
* 规则名称
|
||||
*/
|
||||
private String ruleName;
|
||||
|
||||
/**
|
||||
* 字段
|
||||
*/
|
||||
private String ruleColumn;
|
||||
|
||||
/**
|
||||
* 条件
|
||||
*/
|
||||
private String ruleConditions;
|
||||
|
||||
/**
|
||||
* 规则值
|
||||
*/
|
||||
private String ruleValue;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 修改人
|
||||
*/
|
||||
private String updateBy;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPermissionId() {
|
||||
return permissionId;
|
||||
}
|
||||
|
||||
public void setPermissionId(String permissionId) {
|
||||
this.permissionId = permissionId;
|
||||
}
|
||||
|
||||
public String getRuleName() {
|
||||
return ruleName;
|
||||
}
|
||||
|
||||
public void setRuleName(String ruleName) {
|
||||
this.ruleName = ruleName;
|
||||
}
|
||||
|
||||
public String getRuleColumn() {
|
||||
return ruleColumn;
|
||||
}
|
||||
|
||||
public void setRuleColumn(String ruleColumn) {
|
||||
this.ruleColumn = ruleColumn;
|
||||
}
|
||||
|
||||
public String getRuleConditions() {
|
||||
return ruleConditions;
|
||||
}
|
||||
|
||||
public void setRuleConditions(String ruleConditions) {
|
||||
this.ruleConditions = ruleConditions;
|
||||
}
|
||||
|
||||
public String getRuleValue() {
|
||||
return ruleValue;
|
||||
}
|
||||
|
||||
public void setRuleValue(String ruleValue) {
|
||||
this.ruleValue = ruleValue;
|
||||
}
|
||||
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getCreateBy() {
|
||||
return createBy;
|
||||
}
|
||||
|
||||
public void setCreateBy(String createBy) {
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public String getUpdateBy() {
|
||||
return updateBy;
|
||||
}
|
||||
|
||||
public void setUpdateBy(String updateBy) {
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>digital-common</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>digital-bean</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!--集成springmvc框架 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>digital-base</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>digital-util</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,139 @@
|
||||
package digital.bean.jeecg;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import org.apache.commons.beanutils.ConvertUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* BaseMap
|
||||
*
|
||||
* @author: scott
|
||||
* @date: 2020/01/01 16:17
|
||||
*/
|
||||
public class BaseMap extends HashMap<String, Object> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
public BaseMap() {
|
||||
|
||||
}
|
||||
|
||||
public BaseMap(Map<String, Object> map) {
|
||||
this.putAll(map);
|
||||
}
|
||||
|
||||
public static BaseMap toBaseMap(Map<String, Object> obj) {
|
||||
BaseMap map = new BaseMap();
|
||||
map.putAll(obj);
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseMap put(String key, Object value) {
|
||||
super.put(key, Optional.ofNullable(value).orElse(""));
|
||||
return this;
|
||||
}
|
||||
|
||||
public BaseMap add(String key, Object value) {
|
||||
super.put(key, Optional.ofNullable(value).orElse(""));
|
||||
return this;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(String key) {
|
||||
Object obj = super.get(key);
|
||||
if (ObjectUtil.isNotEmpty(obj)) {
|
||||
return (T) obj;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Boolean getBoolean(String key) {
|
||||
Object obj = super.get(key);
|
||||
if (ObjectUtil.isNotEmpty(obj)) {
|
||||
return Boolean.valueOf(obj.toString());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public Long getLong(String key) {
|
||||
Object v = get(key);
|
||||
if (ObjectUtil.isNotEmpty(v)) {
|
||||
return new Long(v.toString());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public Long[] getLongs(String key) {
|
||||
Object v = get(key);
|
||||
if (ObjectUtil.isNotEmpty(v)) {
|
||||
return (Long[]) v;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Long> getListLong(String key) {
|
||||
List<String> list = get(key);
|
||||
if (ObjectUtil.isNotEmpty(list)) {
|
||||
return list.stream().map(e -> new Long(e)).collect(Collectors.toList());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Long[] getLongIds(String key) {
|
||||
Object ids = get(key);
|
||||
if (ObjectUtil.isNotEmpty(ids)) {
|
||||
return (Long[]) ConvertUtils.convert(ids.toString().split(","), Long.class);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getInt(String key, Integer def) {
|
||||
Object v = get(key);
|
||||
if (ObjectUtil.isNotEmpty(v)) {
|
||||
return Integer.parseInt(v.toString());
|
||||
} else {
|
||||
return def;
|
||||
}
|
||||
}
|
||||
|
||||
public Integer getInt(String key) {
|
||||
Object v = get(key);
|
||||
if (ObjectUtil.isNotEmpty(v)) {
|
||||
return Integer.parseInt(v.toString());
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public BigDecimal getBigDecimal(String key) {
|
||||
Object v = get(key);
|
||||
if (ObjectUtil.isNotEmpty(v)) {
|
||||
return new BigDecimal(v.toString());
|
||||
}
|
||||
return new BigDecimal("0");
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> T get(String key, T def) {
|
||||
Object obj = super.get(key);
|
||||
if (ObjectUtil.isEmpty(obj)) {
|
||||
return def;
|
||||
}
|
||||
return (T) obj;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package digital.bean.jeecg.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文件下载
|
||||
* cloud api 用到的接口传输对象
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class FileDownDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6749126258686446019L;
|
||||
|
||||
private String filePath;
|
||||
private String uploadpath;
|
||||
private String uploadType;
|
||||
private HttpServletResponse response;
|
||||
|
||||
public FileDownDTO(){}
|
||||
|
||||
public FileDownDTO(String filePath, String uploadpath, String uploadType,HttpServletResponse response){
|
||||
this.filePath = filePath;
|
||||
this.uploadpath = uploadpath;
|
||||
this.uploadType = uploadType;
|
||||
this.response = response;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package digital.bean.jeecg.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 文件上传
|
||||
* cloud api 用到的接口传输对象
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class FileUploadDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4111953058578954386L;
|
||||
|
||||
private MultipartFile file;
|
||||
|
||||
private String bizPath;
|
||||
|
||||
private String uploadType;
|
||||
|
||||
private String customBucket;
|
||||
|
||||
public FileUploadDTO(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 简单上传 构造器1
|
||||
* @param file
|
||||
* @param bizPath
|
||||
* @param uploadType
|
||||
*/
|
||||
public FileUploadDTO(MultipartFile file,String bizPath,String uploadType){
|
||||
this.file = file;
|
||||
this.bizPath = bizPath;
|
||||
this.uploadType = uploadType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 申明桶 文件上传 构造器2
|
||||
* @param file
|
||||
* @param bizPath
|
||||
* @param uploadType
|
||||
* @param customBucket
|
||||
*/
|
||||
public FileUploadDTO(MultipartFile file,String bizPath,String uploadType,String customBucket){
|
||||
this.file = file;
|
||||
this.bizPath = bizPath;
|
||||
this.uploadType = uploadType;
|
||||
this.customBucket = customBucket;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package digital.bean.jeecg.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import digital.base.vo.LoginUser;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 日志对象
|
||||
* cloud api 用到的接口传输对象
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class LogDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 8482720462943906924L;
|
||||
|
||||
/**内容*/
|
||||
private String logContent;
|
||||
|
||||
private String appKey;
|
||||
|
||||
/**日志类型(0:操作日志;1:登录日志;2:定时任务) */
|
||||
private Integer logType;
|
||||
|
||||
/**操作类型(1:添加;2:修改;3:删除;) */
|
||||
private Integer operateType;
|
||||
|
||||
/**登录用户 */
|
||||
private LoginUser loginUser;
|
||||
|
||||
private String id;
|
||||
private String createBy;
|
||||
private Date createTime;
|
||||
private Long costTime;
|
||||
private String ip;
|
||||
|
||||
/**请求参数 */
|
||||
private String requestParam;
|
||||
|
||||
/**
|
||||
* 请求类型
|
||||
*/
|
||||
private String requestType;
|
||||
|
||||
/**
|
||||
* 请求路径
|
||||
*/
|
||||
private String requestUrl;
|
||||
|
||||
/**
|
||||
* 请求方法
|
||||
*/
|
||||
private String method;
|
||||
|
||||
private String result;
|
||||
|
||||
/**
|
||||
* 操作人用户名称
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 操作人用户账户
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
public LogDTO() {
|
||||
|
||||
}
|
||||
|
||||
public LogDTO(String logContent, Integer logType, Integer operatetype){
|
||||
this.logContent = logContent;
|
||||
this.logType = logType;
|
||||
this.operateType = operatetype;
|
||||
}
|
||||
|
||||
public LogDTO(String logContent, Integer logType, Integer operatetype, LoginUser loginUser){
|
||||
this.logContent = logContent;
|
||||
this.logType = logType;
|
||||
this.operateType = operatetype;
|
||||
this.loginUser = loginUser;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package digital.bean.jeecg.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* online 拦截器权限判断
|
||||
* cloud api 用到的接口传输对象
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class OnlineAuthDTO implements Serializable {
|
||||
private static final long serialVersionUID = 1771827545416418203L;
|
||||
|
||||
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 可能的请求地址
|
||||
*/
|
||||
private List<String> possibleUrl;
|
||||
|
||||
/**
|
||||
* online开发的菜单地址
|
||||
*/
|
||||
private String onlineFormUrl;
|
||||
|
||||
public OnlineAuthDTO(){
|
||||
|
||||
}
|
||||
|
||||
public OnlineAuthDTO(String username, List<String> possibleUrl, String onlineFormUrl){
|
||||
this.username = username;
|
||||
this.possibleUrl = possibleUrl;
|
||||
this.onlineFormUrl = onlineFormUrl;
|
||||
}
|
||||
}
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
package digital.bean.jeecg.dto.message;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 带业务参数的消息
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class BusMessageDTO extends MessageDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 9104793287983367669L;
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String busType;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String busId;
|
||||
|
||||
public BusMessageDTO(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 带业务参数的消息
|
||||
* @param fromUser
|
||||
* @param toUser
|
||||
* @param title
|
||||
* @param msgContent
|
||||
* @param msgCategory
|
||||
* @param busType
|
||||
* @param busId
|
||||
*/
|
||||
public BusMessageDTO(String fromUser, String toUser, String title, String msgContent, String msgCategory, String busType, String busId){
|
||||
super(fromUser, toUser, title, msgContent, msgCategory);
|
||||
this.busId = busId;
|
||||
this.busType = busType;
|
||||
}
|
||||
}
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
package digital.bean.jeecg.dto.message;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 带业务参数的模板消息
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class BusTemplateMessageDTO extends TemplateMessageDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4277810906346929459L;
|
||||
|
||||
/**
|
||||
* 业务类型
|
||||
*/
|
||||
private String busType;
|
||||
|
||||
/**
|
||||
* 业务id
|
||||
*/
|
||||
private String busId;
|
||||
|
||||
public BusTemplateMessageDTO(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造 带业务参数的模板消息
|
||||
* @param fromUser
|
||||
* @param toUser
|
||||
* @param title
|
||||
* @param templateParam
|
||||
* @param templateCode
|
||||
* @param busType
|
||||
* @param busId
|
||||
*/
|
||||
public BusTemplateMessageDTO(String fromUser, String toUser, String title, Map<String, String> templateParam, String templateCode, String busType, String busId){
|
||||
super(fromUser, toUser, title, templateParam, templateCode);
|
||||
this.busId = busId;
|
||||
this.busType = busType;
|
||||
}
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package digital.bean.jeecg.dto.message;
|
||||
|
||||
import lombok.Data;
|
||||
import digital.base.constant.CommonConstant;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 普通消息
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class MessageDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -5690444483968058442L;
|
||||
|
||||
/**
|
||||
* 发送人(用户登录账户)
|
||||
*/
|
||||
protected String fromUser;
|
||||
|
||||
/**
|
||||
* 发送给(用户登录账户)
|
||||
*/
|
||||
protected String toUser;
|
||||
|
||||
/**
|
||||
* 发送给所有人
|
||||
*/
|
||||
protected Boolean toAll;
|
||||
|
||||
/**
|
||||
* 消息主题
|
||||
*/
|
||||
protected String title;
|
||||
|
||||
/**
|
||||
* 消息内容
|
||||
*/
|
||||
protected String content;
|
||||
|
||||
/**
|
||||
* 消息类型 1:消息 2:系统消息
|
||||
*/
|
||||
protected String category;
|
||||
|
||||
|
||||
public MessageDTO(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器1 系统消息
|
||||
*/
|
||||
public MessageDTO(String fromUser,String toUser,String title, String content){
|
||||
this.fromUser = fromUser;
|
||||
this.toUser = toUser;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
//默认 都是2系统消息
|
||||
this.category = CommonConstant.MSG_CATEGORY_2;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器2 支持设置category 1:消息 2:系统消息
|
||||
*/
|
||||
public MessageDTO(String fromUser,String toUser,String title, String content, String category){
|
||||
this.fromUser = fromUser;
|
||||
this.toUser = toUser;
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package digital.bean.jeecg.dto.message;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 消息模板dto
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class TemplateDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 5848247133907528650L;
|
||||
|
||||
/**
|
||||
* 模板编码
|
||||
*/
|
||||
protected String templateCode;
|
||||
|
||||
/**
|
||||
* 模板参数
|
||||
*/
|
||||
protected Map<String, String> templateParam;
|
||||
|
||||
/**
|
||||
* 构造器 通过设置模板参数和模板编码 作为参数获取消息内容
|
||||
*/
|
||||
public TemplateDTO(String templateCode, Map<String, String> templateParam){
|
||||
this.templateCode = templateCode;
|
||||
this.templateParam = templateParam;
|
||||
}
|
||||
|
||||
public TemplateDTO(){
|
||||
|
||||
}
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
package digital.bean.jeecg.dto.message;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 模板消息
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class TemplateMessageDTO extends TemplateDTO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 411137565170647585L;
|
||||
|
||||
|
||||
/**
|
||||
* 发送人(用户登录账户)
|
||||
*/
|
||||
protected String fromUser;
|
||||
|
||||
/**
|
||||
* 发送给(用户登录账户)
|
||||
*/
|
||||
protected String toUser;
|
||||
|
||||
/**
|
||||
* 消息主题
|
||||
*/
|
||||
protected String title;
|
||||
|
||||
|
||||
public TemplateMessageDTO(){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 构造器1 发模板消息用
|
||||
*/
|
||||
public TemplateMessageDTO(String fromUser, String toUser,String title, Map<String, String> templateParam, String templateCode){
|
||||
super(templateCode, templateParam);
|
||||
this.fromUser = fromUser;
|
||||
this.toUser = toUser;
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package digital.bean.jeecg.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: Entity基类
|
||||
* @Author: dangzhenghui@163.com
|
||||
* @Date: 2019-4-28
|
||||
* @Version: 1.1
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
public class JeecgEntity implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "ID")
|
||||
private java.lang.String id;
|
||||
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
@Excel(name = "创建人", width = 15)
|
||||
private java.lang.String createBy;
|
||||
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@Excel(name = "创建时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
@Excel(name = "更新人", width = 15)
|
||||
private java.lang.String updateBy;
|
||||
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
@Excel(name = "更新时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 文档管理
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ComboModel implements Serializable {
|
||||
private String id;
|
||||
private String title;
|
||||
/**
|
||||
* 文档管理 表单table默认选中
|
||||
*/
|
||||
private boolean checked;
|
||||
/**
|
||||
* 文档管理 表单table 用户账号
|
||||
*/
|
||||
private String username;
|
||||
/**
|
||||
* 文档管理 表单table 用户邮箱
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 文档管理 表单table 角色编码
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
public ComboModel() {
|
||||
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
public ComboModel(String id, String title, boolean checked, String username) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.checked = false;
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 字典类
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class DictModel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 字典value
|
||||
*/
|
||||
private String value;
|
||||
/**
|
||||
* 字典文本
|
||||
*/
|
||||
private String text;
|
||||
|
||||
public DictModel() {
|
||||
}
|
||||
|
||||
public DictModel(String value, String text) {
|
||||
this.value = value;
|
||||
this.text = text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特殊用途: JgEditableTable
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTitle() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
/**
|
||||
* 特殊用途: vue3 Select组件
|
||||
*/
|
||||
public String getLabel() {
|
||||
return this.text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 查询多个字典时用到
|
||||
*
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DictModelMany extends DictModel {
|
||||
|
||||
/**
|
||||
* 字典code,根据多个字段code查询时才用到,用于区分不同的字典选项
|
||||
*/
|
||||
private String dictCode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 字典查询参数实体
|
||||
*
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class DictQuery {
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
private String table;
|
||||
/**
|
||||
* 存储列
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 显示列
|
||||
*/
|
||||
private String text;
|
||||
|
||||
/**
|
||||
* 关键字查询
|
||||
*/
|
||||
private String keyword;
|
||||
|
||||
/**
|
||||
* 存储列的值 用于回显查询
|
||||
*/
|
||||
private String codeValue;
|
||||
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
|
||||
/**
|
||||
* @Description: 数据源
|
||||
* @author: smcp
|
||||
*/
|
||||
@Data
|
||||
public class DynamicDataSourceModel {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private java.lang.String id;
|
||||
/**
|
||||
* 数据源编码
|
||||
*/
|
||||
private java.lang.String code;
|
||||
/**
|
||||
* 数据库类型
|
||||
*/
|
||||
private java.lang.String dbType;
|
||||
/**
|
||||
* 驱动类
|
||||
*/
|
||||
private java.lang.String dbDriver;
|
||||
/**
|
||||
* 数据源地址
|
||||
*/
|
||||
private java.lang.String dbUrl;
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
private java.lang.String dbUsername;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
private java.lang.String dbPassword;
|
||||
|
||||
// /**
|
||||
// * 数据库名称
|
||||
// */
|
||||
// private java.lang.String dbName;
|
||||
|
||||
public DynamicDataSourceModel() {
|
||||
|
||||
}
|
||||
|
||||
public DynamicDataSourceModel(Object dbSource) {
|
||||
if (dbSource != null) {
|
||||
BeanUtils.copyProperties(dbSource, this);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 下拉树 model
|
||||
*
|
||||
* @author jeecg-boot
|
||||
*/
|
||||
@Data
|
||||
public class SelectTreeModel implements Serializable {
|
||||
|
||||
private String key;
|
||||
private String title;
|
||||
private String value;
|
||||
/**
|
||||
* 父Id
|
||||
*/
|
||||
private String parentId;
|
||||
/**
|
||||
* 是否是叶节点
|
||||
*/
|
||||
private boolean isLeaf;
|
||||
/**
|
||||
* 子节点
|
||||
*/
|
||||
private List<SelectTreeModel> children;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
/**
|
||||
* @Author qinfeng
|
||||
* @Date 2020/2/19 12:01
|
||||
* @Description:
|
||||
* @Version 1.0
|
||||
*/
|
||||
public class SysCategoryModel {
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private java.lang.String id;
|
||||
/**
|
||||
* 父级节点
|
||||
*/
|
||||
private java.lang.String pid;
|
||||
/**
|
||||
* 类型名称
|
||||
*/
|
||||
private java.lang.String name;
|
||||
/**
|
||||
* 类型编码
|
||||
*/
|
||||
private java.lang.String code;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getPid() {
|
||||
return pid;
|
||||
}
|
||||
|
||||
public void setPid(String pid) {
|
||||
this.pid = pid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
package digital.bean.jeecg.vo;
|
||||
|
||||
/**
|
||||
* 部门机构model
|
||||
*
|
||||
* @author: lvdandan
|
||||
*/
|
||||
public class SysDepartModel {
|
||||
/**
|
||||
* ID
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 父机构ID
|
||||
*/
|
||||
private String parentId;
|
||||
/**
|
||||
* 机构/部门名称
|
||||
*/
|
||||
private String departName;
|
||||
/**
|
||||
* 英文名
|
||||
*/
|
||||
private String departNameEn;
|
||||
/**
|
||||
* 缩写
|
||||
*/
|
||||
private String departNameAbbr;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer departOrder;
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 机构类别 1组织机构,2岗位
|
||||
*/
|
||||
private String orgCategory;
|
||||
/**
|
||||
* 机构类型
|
||||
*/
|
||||
private String orgType;
|
||||
/**
|
||||
* 机构编码
|
||||
*/
|
||||
private String orgCode;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 传真
|
||||
*/
|
||||
private String fax;
|
||||
/**
|
||||
* 地址
|
||||
*/
|
||||
private String address;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String memo;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(String parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getDepartName() {
|
||||
return departName;
|
||||
}
|
||||
|
||||
public void setDepartName(String departName) {
|
||||
this.departName = departName;
|
||||
}
|
||||
|
||||
public String getDepartNameEn() {
|
||||
return departNameEn;
|
||||
}
|
||||
|
||||
public void setDepartNameEn(String departNameEn) {
|
||||
this.departNameEn = departNameEn;
|
||||
}
|
||||
|
||||
public String getDepartNameAbbr() {
|
||||
return departNameAbbr;
|
||||
}
|
||||
|
||||
public void setDepartNameAbbr(String departNameAbbr) {
|
||||
this.departNameAbbr = departNameAbbr;
|
||||
}
|
||||
|
||||
public Integer getDepartOrder() {
|
||||
return departOrder;
|
||||
}
|
||||
|
||||
public void setDepartOrder(Integer departOrder) {
|
||||
this.departOrder = departOrder;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getOrgCategory() {
|
||||
return orgCategory;
|
||||
}
|
||||
|
||||
public void setOrgCategory(String orgCategory) {
|
||||
this.orgCategory = orgCategory;
|
||||
}
|
||||
|
||||
public String getOrgType() {
|
||||
return orgType;
|
||||
}
|
||||
|
||||
public void setOrgType(String orgType) {
|
||||
this.orgType = orgType;
|
||||
}
|
||||
|
||||
public String getOrgCode() {
|
||||
return orgCode;
|
||||
}
|
||||
|
||||
public void setOrgCode(String orgCode) {
|
||||
this.orgCode = orgCode;
|
||||
}
|
||||
|
||||
public String getMobile() {
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile) {
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public String getFax() {
|
||||
return fax;
|
||||
}
|
||||
|
||||
public void setFax(String fax) {
|
||||
this.fax = fax;
|
||||
}
|
||||
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
|
||||
public String getMemo() {
|
||||
return memo;
|
||||
}
|
||||
|
||||
public void setMemo(String memo) {
|
||||
this.memo = memo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,249 @@
|
||||
package digital.bean.task;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @Description: dp_user
|
||||
* @Author: jeecg-boot
|
||||
* @Date: 2024-04-17
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("dp_user")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "dp_user对象", description = "dp_user")
|
||||
public class DpUser implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "appId")
|
||||
private String appId;
|
||||
|
||||
@ApiModelProperty(value = "roleType")
|
||||
private String roleType;
|
||||
|
||||
@ApiModelProperty(value = "apiAuthority")
|
||||
private boolean apiAuthority;
|
||||
|
||||
@ApiModelProperty(value = "appSecret")
|
||||
private String appSecret;
|
||||
|
||||
@ApiModelProperty(value = "直销客户传C ,代理商传D")
|
||||
private String reqFrom;
|
||||
|
||||
@ApiModelProperty(value = "token")
|
||||
private String token;
|
||||
|
||||
@ApiModelProperty(value = "token 过期时间")
|
||||
private Date expires;
|
||||
|
||||
@ApiModelProperty(value = "登录账号")
|
||||
private String account;
|
||||
/**
|
||||
* 真实姓名
|
||||
*/
|
||||
@Excel(name = "真实姓名", width = 15)
|
||||
@ApiModelProperty(value = "真实姓名")
|
||||
private String realname;
|
||||
/**
|
||||
* 密码
|
||||
*/
|
||||
@Excel(name = "密码", width = 15)
|
||||
@ApiModelProperty(value = "密码")
|
||||
private String password;
|
||||
/**
|
||||
* md5密码盐
|
||||
*/
|
||||
@Excel(name = "md5密码盐", width = 15)
|
||||
@ApiModelProperty(value = "md5密码盐")
|
||||
private String salt;
|
||||
/**
|
||||
* 头像
|
||||
*/
|
||||
@Excel(name = "头像", width = 15)
|
||||
@ApiModelProperty(value = "头像")
|
||||
private String avatar;
|
||||
/**
|
||||
* 生日
|
||||
*/
|
||||
@Excel(name = "生日", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "生日")
|
||||
private Date birthday;
|
||||
/**
|
||||
* 性别(0-默认未知,1-男,2-女)
|
||||
*/
|
||||
@Excel(name = "性别(0-默认未知,1-男,2-女)", width = 15)
|
||||
@ApiModelProperty(value = "性别(0-默认未知,1-男,2-女)")
|
||||
private String sex;
|
||||
/**
|
||||
* 电子邮件
|
||||
*/
|
||||
@Excel(name = "电子邮件", width = 15)
|
||||
@ApiModelProperty(value = "电子邮件")
|
||||
private String email;
|
||||
/**
|
||||
* 电话
|
||||
*/
|
||||
@Excel(name = "电话", width = 15)
|
||||
@ApiModelProperty(value = "电话")
|
||||
private String phone;
|
||||
/**
|
||||
* 性别(1-正常,2-冻结)
|
||||
*/
|
||||
@Excel(name = "性别(1-正常,2-冻结)", width = 15)
|
||||
@ApiModelProperty(value = "性别(1-正常,2-冻结)")
|
||||
private String status;
|
||||
/**
|
||||
* 删除状态(0-正常,1-已删除)
|
||||
*/
|
||||
@Excel(name = "删除状态(0-正常,1-已删除)", width = 15)
|
||||
@ApiModelProperty(value = "删除状态(0-正常,1-已删除)")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
/**
|
||||
* 创建人
|
||||
*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
/**
|
||||
* 更新人
|
||||
*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
/**
|
||||
* 更新时间
|
||||
*/
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
/**
|
||||
* 公司名称
|
||||
*/
|
||||
@Excel(name = "公司名称", width = 15)
|
||||
@ApiModelProperty(value = "公司名称")
|
||||
private String companyName;
|
||||
/**
|
||||
* 购买的短视频合成时长
|
||||
*/
|
||||
@Excel(name = "购买的短视频合成时长", width = 15)
|
||||
@ApiModelProperty(value = "购买的短视频合成时长")
|
||||
private Integer videoComposeTime;
|
||||
/**
|
||||
* 购买的数字人个数
|
||||
*/
|
||||
@Excel(name = "购买的数字人个数", width = 15)
|
||||
@ApiModelProperty(value = "购买的数字人个数")
|
||||
private Integer modelNum;
|
||||
|
||||
@Excel(name = "使用的数字人个数", width = 15)
|
||||
@ApiModelProperty(value = "使用的数字人个数")
|
||||
private Integer useModelNum;
|
||||
/**
|
||||
* 购买克隆声音数
|
||||
*/
|
||||
@Excel(name = "购买克隆声音数", width = 15)
|
||||
@ApiModelProperty(value = "购买克隆声音数")
|
||||
private Integer cloneSoundNum;
|
||||
/**
|
||||
* 定制的数字人个数
|
||||
*/
|
||||
@Excel(name = "定制的数字人个数", width = 15)
|
||||
@ApiModelProperty(value = "定制的数字人个数")
|
||||
private Integer customizedModelNum;
|
||||
/**
|
||||
* 剩余的数字人个数
|
||||
*/
|
||||
@Excel(name = "剩余的数字人个数", width = 15)
|
||||
@ApiModelProperty(value = "剩余的数字人个数")
|
||||
private Integer remainModelNum;
|
||||
/**
|
||||
* 剩余声音克隆个数
|
||||
*/
|
||||
@Excel(name = "剩余声音克隆个数", width = 15)
|
||||
@ApiModelProperty(value = "剩余声音克隆个数")
|
||||
private Integer remainCloneSoundNum;
|
||||
/**
|
||||
* remainComposeTime
|
||||
*/
|
||||
@Excel(name = "remainComposeTime", width = 15)
|
||||
@ApiModelProperty(value = "remainComposeTime")
|
||||
private Integer remainComposeTime;
|
||||
/**
|
||||
* 短视频合成时长 分
|
||||
*/
|
||||
@Excel(name = "短视频合成时长 分", width = 15)
|
||||
@ApiModelProperty(value = "短视频合成时长 分")
|
||||
private Integer videoComposeMin;
|
||||
/**
|
||||
* 短视频合成时长 秒
|
||||
*/
|
||||
@Excel(name = "短视频合成时长 秒", width = 15)
|
||||
@ApiModelProperty(value = "短视频合成时长 秒")
|
||||
private Integer videoComposeSec;
|
||||
/**
|
||||
* 剩余定制模特数-豪华版(2K)
|
||||
*/
|
||||
@Excel(name = "剩余定制模特数-豪华版(2K)", width = 15)
|
||||
@ApiModelProperty(value = "剩余定制模特数-豪华版(2K)")
|
||||
private Integer remainModeTwoNum;
|
||||
/**
|
||||
* 剩余定制模特数-旗舰版(4K)
|
||||
*/
|
||||
@Excel(name = "剩余定制模特数-旗舰版(4K)", width = 15)
|
||||
@ApiModelProperty(value = "剩余定制模特数-旗舰版(4K)")
|
||||
private Integer remainModeThreeNum;
|
||||
/**
|
||||
* 剩余克隆声音数-基础版
|
||||
*/
|
||||
@Excel(name = "剩余克隆声音数-基础版", width = 15)
|
||||
@ApiModelProperty(value = "剩余克隆声音数-基础版")
|
||||
private Integer remainSoundTwoNum;
|
||||
/**
|
||||
* 剩余克隆声音数-情感版
|
||||
*/
|
||||
@Excel(name = "剩余克隆声音数-情感版", width = 15)
|
||||
@ApiModelProperty(value = "剩余克隆声音数-情感版")
|
||||
private Integer remainSoundThreeNum;
|
||||
/**
|
||||
* 互动并发总数量
|
||||
*/
|
||||
@Excel(name = "互动并发总数量", width = 15)
|
||||
@ApiModelProperty(value = "互动并发总数量")
|
||||
private Integer liveInteractConcurrency;
|
||||
/**
|
||||
* 直播并发总数量
|
||||
*/
|
||||
@Excel(name = "直播并发总数量", width = 15)
|
||||
@ApiModelProperty(value = "直播并发总数量")
|
||||
private Integer liveConcurrency;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package digital.bean.task;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@TableName("mw_train_task")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value = "mw_train_task对象", description = "mw_train_task")
|
||||
public class MwTrainTask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "训练时长")
|
||||
private Integer costTime;
|
||||
|
||||
@ApiModelProperty(value = "任务id")
|
||||
private String taskId;
|
||||
|
||||
@ApiModelProperty(value = "试穿类型 单个single 还是批量 batch ")
|
||||
private String tryOnType;
|
||||
|
||||
@ApiModelProperty(value = "试穿算法 cloth 衣服 hair 发型 ")
|
||||
private String tryOnAlgo;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "服装路径")
|
||||
private String clothPath;
|
||||
|
||||
@ApiModelProperty(value = "模特路径")
|
||||
private String modelPath;
|
||||
|
||||
@ApiModelProperty(value = "平铺图")
|
||||
private String tilePath;
|
||||
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "结果成功还是失败")
|
||||
private String result;
|
||||
|
||||
@ApiModelProperty(value = "请求结果")
|
||||
private String requestResult;
|
||||
|
||||
@ApiModelProperty(value = "回调结果图片url")
|
||||
private String resultImages;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "createdAt")
|
||||
private Date createTime;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "updatedAt")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "删除标识(0-未删除,1-已删除)")
|
||||
@TableLogic
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,232 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>digital-common</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>digital-config</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!--jeecg-tools-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-base-tools</artifactId>
|
||||
</dependency>
|
||||
<!--集成springmvc框架并实现自动配置 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- websocket -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--springboot2.3+ 需引入validation对应的包-->
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springframework.boot</groupId>-->
|
||||
<!-- <artifactId>spring-boot-starter-validation</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!--springboot2.6+解决metrics端点不显示jvm信息的问题-->
|
||||
<dependency>
|
||||
<groupId>io.micrometer</groupId>
|
||||
<artifactId>micrometer-registry-prometheus</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- commons -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>${commons.version}</version>
|
||||
</dependency>
|
||||
<!-- freemarker -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-freemarker</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- mybatis-plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>${mybatis-plus.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- druid -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<version>${druid.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 动态数据源 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>${dynamic-datasource-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 数据库驱动 -->
|
||||
<!--mysql-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>${mysql-connector-java.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- sqlserver-->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>sqljdbc4</artifactId>
|
||||
<version>${sqljdbc4.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- oracle驱动 -->
|
||||
<dependency>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc6</artifactId>
|
||||
<version>${ojdbc6.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- postgresql驱动 -->
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>${postgresql.version}</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!--JWT-->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>${java-jwt.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!--shiro-->
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-spring-boot-starter</artifactId>
|
||||
<version>${shiro.version}</version>
|
||||
</dependency>
|
||||
<!-- shiro-redis -->
|
||||
<dependency>
|
||||
<groupId>org.crazycake</groupId>
|
||||
<artifactId>shiro-redis</artifactId>
|
||||
<version>${shiro-redis.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
</exclusion>
|
||||
<!-- [issues/3596] 解决启动报错:Cannot resolve com.sun:tools:1.8.0 -->
|
||||
<exclusion>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- knife4j -->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-spring-boot-starter</artifactId>
|
||||
<version>${knife4j-spring-boot-starter.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成器 -->
|
||||
<!-- 如下载失败,请参考此文档 http://doc.jeecg.com/2043876 -->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>codegenerate</artifactId>
|
||||
<version>${codegenerate.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- AutoPoi Excel工具类-->
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi-web</artifactId>
|
||||
<version>${autopoi-web.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- mini文件存储服务 -->
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>${guava.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 阿里云短信 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>${aliyun-java-sdk-dysmsapi.version}</version>
|
||||
</dependency>
|
||||
<!-- aliyun oss -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.oss.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- 解决okhttp引用了kotlin,应用启动有警告日志问题 -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.module</groupId>
|
||||
<artifactId>jackson-module-kotlin</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>digital-base</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>digital-util</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>swagger-bootstrap-ui</artifactId>
|
||||
<version>1.9.6</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,28 @@
|
||||
package digital.config;
|
||||
|
||||
import org.jeecgframework.core.util.ApplicationContextUtil;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @Author: Scott
|
||||
* @Date: 2018/2/7
|
||||
* @description: autopoi 配置类
|
||||
*/
|
||||
|
||||
@Configuration
|
||||
public class AutoPoiConfig {
|
||||
|
||||
/**
|
||||
* excel注解字典参数支持(导入导出字典值,自动翻译)
|
||||
* 举例: @Excel(name = "性别", width = 15, dicCode = "sex")
|
||||
* 1、导出的时候会根据字典配置,把值1,2翻译成:男、女;
|
||||
* 2、导入的时候,会把男、女翻译成1,2存进数据库;
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public ApplicationContextUtil applicationContextUtil() {
|
||||
return new org.jeecgframework.core.util.ApplicationContextUtil();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package digital.config;
|
||||
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import digital.util.util.SpringContextHolder;
|
||||
|
||||
/**
|
||||
* SpringContextHolder注册用
|
||||
*
|
||||
* @author: scott
|
||||
* @date: 2020/01/01 16:00
|
||||
*/
|
||||
@Configuration
|
||||
public class CommonConfig {
|
||||
|
||||
/**
|
||||
* Spring上下文工具配置
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SpringContextHolder.class)
|
||||
public SpringContextHolder springContextHolder() {
|
||||
SpringContextHolder holder = new SpringContextHolder();
|
||||
return holder;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package digital.config;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import digital.base.constant.CommonConstant;
|
||||
|
||||
|
||||
/**
|
||||
* 跨域配置加载条件
|
||||
* @author: smcp
|
||||
*/
|
||||
public class CorsFilterCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
Object object = context.getEnvironment().getProperty(CommonConstant.CLOUD_SERVER_KEY);
|
||||
//如果没有服务注册发现的配置 说明是单体应用 则加载跨域配置 返回true
|
||||
if(object==null){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package digital.config;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties;
|
||||
import com.alibaba.druid.util.Utils;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.servlet.*;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @Description: DruidConfig配置类
|
||||
* @author: smcp
|
||||
*/
|
||||
@Configuration
|
||||
@AutoConfigureAfter(DruidDataSourceAutoConfigure.class)
|
||||
public class DruidConfig {
|
||||
|
||||
/**
|
||||
* 带有广告的common.js全路径,druid-1.1.14
|
||||
*/
|
||||
private static final String FILE_PATH = "support/http/resources/js/common.js";
|
||||
/**
|
||||
* 原始脚本,触发构建广告的语句
|
||||
*/
|
||||
private static final String ORIGIN_JS = "this.buildFooter();";
|
||||
/**
|
||||
* 替换后的脚本
|
||||
*/
|
||||
private static final String NEW_JS = "//this.buildFooter();";
|
||||
|
||||
/**
|
||||
* 去除Druid监控页面的广告
|
||||
*
|
||||
* @param properties DruidStatProperties属性集合
|
||||
* @return {@link FilterRegistrationBean}
|
||||
*/
|
||||
@Bean
|
||||
@ConditionalOnWebApplication
|
||||
@ConditionalOnProperty(name = "spring.datasource.druid.stat-view-servlet.enabled", havingValue = "true")
|
||||
public FilterRegistrationBean<RemoveAdFilter> removeDruidAdFilter(
|
||||
DruidStatProperties properties) throws IOException {
|
||||
// 获取web监控页面的参数
|
||||
DruidStatProperties.StatViewServlet config = properties.getStatViewServlet();
|
||||
// 提取common.js的配置路径
|
||||
String pattern = config.getUrlPattern() != null ? config.getUrlPattern() : "/druid/*";
|
||||
String commonJsPattern = pattern.replaceAll("\\*", "js/common.js");
|
||||
// 获取common.js
|
||||
String text = Utils.readFromResource(FILE_PATH);
|
||||
// 屏蔽 this.buildFooter(); 不构建广告
|
||||
final String newJs = text.replace(ORIGIN_JS, NEW_JS);
|
||||
FilterRegistrationBean<RemoveAdFilter> registration = new FilterRegistrationBean<>();
|
||||
registration.setFilter(new RemoveAdFilter(newJs));
|
||||
registration.addUrlPatterns(commonJsPattern);
|
||||
return registration;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除druid的广告过滤器
|
||||
*
|
||||
* @author BBF
|
||||
*/
|
||||
private class RemoveAdFilter implements Filter {
|
||||
|
||||
private final String newJs;
|
||||
|
||||
public RemoveAdFilter(String newJs) {
|
||||
this.newJs = newJs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
|
||||
throws IOException, ServletException {
|
||||
chain.doFilter(request, response);
|
||||
// 重置缓冲区,响应头不会被重置
|
||||
response.resetBuffer();
|
||||
response.getWriter().write(newJs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package digital.config;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
import digital.config.vo.Shiro;
|
||||
|
||||
|
||||
/**
|
||||
* 加载项目配置
|
||||
* @author: smcp
|
||||
*/
|
||||
@Component("jeecgBaseConfig")
|
||||
@ConfigurationProperties(prefix = "jeecg")
|
||||
public class JeecgBaseConfig {
|
||||
/**
|
||||
* 是否启用安全模式
|
||||
*/
|
||||
private Boolean safeMode = false;
|
||||
/**
|
||||
* shiro拦截排除
|
||||
*/
|
||||
private Shiro shiro;
|
||||
/**
|
||||
* 签名密钥串(字典等敏感接口)
|
||||
* @TODO 降低使用成本加的默认值,实际以 yml配置 为准
|
||||
*/
|
||||
private String signatureSecret = "dd05f1c54d63749eda95f9fa6d49v442a";
|
||||
|
||||
public Boolean getSafeMode() {
|
||||
return safeMode;
|
||||
}
|
||||
|
||||
public void setSafeMode(Boolean safeMode) {
|
||||
this.safeMode = safeMode;
|
||||
}
|
||||
|
||||
public String getSignatureSecret() {
|
||||
return signatureSecret;
|
||||
}
|
||||
|
||||
public void setSignatureSecret(String signatureSecret) {
|
||||
this.signatureSecret = signatureSecret;
|
||||
}
|
||||
|
||||
public Shiro getShiro() {
|
||||
return shiro;
|
||||
}
|
||||
|
||||
public void setShiro(Shiro shiro) {
|
||||
this.shiro = shiro;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package digital.config;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Condition;
|
||||
import org.springframework.context.annotation.ConditionContext;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import digital.base.constant.CommonConstant;
|
||||
|
||||
|
||||
/**
|
||||
* 微服务环境加载条件
|
||||
* @author: smcp
|
||||
*/
|
||||
public class JeecgCloudCondition implements Condition {
|
||||
|
||||
@Override
|
||||
public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
|
||||
Object object = context.getEnvironment().getProperty(CommonConstant.CLOUD_SERVER_KEY);
|
||||
//如果没有服务注册发现的配置 说明是单体应用
|
||||
if(object==null){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package digital.config;
|
||||
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import digital.util.util.oConvertUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* author: damao
|
||||
* date:2022-09-15 11:54
|
||||
* description:
|
||||
**/
|
||||
public class MyLocaleResolver implements LocaleResolver {
|
||||
@Override
|
||||
public Locale resolveLocale(HttpServletRequest req) {
|
||||
//获取请求中的参数链接
|
||||
String language = req.getHeader("langType");//前端传递的参数用来判断中文还是英文
|
||||
Locale locale = Locale.getDefault();//获取默认Locale
|
||||
if (!oConvertUtils.isEmpty(language)) {//判断传递参数是否为空
|
||||
locale = new Locale(language);
|
||||
}
|
||||
return locale;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package digital.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.http.client.ClientHttpRequestFactory;
|
||||
import org.springframework.http.client.SimpleClientHttpRequestFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
/**
|
||||
* 优雅的http请求方式RestTemplate
|
||||
* @author: smcp
|
||||
* @Return:
|
||||
*/
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate(ClientHttpRequestFactory factory) {
|
||||
return new RestTemplate(factory);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClientHttpRequestFactory simpleClientHttpRequestFactory() {
|
||||
SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory();
|
||||
//ms毫秒
|
||||
factory.setReadTimeout(7200*1000);
|
||||
//ms毫秒
|
||||
factory.setConnectTimeout(7200*1000);
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//package digital.config;
|
||||
//
|
||||
//import lombok.Data;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
///**
|
||||
// * 设置静态参数初始化
|
||||
// * @author: smcp
|
||||
// */
|
||||
//@Component
|
||||
//@Data
|
||||
//public class StaticConfig {
|
||||
//
|
||||
// @Value("${jeecg.oss.accessKey}")
|
||||
// private String accessKeyId;
|
||||
//
|
||||
// @Value("${jeecg.oss.secretKey}")
|
||||
// private String accessKeySecret;
|
||||
//
|
||||
// @Value(value = "${spring.mail.username}")
|
||||
// private String emailFrom;
|
||||
//
|
||||
//// /**
|
||||
//// * 签名密钥串
|
||||
//// */
|
||||
//// @Value(value = "${jeecg.signatureSecret}")
|
||||
//// private String signatureSecret;
|
||||
//
|
||||
//
|
||||
// /*@Bean
|
||||
// public void initStatic() {
|
||||
// DySmsHelper.setAccessKeyId(accessKeyId);
|
||||
// DySmsHelper.setAccessKeySecret(accessKeySecret);
|
||||
// EmailSendMsgHandle.setEmailFrom(emailFrom);
|
||||
// }*/
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,184 @@
|
||||
package digital.config;
|
||||
|
||||
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping;
|
||||
import digital.base.constant.CommonConstant;
|
||||
import springfox.bean.validators.configuration.BeanValidatorPluginsConfiguration;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.ParameterBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.schema.ModelRef;
|
||||
import springfox.documentation.service.*;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider;
|
||||
import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author scott
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2 //开启 Swagger2
|
||||
@EnableKnife4j //开启 knife4j,可以不写
|
||||
@Import(BeanValidatorPluginsConfiguration.class)
|
||||
public class Swagger2Config implements WebMvcConfigurer {
|
||||
|
||||
/**
|
||||
* 解决springboot2.6 和springfox不兼容问题
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public static BeanPostProcessor springfoxHandlerProviderBeanPostProcessor() {
|
||||
return new BeanPostProcessor() {
|
||||
|
||||
@Override
|
||||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||
if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) {
|
||||
customizeSpringfoxHandlerMappings(getHandlerMappings(bean));
|
||||
}
|
||||
return bean;
|
||||
}
|
||||
|
||||
private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) {
|
||||
List<T> copy = mappings.stream()
|
||||
.filter(mapping -> mapping.getPatternParser() == null)
|
||||
.collect(Collectors.toList());
|
||||
mappings.clear();
|
||||
mappings.addAll(copy);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) {
|
||||
try {
|
||||
Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings");
|
||||
field.setAccessible(true);
|
||||
return (List<RequestMappingInfoHandlerMapping>) field.get(bean);
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* 显示swagger-ui.html文档展示页,还必须注入swagger资源:
|
||||
*
|
||||
* @param registry
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
||||
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
||||
}
|
||||
|
||||
/**
|
||||
* swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等
|
||||
*
|
||||
* @return Docket
|
||||
*/
|
||||
|
||||
@Bean(value = "digital-application")
|
||||
public Docket zitaApplication() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo()).groupName("换装服务")
|
||||
.select()
|
||||
//此包路径下的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.basePackage("digital.application"))
|
||||
//加了ApiOperation注解的类,才生成接口文档
|
||||
.apis(RequestHandlerSelectors.withClassAnnotation(RestController.class))
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.securitySchemes(Collections.singletonList(securityScheme()))
|
||||
.securityContexts(securityContexts());
|
||||
//.globalOperationParameters(setHeaderToken());
|
||||
}
|
||||
|
||||
/***
|
||||
* oauth2配置
|
||||
* 需要增加swagger授权回调地址
|
||||
* http://localhost:8888/webjars/springfox-swagger-ui/o2c.html
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
SecurityScheme securityScheme() {
|
||||
return new ApiKey(CommonConstant.X_ACCESS_TOKEN, CommonConstant.X_ACCESS_TOKEN, "header");
|
||||
}
|
||||
|
||||
/**
|
||||
* JWT token
|
||||
* @return
|
||||
*/
|
||||
private List<Parameter> setHeaderToken() {
|
||||
ParameterBuilder tokenPar = new ParameterBuilder();
|
||||
List<Parameter> pars = new ArrayList<>();
|
||||
tokenPar.name(CommonConstant.X_ACCESS_TOKEN).description("token").modelRef(new ModelRef("string")).parameterType("header").required(false).build();
|
||||
pars.add(tokenPar.build());
|
||||
return pars;
|
||||
}
|
||||
|
||||
/**
|
||||
* api文档的详细信息函数,注意这里的注解引用的是哪个
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
// //大标题
|
||||
.title("换装体验API接口文档")
|
||||
// 版本号
|
||||
.version("1.0")
|
||||
// .termsOfServiceUrl("NO terms of service")
|
||||
// 描述
|
||||
.description("后台API接口")
|
||||
// 作者
|
||||
.contact(new Contact("zita", "", ""))
|
||||
// .contact("JEECG团队")
|
||||
.license("The Apache License, Version 2.0")
|
||||
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增 securityContexts 保持登录状态
|
||||
*/
|
||||
private List<SecurityContext> securityContexts() {
|
||||
return new ArrayList(
|
||||
Collections.singleton(SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.forPaths(PathSelectors.regex("^(?!auth).*$"))
|
||||
.build())
|
||||
);
|
||||
}
|
||||
|
||||
private List<SecurityReference> defaultAuth() {
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
return new ArrayList(
|
||||
Collections.singleton(new SecurityReference(CommonConstant.X_ACCESS_TOKEN, authorizationScopes)));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
package digital.config;
|
||||
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class ThreadPoolConfiguration {
|
||||
|
||||
@Bean(name = "defaultThreadPoolExecutor", destroyMethod = "shutdown")
|
||||
public ThreadPoolExecutor systemCheckPoolExecutorService() {
|
||||
|
||||
return new ThreadPoolExecutor(3, 10, 60, TimeUnit.SECONDS,
|
||||
new LinkedBlockingQueue<Runnable>(10000),
|
||||
new ThreadFactoryBuilder().setNameFormat("default-executor-%d").build(),
|
||||
(r, executor) -> log.error("system pool is full! "));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package digital.config;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
|
||||
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
|
||||
import io.micrometer.prometheus.PrometheusMeterRegistry;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
//import org.springframework.boot.actuate.trace.http.InMemoryHttpTraceRepository;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.LocaleResolver;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Spring Boot 2.0 解决跨域问题
|
||||
*
|
||||
* @Author qinfeng
|
||||
*
|
||||
*/
|
||||
@Configuration
|
||||
public class WebMvcConfiguration implements WebMvcConfigurer {
|
||||
|
||||
@Value("${jeecg.path.upload}")
|
||||
private String upLoadPath;
|
||||
@Value("${jeecg.path.webapp}")
|
||||
private String webAppPath;
|
||||
@Value("${spring.resource.static-locations}")
|
||||
private String staticLocations;
|
||||
|
||||
@Autowired(required = false)
|
||||
private PrometheusMeterRegistry prometheusMeterRegistry;
|
||||
|
||||
/**
|
||||
* 国际化配置
|
||||
*/
|
||||
@Bean
|
||||
public LocaleResolver localeResolver(){
|
||||
return new MyLocaleResolver();
|
||||
}
|
||||
|
||||
/**
|
||||
* 静态资源的配置 - 使得可以从磁盘中读取 Html、图片、视频、音频等
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/**")
|
||||
//update-begin-author:taoyan date:20211116 for: jeecg.path.webapp配置无效 #3126
|
||||
.addResourceLocations("file:" + upLoadPath + "//")
|
||||
.addResourceLocations("file:" + webAppPath + "//")
|
||||
//update-end-author:taoyan date:20211116 for: jeecg.path.webapp配置无效 #3126
|
||||
.addResourceLocations(staticLocations.split(","));
|
||||
}
|
||||
|
||||
/**
|
||||
* 方案一: 默认访问根路径跳转 doc.html页面 (swagger文档页面)
|
||||
* 方案二: 访问根路径改成跳转 index.html页面 (简化部署方案: 可以把前端打包直接放到项目的 webapp,上面的配置)
|
||||
*/
|
||||
@Override
|
||||
public void addViewControllers(ViewControllerRegistry registry) {
|
||||
registry.addViewController("/").setViewName("doc.html");
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Conditional(CorsFilterCondition.class)
|
||||
public CorsFilter corsFilter() {
|
||||
final UrlBasedCorsConfigurationSource urlBasedCorsConfigurationSource = new UrlBasedCorsConfigurationSource();
|
||||
final CorsConfiguration corsConfiguration = new CorsConfiguration();
|
||||
//是否允许请求带有验证信息
|
||||
corsConfiguration.setAllowCredentials(true);
|
||||
// 允许访问的客户端域名
|
||||
corsConfiguration.addAllowedOriginPattern("*");
|
||||
// 允许服务端访问的客户端请求头
|
||||
corsConfiguration.addAllowedHeader("*");
|
||||
// 允许访问的方法名,GET POST等
|
||||
corsConfiguration.addAllowedMethod("*");
|
||||
urlBasedCorsConfigurationSource.registerCorsConfiguration("/**", corsConfiguration);
|
||||
return new CorsFilter(urlBasedCorsConfigurationSource);
|
||||
}
|
||||
@Override
|
||||
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
|
||||
MappingJackson2HttpMessageConverter jackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter(objectMapper());
|
||||
converters.add(jackson2HttpMessageConverter);
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义ObjectMapper
|
||||
*/
|
||||
@Bean
|
||||
@Primary
|
||||
public ObjectMapper objectMapper() {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
//处理bigDecimal
|
||||
objectMapper.enable(JsonGenerator.Feature.WRITE_BIGDECIMAL_AS_PLAIN);
|
||||
objectMapper.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
|
||||
//处理失败
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES, false);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_FOR_PRIMITIVES, false);
|
||||
objectMapper.configure(DeserializationFeature.FAIL_ON_NULL_CREATOR_PROPERTIES, false);
|
||||
//默认的处理日期时间格式
|
||||
objectMapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
JavaTimeModule javaTimeModule = new JavaTimeModule();
|
||||
javaTimeModule.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
javaTimeModule.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
javaTimeModule.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
javaTimeModule.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
javaTimeModule.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
|
||||
javaTimeModule.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
objectMapper.registerModule(javaTimeModule);
|
||||
return objectMapper;
|
||||
}
|
||||
|
||||
/**
|
||||
* SpringBootAdmin的Httptrace不见了
|
||||
* https://blog.csdn.net/u013810234/article/details/110097201
|
||||
*/
|
||||
// @Bean
|
||||
// public InMemoryHttpTraceRepository getInMemoryHttpTrace(){
|
||||
// return new InMemoryHttpTraceRepository();
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 解决metrics端点不显示jvm信息的问题(zyf)
|
||||
*/
|
||||
@Bean
|
||||
InitializingBean forcePrometheusPostProcessor(BeanPostProcessor meterRegistryPostProcessor) {
|
||||
return () -> meterRegistryPostProcessor.postProcessAfterInitialization(prometheusMeterRegistry, "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package digital.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.socket.server.standard.ServerEndpointExporter;
|
||||
|
||||
/**
|
||||
* @Description: WebSocketConfig
|
||||
* @author: smcp
|
||||
*/
|
||||
@Configuration
|
||||
public class WebSocketConfig {
|
||||
/**
|
||||
* 注入ServerEndpointExporter,
|
||||
* 这个bean会自动注册使用了@ServerEndpoint注解声明的Websocket endpoint
|
||||
*/
|
||||
@Bean
|
||||
public ServerEndpointExporter serverEndpointExporter() {
|
||||
return new ServerEndpointExporter();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package digital.config.filter;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* author: smcp
|
||||
* date:2022-08-08 16:31
|
||||
* description:
|
||||
**/
|
||||
|
||||
@Configuration
|
||||
public class FilterConfig {
|
||||
// @Resource
|
||||
// private MyAesFilter myAesFilter;
|
||||
//
|
||||
// @Bean
|
||||
// public FilterRegistrationBean testFilterRegistration() {
|
||||
// FilterRegistrationBean registration = new FilterRegistrationBean(myAesFilter);
|
||||
// registration.addUrlPatterns("/*");
|
||||
// registration.setName("myAesFilter");
|
||||
// registration.setOrder(1);
|
||||
// return registration;
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package digital.config.filter;
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import digital.util.encryption.AesEncryptUtil;
|
||||
|
||||
import javax.servlet.FilterConfig;
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
|
||||
/**
|
||||
* author: smcp
|
||||
* date:2022-08-08 16:23
|
||||
* description:
|
||||
**/
|
||||
//@Component
|
||||
@Slf4j
|
||||
public class MyAesFilter implements Filter {
|
||||
// @Value("${admin.encrypt.excludeUrl}")
|
||||
private String ignoreStr;
|
||||
private String[] ignoreArr;
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/**
|
||||
* 有错误相应返回-44
|
||||
*
|
||||
* @param response
|
||||
* @throws IOException
|
||||
*/
|
||||
private void getFailResponse(HttpServletResponse response) throws IOException {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
PrintWriter out = null;
|
||||
out = response.getWriter();
|
||||
// out.write("{\n" +
|
||||
// " \"status\":"+ Constant.ENCRYPT_FAIL +",\n" +
|
||||
// " \"message\": null,\n" +
|
||||
// " \"data\": []\n" +
|
||||
// "}");
|
||||
//加密后的错误消息
|
||||
out.write("+D+JO8tuwkrNbxnTTLdqStifmQceT+LlYETnIG/JZKrbAn+gIiqIp3VbzBV1y6R8B7aY53VM2xHa7cY3Osbnqw==");
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) {
|
||||
// if (ignoreArr != null) {
|
||||
// ignoreArr = ignoreStr.split(",");
|
||||
// }
|
||||
// HttpServletRequest HttpRequest = (HttpServletRequest) request;
|
||||
// HttpServletResponse HttpResponse = (HttpServletResponse) response;
|
||||
// boolean flag = isIgnore(HttpRequest, ignoreArr);
|
||||
// if (flag) {
|
||||
// try {
|
||||
// chain.doFilter(HttpRequest, HttpResponse);
|
||||
// } catch (IOException e) {
|
||||
// e.printStackTrace();
|
||||
// } catch (ServletException e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// } else {
|
||||
try {
|
||||
//响应处理 包装响应对象 res 并缓存响应数据
|
||||
ResponseWrapper responseWrapper = new ResponseWrapper((HttpServletResponse) response);
|
||||
//执行业务逻辑 交给下一个过滤器或servlet处理
|
||||
chain.doFilter(request, responseWrapper);
|
||||
byte[] resData = responseWrapper.getResponseData();
|
||||
//设置响应内容格式,防止解析响应内容时出错
|
||||
// responseWrapper.setContentType("text/plain;charset=UTF-8");
|
||||
//加密响应报文并响应
|
||||
String encryptBASE64 = AesEncryptUtil.encrypt(new String(resData));
|
||||
PrintWriter out = response.getWriter();
|
||||
out.print(encryptBASE64);
|
||||
out.flush();
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
getFailResponse((HttpServletResponse) response);
|
||||
} catch (IOException ioException) {
|
||||
ioException.printStackTrace();
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
/**
|
||||
* 哪些路径不处理
|
||||
*
|
||||
* @param request
|
||||
* @param strArr
|
||||
* @return
|
||||
*/
|
||||
public boolean isIgnore(HttpServletRequest request, String[] strArr) {
|
||||
String path = request.getRequestURI();
|
||||
for (String ignore : strArr) {
|
||||
if (path.contains(ignore)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
+145
@@ -0,0 +1,145 @@
|
||||
package digital.config.filter;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* author: smcp
|
||||
* date:2022-08-08 17:48
|
||||
* description:
|
||||
**/
|
||||
public class RequestWrapper extends HttpServletRequestWrapper {
|
||||
private String requestBody = null;
|
||||
//请求体
|
||||
private HttpServletRequest req = null;
|
||||
// private final byte[] body;//保存流的字节数组
|
||||
private final Map<String, String> reqHeaders=new HashMap<>();
|
||||
public RequestWrapper(HttpServletRequest request) throws IOException {
|
||||
super(request);
|
||||
this.req = request;
|
||||
// this.reqHeaders = new HashMap<String, String>();
|
||||
// String sessionStream = getRequestBodyStr(request);//读取流中的参数
|
||||
// body = sessionStream.getBytes(Charset.forName("UTF-8"));
|
||||
}
|
||||
public RequestWrapper(HttpServletRequest request, String requestBody) {
|
||||
super(request);
|
||||
this.requestBody = requestBody;
|
||||
this.req = request;
|
||||
// this.reqHeaders = request.get;
|
||||
}
|
||||
/**
|
||||
* @Description: 获取请求body
|
||||
* @Date: 2020/5/26 10:31
|
||||
* @Param: [request]
|
||||
* @Return: java.lang.String
|
||||
*/
|
||||
public String getRequestBodyStr(final ServletRequest request) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
InputStream inputStream = null;
|
||||
BufferedReader reader = null;
|
||||
try {
|
||||
inputStream = cloneInputStream(request.getInputStream());
|
||||
reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
|
||||
String line = "";
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
if (reader != null) {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
/**
|
||||
* @Description: 复制输入流
|
||||
* @Param: [inputStream]
|
||||
* @Return: java.io.InputStream
|
||||
*/
|
||||
public InputStream cloneInputStream(ServletInputStream inputStream) throws IOException {
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
while ((len = inputStream.read(buffer)) > -1) {
|
||||
byteArrayOutputStream.write(buffer, 0, len);
|
||||
}
|
||||
byteArrayOutputStream.flush();
|
||||
InputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
||||
return byteArrayInputStream;
|
||||
}
|
||||
@Override
|
||||
public BufferedReader getReader() throws IOException {
|
||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||
}
|
||||
@Override
|
||||
public ServletInputStream getInputStream() throws IOException {
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(requestBody.getBytes(req.getCharacterEncoding()));
|
||||
return new ServletInputStream() {
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
}
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return bais.read();
|
||||
}
|
||||
};
|
||||
}
|
||||
/**
|
||||
* 添加header的名称和值
|
||||
*
|
||||
* @param name
|
||||
* @param value
|
||||
*/
|
||||
public void addHeader(String name, String value) {
|
||||
reqHeaders.put(name, value);
|
||||
}
|
||||
@Override
|
||||
public String getHeader(String name) {
|
||||
// log.info("getHeader --->{}", name);
|
||||
String headerValue = super.getHeader(name);
|
||||
if (reqHeaders.containsKey(name)) {
|
||||
headerValue = reqHeaders.get(name);
|
||||
}
|
||||
return headerValue;
|
||||
}
|
||||
/**
|
||||
* 得到headers的名称
|
||||
*/
|
||||
@Override
|
||||
public Enumeration<String> getHeaderNames() {
|
||||
List<String> names = Collections.list(super.getHeaderNames());
|
||||
for (String name : reqHeaders.keySet()) {
|
||||
names.add(name);
|
||||
}
|
||||
return Collections.enumeration(names);
|
||||
}
|
||||
@Override
|
||||
public Enumeration<String> getHeaders(String name) {
|
||||
// log.info("getHeaders name --->>>>>>{}", name);
|
||||
List<String> values = Collections.list(super.getHeaders(name));
|
||||
// log.info("getHeaders value --->>>>>>{}", values);
|
||||
if (reqHeaders.containsKey(name)) {
|
||||
values = Arrays.asList(reqHeaders.get(name));
|
||||
}
|
||||
return Collections.enumeration(values);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package digital.config.filter;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.WriteListener;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpServletResponseWrapper;
|
||||
import java.io.*;
|
||||
|
||||
/**
|
||||
* author: smcp
|
||||
* date:2022-08-08 17:49
|
||||
* description:
|
||||
**/
|
||||
public class ResponseWrapper extends HttpServletResponseWrapper {
|
||||
private ByteArrayOutputStream buffer = null;
|
||||
private ServletOutputStream out = null;
|
||||
private PrintWriter writer = null;
|
||||
public ResponseWrapper(HttpServletResponse response) throws IOException {
|
||||
super(response);
|
||||
buffer = new ByteArrayOutputStream();// 真正存储数据的流
|
||||
out = new WapperedOutputStream(buffer);
|
||||
writer = new PrintWriter(new OutputStreamWriter(buffer,this.getCharacterEncoding()));
|
||||
}
|
||||
/** 重载父类获取outputstream的方法 */
|
||||
@Override
|
||||
public ServletOutputStream getOutputStream() throws IOException {
|
||||
return out;
|
||||
}
|
||||
/** 重载父类获取writer的方法 */
|
||||
@Override
|
||||
public PrintWriter getWriter() throws UnsupportedEncodingException {
|
||||
return writer;
|
||||
}
|
||||
/** 重载父类获取flushBuffer的方法 */
|
||||
@Override
|
||||
public void flushBuffer() throws IOException {
|
||||
if (out != null) {
|
||||
out.flush();
|
||||
}
|
||||
if (writer != null) {
|
||||
writer.flush();
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void reset() {
|
||||
buffer.reset();
|
||||
}
|
||||
/** 将out、writer中的数据强制输出到WapperedResponse的buffer里面,否则取不到数据 */
|
||||
public byte[] getResponseData() throws IOException {
|
||||
flushBuffer();
|
||||
return buffer.toByteArray();
|
||||
}
|
||||
/** 内部类,对ServletOutputStream进行包装 */
|
||||
private class WapperedOutputStream extends ServletOutputStream {
|
||||
private ByteArrayOutputStream bos = null;
|
||||
public WapperedOutputStream(ByteArrayOutputStream stream)
|
||||
throws IOException {
|
||||
bos = stream;
|
||||
}
|
||||
@Override
|
||||
public void write(int b) throws IOException {
|
||||
bos.write(b);
|
||||
}
|
||||
@Override
|
||||
public void write(byte[] b) throws IOException {
|
||||
bos.write(b, 0, b.length);
|
||||
}
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public void setWriteListener(WriteListener writeListener) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
//package digital.config.mns;
|
||||
//
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//
|
||||
//@Configuration
|
||||
//@ConfigurationProperties(prefix = "mns")
|
||||
//public class MnsConfiguration {
|
||||
//
|
||||
// @Value("${mns.accountEndpoint}")
|
||||
// private String accountEndpoint;
|
||||
// @Value("${mns.accessKeyId}")
|
||||
// private String accessKeyId;
|
||||
//
|
||||
// @Value("${mns.accessKeySecret}")
|
||||
// private String accessKeySecret;
|
||||
//
|
||||
// public String getAccountEndpoint() {
|
||||
// return accountEndpoint;
|
||||
// }
|
||||
//
|
||||
// public void setAccountEndpoint(String accountEndpoint) {
|
||||
// this.accountEndpoint = accountEndpoint;
|
||||
// }
|
||||
//
|
||||
// public String getAccessKeyId() {
|
||||
// return accessKeyId;
|
||||
// }
|
||||
//
|
||||
// public void setAccessKeyId(String accessKeyId) {
|
||||
// this.accessKeyId = accessKeyId;
|
||||
// }
|
||||
//
|
||||
// public String getAccessKeySecret() {
|
||||
// return accessKeySecret;
|
||||
// }
|
||||
//
|
||||
// public void setAccessKeySecret(String accessKeySecret) {
|
||||
// this.accessKeySecret = accessKeySecret;
|
||||
// }
|
||||
//}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
//package digital.config.mqtoken;
|
||||
//
|
||||
//import javax.servlet.*;
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//import java.io.IOException;
|
||||
//
|
||||
///**
|
||||
// * 存放临时令牌Token到线程上下文
|
||||
// *
|
||||
// * 供队列、定时任务 feign调用使用(解决无会话Token问题)
|
||||
// * @author zyf
|
||||
// */
|
||||
//public class TransmitUserTokenFilter implements Filter {
|
||||
//
|
||||
// private static String X_ACCESS_TOKEN="X-Access-Token";
|
||||
//
|
||||
// public TransmitUserTokenFilter() {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void init(FilterConfig filterConfig) throws ServletException {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
// this.initUserInfo((HttpServletRequest) request);
|
||||
// chain.doFilter(request, response);
|
||||
// }
|
||||
//
|
||||
// private void initUserInfo(HttpServletRequest request) {
|
||||
// String token = request.getHeader(X_ACCESS_TOKEN);
|
||||
// if (token!=null) {
|
||||
// try {
|
||||
// //将Token放入当前线程上下文中
|
||||
// UserTokenContext.setToken(token);
|
||||
// } catch (Exception e) {
|
||||
// //e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void destroy() {
|
||||
// }
|
||||
//}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package digital.config.mqtoken;
|
||||
|
||||
|
||||
/**
|
||||
* 用户Token线程上下文
|
||||
*
|
||||
* 供队列、定时任务 feign调用使用(解决无会话Token问题)
|
||||
* @author zyf
|
||||
*/
|
||||
public class UserTokenContext {
|
||||
|
||||
/**
|
||||
* 当前线程的TOKEN副本
|
||||
*/
|
||||
private static ThreadLocal<String> userToken = new ThreadLocal<String>();
|
||||
|
||||
public UserTokenContext() {
|
||||
}
|
||||
|
||||
public static String getToken(){
|
||||
return userToken.get();
|
||||
}
|
||||
|
||||
public static void setToken(String token){
|
||||
userToken.set(token);
|
||||
}
|
||||
|
||||
public static void remove() {
|
||||
userToken.remove();
|
||||
}
|
||||
}
|
||||
+129
@@ -0,0 +1,129 @@
|
||||
//package digital.config.mybatis;
|
||||
//
|
||||
//import net.sf.jsqlparser.expression.BinaryExpression;
|
||||
//import net.sf.jsqlparser.expression.Expression;
|
||||
//import net.sf.jsqlparser.expression.Parenthesis;
|
||||
//import net.sf.jsqlparser.expression.operators.conditional.AndExpression;
|
||||
//import net.sf.jsqlparser.expression.operators.conditional.OrExpression;
|
||||
//import net.sf.jsqlparser.expression.operators.relational.*;
|
||||
//import net.sf.jsqlparser.schema.Column;
|
||||
//import net.sf.jsqlparser.schema.Table;
|
||||
//import net.sf.jsqlparser.statement.select.*;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * 复写租户条件
|
||||
// */
|
||||
//public class JeecgTenantParser extends TenantSqlParser {
|
||||
//
|
||||
// /**
|
||||
// * @param expression
|
||||
// * @param table
|
||||
// * @return
|
||||
// */
|
||||
// protected Expression processTableAlias(Expression expression, Table table) {
|
||||
// String tableAliasName;
|
||||
// if (table.getAlias() == null) {
|
||||
// tableAliasName = table.getName();
|
||||
// } else {
|
||||
// tableAliasName = table.getAlias().getName();
|
||||
// }
|
||||
//
|
||||
// // in
|
||||
// if (expression instanceof InExpression) {
|
||||
// InExpression in = (InExpression) expression;
|
||||
// if (in.getLeftExpression() instanceof Column) {
|
||||
// setTableAliasNameForColumn((Column) in.getLeftExpression(), tableAliasName);
|
||||
// }
|
||||
//
|
||||
// // 比较操作
|
||||
// } else if (expression instanceof BinaryExpression) {
|
||||
// BinaryExpression compare = (BinaryExpression) expression;
|
||||
// if (compare.getLeftExpression() instanceof Column) {
|
||||
// setTableAliasNameForColumn((Column) compare.getLeftExpression(), tableAliasName);
|
||||
// } else if (compare.getRightExpression() instanceof Column) {
|
||||
// setTableAliasNameForColumn((Column) compare.getRightExpression(), tableAliasName);
|
||||
// }
|
||||
//
|
||||
// // between
|
||||
// } else if (expression instanceof Between) {
|
||||
// Between between = (Between) expression;
|
||||
// if (between.getLeftExpression() instanceof Column) {
|
||||
// setTableAliasNameForColumn((Column) between.getLeftExpression(), tableAliasName);
|
||||
// }
|
||||
// }
|
||||
// return expression;
|
||||
// }
|
||||
//
|
||||
// private void setTableAliasNameForColumn(Column column, String tableAliasName) {
|
||||
// column.setColumnName(tableAliasName + "." + column.getColumnName());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 默认是按 tenant_id=1 按等于条件追加
|
||||
// *
|
||||
// * @param currentExpression 现有的条件:比如你原来的sql查询条件
|
||||
// * @param table
|
||||
// * @return
|
||||
// */
|
||||
// @Override
|
||||
// protected Expression builderExpression(Expression currentExpression, Table table) {
|
||||
// final Expression tenantExpression = this.getTenantHandler().getTenantId(true);
|
||||
// Expression appendExpression;
|
||||
// if (!(tenantExpression instanceof SupportsOldOracleJoinSyntax)) {
|
||||
// appendExpression = new EqualsTo();
|
||||
// ((EqualsTo) appendExpression).setLeftExpression(this.getAliasColumn(table));
|
||||
// ((EqualsTo) appendExpression).setRightExpression(tenantExpression);
|
||||
// } else {
|
||||
// appendExpression = processTableAlias(tenantExpression, table);
|
||||
// }
|
||||
// if (currentExpression == null) {
|
||||
// return appendExpression;
|
||||
// }
|
||||
// if (currentExpression instanceof BinaryExpression) {
|
||||
// BinaryExpression binaryExpression = (BinaryExpression) currentExpression;
|
||||
// if (binaryExpression.getLeftExpression() instanceof FromItem) {
|
||||
// processFromItem((FromItem) binaryExpression.getLeftExpression());
|
||||
// }
|
||||
// if (binaryExpression.getRightExpression() instanceof FromItem) {
|
||||
// processFromItem((FromItem) binaryExpression.getRightExpression());
|
||||
// }
|
||||
// } else if (currentExpression instanceof InExpression) {
|
||||
// InExpression inExp = (InExpression) currentExpression;
|
||||
// ItemsList rightItems = inExp.getRightItemsList();
|
||||
// if (rightItems instanceof SubSelect) {
|
||||
// processSelectBody(((SubSelect) rightItems).getSelectBody());
|
||||
// }
|
||||
// }
|
||||
// if (currentExpression instanceof OrExpression) {
|
||||
// return new AndExpression(new Parenthesis(currentExpression), appendExpression);
|
||||
// } else {
|
||||
// return new AndExpression(currentExpression, appendExpression);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void processPlainSelect(PlainSelect plainSelect, boolean addColumn) {
|
||||
// FromItem fromItem = plainSelect.getFromItem();
|
||||
// if (fromItem instanceof Table) {
|
||||
// Table fromTable = (Table) fromItem;
|
||||
// if (!this.getTenantHandler().doTableFilter(fromTable.getName())) {
|
||||
// plainSelect.setWhere(builderExpression(plainSelect.getWhere(), fromTable));
|
||||
// if (addColumn) {
|
||||
// plainSelect.getSelectItems().add(new SelectExpressionItem(new Column(this.getTenantHandler().getTenantIdColumn())));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// processFromItem(fromItem);
|
||||
// }
|
||||
// List<Join> joins = plainSelect.getJoins();
|
||||
// if (joins != null && joins.size() > 0) {
|
||||
// joins.forEach(j -> {
|
||||
// processJoin(j);
|
||||
// processFromItem(j.getRightItem());
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//}
|
||||
+182
@@ -0,0 +1,182 @@
|
||||
package digital.config.mybatis;
|
||||
|
||||
import digital.base.vo.LoginUser;
|
||||
import digital.util.util.SpringContextUtils;
|
||||
import digital.util.util.oConvertUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.binding.MapperMethod.ParamMap;
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.*;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Date;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* mybatis拦截器,自动注入创建人、创建时间、修改人、修改时间
|
||||
* @Author scott
|
||||
* @Date 2019-01-19
|
||||
*
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@Intercepts({ @Signature(type = Executor.class, method = "update", args = { MappedStatement.class, Object.class }) })
|
||||
public class MybatisInterceptor implements Interceptor {
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable {
|
||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||
String sqlId = mappedStatement.getId();
|
||||
log.debug("------sqlId------" + sqlId);
|
||||
SqlCommandType sqlCommandType = mappedStatement.getSqlCommandType();
|
||||
Object parameter = invocation.getArgs()[1];
|
||||
log.debug("------sqlCommandType------" + sqlCommandType);
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
if (parameter == null) {
|
||||
return invocation.proceed();
|
||||
}
|
||||
if (SqlCommandType.INSERT == sqlCommandType) {
|
||||
LoginUser sysUser = this.getLoginUser();
|
||||
Field[] fields = oConvertUtils.getAllFields(parameter);
|
||||
for (Field field : fields) {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
if ("createBy".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object localCreateBy = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (localCreateBy == null || "".equals(localCreateBy)) {
|
||||
if (sysUser != null) {
|
||||
// 登录人账号
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, sysUser.getUsername());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 注入创建时间
|
||||
if ("createTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object localCreateDate = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (localCreateDate == null || "".equals(localCreateDate)) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
//注入部门编码
|
||||
if ("sysOrgCode".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object localSysOrgCode = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (localSysOrgCode == null || "".equals(localSysOrgCode)) {
|
||||
// 获取登录用户信息
|
||||
if (sysUser != null) {
|
||||
field.setAccessible(true);
|
||||
// field.set(parameter, sysUser.getOrgCode());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// 注入appKet
|
||||
if ("appKey".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
Object appKey = field.get(parameter);
|
||||
field.setAccessible(false);
|
||||
if (appKey == null || "".equals(appKey)) {
|
||||
String headAppKey = request.getHeader("appKey");
|
||||
if (oConvertUtils.isNotEmpty(headAppKey)){
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, headAppKey);
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (SqlCommandType.UPDATE == sqlCommandType) {
|
||||
LoginUser sysUser = this.getLoginUser();
|
||||
Field[] fields = null;
|
||||
if (parameter instanceof ParamMap) {
|
||||
ParamMap<?> p = (ParamMap<?>) parameter;
|
||||
//update-begin-author:scott date:20190729 for:批量更新报错issues/IZA3Q--
|
||||
String et = "et";
|
||||
if (p.containsKey(et)) {
|
||||
parameter = p.get(et);
|
||||
} else {
|
||||
parameter = p.get("param1");
|
||||
}
|
||||
//update-end-author:scott date:20190729 for:批量更新报错issues/IZA3Q-
|
||||
|
||||
//update-begin-author:scott date:20190729 for:更新指定字段时报错 issues/#516-
|
||||
if (parameter == null) {
|
||||
return invocation.proceed();
|
||||
}
|
||||
//update-end-author:scott date:20190729 for:更新指定字段时报错 issues/#516-
|
||||
|
||||
fields = oConvertUtils.getAllFields(parameter);
|
||||
} else {
|
||||
fields = oConvertUtils.getAllFields(parameter);
|
||||
}
|
||||
|
||||
for (Field field : fields) {
|
||||
log.debug("------field.name------" + field.getName());
|
||||
try {
|
||||
if ("updateBy".equals(field.getName())) {
|
||||
//获取登录用户信息
|
||||
if (sysUser != null) {
|
||||
// 登录账号
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, sysUser.getUsername());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
}
|
||||
if ("updateTime".equals(field.getName())) {
|
||||
field.setAccessible(true);
|
||||
field.set(parameter, new Date());
|
||||
field.setAccessible(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object plugin(Object target) {
|
||||
return Plugin.wrap(target, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProperties(Properties properties) {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
//update-begin--Author:scott Date:20191213 for:关于使用Quzrtz 开启线程任务, #465
|
||||
/**
|
||||
* 获取登录用户
|
||||
* @return
|
||||
*/
|
||||
private LoginUser getLoginUser() {
|
||||
LoginUser sysUser = null;
|
||||
try {
|
||||
sysUser = SecurityUtils.getSubject().getPrincipal() != null ? (LoginUser) SecurityUtils.getSubject().getPrincipal() : null;
|
||||
} catch (Exception e) {
|
||||
//e.printStackTrace();
|
||||
sysUser = null;
|
||||
}
|
||||
return sysUser;
|
||||
}
|
||||
//update-end--Author:scott Date:20191213 for:关于使用Quzrtz 开启线程任务, #465
|
||||
|
||||
}
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
package digital.config.mybatis;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.handler.TenantLineHandler;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.TenantLineInnerInterceptor;
|
||||
import digital.base.constant.CommonConstant;
|
||||
import digital.util.util.SpringContextUtils;
|
||||
import digital.util.util.oConvertUtils;
|
||||
import net.sf.jsqlparser.expression.Expression;
|
||||
import net.sf.jsqlparser.expression.StringValue;
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 单数据源配置(jeecg.datasource.open = false时生效)
|
||||
*
|
||||
* @Author zhoujf
|
||||
*/
|
||||
@Configuration
|
||||
//@MapperScan(value = {"org.jeecg.modules.**.mapper*", "smcp.**.mapper*"})
|
||||
@MapperScan(value = {"digital.**.mapper*"})
|
||||
public class MybatisPlusSaasConfig {
|
||||
/**
|
||||
* tenant_id 字段名
|
||||
*/
|
||||
private static final String TENANT_FIELD_NAME = "app_key";
|
||||
/**
|
||||
* 哪些表需要做多租户 表需要添加一个字段 tenant_id
|
||||
*/
|
||||
private static final List<String> TENANT_TABLE = new ArrayList<String>();
|
||||
|
||||
static {
|
||||
// TENANT_TABLE.add("audio_manage");
|
||||
// TENANT_TABLE.add("background_manage");
|
||||
// TENANT_TABLE.add("digital_manage");
|
||||
// TENANT_TABLE.add("sys_file");
|
||||
// TENANT_TABLE.add("digital_manage");
|
||||
// TENANT_TABLE.add("video_manage");
|
||||
// //角色、菜单、部门
|
||||
// tenantTable.add("sys_role");
|
||||
// tenantTable.add("sys_permission");
|
||||
// tenantTable.add("sys_depart");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
// 先 add TenantLineInnerInterceptor 再 add PaginationInnerInterceptor
|
||||
interceptor.addInnerInterceptor(new TenantLineInnerInterceptor(new TenantLineHandler() {
|
||||
@Override
|
||||
public Expression getTenantId() {
|
||||
HttpServletRequest request = SpringContextUtils.getHttpServletRequest();
|
||||
if (Objects.isNull(request)) {
|
||||
return new StringValue("");
|
||||
}
|
||||
String tenantId = oConvertUtils.getString(request.getHeader("appKey"), "0");
|
||||
return new StringValue(tenantId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTenantIdColumn() {
|
||||
return TENANT_FIELD_NAME;
|
||||
}
|
||||
|
||||
// 返回 true 表示不走租户逻辑
|
||||
@Override
|
||||
public boolean ignoreTable(String tableName) {
|
||||
HttpServletRequest req = SpringContextUtils.getHttpServletRequest();
|
||||
// String tenantId = req.getHeader(CommonConstant.TENANT_ID);
|
||||
String tenantId = oConvertUtils.getString(TenantContext.getTenant(), "0");
|
||||
//判断是否是超管
|
||||
if (CommonConstant.ADMIN_TENANT_ID.equals(tenantId)) {
|
||||
return true;
|
||||
}
|
||||
for (String temp : TENANT_TABLE) {
|
||||
if (temp.equalsIgnoreCase(tableName)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}));
|
||||
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
interceptor.addInnerInterceptor(new PaginationInnerInterceptor());
|
||||
return interceptor;
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 下个版本会删除,现在为了避免缓存出现问题不得不配置
|
||||
// * @return
|
||||
// */
|
||||
// @Bean
|
||||
// public ConfigurationCustomizer configurationCustomizer() {
|
||||
// return configuration -> configuration.setUseDeprecatedExecutor(false);
|
||||
// }
|
||||
// /**
|
||||
// * mybatis-plus SQL执行效率插件【生产环境可以关闭】
|
||||
// */
|
||||
// @Bean
|
||||
// public PerformanceInterceptor performanceInterceptor() {
|
||||
// return new PerformanceInterceptor();
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package digital.config.mybatis;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* 多租户 tenant_id存储器
|
||||
* @author: smcp
|
||||
*/
|
||||
@Slf4j
|
||||
public class TenantContext {
|
||||
private static ThreadLocal<String> currentTenant = new ThreadLocal<>();
|
||||
|
||||
public static void setTenant(String tenant) {
|
||||
log.debug(" setting tenant to " + tenant);
|
||||
currentTenant.set(tenant);
|
||||
}
|
||||
|
||||
public static String getTenant() {
|
||||
return currentTenant.get();
|
||||
}
|
||||
|
||||
public static void clear(){
|
||||
currentTenant.remove();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
//package digital.config.oss;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Bean;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import digital.base.constant.CommonConstant;
|
||||
//import digital.base.constant.SymbolConstant;
|
||||
//
|
||||
///**
|
||||
// * Minio文件上传配置文件
|
||||
// * @author: smcp
|
||||
// */
|
||||
//@Slf4j
|
||||
//@Configuration
|
||||
//public class MinioConfig {
|
||||
// @Value(value = "${jeecg.minio.minio_url}")
|
||||
// private String minioUrl;
|
||||
// @Value(value = "${jeecg.minio.minio_name}")
|
||||
// private String minioName;
|
||||
// @Value(value = "${jeecg.minio.minio_pass}")
|
||||
// private String minioPass;
|
||||
// @Value(value = "${jeecg.minio.bucketName}")
|
||||
// private String bucketName;
|
||||
//
|
||||
// @Bean
|
||||
// public void initMinio() {
|
||||
// if (!minioUrl.startsWith(CommonConstant.STR_HTTP)) {
|
||||
// minioUrl = "http://" + minioUrl;
|
||||
// }
|
||||
// if (!minioUrl.endsWith(SymbolConstant.SINGLE_SLASH)) {
|
||||
// minioUrl = minioUrl.concat(SymbolConstant.SINGLE_SLASH);
|
||||
// }
|
||||
//// MinioUtil.setMinioUrl(minioUrl);
|
||||
//// MinioUtil.setMinioName(minioName);
|
||||
//// MinioUtil.setMinioPass(minioPass);
|
||||
//// MinioUtil.setBucketName(bucketName);
|
||||
// }
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,39 @@
|
||||
package digital.config.oss;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import digital.util.oss.OssBootUtil;
|
||||
|
||||
/**
|
||||
* 云存储 配置
|
||||
*
|
||||
* @author: smcp
|
||||
*/
|
||||
@Configuration
|
||||
@Data
|
||||
public class OssConfiguration {
|
||||
@Value("${jeecg.oss.endpoint}")
|
||||
private String endpoint;
|
||||
@Value("${jeecg.oss.accessKey}")
|
||||
private String accessKeyId;
|
||||
@Value("${jeecg.oss.secretKey}")
|
||||
private String accessKeySecret;
|
||||
@Value("${jeecg.oss.bucketName}")
|
||||
private String bucketName;
|
||||
@Value("${jeecg.oss.staticDomain}")
|
||||
private String staticDomain;
|
||||
// @Value("${jeecg.oss.callBackUrl}")
|
||||
// private String callBackUrl;
|
||||
|
||||
@Bean
|
||||
public void initOssBootConfiguration() {
|
||||
OssBootUtil.setEndPoint(endpoint);
|
||||
OssBootUtil.setAccessKeyId(accessKeyId);
|
||||
OssBootUtil.setAccessKeySecret(accessKeySecret);
|
||||
OssBootUtil.setBucketName(bucketName);
|
||||
OssBootUtil.setStaticDomain(staticDomain);
|
||||
// OssBootUtil.setCallBackUrl(callBackUrl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package digital.config.shiro;
|
||||
|
||||
import org.apache.shiro.authc.AuthenticationToken;
|
||||
|
||||
/**
|
||||
* @Author Scott
|
||||
* @create 2018-07-12 15:19
|
||||
* @desc
|
||||
**/
|
||||
public class JwtToken implements AuthenticationToken {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String token;
|
||||
|
||||
public JwtToken(String token) {
|
||||
this.token = token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getPrincipal() {
|
||||
return token;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCredentials() {
|
||||
return token;
|
||||
}
|
||||
}
|
||||
+77
@@ -0,0 +1,77 @@
|
||||
package digital.config.shiro.filters;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.mgt.SecurityManager;
|
||||
import org.apache.shiro.spring.web.ShiroFilterFactoryBean;
|
||||
import org.apache.shiro.web.filter.InvalidRequestFilter;
|
||||
import org.apache.shiro.web.filter.mgt.DefaultFilter;
|
||||
import org.apache.shiro.web.filter.mgt.FilterChainManager;
|
||||
import org.apache.shiro.web.filter.mgt.FilterChainResolver;
|
||||
import org.apache.shiro.web.filter.mgt.PathMatchingFilterChainResolver;
|
||||
import org.apache.shiro.web.mgt.WebSecurityManager;
|
||||
import org.apache.shiro.web.servlet.AbstractShiroFilter;
|
||||
import org.springframework.beans.factory.BeanInitializationException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 自定义ShiroFilterFactoryBean解决资源中文路径问题
|
||||
* @author: smcp
|
||||
*/
|
||||
@Slf4j
|
||||
public class CustomShiroFilterFactoryBean extends ShiroFilterFactoryBean {
|
||||
@Override
|
||||
public Class getObjectType() {
|
||||
return MySpringShiroFilter.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractShiroFilter createInstance() throws Exception {
|
||||
|
||||
SecurityManager securityManager = getSecurityManager();
|
||||
if (securityManager == null) {
|
||||
String msg = "SecurityManager property must be set.";
|
||||
throw new BeanInitializationException(msg);
|
||||
}
|
||||
|
||||
if (!(securityManager instanceof WebSecurityManager)) {
|
||||
String msg = "The security manager does not implement the WebSecurityManager interface.";
|
||||
throw new BeanInitializationException(msg);
|
||||
}
|
||||
|
||||
FilterChainManager manager = createFilterChainManager();
|
||||
//Expose the constructed FilterChainManager by first wrapping it in a
|
||||
// FilterChainResolver implementation. The AbstractShiroFilter implementations
|
||||
// do not know about FilterChainManagers - only resolvers:
|
||||
PathMatchingFilterChainResolver chainResolver = new PathMatchingFilterChainResolver();
|
||||
chainResolver.setFilterChainManager(manager);
|
||||
|
||||
Map<String, Filter> filterMap = manager.getFilters();
|
||||
Filter invalidRequestFilter = filterMap.get(DefaultFilter.invalidRequest.name());
|
||||
if (invalidRequestFilter instanceof InvalidRequestFilter) {
|
||||
//此处是关键,设置false跳过URL携带中文400,servletPath中文校验bug
|
||||
((InvalidRequestFilter) invalidRequestFilter).setBlockNonAscii(false);
|
||||
}
|
||||
//Now create a concrete ShiroFilter instance and apply the acquired SecurityManager and built
|
||||
//FilterChainResolver. It doesn't matter that the instance is an anonymous inner class
|
||||
//here - we're just using it because it is a concrete AbstractShiroFilter instance that accepts
|
||||
//injection of the SecurityManager and FilterChainResolver:
|
||||
return new MySpringShiroFilter((WebSecurityManager) securityManager, chainResolver);
|
||||
}
|
||||
|
||||
private static final class MySpringShiroFilter extends AbstractShiroFilter {
|
||||
protected MySpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) {
|
||||
if (webSecurityManager == null) {
|
||||
throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
|
||||
} else {
|
||||
this.setSecurityManager(webSecurityManager);
|
||||
if (resolver != null) {
|
||||
this.setFilterChainResolver(resolver);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
package digital.config.shiro.filters;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.web.filter.authc.BasicHttpAuthenticationFilter;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import digital.base.constant.CommonConstant;
|
||||
import digital.config.mybatis.TenantContext;
|
||||
import digital.config.shiro.JwtToken;
|
||||
import digital.util.util.JwtUtil;
|
||||
import digital.util.util.oConvertUtils;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Description: 鉴权登录拦截器
|
||||
* @Author: Scott
|
||||
* @Date: 2018/10/7
|
||||
**/
|
||||
@Slf4j
|
||||
public class JwtFilter extends BasicHttpAuthenticationFilter {
|
||||
|
||||
/**
|
||||
* 默认开启跨域设置(使用单体)
|
||||
* 微服务情况下,此属性设置为false
|
||||
*/
|
||||
private boolean allowOrigin = true;
|
||||
|
||||
public JwtFilter(){}
|
||||
public JwtFilter(boolean allowOrigin){
|
||||
this.allowOrigin = allowOrigin;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行登录认证
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param mappedValue
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
|
||||
try {
|
||||
executeLogin(request, response);
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
JwtUtil.responseError(response, 401, CommonConstant.TOKEN_IS_INVALID_MSG);
|
||||
return false;
|
||||
//throw new AuthenticationException("Token失效,请重新登录", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
protected boolean executeLogin(ServletRequest request, ServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
String token = httpServletRequest.getHeader(CommonConstant.X_ACCESS_TOKEN);
|
||||
// update-begin--Author:lvdandan Date:20210105 for:JT-355 OA聊天添加token验证,获取token参数
|
||||
if (oConvertUtils.isEmpty(token)) {
|
||||
token = httpServletRequest.getParameter("token");
|
||||
}
|
||||
// update-end--Author:lvdandan Date:20210105 for:JT-355 OA聊天添加token验证,获取token参数
|
||||
|
||||
JwtToken jwtToken = new JwtToken(token);
|
||||
// 提交给realm进行登入,如果错误他会抛出异常并被捕获
|
||||
getSubject(request, response).login(jwtToken);
|
||||
// 如果没有抛出异常则代表登入成功,返回true
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对跨域提供支持
|
||||
*/
|
||||
@Override
|
||||
protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
|
||||
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
|
||||
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
|
||||
if(allowOrigin){
|
||||
httpServletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_ORIGIN, httpServletRequest.getHeader(HttpHeaders.ORIGIN));
|
||||
// 允许客户端请求方法
|
||||
httpServletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_METHODS, "GET,POST,OPTIONS,PUT,DELETE");
|
||||
// 允许客户端提交的Header
|
||||
String requestHeaders = httpServletRequest.getHeader(HttpHeaders.ACCESS_CONTROL_REQUEST_HEADERS);
|
||||
if (StringUtils.isNotEmpty(requestHeaders)) {
|
||||
httpServletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_HEADERS, requestHeaders);
|
||||
}
|
||||
// 允许客户端携带凭证信息(是否允许发送Cookie)
|
||||
httpServletResponse.setHeader(HttpHeaders.ACCESS_CONTROL_ALLOW_CREDENTIALS, "true");
|
||||
}
|
||||
// 跨域时会首先发送一个option请求,这里我们给option请求直接返回正常状态
|
||||
if (RequestMethod.OPTIONS.name().equalsIgnoreCase(httpServletRequest.getMethod())) {
|
||||
httpServletResponse.setStatus(HttpStatus.OK.value());
|
||||
return false;
|
||||
}
|
||||
//update-begin-author:taoyan date:20200708 for:多租户用到
|
||||
String tenantId = httpServletRequest.getHeader(CommonConstant.TENANT_ID);
|
||||
TenantContext.setTenant(tenantId);
|
||||
//update-end-author:taoyan date:20200708 for:多租户用到
|
||||
|
||||
return super.preHandle(request, response);
|
||||
}
|
||||
}
|
||||
+68
@@ -0,0 +1,68 @@
|
||||
package digital.config.shiro.filters;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.apache.shiro.web.filter.AccessControlFilter;
|
||||
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.ServletResponse;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @Author Scott
|
||||
* @create 2019-02-01 15:56
|
||||
* @desc 鉴权请求URL访问权限拦截器
|
||||
*/
|
||||
@Slf4j
|
||||
public class ResourceCheckFilter extends AccessControlFilter {
|
||||
|
||||
private String errorUrl;
|
||||
|
||||
public String getErrorUrl() {
|
||||
return errorUrl;
|
||||
}
|
||||
|
||||
public void setErrorUrl(String errorUrl) {
|
||||
this.errorUrl = errorUrl;
|
||||
}
|
||||
|
||||
/**
|
||||
* 表示是否允许访问 ,如果允许访问返回true,否则false;
|
||||
*
|
||||
* @param servletRequest
|
||||
* @param servletResponse
|
||||
* @param o 表示写在拦截器中括号里面的字符串 mappedValue 就是 [urls] 配置中拦截器参数部分
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
protected boolean isAccessAllowed(ServletRequest servletRequest, ServletResponse servletResponse, Object o) throws Exception {
|
||||
Subject subject = getSubject(servletRequest, servletResponse);
|
||||
String url = getPathWithinApplication(servletRequest);
|
||||
log.info("当前用户正在访问的 url => " + url);
|
||||
return subject.isPermitted(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* onAccessDenied:表示当访问拒绝时是否已经处理了; 如果返回 true 表示需要继续处理; 如果返回 false
|
||||
* 表示该拦截器实例已经处理了,将直接返回即可。
|
||||
*
|
||||
* @param servletRequest
|
||||
* @param servletResponse
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
protected boolean onAccessDenied(ServletRequest servletRequest, ServletResponse servletResponse) throws Exception {
|
||||
log.info("当 isAccessAllowed 返回 false 的时候,才会执行 method onAccessDenied ");
|
||||
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
response.sendRedirect(request.getContextPath() + this.errorUrl);
|
||||
|
||||
// 返回 false 表示已经处理,例如页面跳转啥的,表示不在走以下的拦截器了(如果还有配置的话)
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package digital.config.sign.interceptor;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
/**
|
||||
* 签名 拦截器配置
|
||||
* @author: smcp
|
||||
*/
|
||||
@Configuration
|
||||
public class SignAuthConfiguration implements WebMvcConfigurer {
|
||||
public static String[] SIGN_URL_LIST = new String[]{"/sys/dict/getDictItems/*", "/sys/dict/loadDict/*",
|
||||
"/sys/dict/loadDictOrderByValue/*", "/sys/dict/loadDictItem/*", "/sys/dict/loadTreeData",
|
||||
"/sys/api/queryTableDictItemsByCode", "/sys/api/queryFilterTableDictInfo", "/sys/api/queryTableDictByKeys",
|
||||
"/sys/api/translateDictFromTable", "/sys/api/translateDictFromTableByKeys"};
|
||||
@Bean
|
||||
public SignAuthInterceptor signAuthInterceptor() {
|
||||
return new SignAuthInterceptor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInterceptors(InterceptorRegistry registry) {
|
||||
registry.addInterceptor(signAuthInterceptor()).addPathPatterns(SIGN_URL_LIST);
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
package digital.config.sign.interceptor;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import digital.base.constant.CommonConstant;
|
||||
import digital.base.vo.Result;
|
||||
import digital.config.sign.util.BodyReaderHttpServletRequestWrapper;
|
||||
import digital.config.sign.util.HttpUtils;
|
||||
import digital.config.sign.util.SignUtil;
|
||||
import digital.util.util.DateUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* 签名拦截器
|
||||
* @author qinfeng
|
||||
*/
|
||||
@Slf4j
|
||||
public class SignAuthInterceptor implements HandlerInterceptor {
|
||||
/**
|
||||
* 5分钟有效期
|
||||
*/
|
||||
private final static long MAX_EXPIRE = 5 * 60;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
log.info("request URI = " + request.getRequestURI());
|
||||
HttpServletRequest requestWrapper = new BodyReaderHttpServletRequestWrapper(request);
|
||||
//获取全部参数(包括URL和body上的)
|
||||
SortedMap<String, String> allParams = HttpUtils.getAllParams(requestWrapper);
|
||||
//对参数进行签名验证
|
||||
String headerSign = request.getHeader(CommonConstant.X_SIGN);
|
||||
String xTimestamp = request.getHeader(CommonConstant.X_TIMESTAMP);
|
||||
//客户端时间
|
||||
Long clientTimestamp = Long.parseLong(xTimestamp);
|
||||
|
||||
int length = 14;
|
||||
int length1000 = 1000;
|
||||
//1.校验签名时间(兼容X_TIMESTAMP的新老格式)
|
||||
if (xTimestamp.length() == length) {
|
||||
//a. X_TIMESTAMP格式是 yyyyMMddHHmmss (例子:20220308152143)
|
||||
if ((DateUtils.getCurrentTimestamp() - clientTimestamp) > MAX_EXPIRE) {
|
||||
log.error("签名验证失败:X-TIMESTAMP已过期,注意系统时间和服务器时间是否有误差!");
|
||||
throw new IllegalArgumentException("签名验证失败:X-TIMESTAMP已过期");
|
||||
}
|
||||
} else {
|
||||
//b. X_TIMESTAMP格式是 时间戳 (例子:1646552406000)
|
||||
if ((System.currentTimeMillis() - clientTimestamp) > (MAX_EXPIRE * length1000)) {
|
||||
log.error("签名验证失败:X-TIMESTAMP已过期,注意系统时间和服务器时间是否有误差!");
|
||||
throw new IllegalArgumentException("签名验证失败:X-TIMESTAMP已过期");
|
||||
}
|
||||
}
|
||||
|
||||
//2.校验签名
|
||||
boolean isSigned = SignUtil.verifySign(allParams,headerSign);
|
||||
|
||||
if (isSigned) {
|
||||
log.debug("Sign 签名通过!Header Sign : {}",headerSign);
|
||||
return true;
|
||||
} else {
|
||||
log.error("request URI = " + request.getRequestURI());
|
||||
log.error("Sign 签名校验失败!Header Sign : {}",headerSign);
|
||||
//校验失败返回前端
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
response.setContentType("application/json; charset=utf-8");
|
||||
PrintWriter out = response.getWriter();
|
||||
Result<?> result = Result.error("Sign签名校验失败!");
|
||||
out.print(JSON.toJSON(result));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package digital.config.sign.util;
|
||||
|
||||
import javax.servlet.ReadListener;
|
||||
import javax.servlet.ServletInputStream;
|
||||
import javax.servlet.ServletRequest;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletRequestWrapper;
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/**
|
||||
* 保存过滤器里面的流
|
||||
*
|
||||
* @author jeecg
|
||||
* @date 20210621
|
||||
*/
|
||||
public class BodyReaderHttpServletRequestWrapper extends HttpServletRequestWrapper {
|
||||
|
||||
private final byte[] body;
|
||||
|
||||
public BodyReaderHttpServletRequestWrapper(HttpServletRequest request) {
|
||||
|
||||
super(request);
|
||||
String sessionStream = getBodyString(request);
|
||||
body = sessionStream.getBytes(Charset.forName("UTF-8"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取请求Body
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
public String getBodyString(final ServletRequest request) {
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try (InputStream inputStream = cloneInputStream(request.getInputStream());
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Description: 复制输入流</br>
|
||||
*
|
||||
* @param inputStream
|
||||
* @return</br>
|
||||
*/
|
||||
public InputStream cloneInputStream(ServletInputStream inputStream) {
|
||||
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
|
||||
byte[] buffer = new byte[1024];
|
||||
int len;
|
||||
try {
|
||||
while ((len = inputStream.read(buffer)) > -1) {
|
||||
byteArrayOutputStream.write(buffer, 0, len);
|
||||
}
|
||||
byteArrayOutputStream.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedReader getReader() {
|
||||
|
||||
return new BufferedReader(new InputStreamReader(getInputStream()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServletInputStream getInputStream() {
|
||||
|
||||
final ByteArrayInputStream bais = new ByteArrayInputStream(body);
|
||||
return new ServletInputStream() {
|
||||
|
||||
@Override
|
||||
public int read() {
|
||||
|
||||
return bais.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReady() {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadListener(ReadListener readListener) {
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,185 @@
|
||||
package digital.config.sign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import digital.base.constant.SymbolConstant;
|
||||
import digital.util.util.oConvertUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.SortedMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* http 工具类 获取请求中的参数
|
||||
*
|
||||
* @author jeecg
|
||||
* @date 20210621
|
||||
*/
|
||||
@Slf4j
|
||||
public class HttpUtils {
|
||||
|
||||
/**
|
||||
* 将URL的参数和body参数合并
|
||||
*
|
||||
* @author jeecg
|
||||
* @date 20210621
|
||||
* @param request
|
||||
*/
|
||||
public static SortedMap<String, String> getAllParams(HttpServletRequest request) throws IOException {
|
||||
|
||||
SortedMap<String, String> result = new TreeMap<>();
|
||||
// 获取URL上最后带逗号的参数变量 sys/dict/getDictItems/sys_user,realname,username
|
||||
String pathVariable = request.getRequestURI().substring(request.getRequestURI().lastIndexOf("/") + 1);
|
||||
if (pathVariable.contains(SymbolConstant.COMMA)) {
|
||||
log.info(" pathVariable: {}",pathVariable);
|
||||
String deString = URLDecoder.decode(pathVariable, "UTF-8");
|
||||
log.info(" pathVariable decode: {}",deString);
|
||||
result.put(SignUtil.X_PATH_VARIABLE, deString);
|
||||
}
|
||||
// 获取URL上的参数
|
||||
Map<String, String> urlParams = getUrlParams(request);
|
||||
for (Map.Entry entry : urlParams.entrySet()) {
|
||||
result.put((String)entry.getKey(), (String)entry.getValue());
|
||||
}
|
||||
Map<String, String> allRequestParam = new HashMap<>(16);
|
||||
// get请求不需要拿body参数
|
||||
if (!HttpMethod.GET.name().equals(request.getMethod())) {
|
||||
allRequestParam = getAllRequestParam(request);
|
||||
}
|
||||
// 将URL的参数和body参数进行合并
|
||||
if (allRequestParam != null) {
|
||||
for (Map.Entry entry : allRequestParam.entrySet()) {
|
||||
result.put((String)entry.getKey(), (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将URL的参数和body参数合并
|
||||
*
|
||||
* @author jeecg
|
||||
* @date 20210621
|
||||
* @param queryString
|
||||
*/
|
||||
public static SortedMap<String, String> getAllParams(String url, String queryString, byte[] body, String method)
|
||||
throws IOException {
|
||||
|
||||
SortedMap<String, String> result = new TreeMap<>();
|
||||
// 获取URL上最后带逗号的参数变量 sys/dict/getDictItems/sys_user,realname,username
|
||||
String pathVariable = url.substring(url.lastIndexOf("/") + 1);
|
||||
if (pathVariable.contains(SymbolConstant.COMMA)) {
|
||||
log.info(" pathVariable: {}",pathVariable);
|
||||
String deString = URLDecoder.decode(pathVariable, "UTF-8");
|
||||
log.info(" pathVariable decode: {}",deString);
|
||||
result.put(SignUtil.X_PATH_VARIABLE, deString);
|
||||
}
|
||||
// 获取URL上的参数
|
||||
Map<String, String> urlParams = getUrlParams(queryString);
|
||||
for (Map.Entry entry : urlParams.entrySet()) {
|
||||
result.put((String)entry.getKey(), (String)entry.getValue());
|
||||
}
|
||||
Map<String, String> allRequestParam = new HashMap<>(16);
|
||||
// get请求不需要拿body参数
|
||||
if (!HttpMethod.GET.name().equals(method)) {
|
||||
allRequestParam = getAllRequestParam(body);
|
||||
}
|
||||
// 将URL的参数和body参数进行合并
|
||||
if (allRequestParam != null) {
|
||||
for (Map.Entry entry : allRequestParam.entrySet()) {
|
||||
result.put((String)entry.getKey(), (String)entry.getValue());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Body 参数
|
||||
*
|
||||
* @date 15:04 20210621
|
||||
* @param request
|
||||
*/
|
||||
public static Map<String, String> getAllRequestParam(final HttpServletRequest request) throws IOException {
|
||||
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(request.getInputStream()));
|
||||
String str = "";
|
||||
StringBuilder wholeStr = new StringBuilder();
|
||||
// 一行一行的读取body体里面的内容;
|
||||
while ((str = reader.readLine()) != null) {
|
||||
wholeStr.append(str);
|
||||
}
|
||||
// 转化成json对象
|
||||
return JSONObject.parseObject(wholeStr.toString(), Map.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 Body 参数
|
||||
*
|
||||
* @date 15:04 20210621
|
||||
* @param body
|
||||
*/
|
||||
public static Map<String, String> getAllRequestParam(final byte[] body) throws IOException {
|
||||
if(body==null){
|
||||
return null;
|
||||
}
|
||||
String wholeStr = new String(body);
|
||||
// 转化成json对象
|
||||
return JSONObject.parseObject(wholeStr.toString(), Map.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将URL请求参数转换成Map
|
||||
*
|
||||
* @param request
|
||||
*/
|
||||
public static Map<String, String> getUrlParams(HttpServletRequest request) {
|
||||
Map<String, String> result = new HashMap<>(16);
|
||||
if (oConvertUtils.isEmpty(request.getQueryString())) {
|
||||
return result;
|
||||
}
|
||||
String param = "";
|
||||
try {
|
||||
param = URLDecoder.decode(request.getQueryString(), "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String[] params = param.split("&");
|
||||
for (String s : params) {
|
||||
int index = s.indexOf("=");
|
||||
result.put(s.substring(0, index), s.substring(index + 1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将URL请求参数转换成Map
|
||||
*
|
||||
* @param queryString
|
||||
*/
|
||||
public static Map<String, String> getUrlParams(String queryString) {
|
||||
Map<String, String> result = new HashMap<>(16);
|
||||
if (oConvertUtils.isEmpty(queryString)) {
|
||||
return result;
|
||||
}
|
||||
String param = "";
|
||||
try {
|
||||
param = URLDecoder.decode(queryString, "utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String[] params = param.split("&");
|
||||
for (String s : params) {
|
||||
int index = s.indexOf("=");
|
||||
result.put(s.substring(0, index), s.substring(index + 1));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package digital.config.sign.util;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
import digital.base.constant.SymbolConstant;
|
||||
import digital.config.JeecgBaseConfig;
|
||||
import digital.util.exception.JeecgBootException;
|
||||
import digital.util.util.SpringContextUtils;
|
||||
import digital.util.util.oConvertUtils;
|
||||
|
||||
import java.util.SortedMap;
|
||||
|
||||
/**
|
||||
* 签名工具类
|
||||
*
|
||||
* @author jeecg
|
||||
* @date 20210621
|
||||
*/
|
||||
@Slf4j
|
||||
public class SignUtil {
|
||||
public static final String X_PATH_VARIABLE = "x-path-variable";
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* 所有的请求参数都会在这里进行排序加密
|
||||
* @return 验证签名结果
|
||||
*/
|
||||
public static boolean verifySign(SortedMap<String, String> params,String headerSign) {
|
||||
if (params == null || StringUtils.isEmpty(headerSign)) {
|
||||
return false;
|
||||
}
|
||||
// 把参数加密
|
||||
String paramsSign = getParamsSign(params);
|
||||
log.info("Param Sign : {}", paramsSign);
|
||||
return !StringUtils.isEmpty(paramsSign) && headerSign.equals(paramsSign);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param params
|
||||
* 所有的请求参数都会在这里进行排序加密
|
||||
* @return 得到签名
|
||||
*/
|
||||
public static String getParamsSign(SortedMap<String, String> params) {
|
||||
//去掉 Url 里的时间戳
|
||||
params.remove("_t");
|
||||
String paramsJsonStr = JSONObject.toJSONString(params);
|
||||
log.info("Param paramsJsonStr : {}", paramsJsonStr);
|
||||
//设置签名秘钥
|
||||
JeecgBaseConfig jeecgBaseConfig = SpringContextUtils.getBean(JeecgBaseConfig.class);
|
||||
String signatureSecret = jeecgBaseConfig.getSignatureSecret();
|
||||
String curlyBracket = SymbolConstant.DOLLAR + SymbolConstant.LEFT_CURLY_BRACKET;
|
||||
if(oConvertUtils.isEmpty(signatureSecret) || signatureSecret.contains(curlyBracket)){
|
||||
throw new JeecgBootException("签名密钥 ${jeecg.signatureSecret} 缺少配置 !!");
|
||||
}
|
||||
return DigestUtils.md5DigestAsHex((paramsJsonStr + signatureSecret).getBytes()).toUpperCase();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package digital.config.vo;
|
||||
|
||||
/**
|
||||
* @Description: TODO
|
||||
* @author: scott
|
||||
* @date: 2022年01月21日 14:23
|
||||
*/
|
||||
public class Shiro {
|
||||
private String excludeUrls = "";
|
||||
|
||||
public String getExcludeUrls() {
|
||||
return excludeUrls;
|
||||
}
|
||||
|
||||
public void setExcludeUrls(String excludeUrls) {
|
||||
this.excludeUrls = excludeUrls;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>digital-common</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>digital-util</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!--JWT-->
|
||||
<dependency>
|
||||
<groupId>com.auth0</groupId>
|
||||
<artifactId>java-jwt</artifactId>
|
||||
<version>${java-jwt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>5.3.18</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<!--集成springmvc框架 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- Redis -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-pool2</artifactId>
|
||||
</dependency>
|
||||
<!--加载hutool-->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-crypto</artifactId>
|
||||
</dependency>
|
||||
<!--加载beanutils-->
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjweaver</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>3.11.2</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<!-- 阿里云短信 -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-dysmsapi</artifactId>
|
||||
<version>${aliyun-java-sdk-dysmsapi.version}</version>
|
||||
</dependency>
|
||||
<!-- aliyun oss -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun.oss</groupId>
|
||||
<artifactId>aliyun-sdk-oss</artifactId>
|
||||
<version>${aliyun.oss.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.shiro</groupId>
|
||||
<artifactId>shiro-core</artifactId>
|
||||
<version>1.9.1</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>digital-base</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework</groupId>
|
||||
<artifactId>autopoi</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-commons</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user