Commit 948582da338599d93d87c61057ef38c071f580d8

Authored by 肖超群
2 parents b3e611d2 91661442

Merge branch 'develop4' of http://www.huahengrobot.com:90/wms/wms4 into develop4

huaheng-wms-core/src/main/java/org/jeecg/utils/CustomLogContextListener.java 0 → 100644
  1 +package org.jeecg.utils;
  2 +
  3 +import ch.qos.logback.classic.Level;
  4 +import ch.qos.logback.classic.Logger;
  5 +import ch.qos.logback.classic.LoggerContext;
  6 +import ch.qos.logback.classic.spi.LoggerContextListener;
  7 +import ch.qos.logback.core.spi.ContextAwareBase;
  8 +import ch.qos.logback.core.spi.LifeCycle;
  9 +import ch.qos.logback.core.Context;
  10 +
  11 +/**
  12 + * @version 1.0
  13 + * @class: CustomLogContextListener
  14 + * @author: carlo
  15 + * @mail: carlo_cwh@qq.com
  16 + * @date: 2021/8/25 10:01
  17 + * @description: 定义logback 日志监听器,指定日志文件存放目录
  18 + */
  19 +public class CustomLogContextListener extends ContextAwareBase implements LoggerContextListener, LifeCycle {
  20 +
  21 + /** 存储日志路径标识 */
  22 + public static final String LOG_PAHT_KEY = "LOG_PATH";
  23 +
  24 + @Override
  25 + public boolean isResetResistant() {
  26 + return false;
  27 + }
  28 +
  29 + @Override
  30 + public void onStart(LoggerContext loggerContext) {
  31 +
  32 + }
  33 +
  34 + @Override
  35 + public void onReset(LoggerContext loggerContext) {
  36 +
  37 + }
  38 +
  39 + @Override
  40 + public void onStop(LoggerContext loggerContext) {
  41 +
  42 + }
  43 +
  44 + @Override
  45 + public void onLevelChange(Logger logger, Level level) {
  46 +
  47 + }
  48 +
  49 + @Override
  50 + public void start() {
  51 + // "user.dir"是指用户当前工作目录
  52 + String s = System.getProperty("user.dir");
  53 + System.setProperty(LOG_PAHT_KEY, s);
  54 + Context context = getContext();
  55 + context.putProperty(LOG_PAHT_KEY, s);
  56 + }
  57 +
  58 + @Override
  59 + public void stop() {
  60 +
  61 + }
  62 +
  63 + @Override
  64 + public boolean isStarted() {
  65 + return false;
  66 + }
  67 +}
0 68 \ No newline at end of file
... ...
huaheng-wms-core/src/main/resources/application-test.yml
... ... @@ -7,7 +7,7 @@ server:
7 7 include-stacktrace: ALWAYS
8 8 include-message: ALWAYS
9 9 servlet:
10   - context-path: /jeecg-boot
  10 + context-path: /wms
11 11 compression:
12 12 enabled: true
13 13 min-response-size: 1024
... ... @@ -131,9 +131,9 @@ spring:
131 131 connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
132 132 datasource:
133 133 master:
134   - url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
  134 + 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
135 135 username: root
136   - password: root
  136 + password: hhsoftware
137 137 driver-class-name: com.mysql.cj.jdbc.Driver
138 138 # 多数据源配置
139 139 #multi-datasource1:
... ... @@ -144,15 +144,15 @@ spring:
144 144 #redis 配置
145 145 redis:
146 146 database: 0
147   - host: 192.168.1.199
  147 + host: 172.16.29.77
148 148 lettuce:
149 149 pool:
150 150 max-active: 8 #最大连接数据库连接数,设 -1 为没有限制
151 151 max-idle: 8 #最大等待连接中的数量,设 0 为没有限制
152   - max-wait: -1ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
  152 + max-wait: 100ms #最大建立连接等待时间。如果超过此时间将接到异常。设为-1表示无限制。
153 153 min-idle: 0 #最小等待连接中的数量,设 0 为没有限制
154 154 shutdown-timeout: 100ms
155   - password: ''
  155 + password: 123456
156 156 port: 6379
157 157 #mybatis plus 设置
158 158 mybatis-plus:
... ... @@ -161,7 +161,7 @@ mybatis-plus:
161 161 # 关闭MP3.0自带的banner
162 162 banner: false
163 163 db-config:
164   - #主键类型
  164 + #主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
165 165 id-type: ASSIGN_ID
166 166 # 默认数据库表下划线命名
167 167 table-underline: true
... ... @@ -173,20 +173,22 @@ mybatis-plus:
173 173 #jeecg专用配置
174 174 minidao:
175 175 base-package: org.jeecg.modules.jmreport.*
  176 + #DB类型(mysql | postgresql | oracle | sqlserver| other)
  177 + db-type: mysql
176 178 jeecg:
177 179 # 是否启用安全模式
178 180 safeMode: false
179 181 # 签名密钥串(前后端要一致,正式发布请自行修改)
180 182 signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
181 183 # 本地:local\Minio:minio\阿里云:alioss
182   - uploadType: local
  184 + uploadType: minio
183 185 path:
184 186 #文件上传根目录 设置
185   - upload: D://opt//upFiles
  187 + upload: /opt/upFiles
186 188 #webapp文件路径
187   - webapp: D://opt//webapp
  189 + webapp: /opt/webapp
