Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
27587260
Commit
27587260
authored
Aug 01, 2019
by
libin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
8e6c8380
2cf6f38f
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
300 additions
and
63 deletions
+300
-63
logback.xml
ace-auth/ace-auth-server/src/main/resources/logback.xml
+2
-2
logback.xml
ace-gate/src/main/resources/logback.xml
+2
-2
logback.xml
ace-modules/ace-admin/src/main/resources/logback.xml
+2
-2
pom.xml
pom.xml
+4
-0
logback.xml
...ctivity/xx-activity-server/src/main/resources/logback.xml
+2
-2
logback.xml
xx-app/xx-app-server/src/main/resources/logback.xml
+2
-2
logback.xml
...ampsite/xx-campsite-server/src/main/resources/logback.xml
+2
-2
logback.xml
xx-im/xx-im-server/src/main/resources/logback.xml
+2
-2
logback.xml
xx-order/xx-order-server/src/main/resources/logback.xml
+2
-2
logback.xml
xx-tour/xx-tour-server/src/main/resources/logback.xml
+40
-40
pom.xml
xx-universal/xx-universal-api/pom.xml
+12
-0
FileTypeEnum.java
...c/platform/universal/constant/enumerate/FileTypeEnum.java
+24
-0
UnPackeUtil.java
...n/java/com/xxfc/platform/universal/utils/UnPackeUtil.java
+85
-0
CommonConfig.java
...java/com/xxfc/platform/universal/config/CommonConfig.java
+2
-2
UploadController.java
.../xxfc/platform/universal/controller/UploadController.java
+11
-0
FileUploadService.java
...om/xxfc/platform/universal/service/FileUploadService.java
+9
-0
UploadService.java
...va/com/xxfc/platform/universal/service/UploadService.java
+1
-1
FileUploadServiceImpl.java
...latform/universal/service/impl/FileUploadServiceImpl.java
+92
-0
logback.xml
...versal/xx-universal-server/src/main/resources/logback.xml
+2
-2
logback.xml
xx-vehicle/xx-vehicle-server/src/main/resources/logback.xml
+2
-2
No files found.
ace-auth/ace-auth-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
ace-gate/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
ace-modules/ace-admin/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
pom.xml
View file @
27587260
...
...
@@ -97,6 +97,10 @@
<artifactId>
fastjson
</artifactId>
<version>
1.2.33
</version>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-sleuth-zipkin
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.cloud
</groupId>
<artifactId>
spring-cloud-alibaba-dependencies
</artifactId>
...
...
xx-activity/xx-activity-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
xx-app/xx-app-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
xx-campsite/xx-campsite-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
xx-im/xx-im-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
xx-order/xx-order-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
xx-tour/xx-tour-server/src/main/resources/logback.xml
View file @
27587260
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"false"
>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<property
name=
"LOG_HOME"
value=
"${system.log.path:-logs}"
/>
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<property
name=
"LOG_HOME"
value=
"${system.log.path:-logs}"
/>
<!-- 彩色日志依赖的渲染类 -->
<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}){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}}"
/>
<!-- 彩色日志依赖的渲染类 -->
<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}){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=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<!--1. 输出到控制台-->
<filter
class=
"com.github.wxiaoqi.security.common.filter.NacosLogFilter"
></filter>
<encoder>
<Pattern>
${CONSOLE_LOG_PATTERN}
</Pattern>
<charset>
UTF-8
</charset>
<!-- 设置字符集 -->
</encoder>
</appender>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<!--1. 输出到控制台-->
<filter
class=
"com.github.wxiaoqi.security.common.filter.NacosLogFilter"
></filter>
<encoder>
<Pattern>
${CONSOLE_LOG_PATTERN}
</Pattern>
<charset>
UTF-8
</charset>
<!-- 设置字符集 -->
</encoder>
</appender>
<appender
name=
"SYSTEM_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 按照每天生成日志文件 -->
<filter
class=
"com.github.wxiaoqi.security.common.filter.DenyFilter"
></filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_HOME}/sys.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件输出的文件名 -->
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
<appender
name=
"SYSTEM_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 按照每天生成日志文件 -->
<filter
class=
"com.github.wxiaoqi.security.common.filter.DenyFilter"
></filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_HOME}/sys.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件输出的文件名 -->
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
<appender
name=
"WEB_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 按照每天生成日志文件 -->
<filter
class=
"com.github.wxiaoqi.security.common.filter.AcceptFilter"
></filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_HOME}/log.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件输出的文件名 -->
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
<appender
name=
"WEB_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 按照每天生成日志文件 -->
<filter
class=
"com.github.wxiaoqi.security.common.filter.AcceptFilter"
></filter>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_HOME}/log.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件输出的文件名 -->
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"SYSTEM_FILE"
/>
<appender-ref
ref=
"WEB_FILE"
/>
</root>
<root
level=
"INFO"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"SYSTEM_FILE"
/>
<appender-ref
ref=
"WEB_FILE"
/>
</root>
</configuration>
\ No newline at end of file
xx-universal/xx-universal-api/pom.xml
View file @
27587260
...
...
@@ -60,6 +60,18 @@
<groupId>
com.google.code.gson
</groupId>
<artifactId>
gson
</artifactId>
</dependency>
<!--zip4j依赖,解压zip压缩-->
<dependency>
<groupId>
net.lingala.zip4j
</groupId>
<artifactId>
zip4j
</artifactId>
<version>
1.3.2
</version>
</dependency>
<!--解压rar压缩-->
<dependency>
<groupId>
com.github.junrar
</groupId>
<artifactId>
junrar
</artifactId>
<version>
0.7
</version>
</dependency>
</dependencies>
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/enumerate/FileTypeEnum.java
0 → 100644
View file @
27587260
package
com
.
xxfc
.
platform
.
universal
.
constant
.
enumerate
;
import
lombok.AllArgsConstructor
;
import
lombok.NoArgsConstructor
;
@AllArgsConstructor
@NoArgsConstructor
public
enum
FileTypeEnum
{
FILE_TYPE_ZIP
(
"application/zip"
,
".zip"
),
FILE_TYPE_RAR
(
"application/octet-stream"
,
".rar"
);
public
String
type
;
public
String
fileStufix
;
public
static
String
getFileStufix
(
String
type
)
{
for
(
FileTypeEnum
orderTypeEnum
:
FileTypeEnum
.
values
())
{
if
(
orderTypeEnum
.
type
.
equals
(
type
))
{
return
orderTypeEnum
.
fileStufix
;
}
}
return
null
;
}
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/utils/UnPackeUtil.java
0 → 100644
View file @
27587260
package
com
.
xxfc
.
platform
.
universal
.
utils
;
import
com.github.junrar.Archive
;
import
com.github.junrar.rarfile.FileHeader
;
import
lombok.extern.slf4j.Slf4j
;
import
net.lingala.zip4j.core.ZipFile
;
import
java.io.*
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipInputStream
;
/**
* 解压rar/zip工具类
*/
@Slf4j
public
class
UnPackeUtil
{
/**
* zip文件解压
*
* @param destPath 解压文件路径
* @param zipFile 压缩文件
* @param password 解压密码(如果有)
*/
public
static
void
unPackZip
(
File
zipFile
,
String
password
,
String
destPath
)
{
try
{
ZipFile
zip
=
new
ZipFile
(
zipFile
);
/*zip4j默认用GBK编码去解压,这里设置编码为GBK的*/
zip
.
setFileNameCharset
(
"GBK"
);
log
.
info
(
"begin unpack zip file...."
);
zip
.
extractAll
(
destPath
);
// 如果解压需要密码
if
(
zip
.
isEncrypted
())
{
zip
.
setPassword
(
password
);
}
}
catch
(
Exception
e
)
{
log
.
error
(
"unPack zip file to "
+
destPath
+
" fail ...."
,
e
.
getMessage
(),
e
);
}
}
/**
* rar文件解压(不支持有密码的压缩包)
*
* @param rarFile rar压缩包
* @param destPath 解压保存路径
*/
public
static
void
unPackRar
(
File
rarFile
,
String
destPath
)
{
try
(
Archive
archive
=
new
Archive
(
rarFile
))
{
if
(
null
!=
archive
)
{
FileHeader
fileHeader
=
archive
.
nextFileHeader
();
File
file
=
null
;
while
(
null
!=
fileHeader
)
{
// 防止文件名中文乱码问题的处理
String
fileName
=
fileHeader
.
getFileNameW
().
isEmpty
()
?
fileHeader
.
getFileNameString
()
:
fileHeader
.
getFileNameW
();
if
(
fileHeader
.
isDirectory
())
{
//是文件夹
file
=
new
File
(
destPath
+
File
.
separator
+
fileName
);
file
.
mkdirs
();
}
else
{
//不是文件夹
file
=
new
File
(
destPath
+
File
.
separator
+
fileName
.
trim
());
if
(!
file
.
exists
())
{
if
(!
file
.
getParentFile
().
exists
())
{
// 相对路径可能多级,可能需要创建父目录.
file
.
getParentFile
().
mkdirs
();
}
file
.
createNewFile
();
}
FileOutputStream
os
=
new
FileOutputStream
(
file
);
archive
.
extractFile
(
fileHeader
,
os
);
os
.
close
();
}
fileHeader
=
archive
.
nextFileHeader
();
}
}
}
catch
(
Exception
e
)
{
log
.
error
(
"unpack rar file fail...."
,
e
.
getMessage
(),
e
);
}
}
}
\ No newline at end of file
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/config/CommonConfig.java
View file @
27587260
...
...
@@ -13,9 +13,9 @@ public class CommonConfig {
public
MultipartConfigElement
multipartConfigElement
()
{
MultipartConfigFactory
factory
=
new
MultipartConfigFactory
();
// 单个数据大小
factory
.
setMaxFileSize
(
"10240KB"
);
// KB,MB
factory
.
setMaxFileSize
(
"10240
0
KB"
);
// KB,MB
/// 总上传数据大小
factory
.
setMaxRequestSize
(
"
1
02400KB"
);
factory
.
setMaxRequestSize
(
"
5
02400KB"
);
return
factory
.
createMultipartConfig
();
}
}
\ No newline at end of file
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/UploadController.java
View file @
27587260
...
...
@@ -2,9 +2,11 @@ package com.xxfc.platform.universal.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreUserToken
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.universal.dto.ImgDTO
;
import
com.xxfc.platform.universal.dto.UploadImgDTO
;
import
com.xxfc.platform.universal.service.FileUploadService
;
import
com.xxfc.platform.universal.service.UploadService
;
import
com.xxfc.platform.universal.utils.ImgBase64Util
;
import
com.xxfc.platform.universal.utils.PublicMsg
;
...
...
@@ -38,6 +40,8 @@ public class UploadController{
@Autowired
UploadService
uploadService
;
@Autowired
FileUploadService
fileUploadService
;
private
static
Integer
MAX_DRIVING_LICENSE_SIZE
=
10
*
1024
*
1024
;
//10M
...
...
@@ -158,5 +162,12 @@ public class UploadController{
ueditor
.
setTitle
(
upfile
.
getOriginalFilename
());
return
ueditor
;
}
@RequestMapping
(
value
=
"/app/unauth/zip"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
zip
(
@RequestParam
(
"file"
)
MultipartFile
upfile
,
@RequestParam
(
value
=
"prefix"
,
defaultValue
=
"renovate"
)
String
prefix
)
throws
Exception
{
return
fileUploadService
.
handlerUpload
(
upfile
,
null
,
prefix
);
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/FileUploadService.java
0 → 100644
View file @
27587260
package
com
.
xxfc
.
platform
.
universal
.
service
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
org.springframework.web.multipart.MultipartFile
;
public
interface
FileUploadService
{
public
ObjectRestResponse
handlerUpload
(
MultipartFile
zipFile
,
String
password
,
String
prefix
)
throws
Exception
;
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/UploadService.java
View file @
27587260
...
...
@@ -23,7 +23,7 @@ import java.util.UUID;
import
java.util.concurrent.TimeUnit
;
@Service
public
class
UploadService
{
public
class
UploadService
{
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
@Value
(
"${universal.baseUploadPath}"
)
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/impl/FileUploadServiceImpl.java
0 → 100644
View file @
27587260
package
com
.
xxfc
.
platform
.
universal
.
service
.
impl
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.universal.constant.enumerate.FileTypeEnum
;
import
com.xxfc.platform.universal.service.FileUploadService
;
import
com.xxfc.platform.universal.utils.UnPackeUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.*
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipFile
;
import
java.util.zip.ZipInputStream
;
@Service
@Slf4j
public
class
FileUploadServiceImpl
implements
FileUploadService
{
@Value
(
"${universal.uploadPath}"
)
private
String
uploadPath
;
@Value
(
"${universal.url}"
)
private
String
xx_url
;
@Override
public
ObjectRestResponse
handlerUpload
(
MultipartFile
zipFile
,
String
password
,
String
prefix
)
throws
Exception
{
if
(
null
==
zipFile
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"请上传压缩文件!"
);
}
boolean
isZipPack
=
true
;
String
fileContentType
=
zipFile
.
getContentType
();
//将压缩包保存在指定路径
String
packFilePath
=
uploadPath
+
File
.
separator
+
zipFile
.
getName
();
if
(
FileTypeEnum
.
FILE_TYPE_ZIP
.
type
.
equals
(
fileContentType
))
{
//zip解压缩处理
packFilePath
+=
FileTypeEnum
.
FILE_TYPE_ZIP
.
fileStufix
;
}
else
if
(
FileTypeEnum
.
FILE_TYPE_RAR
.
type
.
equals
(
fileContentType
))
{
//rar解压缩处理
packFilePath
+=
FileTypeEnum
.
FILE_TYPE_RAR
.
fileStufix
;
isZipPack
=
false
;
}
else
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"上传的压缩包格式不正确,仅支持rar和zip压缩文件!"
);
}
File
file
=
new
File
(
packFilePath
);
try
{
zipFile
.
transferTo
(
file
);
}
catch
(
IOException
e
)
{
log
.
error
(
"zip file save to "
+
uploadPath
+
" error"
,
e
.
getMessage
(),
e
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"保存压缩文件到:"
+
uploadPath
+
" 失败!"
);
}
if
(
isZipPack
)
{
//zip压缩包
UnPackeUtil
.
unPackZip
(
file
,
password
,
uploadPath
);
}
else
{
//rar压缩包
UnPackeUtil
.
unPackRar
(
file
,
uploadPath
);
}
String
path
=
readZipFile
(
packFilePath
);
if
(
StringUtils
.
isNotBlank
(
path
)){
path
=
xx_url
+
"/"
+
prefix
+
"/"
+
path
;
return
ObjectRestResponse
.
succ
(
path
);
}
else
{
return
ObjectRestResponse
.
createDefaultFail
();
}
}
public
static
String
readZipFile
(
String
file
)
throws
Exception
{
ZipFile
zf
=
new
ZipFile
(
file
);
InputStream
in
=
new
BufferedInputStream
(
new
FileInputStream
(
file
));
ZipInputStream
zin
=
new
ZipInputStream
(
in
);
ZipEntry
ze
;
String
path
=
null
;
while
((
ze
=
zin
.
getNextEntry
())
!=
null
)
{
if
(
ze
.
isDirectory
())
{
}
else
{
path
=
ze
.
getName
();
}
}
zin
.
closeEntry
();
return
path
;
}
}
xx-universal/xx-universal-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<
pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<
Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
xx-vehicle/xx-vehicle-server/src/main/resources/logback.xml
View file @
27587260
...
...
@@ -25,7 +25,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
@@ -36,7 +36,7 @@
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</p
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<Pattern>
${CONSOLE_LOG_PATTERN}
</P
attern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
</encoder>
</appender>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment