From 30b8a5b9497ecaca469ff34d83fdc5d6841bd6f5 Mon Sep 17 00:00:00 2001
From: TanYibin <5491541@qq.com>
Date: Wed, 15 Mar 2023 16:27:47 +0800
Subject: [PATCH] prod配置文件优化,接口日志输出格式优化

---
 huaheng-wms-core/src/main/java/org/jeecg/modules/ngalain/aop/LogRecordAspect.java           | 46 ----------------------------------------------
 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/LogRecordAspect.java | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 huaheng-wms-core/src/main/resources/application-prod.yml                                    | 58 +++++++++++++++++++++++++++++++++++-----------------------
 huaheng-wms-core/src/main/resources/logback-spring.xml                                      |  8 ++++----
 4 files changed, 85 insertions(+), 73 deletions(-)
 delete mode 100644 huaheng-wms-core/src/main/java/org/jeecg/modules/ngalain/aop/LogRecordAspect.java
 create mode 100644 huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/LogRecordAspect.java

diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/ngalain/aop/LogRecordAspect.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/ngalain/aop/LogRecordAspect.java
deleted file mode 100644
index 0720085..0000000
--- a/huaheng-wms-core/src/main/java/org/jeecg/modules/ngalain/aop/LogRecordAspect.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.jeecg.modules.ngalain.aop;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.jeecg.modules.wms.framework.aspectj.ApiLoggerAspect;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import com.alibaba.druid.util.StringUtils;
-
-import lombok.extern.slf4j.Slf4j;
-
-// 暂时注释掉,提高系统性能
-@Slf4j
-@Aspect // 定义一个切面
-@Configuration
-public class LogRecordAspect {
-
-    // 定义切点Pointcut
-    @Pointcut("execution(public * org.jeecg.modules.wms..*.controller..*.*(..))" + "&& (@annotation(org.springframework.web.bind.annotation.RequestMapping) "
-        + "|| @annotation(org.springframework.web.bind.annotation.GetMapping) " + "|| @annotation(org.springframework.web.bind.annotation.PostMapping))")
-    public void excudeService() {}
-
-    @Around("excudeService()")
-    public Object doAround(ProceedingJoinPoint point) throws Throwable {
-        long startTime = System.currentTimeMillis();
-        // 接收到请求,记录请求内容
-        ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
-        // 获取请求的request
-        HttpServletRequest request = attributes.getRequest();
-        String url = request.getRequestURL().toString();
-        String className = point.getTarget().getClass().getName();
-        String methodName = point.getSignature().getName();
-        log.info("[Controller start] {}[{}][{}]\r\n{}.{}", url, request.getMethod(), ApiLoggerAspect.getIpAddr(request), className, methodName);
-        // result的值就是被拦截方法的返回值
-        Object result = point.proceed();
-        long callTime = System.currentTimeMillis() - startTime;
-        log.info("[Controller return] {}[{}ms]", url, callTime);
-        return result;
-    }
-}
\ No newline at end of file
diff --git a/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/LogRecordAspect.java b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/LogRecordAspect.java
new file mode 100644
index 0000000..e4eea93
--- /dev/null
+++ b/huaheng-wms-core/src/main/java/org/jeecg/modules/wms/framework/aspectj/LogRecordAspect.java
@@ -0,0 +1,46 @@
+package org.jeecg.modules.wms.framework.aspectj;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.jeecg.modules.wms.framework.aspectj.ApiLoggerAspect;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import com.alibaba.druid.util.StringUtils;
+
+import lombok.extern.slf4j.Slf4j;
+
+// 暂时注释掉,提高系统性能
+@Slf4j
+@Aspect // 定义一个切面
+@Configuration
+public class LogRecordAspect {
+
+    // 定义切点Pointcut
+    @Pointcut("execution(public * org.jeecg.modules.wms..*.controller..*.*(..))" + "&& (@annotation(org.springframework.web.bind.annotation.RequestMapping) "
+        + "|| @annotation(org.springframework.web.bind.annotation.GetMapping) " + "|| @annotation(org.springframework.web.bind.annotation.PostMapping))")
+    public void excudeService() {}
+
+    @Around("excudeService()")
+    public Object doAround(ProceedingJoinPoint point) throws Throwable {
+        long startTime = System.currentTimeMillis();
+        // 接收到请求,记录请求内容
+        ServletRequestAttributes attributes = (ServletRequestAttributes)RequestContextHolder.getRequestAttributes();
+        // 获取请求的request
+        HttpServletRequest request = attributes.getRequest();
+        String url = request.getRequestURL().toString();
+        String className = point.getTarget().getClass().getSimpleName();
+        String methodName = point.getSignature().getName();
+        log.info("[{}] {} [{}.{}] [{}]", request.getMethod(), url, className, methodName, ApiLoggerAspect.getIpAddr(request));
+        // result的值就是被拦截方法的返回值
+        Object result = point.proceed();
+        long callTime = System.currentTimeMillis() - startTime;
+        log.info("[{}] {} [{}.{}] [{}ms]", request.getMethod(), url, className, methodName, callTime);
+        return result;
+    }
+}
\ No newline at end of file
diff --git a/huaheng-wms-core/src/main/resources/application-prod.yml b/huaheng-wms-core/src/main/resources/application-prod.yml
index 5de41d6..8fc07a5 100644
--- a/huaheng-wms-core/src/main/resources/application-prod.yml
+++ b/huaheng-wms-core/src/main/resources/application-prod.yml
@@ -113,7 +113,7 @@ spring:
         # 初始化大小,最小,最大
         initial-size: 5
         min-idle: 5
-        maxActive: 1000
+        maxActive: 20
         # 配置获取连接等待超时的时间
         maxWait: 60000
         # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
