Compare commits
47 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fc00bad49a | ||
|
|
6dd4e19e39 | ||
|
|
4373ec7c0e | ||
|
|
5cc135d8e2 | ||
|
|
69a9681b48 | ||
|
|
6c39dc24bd | ||
|
|
952341918a | ||
|
|
5dde3e3e9f | ||
|
|
c5c7afd7f6 | ||
|
|
ceb13dc78d | ||
|
|
0fabc7aae9 | ||
|
|
28a2fa0262 | ||
|
|
cc3ab52885 | ||
|
|
027587ae02 | ||
|
|
353851a0aa | ||
|
|
1db6d88e4e | ||
|
|
7e69138ef7 | ||
|
|
ea211b1bfc | ||
|
|
101270e881 | ||
|
|
a658298363 | ||
|
|
65beecc330 | ||
|
|
ea24bf3479 | ||
|
|
90e504e7fd | ||
|
|
5db42f5bc8 | ||
|
|
37d84e2f36 | ||
|
|
f59d56be9e | ||
|
|
7f4871fe19 | ||
|
|
34e3cb2f09 | ||
|
|
7c1abb9b97 | ||
|
|
a649bdae7c | ||
|
|
7b6eccb0d5 | ||
|
|
c700ddc90a | ||
|
|
4254bf47bf | ||
|
|
e0b1720c4a | ||
|
|
9cd7b069a8 | ||
|
|
0ca3d13659 | ||
|
|
0ac237fbbd | ||
|
|
d9da55d4bf | ||
|
|
802152badd | ||
|
|
7b4169f3e6 | ||
|
|
c3b3831378 | ||
|
|
73e6470b39 | ||
|
|
458d118d85 | ||
|
|
659deb6132 | ||
|
|
f8c121ba6f | ||
|
|
0307d3f544 | ||
|
|
6f0bfb1a7d |
@@ -1,23 +1,10 @@
|
|||||||
stages:
|
stages:
|
||||||
- deploy
|
- deploy
|
||||||
- package
|
|
||||||
|
|
||||||
build-jar:
|
|
||||||
stage: deploy
|
|
||||||
tags:
|
|
||||||
- hzkepai
|
|
||||||
rules:
|
|
||||||
- if: $CI_COMMIT_BRANCH == "master"
|
|
||||||
script:
|
|
||||||
- mvn clean package -Dmaven.test.skip=true
|
|
||||||
- systemctl stop tieshengboot-ademo
|
|
||||||
- cp springboot-ademo/target/*.jar /usr/local/nginx/html/demo.tmp.kepai365.ltd/
|
|
||||||
- systemctl start tieshengboot-ademo
|
|
||||||
|
|
||||||
deploy-jar:
|
deploy-jar:
|
||||||
stage: deploy
|
stage: deploy
|
||||||
tags:
|
tags:
|
||||||
- hzkepai
|
- zengos
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
script:
|
script:
|
||||||
|
|||||||
56
CHANGELOG.md
56
CHANGELOG.md
@@ -1,30 +1,48 @@
|
|||||||
|
## 1.1.0
|
||||||
|
|
||||||
|
- feat:globalConfig增加ext属性。
|
||||||
|
- feat:增加网络请求超时、重定向的配置。
|
||||||
|
- perf:更新数据库对比插件。
|
||||||
|
- feat(web):增加DaoBase的常量。
|
||||||
|
- perf(web):操作日志优化。
|
||||||
|
|
||||||
|
|
||||||
|
## 1.0.12
|
||||||
|
|
||||||
|
- perf(encrypt):开启关闭加解密移动到**yaml**中配置,移除**EnableEncryptConfig**注解。
|
||||||
|
- feat(login):登录接口增加验签步骤,可通过**validLoginSign**属性开启或关闭(默认)。
|
||||||
|
- perf(login):可重写**onSignError**方法自定义验签错误的跳转。
|
||||||
|
- fix(login):修复微信、钉钉授权跳转地址错误的bug
|
||||||
|
|
||||||
|
## 1.0.7
|
||||||
|
|
||||||
|
- feat(web): 增加uploadFileCustomize方法,允许自定义文件存放情况
|
||||||
|
- feat(database): 增加db/data目录,存放初始化数据的sql
|
||||||
|
- perf(login): 增加默认值,防止token解析异常
|
||||||
|
|
||||||
|
## 1.0.6
|
||||||
|
|
||||||
|
- feat(web):新增 **OperationIgnore** 注解,可以指定接口忽略操作日志的收集。
|
||||||
|
- feat(web):**OperationLog** 增加 desensitize 属性,用来脱敏指定的字段。
|
||||||
|
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
### 调整
|
- feat(database):增加数据库定时备份;
|
||||||
|
- feat(database):增加过期备份的删除操作,默认过期时间为7天;
|
||||||
> 1,增加数据库定时备份;
|
- perf(message):调整阿里云短信类,方便扩展其他方法。
|
||||||
> 2,增加过期备份的删除操作,默认过期时间为7天;
|
- perf(message):消息发送接口该body类型为 **JSONObject**
|
||||||
> 3,调整阿里云短信类,方便扩展其他方法。
|
- perf(message):调整消息发送接口和方法(不兼容旧版本)
|
||||||
> 4,消息发送接口该body类型为 **JSONObject**
|
|
||||||
> 5,调整消息发送接口和方法(不兼容旧版本)
|
|
||||||
|
|
||||||
## 1.0.1
|
## 1.0.1
|
||||||
|
|
||||||
### 调整
|
- perf(web):fastjson增加配置 **DisableCircularReferenceDetect**,禁用相同的对象写成引用的形式。
|
||||||
|
|
||||||
fastjson增加配置 **DisableCircularReferenceDetect**,禁用相同的对象写成引用的形式。
|
|
||||||
|
|
||||||
## 1.0.0
|
## 1.0.0
|
||||||
|
|
||||||
### 升级
|
- perf:hutool依赖升级:5.8.11 -> 5.8.16
|
||||||
|
- perf:fastjson依赖升级:1.2.78 -> 1.2.83
|
||||||
> 1,hutool依赖升级:5.8.11 -> 5.8.16
|
- perf:mybatis-plus依赖升级:3.5.1 -> 3.5.3
|
||||||
> 2,fastjson依赖升级:1.2.78 -> 1.2.83
|
- perf:**TieshengWebConfigurer** 增加 **configSystemCheck** 方法,可根据情况校验系统配置参数。
|
||||||
> 3,mybatis-plus依赖升级:3.5.1 -> 3.5.3
|
|
||||||
|
|
||||||
### 调整
|
|
||||||
|
|
||||||
> 1,**TieshengWebConfigurer** 增加 **configSystemCheck** 方法,可根据情况校验系统配置参数。
|
|
||||||
|
|
||||||
从该版本开始,仓库地址改为:
|
从该版本开始,仓库地址改为:
|
||||||
|
|
||||||
|
|||||||
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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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>1.0.0</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<goals>
|
<goals>
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
<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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.17</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package com.tiesheng.demo;
|
|||||||
|
|
||||||
import com.tiesheng.core.EnableTieshengWeb;
|
import com.tiesheng.core.EnableTieshengWeb;
|
||||||
import com.tiesheng.demo.config.DemoWebConfigurer;
|
import com.tiesheng.demo.config.DemoWebConfigurer;
|
||||||
import com.tiesheng.encrypt.EnableEncryptConfig;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||||
|
|||||||
@@ -31,9 +31,6 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
|
|||||||
TokenBean tokenBean = null;
|
TokenBean tokenBean = null;
|
||||||
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
||||||
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
|
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
|
||||||
} else {
|
|
||||||
// 获取用户信息判断是否可登录
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tokenBean;
|
return tokenBean;
|
||||||
|
|||||||
@@ -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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
package com.tiesheng.encrypt;
|
|
||||||
|
|
||||||
|
|
||||||
import com.tiesheng.encrypt.config.DecryptRequestBodyAdvice;
|
|
||||||
import com.tiesheng.encrypt.config.EncryptResponseBodyAdvice;
|
|
||||||
import org.springframework.context.annotation.Import;
|
|
||||||
|
|
||||||
import java.lang.annotation.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author hao
|
|
||||||
*/
|
|
||||||
@Retention(RetentionPolicy.RUNTIME)
|
|
||||||
@Target({ElementType.TYPE})
|
|
||||||
@Documented
|
|
||||||
@Import({
|
|
||||||
DecryptRequestBodyAdvice.class,
|
|
||||||
EncryptResponseBodyAdvice.class,
|
|
||||||
})
|
|
||||||
public @interface EnableEncryptConfig {
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.tiesheng.encrypt;
|
||||||
|
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
|
@ComponentScan({
|
||||||
|
"com.tiesheng.encrypt.**.*",
|
||||||
|
})
|
||||||
|
public class EncryptAutoConfigurer {
|
||||||
|
}
|
||||||
@@ -37,7 +37,7 @@ public class EncryptResponseBodyAdvice implements ResponseBodyAdvice<ApiResp> {
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
Object data = body.getData();
|
Object data = body.getData();
|
||||||
if (data == null || !body.successful()) {
|
if (data == null || !body.successful() || !encryptConfig.isBody()) {
|
||||||
return body;
|
return body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public class TsTokenConfig {
|
|||||||
private String encryptKey = "%kIp9frQCu";
|
private String encryptKey = "%kIp9frQCu";
|
||||||
private Integer expireHours = 48;
|
private Integer expireHours = 48;
|
||||||
private String[] ignorePaths;
|
private String[] ignorePaths;
|
||||||
|
private boolean validLoginSign = false;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -148,4 +149,12 @@ public class TsTokenConfig {
|
|||||||
public void setIgnorePaths(String[] ignorePaths) {
|
public void setIgnorePaths(String[] ignorePaths) {
|
||||||
this.ignorePaths = ignorePaths;
|
this.ignorePaths = ignorePaths;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isValidLoginSign() {
|
||||||
|
return validLoginSign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValidLoginSign(boolean validLoginSign) {
|
||||||
|
this.validLoginSign = validLoginSign;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,7 +4,9 @@ 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.TsTokenConfig;
|
||||||
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;
|
||||||
import com.tiesheng.login.pojos.DoLoginInfo;
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
@@ -49,6 +51,8 @@ public class LoginController {
|
|||||||
TieshengLoginConfigurer tieshengLoginConfigurer;
|
TieshengLoginConfigurer tieshengLoginConfigurer;
|
||||||
@Autowired
|
@Autowired
|
||||||
GlobalConfig globalConfig;
|
GlobalConfig globalConfig;
|
||||||
|
@Autowired
|
||||||
|
TsTokenConfig tsTokenConfig;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -57,7 +61,13 @@ 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) {
|
||||||
|
if (tsTokenConfig.isValidLoginSign() && !dto.validSign()) {
|
||||||
|
tieshengLoginConfigurer.onSignError(response);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
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()));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
@@ -71,6 +81,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 +104,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 = "";
|
||||||
@@ -101,6 +113,7 @@ public class LoginController {
|
|||||||
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
|
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
|
||||||
map.put("service", service);
|
map.put("service", service);
|
||||||
map.put("extra", extra);
|
map.put("extra", extra);
|
||||||
|
map.put("context", globalConfig.getContextPath());
|
||||||
String query = URLUtil.buildQuery(map, Charset.defaultCharset());
|
String query = URLUtil.buildQuery(map, Charset.defaultCharset());
|
||||||
String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
|
String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
|
||||||
try {
|
try {
|
||||||
@@ -116,6 +129,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 +163,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 +178,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 +209,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);
|
||||||
|
|||||||
@@ -1,6 +1,10 @@
|
|||||||
package com.tiesheng.login.pojos;
|
package com.tiesheng.login.pojos;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
public class UniqueIndexDTO extends LoginToInfo {
|
public class UniqueIndexDTO extends LoginToInfo {
|
||||||
|
|
||||||
@@ -8,6 +12,26 @@ public class UniqueIndexDTO extends LoginToInfo {
|
|||||||
private String extra;
|
private String extra;
|
||||||
private String info;
|
private String info;
|
||||||
private String platform = "web";
|
private String platform = "web";
|
||||||
|
private Long timestamp;
|
||||||
|
private String sign;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证签名是否正确
|
||||||
|
*/
|
||||||
|
public boolean validSign() {
|
||||||
|
if (StrUtil.isEmpty(getNo()) || getTimestamp() == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((DateUtil.currentSeconds() - getTimestamp()) > 60) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
String mySign = getNo() + getTimestamp();
|
||||||
|
for (int i = 0; i < 11; i++) {
|
||||||
|
mySign = SecureUtil.md5(mySign);
|
||||||
|
}
|
||||||
|
return Objects.equals(sign, mySign);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
@@ -47,4 +71,20 @@ public class UniqueIndexDTO extends LoginToInfo {
|
|||||||
public void setPlatform(String platform) {
|
public void setPlatform(String platform) {
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getTimestamp() {
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(Long timestamp) {
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSign() {
|
||||||
|
return sign;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSign(String sign) {
|
||||||
|
this.sign = sign;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.tiesheng.login.service;
|
|||||||
|
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.login.pojos.DoLoginInfo;
|
import com.tiesheng.login.pojos.DoLoginInfo;
|
||||||
|
import com.tiesheng.util.ServletKit;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -28,4 +29,9 @@ public interface TieshengLoginConfigurer {
|
|||||||
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名错误的时候
|
||||||
|
*/
|
||||||
|
void onSignError(HttpServletResponse response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,9 @@ public class DefaultLoginConfigurer implements TieshengLoginConfigurer {
|
|||||||
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSignError(HttpServletResponse response) {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,10 +24,10 @@
|
|||||||
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.replace(getQueryString("context") + "/login/ding/oauth2/" + getQueryString("service") + search);
|
||||||
},
|
},
|
||||||
onFail: function (err) {
|
onFail: function (err) {
|
||||||
window.location.href = "./error.html?message=" + JSON.stringify(err);
|
window.location.replace("./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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.tiesheng.message.config.aliyun;
|
package com.tiesheng.message.config.aliyun;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.lang.Validator;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
|
import cn.hutool.extra.validation.ValidationUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@@ -139,7 +142,15 @@ public class AliyunSmsSender implements TieshengMessageSender {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MessageReqResp send(String user, JSONObject body) {
|
public MessageReqResp send(String user, JSONObject body) {
|
||||||
return sendSms(user, body.getStr("template_code"), body);
|
boolean mobile = Validator.isMobile(user);
|
||||||
|
if (!mobile) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String templateCode = body.getStr("template_code");
|
||||||
|
if (StrUtil.isEmpty(templateCode)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return sendSms(user, templateCode, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.lang.TypeReference;
|
|||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@@ -125,9 +126,11 @@ public class PlatformDingConfig {
|
|||||||
* @see <a href="https://open.dingtalk.com/document/isvapp-server/obtain-the-userid-of-a-user-by-using-the-log-free"></a>
|
* @see <a href="https://open.dingtalk.com/document/isvapp-server/obtain-the-userid-of-a-user-by-using-the-log-free"></a>
|
||||||
*/
|
*/
|
||||||
public String getUserIdByCode(String service, String code) {
|
public String getUserIdByCode(String service, String code) {
|
||||||
String response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=" + getAccessToken(service))
|
HttpRequest request = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/getuserinfo?access_token=" + getAccessToken(service))
|
||||||
.body(JSONUtil.createObj().putOpt("code", code).toString()).execute().body();
|
.body(JSONUtil.createObj().putOpt("code", code).toString());
|
||||||
return JSONUtil.parseObj(response).getJSONObject("result").getStr("userid");
|
try (HttpResponse response = request.execute()) {
|
||||||
|
return JSONUtil.parseObj(response.body()).getJSONObject("result").getStr("userid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -141,15 +144,16 @@ public class PlatformDingConfig {
|
|||||||
*/
|
*/
|
||||||
public DingUserInfo topapiV2UserGet(String service, String ddUserId) {
|
public DingUserInfo topapiV2UserGet(String service, String ddUserId) {
|
||||||
DingConfigBean dingConfigBean = getConfigBean(service);
|
DingConfigBean dingConfigBean = getConfigBean(service);
|
||||||
String response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/get?access_token=" + getAccessToken(service))
|
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/get?access_token="
|
||||||
.body(JSONUtil.createObj().putOpt("userid", ddUserId).toString()).execute().body();
|
+ getAccessToken(service))
|
||||||
JSONObject resultJson = JSONUtil.parseObj(response).getJSONObject("result");
|
.body(JSONUtil.createObj().putOpt("userid", ddUserId).toString()).execute()) {
|
||||||
DingUserInfo userInfo = JSONUtil.toBean(resultJson, DingUserInfo.class);
|
JSONObject resultJson = JSONUtil.parseObj(response.body()).getJSONObject("result");
|
||||||
|
DingUserInfo userInfo = JSONUtil.toBean(resultJson, DingUserInfo.class);
|
||||||
// 设置一下job_number
|
// 设置一下job_number
|
||||||
userInfo.setJobNumber(resultJson.getStr("job_number"));
|
userInfo.setJobNumber(resultJson.getStr("job_number"));
|
||||||
userInfo.setAppId(dingConfigBean.getAppKey());
|
userInfo.setAppId(dingConfigBean.getAppKey());
|
||||||
return userInfo;
|
return userInfo;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -164,15 +168,16 @@ public class PlatformDingConfig {
|
|||||||
if (StrUtil.isEmpty(token)) {
|
if (StrUtil.isEmpty(token)) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
String response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/department/listsub?access_token=" + token)
|
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/department/listsub?access_token=" + token)
|
||||||
.body(JSONUtil.createObj().putOpt("dept_id", deptId).toString()).execute().body();
|
.body(JSONUtil.createObj().putOpt("dept_id", deptId).toString()).execute()) {
|
||||||
DingResponse<List<DingDeptVo>> result = JSONUtil.toBean(response, new TypeReference<DingResponse<List<DingDeptVo>>>() {
|
DingResponse<List<DingDeptVo>> result = JSONUtil.toBean(response.body(), new TypeReference<DingResponse<List<DingDeptVo>>>() {
|
||||||
}.getType(), true);
|
}.getType(), true);
|
||||||
|
|
||||||
if (!result.isOk()) {
|
if (!result.isOk()) {
|
||||||
result.setResult(new ArrayList<>());
|
result.setResult(new ArrayList<>());
|
||||||
|
}
|
||||||
|
return result.getResult();
|
||||||
}
|
}
|
||||||
return result.getResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -187,16 +192,16 @@ public class PlatformDingConfig {
|
|||||||
if (StrUtil.isEmpty(token)) {
|
if (StrUtil.isEmpty(token)) {
|
||||||
return DingUserListVo.fail();
|
return DingUserListVo.fail();
|
||||||
}
|
}
|
||||||
|
try (HttpResponse response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/list?access_token=" + token)
|
||||||
String response = HttpRequest.post("https://oapi.dingtalk.com/topapi/v2/user/list?access_token=" + token)
|
|
||||||
.body(JSONUtil.createObj().putOpt("dept_id", deptId).putOpt("cursor", cursor).putOpt("size", 100).toString())
|
.body(JSONUtil.createObj().putOpt("dept_id", deptId).putOpt("cursor", cursor).putOpt("size", 100).toString())
|
||||||
.execute().body();
|
.execute()) {
|
||||||
DingResponse<DingUserListVo> result = JSONUtil.toBean(response, new TypeReference<DingResponse<DingUserListVo>>() {
|
DingResponse<DingUserListVo> result = JSONUtil.toBean(response.body(), new TypeReference<DingResponse<DingUserListVo>>() {
|
||||||
}.getType(), true);
|
}.getType(), true);
|
||||||
if (!result.isOk()) {
|
if (!result.isOk()) {
|
||||||
result.setResult(DingUserListVo.fail());
|
result.setResult(DingUserListVo.fail());
|
||||||
|
}
|
||||||
|
return result.getResult();
|
||||||
}
|
}
|
||||||
return result.getResult();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.tiesheng.platform.config.wxmini;
|
|||||||
|
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.http.HttpRequest;
|
import cn.hutool.http.HttpRequest;
|
||||||
|
import cn.hutool.http.HttpResponse;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
|
import com.tiesheng.platform.config.wxmp.bean.WxConfigBean;
|
||||||
@@ -50,12 +51,13 @@ public class PlatformWxminiConfig {
|
|||||||
*/
|
*/
|
||||||
public String jscode2session(String service, String code) {
|
public String jscode2session(String service, String code) {
|
||||||
WxConfigBean configBean = getConfigBean(service);
|
WxConfigBean configBean = getConfigBean(service);
|
||||||
String body = HttpRequest.get("https://api.weixin.qq.com/sns/jscode2session"
|
try (HttpResponse response = HttpRequest.get("https://api.weixin.qq.com/sns/jscode2session"
|
||||||
+ "?appid=" + configBean.getAppId()
|
+ "?appid=" + configBean.getAppId()
|
||||||
+ "&secret=" + configBean.getAppSecret()
|
+ "&secret=" + configBean.getAppSecret()
|
||||||
+ "&js_code=" + code + "&grant_type=authorization_code").execute().body();
|
+ "&js_code=" + code + "&grant_type=authorization_code").execute()) {
|
||||||
JSONObject object = JSONUtil.parseObj(body);
|
JSONObject object = JSONUtil.parseObj(response.body());
|
||||||
return object.getStr("openid");
|
return object.getStr("openid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -65,11 +67,12 @@ public class PlatformWxminiConfig {
|
|||||||
*/
|
*/
|
||||||
public String getAccessToken(String service) {
|
public String getAccessToken(String service) {
|
||||||
WxConfigBean configBean = getConfigBean(service);
|
WxConfigBean configBean = getConfigBean(service);
|
||||||
String body = HttpRequest.get("https://api.weixin.qq.com/cgi-bin/token"
|
try (HttpResponse response = HttpRequest.get("https://api.weixin.qq.com/cgi-bin/token"
|
||||||
+ "?grant_type=client_credential&appid=" + configBean.getAppId()
|
+ "?grant_type=client_credential&appid=" + configBean.getAppId()
|
||||||
+ "&secret=" + configBean.getAppSecret()).execute().body();
|
+ "&secret=" + configBean.getAppSecret()).execute()) {
|
||||||
JSONObject object = JSONUtil.parseObj(body);
|
JSONObject object = JSONUtil.parseObj(response.body());
|
||||||
return object.getStr("access_token");
|
return object.getStr("access_token");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -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.2</version>
|
<version>1.0.17</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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -26,7 +26,8 @@ public class ServletKit extends ServletUtil {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getClientIP() {
|
public static String getClientIP() {
|
||||||
return getClientIP(getRequest());
|
HttpServletRequest request = getRequest();
|
||||||
|
return getClientIP(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ public class EncryptConfig {
|
|||||||
*/
|
*/
|
||||||
private String key = "WmdUzPJXbngVNiaSsQrihg==";
|
private String key = "WmdUzPJXbngVNiaSsQrihg==";
|
||||||
private Integer saltSize = 8;
|
private Integer saltSize = 8;
|
||||||
|
private boolean body = false;
|
||||||
|
|
||||||
public EncryptConfig() {
|
public EncryptConfig() {
|
||||||
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
sm4 = SmUtil.sm4(Base64.decode(getKey()));
|
||||||
@@ -72,7 +73,7 @@ public class EncryptConfig {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public String passwdCreate(String inputPasswd, String salt) {
|
public String passwdCreate(String inputPasswd, String salt) {
|
||||||
if (StrUtil.isEmpty(salt)) {
|
if (StrUtil.isEmpty(salt) || StrUtil.length(salt) != getSaltSize()) {
|
||||||
salt = RandomUtil.randomString(saltSize);
|
salt = RandomUtil.randomString(saltSize);
|
||||||
}
|
}
|
||||||
if (!passwdComplexity(inputPasswd)) {
|
if (!passwdComplexity(inputPasswd)) {
|
||||||
@@ -133,4 +134,12 @@ public class EncryptConfig {
|
|||||||
public void setSaltSize(Integer saltSize) {
|
public void setSaltSize(Integer saltSize) {
|
||||||
this.saltSize = saltSize;
|
this.saltSize = saltSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(boolean body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,8 +4,9 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.core.comparator.VersionComparator;
|
import cn.hutool.core.comparator.VersionComparator;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import cn.hutool.core.util.URLUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.http.HttpGlobalConfig;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
@@ -13,10 +14,12 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,10 +34,37 @@ public class GlobalConfig {
|
|||||||
private String version;
|
private String version;
|
||||||
private String uploadDir = System.getProperty("user.dir");
|
private String uploadDir = System.getProperty("user.dir");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 其他属性
|
||||||
|
*/
|
||||||
|
private HashMap<String, String> ext;
|
||||||
|
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
// 默认10s的超时时间
|
||||||
|
HttpGlobalConfig.setTimeout(10 * 1000);
|
||||||
|
// 最多重定向3次
|
||||||
|
HttpGlobalConfig.setMaxRedirectCount(3);
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 逻辑方法
|
// 逻辑方法
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取扩展属性内容
|
||||||
|
*
|
||||||
|
* @param extkey
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getExtValue(String extkey) {
|
||||||
|
if (getExt() == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return getExt().get(extkey);
|
||||||
|
}
|
||||||
|
|
||||||
public String getContextPath() {
|
public String getContextPath() {
|
||||||
String context = SpringUtil.getProperty("server.servlet.context-path");
|
String context = SpringUtil.getProperty("server.servlet.context-path");
|
||||||
if (StrUtil.isEmpty(context)) {
|
if (StrUtil.isEmpty(context)) {
|
||||||
@@ -87,7 +117,8 @@ public class GlobalConfig {
|
|||||||
if (FileUtil.exist(folder)) {
|
if (FileUtil.exist(folder)) {
|
||||||
File[] files = FileUtil.ls(folder);
|
File[] files = FileUtil.ls(folder);
|
||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
versions.add(StrUtil.subAfter(file.getAbsolutePath(), htmlDir, true));
|
String normalize = FileUtil.normalize(file.getAbsolutePath());
|
||||||
|
versions.add(StrUtil.subAfter(normalize, htmlDir, true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,4 +169,12 @@ public class GlobalConfig {
|
|||||||
public void setVersion(String version) {
|
public void setVersion(String version) {
|
||||||
this.version = version;
|
this.version = version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public HashMap<String, String> getExt() {
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setExt(HashMap<String, String> ext) {
|
||||||
|
this.ext = ext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ public class Searcher {
|
|||||||
this.ioCount = 0;
|
this.ioCount = 0;
|
||||||
|
|
||||||
// locate the segment index block based on the vector index
|
// locate the segment index block based on the vector index
|
||||||
int sPtr = 0, ePtr = 0;
|
int sPtr, ePtr;
|
||||||
int il0 = (int) ((ip >> 24) & 0xFF);
|
int il0 = (int) ((ip >> 24) & 0xFF);
|
||||||
int il1 = (int) ((ip >> 16) & 0xFF);
|
int il1 = (int) ((ip >> 16) & 0xFF);
|
||||||
int idx = il0 * VectorIndexCols * VectorIndexSize + il1 * VectorIndexSize;
|
int idx = il0 * VectorIndexCols * VectorIndexSize + il1 * VectorIndexSize;
|
||||||
|
|||||||
@@ -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.2</version>
|
<version>1.0.17</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.tiesheng.core;
|
|||||||
|
|
||||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
import com.tiesheng.core.service.TieshengWebConfigurer;
|
||||||
import com.tiesheng.database.DatabaseAutoConfigurer;
|
import com.tiesheng.database.DatabaseAutoConfigurer;
|
||||||
|
import com.tiesheng.encrypt.EncryptAutoConfigurer;
|
||||||
import com.tiesheng.login.LoginAutoConfigurer;
|
import com.tiesheng.login.LoginAutoConfigurer;
|
||||||
import com.tiesheng.message.MessageAutoConfigurer;
|
import com.tiesheng.message.MessageAutoConfigurer;
|
||||||
import com.tiesheng.util.UtilAutoConfigurer;
|
import com.tiesheng.util.UtilAutoConfigurer;
|
||||||
@@ -20,7 +21,8 @@ import java.lang.annotation.*;
|
|||||||
MessageAutoConfigurer.class,
|
MessageAutoConfigurer.class,
|
||||||
CoreAutoConfigurer.class,
|
CoreAutoConfigurer.class,
|
||||||
LoginAutoConfigurer.class,
|
LoginAutoConfigurer.class,
|
||||||
DatabaseAutoConfigurer.class
|
DatabaseAutoConfigurer.class,
|
||||||
|
EncryptAutoConfigurer.class
|
||||||
})
|
})
|
||||||
public @interface EnableTieshengWeb {
|
public @interface EnableTieshengWeb {
|
||||||
|
|
||||||
|
|||||||
@@ -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,7 +18,6 @@ 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.HashMap;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
@@ -58,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();
|
||||||
@@ -70,15 +76,15 @@ 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));
|
allParams.putAll(reqMaps);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object response = joinPoint.proceed(joinPoint.getArgs());
|
Object response = joinPoint.proceed(joinPoint.getArgs());
|
||||||
allParams.putAll(BeanUtil.beanToMap(response));
|
allParams.putAll(BeanUtil.beanToMap(response, false, true));
|
||||||
|
|
||||||
if (!StrUtil.isEmpty(subject)) {
|
if (!StrUtil.isEmpty(subject)) {
|
||||||
// 添加、编辑关键字处理
|
// 添加、编辑关键字处理
|
||||||
@@ -94,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.controller;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||||
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
||||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||||
@@ -40,11 +41,11 @@ public class LogController {
|
|||||||
|
|
||||||
QueryWrapper<CoreLogOperation> queryWrapper = new QueryWrapper<>();
|
QueryWrapper<CoreLogOperation> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.eq("is_deleted", 0);
|
queryWrapper.eq("is_deleted", 0);
|
||||||
dto.likeColumns(queryWrapper, "user_name", "title", "subject", "params");
|
dto.likeColumns(queryWrapper, "user_name", "title", "subject");
|
||||||
queryWrapper.orderByDesc("create_time");
|
queryWrapper.orderByDesc("create_time");
|
||||||
|
|
||||||
Page<CoreLogOperation> page = dto.pageObj();
|
Page<CoreLogOperation> page = dto.pageObj();
|
||||||
coreLogService.page(page, queryWrapper);
|
coreLogService.getBaseMapper().page(page, queryWrapper);
|
||||||
|
|
||||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,23 @@
|
|||||||
package com.tiesheng.core.mapper;
|
package com.tiesheng.core.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
public interface CoreLogOperationMapper extends BaseMapper<CoreLogOperation> {
|
public interface CoreLogOperationMapper extends BaseMapper<CoreLogOperation> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取日志列表
|
||||||
|
*
|
||||||
|
* @param page
|
||||||
|
* @param queryWrapper
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Page<CoreLogOperation> page(IPage<CoreLogOperation> page, @Param("ew") QueryWrapper<CoreLogOperation> queryWrapper);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,12 @@ import java.util.Date;
|
|||||||
|
|
||||||
public class DaoBase {
|
public class DaoBase {
|
||||||
|
|
||||||
|
public static final String ID = "id";
|
||||||
|
public static final String CREATE_TIME = "create_time";
|
||||||
|
public static final String UPDATE_TIME = "update_time";
|
||||||
|
public static final String IS_DELETED = "is_deleted";
|
||||||
|
public static final String LIMIT_1 = "limit 1";
|
||||||
|
|
||||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.tiesheng.core.pojos.dao.CoreJobUser;
|
|||||||
import com.tiesheng.util.pojos.IdName;
|
import com.tiesheng.util.pojos.IdName;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -35,6 +36,7 @@ public class CoreJobService extends TsServiceBase<CoreJobMapper, CoreJob> {
|
|||||||
* @param remark
|
* @param remark
|
||||||
* @param isSystem
|
* @param isSystem
|
||||||
*/
|
*/
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void refresh(String id, String name, String remark, Integer isSystem) {
|
public void refresh(String id, String name, String remark, Integer isSystem) {
|
||||||
CoreJob coreJob = new CoreJob();
|
CoreJob coreJob = new CoreJob();
|
||||||
coreJob.setId(id);
|
coreJob.setId(id);
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,22 +85,25 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
coreLogProcessMapper.insert(coreLogProcess);
|
coreLogProcessMapper.insert(coreLogProcess);
|
||||||
|
|
||||||
ThreadUtil.execute(() -> {
|
ThreadUtil.execute(() -> {
|
||||||
|
List<Exception> errorList = new ArrayList<>();
|
||||||
CollUtil.split(list, 100).forEach((it) -> {
|
CollUtil.split(list, 100).forEach((it) -> {
|
||||||
int accept = 0;
|
int accept = 0;
|
||||||
try {
|
try {
|
||||||
accept = consumer.accept(it);
|
accept = consumer.accept(it);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
coreLogProcess.setError(coreLogProcess.getError() + ";" + JSONUtil.toJsonStr(e));
|
errorList.add(e);
|
||||||
}
|
}
|
||||||
coreLogProcess.setProcess(coreLogProcess.getProcess() + it.size());
|
coreLogProcess.setProcess(coreLogProcess.getProcess() + it.size());
|
||||||
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + accept);
|
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + accept);
|
||||||
coreLogProcess.setFailNum(coreLogProcess.getFailNum() + it.size() - accept);
|
coreLogProcess.setFailNum(coreLogProcess.getFailNum() + it.size() - accept);
|
||||||
|
coreLogProcess.setError(JSONUtil.toJsonStr(errorList));
|
||||||
coreLogProcessMapper.updateById(coreLogProcess);
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
});
|
});
|
||||||
|
|
||||||
// 执行结束
|
// 执行结束
|
||||||
coreLogProcess.setFailFile(consumer.getFailFile());
|
coreLogProcess.setFailFile(consumer.getFailFile());
|
||||||
coreLogProcess.setStatus(1);
|
coreLogProcess.setStatus(1);
|
||||||
|
coreLogProcess.setError(JSONUtil.toJsonStr(errorList));
|
||||||
coreLogProcessMapper.updateById(coreLogProcess);
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -130,20 +134,23 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
ThreadUtil.execute(() -> {
|
ThreadUtil.execute(() -> {
|
||||||
int pageSize = 1000;
|
int pageSize = 1000;
|
||||||
int pageNum = 1, lastCount = pageSize;
|
int pageNum = 1, lastCount = pageSize;
|
||||||
|
List<Exception> errorList = new ArrayList<>();
|
||||||
while (lastCount == pageSize) {
|
while (lastCount == pageSize) {
|
||||||
try {
|
try {
|
||||||
lastCount = consumer.accept(pageNum, pageSize);
|
lastCount = consumer.accept(pageNum, pageSize);
|
||||||
coreLogProcess.setTotal(coreLogProcess.getTotal() + lastCount);
|
coreLogProcess.setTotal(coreLogProcess.getTotal() + lastCount);
|
||||||
coreLogProcess.setProcess(coreLogProcess.getTotal());
|
coreLogProcess.setProcess(coreLogProcess.getTotal());
|
||||||
|
coreLogProcess.setError(JSONUtil.toJsonStr(errorList));
|
||||||
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + lastCount);
|
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + lastCount);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
coreLogProcess.setError(coreLogProcess.getError() + ";" + JSONUtil.toJsonStr(e));
|
errorList.add(e);
|
||||||
}
|
}
|
||||||
coreLogProcessMapper.updateById(coreLogProcess);
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
pageNum++;
|
pageNum++;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行结束
|
// 执行结束
|
||||||
|
coreLogProcess.setError(JSONUtil.toJsonStr(errorList));
|
||||||
coreLogProcess.setStatus(1);
|
coreLogProcess.setStatus(1);
|
||||||
coreLogProcessMapper.updateById(coreLogProcess);
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -28,10 +28,38 @@ public class CoreMessageService {
|
|||||||
CoreLogMessageMapper coreLogMessageMapper;
|
CoreLogMessageMapper coreLogMessageMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入数据
|
||||||
|
*
|
||||||
|
* @param reqResp
|
||||||
|
*/
|
||||||
|
private void insertMessageLog(MessageReqResp reqResp) {
|
||||||
|
if (reqResp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送所有消息
|
||||||
|
*
|
||||||
|
* @param userIds
|
||||||
|
* @param body
|
||||||
|
*/
|
||||||
|
public void all(List<String> userIds, JSONObject body) {
|
||||||
|
messageSenderList.stream().filter(TieshengMessageSender::support)
|
||||||
|
.forEach(sender -> {
|
||||||
|
for (String user : userIds) {
|
||||||
|
insertMessageLog(sender.send(user, body));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
* @param title
|
* @param channels
|
||||||
* @param body
|
* @param body
|
||||||
* @param channels 消息通道,如果为all时,表示发送全部通道
|
* @param channels 消息通道,如果为all时,表示发送全部通道
|
||||||
*/
|
*/
|
||||||
@@ -41,12 +69,8 @@ public class CoreMessageService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
messageSenderList.stream().filter(TieshengMessageSender::support)
|
messageSenderList.stream().filter(TieshengMessageSender::support)
|
||||||
.forEach(sender -> {
|
.forEach(sender -> channels.stream().filter(it -> Objects.equals(it.getChannel(), sender.getChannel()))
|
||||||
channels.stream().filter(it -> Objects.equals(it.getChannel(), sender.getChannel())).forEach(it -> {
|
.forEach(it -> insertMessageLog(sender.send(it.getUser(), body))));
|
||||||
MessageReqResp reqResp = sender.send(it.getUser(), body);
|
|
||||||
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -54,7 +78,6 @@ public class CoreMessageService {
|
|||||||
* 发送消息
|
* 发送消息
|
||||||
*
|
*
|
||||||
* @param userChannel
|
* @param userChannel
|
||||||
* @param title
|
|
||||||
* @param body
|
* @param body
|
||||||
*/
|
*/
|
||||||
public MessageReqResp send(UserChannel userChannel, JSONObject body) {
|
public MessageReqResp send(UserChannel userChannel, JSONObject body) {
|
||||||
@@ -67,7 +90,7 @@ public class CoreMessageService {
|
|||||||
sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support());
|
sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support());
|
||||||
if (messageSender != null) {
|
if (messageSender != null) {
|
||||||
MessageReqResp reqResp = messageSender.send(userChannel.getUser(), body);
|
MessageReqResp reqResp = messageSender.send(userChannel.getUser(), body);
|
||||||
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
|
insertMessageLog(reqResp);
|
||||||
return reqResp;
|
return reqResp;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.tiesheng.login.pojos.DoLoginInfo;
|
|||||||
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
import com.tiesheng.login.service.TieshengLoginConfigurer;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
|
||||||
@@ -23,6 +24,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
CoreLogService coreLogService;
|
CoreLogService coreLogService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public TokenBean doLogin(DoLoginInfo loginInfo) {
|
public TokenBean doLogin(DoLoginInfo loginInfo) {
|
||||||
|
|
||||||
CorePlatformUnique platformUnique = getOneByColumn("unique_id", loginInfo.getUnique());
|
CorePlatformUnique platformUnique = getOneByColumn("unique_id", loginInfo.getUnique());
|
||||||
@@ -48,6 +50,10 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
tieshengWebConfigurer.redirect(bean, to, extra, response);
|
tieshengWebConfigurer.redirect(bean, to, extra, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onSignError(HttpServletResponse response) {
|
||||||
|
tieshengWebConfigurer.onSignError(response);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新用户id
|
* 更新用户id
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -13,6 +14,7 @@ import java.io.File;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,6 +39,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);
|
||||||
|
|
||||||
@@ -153,12 +160,7 @@ public class FileUploadService {
|
|||||||
//将文件数组转成list,并排序
|
//将文件数组转成list,并排序
|
||||||
List<File> chunkFileList = new ArrayList<>(Arrays.asList(chunkFiles));
|
List<File> chunkFileList = new ArrayList<>(Arrays.asList(chunkFiles));
|
||||||
//排序
|
//排序
|
||||||
chunkFileList.sort((o1, o2) -> {
|
chunkFileList.sort(Comparator.comparingInt(o -> Integer.parseInt(o.getName())));
|
||||||
if (Integer.parseInt(o1.getName()) > Integer.parseInt(o2.getName())) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
return chunkFileList;
|
return chunkFileList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,8 +5,10 @@ import com.tiesheng.core.pojos.RequestUserInfo;
|
|||||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
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.ServletKit;
|
||||||
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 +47,16 @@ public interface TieshengWebConfigurer {
|
|||||||
default void uploadFileCheck(String fileExt) {
|
default void uploadFileCheck(String fileExt) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自定义文件上传
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
default String uploadFileCustomize(MultipartFile file) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 上传文件后处理文件
|
* 上传文件后处理文件
|
||||||
*
|
*
|
||||||
@@ -80,5 +92,11 @@ public interface TieshengWebConfigurer {
|
|||||||
*/
|
*/
|
||||||
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 签名错误的时候
|
||||||
|
*/
|
||||||
|
default void onSignError(HttpServletResponse response) {
|
||||||
|
ServletKit.write(response, "404", "text");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ CREATE TABLE `core_log_operation`
|
|||||||
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
|
||||||
`title` varchar(255) DEFAULT NULL COMMENT '标题',
|
`title` varchar(255) DEFAULT NULL COMMENT '标题',
|
||||||
`subject` varchar(500) DEFAULT NULL COMMENT '小标题',
|
`subject` varchar(500) DEFAULT NULL COMMENT '小标题',
|
||||||
`params` text COMMENT '其他参数',
|
`params` longtext COMMENT '其他参数',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-操作';
|
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-操作';
|
||||||
|
|||||||
@@ -19,4 +19,9 @@
|
|||||||
id, create_time, update_time, is_deleted, user_id, user_name, title, subject, params
|
id, create_time, update_time, is_deleted, user_id, user_name, title, subject, params
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
|
<select id="page" resultMap="BaseResultMap">
|
||||||
|
select id,create_time,update_time,is_deleted,user_name,user_id,title,subject from core_log_operation
|
||||||
|
${ew.customSqlSegment}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user