From 83fc24ac0dc7653945e0491c480503183725fdb1 Mon Sep 17 00:00:00 2001
From: yxt_njy <119782786@qq.com>
Date: Fri, 26 Apr 2024 08:41:56 +0800
Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A1=B9=E7=9B=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 0
pom.xml | 133 +++++++++
.../com/yxt/finance/FinanceApplication.java | 24 ++
.../yxt/finance/apiadmin/AdminHomeRest.java | 10 +
.../com/yxt/finance/apiwx/WxHomeRest.java | 10 +
.../com/yxt/finance/biz/package-info.java | 4 +
.../yxt/finance/config/SaTokenConfigure.java | 114 +++++++
.../config/SaTokenGloableException.java | 67 +++++
.../com/yxt/finance/config/package-info.java | 4 +
.../com/yxt/finance/feign/package-info.java | 4 +
.../com/yxt/finance/utils/DoubleUtils.java | 93 ++++++
.../com/yxt/finance/utils/PinYinUtils.java | 277 ++++++++++++++++++
.../com/yxt/finance/utils/StyleUtils.java | 89 ++++++
src/main/resources/application-dev.yml | 37 +++
src/main/resources/application-pro.yml | 29 ++
src/main/resources/application-test.yml | 34 +++
src/main/resources/application.yml | 50 ++++
src/main/resources/logback-spring.xml | 50 ++++
18 files changed, 1029 insertions(+)
create mode 100644 README.md
create mode 100644 pom.xml
create mode 100644 src/main/java/com/yxt/finance/FinanceApplication.java
create mode 100644 src/main/java/com/yxt/finance/apiadmin/AdminHomeRest.java
create mode 100644 src/main/java/com/yxt/finance/apiwx/WxHomeRest.java
create mode 100644 src/main/java/com/yxt/finance/biz/package-info.java
create mode 100644 src/main/java/com/yxt/finance/config/SaTokenConfigure.java
create mode 100644 src/main/java/com/yxt/finance/config/SaTokenGloableException.java
create mode 100644 src/main/java/com/yxt/finance/config/package-info.java
create mode 100644 src/main/java/com/yxt/finance/feign/package-info.java
create mode 100644 src/main/java/com/yxt/finance/utils/DoubleUtils.java
create mode 100644 src/main/java/com/yxt/finance/utils/PinYinUtils.java
create mode 100644 src/main/java/com/yxt/finance/utils/StyleUtils.java
create mode 100644 src/main/resources/application-dev.yml
create mode 100644 src/main/resources/application-pro.yml
create mode 100644 src/main/resources/application-test.yml
create mode 100644 src/main/resources/application.yml
create mode 100644 src/main/resources/logback-spring.xml
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..e69de29
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..da6441c
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,133 @@
+
+
+
+
+ com.yxt
+ yxt-parent
+ 0.0.1
+
+
+ 4.0.0
+
+ ss-common-finance
+ ss-common-finance
+ 2.0.1
+
+
+
+ com.yxt
+ yxt-common-base
+ 0.0.1
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.alibaba.cloud
+ spring-cloud-starter-alibaba-nacos-discovery
+
+
+
+ org.springframework.cloud
+ spring-cloud-starter-openfeign
+
+
+
+
+ mysql
+ mysql-connector-java
+ runtime
+
+
+
+ com.baomidou
+ mybatis-plus-boot-starter
+
+
+ com.baomidou
+ mybatis-plus-annotation
+
+
+ junit
+ junit
+ compile
+
+
+
+ org.projectlombok
+ lombok
+ true
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+
+
+ cn.dev33
+ sa-token-spring-boot-starter
+ 1.37.0
+
+
+ cn.hutool
+ hutool-all
+ 5.8.23
+
+
+ cn.hutool
+ hutool-core
+ 5.8.23
+
+
+ com.google.zxing
+ core
+ 3.5.2
+
+
+ com.alibaba
+ easyexcel
+ 3.3.2
+
+
+
+
+
+
+
+ org.springframework.boot
+ spring-boot-maven-plugin
+ 2.5.6
+
+
+
+ repackage
+
+
+
+
+
+
+
+ src/main/java
+
+ **/*Mapper.xml
+
+
+
+ src/main/resources
+
+ **/*.*
+
+ false
+
+
+
+
+
diff --git a/src/main/java/com/yxt/finance/FinanceApplication.java b/src/main/java/com/yxt/finance/FinanceApplication.java
new file mode 100644
index 0000000..02ac8c3
--- /dev/null
+++ b/src/main/java/com/yxt/finance/FinanceApplication.java
@@ -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);
+ }
+}
diff --git a/src/main/java/com/yxt/finance/apiadmin/AdminHomeRest.java b/src/main/java/com/yxt/finance/apiadmin/AdminHomeRest.java
new file mode 100644
index 0000000..d7932b8
--- /dev/null
+++ b/src/main/java/com/yxt/finance/apiadmin/AdminHomeRest.java
@@ -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 {
+
+}
diff --git a/src/main/java/com/yxt/finance/apiwx/WxHomeRest.java b/src/main/java/com/yxt/finance/apiwx/WxHomeRest.java
new file mode 100644
index 0000000..fcc2171
--- /dev/null
+++ b/src/main/java/com/yxt/finance/apiwx/WxHomeRest.java
@@ -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 {
+
+}
diff --git a/src/main/java/com/yxt/finance/biz/package-info.java b/src/main/java/com/yxt/finance/biz/package-info.java
new file mode 100644
index 0000000..c1dc015
--- /dev/null
+++ b/src/main/java/com/yxt/finance/biz/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * 宇信通 仓库管理 项目后台逻辑和接口
+ */
+package com.yxt.finance.biz;
\ No newline at end of file
diff --git a/src/main/java/com/yxt/finance/config/SaTokenConfigure.java b/src/main/java/com/yxt/finance/config/SaTokenConfigure.java
new file mode 100644
index 0000000..b662e25
--- /dev/null
+++ b/src/main/java/com/yxt/finance/config/SaTokenConfigure.java
@@ -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/**")
+// ;
+// }
+//}
diff --git a/src/main/java/com/yxt/finance/config/SaTokenGloableException.java b/src/main/java/com/yxt/finance/config/SaTokenGloableException.java
new file mode 100644
index 0000000..b0d0b2f
--- /dev/null
+++ b/src/main/java/com/yxt/finance/config/SaTokenGloableException.java
@@ -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);
+ }
+}
diff --git a/src/main/java/com/yxt/finance/config/package-info.java b/src/main/java/com/yxt/finance/config/package-info.java
new file mode 100644
index 0000000..a84722f
--- /dev/null
+++ b/src/main/java/com/yxt/finance/config/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * 宇信通监管项目-光伏(山海新能源)项目后台逻辑和接口-接口声明
+ */
+package com.yxt.finance.config;
\ No newline at end of file
diff --git a/src/main/java/com/yxt/finance/feign/package-info.java b/src/main/java/com/yxt/finance/feign/package-info.java
new file mode 100644
index 0000000..ead6033
--- /dev/null
+++ b/src/main/java/com/yxt/finance/feign/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * 宇信通监管项目-光伏(山海新能源)项目后台逻辑和接口-接口声明
+ */
+package com.yxt.finance.feign;
\ No newline at end of file
diff --git a/src/main/java/com/yxt/finance/utils/DoubleUtils.java b/src/main/java/com/yxt/finance/utils/DoubleUtils.java
new file mode 100644
index 0000000..892f352
--- /dev/null
+++ b/src/main/java/com/yxt/finance/utils/DoubleUtils.java
@@ -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;
+ }
+}
diff --git a/src/main/java/com/yxt/finance/utils/PinYinUtils.java b/src/main/java/com/yxt/finance/utils/PinYinUtils.java
new file mode 100644
index 0000000..70bf1ea
--- /dev/null
+++ b/src/main/java/com/yxt/finance/utils/PinYinUtils.java
@@ -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 DYZMAP = setDYZMap();
+
+ private static Map setDYZMap(){
+ Map 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 result = new ArrayList();
+ //对字符串中的记录逐个分析
+ 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 getCharPinYinString(char c, List list) {
+ String[] strs = getCharPinYinString(c);
+ List result = new ArrayList();
+ // 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 result = new ArrayList();
+ //对字符串中的记录逐个分析
+ 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 getCharPinYinChar(char c, List list) {
+ char[] chars = getCharPinYinChar(c);
+ List result = new ArrayList();
+ //如果解析出的拼音为空,判断字符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 arrStream = Arrays.stream(str);
+ List 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 "#";
+ }
+ }
+
+}
diff --git a/src/main/java/com/yxt/finance/utils/StyleUtils.java b/src/main/java/com/yxt/finance/utils/StyleUtils.java
new file mode 100644
index 0000000..d85b779
--- /dev/null
+++ b/src/main/java/com/yxt/finance/utils/StyleUtils.java
@@ -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;
+ }
+
+}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
new file mode 100644
index 0000000..30fab1d
--- /dev/null
+++ b/src/main/resources/application-dev.yml
@@ -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/
diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml
new file mode 100644
index 0000000..cb9c87d
--- /dev/null
+++ b/src/main/resources/application-pro.yml
@@ -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/
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
new file mode 100644
index 0000000..fc2e84f
--- /dev/null
+++ b/src/main/resources/application-test.yml
@@ -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/
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
new file mode 100644
index 0000000..b3061d1
--- /dev/null
+++ b/src/main/resources/application.yml
@@ -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
+
+
+
+
diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml
new file mode 100644
index 0000000..ea76604
--- /dev/null
+++ b/src/main/resources/logback-spring.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+ %yellow(%date{yyyy-MM-dd HH:mm:ss}) |%highlight(%-5level) |%green(%logger:%line) |%blue(%msg%n)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${log.base}.log
+
+ ${log.base}.%d{yyyyMMdd}.%i.log.zip
+
+
+
+ 1MB
+
+
+
+
+ %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36}
+ -%msg%n
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file