188 190 shiro:
189   - excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**
  191 + excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/category/**,/visual/**,/map/**,/jmreport/bigscreen2/**,/sys/getWarehouseByUserCode
190 192 #阿里云oss存储和大鱼短信秘钥配置
191 193 oss:
192 194 accessKey: ??
... ... @@ -209,20 +211,30 @@ jeecg:
209 211 # 配置百度地图的AK,申请地址:https://lbs.baidu.com/apiconsole/key?application=key#/home
210 212 baidu: ??
211 213 # 在线预览文件服务器地址配置
212   - file-view-domain: http://127.0.0.1:8012
  214 + file-view-domain: 127.0.0.1:8012
213 215 # minio文件上传
214 216 minio:
215 217 minio_url: http://minio.jeecg.com
216 218 minio_name: ??
217 219 minio_pass: ??
218   - bucketName: ??
  220 + bucketName: otatest
219 221 #大屏报表参数设置
220 222 jmreport:
221   - mode: prod
  223 + # 打印纸张配置 title描述 size宽高
  224 + printPaper:
  225 + - title: 条码双边打印机纸
  226 + size:
  227 + - 60
  228 + - 80
  229 + - title: 物料双边打印机纸
  230 + size:
  231 + - 85
  232 + - 60
  233 + mode: dev
222 234 #数据字典是否进行saas数据隔离,自己看自己的字典
223 235 saas: false
224 236 #是否需要校验token
225   - is_verify_token: false
  237 + is_verify_token: true
226 238 #必须校验方法
227 239 verify_methods: remove,delete,save,add,update
228 240 #Wps在线文档
... ... @@ -267,7 +279,7 @@ knife4j:
267 279 #开启生产环境屏蔽
268 280 production: false
269 281 basic:
270   - enable: true
  282 + enable: false
271 283 username: jeecg
272 284 password: jeecg1314
273 285 #第三方登录
... ...
huaheng-wms-core/src/main/resources/logback-spring.xml
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <configuration debug="false">
  3 +
  4 + <!-- 监听器,指定日志文件存放目录 -->
  5 + <contextListener class="org.jeecg.utils.CustomLogContextListener" />
  6 +
3 7 <!--定义日志文件的存储地址 -->
4   - <property name="LOG_HOME" value="../logs"/>
  8 + <property name="LOG_HOME" value="${LOG_PATH}/logs" />
5 9  
6   - <!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
  10 + <!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(
  11 + %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" /> -->
7 12 <!-- 控制台输出 -->
8 13 <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
9 14 <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
10   - <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符
11   - <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n</pattern>-->
  15 + <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L
  16 + - %msg%n</pattern> -->
12 17 <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %highlight(%-5level) %cyan(%logger{50}:%L) - %msg%n</pattern>
13 18 </encoder>
14 19 </appender>
... ... @@ -17,10 +22,10 @@
17 22 <appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
18 23 <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
19 24 <!--日志文件输出的文件名 -->
20   - <FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
  25 + <FileNamePattern>${LOG_HOME}/wms-%d{yyyy-MM-dd}.%i.log</FileNamePattern>
21 26 <!--日志文件保留天数 -->
22 27 <MaxHistory>30</MaxHistory>
23   - <maxFileSize>10MB</maxFileSize>
  28 + <maxFileSize>100MB</maxFileSize>
24 29 </rollingPolicy>
25 30 <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
26 31 <!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
... ... @@ -31,7 +36,7 @@
31 36 <!-- 生成 error html格式日志开始 -->
32 37 <appender name="HTML" class="ch.qos.logback.core.FileAppender">
33 38 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
34   - <!--设置日志级别,过滤掉info日志,只输入error日志-->
  39 + <!--设置日志级别,过滤掉info日志,只输入error日志 -->
35 40 <level>ERROR</level>
36 41 </filter>
37 42 <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
... ... @@ -39,7 +44,7 @@
39 44 <pattern>%p%d%msg%M%F{32}%L</pattern>
40 45 </layout>
41 46 </encoder>
42   - <file>${LOG_HOME}/error-log.html</file>
  47 + <file>${LOG_HOME}/wms-error-log.html</file>
43 48 </appender>
44 49 <!-- 生成 error html格式日志结束 -->
45 50  
... ... @@ -47,10 +52,10 @@
47 52 <appender name="FILE_HTML" class="ch.qos.logback.core.rolling.RollingFileAppender">
48 53 <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
49 54 <!--日志文件输出的文件名 -->
50   - <FileNamePattern>${LOG_HOME}/jeecgboot-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
  55 + <FileNamePattern>${LOG_HOME}/wms-%d{yyyy-MM-dd}.%i.html</FileNamePattern>
51 56 <!--日志文件保留天数 -->
52 57 <MaxHistory>30</MaxHistory>
53   - <MaxFileSize>10MB</MaxFileSize>
  58 + <MaxFileSize>100MB</MaxFileSize>
54 59 </rollingPolicy>
55 60 <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
56 61 <layout class="ch.qos.logback.classic.html.HTMLLayout">
... ... @@ -61,17 +66,17 @@
61 66 <!-- 每天生成一个html格式的日志结束 -->
62 67  
63 68 <!--myibatis log configure -->
64   - <logger name="com.apache.ibatis" level="TRACE"/>
65   - <logger name="java.sql.Connection" level="DEBUG"/>
66   - <logger name="java.sql.Statement" level="DEBUG"/>
67   - <logger name="java.sql.PreparedStatement" level="DEBUG"/>
  69 + <logger name="com.apache.ibatis" level="TRACE" />
  70 + <logger name="java.sql.Connection" level="DEBUG" />
  71 + <logger name="java.sql.Statement" level="DEBUG" />
  72 + <logger name="java.sql.PreparedStatement" level="DEBUG" />
68 73  
69 74 <!-- 日志输出级别 -->
70 75 <root level="INFO">
71   - <appender-ref ref="STDOUT"/>
72   - <appender-ref ref="FILE"/>
73   - <appender-ref ref="HTML"/>
74   - <appender-ref ref="FILE_HTML"/>
  76 + <appender-ref ref="STDOUT" />
  77 + <appender-ref ref="FILE" />
  78 + <appender-ref ref="HTML" />
  79 + <appender-ref ref="FILE_HTML" />
75 80 </root>
76 81  
77 82 </configuration>
... ...