Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c700ddc90a | ||
|
|
4254bf47bf | ||
|
|
e0b1720c4a | ||
|
|
9cd7b069a8 | ||
|
|
0ca3d13659 | ||
|
|
0ac237fbbd | ||
|
|
d9da55d4bf | ||
|
|
802152badd | ||
|
|
7b4169f3e6 | ||
|
|
c3b3831378 | ||
|
|
73e6470b39 | ||
|
|
458d118d85 | ||
|
|
659deb6132 |
20
CHANGELOG.md
20
CHANGELOG.md
@@ -1,3 +1,21 @@
|
|||||||
|
## 1.0.7
|
||||||
|
|
||||||
|
## 新增
|
||||||
|
|
||||||
|
> feat(web): 增加uploadFileCustomize方法,允许自定义文件存放情况
|
||||||
|
> feat(database): 增加db/data目录,存放初始化数据的sql
|
||||||
|
|
||||||
|
## 优化
|
||||||
|
|
||||||
|
> perf(login): 增加默认值,防止token解析异常
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
|
||||||
|
### 新增
|
||||||
|
|
||||||
|
> 1,新增 **OperationIgnore** 注解,可以指定接口忽略操作日志的收集。
|
||||||
|
> 2,**OperationLog** 增加 desensitize 属性,用来脱敏指定的字段。
|
||||||
|
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
### 调整
|
### 调整
|
||||||
@@ -6,7 +24,7 @@
|
|||||||
> 2,增加过期备份的删除操作,默认过期时间为7天;
|
> 2,增加过期备份的删除操作,默认过期时间为7天;
|
||||||
> 3,调整阿里云短信类,方便扩展其他方法。
|
> 3,调整阿里云短信类,方便扩展其他方法。
|
||||||
> 4,消息发送接口该body类型为 **JSONObject**
|
> 4,消息发送接口该body类型为 **JSONObject**
|
||||||
> 5,调整消息发送接口和方法(不兼容旧版本)
|
> 5,调整消息发送接口和方法(不兼容旧版本)
|
||||||
|
|
||||||
## 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
|
|||||||
22
pom.xml
22
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -57,55 +57,55 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>com.tiesheng.springboot-plugin</groupId>
|
<groupId>com.tiesheng.springboot-plugin</groupId>
|
||||||
<artifactId>tiesheng-maven-plugin</artifactId>
|
<artifactId>tiesheng-maven-plugin</artifactId>
|
||||||
<version>0.0.5</version>
|
<version>0.0.6</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import cn.hutool.poi.excel.ExcelUtil;
|
|||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.read.listener.ReadListener;
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
|
import com.tiesheng.annotation.operation.OperationLog;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.core.service.CoreLogService;
|
import com.tiesheng.core.service.CoreLogService;
|
||||||
import com.tiesheng.core.service.CoreMessageService;
|
import com.tiesheng.core.service.CoreMessageService;
|
||||||
@@ -24,10 +25,10 @@ import com.tiesheng.util.config.Ip2regionConfig;
|
|||||||
import com.tiesheng.util.pojos.ApiResp;
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
import com.tiesheng.util.pojos.FileUploadPath;
|
import com.tiesheng.util.pojos.FileUploadPath;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -88,7 +89,7 @@ public class TestController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/send")
|
@GetMapping("/send")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public ApiResp<MessageReqResp> sendMessage() {
|
public ApiResp<MessageReqResp> sendMessage() {
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.tiesheng.annotation.operation;
|
||||||
|
|
||||||
|
import java.lang.annotation.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hao
|
||||||
|
*/
|
||||||
|
@Target(ElementType.METHOD)
|
||||||
|
@Documented
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface OperationIgnore {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -21,4 +21,12 @@ public @interface OperationLog {
|
|||||||
*/
|
*/
|
||||||
String insertKey() default "";
|
String insertKey() default "";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要脱敏的字段
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
String[] desensitize() default {};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
@@ -20,7 +20,8 @@ import java.util.List;
|
|||||||
public class DbMigrationConfig {
|
public class DbMigrationConfig {
|
||||||
|
|
||||||
private String table = "core_config_db";
|
private String table = "core_config_db";
|
||||||
private List<String> locations = CollUtil.newArrayList("classpath*:db/migration/*.sql");
|
private List<String> migrations = CollUtil.newArrayList("classpath*:db/migration/*.sql");
|
||||||
|
private List<String> datas = CollUtil.newArrayList("classpath*:db/data/*.sql");
|
||||||
private String ignoreSqls = "drop table,delete from";
|
private String ignoreSqls = "drop table,delete from";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,12 +58,20 @@ public class DbMigrationConfig {
|
|||||||
this.table = table;
|
this.table = table;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getLocations() {
|
public List<String> getMigrations() {
|
||||||
return locations;
|
return migrations;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLocations(List<String> locations) {
|
public void setMigrations(List<String> migrations) {
|
||||||
this.locations = locations;
|
this.migrations = migrations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getDatas() {
|
||||||
|
return datas;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDatas(List<String> datas) {
|
||||||
|
this.datas = datas;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIgnoreSqls() {
|
public String getIgnoreSqls() {
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.db.Db;
|
import cn.hutool.db.Db;
|
||||||
import cn.hutool.db.Entity;
|
import cn.hutool.db.Entity;
|
||||||
import cn.hutool.log.LogFactory;
|
|
||||||
import com.tiesheng.database.config.DbMigrationConfig;
|
import com.tiesheng.database.config.DbMigrationConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||||
@@ -38,17 +37,24 @@ public class DbMigrationInitializer implements ServletContextInitializer {
|
|||||||
DataSource dataSource;
|
DataSource dataSource;
|
||||||
@Autowired
|
@Autowired
|
||||||
DbMigrationConfig dbMigrationConfig;
|
DbMigrationConfig dbMigrationConfig;
|
||||||
@Autowired(required = false)
|
@Autowired
|
||||||
List<DbDataInitializer> dbDataInitializerList;
|
List<DbDataInitializer> dbDataInitializerList;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartup(ServletContext servletContext) {
|
public void onStartup(ServletContext servletContext) {
|
||||||
try {
|
try {
|
||||||
startDeal();
|
|
||||||
if (dbDataInitializerList != null) {
|
// 初始化
|
||||||
dbDataInitializerList.forEach(DbDataInitializer::init);
|
Db coreDb = Db.use(dataSource);
|
||||||
}
|
dbMigrationConfig.checkDbExists(coreDb);
|
||||||
|
|
||||||
|
startDeal(coreDb, dbMigrationConfig.getMigrations());
|
||||||
|
startDeal(coreDb, dbMigrationConfig.getDatas());
|
||||||
|
|
||||||
|
// 其他数据初始化
|
||||||
|
dbDataInitializerList.forEach(DbDataInitializer::init);
|
||||||
|
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -59,18 +65,13 @@ public class DbMigrationInitializer implements ServletContextInitializer {
|
|||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void startDeal() throws Exception {
|
private void startDeal(Db coreDb, List<String> locations) throws Exception {
|
||||||
Db coreDb = Db.use(dataSource);
|
|
||||||
dbMigrationConfig.checkDbExists(coreDb);
|
|
||||||
|
|
||||||
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
||||||
List<Resource> resourceList = new ArrayList<>();
|
List<Resource> resourceList = new ArrayList<>();
|
||||||
for (String location : dbMigrationConfig.getLocations()) {
|
for (String location : locations) {
|
||||||
Resource[] resources = patternResolver.getResources(location);
|
Resource[] resources = patternResolver.getResources(location);
|
||||||
resourceList.addAll(Arrays.asList(resources));
|
resourceList.addAll(Arrays.asList(resources));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 排序后执行sql
|
|
||||||
resourceList.sort((o1, o2) -> StrUtil.compare(o1.getFilename(), o2.getFilename(), true));
|
resourceList.sort((o1, o2) -> StrUtil.compare(o1.getFilename(), o2.getFilename(), true));
|
||||||
for (Resource resource : resourceList) {
|
for (Resource resource : resourceList) {
|
||||||
migrationByResource(resource, coreDb);
|
migrationByResource(resource, coreDb);
|
||||||
@@ -94,8 +95,8 @@ public class DbMigrationInitializer implements ServletContextInitializer {
|
|||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AtomicReference<Integer> success= new AtomicReference<>(0);
|
AtomicReference<Integer> success = new AtomicReference<>(0);
|
||||||
AtomicReference<Integer> fail= new AtomicReference<>(0);
|
AtomicReference<Integer> fail = new AtomicReference<>(0);
|
||||||
db.tx((VoidFunc1<Db>) parameter -> {
|
db.tx((VoidFunc1<Db>) parameter -> {
|
||||||
List<String> split = StrUtil.split(readUtf8, ";");
|
List<String> split = StrUtil.split(readUtf8, ";");
|
||||||
for (String sql : split) {
|
for (String sql : split) {
|
||||||
@@ -114,7 +115,6 @@ public class DbMigrationInitializer implements ServletContextInitializer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
LogFactory.get().info("执行sql文件{},成功数:{},失败数:{}。",filename,success.get(),fail.get());
|
|
||||||
entity.set("checksum", checksum.getValue());
|
entity.set("checksum", checksum.getValue());
|
||||||
entity.set("update_time", DateUtil.date());
|
entity.set("update_time", DateUtil.date());
|
||||||
db.update(entity, Entity.create(dbMigrationConfig.getTable()).set("id", entity.get("id")));
|
db.update(entity, Entity.create(dbMigrationConfig.getTable()).set("id", entity.get("id")));
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.tiesheng.database.service.impl;
|
||||||
|
|
||||||
|
import com.tiesheng.database.service.DbDataInitializer;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DefaultDbDataInitializer implements DbDataInitializer {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.tiesheng.login.config.token.bean;
|
package com.tiesheng.login.config.token.bean;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.jwt.JWT;
|
import cn.hutool.jwt.JWT;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
@@ -34,9 +35,9 @@ public class TokenBean {
|
|||||||
return JWT.create()
|
return JWT.create()
|
||||||
.setExpiresAt(DateUtil.offsetHour(DateUtil.date(), tsTokenConfig.getExpireHours()))
|
.setExpiresAt(DateUtil.offsetHour(DateUtil.date(), tsTokenConfig.getExpireHours()))
|
||||||
.setPayload("id", getId())
|
.setPayload("id", getId())
|
||||||
.setPayload("environmentType", getEnvironmentType())
|
.setPayload("environmentType", StrUtil.emptyToDefault(getEnvironmentType(), ""))
|
||||||
.setPayload("service", getService())
|
.setPayload("service", StrUtil.emptyToDefault(getService(), ""))
|
||||||
.setPayload("extra", getExtra())
|
.setPayload("extra", StrUtil.emptyToDefault(getExtra(), ""))
|
||||||
.setKey(tsTokenConfig.getEncryptKey().getBytes())
|
.setKey(tsTokenConfig.getEncryptKey().getBytes())
|
||||||
.sign();
|
.sign();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.map.MapUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.URLUtil;
|
import cn.hutool.core.util.URLUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.tiesheng.annotation.operation.OperationIgnore;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.login.pojos.CodeExtraDTO;
|
import com.tiesheng.login.pojos.CodeExtraDTO;
|
||||||
@@ -57,6 +58,7 @@ public class LoginController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/unique/redirect")
|
@GetMapping("/unique/redirect")
|
||||||
|
@OperationIgnore
|
||||||
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_redirect",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_redirect",
|
||||||
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
@@ -71,6 +73,7 @@ public class LoginController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@PostMapping("/unique/index")
|
@PostMapping("/unique/index")
|
||||||
|
@OperationIgnore
|
||||||
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
||||||
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
@@ -93,6 +96,7 @@ public class LoginController {
|
|||||||
* @param response
|
* @param response
|
||||||
*/
|
*/
|
||||||
@GetMapping("/ding/index/{service}")
|
@GetMapping("/ding/index/{service}")
|
||||||
|
@OperationIgnore
|
||||||
public void dingIndex(@PathVariable String service, String extra, HttpServletResponse response) {
|
public void dingIndex(@PathVariable String service, String extra, HttpServletResponse response) {
|
||||||
if (StrUtil.isEmpty(extra)) {
|
if (StrUtil.isEmpty(extra)) {
|
||||||
extra = "";
|
extra = "";
|
||||||
@@ -116,6 +120,7 @@ public class LoginController {
|
|||||||
* @param service
|
* @param service
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/ding/oauth2/{service}")
|
@RequestMapping("/ding/oauth2/{service}")
|
||||||
|
@OperationIgnore
|
||||||
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
public void dingOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
||||||
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
||||||
@@ -149,11 +154,12 @@ public class LoginController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/wxmp/index/{service}")
|
@RequestMapping("/wxmp/index/{service}")
|
||||||
|
@OperationIgnore
|
||||||
public void wxmpIndex(@PathVariable String service, String extra, HttpServletResponse response) throws IOException {
|
public void wxmpIndex(@PathVariable String service, String extra, HttpServletResponse response) throws IOException {
|
||||||
if (StrUtil.isEmpty(extra)) {
|
if (StrUtil.isEmpty(extra)) {
|
||||||
extra = "";
|
extra = "";
|
||||||
}
|
}
|
||||||
String configUrl = globalConfig.buildPath("/auth/wxmp/oauth2/" + service + "?extra=" + extra);
|
String configUrl = globalConfig.buildPath("/login/wxmp/oauth2/" + service + "?extra=" + extra);
|
||||||
String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_userinfo");
|
String authorizationUrl = platformWxmpConfig.buildAuthorizationUrl(service, configUrl, "snsapi_userinfo");
|
||||||
response.sendRedirect(authorizationUrl);
|
response.sendRedirect(authorizationUrl);
|
||||||
}
|
}
|
||||||
@@ -163,6 +169,7 @@ public class LoginController {
|
|||||||
* 微信授权回调
|
* 微信授权回调
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/wxmp/oauth2/{service}")
|
@RequestMapping("/wxmp/oauth2/{service}")
|
||||||
|
@OperationIgnore
|
||||||
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
|
||||||
@@ -193,6 +200,7 @@ public class LoginController {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@RequestMapping("/wxmini/index/{service}")
|
@RequestMapping("/wxmini/index/{service}")
|
||||||
|
@OperationIgnore
|
||||||
public ApiResp<WxminiLoginVo> wxminiIndex(@PathVariable String service, String code) {
|
public ApiResp<WxminiLoginVo> wxminiIndex(@PathVariable String service, String code) {
|
||||||
String openid = platformWxminiConfig.jscode2session(service, code);
|
String openid = platformWxminiConfig.jscode2session(service, code);
|
||||||
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
|
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
corpId: getQueryString("corpId"),
|
corpId: getQueryString("corpId"),
|
||||||
onSuccess: function (result) {
|
onSuccess: function (result) {
|
||||||
let search = window.location.search + "&code=" + result.code;
|
let search = window.location.search + "&code=" + result.code;
|
||||||
window.location.href = "/auth/ding/oauth2/" + getQueryString("service") + search;
|
window.location.href = "/login/ding/oauth2/" + getQueryString("service") + search;
|
||||||
},
|
},
|
||||||
onFail: function (err) {
|
onFail: function (err) {
|
||||||
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>1.0.4</version>
|
<version>1.0.8</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -2,7 +2,9 @@ package com.tiesheng.core.config.operation;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.tiesheng.annotation.operation.OperationIgnore;
|
||||||
import com.tiesheng.annotation.operation.OperationLog;
|
import com.tiesheng.annotation.operation.OperationLog;
|
||||||
import com.tiesheng.core.service.CoreLogService;
|
import com.tiesheng.core.service.CoreLogService;
|
||||||
import com.tiesheng.util.ServletKit;
|
import com.tiesheng.util.ServletKit;
|
||||||
@@ -16,6 +18,7 @@ import org.springframework.stereotype.Component;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
|
||||||
@@ -56,11 +59,16 @@ public class OperationAspect {
|
|||||||
return joinPoint.proceed(joinPoint.getArgs());
|
return joinPoint.proceed(joinPoint.getArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
String title = "", subject = "";
|
|
||||||
String insertKey = "";
|
|
||||||
|
|
||||||
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
|
||||||
Method method = signature.getMethod();
|
Method method = signature.getMethod();
|
||||||
|
|
||||||
|
// 当存在忽略注解时,不添加操作日志
|
||||||
|
if (method.getAnnotation(OperationIgnore.class) != null) {
|
||||||
|
return joinPoint.proceed(joinPoint.getArgs());
|
||||||
|
}
|
||||||
|
|
||||||
|
String title = "", subject = "";
|
||||||
|
String insertKey = "";
|
||||||
OperationLog operationLog = method.getAnnotation(OperationLog.class);
|
OperationLog operationLog = method.getAnnotation(OperationLog.class);
|
||||||
if (operationLog != null) {
|
if (operationLog != null) {
|
||||||
title = operationLog.title();
|
title = operationLog.title();
|
||||||
@@ -68,11 +76,11 @@ public class OperationAspect {
|
|||||||
insertKey = operationLog.insertKey();
|
insertKey = operationLog.insertKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
Object reqObj = null;
|
Map<String, Object> reqMaps = null;
|
||||||
ConcurrentHashMap<String, Object> allParams = new ConcurrentHashMap<>(16);
|
ConcurrentHashMap<String, Object> allParams = new ConcurrentHashMap<>(16);
|
||||||
if (joinPoint.getArgs().length > 0) {
|
if (joinPoint.getArgs().length > 0) {
|
||||||
reqObj = joinPoint.getArgs()[0];
|
reqMaps = BeanUtil.beanToMap(joinPoint.getArgs()[0], false, true);
|
||||||
allParams.putAll(BeanUtil.beanToMap(reqObj, false, true));
|
allParams.putAll(reqMaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object response = joinPoint.proceed(joinPoint.getArgs());
|
Object response = joinPoint.proceed(joinPoint.getArgs());
|
||||||
@@ -92,7 +100,15 @@ public class OperationAspect {
|
|||||||
subject = ServletKit.getRequest().getRequestURI();
|
subject = ServletKit.getRequest().getRequestURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
coreLogService.addOperationLog(title, subject, reqObj);
|
// 指定字段脱敏
|
||||||
|
if (reqMaps != null && operationLog != null
|
||||||
|
&& ArrayUtil.isNotEmpty(operationLog.desensitize())) {
|
||||||
|
for (String key : operationLog.desensitize()) {
|
||||||
|
reqMaps.put(key, "******");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
coreLogService.addOperationLog(title, subject, reqMaps);
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.tiesheng.core.service;
|
|||||||
import cn.hutool.core.io.FileTypeUtil;
|
import cn.hutool.core.io.FileTypeUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.io.IoUtil;
|
import cn.hutool.core.io.IoUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import com.tiesheng.util.pojos.FileUploadPath;
|
import com.tiesheng.util.pojos.FileUploadPath;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -37,6 +38,11 @@ public class FileUploadService {
|
|||||||
public String saveMultipartFile(MultipartFile file) {
|
public String saveMultipartFile(MultipartFile file) {
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
String fileHttpPath = tieshengWebConfigurer.uploadFileCustomize(file);
|
||||||
|
if (!StrUtil.isEmpty(fileHttpPath)) {
|
||||||
|
return fileHttpPath;
|
||||||
|
}
|
||||||
|
|
||||||
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
|
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
|
||||||
tieshengWebConfigurer.uploadFileCheck(fileType);
|
tieshengWebConfigurer.uploadFileCheck(fileType);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
|||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.util.exception.ApiRespEnum;
|
import com.tiesheng.util.exception.ApiRespEnum;
|
||||||
import com.tiesheng.util.pojos.ApiResp;
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@@ -45,6 +46,16 @@ public interface TieshengWebConfigurer {
|
|||||||
default void uploadFileCheck(String fileExt) {
|
default void uploadFileCheck(String fileExt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义文件上传
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default String uploadFileCustomize(MultipartFile file) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件后处理文件
|
* 上传文件后处理文件
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
-- ----------------------------
|
||||||
|
-- Table for data
|
||||||
|
-- ----------------------------
|
||||||
|
|
||||||
|
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||||
|
`config_type`, `remark`, `extra`, `read_only`)
|
||||||
|
VALUES ('manager_web_copyright', '2022-02-23 16:52:48', '2022-02-23 16:52:49', 0, 'manager_web_copyright',
|
||||||
|
'杭州铁晟提供技术支持', 0, '网站底部版权信息', '', 0);
|
||||||
|
|
||||||
|
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||||
|
`config_type`, `remark`, `extra`, `read_only`)
|
||||||
|
VALUES ('manager_web_title', '2022-02-24 11:56:53', '2022-02-24 11:56:53', 0, 'manager_web_title', '网站名称', 0,
|
||||||
|
'网站名称', '', 0);
|
||||||
|
|
||||||
|
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||||
|
`config_type`, `remark`, `extra`, `read_only`)
|
||||||
|
VALUES ('manager_web_logo', '2022-02-24 11:56:53', '2022-02-24 11:56:53', 0, 'manager_web_logo', '', 1,
|
||||||
|
'网站LOGO', '', 0);
|
||||||
@@ -50,23 +50,4 @@ CREATE TABLE `core_config_func`
|
|||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='职位-功能点';
|
DEFAULT CHARSET = utf8mb4 COMMENT ='职位-功能点';
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table for data
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
|
||||||
`config_type`, `remark`, `extra`, `read_only`)
|
|
||||||
VALUES ('manager_web_copyright', '2022-02-23 16:52:48', '2022-02-23 16:52:49', 0, 'manager_web_copyright',
|
|
||||||
'杭州铁晟提供技术支持', 0, '网站底部版权信息', '', 0);
|
|
||||||
|
|
||||||
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
|
||||||
`config_type`, `remark`, `extra`, `read_only`)
|
|
||||||
VALUES ('manager_web_title', '2022-02-24 11:56:53', '2022-02-24 11:56:53', 0, 'manager_web_title', '网站名称', 0,
|
|
||||||
'网站名称', '', 0);
|
|
||||||
|
|
||||||
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
|
||||||
`config_type`, `remark`, `extra`, `read_only`)
|
|
||||||
VALUES ('manager_web_logo', '2022-02-24 11:56:53', '2022-02-24 11:56:53', 0, 'manager_web_logo', '', 1,
|
|
||||||
'网站LOGO', '', 0);
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
SET FOREIGN_KEY_CHECKS = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user