微服务版后端初始化

This commit is contained in:
yaoyn
2025-02-08 17:51:37 +08:00
parent 54af6be188
commit da009a7cc4
1897 changed files with 429541 additions and 81 deletions

View File

@ -0,0 +1,151 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>xjrsoft-common</artifactId>
<groupId>com.xjrsoft</groupId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>xjrsoft-common-core</artifactId>
<properties>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<dependencies>
<!--引入hutool依赖-->
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
</dependency>
<!--引入Lombok依赖-->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
<!-- Hibernate Validator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- SpringBoot Boot Redis -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- Spring Context Support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<!-- Spring Web -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<!-- Java Servlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.smartboot.license</groupId>
<artifactId>license-client</artifactId>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-spring-boot-starter</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-annotation</artifactId>
<version>${mybatisplus.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-core</artifactId>
<version>${satoken.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
</dependency>
<dependency>
<groupId>org.dromara.sms4j</groupId>
<artifactId>sms4j-spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-core</artifactId>
<version>${mybatisplus.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,63 @@
package com.xjrsoft.common.core.annotation;
import com.xjrsoft.common.core.constant.StringPool;
import com.xjrsoft.common.core.enums.TransType;
import java.lang.annotation.*;
/**
* @Author: tzx
* @Date: 2023/1/11 14:17
*/
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface Trans {
/**
* 转换类型
* @return 转换类型
*/
TransType type();
/**
* 如果转换类型是 Api, 装换类型是数据字典则是数据字典id
* @return Api 的 id/ 数据字典id
*/
String id() default "";
/**
* 是否多个值
* @return true or false
*/
boolean isMulti() default false;
/**
* 多个值分隔符
* @return 分隔符
*/
String separator() default StringPool.SLASH;
/**
* 多个值显示格式
* @return 显示格式
*/
String showFormat() default "all";
/**
* 解析类型值的类
* @return
*/
Class typeClass() default Object.class;
/**
* 解析方法名
* @return
*/
String transMethodName() default "";
/**
* 将转换结果赋值到另一个字段,转换是按字段顺序,注意结果覆盖
* @return
*/
String transToFieldName() default "";
}

View File

@ -0,0 +1,12 @@
package com.xjrsoft.common.core.annotation;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.context.annotation.AnnotationBeanNameGenerator;
public class UniqueNameGenerator extends AnnotationBeanNameGenerator {
@Override
protected String buildDefaultBeanName(BeanDefinition definition) {
return definition.getBeanClassName();
}
}

View File

@ -0,0 +1,16 @@
package com.xjrsoft.common.core.annotation;
import java.lang.annotation.*;
/**
* 系统日志注解
*
* @author tzx
*/
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface XjrLog {
String value() default "";
}

View File

@ -0,0 +1,31 @@
package com.xjrsoft.common.core.config;
import com.xjrsoft.common.core.enums.ErrorTypeEnum;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @Author: zlf
* @Date: 2022/10/9 15:51
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.common")
public class CommonPropertiesConfig {
private String druidAccount;
private String druidPassword;
private String defaultPassword;
private ErrorTypeEnum errorType;
private List<String> excludeUrls;
private List<String> whiteList;
}

View File

@ -0,0 +1,24 @@
package com.xjrsoft.common.core.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
/**
* 跨域配置
* @author Zexy
*/
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns(CorsConfiguration.ALL)
.allowCredentials(Boolean.TRUE)
.allowedMethods(CorsConfiguration.ALL)
.allowedHeaders(CorsConfiguration.ALL)
.maxAge(3600);
}
}

View File

@ -0,0 +1,24 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* 数据中台配置
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.data-center")
public class DataCenterServiceConfig {
private String url;
private String userId;
private String deptId;
private String subscribeId;
private String accessToken;
}

View File

@ -0,0 +1,41 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2023/8/9 16:51
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.dingtalk")
public class DingtalkConfig {
/**
* appkey 或者 clientId
*/
private String appKey;
/**
* appSecret 或者 clientSecret
*/
private String appSecret;
/**
* agentid
*/
private String agentid;
/**
* redirectUri 回调地址
*/
private String redirectUri;
/**
* frontUrl 回调地址
*/
private String frontUrl;
}

View File

@ -0,0 +1,37 @@
package com.xjrsoft.common.core.config;
import com.xjrsoft.common.core.xss.XssFilter;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.servlet.DispatcherType;
import java.util.HashMap;
import java.util.Map;
/**
* Filter配置
* 用于Xss过滤
*
* @author tzx
*/
@Configuration
public class FilterConfig {
@Bean
public FilterRegistrationBean<XssFilter> xssFilterRegistration() {
FilterRegistrationBean<XssFilter> registration = new FilterRegistrationBean<>();
registration.setDispatcherTypes(DispatcherType.REQUEST);
registration.setFilter(new XssFilter());
registration.addUrlPatterns("/*");
registration.setName("xssFilter");
registration.setOrder(Integer.MAX_VALUE);
Map<String,String> initParameters = new HashMap<>();
//设置xxs 忽略地址
initParameters.put("excludes","/magic/*,/magic-api/*");
registration.setInitParameters(initParameters);
return registration;
}
}

View File

@ -0,0 +1,18 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2022/6/6 15:51
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.generate")
public class GeneratePathConfig {
private String webPath;
private String appPath;
}

View File

@ -0,0 +1,31 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2022/3/8 9:01
*/
@Data
@Component
@ConfigurationProperties("xjrsoft")
public class GlobalConfig {
/**
* oss配置
*/
private OSSConfig ossConfig;
/**
* 生成地址配置
*/
private GeneratePathConfig generatePathConfig;
/**
* 短信配置
*/
private XjrSmsConfig xjrSmsConfig;
}

View File

@ -0,0 +1,28 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2022/11/29 10:44
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.keycloak")
public class KeyCloakConfig {
private String url;
private String realm;
private String clientId;
private String secret;
private String userName;
private String password;
private String payload;
}

View File

@ -0,0 +1,44 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2023/7/3 9:47
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.license")
public class LicenseConfig {
/**
* 是否启用
*/
private Boolean enabled;
/**
* 公司名称
*/
private String companyName;
/**
* 公司名称
*/
private String contactNumber;
/**
* 最大登录人数
*/
private Integer loginMax;
/**
* 授权开始时间
*/
private String startTime;
/**
* 授权结束时间
*/
private String endTime;
}

View File

@ -0,0 +1,48 @@
package com.xjrsoft.common.core.config;
import cn.hutool.extra.mail.MailAccount;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
/**
* 邮箱账户配置类
* @Author: tzx
* @Date: 2022/10/27 10:58
*/
@Configuration
@Slf4j
public class MailAccountConfig {
@Value("${xjrsoft.email.host}")
public String host;
@Value("${xjrsoft.email.port}")
public Integer port;
@Value("${xjrsoft.email.auth}")
public Boolean auth;
@Value("${xjrsoft.email.from}")
public String from;
@Value("${xjrsoft.email.user}")
public String user;
@Value("${xjrsoft.email.pass}")
public String pass;
@Bean
public MailAccount mailAccount(){
log.info("------------mail account config init---------------");
MailAccount account = new MailAccount();
account.setHost(host);
account.setPort(port);
account.setAuth(auth);
account.setFrom(from);
account.setUser(user);
account.setPass(pass);
return account;
}
}

View File

@ -0,0 +1,67 @@
package com.xjrsoft.common.core.config;
import com.xjrsoft.common.core.enums.CloudType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2022/3/8 10:29
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.oss")
public class OSSConfig {
/**
* 云服务类别
*/
private CloudType cloudType;
/**
* 是否开启
*/
private Boolean enabled;
/**
* 域名
*/
private String endpoint;
/**
* 替换endpoint用于前端代理下载
*/
private String replaceEndpoint;
/**
* 前缀
*/
private String prefix;
/**
* accessKey 腾讯云 这个代表 secretId
*/
private String accessKey;
/**
* 密钥
*/
private String secretKey;
/**
* bucket
*/
private String bucketName;
/**
* 区域 目前只有腾讯云有需要配置
*/
private String region;
/**
* appId 腾讯云需要配置
*/
private Long appId;
}

View File

@ -0,0 +1,72 @@
//package com.xjrsoft.common.core.config;
//
//import lombok.AllArgsConstructor;
//import org.springframework.boot.autoconfigure.AutoConfigureBefore;
//import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.core.*;
//import org.springframework.data.redis.listener.RedisMessageListenerContainer;
//import org.springframework.data.redis.serializer.StringRedisSerializer;
//
///**
// * Redis配置
// *
// * @author Zexy
// */
//@Configuration
//@AllArgsConstructor
//@AutoConfigureBefore(RedisAutoConfiguration.class)
//public class RedisConfig {
// private RedisConnectionFactory factory;
//
// @Bean
// public RedisTemplate<String, Object> redisTemplate() {
// RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
// redisTemplate.setKeySerializer(new StringRedisSerializer());
// redisTemplate.setHashKeySerializer(new StringRedisSerializer());
// redisTemplate.setHashValueSerializer(new StringRedisSerializer());
// redisTemplate.setValueSerializer(new StringRedisSerializer());
// redisTemplate.setConnectionFactory(factory);
// return redisTemplate;
// }
//
// @Bean
// public HashOperations<String, String, Object> hashOperations(RedisTemplate<String, Object> redisTemplate) {
// return redisTemplate.opsForHash();
// }
//
// @Bean
// public ValueOperations<String, String> valueOperations(RedisTemplate<String, String> redisTemplate) {
// return redisTemplate.opsForValue();
// }
//
// @Bean
// public ListOperations<String, Object> listOperations(RedisTemplate<String, Object> redisTemplate) {
// return redisTemplate.opsForList();
// }
//
// @Bean
// public SetOperations<String, Object> setOperations(RedisTemplate<String, Object> redisTemplate) {
// return redisTemplate.opsForSet();
// }
//
// @Bean
// public ZSetOperations<String, Object> zSetOperations(RedisTemplate<String, Object> redisTemplate) {
// return redisTemplate.opsForZSet();
// }
//
// /**
// * 配置监听器
// * @param connectionFactory
// * @return
// */
// @Bean
// RedisMessageListenerContainer redisContainer(RedisConnectionFactory connectionFactory) {
//
// RedisMessageListenerContainer container = new RedisMessageListenerContainer();
// container.setConnectionFactory(connectionFactory);
// return container;
// }
//}

View File

@ -0,0 +1,13 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
@Data
public class SmsTemplate {
private String type;
private String id;
private String[] keys;
}

View File

@ -0,0 +1,41 @@
package com.xjrsoft.common.core.config;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
/**
* @Author: tzx
* @Date: 2023/8/9 16:51
*/
@Data
@Component
@ConfigurationProperties("xjrsoft.wechatenterprise")
public class WechatEnterpriseConfig {
/**
* appkey 或者 clientId
*/
private String appKey;
/**
* appSecret 或者 clientSecret
*/
private String appSecret;
/**
* agentid
*/
private String agentid;
/**
* redirectUri 回调地址
*/
private String redirectUri;
/**
* frontUrl 回调地址
*/
private String frontUrl;
}

View File

@ -0,0 +1,68 @@
package com.xjrsoft.common.core.config;
import com.xjrsoft.common.core.enums.SmsCloudType;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties("xjrsoft.sms")
public class XjrSmsConfig {
/**
* 短信限制时间(单位:小时,正整数)
*/
private Integer limitTime;
/**
* 短信限制次数与limitTime一起使用限制时长内允许发送的次数
*/
private Integer limitCount;
/**
* 云平台 服务提供商
*/
private SmsCloudType platform;
/**
* 验证码通道号
*/
private String captchaSender;
/**
* 验证码模板id
*/
private String captchaTemplateId;
/**
* 通知类通道号
*/
private String notifySender;
/**
* 通知类消息通知模板号
*/
private String notifyTemplateId;
/**
* 通知类通道号
*/
private String circulatedSender;
/**
* 通知类传阅消息模板号
*/
private String circulatedTemplateId;
/**
* 通知类超时通道号
*/
private String timeoutSender;
/**
* 通知类超时提醒模板号
*/
private String timeoutTemplateId;
}

View File

@ -0,0 +1,747 @@
package com.xjrsoft.common.core.constant;
import cn.hutool.core.collection.ListUtil;
import java.util.Arrays;
import java.util.List;
/**
* @Author: tzx
* @Date: 2022/3/3 16:35
*/
public interface GlobalConstant {
/**
* 超级管理员角色id
*/
Long SUPER_ADMIN_ROLE_ID = 1L;
/**
* 超级管理员用户默认id
*/
Long SUPER_ADMIN_USER_ID = 1000000000000000000L;
/**
* 框架 约定 默认数据源的名称
*/
String DEFAULT_DATASOURCE_KEY = "master";
/**
* 框架 约定 默认数据库连接的id
*/
Long DEFAULT_DATABASELINKID= 0L;
/**
* @des 账户加密字符串
* */
String SECRET_KEY = "xxxxxxxxxxxxxxxx";
String LTPAS_TOKEN_KEY = "ltpasToken";
/**
* ureport http-basic 验证 账号密码
*/
String UREPORT_ACCOUNT = "xjrsoft";
/**
* ureport http-basic 验证 账号密码
*/
String UREPORT_PASSWORD = "123456";
/**
* @des 登录界面返回前端 token 的 key
* */
String TOKEN_KEY = "token";
/**
* @des sa-token 登陆人信息key
*
* */
String LOGIN_USER_INFO_KEY = "LOGIN_USER_INFO_KEY";
/**
* @des sa-token 登陆人权限Code key
* */
String LOGIN_USER_AUTH_CODE_KEY = "LOGIN_USER_AUTH_CODE_KEY";
/**
* @des sa-token 登陆人自定义接口权限Code key
* */
String LOGIN_USER_INTERFACE_AUTH_CODE_KEY = "LOGIN_USER_INTERFACE_AUTH_CODE_KEY";
/**
* @des sa-token 登陆人所有角色集合 key
* */
String LOGIN_USER_ROLE_LIST_KEY = "LOGIN_USER_ROLE_LIST_KEY";
/**
* @des sa-token 登陆人角色Code key
* */
String LOGIN_USER_ROLE_CODE_KEY = "LOGIN_USER_ROLE_CODE_KEY";
/**
* @des sa-token 登陆人角色ID key
* */
String LOGIN_USER_ROLE_ID_KEY = "LOGIN_USER_ROLE_ID_KEY";
/**
* @des sa-token 登陆人当前部门信息 key
* */
String LOGIN_USER_DEPT_INFO_KEY = "LOGIN_USER_DEPT_INFO_KEY";
/**
* @des sa-token 登陆人所有部门集合 key
* */
String LOGIN_USER_DEPT_LIST_KEY = "LOGIN_USER_DEPT_LIST_KEY";
/**
* @des sa-token 登陆人所有负责部门集合 key
* */
String LOGIN_USER_CHARGE_DEPT_LIST_KEY = "LOGIN_USER_CHARGE_DEPT_LIST_KEY";
/**
* @des sa-token 登陆人所属公司属于一级单位
* */
String LOGIN_USER_COMPANY_LVL_ONE_KEY = "LOGIN_USER_COMPANY_LVL_ONE_KEY";
/**
* @des sa-token 登陆人所属公司属于二级单位
* */
String LOGIN_USER_COMPANY_LVL_TWO_KEY = "LOGIN_USER_COMPANY_LVL_TWO_KEY";
/**
* @des sa-token 登陆人所属公司属于三级单位
* */
String LOGIN_USER_COMPANY_LVL_THREE_KEY = "LOGIN_USER_COMPANY_LVL_THREE_KEY";
/**
* @des sa-token 登陆人所属公司属于四级单位
* */
String LOGIN_USER_COMPANY_LVL_FOUR_KEY = "LOGIN_USER_COMPANY_LVL_FOUR_KEY";
/**
* @des sa-token 登陆人所属公司集合 key
* */
String LOGIN_USER_COMPANY_LIST_KEY = "LOGIN_USER_COMPANY_LIST_KEY";
/**
* @des sa-token 登陆人所属公司的所有下属公司集合 key
* */
String LOGIN_USER_SUBCOMPANY_LIST_KEY = "LOGIN_USER_SUBCOMPANY_LIST_KEY";
/**
* @des sa-token 登陆人所属公司的所有上级公司集合 key
* */
String LOGIN_USER_SUPERCOMPANY_LIST_KEY = "LOGIN_USER_SUPERCOMPANY_LIST_KEY";
/**
* @des sa-token 登陆人主部门ID key
* */
String LOGIN_USER_MAIN_DEPT_ID_KEY = "LOGIN_USER_MAIN_DEPT_ID_KEY";
/**
* @des sa-token 登陆人当前岗位信息 key
* */
String LOGIN_USER_POST_INFO_KEY = "LOGIN_USER_POST_INFO_KEY";
/**
* @des sa-token 登陆人所有岗位集合 key
* */
String LOGIN_USER_POST_LIST_KEY = "LOGIN_USER_POST_LIST_KEY";
/**
* @des 系统功能模块 前缀
* */
String SYSTEM_MODULE_PREFIX = "/system";
/**
* @des 第三方登录模块 前缀
* */
String OAUTH_MODULE_PREFIX = "/oauth";
/**
* @des bi功能模块 前缀
* */
String BI_MODULE_PREFIX = "/bi";
/**
* @des 组织架构模块 前缀
* */
String ORGANIZATION_MODULE_PREFIX = "/organization";
/**
* @des 表单模块 前缀
* */
String FORM_MODULE_PREFIX = "/form";
/**
* @des 工作流模块 前缀
* */
String WORKFLOW_MODULE_PREFIX = "/workflow";
/**
* @des 打印模块 前缀
* */
String PRINT_MODULE_PREFIX = "/print";
/**
* @des 报表模块 前缀
* */
String REPORT_MODULE_PREFIX = "/report";
/**
* @des OA模块 前缀
* */
String OA_MODULE_PREFIX = "/oa";
/**
* @des 邮件模块 前缀
* */
String MAIL_MODULE_PREFIX = "/mail";
/**
* @Des 翻译管理模块
*/
String LANGUAGE_MODULE_PREFIX = "/language";
/**
* @Des magic-api模块
*/
String MAGICAPI_MODULE_PREFIX = "/interface";
/**
* @Des liteflow模块
*/
String LITEFLOW_MODULE_PREFIX = "/liteflow";
/**
* @Des 桌面设计模块
*/
String DESKTOP_MODULE_PREFIX = "/desktop";
/**
* @Des 数据权限模块模块
*/
String AUTHORITY_MODULE_PREFIX = "/authority";
/**
* ERP_Unit模块
*/
String CASE_ERP_UNIT = "/caseErpUnit";
/**
* ERP_Material模块
*/
String CASE_ERP_MATERIAL = "/caseErpMaterial";
/**
* ERP_Bom模块
*/
String CASE_ERP_BOM = "/caseErpBom";
/**
* ERP_Device模块
*/
String CASE_ERP_DEVICE = "/caseErpDevice";
/**
* caseErpSupplier模块
*/
String CASE_ERP_SUPPLIER = "/caseErpSupplier";
/**
* caseErpCustomer
*/
String CASE_ERP_CUSTOMER = "/caseErpCustomer";
/**
* caseErpSale模块
*/
String CASE_ERP_SALE = "/caseErpSale";
/**
* caseErpPurchase模块
*/
String CASE_ERP_PURCHASE = "/caseErpPurchase";
/**
* caseErpStore模块
*/
String CASE_ERP_STOR_RECCCEIPT = "/caseErpStoreReceipt";
/**
* caseErpPurchaseApply模块
*/
String CASE_ERP_PURCHASE_APPLY = "/caseErpPurchaseApply";
/**
* appModel模块
*/
String APP_MODEL = "/app";
/**
* @des 排序 降序
* */
String ORDER_DESC = "descend";
/**
* 代码生成器 默认生成路劲
*/
String GENERATOR_DEFAULT_PATH = "com.xjrsoft.module";
/**
* 数据库表 固定审计字段 创建人id
*/
String CREATE_USER_ID = "create_user_id";
/**
* 数据库表 固定审计属性 创建人id
*/
String CREATE_USER_ID_PROPERTY = "createUserId";
/**
* 数据库表 固定审计字段 创建人部门id
*/
String DEPT_ID = "dept_id";
/**
* 数据库表 固定审计属性 创建人部门id
*/
String DEPT_ID_PROPERTY = "deptId";
/**
* 数据库表 固定审计字段 创建时间
*/
String CREATE_DATE = "create_date";
/**
* 数据库表 固定审计属性 创建时间
*/
String CREATE_DATE_PROPERTY = "createDate";
/**
* 数据库表 固定审计字段 修改人id
*/
String MODIFY_USER_ID = "modify_user_id";
/**
* 数据库表 固定审计属性 修改人id
*/
String MODIFY_USER_ID_PROPERTY = "modifyUserId";
/**
* 数据库表 固定审计字段 修改人时间
*/
String MODIFY_DATE = "modify_date";
/**
* 数据库表 固定审计属性 修改人时间
*/
String MODIFY_DATE_PROPERTY = "modifyDate";
/**
* 数据库表 固定审计字段 删除标记
*/
String DELETE_MARK = "delete_mark";
/**
* 数据库表 固定审计属性 删除标记
*/
String DELETE_MARK_PROPERTY = "deleteMark";
/**
* 数据库表 固定审计字段 修改标记
*/
String ENABLED_MARK = "enabled_mark";
/**
* 数据库表 固定审计属性 修改标记
*/
String ENABLED_MARK_PROPERTY = "enabledMark";
/**
* 数据库表 数据权限字段
*/
String AUTH_USER_ID = "rule_user_id";
/**
* 数据库表 数据权限属性名字
*/
String AUTH_USER_ID_PROPERTY = "ruleUserId";
/**
* 自动填充的字段
*/
List<String> AUTO_INSERT = Arrays.asList(CREATE_USER_ID, CREATE_DATE, DELETE_MARK, ENABLED_MARK, AUTH_USER_ID, DEPT_ID);
/**
* 自动填充的字段
*/
List<String> AUTO_UPDATE = Arrays.asList(MODIFY_USER_ID, MODIFY_DATE);
/**
* 新增自动填充的属性
*/
List<String> AUTO_INSERT_PROPERTY = Arrays.asList(CREATE_USER_ID_PROPERTY, CREATE_DATE_PROPERTY, DELETE_MARK_PROPERTY, ENABLED_MARK_PROPERTY);
/**
* 修改自动填充的属性
*/
List<String> AUTO_UPDATE_PROPERTY = Arrays.asList(MODIFY_USER_ID_PROPERTY, MODIFY_DATE_PROPERTY);
/**
* 数据库排序 关键字
*/
String ORDER_BY = "ORDER BY";
/**
* 数据库 约定 自定义表单 代码生成器 生成 时间区间的字段 开始时间后缀
*/
String START_TIME_SUFFIX = "Start";
/**
* 数据库 约定 自定义表单 代码生成器 生成 时间区间的字段 结束时间后缀
*/
String END_TIME_SUFFIX = "End";
/**
* 框架 约定 代码生成器 生成 数据库表 默认主键名
*/
String DEFAULT_PK = "id";
/**
* 框架 约定 代码生成器 生成 数据库表 默认主键类型
*/
String DEFAULT_PK_TYPE = "Long";
/**
* 框架 约定 代码生成器 生成 数据库表 父子表 关联字段
*/
String DEFAULT_FK = "parent_id";
/**
* 框架 约定 代码生成器 生成 数据库表 默认 文本类型长度
*/
String DEFAULT_TEXT_LENGTH = "50";
/**
* 框架约定树结构的根节点parentId 统一设置为0
*/
Long FIRST_NODE_VALUE = 0L;
/**
* 框架用户表缓存key
*/
String USER_CACHE_KEY = "ALL_USER";
/**
* 框架用户表缓存key
*/
String USER_NAME_CACHE_KEY = "ALL_USER_NAME";
/**
* 框架角色缓存key
*/
String ROLE_CACHE_KEY = "ALL_ROLE";
/**
* 框架部门缓存key
*/
String DEP_CACHE_KEY = "ALL_DEP";
/**
* 框架部门缓存key
*/
String DEP_NAME_CACHE_KEY = "ALL_DEP_NAME";
/**
* 用户-角色 关联数据 数据 缓存key
*/
String USER_ROLE_RELATION_CACHE_KEY = "ALL_USER_ROLE_RELATION";
/**
* 用户-岗位 关联数据 数据 缓存key
*/
String USER_POST_RELATION_CACHE_KEY = "ALL_USER_POST_RELATION";
/**
* 用户-组织 关联数据 数据 缓存key
*/
String USER_DEPT_RELATION_CACHE_KEY = "ALL_USER_DEPT_RELATION";
/**
* 框架岗位缓存key
*/
String POST_CACHE_KEY = "ALL_POST";
/**
* 框架岗位缓存key
*/
String POST_NAME_CACHE_KEY = "ALL_POST_NAME";
/**
* 数据字典分类
*/
String DIC_ITEM_CACHE_KEY = "ALL_DIC_ITEM";
/**
* 数据字典详情
*/
String DIC_DETAIL_CACHE_KEY = "ALL_DIC_DETAIL";
/**
* 数据字典详情
*/
String DIC_DETAIL_NAME_CACHE_KEY = "ALL_DIC_DETAIL_NAME";
/**
* 数据权限
*/
String DATA_AUTH_CACHE_KEY = "ALL_DATA_AUTH";
/**
* 数据权限 配置
*/
String DATA_AUTH_CONFIG_CACHE_KEY = "ALL_DATA_AUTH_CONFIG";
/**
* 数据权限 关联
*/
String DATA_AUTH_RELATION_CACHE_KEY = "ALL_DATA_AUTH_RELATION";
/**
* 数据权限 与表 关联
*/
String DATA_AUTH_TABLE_RELATION_CACHE_KEY = "ALL_DATA_AUTH_TABLE_RELATION";
/**
* yyyy-MM-dd HH:mm:ss 24小时制
*/
String YYYY_MM_DD_HH_MM_SS_24 = "yyyy-MM-dd HH:mm:ss";
/**
* yyyy-MM-dd hh:mm:ss 12小时制
*/
String YYYY_MM_DD_HH_MM_SS_12 = "yyyy-MM-dd hh:mm:ss";
/**
* yyyy-MM-dd
*/
String YYYY_MM_DD = "yyyy-MM-dd";
/**
* HH:mm:ss 24小时制
*/
String HH_MM_SS_24 = "HH:mm:ss";
/**
* yyyy-hh:mm:ss 12小时制-dd
*/
String HH_MM_SS_12 = "hh:mm:ss";
/**
* 验证码
*/
String CAPTCHA = "captcha";
/**
* 验证法发送次数前缀
*/
String CACHE_COUNT_SMS_CODE_PREFIX = "COUNT_SMS_CODE_";
/**
* chatgpt 缓存前缀
*/
String CHATGPT_PREFIX = "chatgpt-";
/**
* 登录身份的缓存key 前缀
*/
String LOGIN_IDENTITY_CACHE_PREFIX = "identityCache:";
/**
* 登录错误次数缓存 前缀
*/
String LOGIN_ERROR_NUMBER = "loginErrorNumber:";
/**
* 登录人权限的缓存key 前缀
*/
String PERMISSION_CACHE_PREFIX = "permission:";
/**
* 所支持的图片格式
*/
List<String> imageType = ListUtil.toList("jpg","png","gif","jpeg","image","bmp");
/**
* @name feign URL
* @des 前缀 + 服务名 + 接口url
* @demo /client/organization/users/list
* /client/system/menu/list
* */
String CLIENT_API_PRE = "/client/";
/**
* 前缀
*/
String CLIENT_NAME_PRE = "";
/**
* 后缀
*/
String CLIENT_NAME_SUF = "";
/*----------------------------权限模块开始---------------------------------*/
/**
* 认证中心url前缀
*/
String AUTH_PRE = "/sso";
/**
* 统一认证中心
*/
String AUTH_CENTER = "/auth";
/**
* 统一认证登录接口
*/
String AUTH_LOGIN = AUTH_PRE + "/login";
/**
* 检验ticktet
*/
String AUTH_CHECK_TICKET = AUTH_PRE + "/check-ticket";
/**
* 检验ticktet
*/
String AUTH_LOGOUT = AUTH_PRE + "/logout";
/**
* 系统模块 名称
*/
String MODULE_SYSTEM_NAME = "system";
/**
* app模块 名称
*/
String MODULE_APP_NAME = "app";
/**
* 组织架构模块 名称
*/
String MODULE_ORGANIZATION_NAME = "organization";
/**
* 桌面模块 名称
*/
String MODULE_DESKTOP_NAME = "desktop";
/**
* 自定义表单 名称
*/
String MODULE_FORM_NAME = "form";
/**
* 代码生成器模块 名称
*/
String MODULE_GENERETOR_NAME = "generator";
/**
* magicapi模块名称 名称
*/
String MODULE_MAGICAPI_NAME = "magicapi";
/**
* 工作流模块 名称
*/
String MODULE_WORKFLOW_NAME = "workflow";
/**
* 系统服务client 名称
*/
String CLIENT_SYSTEM_NAME = CLIENT_NAME_PRE + "system-service" + CLIENT_NAME_SUF;
/**
* 系统服务client 名称
*/
String CLIENT_ORGANIZATION_NAME = CLIENT_NAME_PRE + "organization-service" + CLIENT_NAME_SUF;
/**
* 系统服务client 名称
*/
String CLIENT_DESKTOP_NAME = CLIENT_NAME_PRE + "desktop-service" + CLIENT_NAME_SUF;
/**
* 系统服务client 名称
*/
String CLIENT_MAGICAPI_NAME = CLIENT_NAME_PRE + "magicapi-service" + CLIENT_NAME_SUF;
/**
* app服务client 名称
*/
String CLIENT_APP_NAME = CLIENT_NAME_PRE + "app-service" + CLIENT_NAME_SUF;
/**
* 工作流服务client 名称
*/
String CLIENT_WORKFLOW_NAME = CLIENT_NAME_PRE + "workflow-service" + CLIENT_NAME_SUF;
/**
* 自定义表单服务client 名称
*/
String CLIENT_FORM_NAME = CLIENT_NAME_PRE + "form-service" + CLIENT_NAME_SUF;
/**
* 代码生成器服务client 名称
*/
String CLIENT_GENERATE_NAME = CLIENT_NAME_PRE + "generate-service" + CLIENT_NAME_SUF;
/**
* 数字新能源服务client 名称
*/
String CLIENT_DNE_NAME = CLIENT_NAME_PRE + "dne-service" + CLIENT_NAME_SUF;
/**
* 微信token
*/
String WechatAccessTokenKey = "WECHAT_ACCESS_TOKEN";
/**
* 钉钉token
*/
String DingtalkAccessTokenKey = "DINGTALK_ACCTSS_TOKEN";
String siteRootDepartmentKey="siteRootDepartment";
String companyTypeFilterKey="companyTypeFilter";
/**
* 流程结束是否发送系统消息至发起人
* 值 true || false
*/
String siteWorkflowEndSendSysNoticeKey="siteWorkflowEndSendSysNotice";
}

View File

@ -0,0 +1,72 @@
package com.xjrsoft.common.core.constant;
public interface StringPool {
String AMPERSAND = "&";
String AND = "and";
String AT = "@";
String ASTERISK = "*";
String STAR = "*";
String BACK_SLASH = "\\";
String COLON = ":";
String COMMA = ",";
String DASH = "-";
String DOLLAR = "$";
String DOT = ".";
String DOTDOT = "..";
String DOT_CLASS = ".class";
String DOT_JAVA = ".java";
String DOT_XML = ".xml";
String EMPTY = "";
String EQUALS = "=";
String FALSE = "false";
String SLASH = "/";
String HASH = "#";
String HAT = "^";
String LEFT_BRACE = "{";
String LEFT_BRACKET = "(";
String LEFT_CHEV = "<";
String DOT_NEWLINE = ",\n";
String NEWLINE = "\n";
String N = "n";
String NO = "no";
String NULL = "null";
String OFF = "off";
String ON = "on";
String PERCENT = "%";
String PIPE = "|";
String PLUS = "+";
String QUESTION_MARK = "?";
String EXCLAMATION_MARK = "!";
String QUOTE = "\"";
String RETURN = "\r";
String TAB = "\t";
String RIGHT_BRACE = "}";
String RIGHT_BRACKET = ")";
String RIGHT_CHEV = ">";
String SEMICOLON = ";";
String SINGLE_QUOTE = "'";
String BACKTICK = "`";
String SPACE = " ";
String TILDA = "~";
String LEFT_SQ_BRACKET = "[";
String RIGHT_SQ_BRACKET = "]";
String TRUE = "true";
String UNDERSCORE = "_";
String UTF_8 = "UTF-8";
String US_ASCII = "US-ASCII";
String ISO_8859_1 = "ISO-8859-1";
String Y = "y";
String YES = "yes";
String ONE = "1";
String ZERO = "0";
String DOLLAR_LEFT_BRACE = "${";
String HASH_LEFT_BRACE = "#{";
String CRLF = "\r\n";
String HTML_NBSP = "&nbsp;";
String HTML_AMP = "&amp";
String HTML_QUOTE = "&quot;";
String HTML_LT = "&lt;";
String HTML_GT = "&gt;";
String[] EMPTY_ARRAY = new String[0];
byte[] BYTES_NEW_LINE = "\n".getBytes();
}

View File

@ -0,0 +1,6 @@
package com.xjrsoft.common.core.constant;
public interface SyncConstant {
Integer SYNC_TYPE_SCHEDULE=0;
Integer SYNC_TYPE_MANUAL=1;
}

View File

@ -0,0 +1,39 @@
package com.xjrsoft.common.core.domain.base;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 审计字段
* @Author: tzx
* @Date: 2022/5/9 14:35
*/
@Data
public class AuditEntity {
@TableField(fill = FieldFill.INSERT)
private Long createUserId;
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime createDate;
@TableField(fill = FieldFill.UPDATE)
private Long modifyUserId;
@TableField(fill = FieldFill.UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime modifyDate;
@TableLogic
@TableField(fill = FieldFill.INSERT)
private Integer deleteMark;
@TableField(fill = FieldFill.INSERT)
private Integer enabledMark;
}

View File

@ -0,0 +1,65 @@
package com.xjrsoft.common.core.domain.datasource;
import lombok.Data;
/**
* 字段信息
* @Author: tzx
* @Date: 2022/4/25 11:46
*/
@Data
public class MyColumnInfo {
/**
* 数据库字段名
*/
private String column;
/**
* entity 属性名
*/
private String property;
/**
* entity 属性类型
*/
private String propertyType;
/**
* 数据库字段类型
*/
private String dataType;
/**
* 字段长度
*/
private Long dataLength;
/**
* 是否为空
*/
private Boolean nullable;
/**
* 是否为主键
*/
private Boolean primaryKey;
/**
* 是否为自增
*/
private Boolean autoIncrement;
/**
* 字段注释
*/
private String columnComment;
/**
* 字段默认值
*/
private String columnDefault;
}

View File

@ -0,0 +1,18 @@
package com.xjrsoft.common.core.domain.datasource;
import lombok.Data;
/**
* 表信息
* @Author: tzx
* @Date: 2022/4/25 11:45
*/
@Data
public class MyTableInfo {
private String tableName;
private String tableComment;
private String pkField;
private String pkType;
}

View File

@ -0,0 +1,99 @@
package com.xjrsoft.common.core.domain.generator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* 表单组件配置
* @Author: tzx
* @Date: 2022/5/11 15:45
*/
@Data
public class ComponentConfig {
/**
* label标签
*/
private String label;
/**
* 组件类型
*/
private String type;
/**
* 组件随机表示
*/
private String key;
/**
* 绑定表名
*/
private String bindTable;
/**
* 绑定表字段
*/
private String bindField;
/**
* 验证
*/
private List<Map<String,Object>> rules;
/**
* 子表单 的子组件
*/
private List<ComponentConfig> children;
/**
* 栅格布局 选项卡 的子组件 特有属性
*/
private List<LayoutOptionModel> layout;
/**
* 各组件 特殊配置信息 具体配置信息
*/
private Map<String,Object> options;
/**
* range特有 绑定开始字段
*/
private String bindStartTime;
/**
* range特有 绑定结束字段
*/
private String bindEndTime;
/**
* 隐藏组件特有 值
*/
private String value;
/**
* 隐藏组件特有 编码
*/
private String code;
private Boolean isSubFormChild;
// 表格布局配置
@JsonProperty("class")
private String clazz;
private String height;
private List<Integer> position;
private String width;
private Integer colspan;
private Integer rowspan;
}

View File

@ -0,0 +1,82 @@
package com.xjrsoft.common.core.domain.generator;
import lombok.Data;
/**
* @Author: tzx
* @Date: 2022/5/11 15:55
*/
@Data
public class ComponentOptionConfig {
/**
* 宽度
*/
private String width;
/**
* 默认值
*/
private String defaultValue;
/**
* 提示
*/
private String placeholder;
/**
* 最大长度
*/
private Integer maxlength;
/**
* 前缀
*/
private String prefix;
/**
* 后缀
*/
private String suffix;
/**
* 前标签
*/
private String addonBefore;
/**
* 后标签
*/
private String addonAfter;
/**
* 是否不可操作
*/
private Boolean disabled;
/**
* 是否显示清除
*/
private Boolean allowClear;
/**
* 是否只读
*/
private Boolean readonly;
/**
* 远程数据的类型 可分为 静态 数据字典 数据源 接口
*/
private String remoteType;
/**
* 数据源id
*/
private String sourceId;
/**
* 字典id
*/
private String itemId;
}

View File

@ -0,0 +1,47 @@
package com.xjrsoft.common.core.domain.generator;
import lombok.Data;
import java.util.Map;
/**
* 表单组件属性配置
* @Author: tzx
* @Date: 2022/5/11 15:45
*/
@Data
public class FormAttrConfig {
/**
* 表单类型modal,drawer
*/
private String formType;
/**
* 表单大小 根据antd表单属性来 large medium small default
*/
private String size;
/**
* 是否隐藏表单必填标记
*/
private Boolean hideRequiredMark;
/**
* 表单布局方式 根据antd表单布局来 horizontal vertical inline
*/
private String layout;
/**
* 表单标签位置 根据antd 属性来 left right
*/
private String labelAlign;
/**
* 表单的样式(标题宽度)
*/
private Map<String, Object> labelCol;
/**
* 弹窗宽度
*/
private Integer formWidth;
}

View File

@ -0,0 +1,29 @@
package com.xjrsoft.common.core.domain.generator;
import lombok.Data;
import java.util.List;
import java.util.Map;
/**
* 表单配置
* @Author: tzx
* @Date: 2022/5/11 15:43
*/
@Data
public class FormConfig {
/**
* 所有组件配置
*/
private List<ComponentConfig> list;
/**
* 表单属性配置
*/
private FormAttrConfig config;
/**
* 隐藏组件
*/
private List<Map<String, Object>> hiddenComponent;
}

View File

@ -0,0 +1,17 @@
package com.xjrsoft.common.core.domain.generator;
import lombok.Data;
import java.util.List;
/**
* 布局组件子级 tab 和 grid
* @Author: tzx
* @Date: 2022/5/25 17:54
*/
@Data
public class LayoutOptionModel {
private String name;
private Integer span;
private List<ComponentConfig> list;
}

View File

@ -0,0 +1,35 @@
package com.xjrsoft.common.core.domain.page;
import cn.hutool.core.util.StrUtil;
import com.xjrsoft.common.core.xss.SQLFilter;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
/**
* @Author: tzx
* @Date: 2022/4/28 15:33
*/
@Data
@ToString
@Tag(name = "ListInput", description = "不分页入参")
public class ListInput {
public ListInput(){
}
@Schema(name = "排序字段")
private String field;
@Schema(name = "排序方式 asc desc")
private String order;
@Schema(name = "关键词")
@Length(max = 50, message = "关键词长度不能超过50")
private String keyword;
public String getField() {
return SQLFilter.sqlInject(StrUtil.toUnderlineCase(this.field));
}
}

View File

@ -0,0 +1,22 @@
package com.xjrsoft.common.core.domain.page;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import java.util.List;
@Data
public class PageInfoVo<T> {
/**
* 信息
*/
@JsonProperty("list")
private List<T> rows;
/**
* 总记录数
*/
@JsonProperty("total")
private Integer total;
}

View File

@ -0,0 +1,43 @@
package com.xjrsoft.common.core.domain.page;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.Data;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.io.Serializable;
/**
* @Author: tzx
* @Date: 2022/3/7 14:52
*/
@Data
@ToString
@Tag(name = "PageInput", description = "分页入参")
public class PageInput implements Serializable {
public PageInput(){
}
@Schema(name = "当前页标")
@Min(value = 1,message = "当前页标必须大于0")
private Integer limit = 1;
@Schema(name = "每页大小")
@Min(value = 1,message = "每页大小必须大于0")
@Max(value = 100,message = "每页大小必须小于100")
private Integer size = 15;
@Schema(name = "关键词")
@Length(max = 50, message = "关键词长度不能超过50")
private String keyword;
@Schema(name = "排序字段")
private String field;
@Schema(name = "排序方式 asc desc")
private String order;
}

View File

@ -0,0 +1,24 @@
package com.xjrsoft.common.core.domain.page;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* @Author: tzx
* @Date:2022/3/7 14:55
*/
@Data
public class PageOutput<T> implements Serializable {
public Integer totalPage;
public Integer currentPage;
public Integer pageSize;
public Integer total;
public List<T> list;
}

View File

@ -0,0 +1,86 @@
package com.xjrsoft.common.core.domain.result;
import com.xjrsoft.common.core.enums.ResponseCode;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.HashMap;
/**
* 返回数据
*
* @author tzx
*/
public class R extends HashMap<String, Object> {
private static final long serialVersionUID = 1L;
public R() {
put("code", 0);
put("success", true);
put("msg", "");
}
public static R error() {
return error(ResponseCode.INTERNAL_SERVER_ERROR.getCode(), "未知异常,请联系管理员");
}
public static R error(String msg) {
return error(ResponseCode.INTERNAL_SERVER_ERROR.getCode(), msg);
}
public static R error(int code, String msg) {
R r = new R();
r.put("code", code);
r.put("msg", msg);
r.put("data",null);
return r;
}
public static R ok(String msg,Object result) {
R r = new R();
r.put("msg", msg);
r.put("data",result);
return r;
}
public static R ok(Object result) {
R r = new R();
r.put("msg", "");
r.put("data",result);
return r;
}
// public static R ok(Map<String, Object> map) {
// R r = new R();
// r.put("data",map);
// return r;
// }
public static R ok() {
return new R().put("data",null);
}
public static ResponseEntity<byte[]> fileStream(byte[] bot, String fileName) {
HttpHeaders headers = new HttpHeaders();
headers.setContentDispositionFormData("attachment", Arrays.toString(fileName.getBytes(StandardCharsets.UTF_8)));
headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
return new ResponseEntity<byte[]>(bot, headers, HttpStatus.OK);
}
@Override
public R put(String key, Object value) {
super.put(key, value);
return this;
}
public Object getData(){
return this.get("data");
}
}

View File

@ -0,0 +1,38 @@
package com.xjrsoft.common.core.domain.tree;
import java.util.List;
/**
* @Author: tzx
* @Date: 2022/3/7 15:46
*/
public interface ITreeNode<T extends ITreeNode<T, V>, V > {
/**
* 获取id
*
* @return
*/
V getId();
/**
* 获取父级id
*
* @return
*/
V getParentId();
/**
* 获取子级
*
* @return
*/
List<T> getChildren();
/**
* 设置子级
*
* @param children
*/
void setChildren(List<T> children);
}

View File

@ -0,0 +1,40 @@
package com.xjrsoft.common.core.enums;
/**
* @author Zexy
*/
public enum AuthorizeType {
/**
* 菜单
*/
MENU(0, "菜单"),
/**
* 按钮
*/
BUTTON(1, "按钮"),
/**
* 列表
*/
COLUMN(2, "列表"),
/**
* 表单
*/
FORM(3, "表单");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
AuthorizeType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,48 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/3/8 9:15
*/
public enum CloudType {
/**
* 七牛云
* */
QINIUCLOUD(1, "七牛云"),
/**
* 阿里云
* */
ALICLOUD(2, "阿里云"),
/**
* 腾讯云
* */
QCLOUD(3, "腾讯云"),
/**
* 华为云
* */
HWCLOUD(4, "华为云"),
/**
* Minio
* */
MINIO(5, "Minio");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
CloudType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,48 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/6/27 14:19
*/
public enum CodeRuleTypeEnum {
/**
* 字符串
*/
CUSTOM(0, "自定义"),
/**
* 日期
*/
DATE(1, "日期"),
/**
* 流水号
*/
SERIAL(2, "流水号"),
/**
* 部门
*/
DEPARTMENT(3, "部门"),
/**
* 用户
*/
USER(4, "用户"),
/**
* 公司
*/
COMPANY(5, "公司");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
CodeRuleTypeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,81 @@
package com.xjrsoft.common.core.enums;
public enum DB2FieldsType {
/**
* 短文本
* */
VARCHAR(0, "VARCHAR", "短文本"),
/**
* 长文本
* */
VARCHARMAX(1, "LONG VARCHAR", "长文本"),
/**
* 数字类型
* */
INT(2, "INTEGER", "数字"),
/**
* 小数
* */
FLOAT(3, "DOUBLE", "小数"),
/**
* 日期
* */
DATE(4, "DATE", "日期"),
/**
* 日期时间类型
* */
DATETIME(5, "TIMESTAMP", "日期时间"),
/**
* 主表主键
* */
FK(6, "BIGINT", "主表主键"),
/**
* 长整数
* */
LONG(7, "BIGINT", "长整数"),
/**
* 时间
* */
TIME(8, "TIME", "时间");
final int code;
final String type;
final String message;
public int getCode() {
return this.code;
}
public String getType() {
return this.type;
}
public String getMessage() {
return this.message;
}
public static DB2FieldsType getFieldType(Integer fieldType) {
DB2FieldsType[] var1 = values();
int var2 = var1.length;
for (DB2FieldsType type : var1) {
if (type.code == fieldType) {
return type;
}
}
return VARCHAR;
}
DB2FieldsType(final int code, final String type, final String message) {
this.code = code;
this.type = type;
this.message = message;
}
}

View File

@ -0,0 +1,44 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: hnyyzy
* @Date: 2023/9/19 15:12
*/
public enum DataAuthConditionTypeEnum {
EQUAL_TO(0, "等于"),
GREATER_THAN(1, "大于"),
GREATER_THAN_EQUAL(2,"大于等于"),
MINOR_THAN(3, "小于"),
MINOR_THAN_EQUAL(4,"小于等于"),
CONTAIN(5,"包含"),
CONTAINED_IN(6,"包含于"),
NO_EQUAL_TO(7, "不等于"),
NO_CONTAIN(8,"不包含"),
NO_CONTAINED_IN(9,"不包含于");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
DataAuthConditionTypeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,43 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/3/1 15:12
*/
public enum DataAuthFieldTypeEnum {
STRING(0, "文本/字符串"),
INT(1, "数字类型"),
LOGIN_USER_ID(2, "登陆人id"),
LOGIN_DEP_ID(3, "登陆人组织架构id"),
LOGIN_DEP_CHILD_ID(4, "登陆人组织架构 和 下属组织架构 id"),
LOGIN_USER_NAME(5, "登陆人账户id"),
LOGIN_POST_ID(6, "登陆人岗位id"),
LOGIN_ROLE_ID(7, "登陆人角色id"),
LOGIN_ROLE_CODE(8, "登陆人角色编码");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
DataAuthFieldTypeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,35 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/2/27 15:22
*/
public enum DataAuthMethodEnum {
/*
*
* 简易
* */
SIMPLE(0, "简易"),
/*
* 自定义
* */
CUSTOM(1, "自定义");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
DataAuthMethodEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,43 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/2/28 16:19
*/
public enum DataAuthScopeEnum {
MY(0, "仅查看登录人数据"),
MY_AND_POST(1, "仅查看登录人同岗位数据"),
MY_AND_CHILD_POST(2, "仅查看登录人及所有下属岗位数据"),
MY_AND_POST_AND_CHILD_POST(3, "仅查看登录人同岗位及所有下属岗位数据"),
MY_AND_ORG(4, "仅查看登录人同组织架构人员数据"),
MY_AND_CHILD_ORG(5, "仅查看登录人及所有下属组织架构人员数据"),
MY_AND_ORG_AND_CHILD_ORG(6, "仅查看登录人同组织架构人员及所有下属组织架构人员数据"),
ROLE(7, "仅查看登录人同角色数据");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
DataAuthScopeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,34 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/2/27 15:20
*/
public enum DataAuthTypeEnum {
/*
*
* 角色
* */
ROLE(0, "角色"),
/*
* 用户
* */
USER(1, "用户");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
DataAuthTypeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,78 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/5/5 19:07
*/
public enum DbFieldsType {
/**
* 短文本
* */
VARCHAR(0, "短文本"),
/**
* 阿里云
* */
VARCHARMAX(1, "长文本"),
/**
* 数字类型
* */
INT(2, "数字"),
/**
* 小数
* */
FLOAT(3, "小数"),
/**
* 日期
* */
DATE(4, "日期"),
/**
* 日期时间类型
* */
DATETIME(5, "日期时间"),
/**
* 主表主键
* */
FK(6, "主表主键"),
/**
* 长整数
* */
LONG(7, "长整数"),
/**
* 时间
* */
TIME(8, "时间");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
public static DbFieldsType getFieldType(Integer fieldType) {
DbFieldsType[] var1 = values();
int var2 = var1.length;
for (DbFieldsType type : var1) {
if (type.code == fieldType) {
return type;
}
}
return VARCHAR;
}
DbFieldsType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,32 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/3/4 17:04
*/
public enum DeleteMark {
/*
* 未启用
* */
NODELETE(0, "未删除"),
/*
* 启用
* */
DELETED(1, "已删除");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
DeleteMark(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,32 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/3/3 16:37
*/
public enum EnabledMark {
/*
* 未启用
* */
DISABLED(0, "未启用"),
/*
* 启用
* */
ENABLED(1, "已启用");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
EnabledMark(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,34 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/12/14 14:04
*/
public enum ErrorTypeEnum {
/**
* 系统错误信息
* */
SYSTEM(0, "系统错误信息"),
/**
* 友好错误信息
* */
SIMPLE(1, "友好错误信息");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
ErrorTypeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/5/10 10:36
*/
public enum FormTemplateType {
/**
* 自定义表单
*/
CUSTOM(1, "自定义表单"),
/*
* 系统表单
*/
SYSTEM(0, "系统表单");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
FormTemplateType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,31 @@
package com.xjrsoft.common.core.enums;
public enum IsReadTypeEnum {
/**
* 未读
*/
UNREAD(0, "未读"),
/**
* 已读
*/
READ(1, "已读");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
IsReadTypeEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,44 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/3/3 16:37
*/
public enum LogCategory {
/**
* 登录
* */
LOGIN(1, "登录"),
/**
* 登录
* */
GET(2, "访问"),
/**
* 登录
* */
OPERAT(3, "操作"),
/**
* 登录
* */
EXCEPTION(4, "异常");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
LogCategory(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,32 @@
package com.xjrsoft.common.core.enums;
public enum LogCategoryEnum {
LOGIN(1, "登录"),
GET(2, "访问"),
OPERAT(3, "操作"),
EXCEPTION(4, "异常"),
INTERFACE(5,"接口"),
FORM(6,"表单");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
private LogCategoryEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/8/17 15:00
*/
public enum MenuType {
/**
* 字符串
*/
MENU(0, "菜单"),
/**
* 数字
*/
FUNCTION(1, "功能");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
MenuType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,43 @@
package com.xjrsoft.common.core.enums;
/**
* 消息类型
* @Author: tzx
* @Date: 2022/10/26 16:12
*/
public enum MessageType {
/**
* 日程
*/
SCHEDULE(0, "日程"),
/**
* 工作流审批
*/
APPROVE(1, "工作流审批"),
/**
* 工作流审批
*/
CIRCULATED(2, "工作流传阅"),
/**
* 工作流审批
*/
TIMEOUT(3, "超时");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
MessageType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,80 @@
package com.xjrsoft.common.core.enums;
public enum MySqlFieldsType {
/**
* 短文本
* */
VARCHAR(0, "varchar", "短文本"),
/**
* 阿里云
* */
VARCHARMAX(1, "longtext", "长文本"),
/**
* 数字类型
* */
INT(2, "int", "数字"),
/**
* 小数
* */
FLOAT(3, "double", "小数"),
/**
* 日期
* */
DATE(4, "date", "日期"),
/**
* 日期时间类型
* */
DATETIME(5, "datetime", "日期时间"),
/**
* 主表主键
* */
FK(6, "bigint", "主表主键"),
/**
* 长整数
* */
LONG(7, "bigint", "长整数"),
/**
* 时间
* */
TIME(8, "time", "时间");
final int code;
final String type;
final String message;
public int getCode() {
return this.code;
}
public String getType() {
return this.type;
}
public String getMessage() {
return this.message;
}
public static MySqlFieldsType getFieldType(Integer fieldType) {
MySqlFieldsType[] var1 = values();
int var2 = var1.length;
for (MySqlFieldsType type : var1) {
if (type.code == fieldType) {
return type;
}
}
return VARCHAR;
}
MySqlFieldsType(final int code, final String type, final String message) {
this.code = code;
this.type = type;
this.message = message;
}
}

View File

@ -0,0 +1,80 @@
package com.xjrsoft.common.core.enums;
public enum OracleFieldsType {
/**
* 短文本
* */
VARCHAR(0, "VARCHAR2", "短文本"),
/**
* 长文本
* */
VARCHARMAX(1, "NVARCHAR2", "长文本"),
/**
* 数字类型
* */
INT(2, "NUMBER", "数字"),
/**
* 小数
* */
FLOAT(3, "NUMBER", "小数"),
/**
* 日期
* */
DATE(4, "DATE", "日期"),
/**
* 日期时间类型
* */
DATETIME(5, "TIMESTAMP", "日期时间"),
/**
* 主表主键
* */
FK(6, "NUMBER", "主表主键"),
/**
* 长整数
* */
LONG(7, "NUMBER", "长整数"),
/**
* 时间
* */
TIME(8, "INTERVAL DAY(0) TO SECOND(6)", "时间");
final int code;
final String type;
final String message;
public int getCode() {
return this.code;
}
public String getType() {
return this.type;
}
public String getMessage() {
return this.message;
}
public static OracleFieldsType getFieldType(Integer fieldType) {
OracleFieldsType[] var1 = values();
int var2 = var1.length;
for (OracleFieldsType type : var1) {
if (type.code == fieldType) {
return type;
}
}
return VARCHAR;
}
OracleFieldsType(final int code, final String type, final String message) {
this.code = code;
this.type = type;
this.message = message;
}
}

View File

@ -0,0 +1,40 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/10/17 14:59
*/
public enum ParamAssignmentType {
/**
* 值
*/
VALUE(0, ""),
/**
* 变量
*/
VAR(1, "流程变量"),
/**
* api
*/
API(2, "API"),
/**
* 变量
*/
FORM(3, "表单");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
ParamAssignmentType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,80 @@
package com.xjrsoft.common.core.enums;
public enum PostgreSqlFieldsType {
/**
* 短文本
* */
VARCHAR(0, "varchar", "短文本"),
/**
* 阿里云
* */
VARCHARMAX(1, "text", "长文本"),
/**
* 数字类型
* */
INT(2, "bigint", "数字"),
/**
* 小数
* */
FLOAT(3, "float8", "小数"),
/**
* 日期
* */
DATE(4, "timestamp", "日期"),
/**
* 日期时间类型
* */
DATETIME(5, "timestamp", "日期时间"),
/**
* 主表主键
* */
FK(6, "bigint", "主表主键"),
/**
* 长整数
* */
LONG(7, "bigint", "长整数"),
/**
* 时间
* */
TIME(8, "time", "时间");
final int code;
final String type;
final String message;
public int getCode() {
return this.code;
}
public String getType() {
return this.type;
}
public String getMessage() {
return this.message;
}
public static PostgreSqlFieldsType getFieldType(Integer fieldType) {
PostgreSqlFieldsType[] var1 = values();
int var2 = var1.length;
for (PostgreSqlFieldsType type : var1) {
if (type.code == fieldType) {
return type;
}
}
return VARCHAR;
}
PostgreSqlFieldsType(final int code, final String type, final String message) {
this.code = code;
this.type = type;
this.message = message;
}
}

View File

@ -0,0 +1,36 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/5/24 16:13
*/
public enum PublishStateType {
/*
* 未发布菜单
* */
NO(0, "未发布菜单"),
/*
* 正在发布
* */
ING(1, "正在发布"),
/*
* 发布过已经取消
* */
PT(2, "发布过已经取消");
final int code;
final String message;
public int getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
PublishStateType(final int code, final String message) {
this.code = code;
this.message = message;
}
}

View File

@ -0,0 +1,81 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/3/3 15:49
*/
public enum ResponseCode {
/*
* 成功
* */
SUCCESS(0, "操作成功"),
/*
* 业务异常
* */
FAILURE(10400, "业务异常"),
/*
* 请求未授权
* */
UN_AUTHORIZED(10401, "请求未授权"),
/*
* 404 没找到资源
* */
NOT_FOUND(10404, "404 没找到资源"),
/*
* 消息不能读取
* */
MSG_NOT_READABLE(10400, "消息不能读取"),
/*
* 不支持当前请求方法
* */
METHOD_NOT_SUPPORTED(10405, "不支持当前请求方法"),
/*
* 不支持当前媒体类型
* */
MEDIA_TYPE_NOT_SUPPORTED(10415, "不支持当前媒体类型"),
/*
* 请求被拒绝
* */
REQ_REJECT(10403, "请求被拒绝"),
/*
* 服务器异常
* */
INTERNAL_SERVER_ERROR(10500, "服务器异常"),
/*
* 缺少必要的请求参数
* */
PARAM_MISS(10400, "缺少必要的请求参数"),
/*
* 请求参数类型错误
* */
PARAM_TYPE_ERROR(10400, "请求参数类型错误"),
/*
* 请求参数绑定错误
* */
PARAM_BIND_ERROR(10400, "请求参数绑定错误"),
/*
* 参数校验失败
* */
PARAM_VALID_ERROR(10400, "参数校验失败"),
/*
* 参数校验失败
* */
MAGIC_API_UN_AUTHORIZED(10404, "magicAPI接口未授权");
final int code;
final String message;
public int getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
ResponseCode(final int code, final String message) {
this.code = code;
this.message = message;
}
}

View File

@ -0,0 +1,65 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/6/6 10:24
*/
public enum SmsCloudType {
/**
* 阿里云
* */
ALI_CLOUD(1, "阿里云"),
/**
* 腾讯 短信
* */
TENCENT_CLOUD(2, "腾讯"),
/**
* 华为云
* */
HW_CLOUD(3, "华为云"),
/**
* 合一 短信
* */
HEYI_CLOUD(4, "合一"),
/**
* 京东 短信
* */
JD_CLOUD(5, "京东"),
/**
* 容联 短信
* */
RONGLIAN_CLOUD(6, "容联"),
/**
* 亿美 短信
* */
YIMEI_CLOUD(7, "亿美"),
/**
* 天翼云 短信
* */
TIANYI_CLOUD(8, "天翼云"),
/**
* 云片短信
* */
YUNPIAN_CLOUD(9, "云片");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
SmsCloudType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,43 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/7/6 10:32
*/
public enum SmsType {
/**
* 验证码
*/
CAPTCHA(0, "验证码"),
/**
* 消息通知
*/
NOTIFY(1, "消息通知"),
/**
* 传阅通知
*/
CIRCULATED(2, "传阅通知"),
/**
* 超时提醒
*/
TIMEOUT(3, "超时提醒");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
SmsType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,80 @@
package com.xjrsoft.common.core.enums;
public enum SqlServerFieldsType {
/**
* 短文本
* */
VARCHAR(0, "nvarchar", "短文本"),
/**
* 阿里云
* */
VARCHARMAX(1, "nvarchar", "长文本"),
/**
* 数字类型
* */
INT(2, "int", "数字"),
/**
* 小数
* */
FLOAT(3, "float", "小数"),
/**
* 日期
* */
DATE(4, "datetime", "日期"),
/**
* 日期时间类型
* */
DATETIME(5, "datetime", "日期时间"),
/**
* 主表主键
* */
FK(6, "bigint", "主表主键"),
/**
* 长整数
* */
LONG(7, "bigint", "长整数"),
/**
* 时间
* */
TIME(8, "time", "时间");
final int code;
final String type;
final String message;
public int getCode() {
return this.code;
}
public String getType() {
return this.type;
}
public String getMessage() {
return this.message;
}
public static SqlServerFieldsType getFieldType(Integer fieldType) {
SqlServerFieldsType[] var1 = values();
int var2 = var1.length;
for (SqlServerFieldsType type : var1) {
if (type.code == fieldType) {
return type;
}
}
return VARCHAR;
}
SqlServerFieldsType(final int code, final String type, final String message) {
this.code = code;
this.type = type;
this.message = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/2/21 14:09
*/
public enum StampEnum {
/**
* 私人签章
*/
PRIVATE(0, "私人签章"),
/**
* 公共签章
*/
PUBLIC(1, "公共签章");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
StampEnum(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,60 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/1/11 14:27
*/
public enum TransType {
/**
* 数据字典
*/
DIC(0, "数据字典"),
/**
* 用户
*/
USER(1, "用户"),
/**
* 机构
*/
DEPT(2, "机构"),
/**
* 机构
*/
POST(3, "岗位"),
/**
* API
*/
API(4, "API"),
/**
* 行政区域
*/
AREA(5, "行政区域"),
/**
* 级联
*/
CASCADE(6, "级联");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
TransType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,37 @@
package com.xjrsoft.common.core.enums;
/**
* typescript 字段类型美剧
* @Author: tzx
* @Date: 2022/5/27 9:44
*/
public enum TsColumnType {
/**
* 字符串
*/
STRING(0, "字符串"),
/**
* 数字
*/
NUMBER(1, "数字"),
/**
* 布尔
*/
BOOL(2, "布尔");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
TsColumnType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,48 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/10/12 16:07
*/
public enum WorkflowApproveType {
/**
* 同意
*/
AGREE(0, "同意"),
/**
* 拒绝
*/
DISAGREE(1, "拒绝"),
/**
* 指定
*/
REJECT(2, "驳回"),
/**
* 结束
*/
FINISH(3, "结束"),
/**
* 其他(用户自定义)
*/
OTHER(4, "其他(用户自定义)");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowApproveType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* 工作流人员权限配置
* @Author: tzx
* @Date: 2022/9/26 15:58
*/
public enum WorkflowAuth {
/**
* 全部
*/
ALL(0, "全部"),
/**
* 指定
*/
ASSIGN(1, "指定");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowAuth(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,42 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/10/18 14:32
*/
public enum WorkflowAutoAgreeType {
/**
* 无
*/
NONE(0, ""),
/**
* 候选审批人包含流程任务发起人
*/
APPROVED_INCLUDE_INITIATOR(1, "候选审批人包含流程任务发起人"),
/**
* 候选审批人包含上一节点审批人
*/
APPROVED_INCLUDE_PREV(2, "候选审批人包含上一节点审批人"),
/**
* 候选审批人在流传中审批过
*/
APPROVED_IN_PROCESS(3, "候选审批人在流传中审批过");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowAutoAgreeType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,35 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/11/18 15:56
*/
public enum WorkflowCallActivityType {
/**
* 单个
*/
SINGLE(0,"单实例"),
/**
* 多实例
*/
MULTI(1,"多实例");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowCallActivityType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,34 @@
package com.xjrsoft.common.core.enums;
/**
* 工作流事件 执行类型
* @Author: tzx
* @Date: 2023/6/7 14:10
*/
public enum WorkflowEventExType {
/**
* API
*/
API(0, "API"),
/**
* 规则
*/
LITEFLOW(1, "规则");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowEventExType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,34 @@
package com.xjrsoft.common.core.enums;
/**
* 工作流事件类型
* @Author: tzx
* @Date: 2023/6/7 14:15
*/
public enum WorkflowEventType {
/**
* 开始事件
*/
START(0, "start"),
/**
* 结束事件
*/
END(1, "end");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowEventType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/12/12 18:44
*/
public enum WorkflowIsPrevChooseNextType {
/**
* 超级管理员处理
*/
NONE(0, ""),
/**
* 上节点审批人指定
*/
PREV(1, "上节点审批人指定");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowIsPrevChooseNextType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,35 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/11/1 10:48
*/
public enum WorkflowIsRecycleType {
/**
* 未移到回收站
*/
NO(0,"未移到回收站"),
/**
* 已移到回收站
*/
YES(1,"已移到回收站");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowIsRecycleType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,64 @@
package com.xjrsoft.common.core.enums;
/**
* 工作流成员配置类型枚举
* @Author: tzx
* @Date: 2022/9/26 16:01
*/
public enum WorkflowMemberType {
/**
* 用户
*/
USER(0, "用户"),
/**
* 角色
*/
ROLE(1, "角色"),
/**
* 岗位
*/
POST(2, "岗位"),
/**
* 指定节点审批人
*/
APPROVE(3,"指定节点审批人"),
/**
* 上级领导
*/
LEADER(4,"上级领导"),
/**
* 表单字段
*/
FORM_FIELD(5,"表单字段"),
/***
* API
*/
API(6,"api接口"),
/**
* sql指定
*/
SQL(7,"sql指定");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowMemberType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,36 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2023/5/29 16:41
*/
public enum WorkflowMultiInstanceFinishType {
/**
* 全部
*/
ALL(0, "全部"),
/**
* 单个
*/
SINGLE(1, "单个"),
/**
* 百分比
*/
PERCENTAGE(2, "百分比");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowMultiInstanceFinishType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,37 @@
package com.xjrsoft.common.core.enums;
/**
* 工作流多实例类型
* @Author: tzx
* @Date: 2022/10/19 14:41
*/
public enum WorkflowMultiInstanceType {
/**
* 无
*/
NONE(0, ""),
/**
* 同步执行(并行)
*/
PARALLEL(1, "同步执行(并行)"),
/**
* 顺序执行(串行)
*/
SEQUENTIAL(2, "顺序执行(串行)");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowMultiInstanceType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* 无对应处理人 类型
* @Author: tzx
* @Date: 2022/10/18 16:10
*/
public enum WorkflowNoHandlerType {
/**
* 超级管理员处理
*/
ADMIN(0, "超级管理员处理"),
/**
* 上节点审批人指定
*/
PREV(1, "上节点审批人指定");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowNoHandlerType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,47 @@
package com.xjrsoft.common.core.enums;
/**
* 通知策略
* @Author: tzx
* @Date: 2022/10/26 15:14
*/
public enum WorkflowNoticePolicyType {
/**
* 系统消息
*/
SYSTEM(0, "系统消息"),
/**
* 短信
*/
SMS(1, "短信"),
/**
* 企业微信
*/
WECHAT(2, "企业微信"),
/**
* 钉钉
*/
DING(3, "钉钉"),
/**
* 邮箱
*/
EMAIL(4, "邮箱");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowNoticePolicyType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,33 @@
package com.xjrsoft.common.core.enums;
/**
* 参数操作类型
* @Author: tzx
* @Date: 2022/10/14 15:49
*/
public enum WorkflowOperationType {
/*
* 未启用
* */
FORM(0, "表单赋值"),
/*
* 启用
* */
PARAM(1, "参数赋值");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowOperationType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,38 @@
package com.xjrsoft.common.core.enums;
/**
* 流程参数类型
* @Author: tzx
* @Date: 2022/9/27 11:18
*/
public enum WorkflowParamType {
/**
* 值
*/
VALUE(0, ""),
/**
* 变量
*/
VAR(1, "变量"),
/**
* API
*/
API(2, "API");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowParamType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,32 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/10/27 14:53
*/
public enum WorkflowRelationAuthType {
/**
* 限发起人发起的此模板任务
*/
ORIGINATOR(0, "限发起人发起的此模板任务"),
/**
* 所有此模板发起的任务
*/
ALL(1, "所有此模板发起的任务");
final int code;
final String value;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
WorkflowRelationAuthType(final int code, final String message) {
this.code = code;
this.value = message;
}
}

View File

@ -0,0 +1,38 @@
package com.xjrsoft.common.core.enums;
/**
* @Author: tzx
* @Date: 2022/12/16 10:06
*/
public enum YesOrNoEnum {
/**
* 值
*/
NO(0, "","N"),
/**
* API
*/
YES(1, "","Y");
final int code;
final String value;
final String textCode;
public int getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
public String getTextCode() {
return this.textCode;
}
YesOrNoEnum(final int code, final String message, final String textCode) {
this.code = code;
this.value = message;
this.textCode=textCode;
}
}

View File

@ -0,0 +1,124 @@
package com.xjrsoft.common.core.exception;
import cn.dev33.satoken.exception.NotLoginException;
import cn.dev33.satoken.exception.NotPermissionException;
import com.xjrsoft.common.core.config.CommonPropertiesConfig;
import com.xjrsoft.common.core.domain.result.R;
import com.xjrsoft.common.core.enums.ErrorTypeEnum;
import com.xjrsoft.common.core.enums.ResponseCode;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.BindException;
import org.springframework.validation.BindingResult;
import org.springframework.validation.FieldError;
import org.springframework.validation.ObjectError;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import java.util.List;
/**
* @Author: tzx
* @Date: 2022/3/3 15:38
*/
@RestControllerAdvice
@Slf4j
@RequiredArgsConstructor
public class GlobalExceptionHandler {
private final CommonPropertiesConfig commonPropertiesConfig;
private final String ERROR_MESSAGE = "系统错误,请联系管理员!";
private final String NOTLOGIN_MESSAGE = "系统未登录,请登录!";
private final String VALIDATION_MESSAGE = "数据校验错误!";
/**
* 全局异常处理
*
* @Author: tzx
*/
@ExceptionHandler(Exception.class)
@ResponseBody
public R globalExceptionHandler(Exception e){
log.error(e.getMessage()+"\n", e);
if (commonPropertiesConfig.getErrorType() == ErrorTypeEnum.SYSTEM) {
return R.error(ResponseCode.INTERNAL_SERVER_ERROR.getCode(),e.getMessage());
}
else{
return R.error(ResponseCode.INTERNAL_SERVER_ERROR.getCode(),ERROR_MESSAGE);
}
}
/**
* 全局校验异常处理
*
* @Author: yaoyn
*/
@ExceptionHandler(ValidationException.class)
@ResponseBody
public R globalValidationExceptionHandler(ValidationException e){
log.error(e.getMessage()+"\n", e);
return R.error(ResponseCode.PARAM_VALID_ERROR.getCode(),VALIDATION_MESSAGE+e.getMessage());
}
/**
* 未登录异常处理
*
* @Author: tzx
*/
@ExceptionHandler(NotLoginException.class)
@ResponseBody
public R notLoginExceptionHandler(NotLoginException e){
log.error(e.getMessage()+"\n", e);
if (commonPropertiesConfig.getErrorType() == ErrorTypeEnum.SYSTEM) {
return R.error(ResponseCode.UN_AUTHORIZED.getCode(),ResponseCode.UN_AUTHORIZED.getMessage());
}
else{
return R.error(ResponseCode.UN_AUTHORIZED.getCode(),NOTLOGIN_MESSAGE);
}
}
/**
* 权限异常
*
* @Author: tzx
*/
@ExceptionHandler(NotPermissionException.class)
@ResponseBody
public R notPermissionExceptionHandler(NotPermissionException e){
log.error(e.getMessage()+"\n", e);
if (commonPropertiesConfig.getErrorType() == ErrorTypeEnum.SYSTEM) {
return R.error(ResponseCode.UN_AUTHORIZED.getCode(),e.getMessage());
}
else{
return R.error(ResponseCode.UN_AUTHORIZED.getCode(),ERROR_MESSAGE);
}
}
/**
* 参数错误异常
*
* @Author: tzx
*/
@ResponseBody
@ExceptionHandler({BindException.class})
public R paramExceptionHandler(BindException e) {
log.error(e.getMessage()+"\n", e);
BindingResult exceptions = e.getBindingResult();
// 判断异常中是否有错误信息,如果存在就使用异常中的消息,否则使用默认消息
if (exceptions.hasErrors()) {
List<ObjectError> errors = exceptions.getAllErrors();
if (!errors.isEmpty()) {
// 这里列出了全部错误参数,按正常逻辑,只需要第一条错误即可
FieldError fieldError = (FieldError) errors.get(0);
return R.error(fieldError.getDefaultMessage());
}
}
return R.error("请求参数错误");
}
}

View File

@ -0,0 +1,55 @@
package com.xjrsoft.common.core.exception;
import com.xjrsoft.common.core.enums.ResponseCode;
/**
* 自定义异常
* @author Zexy
* @version 1.0
*/
public class MyException extends RuntimeException {
private static final long serialVersionUID = 1L;
private String msg;
private int code = ResponseCode.INTERNAL_SERVER_ERROR.getCode();
public MyException(String msg) {
super(msg);
this.msg = msg;
}
public MyException(String msg, Throwable e) {
super(msg, e);
this.msg = msg;
}
public MyException(String msg, int code) {
super(msg);
this.msg = msg;
this.code = code;
}
public MyException(String msg, int code, Throwable e) {
super(msg, e);
this.msg = msg;
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
}

View File

@ -0,0 +1,24 @@
package com.xjrsoft.common.core.exception;
import com.xjrsoft.common.core.enums.ResponseCode;
public class ValidationException extends MyException{
private static final long serialVersionUID = 1L;
private static final int code = ResponseCode.PARAM_VALID_ERROR.getCode();
public ValidationException(String msg) {
super(msg, code);
}
public ValidationException(String msg, Throwable e) {
super(msg, code, e);
}
public ValidationException(String msg, int code) {
super(msg, code);
}
public ValidationException(String msg, int code, Throwable e) {
super(msg, code, e);
}
}

View File

@ -0,0 +1,9 @@
package com.xjrsoft.common.core.result;
import java.io.Serializable;
public interface IResultCode extends Serializable {
String getMessage();
int getCode();
}

View File

@ -0,0 +1,73 @@
package com.xjrsoft.common.core.result;
import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
@Getter
@Setter
public class Response<T> implements Serializable {
private static final long serialVersionUID = 1L;
public static final String MSG_QUERY_SUCCESSFUL = "查询成功!";
private int code;
private boolean success;
private String msg;
private T data;
public static <T> Response<T> ok(T data) {
return ok(0, data ,"");
}
public static <T> Response<T> ok(T data, String msg) {
return ok(0, data, msg);
}
//
public static <T> Response ok() {
return ok(0, null, "");
}
public static <T> Response notOk() {
return new Response(ResultCode.INTERNAL_SERVER_ERROR.code, null, "");
}
//成功 自定义返回 code data 以及 msg
public static <T> Response ok(int code, T data, String msg) {
return new Response(code, data, data == null ? "暂无承载数据" : msg);
}
//错误 返回自定义返回
public static <T> Response<T> notOk(int code, String msg) {
return new Response(code, null, msg);
}
public static <T> Response notOk(String msg,T data) {
return new Response(ResultCode.INTERNAL_SERVER_ERROR.code, data, msg);
}
//错误 返回500
public static <T> Response<T> notOk(String msg) {
return new Response(ResultCode.INTERNAL_SERVER_ERROR.code, null, msg);
}
public static <T> Response<T> status(boolean flag) {
return flag ? ok(null,"操作成功") : notOk("操作失败");
}
private Response(int code, T data, String msg) {
this.code = code;
this.data = data;
this.msg = msg;
this.success = ResultCode.SUCCESS.code == code;
}
private Response(boolean success) {
this.success = success;
}
}

View File

@ -0,0 +1,36 @@
package com.xjrsoft.common.core.result;
public enum ResultCode implements IResultCode {
SUCCESS(0, "操作成功"),
FAILURE(10400, "业务异常"),
UN_AUTHORIZED(10401, "请求未授权"),
NOT_FOUND(10404, "404 没找到请求"),
MSG_NOT_READABLE(10400, "消息不能读取"),
METHOD_NOT_SUPPORTED(10405, "不支持当前请求方法"),
MEDIA_TYPE_NOT_SUPPORTED(10415, "不支持当前媒体类型"),
REQ_REJECT(10403, "请求被拒绝"),
INTERNAL_SERVER_ERROR(10500, "服务器异常"),
PARAM_MISS(10400, "缺少必要的请求参数"),
PARAM_TYPE_ERROR(10400, "请求参数类型错误"),
PARAM_BIND_ERROR(10400, "请求参数绑定错误"),
PARAM_VALID_ERROR(10400, "参数校验失败"),
WX_LOGIN_ERROR(10409, "openId未关联账户");
final int code;
final String message;
public int getCode() {
return this.code;
}
public String getMessage() {
return this.message;
}
private ResultCode(final int code, final String message) {
this.code = code;
this.message = message;
}
}

View File

@ -0,0 +1,177 @@
package com.xjrsoft.common.core.support;
import com.xjrsoft.common.core.uitls.BeanUtil;
import org.springframework.asm.ClassVisitor;
import org.springframework.asm.Type;
import org.springframework.cglib.core.*;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Modifier;
import java.security.ProtectionDomain;
import java.util.HashMap;
import java.util.Map;
//import org.springframework.cglib.core.AbstractClassGenerator.Source;
public abstract class BaseBeanCopier {
private static final BeanCopierKey KEY_FACTORY = (BeanCopierKey)KeyFactory.create(BeanCopierKey.class);
private static final Type CONVERTER = TypeUtils.parseType("org.springframework.cglib.core.Converter");
private static final Type BEAN_COPIER = TypeUtils.parseType(BaseBeanCopier.class.getName());
private static final Signature COPY;
private static final Signature CONVERT;
public BaseBeanCopier() {
}
public static BaseBeanCopier create(Class source, Class target, boolean useConverter) {
return create(source, target, (ClassLoader)null, useConverter);
}
public static BaseBeanCopier create(Class source, Class target, ClassLoader classLoader, boolean useConverter) {
Generator gen;
if (classLoader == null) {
gen = new Generator();
} else {
gen = new Generator(classLoader);
}
gen.setSource(source);
gen.setTarget(target);
gen.setUseConverter(useConverter);
return gen.create();
}
public abstract void copy(Object from, Object to, Converter converter);
static {
COPY = new Signature("copy", Type.VOID_TYPE, new Type[]{Constants.TYPE_OBJECT, Constants.TYPE_OBJECT, CONVERTER});
CONVERT = TypeUtils.parseSignature("Object convert(Object, Class, Object)");
}
public static class Generator extends AbstractClassGenerator {
private static final Source SOURCE = new Source(BaseBeanCopier.class.getName());
private final ClassLoader classLoader;
private Class source;
private Class target;
private boolean useConverter;
Generator() {
super(SOURCE);
this.classLoader = null;
}
Generator(ClassLoader classLoader) {
super(SOURCE);
this.classLoader = classLoader;
}
public void setSource(Class source) {
if (!Modifier.isPublic(source.getModifiers())) {
this.setNamePrefix(source.getName());
}
this.source = source;
}
public void setTarget(Class target) {
if (!Modifier.isPublic(target.getModifiers())) {
this.setNamePrefix(target.getName());
}
this.target = target;
}
public void setUseConverter(boolean useConverter) {
this.useConverter = useConverter;
}
protected ClassLoader getDefaultClassLoader() {
return this.target.getClassLoader();
}
protected ProtectionDomain getProtectionDomain() {
return ReflectUtils.getProtectionDomain(this.source);
}
public BaseBeanCopier create() {
Object key = BaseBeanCopier.KEY_FACTORY.newInstance(this.source.getName(), this.target.getName(), this.useConverter);
return (BaseBeanCopier)super.create(key);
}
public void generateClass(ClassVisitor v) {
Type sourceType = Type.getType(this.source);
Type targetType = Type.getType(this.target);
ClassEmitter ce = new ClassEmitter(v);
ce.begin_class(46, 1, this.getClassName(), BaseBeanCopier.BEAN_COPIER, (Type[])null, "<generated>");
EmitUtils.null_constructor(ce);
CodeEmitter e = ce.begin_method(1, BaseBeanCopier.COPY, (Type[])null);
PropertyDescriptor[] getters = BeanUtil.getBeanGetters(this.source);
PropertyDescriptor[] setters = BeanUtil.getBeanSetters(this.target);
Map<String, Object> names = new HashMap(16);
PropertyDescriptor[] var9 = getters;
int var10 = getters.length;
int i;
PropertyDescriptor setter;
for(i = 0; i < var10; ++i) {
setter = var9[i];
names.put(setter.getName(), setter);
}
Local targetLocal = e.make_local();
Local sourceLocal = e.make_local();
e.load_arg(1);
e.checkcast(targetType);
e.store_local(targetLocal);
e.load_arg(0);
e.checkcast(sourceType);
e.store_local(sourceLocal);
for(i = 0; i < setters.length; ++i) {
setter = setters[i];
PropertyDescriptor getter = (PropertyDescriptor)names.get(setter.getName());
if (getter != null) {
MethodInfo read = ReflectUtils.getMethodInfo(getter.getReadMethod());
MethodInfo write = ReflectUtils.getMethodInfo(setter.getWriteMethod());
if (this.useConverter) {
Type setterType = write.getSignature().getArgumentTypes()[0];
e.load_local(targetLocal);
e.load_arg(2);
e.load_local(sourceLocal);
e.invoke(read);
e.box(read.getSignature().getReturnType());
EmitUtils.load_class(e, setterType);
e.push(write.getSignature().getName());
e.invoke_interface(BaseBeanCopier.CONVERTER, BaseBeanCopier.CONVERT);
e.unbox_or_zero(setterType);
e.invoke(write);
} else if (compatible(getter, setter)) {
e.load_local(targetLocal);
e.load_local(sourceLocal);
e.invoke(read);
e.invoke(write);
}
}
}
e.return_value();
e.end_method();
ce.end_class();
}
private static boolean compatible(PropertyDescriptor getter, PropertyDescriptor setter) {
return setter.getPropertyType().isAssignableFrom(getter.getPropertyType());
}
protected Object firstInstance(Class type) {
return ReflectUtils.newInstance(type);
}
protected Object nextInstance(Object instance) {
return instance;
}
}
interface BeanCopierKey {
Object newInstance(String source, String target, boolean useConverter);
}
}

View File

@ -0,0 +1,19 @@
package com.xjrsoft.common.core.support;
public class BeanProperty {
private final String name;
private final Class<?> type;
public String getName() {
return this.name;
}
public Class<?> getType() {
return this.type;
}
public BeanProperty(final String name, final Class<?> type) {
this.name = name;
this.type = type;
}
}

View File

@ -0,0 +1,84 @@
package com.xjrsoft.common.core.support;
import org.springframework.lang.Nullable;
import java.io.Writer;
public class FastStringWriter extends Writer {
private StringBuilder builder;
public FastStringWriter() {
this.builder = new StringBuilder(64);
}
public FastStringWriter(final int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException("Negative builderfer size");
} else {
this.builder = new StringBuilder(capacity);
}
}
public FastStringWriter(@Nullable final StringBuilder builder) {
this.builder = builder != null ? builder : new StringBuilder(64);
}
public StringBuilder getBuilder() {
return this.builder;
}
public void write(int c) {
this.builder.append((char)c);
}
public void write(char[] cbuilder, int off, int len) {
if (off >= 0 && off <= cbuilder.length && len >= 0 && off + len <= cbuilder.length && off + len >= 0) {
if (len != 0) {
this.builder.append(cbuilder, off, len);
}
} else {
throw new IndexOutOfBoundsException();
}
}
public void write(String str) {
this.builder.append(str);
}
public void write(String str, int off, int len) {
this.builder.append(str.substring(off, off + len));
}
public FastStringWriter append(CharSequence csq) {
if (csq == null) {
this.write("null");
} else {
this.write(csq.toString());
}
return this;
}
public FastStringWriter append(CharSequence csq, int start, int end) {
CharSequence cs = csq == null ? "null" : csq;
this.write(((CharSequence)cs).subSequence(start, end).toString());
return this;
}
public FastStringWriter append(char c) {
this.write(c);
return this;
}
public String toString() {
return this.builder.toString();
}
public void flush() {
}
public void close() {
this.builder.setLength(0);
this.builder.trimToSize();
}
}

View File

@ -0,0 +1,92 @@
package com.xjrsoft.common.core.support;
import com.xjrsoft.common.core.uitls.Func;
import org.springframework.util.LinkedCaseInsensitiveMap;
import java.sql.Time;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
public class Kv extends LinkedCaseInsensitiveMap<Object> {
private Kv() {
}
public static Kv init() {
return new Kv();
}
public static HashMap newMap() {
return new HashMap(16);
}
public Kv set(String attr, Object value) {
this.put(attr, value);
return this;
}
public Kv setIgnoreNull(String attr, Object value) {
if (null != attr && null != value) {
this.set(attr, value);
}
return this;
}
public Object getObj(String key) {
return super.get(key);
}
public <T> T get(String attr, T defaultValue) {
Object result = this.get(attr);
return result != null ? (T) result : defaultValue;
}
public String getStr(String attr) {
return Func.toStr(this.get(attr), (String)null);
}
public Integer getInt(String attr) {
return Func.toInt(this.get(attr), -1);
}
public Long getLong(String attr) {
return Func.toLong(this.get(attr), -1L);
}
public Float getFloat(String attr) {
return Func.toFloat(this.get(attr), (Float)null);
}
public Double getDouble(String attr) {
return Func.toDouble(this.get(attr), (Double)null);
}
public Boolean getBool(String attr) {
return Func.toBoolean(this.get(attr), (Boolean)null);
}
public byte[] getBytes(String attr) {
return (byte[])this.get(attr, (Object)null);
}
public Date getDate(String attr) {
return (Date)this.get(attr, (Object)null);
}
public Time getTime(String attr) {
return (Time)this.get(attr, (Object)null);
}
public Timestamp getTimestamp(String attr) {
return (Timestamp)this.get(attr, (Object)null);
}
public Number getNumber(String attr) {
return (Number)this.get(attr, (Object)null);
}
public Kv clone() {
return (Kv)super.clone();
}
}

View File

@ -0,0 +1,50 @@
package com.xjrsoft.common.core.support;
import com.xjrsoft.common.core.uitls.Func;
public class StrFormatter {
public StrFormatter() {
}
public static String format(final String strPattern, final Object... argArray) {
if (!Func.isBlank(strPattern) && !Func.isEmpty(argArray)) {
int strPatternLength = strPattern.length();
StringBuilder sbuf = new StringBuilder(strPatternLength + 50);
int handledPosition = 0;
for(int argIndex = 0; argIndex < argArray.length; ++argIndex) {
int delimIndex = strPattern.indexOf("{}", handledPosition);
if (delimIndex == -1) {
if (handledPosition == 0) {
return strPattern;
}
sbuf.append(strPattern, handledPosition, strPatternLength);
return sbuf.toString();
}
if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == '\\') {
if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == '\\') {
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append(Func.toStr(argArray[argIndex]));
handledPosition = delimIndex + 2;
} else {
--argIndex;
sbuf.append(strPattern, handledPosition, delimIndex - 1);
sbuf.append("{");
handledPosition = delimIndex + 1;
}
} else {
sbuf.append(strPattern, handledPosition, delimIndex);
sbuf.append(Func.toStr(argArray[argIndex]));
handledPosition = delimIndex + 2;
}
}
sbuf.append(strPattern, handledPosition, strPattern.length());
return sbuf.toString();
} else {
return strPattern;
}
}
}

View File

@ -0,0 +1,234 @@
package com.xjrsoft.common.core.support;
import com.xjrsoft.common.core.uitls.Func;
import com.xjrsoft.common.core.uitls.StringUtil;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StrSpliter {
public StrSpliter() {
}
public static List<String> splitPath(String str) {
return splitPath(str, 0);
}
public static String[] splitPathToArray(String str) {
return toArray(splitPath(str));
}
public static List<String> splitPath(String str, int limit) {
return split(str, "/", limit, true, true);
}
public static String[] splitPathToArray(String str, int limit) {
return toArray(splitPath(str, limit));
}
public static List<String> splitTrim(String str, char separator, boolean ignoreEmpty) {
return split(str, separator, 0, true, ignoreEmpty);
}
public static List<String> split(String str, char separator, boolean isTrim, boolean ignoreEmpty) {
return split(str, separator, 0, isTrim, ignoreEmpty);
}
public static List<String> splitTrim(String str, char separator, int limit, boolean ignoreEmpty) {
return split(str, separator, limit, true, ignoreEmpty, false);
}
public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
return split(str, separator, limit, isTrim, ignoreEmpty, false);
}
public static List<String> splitIgnoreCase(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
return split(str, separator, limit, isTrim, ignoreEmpty, true);
}
public static List<String> split(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase) {
if (StringUtil.isEmpty(str)) {
return new ArrayList(0);
} else if (limit == 1) {
return addToList(new ArrayList(1), str, isTrim, ignoreEmpty);
} else {
ArrayList<String> list = new ArrayList(limit > 0 ? limit : 16);
int len = str.length();
int start = 0;
for(int i = 0; i < len; ++i) {
if (Func.equals(separator, str.charAt(i))) {
addToList(list, str.substring(start, i), isTrim, ignoreEmpty);
start = i + 1;
if (limit > 0 && list.size() > limit - 2) {
break;
}
}
}
return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
}
}
public static String[] splitToArray(String str, char separator, int limit, boolean isTrim, boolean ignoreEmpty) {
return toArray(split(str, separator, limit, isTrim, ignoreEmpty));
}
public static List<String> split(String str, String separator, boolean isTrim, boolean ignoreEmpty) {
return split(str, separator, -1, isTrim, ignoreEmpty, false);
}
public static List<String> splitTrim(String str, String separator, boolean ignoreEmpty) {
return split(str, separator, true, ignoreEmpty);
}
public static List<String> split(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty) {
return split(str, separator, limit, isTrim, ignoreEmpty, false);
}
public static List<String> splitTrim(String str, String separator, int limit, boolean ignoreEmpty) {
return split(str, separator, limit, true, ignoreEmpty);
}
public static List<String> splitIgnoreCase(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty) {
return split(str, separator, limit, isTrim, ignoreEmpty, true);
}
public static List<String> splitTrimIgnoreCase(String str, String separator, int limit, boolean ignoreEmpty) {
return split(str, separator, limit, true, ignoreEmpty, true);
}
public static List<String> split(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty, boolean ignoreCase) {
if (StringUtil.isEmpty(str)) {
return new ArrayList(0);
} else if (limit == 1) {
return addToList(new ArrayList(1), str, isTrim, ignoreEmpty);
} else if (StringUtil.isEmpty(separator)) {
return split(str, limit);
} else if (separator.length() == 1) {
return split(str, separator.charAt(0), limit, isTrim, ignoreEmpty, ignoreCase);
} else {
ArrayList<String> list = new ArrayList();
int len = str.length();
int separatorLen = separator.length();
int start = 0;
int i = 0;
while(i < len) {
i = StringUtil.indexOf(str, separator, start, ignoreCase);
if (i <= -1) {
break;
}
addToList(list, str.substring(start, i), isTrim, ignoreEmpty);
start = i + separatorLen;
if (limit > 0 && list.size() > limit - 2) {
break;
}
}
return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
}
}
public static String[] splitToArray(String str, String separator, int limit, boolean isTrim, boolean ignoreEmpty) {
return toArray(split(str, separator, limit, isTrim, ignoreEmpty));
}
public static List<String> split(String str, int limit) {
if (StringUtil.isEmpty(str)) {
return new ArrayList(0);
} else if (limit == 1) {
return addToList(new ArrayList(1), str, true, true);
} else {
ArrayList<String> list = new ArrayList();
int len = str.length();
int start = 0;
for(int i = 0; i < len; ++i) {
if (Func.isEmpty(str.charAt(i))) {
addToList(list, str.substring(start, i), true, true);
start = i + 1;
if (limit > 0 && list.size() > limit - 2) {
break;
}
}
}
return addToList(list, str.substring(start, len), true, true);
}
}
public static String[] splitToArray(String str, int limit) {
return toArray(split(str, limit));
}
public static List<String> split(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty) {
if (StringUtil.isEmpty(str)) {
return new ArrayList(0);
} else if (limit == 1) {
return addToList(new ArrayList(1), str, isTrim, ignoreEmpty);
} else if (null == separatorPattern) {
return split(str, limit);
} else {
Matcher matcher = separatorPattern.matcher(str);
ArrayList<String> list = new ArrayList();
int len = str.length();
int start = 0;
while(matcher.find()) {
addToList(list, str.substring(start, matcher.start()), isTrim, ignoreEmpty);
start = matcher.end();
if (limit > 0 && list.size() > limit - 2) {
break;
}
}
return addToList(list, str.substring(start, len), isTrim, ignoreEmpty);
}
}
public static String[] splitToArray(String str, Pattern separatorPattern, int limit, boolean isTrim, boolean ignoreEmpty) {
return toArray(split(str, separatorPattern, limit, isTrim, ignoreEmpty));
}
public static String[] splitByLength(String str, int len) {
int partCount = str.length() / len;
int lastPartCount = str.length() % len;
int fixPart = 0;
if (lastPartCount != 0) {
fixPart = 1;
}
String[] strs = new String[partCount + fixPart];
for(int i = 0; i < partCount + fixPart; ++i) {
if (i == partCount + fixPart - 1 && lastPartCount != 0) {
strs[i] = str.substring(i * len, i * len + lastPartCount);
} else {
strs[i] = str.substring(i * len, i * len + len);
}
}
return strs;
}
private static List<String> addToList(List<String> list, String part, boolean isTrim, boolean ignoreEmpty) {
part = part.toString();
if (isTrim) {
part = part.trim();
}
if (!ignoreEmpty || !part.isEmpty()) {
list.add(part);
}
return list;
}
private static String[] toArray(List<String> list) {
return (String[])list.toArray(new String[list.size()]);
}
}

View File

@ -0,0 +1,48 @@
package com.xjrsoft.common.core.uitls;
import org.springframework.util.Base64Utils;
import java.nio.charset.Charset;
public class Base64Util extends Base64Utils {
public Base64Util() {
}
public static String encode(String value) {
return encode(value, Charsets.UTF_8);
}
public static String encode(String value, Charset charset) {
byte[] val = value.getBytes(charset);
return new String(encode(val), charset);
}
public static String encodeUrlSafe(String value) {
return encodeUrlSafe(value, Charsets.UTF_8);
}
public static String encodeUrlSafe(String value, Charset charset) {
byte[] val = value.getBytes(charset);
return new String(encodeUrlSafe(val), charset);
}
public static String decode(String value) {
return decode(value, Charsets.UTF_8);
}
public static String decode(String value, Charset charset) {
byte[] val = value.getBytes(charset);
byte[] decodedValue = decode(val);
return new String(decodedValue, charset);
}
public static String decodeUrlSafe(String value) {
return decodeUrlSafe(value, Charsets.UTF_8);
}
public static String decodeUrlSafe(String value, Charset charset) {
byte[] val = value.getBytes(charset);
byte[] decodedValue = decodeUrlSafe(val);
return new String(decodedValue, charset);
}
}

View File

@ -0,0 +1,200 @@
package com.xjrsoft.common.core.uitls;
import cn.hutool.core.collection.CollectionUtil;
import com.xjrsoft.common.core.support.BaseBeanCopier;
import com.xjrsoft.common.core.support.BeanProperty;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import org.springframework.cglib.beans.BeanGenerator;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.cglib.core.CodeGenerationException;
import org.springframework.cglib.core.Converter;
import org.springframework.util.Assert;
import java.beans.PropertyDescriptor;
import java.io.*;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class BeanUtil extends BeanUtils {
public BeanUtil() {
}
public static <T> T newInstance(Class<?> clazz) {
return (T) instantiateClass(clazz);
}
public static <T> T newInstance(String clazzStr) {
try {
Class<?> clazz = Class.forName(clazzStr);
return newInstance(clazz);
} catch (ClassNotFoundException var2) {
throw new RuntimeException(var2);
}
}
public static Object getProperty(Object bean, String propertyName) {
Assert.notNull(bean, "bean Could not null");
// return BeanMap.create(bean).get(propertyName);
PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean.getClass(), propertyName);
Method readMethod = propertyDescriptor.getReadMethod();
Assert.notNull(readMethod, bean.getClass() + "." + propertyName + " 没有get方法");
try {
return readMethod.invoke(bean);
} catch (Exception e) {
throw new RuntimeException("获取对象的值失败!" + bean.getClass() + "." + propertyName, e);
}
}
public static void setProperty(Object bean, String propertyName, Object value) {
Assert.notNull(bean, "bean Could not null");
// return BeanMap.create(bean).get(propertyName);
PropertyDescriptor propertyDescriptor = getPropertyDescriptor(bean.getClass(), propertyName);
Method readMethod = propertyDescriptor.getWriteMethod();
Assert.notNull(readMethod, bean.getClass() + "." + propertyName + " 没有get方法");
try {
readMethod.invoke(bean, value);
} catch (Exception e) {
throw new RuntimeException("获取对象的值失败!"+ bean.getClass() + "." + propertyName, e);
}
}
public static <T> T clone(T source) {
return (T) copy(source, source.getClass());
}
public static <T> T copy(Object source, Class<T> clazz) {
BaseBeanCopier copier = BaseBeanCopier.create(source.getClass(), clazz, false);
T to = newInstance(clazz);
copier.copy(source, to, (Converter)null);
return to;
}
public static <T> List<T> copyList(List<?> sourceList, Class<T> clazz) {
List<T> resultList = new ArrayList<>(sourceList.size());
if (CollectionUtil.isNotEmpty(sourceList)) {
// resultList = sourceList.stream().map(source -> (T)BeanUtil.copy(source, clazz)).collect(Collectors.toList());
for (Object source : sourceList) {
resultList.add((T)copy(source, clazz));
}
}
return resultList;
}
public static void copy(Object source, Object targetBean) {
BaseBeanCopier copier = BaseBeanCopier.create(source.getClass(), targetBean.getClass(), false);
copier.copy(source, targetBean, (Converter)null);
}
public static <T> T copyProperties(Object source, Class<T> target) throws BeansException {
T to = newInstance(target);
copyProperties(source, to);
return to;
}
public static Map<String, Object> toMap(Object bean) {
return BeanMap.create(bean);
}
public static <T> T toBean(Map<String, Object> beanMap, Class<T> valueType) {
T bean = newInstance(valueType);
BeanMap.create(bean).putAll(beanMap);
return bean;
}
public static Object generator(Object superBean, BeanProperty... props) {
Class<?> superclass = superBean.getClass();
Object genBean = generator(superclass, props);
copy(superBean, genBean);
return genBean;
}
public static Object generator(Class<?> superclass, BeanProperty... props) {
BeanGenerator generator = new BeanGenerator();
generator.setSuperclass(superclass);
generator.setUseCache(true);
BeanProperty[] var3 = props;
int var4 = props.length;
for(int var5 = 0; var5 < var4; ++var5) {
BeanProperty prop = var3[var5];
generator.addProperty(prop.getName(), prop.getType());
}
return generator.create();
}
public static PropertyDescriptor[] getBeanGetters(Class type) {
return getPropertiesHelper(type, true, false);
}
public static PropertyDescriptor[] getBeanSetters(Class type) {
return getPropertiesHelper(type, false, true);
}
private static PropertyDescriptor[] getPropertiesHelper(Class type, boolean read, boolean write) {
try {
PropertyDescriptor[] all = getPropertyDescriptors(type);
if (read && write) {
return all;
} else {
List<PropertyDescriptor> properties = new ArrayList(all.length);
PropertyDescriptor[] var5 = all;
int var6 = all.length;
for(int var7 = 0; var7 < var6; ++var7) {
PropertyDescriptor pd = var5[var7];
if (read && pd.getReadMethod() != null) {
properties.add(pd);
} else if (write && pd.getWriteMethod() != null) {
properties.add(pd);
}
}
return (PropertyDescriptor[])properties.toArray(new PropertyDescriptor[0]);
}
} catch (BeansException var9) {
throw new CodeGenerationException(var9);
}
}
public static <T> List<T> deepCopy(List<T> src) {
ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
ObjectOutputStream out = null;
ObjectInputStream in = null;
List<T> dest = null;
try {
out = new ObjectOutputStream(byteOut);
out.writeObject(src);
ByteArrayInputStream byteIn = new ByteArrayInputStream(byteOut.toByteArray());
in = new ObjectInputStream(byteIn);
dest = (List<T>) in.readObject();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
return dest;
}
public static boolean checkFields(Object entity,String fieldName){
try {
Field field=entity.getClass().getDeclaredField(fieldName);
}catch (NoSuchFieldException e) {
return false;
}
return true;
}
public static <T> T toDtoBean(Map<String, Object> beanMap, Class<T> valueType) {
T bean = newInstance(valueType);
cn.hutool.core.bean.BeanUtil.fillBeanWithMapIgnoreCase(beanMap, bean, false);
return bean;
}
}

View File

@ -0,0 +1,93 @@
//package com.xjrsoft.common.core.uitls;
//
//import cn.hutool.extra.spring.SpringUtil;
//import com.baomidou.mybatisplus.core.toolkit.Wrappers;
//import com.xjrsoft.common.core.constant.GlobalConstant;
//import com.xjrsoft.common.redis.service.RedisUtil;
//import com.xjrsoft.organization.entity.Department;
//import com.xjrsoft.organization.entity.Post;
//import com.xjrsoft.organization.entity.User;
//import com.xjrsoft.organization.mapper.DepartmentMapper;
//import com.xjrsoft.organization.mapper.PostMapper;
//import com.xjrsoft.organization.mapper.UserMapper;
//import com.xjrsoft.system.entity.DictionaryDetail;
//import com.xjrsoft.system.mapper.DictionarydetailMapper;
//import lombok.extern.slf4j.Slf4j;
//
//import java.util.List;
//import java.util.stream.Collectors;
//
//@Slf4j
//public final class CacheUtil {
// private static final RedisUtil redisUtil;
//
// private static final UserMapper userMapper;
// private static final DepartmentMapper departmentMapper;
// private static final PostMapper postMapper;
//
// private static final DictionarydetailMapper dictionarydetailMapper;
//
// static {
// redisUtil = SpringUtil.getBean(RedisUtil.class);
// userMapper = SpringUtil.getBean(UserMapper.class);
// departmentMapper = SpringUtil.getBean(DepartmentMapper.class);
// postMapper = SpringUtil.getBean(PostMapper.class);
// dictionarydetailMapper = SpringUtil.getBean(DictionarydetailMapper.class);
// }
//
// public static List<User> refreshUserList(){
// return refreshUserList(null);
// }
// public static List<User> refreshUserList(List<User> list){
// log.info("刷新用户表缓存开始");
// if(list==null) {
// list = userMapper.selectList(Wrappers.lambdaQuery(User.class));
// }
// redisUtil.set(GlobalConstant.USER_CACHE_KEY,list);
// redisUtil.set(GlobalConstant.USER_NAME_CACHE_KEY,list.stream().collect(Collectors.toMap(User::getId,User::getName)));
// log.info("刷新用户表缓存结束");
// return list;
// }
//
// public static List<Department> refreshDepartmentList(){
// return refreshDepartmentList(null);
// }
// public static List<Department> refreshDepartmentList(List<Department> list){
// log.info("刷新部门表缓存开始");
// if(list==null) {
// list = departmentMapper.selectList(Wrappers.lambdaQuery(Department.class));
// }
// redisUtil.set(GlobalConstant.DEP_CACHE_KEY,list);
// redisUtil.set(GlobalConstant.DEP_NAME_CACHE_KEY,list.stream().collect(Collectors.toMap(Department::getId,Department::getName)));
// log.info("刷新部门表缓存结束");
// return list;
// }
//
// public static List<Post> refreshPostList(){
// return refreshPostList(null);
// }
// public static List<Post> refreshPostList(List<Post> list){
// log.info("刷新岗位表缓存开始");
// if(list==null) {
// list = postMapper.selectList(Wrappers.lambdaQuery(Post.class));
// }
// redisUtil.set(GlobalConstant.POST_CACHE_KEY,list);
// redisUtil.set(GlobalConstant.POST_NAME_CACHE_KEY,list.stream().collect(Collectors.toMap(Post::getId,Post::getName)));
// log.info("刷新岗位表缓存结束");
// return list;
// }
//
// public static List<DictionaryDetail> refreshDictionarydetailList(){
// return refreshDictionarydetailList(null);
// }
// public static List<DictionaryDetail> refreshDictionarydetailList(List<DictionaryDetail> list){
// log.info("刷新数据字典详情缓存开始");
// if(list==null) {
// list = dictionarydetailMapper.selectList(Wrappers.lambdaQuery(DictionaryDetail.class));
// }
// redisUtil.set(GlobalConstant.DIC_DETAIL_CACHE_KEY,list);
// redisUtil.set(GlobalConstant.DIC_DETAIL_NAME_CACHE_KEY,list.stream().collect(Collectors.toMap(dictionaryDetail->dictionaryDetail.getItemId()+"_"+dictionaryDetail.getValue(),DictionaryDetail::getName,(e1,e2)->e1)));
// log.info("刷新数据字典详情缓存结束");
// return list;
// }
//}

View File

@ -0,0 +1,30 @@
package com.xjrsoft.common.core.uitls;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.charset.UnsupportedCharsetException;
public class Charsets {
public static final Charset ISO_8859_1;
public static final String ISO_8859_1_NAME;
public static final Charset GBK;
public static final String GBK_NAME;
public static final Charset UTF_8;
public static final String UTF_8_NAME;
public Charsets() {
}
public static Charset charset(String charsetName) throws UnsupportedCharsetException {
return StringUtil.isBlank(charsetName) ? Charset.defaultCharset() : Charset.forName(charsetName);
}
static {
ISO_8859_1 = StandardCharsets.ISO_8859_1;
ISO_8859_1_NAME = ISO_8859_1.name();
GBK = Charset.forName("GBK");
GBK_NAME = GBK.name();
UTF_8 = StandardCharsets.UTF_8;
UTF_8_NAME = UTF_8.name();
}
}

Some files were not shown because too many files have changed in this diff Show More