@@ -133,16 +133,16 @@ spring:
         connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
       datasource:
         master:
-          url: jdbc:log4jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://172.16.29.45:3306/wms4?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
           username: root
-          password: root
-          driver-class-name: net.sf.log4jdbc.DriverSpy
+          password: hhsoftware
+          driver-class-name: com.mysql.cj.jdbc.Driver
           # 多数据源配置
-          #multi-datasource1:
-          #url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
-          #username: root
-          #password: root
-          #driver-class-name: com.mysql.cj.jdbc.Driver
+          # multi-datasource1:
+          # url: jdbc:mysql://localhost:3306/jeecg-boot2?useUnicode=true&characterEncoding=utf8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          # username: root
+          # password: root
+          # driver-class-name: com.mysql.cj.jdbc.Driver
           # # 达梦数据库链接驱动
           # url: jdbc:dm://192.168.225.128:5236?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true
           # username: WMS4
@@ -151,14 +151,14 @@ spring:
   #redis 配置
   redis:
     database: 0
-    host: 127.0.0.1
+    host: 172.16.29.77
     port: 6379
-    password: ''
+    password: 123456
     lettuce:
       pool:
         min-idle: 0     #最小等待连接中的数量,设 0 为没有限制
         max-idle: 8     #最大等待连接中的数量,设 0 为没有限制
-        max-active: 10   #最大连接数据库连接数,设 -1 为没有限制
+        max-active: 10  #最大连接数据库连接数,设 -1 为没有限制
         max-wait: 5s    #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
         time-between-eviction-runs: 1s #空闲对象逐出器线程的运行间隔时间.空闲连接线程释放周期时间
       shutdown-timeout: 1s #关闭超时
@@ -177,12 +177,14 @@ mybatis-plus:
     map-underscore-to-camel-case: true
     auto-mapping-behavior: full
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    # log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     # 返回类型为Map,显示null对应的字段
     call-setters-on-nulls: true
 #jeecg专用配置
 minidao:
   base-package: org.jeecg.modules.jmreport.*
+  #DB类型(mysql | postgresql | oracle | sqlserver| other)
+  db-type: mysql
 jeecg:
   # 是否启用安全模式
   safeMode: false
@@ -190,15 +192,15 @@ jeecg:
   signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
   # 本地:local\Minio:minio\阿里云:alioss
   uploadType: local
-  # 允许上传的文件类型,使用,分割
-  uploadFileType: apk,txt,jpg,png
+  # 允许上传的文件类型 使用,分割
+  uploadFileType: apk,txt,jpg,png,sh
   path:
     #文件上传根目录 设置
-    upload: ./upload
+    upload: ./upFiles
     #webapp文件路径
     webapp: ./webapp
   shiro:
-    excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/test/test**,/api/**,/sys/cas/client/validateLogin,/sys/common/static/**
+    excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode,/api/**,/sys/cas/client/validateLogin,/sys/common/static/**
   #阿里云oss存储和大鱼短信秘钥配置
   oss:
     accessKey: ??
@@ -209,8 +211,8 @@ jeecg:
   # ElasticSearch 设置
   elasticsearch:
     cluster-name: jeecg-ES
-    cluster-nodes: 127.0.0.1:9200
-    check-enabled: true
+    cluster-nodes: 81.70.47.128:9200
+    check-enabled: false
   # 表单设计器配置
   desform:
     # 主题颜色(仅支持 16进制颜色代码)
@@ -230,7 +232,17 @@ jeecg:
     bucketName: otatest
   #大屏报表参数设置
   jmreport:
-    mode: prod
+    # 打印纸张配置 title描述 size宽高
+    printPaper:
+      - title: 条码双边打印机纸
+        size:
+          - 60
+          - 80
+      - title: 物料双边打印机纸
+        size:
+          - 85
+          - 60
+    mode: dev
     #数据字典是否进行saas数据隔离,自己看自己的字典
     saas: false
     #是否需要校验token
@@ -261,8 +273,8 @@ jeecg:
       data-type: database
   #分布式锁配置
   redisson:
-    address: 127.0.0.1:6379
-    password:
+    address: 172.16.29.77:6379
+    password: 123456
     type: STANDALONE
     enabled: true
 #cas单点登录
@@ -273,7 +285,7 @@ logging:
   level:
     org.jeecg.common: WARN
     org.jeecg.modules: WARN
-    org.jeecg.modules.wms: DEBUG
+    org.jeecg.modules.wms: INFO
     org.jeecg.config.shiro: ERROR
 #swagger
 knife4j:
diff --git a/huaheng-wms-core/src/main/resources/logback-spring.xml b/huaheng-wms-core/src/main/resources/logback-spring.xml
index f183717..c269006 100644
--- a/huaheng-wms-core/src/main/resources/logback-spring.xml
+++ b/huaheng-wms-core/src/main/resources/logback-spring.xml
@@ -71,10 +71,10 @@
     <!-- 每天生成一个html格式的日志结束 -->
 
     <!--myibatis log configure -->
-<!--     <logger name="com.apache.ibatis" level="TRACE" /> -->
-<!--     <logger name="java.sql.Connection" level="DEBUG" /> -->
-<!--     <logger name="java.sql.Statement" level="DEBUG" /> -->
-<!--     <logger name="java.sql.PreparedStatement" level="DEBUG" /> -->
+    <logger name="com.apache.ibatis" level="TRACE" />
+    <logger name="java.sql.Connection" level="INFO" />
+    <logger name="java.sql.Statement" level="INFO" />
+    <logger name="java.sql.PreparedStatement" level="INFO" />
 
     <logger name="jdbc.connection" additivity="false" level="off">
         <appender-ref ref="STDOUT" />
--
libgit2 0.22.2