创建项目
This commit is contained in:
133
pom.xml
Normal file
133
pom.xml
Normal file
@@ -0,0 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>com.yxt</groupId>
|
||||
<artifactId>yxt-parent</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<relativePath/>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ss-common-finance</artifactId>
|
||||
<groupId>ss-common-finance</groupId>
|
||||
<version>2.0.1</version>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.yxt</groupId>
|
||||
<artifactId>yxt-common-base</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--mysql-->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-annotation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- Sa-Token 权限认证,在线文档:https://sa-token.cc -->
|
||||
<dependency>
|
||||
<groupId>cn.dev33</groupId>
|
||||
<artifactId>sa-token-spring-boot-starter</artifactId>
|
||||
<version>1.37.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.23</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-core</artifactId>
|
||||
<version>5.8.23</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.zxing</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>3.5.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<version>3.3.2</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.5.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*Mapper.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.*</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
24
src/main/java/com/yxt/finance/FinanceApplication.java
Normal file
24
src/main/java/com/yxt/finance/FinanceApplication.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.yxt.finance;
|
||||
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
*/
|
||||
@SpringBootApplication(scanBasePackages = {
|
||||
"com.yxt.finance.config",
|
||||
"com.yxt.common.base.config",
|
||||
"com.yxt.goods"
|
||||
})
|
||||
// 启用自带定时任务
|
||||
@EnableScheduling
|
||||
@EnableFeignClients(basePackages = {})
|
||||
public class FinanceApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(FinanceApplication.class, args);
|
||||
}
|
||||
}
|
||||
10
src/main/java/com/yxt/finance/apiadmin/AdminHomeRest.java
Normal file
10
src/main/java/com/yxt/finance/apiadmin/AdminHomeRest.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.yxt.finance.apiadmin;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController("com.yxt.base.apiadmin.AdminHomeRest")
|
||||
@RequestMapping("/apiadmin/home")
|
||||
public class AdminHomeRest {
|
||||
|
||||
}
|
||||
10
src/main/java/com/yxt/finance/apiwx/WxHomeRest.java
Normal file
10
src/main/java/com/yxt/finance/apiwx/WxHomeRest.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.yxt.finance.apiwx;
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController("com.yxt.base.apiwx.WxHomeRest")
|
||||
@RequestMapping("/apiwx/home")
|
||||
public class WxHomeRest {
|
||||
|
||||
}
|
||||
4
src/main/java/com/yxt/finance/biz/package-info.java
Normal file
4
src/main/java/com/yxt/finance/biz/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 宇信通 仓库管理 项目后台逻辑和接口
|
||||
*/
|
||||
package com.yxt.finance.biz;
|
||||
114
src/main/java/com/yxt/finance/config/SaTokenConfigure.java
Normal file
114
src/main/java/com/yxt/finance/config/SaTokenConfigure.java
Normal file
@@ -0,0 +1,114 @@
|
||||
package com.yxt.finance.config;//package com.yxt.base.config;
|
||||
//
|
||||
//import cn.dev33.satoken.interceptor.SaInterceptor;
|
||||
//import cn.dev33.satoken.stp.StpUtil;
|
||||
//import org.springframework.beans.factory.annotation.Value;
|
||||
//import org.springframework.context.annotation.Configuration;
|
||||
//import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
//
|
||||
///**
|
||||
// * @author wangpengfei
|
||||
// * @date 2023/5/16 14:43
|
||||
// */
|
||||
//@Configuration
|
||||
//public class SaTokenConfigure implements WebMvcConfigurer {
|
||||
// @Value("${image.url.prefix:http://127.0.0.1:8080/upload/}")
|
||||
// private String urlPrefix;
|
||||
// // 注册 Sa-Token 拦截器
|
||||
// @Override
|
||||
// public void addInterceptors(InterceptorRegistry registry) {
|
||||
// // 注册 Sa-Token 拦截器,校验规则为 StpUtil.checkLogin() 登录校验。
|
||||
//
|
||||
// registry.addInterceptor(new SaInterceptor(handler -> StpUtil.checkLogin()))
|
||||
// .addPathPatterns("/**")
|
||||
// .excludePathPatterns("/sysuser/doLogin")
|
||||
// .excludePathPatterns("/lpkgiftcard/gifCardByCustomerSid")
|
||||
// .excludePathPatterns("/empcardgift/gifCardByCustomerSid")
|
||||
// .excludePathPatterns("/empcard/getEmpCardByCustomerSid")
|
||||
// .excludePathPatterns("/lpkgiftcard/getGifCardBySid/**")
|
||||
// .excludePathPatterns("/empcardgift/getGifCardBySid/**")
|
||||
// .excludePathPatterns("/empcard/getEmpCardBySid/**")
|
||||
// .excludePathPatterns("/lpkgiftcard/isSaturAndSun/**")
|
||||
// .excludePathPatterns("/empcardgift/isSaturAndSun/**")
|
||||
// .excludePathPatterns("/empcard/isSaturAndSun/**")
|
||||
// .excludePathPatterns("/lpkgiftcard/getReservationBySid/**")
|
||||
// .excludePathPatterns("/lpksreservoorder/submission")
|
||||
// .excludePathPatterns("/lpksreservoorder/exportExcelByStore")
|
||||
// .excludePathPatterns("/empsreservoorder/createNewUserBagOrder")
|
||||
// .excludePathPatterns("/lpksreservoorders/submission")
|
||||
// .excludePathPatterns("/empsreservoorder/ordersList")
|
||||
// .excludePathPatterns("/empsreservoorder/submission")
|
||||
// .excludePathPatterns("/empsreservoorder/submissionEmp")
|
||||
// .excludePathPatterns("/empcardgift/generateCard")
|
||||
// .excludePathPatterns("/lpkgiftcard/bindCard")
|
||||
// .excludePathPatterns("/empcard/bindCard")
|
||||
// .excludePathPatterns("/lpksreservoorder/orderByCardSid/**")
|
||||
// .excludePathPatterns("/lpksreservoorder/orderListByUserSid/**")
|
||||
// .excludePathPatterns("/lpksreservoorder/orderDetails/**")
|
||||
// .excludePathPatterns("/newcomerrecorecord/recommendNewUsers")
|
||||
// .excludePathPatterns("/newcomerrecorecord/recommendedAssistance")
|
||||
// .excludePathPatterns("/newcomerrecorecord/recordList/**")
|
||||
// .excludePathPatterns("/transferrecords/transferRecordsList")
|
||||
// .excludePathPatterns("/empsreservoorder/createVegeOrder")
|
||||
// .excludePathPatterns("/empsreservoorder/OrderDetails/**")
|
||||
// .excludePathPatterns("/empsreservoorder/changePayState/**")
|
||||
// .excludePathPatterns("/lpkgoods/goodsDetails/**")
|
||||
// .excludePathPatterns("/lpkstore/getAllStoreByQuery")
|
||||
// .excludePathPatterns("/vegetablecellar/receiveTransferGoods")
|
||||
// .excludePathPatterns("/transferrecords/submission")
|
||||
// .excludePathPatterns("/lpkgiftcard/getCardByBank")
|
||||
// .excludePathPatterns("/empcard/getEmpCard")
|
||||
// .excludePathPatterns("/empcardgift/shareEmpCard/**")
|
||||
// .excludePathPatterns("/empcardgift/generateEmpCardGift")
|
||||
// .excludePathPatterns("/empcardgift/generateEmpCard")
|
||||
// .excludePathPatterns("/lpkcustomer/wxSilentLogin")
|
||||
// .excludePathPatterns("/lpkgiftcard/gifCardsByCustomerSid")
|
||||
// .excludePathPatterns("/lpkgoods/getAllGiftBag")
|
||||
// .excludePathPatterns("/appletgiftbag/getGiftBagBySid/**")
|
||||
// .excludePathPatterns("/appletgiftbag/appletGiftBagList")
|
||||
// .excludePathPatterns("/lpkgiftcard/cardShareDetail/**")
|
||||
// .excludePathPatterns("/lpkgiftcard/cardShareGoodsDetail/**")
|
||||
// .excludePathPatterns("/empcardgift/generateTopEmpCard/**")
|
||||
// .excludePathPatterns("/empsreservoorder/createOrder")
|
||||
// .excludePathPatterns("/appletgiftbag/recommendRecord/**")
|
||||
// //2024-01-17
|
||||
// .excludePathPatterns("/lpkgiftcard/getAllGoodsType/**")
|
||||
// .excludePathPatterns("/appletnotice/getNotice")
|
||||
// .excludePathPatterns("/empsreservoorder/getPreOrder")
|
||||
// .excludePathPatterns("/lpkgoods/getAllGoodsType/**")
|
||||
// .excludePathPatterns("/transferrecords/submission")
|
||||
// .excludePathPatterns("/vegetablecellar/receiveTransferGoods")
|
||||
// .excludePathPatterns("/customerstore/isSaturAndSun")
|
||||
// .excludePathPatterns("/lpkgiftcard/getGoodsByType/**")
|
||||
// .excludePathPatterns("/lpkgoods/getGoodsTypeAndBrand")
|
||||
// .excludePathPatterns("/lpkgoods/getGoodsByType")
|
||||
// .excludePathPatterns("/lpksreservoorders/orderListByUserSid")
|
||||
// .excludePathPatterns("/appletgiftbag/newUserQuota")
|
||||
// .excludePathPatterns("/shoppingcart/addShoppingCart")
|
||||
// .excludePathPatterns("/shoppingcart/getGoodsWeight")
|
||||
// .excludePathPatterns("/shoppingcart/shoppingCartList")
|
||||
// .excludePathPatterns("/shoppingcart/delShoppingCart/**")
|
||||
// .excludePathPatterns("/lpkgoods/vegeCellarTypeList")
|
||||
// .excludePathPatterns("/vegetablecellar/addGoods/**")
|
||||
// .excludePathPatterns("/lpkgoods/vegeCellarList")
|
||||
// .excludePathPatterns("/customerstore/getStoreBySid/**")
|
||||
// .excludePathPatterns("/lpkgiftcard/bindAllCard")
|
||||
// .excludePathPatterns("/lpkcustomer/customerInfo/**")
|
||||
// .excludePathPatterns("/vegetablecellar/saveGoods")
|
||||
// .excludePathPatterns("/transferrecords/getTransferByCode/**")
|
||||
// //2024-01-18
|
||||
// .excludePathPatterns("/lpkcustomer/getCustomerInfo/**")
|
||||
// .excludePathPatterns("/lpkcustomer/modifyUserNickName")
|
||||
// .excludePathPatterns("/lpkcustomer/modifyHeadImage")
|
||||
// .excludePathPatterns("/upload/**")
|
||||
// .excludePathPatterns("/lpkcustomer/getPhoneNumber")
|
||||
// .excludePathPatterns("/lpkcustomer/getRealInfo/**")
|
||||
// .excludePathPatterns("/lpkcustomer/saveRealInfo")
|
||||
// .excludePathPatterns("/pms/PmsBrand/getList")
|
||||
// .excludePathPatterns("/LpkCustomerBank/getBankList")
|
||||
// .excludePathPatterns("/lpkcustomer/updateCustomerBank")
|
||||
// .excludePathPatterns("//wxapi/**")
|
||||
// ;
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.yxt.finance.config;
|
||||
|
||||
import com.yxt.common.base.config.handler.GlobalExceptionHandler;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.validation.BindException;
|
||||
import org.springframework.validation.ObjectError;
|
||||
import org.springframework.web.bind.MethodArgumentNotValidException;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
import org.springframework.web.bind.annotation.RestControllerAdvice;
|
||||
import org.springframework.web.servlet.NoHandlerFoundException;
|
||||
|
||||
/**
|
||||
* @author dimengzhe
|
||||
* @date 2020/9/12 3:23
|
||||
* @description 全局异常处理
|
||||
*/
|
||||
@RestControllerAdvice
|
||||
public class SaTokenGloableException extends GlobalExceptionHandler {
|
||||
|
||||
private static final Logger L = LoggerFactory.getLogger(GlobalExceptionHandler.class);
|
||||
|
||||
public SaTokenGloableException() {
|
||||
}
|
||||
@ExceptionHandler({Exception.class})
|
||||
public ResultBean handleException(Exception e) {
|
||||
if(null !=e.getMessage()){
|
||||
if(e.getMessage().contains("token 无效:")){
|
||||
L.error(e.getMessage(), e);
|
||||
return ResultBean.fireFail().setCode("5000").setMsg("系统异常::" + e.getMessage());
|
||||
}
|
||||
if(e.getMessage().contains("未能读取到有效 token")){
|
||||
// L.error(e.getMessage(), e);
|
||||
return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
L.error(e.getMessage(), e);
|
||||
return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage());
|
||||
}
|
||||
@ExceptionHandler({NoHandlerFoundException.class})
|
||||
public ResultBean handlerNoFoundException(Exception e) {
|
||||
L.error(e.getMessage(), e);
|
||||
return ResultBean.fireFail().setCode("404").setMsg("路径不存在,请检查路径是否正确");
|
||||
}
|
||||
|
||||
// @ExceptionHandler({Exception.class})
|
||||
// public ResultBean handleException(Exception e) {
|
||||
// L.error(e.getMessage(), e);
|
||||
// return ResultBean.fireFail().setMsg("系统异常::" + e.getMessage());
|
||||
// }
|
||||
|
||||
@ExceptionHandler({BindException.class})
|
||||
public ResultBean validatedBindException(BindException e) {
|
||||
L.error(e.getMessage(), e);
|
||||
String message = ((ObjectError)e.getAllErrors().get(0)).getDefaultMessage();
|
||||
return ResultBean.fireFail().setCode("405").setMsg(message);
|
||||
}
|
||||
|
||||
@ExceptionHandler({MethodArgumentNotValidException.class})
|
||||
public ResultBean validExceptionHandler(MethodArgumentNotValidException e) {
|
||||
L.error(e.getMessage(), e);
|
||||
String message = e.getBindingResult().getFieldError().getDefaultMessage();
|
||||
return ResultBean.fireFail().setCode("405").setMsg(message);
|
||||
}
|
||||
}
|
||||
4
src/main/java/com/yxt/finance/config/package-info.java
Normal file
4
src/main/java/com/yxt/finance/config/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 宇信通监管项目-光伏(山海新能源)项目后台逻辑和接口-接口声明
|
||||
*/
|
||||
package com.yxt.finance.config;
|
||||
4
src/main/java/com/yxt/finance/feign/package-info.java
Normal file
4
src/main/java/com/yxt/finance/feign/package-info.java
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* 宇信通监管项目-光伏(山海新能源)项目后台逻辑和接口-接口声明
|
||||
*/
|
||||
package com.yxt.finance.feign;
|
||||
93
src/main/java/com/yxt/finance/utils/DoubleUtils.java
Normal file
93
src/main/java/com/yxt/finance/utils/DoubleUtils.java
Normal file
@@ -0,0 +1,93 @@
|
||||
package com.yxt.finance.utils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2024/1/24 8:53
|
||||
*/
|
||||
public class DoubleUtils {
|
||||
|
||||
/**
|
||||
* 对double数据进行取精度.
|
||||
* @param value double数据.
|
||||
* @param scale 精度位数(保留的小数位数).
|
||||
* @param roundingMode 精度取值方式.
|
||||
* @return 精度计算后的数据.
|
||||
*/
|
||||
public static double round(double value, int scale,
|
||||
int roundingMode) {
|
||||
BigDecimal bd = BigDecimal.valueOf(value);
|
||||
bd = bd.setScale(scale, roundingMode);
|
||||
double d = bd.doubleValue();
|
||||
bd = null;
|
||||
return d;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* double 相加
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @return
|
||||
*/
|
||||
public static double sum(double d1,double d2){
|
||||
BigDecimal bd1 = BigDecimal.valueOf(d1);
|
||||
BigDecimal bd2 = BigDecimal.valueOf(d2);
|
||||
return bd1.add(bd2).doubleValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* double 相减
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @return
|
||||
*/
|
||||
public static double sub(double d1,double d2){
|
||||
BigDecimal bd1 = BigDecimal.valueOf(d1);
|
||||
BigDecimal bd2 = BigDecimal.valueOf(d2);
|
||||
return bd1.subtract(bd2).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* double 乘法
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @return
|
||||
*/
|
||||
public static double mul(double d1, double d2){
|
||||
BigDecimal bd1 = BigDecimal.valueOf(d1);
|
||||
BigDecimal bd2 = BigDecimal.valueOf(d2);
|
||||
return bd1.multiply(bd2).doubleValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* double 除法
|
||||
* @param d1
|
||||
* @param d2
|
||||
* @param scale 四舍五入 小数点位数
|
||||
* @return
|
||||
*/
|
||||
public static double div(double d1,double d2,int scale){
|
||||
BigDecimal bd1 = BigDecimal.valueOf(d1);
|
||||
BigDecimal bd2 = BigDecimal.valueOf(d2);
|
||||
return bd1.divide
|
||||
(bd2,scale,BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
/**
|
||||
* 去除多余.0
|
||||
* @param num
|
||||
* @return
|
||||
*/
|
||||
public static String removeZeros(String num) {
|
||||
if (num.indexOf(".") > 0) {
|
||||
// 去掉多余的0
|
||||
num = num.replaceAll("0+?$", "");
|
||||
// 如果最后一位是. 则去掉
|
||||
num = num.replaceAll("[.]$", "");
|
||||
}
|
||||
return num;
|
||||
}
|
||||
}
|
||||
277
src/main/java/com/yxt/finance/utils/PinYinUtils.java
Normal file
277
src/main/java/com/yxt/finance/utils/PinYinUtils.java
Normal file
@@ -0,0 +1,277 @@
|
||||
package com.yxt.finance.utils;
|
||||
|
||||
import net.sourceforge.pinyin4j.PinyinHelper;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
|
||||
import net.sourceforge.pinyin4j.format.HanyuPinyinVCharType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* @Description
|
||||
* @Author liuguohui
|
||||
* @Date 2021/9/16
|
||||
*/
|
||||
public class PinYinUtils {
|
||||
|
||||
private static HanyuPinyinOutputFormat format = null;
|
||||
|
||||
static {
|
||||
format = new HanyuPinyinOutputFormat();
|
||||
//拼音小写
|
||||
format.setCaseType(HanyuPinyinCaseType.LOWERCASE);
|
||||
//无音标方式;WITH_TONE_NUMBER:1-4数字表示英标;WITH_TONE_MARK:直接用音标符(必须WITH_U_UNICODE否则异常
|
||||
format.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
|
||||
//用v表示ü
|
||||
format.setVCharType(HanyuPinyinVCharType.WITH_V);
|
||||
}
|
||||
|
||||
// 多音字
|
||||
private static final Map<String, Object> DYZMAP = setDYZMap();
|
||||
|
||||
private static Map<String, Object> setDYZMap(){
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("仇","QIU");
|
||||
map.put("柏", "BO");
|
||||
map.put("牟", "MU");
|
||||
map.put("颉", "XIE");
|
||||
map.put("解", "XIE");
|
||||
map.put("尉", "YU");
|
||||
map.put("奇", "JI");
|
||||
map.put("单", "SHAN");
|
||||
map.put("谌", "SHEN");
|
||||
map.put("乐", "YUE");
|
||||
map.put("召", "SHAO");
|
||||
map.put("朴", "PIAO");
|
||||
map.put("区", "OU");
|
||||
map.put("查", "ZHA");
|
||||
map.put("曾", "ZENG");
|
||||
map.put("缪", "MIAO");
|
||||
map.put("晟", "CHENG");
|
||||
map.put("员", "YUN");
|
||||
map.put("贠", "YUN");
|
||||
map.put("黑", "HE");
|
||||
map.put("重", "CHONG");
|
||||
map.put("秘", "BI");
|
||||
map.put("冼", "XIAN");
|
||||
map.put("折", "SHE");
|
||||
map.put("翟", "ZHAI");
|
||||
map.put("盖", "GE");
|
||||
map.put("万俟", "MOQI");
|
||||
map.put("尉迟", "YUCHI");
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 返回字符串的拼音
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String[] getCharPinYinString(String str) {
|
||||
if (str == null || str.length() < 1) {
|
||||
return null;
|
||||
}
|
||||
List<String> result = new ArrayList<String>();
|
||||
//对字符串中的记录逐个分析
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
result = getCharPinYinString(str.charAt(i), result);
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符c的拼音拼接到list中的记录中
|
||||
* @param c
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
private static List<String> getCharPinYinString(char c, List<String> list) {
|
||||
String[] strs = getCharPinYinString(c);
|
||||
List<String> result = new ArrayList<String>();
|
||||
// strs去重(多音字)
|
||||
strs = disdinctStr(strs);
|
||||
|
||||
//如果解析出的拼音为空,判断字符C是否为英文字母,如果是英文字母则添加值拼音结果中
|
||||
if (strs == null) {
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
|
||||
c = c <= 91 ? (char)(c + 32) : c;
|
||||
if (list == null || list.size() == 0) {
|
||||
result.add(c + "");
|
||||
} else {
|
||||
for (String s : list) {
|
||||
result.add(s + c);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
//将字符C的拼音首和已存在的拼音首组合成新的记录
|
||||
for (String str : strs) {
|
||||
if (list == null || list.size() == 0) {
|
||||
result.add(str);
|
||||
} else {
|
||||
for (String s : list) {
|
||||
result.add(s + str);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回汉字的拼音
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
public static String[] getCharPinYinString(char c) {
|
||||
try {
|
||||
//返回字符C的拼音
|
||||
return PinyinHelper.toHanyuPinyinStringArray(c, format);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回字符串的拼音的首字母
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String[] getCharPinYinChar(String str) {
|
||||
if (str == null || str.length() < 1) {
|
||||
return null;
|
||||
}
|
||||
List<String> result = new ArrayList<String>();
|
||||
//对字符串中的记录逐个分析
|
||||
for (int i = 0; i < str.length(); i++) {
|
||||
result = getCharPinYinChar(str.charAt(i), result);
|
||||
}
|
||||
return result.toArray(new String[result.size()]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符c的拼音首字母拼接到list中的记录中
|
||||
* @param c
|
||||
* @param list
|
||||
* @return
|
||||
*/
|
||||
private static List<String> getCharPinYinChar(char c, List<String> list) {
|
||||
char[] chars = getCharPinYinChar(c);
|
||||
List<String> result = new ArrayList<String>();
|
||||
//如果解析出的拼音为空,判断字符C是否为英文字母,如果是英文字母则添加值拼音结果中
|
||||
if (chars == null) {
|
||||
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z')) {
|
||||
c = c < 91 ? (char)(c + 32) : c;
|
||||
if (list == null || list.size() == 0) {
|
||||
result.add(c + "");
|
||||
} else {
|
||||
for (String s : list) {
|
||||
result.add(s + c);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
//将字符C的拼音首字母和已存在的拼音首字母组合成新的记录
|
||||
for (char ch : chars) {
|
||||
if (list == null || list.size() == 0) {
|
||||
result.add(ch + "");
|
||||
} else {
|
||||
for (String s : list) {
|
||||
result.add(s + ch);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回汉字拼音首字母
|
||||
* @param c
|
||||
* @return
|
||||
*/
|
||||
public static char[] getCharPinYinChar(char c) {
|
||||
//字符C的拼音
|
||||
String[] strs = getCharPinYinString(c);
|
||||
if (strs != null) {
|
||||
//截取拼音的首字母
|
||||
char[] chars = new char[strs.length];
|
||||
for(int i = 0; i <chars.length; i++) {
|
||||
chars[i] = strs[i].charAt(0);
|
||||
}
|
||||
return chars;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去重
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private static String [] disdinctStr(String str[]){
|
||||
Stream<String> arrStream = Arrays.stream(str);
|
||||
List<String> arrList = arrStream.distinct().collect(Collectors.toList());
|
||||
str = new String[arrList.size()];
|
||||
arrList.toArray(str);
|
||||
return str;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断传入的字符串是否为中文,将中文的转换为拼音
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public static String getPinYinName(String name){
|
||||
char[] nameArray = name.toCharArray();
|
||||
String newName = "";
|
||||
for (int i = 0; i < nameArray.length; i++) {
|
||||
if (Character.toString(nameArray[i]).matches("^[\u4e00-\u9fa5]+$")) { // 如果字符是中文,则将中文转为汉语拼音
|
||||
String[] pinYinString = PinYinUtils.getCharPinYinString(nameArray[i]);
|
||||
// strs去重(多音字)
|
||||
pinYinString = disdinctStr(pinYinString);
|
||||
String pinYinStr = StringUtils.join(pinYinString);
|
||||
newName = newName + pinYinStr;
|
||||
}else {
|
||||
newName = newName + Character.toString(nameArray[i]);
|
||||
}
|
||||
}
|
||||
return newName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回字符串的拼音的首字母(包括多音字)
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static String getCharDuoPinYinChar(String str) {
|
||||
if (str == null || str.length() < 1) {
|
||||
return null;
|
||||
}
|
||||
char firstChar = str.toCharArray()[0];
|
||||
if(Character.toString(firstChar).matches("^[\u4e00-\u9fa5]+$")){ // 为中文
|
||||
char[] charPinYinChar = getCharPinYinChar(firstChar);
|
||||
String result = "";
|
||||
if (DYZMAP.containsKey(Character.toString(firstChar))) {
|
||||
result = DYZMAP.get(Character.toString(firstChar)).toString().substring(0, 1);
|
||||
}else {
|
||||
result = StringUtils.join(charPinYinChar[0]);
|
||||
}
|
||||
return result.toUpperCase();
|
||||
}else if(Character.toString(firstChar).matches("^[a-zA-Z]")){ // 为英文字母
|
||||
return Character.toString(firstChar).toUpperCase();
|
||||
}else { // 特殊符号
|
||||
return "#";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
89
src/main/java/com/yxt/finance/utils/StyleUtils.java
Normal file
89
src/main/java/com/yxt/finance/utils/StyleUtils.java
Normal file
@@ -0,0 +1,89 @@
|
||||
package com.yxt.finance.utils;
|
||||
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import org.apache.poi.ss.usermodel.BorderStyle;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
|
||||
/**
|
||||
* @author wangpengfei
|
||||
* @date 2023/12/16 22:14
|
||||
*/
|
||||
public class StyleUtils { /**
|
||||
* 标题样式
|
||||
* @return
|
||||
*/
|
||||
public static WriteCellStyle getHeadStyle(){
|
||||
// 头的策略
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
// 背景颜色
|
||||
// headWriteCellStyle.setFillForegroundColor(IndexedColors.LIGHT_TURQUOISE1.getIndex());
|
||||
// headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
// 字体
|
||||
WriteFont headWriteFont = new WriteFont();
|
||||
headWriteFont.setFontName("宋体");//设置字体名字
|
||||
headWriteFont.setFontHeightInPoints((short)14);//设置字体大小
|
||||
headWriteFont.setBold(true);//字体加粗
|
||||
headWriteCellStyle.setWriteFont(headWriteFont); //在样式用应用设置的字体;
|
||||
|
||||
// 样式
|
||||
headWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
|
||||
headWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
|
||||
headWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边框;
|
||||
headWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
|
||||
headWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
|
||||
headWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
|
||||
headWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
|
||||
headWriteCellStyle.setTopBorderColor((short) 0); //设置顶边框颜色;
|
||||
|
||||
headWriteCellStyle.setWrapped(true); //设置自动换行;
|
||||
|
||||
headWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);//设置水平对齐的样式为居中对齐;
|
||||
headWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); //设置垂直对齐的样式为居中对齐;
|
||||
headWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
|
||||
|
||||
return headWriteCellStyle;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 内容样式
|
||||
* @return
|
||||
*/
|
||||
public static WriteCellStyle getContentStyle(){
|
||||
// 内容的策略
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
|
||||
// 背景绿色
|
||||
// 这里需要指定 FillPatternType 为FillPatternType.SOLID_FOREGROUND 不然无法显示背景颜色.头默认了 FillPatternType所以可以不指定
|
||||
// contentWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex());
|
||||
// contentWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
// 设置字体
|
||||
WriteFont contentWriteFont = new WriteFont();
|
||||
contentWriteFont.setFontHeightInPoints((short) 12);//设置字体大小
|
||||
contentWriteFont.setFontName("宋体"); //设置字体名字
|
||||
contentWriteCellStyle.setWriteFont(contentWriteFont);//在样式用应用设置的字体;
|
||||
|
||||
//设置样式;
|
||||
contentWriteCellStyle.setBorderBottom(BorderStyle.THIN);//设置底边框;
|
||||
contentWriteCellStyle.setBottomBorderColor((short) 0);//设置底边框颜色;
|
||||
contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); //设置左边框;
|
||||
contentWriteCellStyle.setLeftBorderColor((short) 0);//设置左边框颜色;
|
||||
contentWriteCellStyle.setBorderRight(BorderStyle.THIN);//设置右边框;
|
||||
contentWriteCellStyle.setRightBorderColor((short) 0);//设置右边框颜色;
|
||||
contentWriteCellStyle.setBorderTop(BorderStyle.THIN);//设置顶边框;
|
||||
contentWriteCellStyle.setTopBorderColor((short) 0); ///设置顶边框颜色;
|
||||
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);// 水平居中
|
||||
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);// 垂直居中
|
||||
contentWriteCellStyle.setWrapped(true); //设置自动换行;
|
||||
|
||||
// contentWriteCellStyle.setShrinkToFit(true);//设置文本收缩至合适
|
||||
|
||||
return contentWriteCellStyle;
|
||||
}
|
||||
|
||||
}
|
||||
37
src/main/resources/application-dev.yml
Normal file
37
src/main/resources/application-dev.yml
Normal file
@@ -0,0 +1,37 @@
|
||||
spring:
|
||||
datasource:
|
||||
hikari:
|
||||
max-lifetime: 500000
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://39.104.100.138:3306/yxt_base?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
|
||||
# url: jdbc:mysql://8.130.39.13:3306/yxt_lpk_yythmall?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true
|
||||
username: root
|
||||
# password: 1LAiGz$t1*Iw
|
||||
password: yxt_mysql_138
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
namespace: common
|
||||
server-addr: 39.104.100.138:8848
|
||||
register-enabled: false
|
||||
redis:
|
||||
database: 3 # Redis数据库索引(默认为0)
|
||||
host: 39.104.100.138
|
||||
jedis:
|
||||
pool:
|
||||
max-active: -1 #连接池最大连接数(使用负值表示没有限制)
|
||||
max-idle: 8 #连接池中的最大空闲连接
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
password:
|
||||
port: 6379
|
||||
timeout: 0 # 连接超时时间(毫秒)
|
||||
|
||||
image:
|
||||
# xlsxtmpl: E:/code/yxt-yyth/target/classes/static/upload/
|
||||
xlsxtmpl: D:/works/projects/yxt/yxtgit/lipinka/yxt-yyth-biz/target/classes/static/upload/
|
||||
upload:
|
||||
# path: E:/code/yxt-yyth/target/classes/static/upload/
|
||||
path: D:/works/projects/yxt/yxtgit/lipinka/yxt-yythmall-biz/target/classes/static/upload/
|
||||
url:
|
||||
prefix: https://supervise.yxtsoft.com/lpk/upload/
|
||||
29
src/main/resources/application-pro.yml
Normal file
29
src/main/resources/application-pro.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://127.0.0.1:3306/yxt_base?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: 1LAiGz$t1*Iw
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: 127.0.0.1:8848
|
||||
redis:
|
||||
database: 3 # Redis数据库索引(默认为0)
|
||||
host: 127.0.0.1
|
||||
jedis:
|
||||
pool:
|
||||
max-active: -1 #连接池最大连接数(使用负值表示没有限制)
|
||||
max-idle: 8 #连接池中的最大空闲连接
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
password: 123456
|
||||
port: 6379
|
||||
timeout: 0 # 连接超时时间(毫秒)
|
||||
image:
|
||||
upload:
|
||||
path: D:/webapps/lipinka/yythmall-ui/upload/
|
||||
url:
|
||||
prefix: https://supervise.yxtsoft.com/lpk/upload/
|
||||
import:
|
||||
filePath: D:/yxt-supervise-gf/upload/
|
||||
34
src/main/resources/application-test.yml
Normal file
34
src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
server:
|
||||
port: 17211
|
||||
|
||||
spring:
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://172.18.0.4:3306/yxt_base?serverTimezone=GMT%2B8&autoReconnect=true&useUnicode=true&characterEncoding=UTF-8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
|
||||
username: root
|
||||
password: yxt_mysql_138
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
namespace: lipinka
|
||||
server-addr: 172.18.0.5:8848
|
||||
ip: 39.104.100.138
|
||||
redis:
|
||||
database: 3 # Redis数据库索引(默认为0)
|
||||
host: 172.18.0.7
|
||||
jedis:
|
||||
pool:
|
||||
max-active: -1 #连接池最大连接数(使用负值表示没有限制)
|
||||
max-idle: 8 #连接池中的最大空闲连接
|
||||
max-wait: -1 # 连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
min-idle: 0 # 连接池中的最小空闲连接
|
||||
password:
|
||||
port: 6379
|
||||
timeout: 0 # 连接超时时间(毫秒)
|
||||
|
||||
|
||||
image:
|
||||
upload:
|
||||
path: /home/lzh/docker_data/nginx/html/lipinka/yythmall-ui/upload/
|
||||
url:
|
||||
prefix: https://lpk.yyundong.com/upload/
|
||||
50
src/main/resources/application.yml
Normal file
50
src/main/resources/application.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
spring:
|
||||
application:
|
||||
name: ss-common-finance
|
||||
profiles:
|
||||
active: dev
|
||||
# active: test
|
||||
# active: pro
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
servlet:
|
||||
#上传文件
|
||||
multipart:
|
||||
max-file-size: 50MB
|
||||
max-request-size: 100MB
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
|
||||
server:
|
||||
port: 6211
|
||||
max-http-header-size: 102400
|
||||
undertow:
|
||||
max-http-post-size: -1
|
||||
|
||||
#mybatis
|
||||
mybatis-plus:
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapper-locations: classpath*:**Mapper.xml
|
||||
global-config:
|
||||
refresh: true
|
||||
db-config:
|
||||
#定义生成ID的类型
|
||||
id-type: Auto
|
||||
db-type: mysql
|
||||
configuration:
|
||||
map-underscore-to-camel-case: false
|
||||
cache-enabled: true
|
||||
call-setters-on-nulls: true
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
|
||||
#rocketmq:
|
||||
# producer:
|
||||
# group: yxt-supervise-gf
|
||||
# name-server: 127.0.0.1:9876
|
||||
|
||||
|
||||
|
||||
|
||||
50
src/main/resources/logback-spring.xml
Normal file
50
src/main/resources/logback-spring.xml
Normal file
@@ -0,0 +1,50 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
|
||||
<property name="log.base" value="logs/yxt_yyth" />
|
||||
|
||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 :
|
||||
|%blue(%thread) 线程 如 :DiscoveryClient-CacheRefreshExecutor-0-->
|
||||
<!--<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>-->
|
||||
<pattern>%yellow(%date{yyyy-MM-dd HH:mm:ss}) |%highlight(%-5level) |%green(%logger:%line) |%blue(%msg%n)
|
||||
</pattern>
|
||||
<!--<charset>UTF-8</charset> -->
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 彩色日志 -->
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
|
||||
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
|
||||
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
|
||||
<appender name="FILEOUT"
|
||||
class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.base}.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.base}.%d{yyyyMMdd}.%i.log.zip
|
||||
</fileNamePattern>
|
||||
<!-- 当文件大小超过10MB时触发滚动 -->
|
||||
<timeBasedFileNamingAndTriggeringPolicy
|
||||
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
|
||||
<maxFileSize>1MB</maxFileSize>
|
||||
</timeBasedFileNamingAndTriggeringPolicy>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<!--<pattern>%date [%thread] %-5level %logger{35} - %msg%n</pattern>-->
|
||||
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}
|
||||
-%msg%n</Pattern>
|
||||
<!--<charset>UTF-8</charset> -->
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILEOUT" />
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user