Commit 46a3f821 authored by hongguangwu's avatar hongguangwu

Merge remote-tracking branch 'origin/develop' into develop

parents aaae369b ee83f8aa
......@@ -100,7 +100,7 @@ public class TEmployeeInfoServiceImpl extends ServiceImpl<TEmployeeInfoMapper, T
leavePageCount = baseMapper.getLeavePageCount(employeeInfo);
page.setTotal(leavePageCount);
if (leavePageCount > 0L) {
page.setPages((long) Math.ceil(leavePageCount / page.getSize()));
page.setPages((long) Math.ceil(1.0*leavePageCount / page.getSize()));
}
if (page.getCurrent() < 1) {
page.setCurrent(1L);
......
......@@ -496,7 +496,7 @@
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
and
a.emp_id in (
a.id in (
select b.emp_id from t_employee_project b
where
b.DELETE_FLAG = '0'
......@@ -772,7 +772,7 @@
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
and
a.emp_id in (
a.id in (
select b.emp_id from t_employee_project b
where
b.DELETE_FLAG = '0'
......@@ -811,7 +811,7 @@
<include refid="employeeInfo_where"/>
<if test="tEmployeeInfo.authSql != null and tEmployeeInfo.authSql.trim() != ''">
and
a.emp_id in (
a.id in (
select b.emp_id from t_employee_project b
where
b.DELETE_FLAG = '0'
......
package com.yifu.cloud.plus.v1.yifu.common.core.config;
import lombok.extern.slf4j.Slf4j;
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.AsyncConfigurer;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
/**
* 异步线程池
* @Author fxj
* @Date 2021-05-20
* @return
**/
@Configuration
@EnableAsync
@Slf4j
public class AsyncConfig implements AsyncConfigurer {
// todo 幂等性如何保证
@Override
public Executor getAsyncExecutor() {
//定义线程池
ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
/**
* <!-- 设置allowCoreThreadTimeout=true(默认false)时,核心线程会超时关闭 -->
*/
taskExecutor.setAllowCoreThreadTimeOut(true);
/**
* 核心线程数
* 1)<!-- 线程池维护线程的最少数量,即使没有任务需要执行,也会一直存活 -->
* 2)<!-- 设置allowCoreThreadTimeout=true(默认false)时,核心线程会超时关闭 -->
*/
taskExecutor.setCorePoolSize(2);
/**
* <!-- 允许的空闲时间,当线程空闲时间达到keepAliveTime时,线程会退出,直到线程数量=corePoolSize -->
* <!-- 如果allowCoreThreadTimeout=true,则会直到线程数量=0 -->
*/
taskExecutor.setKeepAliveSeconds(200);
/**
* <!-- 线程池维护线程的最大数量 -->
* <!-- 当线程数>=corePoolSize,且任务队列已满时。线程池会创建新线程来处理任务 -->
* <!-- 当线程数=maxPoolSize,且任务队列已满时,线程池会拒绝处理任务而抛出异常,异常见下
*/
taskExecutor.setMaxPoolSize(8);
/**
* <!-- 缓存队列(阻塞队列)当核心线程数达到最大时,新任务会放在队列中排队等待执行 -->
*/
taskExecutor.setQueueCapacity(100);
/**
* 建议配置threadNamePrefix属性,出问题时可以更方便的进行排查。
**/
taskExecutor.setThreadNamePrefix("CRM_TO_HRO_EXECUTOR");
// 捕捉线程队列满的 拒绝处理
taskExecutor.setRejectedExecutionHandler((Runnable r, ThreadPoolExecutor exe) -> {
log.info("当前任务线程池队列已满.");
});
//初始化
taskExecutor.initialize();
return taskExecutor;
}
@Override
public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
return null;
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.config;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.yifu.cloud.plus.v1.yifu.common.core.jackson.YifuJavaTimeModule;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.time.ZoneId;
import java.util.Locale;
import java.util.TimeZone;
/**
* JacksonConfig
*
* @author lengleng
* @author L.cm
* @author lishangbu
* @date 2020-06-17
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(ObjectMapper.class)
@AutoConfigureBefore(JacksonAutoConfiguration.class)
public class JacksonConfiguration {
@Bean
@ConditionalOnMissingBean
public Jackson2ObjectMapperBuilderCustomizer customizer() {
return builder -> {
builder.locale(Locale.CHINA);
builder.timeZone(TimeZone.getTimeZone(ZoneId.systemDefault()));
builder.simpleDateFormat(DatePattern.NORM_DATETIME_PATTERN);
builder.serializerByType(Long.class, ToStringSerializer.instance);
builder.modules(new YifuJavaTimeModule());
};
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.config;
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration;
import org.springframework.cache.annotation.EnableCaching;
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.serializer.RedisSerializer;
/**
* @author lengleng
* @date 2019/2/1 Redis 配置类
*/
@EnableCaching
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore(RedisAutoConfiguration.class)
public class RedisTemplateConfiguration {
@Bean
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
redisTemplate.setKeySerializer(RedisSerializer.string());
redisTemplate.setHashKeySerializer(RedisSerializer.string());
redisTemplate.setValueSerializer(RedisSerializer.java());
redisTemplate.setHashValueSerializer(RedisSerializer.java());
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();
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
/**
* @author lengleng
* @date 2019/2/1 RestTemplate
*/
@Configuration(proxyBeanMethods = false)
public class RestTemplateConfiguration {
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.config;
import cn.hutool.core.date.DatePattern;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.format.FormatterRegistry;
import org.springframework.format.datetime.standard.DateTimeFormatterRegistrar;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import static org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type.SERVLET;
/**
* @author lengleng
* @date 2019-06-24
* <p>
* 注入自自定义SQL 过滤
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication(type = SERVLET)
public class WebMvcConfiguration implements WebMvcConfigurer {
/**
* 增加GET请求参数中时间类型转换 {@link com.yifu.cloud.plus.v1.yifu.common.core.jackson.YifuJavaTimeModule}
* <ul>
* <li>HH:mm:ss -> LocalTime</li>
* <li>yyyy-MM-dd -> LocalDate</li>
* <li>yyyy-MM-dd HH:mm:ss -> LocalDateTime</li>
* </ul>
* @param registry
*/
@Override
public void addFormatters(FormatterRegistry registry) {
DateTimeFormatterRegistrar registrar = new DateTimeFormatterRegistrar();
registrar.setTimeFormatter(DatePattern.NORM_TIME_FORMATTER);
registrar.setDateFormatter(DatePattern.NORM_DATE_FORMATTER);
registrar.setDateTimeFormatter(DatePattern.NORM_DATETIME_FORMATTER);
registrar.registerFormatters(registry);
}
/**
* 系统国际化文件配置
* @return MessageSource
*/
@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:i18n/messages");
return messageSource;
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
/**
* @author lengleng
* @date 2020年01月01日
* <p>
* 缓存的key 常量
*/
public interface CacheConstants {
/**
* oauth 缓存前缀
*/
String PROJECT_OAUTH_ACCESS = "yifu_oauth:access:";
/**
* oauth 缓存令牌前缀
*/
String PROJECT_OAUTH_TOKEN = "yifu_oauth:token:";
/**
* 验证码前缀
*/
String DEFAULT_CODE_KEY = "DEFAULT_CODE_KEY:";
/**
* 菜单信息缓存
*/
String MENU_DETAILS = "menu_details";
/**
* 用户信息缓存
*/
String USER_DETAILS = "user_details";
/**
* 字典信息缓存
*/
String DICT_DETAILS = "dict_details";
/**
* 字典项信息缓存
*/
String DICT_ITEM_DETAILS = "dict_item_details";
/**
* oauth 客户端信息
*/
String CLIENT_DETAILS_KEY = "yifu_oauth:client:details";
/**
* 参数缓存
*/
String PARAMS_DETAILS = "params_details";
/**
* 数据权限信息缓存
* data_auth_details0:用户组
* data_auth_details1:用户
* hgw
* 2022-6-9 17:29:49
*/
String DATA_AUTH_DETAILS = "data_auth_details";
/**
* @Description: 每日员工主码缓存
* @Author: hgw
* @Date: 2022/6/21 17:09
**/
String EVERYDAY_EMP_CODE = "everyday_emp_code";
/**
* @Description: 每日员工合同的 申请编码 缓存
* @Author: hgw
* @Date: 2022/6/21 17:09
**/
String EVERYDAY_EMP_CONTRACT_CODE = "everyday_emp_contract_code";
/**
* @Description: 派单申请编码
* @Author: fxj
**/
String EVERYDAY_DISPATCH_CODE = "everyday_dispatch_code";
/**
* 区域数据--标签
*/
String AREA_LABEL = "area_label:";
/**
* 区域数据--值
*/
String AREA_VALUE = "area_value:";
/**
* 用户登录的项目vo缓存
*/
public static final String WXHR_SETTLE_DOMAIN_VOS_BY_USERID = ServiceNameConstants.ARCHIVES_SERVICE + "_SettleDomainVosByUserId";
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
import java.math.BigDecimal;
/**
* @author lengleng
* @date 2019/2/1
*/
public interface CommonConstants {
/**
* 删除
*/
String STATUS_DEL = "1";
/**
* 正常
*/
String STATUS_NORMAL = "0";
/**
* 锁定
*/
String STATUS_LOCK = "9";
/**
* 菜单树根节点
*/
Long MENU_TREE_ROOT_ID = -1L;
/**
* 部门根节点
*/
Long DEPT_TREE_ROOT_ID = 0L;
/**
* 1L
*/
Long LONG_1 = 1L;
/**
* 菜单
*/
String MENU = "0";
/**
* 编码
*/
String UTF8 = "UTF-8";
/**
* JSON 资源
*/
String CONTENT_TYPE = "application/json; charset=utf-8";
/**
* 前端工程名
*/
String FRONT_END_PROJECT = "yifu-ui";
/**
* 后端工程名
*/
String BACK_END_PROJECT = "yifu";
/**
* 获取一条数据的后缀
*/
String LAST_ONE_SQL = " limit 1";
/**
* 成功标记
*/
Integer SUCCESS = 200;
/**
* 商险导出最大值
*/
Integer EXPORT_TWENTY_THOUSAND = 20000;
/**
* 商险导入最大值
*/
Integer IMPORT_TWENTY_THOUSAND = 20000;
/**
* 失败标记
*/
Integer FAIL = 1;
/**
* 验证码前缀
*/
String DEFAULT_CODE_KEY = "DEFAULT_CODE_KEY_";
/**
* 当前页
*/
String CURRENT = "current";
/**
* size
*/
String SIZE = "size";
/**
* JSON 资源
*/
/**
* number 0
*/
String ZERO_STRING = "0";
String FOUR_STRING = "4";
String FIVE_STRING = "5";
String TWELVE_STRING = "12";
String THIRTEEN_STRING = "13";
String FOURTEEN_STRING = "14";
String FIFTEEN_STRING = "15";
String SIXTEEN_STRING = "16";
/**
* number 0
*/
String ZERO_ONE = "01";
/**
* number 0
*/
int ZERO_INT = 0;
/**
* number 5000
*/
int FIVES_INT = 5000;
/**
* number 1
*/
String ONE_STRING = "1";
/**
* number 2
*/
String TWO_STRING = "2";
/**
* number 3
*/
String THREE_STRING = "3";
/**
* 数字int 3
*/
int THREE_INT = 3;
/**
* 下划线
* hgw 2022-6-9 17:36:35
*/
String DOWN_LINE_STRING = "_";
/**
* 空字符串
* hgw 2022-6-9 17:36:35
*/
String EMPTY_STRING ="";
/**
* 数字int 1
* @author fxj
*/
int ONE_INT = 1;
int TWO_INT = 2;
/**
* 个位数字(阿里编码规约不允许直接使用‘魔法值’)
* @Author pwang
* @Date 2019-08-02 16:39
**/
int[] dingleDigitIntArray = {0,1,2,3,4,5,6,7,8,9};
/**
* 个位数字串(阿里编码规约不允许直接使用‘魔法值’)
* @Author pwang
* @Date 2019-08-02 16:39
**/
String[] dingleDigitStrArray = {"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17"};
/**
* 月份(阿里编码规约不允许直接使用‘魔法值’)
* @Author zhaji
* @Date 2022-07-28 16:39
**/
String[] MonthStrArray = {"0","1","2","3","4","5","6","7","8","9","10","11","12"};
/**
* 逗号
* @Author fxj
**/
char COMMA_CHAR = ',';
char SPOT_CHAR = '.';
/**
* 100
* @Author fxj
**/
int INTEGER_HUNDRED = 100;
//,逗号
String COMMA_STRING = ",";
//、顿号
String DUNHAO_STRING = "、";
//- 横
char DOWN_LINE_CHAR ='_';
// 冒号 :
String COLON_STRING =":";
// - 横 分割线 中
String CENTER_SPLIT_LINE_STRING = "-";
// 斜杠
String SLASH_SPLIT_LINE_STRING = "/";
// = 等
char ETC_CHAR = '=';
// = 等
String ETC_STRING = "=";
//+ 加
char ADD_CHAR = '+';
//int 4
int FOUR_INT = 4;
//int 5
int FIVE_INT = 5;
String TEN_STRING = "10";
int SEVEN_INT = 7;
public static final String SPOT = ".";
int FIFTY_INT = 50;
int BYTE = 1024;
/**
* 员工初始序列
* @Author pwang
* @Date 2020-05-14 11:13
* @param null
* @return
**/
public static final String EMPLOYEE_INIT_NO = "0001";
/**
* 员工的的前缀位数
* @Author pwang
* @Date 2020-05-14 14:10
**/
int EMPLOYEE_INIT_NO_START = 7;
String SAVE_FAILED = "保存失败!";
String RESULT_EMPTY = "获取结果为空";
//错误信息
String ERROR_NO_DOMAIN = "无此实体!";
String NULL = null;
/**
* @Author fxj
* @Date 2020-03-12 14:48
* @return
**/
String RESULT_DATA_FAIL= "操作失败";
String SAVE_SUCCESS = "保存成功!";
String UPDATE_SUCCESS = "更新成功!";
String PARAM_IS_NOT_EMPTY = "参数不可为空";
String DATA_CAN_NOT_EMPTY = "数据不可为空";
String NO_DATA_TO_HANDLE = "无数据可操作!";
String PLEASE_LOG_IN = "请登录!";
String SEX_MAN = "1";
String SEX_WONMAN = "2";
String SALARY_ISFLAG = "已结算";
String SALARY_UNFLAG = "未结算";
// 是否
String IS_FALSE = "否";
String IS_TRUE = "是";
int SIX_INT = 6;
int EIGHT_INT = 8;
public static final String ZIP_TYPE = "zip";
int BATCH_COUNT = 100;
int BATCH_COUNT1 = 1000;
String IMPORT_DATA_ANALYSIS_ERROR = "数据导入解析异常,请检查表数据格式(1.日期格式:yyyy-MM-dd,2.比例为整数且不含%)";
String CREATE_TIME = "CREATE_TIME";
String ID = "ID";
String PARAM_IS_NOT_ERROR = "传参异常,请检查参数";
int EXCEL_EXPORT_LIMIT = 60000;
String USER = "用户";
/**
* multipart/form-data
* @Author fxj
* @Date 2020-10-13
**/
public static final String MULTIPART_FORM_DATA = "multipart/form-data";
/**
* Content-Disposition
* @Author fxj
* @Date 2020-10-13
**/
public static final String CONTENT_DISPOSITION = "Content-Disposition";
/**
* attachment;filename=
* @Author fxj
* @Date 2020-10-13
**/
public static final String ATTACHMENT_FILENAME = "attachment;filename=";
/**
* USER_AGENT
* @Author fxj
* @Date 2020-10-26
**/
public static final String USER_AGENT = "USER-AGENT";
/**
* 成功颜色
*/
String GREEN = "green";
/**
* 失败颜色
*/
String RED = "red";
/**
* 数字int -1
* @author fxj
*/
int ONE_INT_NEGATE = -1;
/**
* 数字int -1
* @author fxj
*/
String ONE_STRING_NEGATE = "-1";
/**
* 数字int -1
* @author fxj
*/
int TWO_INT_NEGATE = -2;
/**
* 数字int -1
* @author fxj
*/
int THREE_INT_NEGATE = -3;
// 是否
String IS_CHANGE = "划转";
// 年
String YEAR = "年";
// 月
String MONTH = "月";
// 日
String DAY = "日";
/**
* 一年365天
*/
int ONE_YEAR = 365;
/**
* 数字70
*/
int SEVENTY = 70;
/**
* 省市
* @Author fxj
* @Date 2020-08-25
**/
public static final String HEFEISTRING="安徽省-合肥市";
/**
* 省
* @Author fxj
* @Date 2020-08-25
**/
public static final String ANHUISTRING="安徽省";
/**
*是所有者
**/
public static final String IS_OWNER_YES = "0";
/**
*不是所有者
**/
public static final String IS_OWNER_NO = "1";
/**
* 获取登录用户信息失败
**/
public static final String USER_FAIL = "获取登录用户信息失败!";
public static final int SIXTEEN_INT = 16;
public static final String FIFTEEN = "15";
public static final String NINETEEN = "19";
public static final String NINE_STRING = "9";
String EIGHT_STRING = "8";
public static final String PAYMENT_SOCIAL_IMPORT = "payment_social_import";
public static final String PAYMENT_SOCIAL_WAIT_EXPORT = "payment_social_wait_export";
//百分之一 1/100
public static final BigDecimal ONE_OF_PERCENT = new BigDecimal("0.01");
// 1/2
public static final BigDecimal HALF_OF_ONE = new BigDecimal("0.5");
public static final BigDecimal TWO_BIG = new BigDecimal("2");
String SIX_STRING = "6";
String SEVEN_STRING = "7";
/**
* 工资最大不能超过9999999.99
*/
public static final BigDecimal MONEY_MAX = new BigDecimal("9999999.99");
/**
* 工资最小不能小于零
*/
public static final BigDecimal MONEY_MIN = new BigDecimal(0);
public static final int TWENTY_INT = 20;
public static final int TWENTY_ONE_STRING = 21;
public static final String ERROR_MSG_PRFIX = "error=";
public static final String SUCCESS_MSG_PREFIX = "success=";
// 社保细分类型 hgw 2021-6-9 17:54:08
public static final String[] SOCIAL_HANDLE_TYPE = {"0","养老", "医疗", "失业", "工伤", "生育", "大病"};
public static final int SIXTY_INT = 60;
/**
* param error
* @Author fxj
* @Date 2020-08-25
**/
public static final String PARAM_INFO_ERROR = "传参有误!";
public static final String XLSX = ".xlsx";
public static final String ERROR_IMPORT = "执行异常";
// 权限使用的
public static final String A_DEPT_ID = "a.dept_id";
public static final String A_CREATE_BY = "a.CREATE_BY";
}
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
* @Description Excel配置注解自定义接口
* @author fangxinjiang
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ java.lang.annotation.ElementType.FIELD })
public @interface ExcelAttribute {
/**
* Excel中的列名
*
* @return
*/
public abstract String name();
/**
* 不好用 建议顺序用表头固定
* 列名对应的A,B,C,D...,不指定按照默认顺序排序
*
* @return
*/
public abstract String column() default "";
/**
* 最大长度校验,默认0无需校验
* @return
*/
public abstract int maxLength() default 0;
/**
* 最大值
* @return
*/
public abstract String max() default "0";
/**
* 最小值
* @return
*/
public abstract float min() default 0;
/**
* 提示信息
*
* @return
*/
public abstract String prompt() default "";
/**
* 设置只能选择不能输入的列内容
*
* @return
*/
public abstract String[] combo() default {};
/**
* 是否导出数据
*
* @return
*/
public abstract boolean isExport() default true;
/**
* 是否为重要字段(整列标红,着重显示)
*
* @return
*/
public abstract boolean isMark() default false;
/**
* 是否合计当前列
*
* @return
*/
public abstract boolean isSum() default false;
/**
* 是否必填字段
* @return
*/
public abstract boolean isNotEmpty() default false;
/**
* 是否为电话字段
* @return
*/
public abstract boolean isPhone() default false;
/**
* 是否为身份证
* @return
*/
public abstract boolean isIdCard() default false;
/**
* 是否为日期
* @return
*/
public abstract boolean isDate() default false;
/**
* 是否为邮箱
* @return
*/
public abstract boolean isEmail() default false;
/**
* 是否为Integer
* @return
*/
public abstract boolean isInteger() default false;
/**
* 是否为float
* @return
*/
public abstract boolean isFloat() default false;
/**
* 是否为double
* @return
*/
public abstract boolean isDouble() default false;
/**
* 验证表达式
* @return
*/
public abstract String pattern() default "";
/**
* 数据类型标识或字典表CODE 与 isDataId()同步出现
* 因为字典有的地方有value有的地方用id
* 建议value不用加后缀 id的后缀加_id
* 组装map的时候code=值 冗余一遍code_id =值
* @return
*/
public abstract String dataType() default "";
/**
* 读取内容转表达式 (如: 0=男,1=女,2=未知)
*/
public String readConverterExp() default "";
/**
* 日期格式化字符串
* @return
*/
public abstract String dateFormat() default "yyyy-MM-dd";
/**
* 日期格式化字符串
* @return
*/
public abstract String dateFormatExport() default "";
/**
* 默认错误信息
* @return
*/
public abstract String errorInfo() default "";
/**
* 默认错误信息
* @return
*/
public abstract String errorInfoImport() default "";
/**
* 是否为实体ID 导入要从字典表取数据 导出要对应导出中文数据
* @return
*/
public abstract boolean isDataId() default false;
/**
* 是否为客户单位和项目实体ID 导入要从字典表取数据 导出要对应导出中文数据
* @return
*/
public abstract boolean isOrgan() default false;
/**
* 是否转义,默认 true 如果是字典会转义, false不会转义值
* @return
*/
public abstract boolean isConvert() default true;
/**
* 是否为区域数据 前提:isDataId = true
* @Author fxj
* @Date 2019-09-02
* @param
* @return
**/
public abstract boolean isArea() default false;
/**
* 父ID 前提:isDataId = true
* @Author fxj
* @Date 2019-09-02
* @param
* @return
**/
public abstract String parentField() default "";
/**
* 导出字段组合 只用于导出
* @Author fxj
* @Date 2019-10-11
* @param
* @return
**/
public abstract String componentFieldExport() default "";
/**
* 用于返回可选择导出的中文字段
* @param
* @Author: wangan
* @Date: 2019/10/17
* @Description:
* @return: boolean
**/
public abstract boolean needExport() default false;
/**
* @param
* @Author: wangan
* @Date: 2020/11/5
* @Description: 字典映射不成功是否展示字典key
* @return: boolean
**/
public abstract boolean noRelationExport() default true;
/**
* 是否为实体ID 导入要从字典表取数据 导出要对应导出中文数据
* @return
*/
public abstract String divider() default "";
/**
* @description: 错误信息 需要对字段值提前设置 error= 前缀为错误信息展示为红色, success= 前缀为正确信息展示为绿色
* @return: boolean 是否开启错误信息展示,对字体颜色进行修改
* @author: wangweiguo
* @date: 2021/6/30
*/
public abstract boolean errorMsg() default false;
}
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
/**
* @Author hgw
* @Date 2022-6-29 19:27:33
* @return
* @Description 注解式 静态数据
**/
public class ExcelAttributeConstants {
// 员工类型
public static final String EMP_NATRUE = "emp_natrue";
// 婚姻状况
public static final String EMP_MARRIED = "emp_married";
// 民族
public static final String EMP_NATIONAL = "emp_national";
// 政治面貌
public static final String EMP_POLITICAL = "emp_political";
// 户口性质
public static final String EMP_REGISTYPE = "emp_registype";
// 最高学历
public static final String EDUCATION = "education";
// 合同状态
public static final String PERSONNEL_STATE = "personnel_state";
// 商险状态
public static final String COMMERCIAL_SATTE = "commercial_satte";
// 社保状态
public static final String SOCIAL_ECURITY_STATE = "social_ecurity_state";
// 公积金状态
public static final String FUND_STATUS = "fund_status";
// 减档原因
public static final String DOWNSHIFT_REASON = "downshift_reason";
// 业务类型一级分类
public static final String CUSTOMER_BUSSINESS_PARENT = "customer_business_parent";
// 业务类型二级分类
public static final String CUSTOMER_BUSSINESS_TYPE = "customer_business_type";
// 业务类型三级分类
public static final String CUSTOMER_BUSSINESS_SUB_TYPE = "customer_business_sub_type";
//员工合同类型---签订期限
public static final String EMPLOYEE_CONTRACT_TYPE = "employee_contract_type" ;
//员工合同工时制 1标准工时 2 综合工时 3不定时工时制
public static final String WORKING_HOURS = "working_hours";
//员工合同续签情况
public static final String EMPLOYEE_SITUATION_TYPE = "situation_type" ;
//商险结算类型
public static final String SETTLEMENT_TYPE = "settlementType";
//商险订单状态
public static final String INSURANCE_RECORD_STATUS = "Insurance_record_status";
//社保大病是否收取费用 0 是 1 否
public static final String IS_ILLNESS = "is_illness";
//社保大病取值方式 0 按比例 1按定值
public static final String VALUE_TYPE = "value_type";
public static final String NATION = "nation";
//家庭信息:与本人关系
public static final String RELATIONSHIP_SELF = "relationship_self";
//员工档案:性别
public static final String SEX ="sex";
//员工档案:户口性质
public static final String HOUSEHOLD_NATURE = "household_nature";
//员工档案:客户性质
public static final String NATURE ="nature";
//员工档案:婚姻状况
public static final String MARITAL_STATUS = "marital_status";
//员工档案:人员类型(合同类型)
public static final String PERSONNEL_TYPE = "personnel_type";
//合同业务细分
public static final String PERSONNEL_TYPE_SUB = "personnel_type_sub";
//员工档案:员工标签
public static final String EMPLOYEE_LABLE = "employee_lable";
//员工档案:政治面貌
public static final String POLITICAL_STATUS = "political_status";
//审核状态
public static final String AUDIT_STATUS ="audit_status";
//是否委托
public static final String IS_ENTRUST ="is_entrust";
//系统用户
public static final String SYS_USER ="sys_user";
//区域
public static final String SYS_AREA ="sys_area";
//员工档案:银行
public static final String BANK="bank";
//通用状态标识 0 是 1 否
public static final String STATUS_FLAG = "status_flag";
//学历信息:学历类型
public static final String EDUCATION_TYPE = "education_type";
//职业资格:资格类型
public static final String QUALIFICATION_TYPE = "qualification_type";
//职业资格:资格等级
public static final String QUALIFICATION_LEVEL = "qualification_level";
//员工伤残:伤残等级
public static final String DISABILITY_GRADE = "disability_grade";
//工作履历:工作类型 如兼职、全职等
public static final String WORK_TYPE = "work_type";
//职业资格:获取方式
public static final String OBTAIN_TYPE = "obtain_type";
//学历信息:学制
public static final String EDUCATION_SYSTEM = "education_system";
//工资形式 1.计时工资 2.计件工资 3.其他
public static final String SALARY_TYPE = "salary_type";
// 关系类型
public static final String FAMILY_RELATION = "family_relation";
// 工作类型---工具履历
public static final String WORKINFO_TYPE = "workinfo_type";
// 项目档案来源
public static final String PROJECT_EMP_SOURCE = "project_emp_source";
//区域字段组合
public static final String DEPARTID_PROVINCE_CITY_TOWN = "departId_province_city_town";
//派减离职原因
public static final String REDUCE_PROJECT_REASON = "reduce_project_reason";
//派减离职原因
public static final String REDUCE_SOCIAL_REASON = "social_reduce_reason";
//社保缴纳月份
public static final String SOCIAL_PAY_MONTH = "socialPayMonth";
//身份证
public static final String EMPIDCARD = "empIdcard";
//最低工资提醒
public static final String SYS_MESSAGE_SALARY_TYPE="SYS_MESSAGE_SALARY_TYPE";
//有工资无社保
public static final String HAVE_SALARY_NO_SOCIAL_TYPE="HAVE_SALARY_NO_SOCIAL_TYPE";
}
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
import lombok.experimental.UtilityClass;
@UtilityClass
public class ResultConstants {
public static final String SAVE_SUCCESS ="保存成功!";
public static final String SAVE_FAIL ="保存失败!";
public static final String MODIFY_SUCCESS ="修改成功!";
public static final String MODIFY_FAIL ="修改失败!";
public static final String VALIDITY_FAIL="校验失败";
public static final String NO_USER = "获取登录用户信息失败!";
public static final String SUCCESS_INFO = "操作成功!";
public static final String FAIL_INFO_NO_MODEL = "操作失败无此实体信息!";
public static final String FAIL_INFO_HAVE = "操作失败记录已存在!";
public static final String FAIL_INFO_PARAM_NULL = "操作失败,参数为空!";
public static final String FAIL_INFO_RELATION_FOLLOW = "已关联跟进记录,禁止删除!";
public static final String FAIL_INFO_RELATION_CONTACT = "已关联联系人,禁止删除!";
public static final String REQUEST_LOCK_FAIL = "获取锁失败";
public static final String DATA_IMPORT_PARSING_RESULT = "数据导入解析!数据行数:";
public static final String NO_SELECT_DATA = "请选择数据";
public static final String NO_GETLOCK_DATA = "获取锁失败,10秒后重试!";
public static final String NO_ID = "操作失败,id不能为空!";
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
/**
* @author lengleng
* @date 2019/2/1
*/
public interface SecurityConstants {
/**
* 角色前缀
*/
String ROLE = "ROLE_";
/**
* 前缀
*/
String PROJECT_PREFIX = "yifu_";
/**
* 项目的license
*/
String PROJECT_LICENSE = "made by yifu";
/**
* 内部
*/
String FROM_IN = "Y";
/**
* 标志
*/
String FROM = "from";
/**
* 默认登录URL
*/
String OAUTH_TOKEN_URL = "/oauth/token";
/**
* grant_type
*/
String REFRESH_TOKEN = "refresh_token";
/**
* 手机号登录
*/
String APP = "app";
/**
* {bcrypt} 加密的特征码
*/
String BCRYPT = "{bcrypt}";
/**
* sys_oauth_client_details 表的字段,不包括client_id、client_secret
*/
String CLIENT_FIELDS = "client_id, CONCAT('{noop}',client_secret) as client_secret, resource_ids, scope, "
+ "authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, "
+ "refresh_token_validity, additional_information, autoapprove";
/**
* JdbcClientDetailsService 查询语句
*/
String BASE_FIND_STATEMENT = "select " + CLIENT_FIELDS + " from sys_oauth_client_details";
/**
* 默认的查询语句
*/
String DEFAULT_FIND_STATEMENT = BASE_FIND_STATEMENT + " order by client_id";
/**
* 按条件client_id 查询
*/
String DEFAULT_SELECT_STATEMENT = BASE_FIND_STATEMENT + " where client_id = ?";
/***
* 资源服务器默认bean名称
*/
String RESOURCE_SERVER_CONFIGURER = "resourceServerConfigurerAdapter";
/**
* 用户信息
*/
String DETAILS_USER = "user_info";
/**
* 协议字段
*/
String DETAILS_LICENSE = "license";
/**
* 验证码有效期,默认 60秒
*/
long CODE_TIME = 60;
/**
* 验证码长度
*/
String CODE_SIZE = "6";
/**
* 客户端模式
*/
String CLIENT_CREDENTIALS = "client_credentials";
/**
* 客户端ID
*/
String CLIENT_ID = "clientId";
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
/**
* @author lengleng
* @date 2018年06月22日16:41:01 服务名称
*/
public interface ServiceNameConstants {
/**
* 认证服务的SERVICEID
*/
String AUTH_SERVICE = "yifu-auth";
/**
* UMPS模块
*/
String UMPS_SERVICE = "yifu-upms-biz";
/**
* consumer模块
*/
String CONSUMER_SERVICE = "consumer-biz";
/**
* provider模块
*/
String PROVIDER_SERVICE = "provider-biz";
/**
* hrms-archives模块
*/
String ARCHIVES_SERVICE = "yifu-archives";
}
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
/**
* @author fxj
* @Date 2022-05-19
*/
public interface UpmsDaprSiderConstants {
// -app-id register-sider -app-port 8848 -dapr-http-port 3005 -dapr-grpc-port 52000 -metrics-port 9098
String APP_ID = "yifu_upms_sider";
String APP_PORT = "4000";
String HTTP_PORT = "3005";
String GRPC_PORT = "52000";
String METRICS_PORT = "9094";
}
package com.yifu.cloud.plus.v1.yifu.common.core.constant;
/**
* @author fang
* 常用的一些验证,如手机、移动号码、联通号码、电信号码、密码、座机、 邮政编码、邮箱、年龄、身份证、URL、QQ、汉字、字母、数字等校验表达式
*/
public class ValidityConstants {
/** 工资-档案-手机号规则 */
public static final String EMP_PHONE_PATTERN = "^1[3-9]\\d{9}$";
/** 手机号规则 hgw2022-1-14 19:24:48客服刘岚有一个电信客户的手机号是16655125569故变更规则 */
public static final String MOBILE_PATTERN="^(1[3-9][0-9])(\\d{8})$";
/** 中国电信号码格式验证 手机段: 133,153,180,181,189,177,1700,173 **/
public static final String CHINA_TELECOM_PATTERN = "(?:^(?:\\+86)?1(?:33|53|7[37]|8[019])\\d{8}$)|(?:^(?:\\+86)?1700\\d{7}$)";
/** 中国联通号码格式验证 手机段:130,131,132,155,156,185,186,145,176,1707,1708,1709,175 **/
public static final String CHINA_UNICOM_PATTERN = "(?:^(?:\\+86)?1(?:3[0-2]|4[5]|5[56]|7[56]|8[56])\\d{8}$)|(?:^(?:\\+86)?170[7-9]\\d{7}$)";
/** 中国移动号码格式验证 手机段:134,135,136,137,138,139,150,151,152,157,158,159,182,183,184,187,188,147,178,1705 **/
public static final String CHINA_MOVE_PATTERN = "(?:^(?:\\+86)?1(?:3[4-9]|4[7]|5[0-27-9]|7[8]|8[2-478])\\d{8}$)|(?:^(?:\\+86)?1705\\d{7}$)";
/** 密码规则(6-16位字母、数字) */
public static final String PASSWORD_PATTERN="^[0-9A-Za-z]{6,16}$";
/** 固号(座机)规则 */
public static final String LANDLINE_PATTERN="^(?:\\(\\d{3,4}\\)|\\d{3,4}-)?\\d{7,8}(?:-\\d{1,4})?$";
/** 邮政编码规则 */
public static final String POSTCODE_PATTERN = "[1-9]\\d{5}" ;
/** 邮箱规则 */
public static final String EMAIL_PATTERN = "^([a-z0-9A-Z]+[-|_|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$" ;
/** 年龄规则 1-120之间 */
public static final String AGE_PATTERN="^(?:[1-9][0-9]?|1[01][0-9]|120)$";
/** 身份证规则 */
public static final String IDCARD_PATTERN="(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9Xx]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)" ;
/** URL规则,http、www、ftp */
public static final String URL_PATTERN = "http(s)?://([\\w-]+\\.)+[\\w-]+(/[\\w- ./?%&=]*)?" ;
/** QQ规则 */
public static final String QQ_PATTERN = "^[1-9][0-9]{4,13}$" ;
/** 全汉字规则 */
public static final String CHINESE_PATTERN = "^[\u4E00-\u9FA5]+$" ;
/** 全字母规则 */
public static final String STR_ENG_PATTERN="^[A-Za-z]+$";
/** 整数规则 */
public static final String INTEGER_PATTERN = "^-?[0-9]+$" ;
/** 正整数规则 */
public static final String POSITIVE_INTEGER_PATTERN = "^\\+?[1-9][0-9]*$" ;
/**浮点数规则*/
public static final String FLOAT_PATTERN = "^(-?\\d+)(\\.\\d+)?$";
/**日期格式化1*/
public static final String DATEFORMAT1_PATTERN = "YYYY-MM-dd";
/**日期格式化2*/
public static final String DATEFORMAT2_PATTERN = "yyyy-MM-dd HH:mm:ss";
/**日期格式化3*/
public static final String DATEFORMAT3_PATTERN = "YYYY-MM";
/**姓名规则 汉字、英文、· 最多10位*/
public static final String USER_NAME_PATTERN = "^[\\u4e00-\\u9fa5a-zA-Z\\·]{1,10}";
/** 全汉字 最多20位 规则 */
public static final String CHINESE_PATTERN_20 = "^[\\u4E00-\\u9FA5]{1,20}";
/** 最多20位 规则 */
public static final String PATTERN_20 = "^.{1,20}$";
/** 最多32位 规则 */
public static final String PATTERN_32 = "^.{1,32}$";
/** 最多50位 规则 */
public static final String PATTERN_50 = "^.{1,50}$";
/** 最多60位 规则 */
public static final String PATTERN_60 = "^.{1,60}$";
/** 最多200位 规则 */
public static final String PATTERN_200 = "[\\s\\S]{1,200}$";
public static String NUMBER_OF_DECIMAL_PLACE= "^[1-9]\\d*\\.\\d*|0\\.\\d*[1-9]\\d*$";
/** 不超过两位小数的正数 */
public static final String POSITIVE_INTEGER_PATTERN_TWO_FLOAT = "^[+]?([0-9]+(.[0-9]{1,2})?)$";
/** 身份证规则(x只能大写) */
public static final String IDCARD_UPPERCASE_PATTERN = "(^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}[0-9X]$)|(^[1-9]\\d{5}\\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\\d{3}$)" ;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* @author lengleng
* @date 2019-05-16
* <p>
* 字典类型
*/
@Getter
@RequiredArgsConstructor
public enum DictTypeEnum {
/**
* 字典类型-系统内置(不可修改)
*/
SYSTEM("0", "系统内置"),
/**
* 字典类型-业务类型
*/
BIZ("1", "业务类");
/**
* 类型
*/
private final String type;
/**
* 描述
*/
private final String description;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* @author lengleng
* @date 2018/8/15 社交登录类型
*/
@Getter
@RequiredArgsConstructor
public enum LoginTypeEnum {
/**
* 账号密码登录
*/
PWD("PWD", "账号密码登录"),
/**
* 验证码登录
*/
SMS("SMS", "验证码登录");
/**
* 类型
*/
private final String type;
/**
* 描述
*/
private final String description;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.constant.enums;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
/**
* @author lengleng
* @date 2020-02-17
* <p>
* 菜单类型
*/
@Getter
@RequiredArgsConstructor
public enum MenuTypeEnum {
/**
* 字典类型-系统内置(不可修改)
*/
SYSTEM("0", "系统内置"),
/**
* 字典类型-数据权限配置表示
*/
DATA_FLAG("0", "是"),
/**
* 左侧菜单
*/
LEFT_MENU("0", "left"),
/**
* 顶部菜单
*/
TOP_MENU("2", "top"),
/**
* 按钮
*/
BUTTON("1", "button");
/**
* 类型
*/
private final String type;
/**
* 描述
*/
private final String description;
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.exception;
import lombok.NoArgsConstructor;
/**
* @author lengleng
* @date 😴2018年06月22日16:21:57
*/
@NoArgsConstructor
public class CheckedException extends RuntimeException {
private static final long serialVersionUID = 1L;
public CheckedException(String message) {
super(message);
}
public CheckedException(Throwable cause) {
super(cause);
}
public CheckedException(String message, Throwable cause) {
super(message, cause);
}
public CheckedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.exception;
import lombok.NoArgsConstructor;
@NoArgsConstructor //@NoArgsConstructor: 自动生成无参数构造函数。
public class ExcelException extends RuntimeException {
public ExcelException(String message) {
super(message);
}
public ExcelException(Throwable cause) {
super(cause);
}
public ExcelException(String message, Throwable cause) {
super(message, cause);
}
public ExcelException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.exception;
/**
* @author lengleng
* @date 2018年06月22日16:22:15
*/
public class ValidateCodeException extends RuntimeException {
private static final long serialVersionUID = -7285211528095468156L;
public ValidateCodeException() {
}
public ValidateCodeException(String msg) {
super(msg);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.exception;
import lombok.NoArgsConstructor;
/**
* @author lengleng
* @date 2018年06月22日16:22:03 403 授权拒绝
*/
@NoArgsConstructor
public class YifuDeniedException extends RuntimeException {
private static final long serialVersionUID = 1L;
public YifuDeniedException(String message) {
super(message);
}
public YifuDeniedException(Throwable cause) {
super(cause);
}
public YifuDeniedException(String message, Throwable cause) {
super(message, cause);
}
public YifuDeniedException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
super(message, cause, enableSuppression, writableStackTrace);
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.factory;
import org.springframework.beans.factory.config.YamlPropertiesFactoryBean;
import org.springframework.core.env.PropertiesPropertySource;
import org.springframework.core.env.PropertySource;
import org.springframework.core.io.support.EncodedResource;
import org.springframework.core.io.support.PropertySourceFactory;
import org.springframework.lang.Nullable;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
/**
* @author lengleng
* @date 2022/3/29
*
* 读取自定义 yaml 文件工厂类
*/
public class YamlPropertySourceFactory implements PropertySourceFactory {
@Override
public PropertySource<?> createPropertySource(@Nullable String name, EncodedResource resource) throws IOException {
Properties propertiesFromYaml = loadYamlIntoProperties(resource);
String sourceName = name != null ? name : resource.getResource().getFilename();
return new PropertiesPropertySource(sourceName, propertiesFromYaml);
}
private Properties loadYamlIntoProperties(EncodedResource resource) throws FileNotFoundException {
try {
YamlPropertiesFactoryBean factory = new YamlPropertiesFactoryBean();
factory.setResources(resource.getResource());
factory.afterPropertiesSet();
return factory.getObject();
}
catch (IllegalStateException e) {
Throwable cause = e.getCause();
if (cause instanceof FileNotFoundException)
throw (FileNotFoundException) e.getCause();
throw e;
}
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.jackson;
import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.fasterxml.jackson.datatype.jsr310.PackageVersion;
import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.InstantSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalTimeSerializer;
import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.format.DateTimeFormatter;
/**
* java 8 时间默认序列化
*
* @author L.cm
* @author lishanbu
*/
public class YifuJavaTimeModule extends SimpleModule {
public YifuJavaTimeModule() {
super(PackageVersion.VERSION);
// ======================= 时间序列化规则 ===============================
// yyyy-MM-dd HH:mm:ss
this.addSerializer(LocalDateTime.class, new LocalDateTimeSerializer(DatePattern.NORM_DATETIME_FORMATTER));
// yyyy-MM-dd
this.addSerializer(LocalDate.class, new LocalDateSerializer(DateTimeFormatter.ISO_LOCAL_DATE));
// HH:mm:ss
this.addSerializer(LocalTime.class, new LocalTimeSerializer(DateTimeFormatter.ISO_LOCAL_TIME));
// Instant 类型序列化
this.addSerializer(Instant.class, InstantSerializer.INSTANCE);
// ======================= 时间反序列化规则 ==============================
// yyyy-MM-dd HH:mm:ss
this.addDeserializer(LocalDateTime.class, new LocalDateTimeDeserializer(DatePattern.NORM_DATETIME_FORMATTER));
// yyyy-MM-dd
this.addDeserializer(LocalDate.class, new LocalDateDeserializer(DateTimeFormatter.ISO_LOCAL_DATE));
// HH:mm:ss
this.addDeserializer(LocalTime.class, new LocalTimeDeserializer(DateTimeFormatter.ISO_LOCAL_TIME));
// Instant 反序列化
this.addDeserializer(Instant.class, InstantDeserializer.INSTANT);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import lombok.experimental.UtilityClass;
import org.springframework.core.BridgeMethodResolver;
import org.springframework.core.DefaultParameterNameDiscoverer;
import org.springframework.core.MethodParameter;
import org.springframework.core.ParameterNameDiscoverer;
import org.springframework.core.annotation.AnnotatedElementUtils;
import org.springframework.core.annotation.SynthesizingMethodParameter;
import org.springframework.web.method.HandlerMethod;
import java.lang.annotation.Annotation;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
/**
* 类工具类
*
* @author L.cm
*/
@UtilityClass
public class ClassUtils extends org.springframework.util.ClassUtils {
private final ParameterNameDiscoverer PARAMETERNAMEDISCOVERER = new DefaultParameterNameDiscoverer();
/**
* 获取方法参数信息
* @param constructor 构造器
* @param parameterIndex 参数序号
* @return {MethodParameter}
*/
public MethodParameter getMethodParameter(Constructor<?> constructor, int parameterIndex) {
MethodParameter methodParameter = new SynthesizingMethodParameter(constructor, parameterIndex);
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
return methodParameter;
}
/**
* 获取方法参数信息
* @param method 方法
* @param parameterIndex 参数序号
* @return {MethodParameter}
*/
public MethodParameter getMethodParameter(Method method, int parameterIndex) {
MethodParameter methodParameter = new SynthesizingMethodParameter(method, parameterIndex);
methodParameter.initParameterNameDiscovery(PARAMETERNAMEDISCOVERER);
return methodParameter;
}
/**
* 获取Annotation
* @param method Method
* @param annotationType 注解类
* @param <A> 泛型标记
* @return {Annotation}
*/
public <A extends Annotation> A getAnnotation(Method method, Class<A> annotationType) {
Class<?> targetClass = method.getDeclaringClass();
// The method may be on an interface, but we need attributes from the target
// class.
// If the target class is null, the method will be unchanged.
Method specificMethod = ClassUtils.getMostSpecificMethod(method, targetClass);
// If we are dealing with method with generic parameters, find the original
// method.
specificMethod = BridgeMethodResolver.findBridgedMethod(specificMethod);
// 先找方法,再找方法上的类
A annotation = AnnotatedElementUtils.findMergedAnnotation(specificMethod, annotationType);
;
if (null != annotation) {
return annotation;
}
// 获取类上面的Annotation,可能包含组合注解,故采用spring的工具类
return AnnotatedElementUtils.findMergedAnnotation(specificMethod.getDeclaringClass(), annotationType);
}
/**
* 获取Annotation
* @param handlerMethod HandlerMethod
* @param annotationType 注解类
* @param <A> 泛型标记
* @return {Annotation}
*/
public <A extends Annotation> A getAnnotation(HandlerMethod handlerMethod, Class<A> annotationType) {
// 先找方法,再找方法上的类
A annotation = handlerMethod.getMethodAnnotation(annotationType);
if (null != annotation) {
return annotation;
}
// 获取类上面的Annotation,可能包含组合注解,故采用spring的工具类
Class<?> beanType = handlerMethod.getBeanType();
return AnnotatedElementUtils.findMergedAnnotation(beanType, annotationType);
}
}
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import cn.hutool.extra.spring.SpringUtil;
import lombok.experimental.UtilityClass;
import org.springframework.context.MessageSource;
import java.util.Locale;
/**
* i18n 工具类
*
* @author lengleng
* @date 2022/3/30
*/
@UtilityClass
public class MsgUtils {
/**
* 通过code 获取中文错误信息
* @param code
* @return
*/
public String getMessage(String code) {
MessageSource messageSource = SpringUtil.getBean("messageSource");
return messageSource.getMessage(code, null, Locale.CHINA);
}
/**
* 通过code 和参数获取中文错误信息
* @param code
* @return
*/
public String getMessage(String code, Object... objects) {
MessageSource messageSource = SpringUtil.getBean("messageSource");
return messageSource.getMessage(code, objects, Locale.CHINA);
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import lombok.*;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* 响应信息主体
*
* @param <T>
* @author lengleng
*/
@ToString
@NoArgsConstructor
@AllArgsConstructor
@Accessors(chain = true)
public class R<T> implements Serializable {
private static final long serialVersionUID = 1L;
@Getter
@Setter
private int code;
@Getter
@Setter
private String msg;
@Getter
@Setter
private T data;
public R(T data) {
super();
this.data = data;
this.code = CommonConstants.SUCCESS;
}
//这个异常类不要放开,new R(null)容易出现问题
public R(T data,Throwable e) {
super();
this.msg = e.getMessage();
this.code = CommonConstants.FAIL;
}
public static <T> R<T> ok() {
return restResult(null, CommonConstants.SUCCESS, null);
}
public static <T> R<T> ok(T data) {
return restResult(data, CommonConstants.SUCCESS, null);
}
public static <T> R<T> ok(T data, String msg) {
return restResult(data, CommonConstants.SUCCESS, msg);
}
public static <T> R<T> failed() {
return restResult(null, CommonConstants.FAIL, null);
}
public static <T> R<T> failed(String msg) {
return restResult(null, CommonConstants.FAIL, msg);
}
public static <T> R<T> failed(T data) {
return restResult(data, CommonConstants.FAIL, null);
}
public static <T> R<T> failed(T data, String msg) {
return restResult(data, CommonConstants.FAIL, msg);
}
private static <T> R<T> restResult(T data, int code, String msg) {
R<T> apiResult = new R<>();
apiResult.setCode(code);
apiResult.setData(data);
apiResult.setMsg(msg);
return apiResult;
}
}
/*
* Copyright (c) 2020 yifu4cloud Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yifu.cloud.plus.v1.yifu.common.core.util;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
/**
* @author lengleng
* @date 2019/2/1 Spring 工具类
*/
@Slf4j
@Service
@Lazy(false)
public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
private static ApplicationContext applicationContext = null;
/**
* 取得存储在静态变量中的ApplicationContext.
*/
public static ApplicationContext getApplicationContext() {
return applicationContext;
}
/**
* 实现ApplicationContextAware接口, 注入Context到静态变量中.
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) {
SpringContextHolder.applicationContext = applicationContext;
}
/**
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
@SuppressWarnings("unchecked")
public static <T> T getBean(String name) {
return (T) applicationContext.getBean(name);
}
/**
* 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
*/
public static <T> T getBean(Class<T> requiredType) {
return applicationContext.getBean(requiredType);
}
/**
* 清除SpringContextHolder中的ApplicationContext为Null.
*/
public static void clearHolder() {
if (log.isDebugEnabled()) {
log.debug("清除SpringContextHolder中的ApplicationContext:" + applicationContext);
}
applicationContext = null;
}
/**
* 发布事件
* @param event
*/
public static void publishEvent(ApplicationEvent event) {
if (applicationContext == null) {
return;
}
applicationContext.publishEvent(event);
}
/**
* 实现DisposableBean接口, 在Context关闭时清理静态变量.
*/
@Override
@SneakyThrows
public void destroy() {
SpringContextHolder.clearHolder();
}
}
......@@ -67,7 +67,7 @@ public class TSalaryAccountServiceImpl extends ServiceImpl<TSalaryAccountMapper,
long pageCount = baseMapper.getTSalaryAccountPageCountDiy(tSalaryAccount);
page.setTotal(pageCount);
if (pageCount > 0L) {
page.setPages((long) Math.ceil(pageCount / page.getSize()));
page.setPages((long) Math.ceil(1.0*pageCount / page.getSize()));
}
if (page.getCurrent() < 1) {
page.setCurrent(1L);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment