'pageadd'

This commit is contained in:
joshen@zcwytd.com
2023-06-07 23:10:14 +08:00
parent f6176078ae
commit f9685a9094
1186 changed files with 129272 additions and 0 deletions

162
servers/modify-user/pom.xml Normal file
View File

@@ -0,0 +1,162 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.xboe</groupId>
<artifactId>modify-user</artifactId>
<version>2.0.0</version>
<name>modify-user</name>
<description>整理用户的数据问题</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>com.xboe</groupId>
<artifactId>xboe-core</artifactId>
<version>1.0.0</version>
</dependency>
<!-- java-jwt -->
<dependency>
<groupId>com.auth0</groupId>
<artifactId>java-jwt</artifactId>
<version>3.18.3</version>
</dependency>
<!--
<dependency>
<groupId>org.bitbucket.b_c</groupId>
<artifactId>jose4j</artifactId>
<version>0.7.9</version>
</dependency>
-->
<!-- apache commons -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-actuator</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.27</version>
<!-- <scope>runtime</scope> -->
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!--加密配置文件-->
<dependency>
<groupId>com.github.ulisesbocchio</groupId>
<artifactId>jasypt-spring-boot-starter</artifactId>
<version>3.0.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<filtering>true</filtering>
<directory>src/main/resources</directory>
<includes>
<include>application-${profileActive}.properties</include>
<include>application.properties</include>
</includes>
</resource>
<resource>
<filtering>false</filtering>
<directory>src/main/resources</directory>
<excludes>
<exclude>*.properties</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
<includeSystemScope>true</includeSystemScope>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>pro</id>
<properties>
<profileActive>pro</profileActive>
</properties>
</profile>
<profile>
<id>pre</id>
<properties>
<profileActive>pre</profileActive>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<profileActive>test</profileActive>
</properties>
</profile>
<profile>
<id>dev</id>
<properties>
<profileActive>dev</profileActive>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,15 @@
package com.xboe;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
@Configuration
@SpringBootApplication
public class BoeBasicApplication {
public static void main(String[] args) {
System.setProperty("jasypt.encryptor.password","jasypt");
SpringApplication.run(BoeBasicApplication.class, args);
}
}

View File

@@ -0,0 +1,38 @@
package com.xboe;
import java.io.IOException;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializerProvider;
/**
* 返回的数据中如果是null 就会转化成空字符串
*
*/
@Configuration
public class ResultNullToEmptyConfig {
@Bean
@Primary
@ConditionalOnMissingBean(ObjectMapper.class)
public ObjectMapper jacksonObjectMapper(Jackson2ObjectMapperBuilder builder) {
ObjectMapper objectMapper = builder.createXmlMapper(false).build();
objectMapper.getSerializerProvider().setNullValueSerializer(new JsonSerializer<Object>() {
@Override
public void serialize(Object o, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
throws IOException, JsonProcessingException {
jsonGenerator.writeString("");
}
});
return objectMapper;
}
}

View File

@@ -0,0 +1,38 @@
package com.xboe;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import com.xboe.basic.service.IModifyService;
import lombok.extern.slf4j.Slf4j;
/**
* 启动执行一次
* @author seastar
*
*/
@Slf4j
@Component
public class StartRunner implements ApplicationRunner {
@Autowired
IModifyService service;
@Override
public void run(ApplicationArguments args) throws Exception {
//用于存放 kid=newId
try {
//本地 971783273423056896971783831047385088
} catch (Exception e) {
log.error("执行失败",e);
e.printStackTrace();
}
System.exit(0);
}
}

View File

@@ -0,0 +1,20 @@
package com.xboe.basic.api;
import com.xboe.core.JsonResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/modify/user")
public class ModifyApi {
/**
* 单独的更新一个用户的接口
* */
@GetMapping("/byid")
public JsonResponse<Boolean> modifyUser(String id){
return null;
}
}

View File

@@ -0,0 +1,11 @@
package com.xboe.basic.dao;
import org.springframework.stereotype.Repository;
import com.xboe.basic.entity.Account;
import com.xboe.core.orm.BaseDao;
@Repository
public class AccountDao extends BaseDao<Account>{
}

View File

@@ -0,0 +1,11 @@
package com.xboe.basic.dao;
import org.springframework.stereotype.Repository;
import com.xboe.basic.entity.Teacher;
import com.xboe.core.orm.BaseDao;
@Repository
public class TeacherDao extends BaseDao<Teacher>{
}

View File

@@ -0,0 +1,11 @@
package com.xboe.basic.dao;
import org.springframework.stereotype.Repository;
import com.xboe.basic.entity.User;
import com.xboe.core.orm.BaseDao;
@Repository
public class UserDao extends BaseDao<User>{
}

View File

@@ -0,0 +1,9 @@
package com.xboe.basic.dao;
import com.xboe.basic.entity.UserRemoveLog;
import com.xboe.core.orm.BaseDao;
import org.springframework.stereotype.Repository;
@Repository
public class UserRemoveLogDao extends BaseDao<UserRemoveLog> {
}

View File

@@ -0,0 +1,57 @@
package com.xboe.basic.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.xboe.core.SysConstant;
import com.xboe.core.orm.IdEntity;
import com.xboe.core.orm.annotation.MetaInfo;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 账号表,只是记录登录的账号信息,无任务业务实名类的信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = SysConstant.TABLE_PRE + "account")
public class Account extends IdEntity{
private static final long serialVersionUID = 1L;
/**0 临时数据*/
public static final int STATUS_TEMPORARY=0;
/**1 正常数据*/
public static final int STATUS_NORMAL=1;
/**2 停用数据*/
public static final int STATUS_DEAD=2;
@MetaInfo("原系统中的id")
@Column(name = "sys_id", length = 36)
private String sysId;
@MetaInfo("登录名")
@Column(name = "login_name", nullable = true, length = 30)
private String loginName;
@MetaInfo("用户头像地址")
@Column(name = "avatar", nullable = true, length = 100)
private String avatar;
@MetaInfo("手机号")
@Column(name = "mobile", length = 11)
private String mobile;
// 状态1, 正常2停用
@Column(name = "status", length = 1)
private Integer status;
@Column(name = "deleted", length = 1)
private Boolean deleted;
}

