Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Kwan的解忧杂货铺@新空间代码工作室
SpringBoot-kwan
提交
b3a4f08f
S
SpringBoot-kwan
项目概览
Kwan的解忧杂货铺@新空间代码工作室
/
SpringBoot-kwan
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot-kwan
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
b3a4f08f
编写于
7月 15, 2023
作者:
Kwan的解忧杂货铺@新空间代码工作室
🐭
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix:修改日志
上级
73cca3e4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
51 addition
and
132 deletion
+51
-132
src/main/java/com/kwan/springbootkwan/config/MyInterceptor.java
...in/java/com/kwan/springbootkwan/config/MyInterceptor.java
+5
-3
src/main/java/com/kwan/springbootkwan/config/RedisConfig.java
...main/java/com/kwan/springbootkwan/config/RedisConfig.java
+3
-1
src/main/java/com/kwan/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java
...an/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java
+13
-71
src/main/resources/application.yaml
src/main/resources/application.yaml
+3
-1
src/main/resources/logback-spring.xml
src/main/resources/logback-spring.xml
+27
-56
未找到文件。
src/main/java/com/kwan/springbootkwan/config/MyInterceptor.java
浏览文件 @
b3a4f08f
package
com.kwan.springbootkwan.config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.servlet.HandlerInterceptor
;
import
org.springframework.web.servlet.ModelAndView
;
...
...
@@ -13,21 +14,22 @@ import javax.servlet.http.HttpServletResponse;
* @version : 2.2.0
* @date : 2022/12/19 16:14
*/
@Slf4j
public
class
MyInterceptor
implements
HandlerInterceptor
{
@Override
public
boolean
preHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
)
throws
Exception
{
System
.
out
.
println
(
"MyInterceptor>>>>>>>>>preHandle"
);
log
.
info
(
"MyInterceptor>>>>>>>>>preHandle"
);
return
true
;
}
@Override
public
void
postHandle
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
ModelAndView
modelAndView
)
throws
Exception
{
System
.
out
.
println
(
"MyInterceptor>>>>>>>>>postHandle"
);
log
.
info
(
"MyInterceptor>>>>>>>>>postHandle"
);
}
@Override
public
void
afterCompletion
(
HttpServletRequest
request
,
HttpServletResponse
response
,
Object
handler
,
Exception
ex
)
throws
Exception
{
System
.
out
.
println
(
"MyInterceptor>>>>>>>>>afterCompletion"
);
log
.
info
(
"MyInterceptor>>>>>>>>>afterCompletion"
);
}
}
src/main/java/com/kwan/springbootkwan/config/RedisConfig.java
浏览文件 @
b3a4f08f
...
...
@@ -3,6 +3,7 @@ package com.kwan.springbootkwan.config;
import
com.fasterxml.jackson.annotation.JsonAutoDetect
;
import
com.fasterxml.jackson.annotation.PropertyAccessor
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
...
...
@@ -10,13 +11,14 @@ import org.springframework.data.redis.core.RedisTemplate;
import
org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
@Slf4j
@Configuration
public
class
RedisConfig
{
@Bean
@SuppressWarnings
(
"all"
)
public
RedisTemplate
<
String
,
Object
>
redisTemplate
(
RedisConnectionFactory
factory
)
{
System
.
out
.
println
(
"==================自定义的redisTemplate实例化了==================="
);
log
.
info
(
"==================自定义的redisTemplate实例化了==================="
);
RedisTemplate
<
String
,
Object
>
template
=
new
RedisTemplate
<
String
,
Object
>();
template
.
setConnectionFactory
(
factory
);
Jackson2JsonRedisSerializer
jackson2JsonRedisSerializer
=
new
Jackson2JsonRedisSerializer
(
Object
.
class
);
...
...
src/main/java/com/kwan/springbootkwan/entity/AdsDimFinancialYearWeekInfo.java
浏览文件 @
b3a4f08f
package
com.kwan.springbootkwan.entity
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.util.Date
;
@TableName
(
value
=
"ads_dim_financial_year_week_info"
)
@Data
@ApiModel
(
value
=
"财年周"
)
public
class
AdsDimFinancialYearWeekInfo
extends
Model
<
AdsDimFinancialYearWeekInfo
>
{
//财年
@TableId
@ApiModelProperty
(
value
=
"财年"
)
private
Integer
financialYear
;
//第n财年周
@ApiModelProperty
(
value
=
"第n财年周"
)
private
Integer
financialYearWeek
;
//财年开始日期
@ApiModelProperty
(
value
=
"财年开始日期"
)
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
private
Date
financialYearStart
;
//财年结束日期
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
value
=
"财年结束日期"
)
private
Date
financialYearEnd
;
//周开始
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
value
=
"周开始"
)
private
Date
weekStartDay
;
//周结束
@JsonFormat
(
shape
=
JsonFormat
.
Shape
.
STRING
,
pattern
=
"yyyy-MM-dd"
,
timezone
=
"GMT+8"
)
@ApiModelProperty
(
value
=
"周结束"
)
private
Date
weekEndDay
;
//财年周所在季节区间,0:跨9月1号,1:3月到8月,2:9月到2月
@ApiModelProperty
(
value
=
"财年周所在季节区间,0:跨9月1号,1:3月到8月,2:9月到2月 "
)
private
Integer
weekInSeason
;
public
Integer
getFinancialYear
()
{
return
financialYear
;
}
public
void
setFinancialYear
(
Integer
financialYear
)
{
this
.
financialYear
=
financialYear
;
}
public
Integer
getFinancialYearWeek
()
{
return
financialYearWeek
;
}
public
void
setFinancialYearWeek
(
Integer
financialYearWeek
)
{
this
.
financialYearWeek
=
financialYearWeek
;
}
public
Date
getFinancialYearStart
()
{
return
financialYearStart
;
}
public
void
setFinancialYearStart
(
Date
financialYearStart
)
{
this
.
financialYearStart
=
financialYearStart
;
}
public
Date
getFinancialYearEnd
()
{
return
financialYearEnd
;
}
public
void
setFinancialYearEnd
(
Date
financialYearEnd
)
{
this
.
financialYearEnd
=
financialYearEnd
;
}
public
Date
getWeekStartDay
()
{
return
weekStartDay
;
}
public
void
setWeekStartDay
(
Date
weekStartDay
)
{
this
.
weekStartDay
=
weekStartDay
;
}
public
Date
getWeekEndDay
()
{
return
weekEndDay
;
}
public
void
setWeekEndDay
(
Date
weekEndDay
)
{
this
.
weekEndDay
=
weekEndDay
;
}
public
Integer
getWeekInSeason
()
{
return
weekInSeason
;
}
public
void
setWeekInSeason
(
Integer
weekInSeason
)
{
this
.
weekInSeason
=
weekInSeason
;
}
}
}
\ No newline at end of file
src/main/resources/application.yaml
浏览文件 @
b3a4f08f
...
...
@@ -59,13 +59,15 @@ spring:
# url: jdbc:mysql://localhost:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
url
:
jdbc:mysql://120.79.36.53:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username
:
root
# password: 716288qwe
# password: 716288qwe
password
:
15671628341Qwe.
ali-ds
:
driver-class-name
:
com.mysql.cj.jdbc.Driver
url
:
jdbc:mysql://120.79.36.53:3306/kwan?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai
username
:
root
password
:
15671628341Qwe.
seata
:
tx-service-group
:
default_tx_group
#seata:
...
...
src/main/resources/logback-spring.xml
浏览文件 @
b3a4f08f
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"true"
>
<configuration>
<property
name=
"log.charset"
value=
"utf-8"
/>
<property
name=
"console.log.pattern"
value=
"%red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %blue(%msg%n)"
/>
<property
name=
"file.log.pattern"
value=
"%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n"
/>
<!-- 此xml在spring-boot-1.5.3.RELEASE.jar里 -->
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<!--控制台打印日志,不需要配置appender了-->
<include
resource=
"org/springframework/boot/logging/logback/console-appender.xml"
/>
<!-- 开启后可以通过jmx动态控制日志级别(springboot Admin的功能) -->
<!--<jmxConfigurator/>-->
<!--总日志-->
<appender
name=
"ALL-FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!--日志存放路径-->
<file>
../logs/springboot-mybatis.log
</file>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<!-- pattern节点,用来设置日志的输入格式 -->
<pattern>
%date [%level] [%thread] %logger{60} [%file : %line] %msg%n
</pattern>
<!--文件编码格式-->
<charset>
UTF-8
</charset>
<pattern>
${console.log.pattern}
</pattern>
<charset>
${log.charset}
</charset>
</encoder>
<!-- 滚动策略 -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 添加.gz 历史日志会启用压缩 大大缩小日志文件所占空间 -->
<fileNamePattern>
../logs/springboot-mybatis.log.%d{yyyy-MM-dd}.log
</fileNamePattern>
<!-- 保留30天日志 -->
<maxHistory>
30
</maxHistory>
<!--文件最大存储-->
<totalSizeCap>
10GB
</totalSizeCap>
</rollingPolicy>
</appender>
<!--错误日志-->
<appender
name=
"ERROR-FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!--日志存放路径-->
<file>
../logs/error.log
</file>
<encoder>
<pattern>
%date [%level] [%thread] %logger{60} [%file : %line] %msg%n
</pattern>
<!--文件编码格式-->
<charset>
UTF-8
</charset>
</encoder>
<!-- 滚动策略 -->
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 添加.gz 历史日志会启用压缩 大大缩小日志文件所占空间 -->
<fileNamePattern>
../logs/error.%d{yyyy-MM-dd}.log
</fileNamePattern>
<!-- 保留30天日志 -->
<appender
name=
"ROLLING"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
logs/SpringBoot-kwan.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"
>
<fileNamePattern>
logs/SpringBoot-kwan-%d{yyyy-MM-dd}.%i.log
</fileNamePattern>
<maxFileSize>
128MB
</maxFileSize>
<maxHistory>
30
</maxHistory>
<!--文件最大存储-->
<totalSizeCap>
10GB
</totalSizeCap>
<totalSizeCap>
20GB
</totalSizeCap>
</rollingPolicy>
<!-- 过滤日志 -->
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<!-- 用于配置符合过滤条件的操作 -->
<onMatch>
ACCEPT
</onMatch>
<!-- 用于配置不符合过滤条件的操作 -->
<onMismatch>
DENY
</onMismatch>
</filter>
<encoder>
<pattern>
${file.log.pattern}
</pattern>
<charset>
${log.charset}
</charset>
</encoder>
</appender>
<logger
name=
"com.kwan.springbootkwan"
level=
"INFO"
/>
<logger
name=
"com.kwan.springbootkwan.mapper"
level=
"info"
additivity=
"false"
>
<appender-ref
ref=
"STDOUT"
/>
</logger>
<root
level=
"INFO"
>
<!--控制台打印日志-->
<appender-ref
ref=
"CONSOLE"
/>
<appender-ref
ref=
"ALL-FILE"
/>
<appender-ref
ref=
"ERROR-FILE"
/>
<root
level=
"info"
>
<appender-ref
ref=
"STDOUT"
/>
<appender-ref
ref=
"ROLLING"
/>
</root>
</configuration>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录