View File

@@ -0,0 +1,41 @@
package com.xboe.basic.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.xboe.core.SysConstant;
import com.xboe.core.orm.IdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = SysConstant.TABLE_PRE + "teacher")
public class Teacher extends IdEntity {
private static final long serialVersionUID = 1L;
/**
* 系统id
*/
@Column(name = "sys_id", length = 36)
private String sysId;
/**
* 在职状态 在职: 0 离职: 1
*/
@Column(name = "wait_status")
private Integer waitStatus;
/**状态,0表临时 1表启用2表停用的*/
@Column(name = "status",length = 1)
private Integer status;
}

View File

@@ -0,0 +1,77 @@
package com.xboe.basic.entity;
import java.time.LocalDateTime;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xboe.core.SysConstant;
import com.xboe.core.orm.IdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 用户信息表
* 存储所有的用户信息,原表中的部分信息
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = SysConstant.TABLE_PRE + "user")
public class User extends IdEntity {
private static final long serialVersionUID = 1L;
/**
* 旧系统id
*/
@Column(name = "sys_id", length = 36)
private String sysId;
/**
* 旧系统机构id
*/
@Column(name = "sys_depart_id", length = 36)
private String sysDepartId;
/**
* 姓名
*/
@Column(name = "name", length = 30)
private String name;
/**
* 员工编号
*/
@Column(name = "user_no", length = 30)
private String userNo;
/**
* 用户类型1表学员2表教师3表管理员
* 该字段暂用于表示是否前台管理员
*/
@Column(name = "user_type", length = 1)
private Integer userType;
/**
* 学习总时长
*/
@Column(name = "study_total", length = 11)
private Integer studyTotal;
/**
* boe的时长和系统时长单独保存
*/
@Column(name = "learning_Duration", length = 11)
private Integer learningDuration;
/**
* 最近一次登录时间
*/
@Column(name = "last_login_at")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime lastLoginAt;
}

View File

@@ -0,0 +1,59 @@
package com.xboe.basic.entity;
import com.xboe.core.SysConstant;
import com.xboe.core.orm.IdEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
* 删除记录表
* 1.对于已删除的记录做个备份 以防删除错误数据丢失
* 2.对于未删除的记录,做一个说明
* */
@Data
@EqualsAndHashCode(callSuper = false)
@Entity
@Table(name = SysConstant.TABLE_PRE + "user_remove_log")
public class UserRemoveLog extends IdEntity {
/**
* 用户id
* */
@Column(name = "user_id")
private String userId;
/**
* 用户的sysId
* */
@Column(name = "sys_id")
private String sysId;
/**
* 已删除的为true
* 未删除的为false
* */
@Column(name = "removed")
private Boolean removed;
/**
* 未删除的原因
* */
@Column(name = "message")
private String message;
public UserRemoveLog() {
}
public UserRemoveLog(String userId, String sysId, Boolean removed, String message) {
this.userId = userId;
this.sysId = sysId;
this.removed = removed;
this.message = message;
}
}

View File

@@ -0,0 +1,38 @@
package com.xboe.basic.service;
import com.xboe.basic.entity.Account;
import com.xboe.basic.entity.User;
import java.util.List;
import java.util.Map;
public interface IModifyService {
/**
* 1.取出重复的数据
* */
List<Object[]> get();
/**
* 2.取出之后查出 老师身份的用户是不能删的,sysId不同工号相同的不能删 待确认
* 无关联的用户或者少关联的用户,少关联的用户的数据记录下来,移到多的中
* */
Map<String,List<String>> find(List<Object[]> list);
/**
* 在删除前记录下来删除的用户,以防多删误删
* */
void saveUserRemove(List<User> userList);
/**
* 标记删除和删除用户信息
* */
void remove(List<User> user, List<Account> accounts);
}

View File

@@ -0,0 +1,134 @@
package com.xboe.basic.service.impl;
import com.xboe.basic.dao.AccountDao;
import com.xboe.basic.dao.TeacherDao;
import com.xboe.basic.dao.UserDao;
import com.xboe.basic.dao.UserRemoveLogDao;
import com.xboe.basic.entity.Account;
import com.xboe.basic.entity.Teacher;
import com.xboe.basic.entity.User;
import com.xboe.basic.entity.UserRemoveLog;
import com.xboe.core.orm.FieldFilters;
import com.xboe.core.orm.QueryBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xboe.basic.service.IModifyService;
import org.springframework.transaction.annotation.Transactional;
import java.sql.Array;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
* */
@Service
@Transactional
public class ModifyServiceImpl implements IModifyService {
@Autowired
UserDao userDao;
@Autowired
AccountDao accountDao;
@Autowired
TeacherDao teacherDao;
@Autowired
UserRemoveLogDao removeLogDao;
/**
* 1.取出重复的数据
*
* */
@Override
public List<Object[]> get() {
//查出用户所有重复的数据只能采用sql查询
String sql="select id,user_no,sys_id from boe_user where user_no in(select user_no from boe_user group by user_no having count(user_no)>1)";
List<Object[]> list = userDao.sqlFindList(sql);
return list;
}
/**
* 2.取出之后查出 老师身份的用户是不能删的, 待确认 sysId不同工号相同的不能删
* 无关联的用户或者少关联的用户,少关联的用户的数据记录下来,移到多的中
* */
@Override
public Map<String,List<String>> find(List<Object[]> list) {
//过滤掉已经是教师的,sysId不同的,同时记录下来
// List<String> notDeleteIds = new ArrayList<>();
Map<String, List<String>> map = new HashMap<>();
//要删除的
List<String> deleteIds=new ArrayList<>();
//同时记录日志 要删的和不删的同时记录
List<UserRemoveLog> userRemoveLogs = new ArrayList<>();
//sysId不同工号相同的不能删
for (Object[] o:list) {
for (Object[] o1:list) {
if(o[1].equals(o1[1])){
if(!o[2].equals(o1[2])){
// notDeleteIds.add((String) o[0]);
// notDeleteIds.add((String) o1[0]);
this.log(o[0].toString(),o[2].toString(),false,"同工号sysId不同不能删除");
this.log(o1[0].toString(),o1[2].toString(),false,"同工号sysId不同不能删除");
}
}
}
}
//教师
List<Teacher> teacherList = teacherDao.getAll();
for (Teacher t:teacherList) {
for (Object[] o:list) {
if(t.getId().equals(o[0])){
// notDeleteIds.add((String) o[0]);
this.log(o[0].toString(),o[2].toString(),false,"该id已是教师身份,不能删除");
}
}
}
return map;
}
/**
*日志记录
* */
private UserRemoveLog log(String userId,String sysId,Boolean removed,String message){
UserRemoveLog userRemoveLog = new UserRemoveLog(userId,sysId,removed,message);
return userRemoveLog;
}
/**
* 在删除前记录下来删除的用户,以防多删误删
* */
@Override
public void saveUserRemove(List<User> userList) {
}
/**
* 标记删除和删除用户信息
* */
@Override
public void remove(List<User> user, List<Account> accounts) {
}
/**
* 查询
*
*/
}

View File

@@ -0,0 +1,23 @@
# datasource config
# basic数据库
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
# 当前数据库 basic 对应的数据库
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=root
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# 设置logback.xml位置
logging.config=classpath:log/logback-dev.xml
#加密盐
#jasypt.encryptor.password=jasypt
jasypt.encryptor.algorithm=PBEWithMD5AndDES
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator

View File

@@ -0,0 +1,23 @@
# datasource config
# basic数据库
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
# 当前数据库 basic 对应的数据库
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=root
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# 设置logback.xml位置
logging.config=classpath:log/logback-dev.xml
#加密盐
#jasypt.encryptor.password=jasypt
jasypt.encryptor.algorithm=PBEWithMD5AndDES
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator

View File

@@ -0,0 +1,23 @@
# datasource config
# basic数据库
spring.jpa.hibernate.ddl-auto=none
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
# 当前数据库 basic 对应的数据库
spring.datasource.url=jdbc:mysql://10.251.129.126:3306/boe_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=admin
spring.datasource.password=boeRds01
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# 设置logback.xml位置
logging.config=classpath:log/logback-dev.xml
#加密盐
#jasypt.encryptor.password=jasypt
jasypt.encryptor.algorithm=PBEWithMD5AndDES
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator

View File

@@ -0,0 +1,23 @@
# datasource config
# basic数据库
spring.jpa.hibernate.ddl-auto=update
spring.jpa.open-in-view=false
spring.jpa.properties.hibernate.enable_lazy_load_no_trans=true
spring.datasource.driverClassName=com.mysql.jdbc.Driver
# spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
# 当前数据库 basic 对应的数据库
spring.datasource.url=jdbc:mysql://127.0.0.1:3306/boeu_base?useSSL=false&useUnicode=true&characterEncoding=UTF8&zeroDateTimeBehavior=convertToNull
spring.datasource.username=root
spring.datasource.password=ENC(lAoFOYuc8CAypPtigTNLYg==)
logging.level.org.hibernate.SQL=DEBUG
logging.level.org.hibernate.type.descriptor.sql.BasicBinder=TRACE
# 设置logback.xml位置
logging.config=classpath:log/logback-dev.xml
#加密盐
#jasypt.encryptor.password=jasypt
jasypt.encryptor.algorithm=PBEWithMD5AndDES
jasypt.encryptor.iv-generator-classname=org.jasypt.iv.NoIvGenerator

View File

@@ -0,0 +1,52 @@
spring.profiles.active=@profileActive@
spring.application.name=boe-server-modify
server.port=9196
server.servlet.session.timeout=30m
server.servlet.encoding.charset=UTF-8
server.servlet.encoding.enabled=true
server.servlet.encoding.force=true
server.tomcat.uri-encoding=UTF-8
#spring.jackson.locale=
#spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
# spring.jackson.default-property-inclusion=NON_NULL
spring.jackson.time-zone=GMT+8
spring.servlet.multipart.max-file-size=1024MB
spring.servlet.multipart.max-request-size=1024MB
## 静态文件目录默认是在static下面以后独立到nginx下面配置
spring.mvc.static-path-pattern=/cdn/**
spring.redis.lettuce.pool.max-active=8
spring.redis.lettuce.pool.min-idle=0
spring.redis.lettuce.pool.max-idle=30
spring.redis.lettuce.pool.max-wait=10000ms
spring.redis.lettuce.shutdown-timeout=100ms
# 上传的临时目录,部署到服务器必须指定
# spring.servlet.multipart.location=
# jpa config
spring.jpa.database = MYSQL
spring.jpa.show-sql = true
# spring.jpa.properties.hibernate.cache.use_second_level_cache=true
# spring.jpa.properties.hibernate.cache.region.factory_class=org.hibernate.cache.ehcache.EhCacheRegionFactory
spring.jpa.properties.hibernate.naming_strategy=org.hibernate.cfg.EJB3NamingStrategy
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.jpa.database-platform=org.hibernate.dialect.MySQL5InnoDBDialect
#spring.transaction
# spring.jpa.properties.hibernate.allow_update_outside_transaction=true
# spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext
# 设置logback.xml位置
logging.config=classpath:log/logback-@profileActive@.xml

View File

@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<property name="log.path" value="logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){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"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="console"/>
</root>
</configuration>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<property name="log.path" value="/home/logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){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"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="WARN">
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</configuration>

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="false" scan="false">
<springProperty scop="context" name="spring.application.name" source="spring.application.name" defaultValue=""/>
<property name="log.path" value="logs/${spring.application.name}"/>
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN"
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){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"/>
<!-- Console log output -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<!-- Log file debug output -->
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/debug.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
</appender>
<!-- Log file error output -->
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<maxHistory>30</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
<root level="INFO">
<appender-ref ref="debug"/>
<appender-ref ref="error"/>
</root>
</configuration>