Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8854225934 | ||
|
|
5ad35cefda | ||
|
|
1921efa27b | ||
|
|
2e9de7ee64 | ||
|
|
e352927396 | ||
|
|
51b26c077d | ||
|
|
2c5f55a876 | ||
|
|
c52f7f5c77 | ||
|
|
7f46d2d371 | ||
|
|
34d8201641 | ||
|
|
92e1c1d9ef | ||
|
|
ee3748c361 | ||
|
|
439947caad | ||
|
|
17706e8065 | ||
|
|
8853e3170d | ||
|
|
222f37afc1 | ||
|
|
f8bc11d456 | ||
|
|
1ea7fa968b | ||
|
|
c892fec45b | ||
|
|
7e94ea54a8 | ||
|
|
d006788c90 | ||
|
|
c63a6769ad | ||
|
|
156cce877b | ||
|
|
49d88ee08f | ||
|
|
88777898c4 | ||
|
|
3f59d00092 | ||
|
|
2e8969f249 | ||
|
|
ebb99ced78 | ||
|
|
e862cdbf43 | ||
|
|
d6faed4f68 | ||
|
|
ec4b0cbb1e | ||
|
|
30fd68d430 | ||
|
|
ec865471cb | ||
|
|
7d454e9c62 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,4 +4,4 @@ rebel.xml
|
|||||||
/.idea/
|
/.idea/
|
||||||
*.iml
|
*.iml
|
||||||
/static/
|
/static/
|
||||||
/ipdb/
|
/config/
|
||||||
|
|||||||
78
pom.xml
78
pom.xml
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -55,57 +55,57 @@
|
|||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-db-migration</artifactId>
|
<artifactId>springboot-db-migration</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -120,8 +120,44 @@
|
|||||||
<version>3.5.1</version>
|
<version>3.5.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|
||||||
|
<pluginRepositories>
|
||||||
|
<pluginRepository>
|
||||||
|
<id>kepai-repo-plugin</id>
|
||||||
|
<url>http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master</url>
|
||||||
|
</pluginRepository>
|
||||||
|
</pluginRepositories>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.tiesheng.springboot-plugin</groupId>
|
||||||
|
<artifactId>launcher-maven-plugin</artifactId>
|
||||||
|
<version>0.0.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>initScript</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<!-- 把外部jar打包进入项目中 -->
|
||||||
|
<includeSystemScope>true</includeSystemScope>
|
||||||
|
<!-- 打包后的jar可直接执行 -->
|
||||||
|
<executable>true</executable>
|
||||||
|
<embeddedLaunchScript>${basedir}/target/launchScript</embeddedLaunchScript>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
@@ -29,14 +29,15 @@
|
|||||||
<repository>
|
<repository>
|
||||||
<id>kepai-repo</id>
|
<id>kepai-repo</id>
|
||||||
<url>http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master</url>
|
<url>http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master</url>
|
||||||
<releases>
|
|
||||||
<enabled>true</enabled>
|
|
||||||
</releases>
|
|
||||||
</repository>
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>com.tiesheng.springboot-plugin</groupId>
|
||||||
|
<artifactId>launcher-maven-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
|
|||||||
@@ -1,19 +1,53 @@
|
|||||||
package com.tiesheng.demo.config;
|
package com.tiesheng.demo.config;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.tiesheng.core.pojos.CurrentWebUser;
|
import com.tiesheng.core.pojos.CurrentWebUser;
|
||||||
|
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||||
import com.tiesheng.core.service.TieshengWebConfigurer;
|
import com.tiesheng.core.service.TieshengWebConfigurer;
|
||||||
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
|
import com.tiesheng.util.config.GlobalConfig;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
@Component
|
@Component
|
||||||
public class DemoWebConfigurer implements TieshengWebConfigurer {
|
public class DemoWebConfigurer implements TieshengWebConfigurer {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
GlobalConfig globalConfig;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CurrentWebUser getCurrentUserName(String userId) {
|
public CurrentWebUser getCurrentUserName(TokenBean tokenBean) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginConfigurer loginConfigurer() {
|
public LoginConfigurer loginConfigurer() {
|
||||||
return null;
|
return new LoginConfigurer() {
|
||||||
|
@Override
|
||||||
|
public TokenBean doLogin(CorePlatformUnique platformUnique, String to) {
|
||||||
|
|
||||||
|
// 默认跳转到mobile
|
||||||
|
to = StrUtil.emptyToDefault(to, "mobile");
|
||||||
|
|
||||||
|
TokenBean tokenBean = null;
|
||||||
|
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
||||||
|
tokenBean = new TokenBean(platformUnique.getUserId(), to, globalConfig.getService());
|
||||||
|
} else {
|
||||||
|
// 获取用户信息判断是否可登录
|
||||||
|
}
|
||||||
|
|
||||||
|
return tokenBean;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
|
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
|
||||||
|
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
package com.tiesheng.demo.controller;
|
package com.tiesheng.demo.controller;
|
||||||
|
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import cn.hutool.log.LogFactory;
|
||||||
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.message.config.aliyun.AliyunSmsConfig;
|
import com.tiesheng.message.config.aliyun.AliyunSmsConfig;
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
import com.tiesheng.message.pojos.MessageReqResp;
|
||||||
import com.tiesheng.util.config.GlobalConfig;
|
import com.tiesheng.util.config.GlobalConfig;
|
||||||
@@ -24,17 +27,24 @@ public class TestController {
|
|||||||
GlobalConfig globalConfig;
|
GlobalConfig globalConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
AliyunSmsConfig aliyunSmsConfig;
|
AliyunSmsConfig aliyunSmsConfig;
|
||||||
|
@Autowired
|
||||||
|
TsTokenConfig tsTokenConfig;
|
||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public ApiResp<String> index() {
|
public ApiResp<String> index() {
|
||||||
|
|
||||||
|
TokenBean tokenBean = new TokenBean("11", "", "fdfd");
|
||||||
|
LogFactory.get().info(tokenBean.toToken());
|
||||||
|
|
||||||
return ApiResp.respOK("hello world");
|
return ApiResp.respOK("hello world");
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/redirect")
|
@RequestMapping("/redirect")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public void redirect(HttpServletResponse response) {
|
public void redirect(HttpServletResponse response) {
|
||||||
globalConfig.redirect("mobile", "/test", response);
|
tsTokenConfig.validToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzYwMDY4NzUsImlkIjoiMSIsImVudmlyb25tZW50VHlwZSI6Im1vYmlsZSIsInNlcnZpY2UiOiJjb250ZXN0LXJlc2VydmUiLCJleHRyYSI6IiJ9.nsfxEFpCNHC7eNCS5DJXdu1VDdnHrTjSfgrozND70Lc", true);
|
||||||
|
// globalConfig.redirect("mobile", "/test", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -66,7 +76,7 @@ public class TestController {
|
|||||||
@RequestMapping("/uploadPath")
|
@RequestMapping("/uploadPath")
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public ApiResp<String> uploadPath() {
|
public ApiResp<String> uploadPath() {
|
||||||
FileUploadPath uploadPath = FileUploadPath.get("http://scv6.tmp.kepai365.ltd/upload/2023-01/2b4b6b7b-70d0-4683-859a-f799adc4f04c.xls");
|
FileUploadPath uploadPath = FileUploadPath.file("http://scv6.tmp.kepai365.ltd/upload/2023-01/2b4b6b7b-70d0-4683-859a-f799adc4f04c.xls");
|
||||||
return ApiResp.respOK(uploadPath.getAbsolutePath());
|
return ApiResp.respOK(uploadPath.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
28
springboot-ademo/src/main/resources/application-test.yml
Normal file
28
springboot-ademo/src/main/resources/application-test.yml
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
## Spring配置
|
||||||
|
spring:
|
||||||
|
|
||||||
|
## 数据库配置
|
||||||
|
datasource:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://47.96.30.85:3306/com_tiesheng_web?useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&queryTimeout=5400&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||||
|
username: com_tiesheng_web
|
||||||
|
password: 4Xo$XheGFc
|
||||||
|
|
||||||
|
platform:
|
||||||
|
wxmp:
|
||||||
|
global:
|
||||||
|
app-id: wxa0343fe519824651
|
||||||
|
app-secret: 776f089ba70bcd66455a7c7893f810b9
|
||||||
|
|
||||||
|
tiesheng:
|
||||||
|
token:
|
||||||
|
ignores:
|
||||||
|
"1111":
|
||||||
|
id: "1111"
|
||||||
|
global:
|
||||||
|
version: 2
|
||||||
|
host: http://localhost:8080
|
||||||
|
aliyun:
|
||||||
|
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
||||||
|
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
||||||
|
sign-name: 阿里云短信测试
|
||||||
@@ -1,28 +1,21 @@
|
|||||||
|
server:
|
||||||
|
compression:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
## Spring配置
|
## Spring配置
|
||||||
spring:
|
spring:
|
||||||
|
|
||||||
## 数据库配置
|
servlet:
|
||||||
datasource:
|
multipart:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
max-file-size: 20MB
|
||||||
url: jdbc:mysql://47.96.30.85:3306/com_tiesheng_web?useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&queryTimeout=5400&allowMultiQueries=true&serverTimezone=GMT%2B8
|
web:
|
||||||
username: com_tiesheng_web
|
resources:
|
||||||
password: 4Xo$XheGFc
|
static-locations: classpath:/static/,file:static/
|
||||||
|
mvc:
|
||||||
|
pathmatch:
|
||||||
|
matching-strategy: ant_path_matcher
|
||||||
|
|
||||||
platform:
|
## 日志
|
||||||
wxmp:
|
logging:
|
||||||
global:
|
file:
|
||||||
app-id: wxa0343fe519824651
|
name: logs/tiesheng.log
|
||||||
app-secret: 776f089ba70bcd66455a7c7893f810b9
|
|
||||||
|
|
||||||
tiesheng:
|
|
||||||
token:
|
|
||||||
ignores:
|
|
||||||
"1111":
|
|
||||||
id: "1111"
|
|
||||||
global:
|
|
||||||
version: 2
|
|
||||||
host: http://localhost:8080
|
|
||||||
aliyun:
|
|
||||||
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
|
||||||
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
|
||||||
sign-name: 阿里云短信测试
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-db-migration</artifactId>
|
<artifactId>springboot-db-migration</artifactId>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
@@ -31,12 +31,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
@@ -27,12 +27,12 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.tiesheng.login.config.token;
|
package com.tiesheng.login.config.token;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
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.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
import cn.hutool.jwt.JWT;
|
import cn.hutool.jwt.JWT;
|
||||||
|
import cn.hutool.jwt.JWTValidator;
|
||||||
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.ServletKit;
|
||||||
import com.tiesheng.util.exception.ApiException;
|
import com.tiesheng.util.exception.ApiException;
|
||||||
@@ -66,10 +68,21 @@ public class TsTokenConfig {
|
|||||||
/**
|
/**
|
||||||
* 验证token
|
* 验证token
|
||||||
*
|
*
|
||||||
|
* @param thrExp
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public TokenBean validToken(boolean thrExp) {
|
public TokenBean validToken(boolean thrExp) {
|
||||||
String token = ServletUtil.getHeader(ServletKit.getRequest(), "token", "utf-8");
|
String token = ServletUtil.getHeader(ServletKit.getRequest(), "token", "utf-8");
|
||||||
|
return validToken(token, thrExp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验证token
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public TokenBean validToken(String token, boolean thrExp) {
|
||||||
TokenBean tokenBean = isIgnored(token);
|
TokenBean tokenBean = isIgnored(token);
|
||||||
if (tokenBean != null) {
|
if (tokenBean != null) {
|
||||||
return tokenBean;
|
return tokenBean;
|
||||||
@@ -77,15 +90,11 @@ public class TsTokenConfig {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
JWT decode = JWT.of(token);
|
JWT decode = JWT.of(token);
|
||||||
|
JWTValidator.of(decode).validateDate();
|
||||||
String id = decode.getPayload("id").toString();
|
String id = decode.getPayload("id").toString();
|
||||||
String environmentType = decode.getPayload("environmentType").toString();
|
String environmentType = decode.getPayload("environmentType").toString();
|
||||||
String service = decode.getPayload("service").toString();
|
String service = decode.getPayload("service").toString();
|
||||||
String extra = decode.getPayload("extra").toString();
|
String extra = decode.getPayload("extra").toString();
|
||||||
Long expireTime = decode.getPayloads().getLong("time");
|
|
||||||
if (expireTime != null && expireTime < System.currentTimeMillis()) {
|
|
||||||
throw new ApiException("登录过期,请重新登陆");
|
|
||||||
}
|
|
||||||
|
|
||||||
tokenBean = new TokenBean(id, environmentType, service);
|
tokenBean = new TokenBean(id, environmentType, service);
|
||||||
tokenBean.setExtra(extra);
|
tokenBean.setExtra(extra);
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.tiesheng.login.config.token.bean;
|
package com.tiesheng.login.config.token.bean;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
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;
|
||||||
@@ -31,11 +32,11 @@ public class TokenBean {
|
|||||||
public String toToken() {
|
public String toToken() {
|
||||||
TsTokenConfig tsTokenConfig = SpringUtil.getBean(TsTokenConfig.class);
|
TsTokenConfig tsTokenConfig = SpringUtil.getBean(TsTokenConfig.class);
|
||||||
return JWT.create()
|
return JWT.create()
|
||||||
|
.setExpiresAt(DateUtil.offsetHour(DateUtil.date(), tsTokenConfig.getExpireHours()))
|
||||||
.setPayload("id", getId())
|
.setPayload("id", getId())
|
||||||
.setPayload("environmentType", getEnvironmentType())
|
.setPayload("environmentType", getEnvironmentType())
|
||||||
.setPayload("service", getService())
|
.setPayload("service", getService())
|
||||||
.setPayload("extra", getExtra())
|
.setPayload("extra", getExtra())
|
||||||
.setPayload("time", System.currentTimeMillis() + tsTokenConfig.getExpireHours() * 1000 * 60 * 60)
|
|
||||||
.setKey(tsTokenConfig.getEncryptKey().getBytes())
|
.setKey(tsTokenConfig.getEncryptKey().getBytes())
|
||||||
.sign();
|
.sign();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
package com.tiesheng.login.pojos;
|
package com.tiesheng.login.pojos;
|
||||||
|
|
||||||
public class CodeExtraDTO {
|
public class CodeExtraDTO extends LoginToInfo {
|
||||||
|
|
||||||
private String code;
|
private String code;
|
||||||
private String extra;
|
private String extra;
|
||||||
private String to;
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
@@ -26,11 +25,4 @@ public class CodeExtraDTO {
|
|||||||
this.extra = extra;
|
this.extra = extra;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTo(String to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.tiesheng.login.pojos;
|
||||||
|
|
||||||
|
public class LoginToInfo {
|
||||||
|
|
||||||
|
private String to;
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// setter\getter
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getTo() {
|
||||||
|
return to;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTo(String to) {
|
||||||
|
this.to = to;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,10 +2,9 @@ package com.tiesheng.login.pojos;
|
|||||||
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
|
||||||
public class UniqueIndexDTO {
|
public class UniqueIndexDTO extends LoginToInfo {
|
||||||
|
|
||||||
private String no;
|
private String no;
|
||||||
private String to;
|
|
||||||
private String extra;
|
private String extra;
|
||||||
private String info;
|
private String info;
|
||||||
|
|
||||||
@@ -21,14 +20,6 @@ public class UniqueIndexDTO {
|
|||||||
this.no = no;
|
this.no = no;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTo(String to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getExtra() {
|
public String getExtra() {
|
||||||
if (StrUtil.isEmpty(extra)) {
|
if (StrUtil.isEmpty(extra)) {
|
||||||
extra = "";
|
extra = "";
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import java.io.RandomAccessFile;
|
|||||||
public class Ip2regionConfig {
|
public class Ip2regionConfig {
|
||||||
|
|
||||||
private String dbUrl = "http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master/ipdb/ip2region.db";
|
private String dbUrl = "http://git.kepai365.com/zeng_wenhao/kepai-repo/raw/master/ipdb/ip2region.db";
|
||||||
private String dbPath = System.getProperty("user.dir") + "/ipdb/ip2region.db";
|
private String dbPath = System.getProperty("user.dir") + "/config/ip2region.db";
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 逻辑方法
|
// 逻辑方法
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.tiesheng.util.pojos;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.CharUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
@@ -29,19 +30,26 @@ public class FileUploadPath {
|
|||||||
* @param fileName
|
* @param fileName
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static FileUploadPath get(String fileName) {
|
public static FileUploadPath file(String fileName) {
|
||||||
|
|
||||||
// 下载文件
|
// 下载文件
|
||||||
fileName = downloadFile(fileName);
|
fileName = fileDownload(fileName);
|
||||||
|
|
||||||
FileUploadPath pathBean = new FileUploadPath();
|
FileUploadPath pathBean = new FileUploadPath();
|
||||||
|
|
||||||
String tempPath = fileName;
|
String tempPath = fileName;
|
||||||
|
if (!StrUtil.startWith(tempPath, CharUtil.SLASH)) {
|
||||||
|
tempPath = CharUtil.SLASH + tempPath;
|
||||||
|
}
|
||||||
if (!StrUtil.startWith(tempPath, UPLOAD_FOLDER)) {
|
if (!StrUtil.startWith(tempPath, UPLOAD_FOLDER)) {
|
||||||
tempPath = UPLOAD_FOLDER + DateUtil.format(DateUtil.date(), "yyyy-MM") + "/" + fileName;
|
tempPath = UPLOAD_FOLDER + DateUtil.format(DateUtil.date(), "yyyy-MM") + CharUtil.SLASH + fileName;
|
||||||
}
|
}
|
||||||
pathBean.setHttpPath(tempPath);
|
pathBean.setHttpPath(tempPath);
|
||||||
pathBean.setAbsolutePath(String.format("%s/static%s", System.getProperty("user.dir"), tempPath));
|
|
||||||
|
String tempAbs = String.format("%s/static%s", System.getProperty("user.dir"), tempPath);
|
||||||
|
tempAbs = FileUtil.normalize(tempAbs);
|
||||||
|
pathBean.setAbsolutePath(tempAbs);
|
||||||
|
|
||||||
FileUtil.mkParentDirs(pathBean.getAbsolutePath());
|
FileUtil.mkParentDirs(pathBean.getAbsolutePath());
|
||||||
|
|
||||||
return pathBean;
|
return pathBean;
|
||||||
@@ -51,40 +59,33 @@ public class FileUploadPath {
|
|||||||
/**
|
/**
|
||||||
* 下载http文件
|
* 下载http文件
|
||||||
*
|
*
|
||||||
* @param fileName
|
* @param httpUrl
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String downloadFile(String fileName) {
|
public static String fileDownload(String httpUrl) {
|
||||||
if (!StrUtil.startWith(fileName, "http")) {
|
if (!StrUtil.startWith(httpUrl, "http")) {
|
||||||
return fileName;
|
return httpUrl;
|
||||||
}
|
}
|
||||||
String newFileName = UPLOAD_FOLDER + StrUtil.subAfter(fileName, UPLOAD_FOLDER, true);
|
String newFileName = UPLOAD_FOLDER + StrUtil.subAfter(httpUrl, UPLOAD_FOLDER, true);
|
||||||
FileUploadPath uploadPath = get(newFileName);
|
FileUploadPath uploadPath = file(newFileName);
|
||||||
if (!FileUtil.exist(uploadPath.getAbsolutePath())) {
|
if (!FileUtil.exist(uploadPath.getAbsolutePath())) {
|
||||||
HttpUtil.downloadFile(fileName, uploadPath.getAbsolutePath());
|
HttpUtil.downloadFile(httpUrl, uploadPath.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
return uploadPath.getHttpPath();
|
return uploadPath.getHttpPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 随机生成一个文件路径
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
public static FileUploadPath random() {
|
|
||||||
return get(IdUtil.simpleUUID());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 随机生成一个文件路径
|
* 随机生成一个文件路径
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static FileUploadPath random(String fileExt) {
|
public static FileUploadPath random(String fileExt) {
|
||||||
return get(IdUtil.simpleUUID() + "." + fileExt);
|
String fileName = IdUtil.simpleUUID();
|
||||||
|
if (!StrUtil.isEmpty(fileExt)) {
|
||||||
|
fileName = fileName + "." + fileExt;
|
||||||
|
}
|
||||||
|
return file(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -95,20 +96,9 @@ public class FileUploadPath {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static FileUploadPath folder(String folder) {
|
public static FileUploadPath folder(String folder) {
|
||||||
FileUploadPath pathBean = new FileUploadPath();
|
FileUploadPath file = file(folder);
|
||||||
|
FileUtil.mkdir(file.getAbsolutePath());
|
||||||
String tempFolder = folder;
|
return file;
|
||||||
if (!StrUtil.startWith(tempFolder, UPLOAD_FOLDER)) {
|
|
||||||
tempFolder = UPLOAD_FOLDER + tempFolder;
|
|
||||||
}
|
|
||||||
if (!StrUtil.endWith(folder, "/")) {
|
|
||||||
tempFolder = tempFolder + "/";
|
|
||||||
}
|
|
||||||
pathBean.setHttpPath(tempFolder);
|
|
||||||
pathBean.setAbsolutePath(String.format("%s/static%s", System.getProperty("user.dir"), tempFolder));
|
|
||||||
FileUtil.mkParentDirs(pathBean.getAbsolutePath());
|
|
||||||
|
|
||||||
return pathBean;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -4,9 +4,9 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.1.3</version>
|
<version>0.3.0</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
@@ -58,32 +58,32 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-db-migration</artifactId>
|
<artifactId>springboot-db-migration</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|||||||
@@ -108,8 +108,8 @@ public class ToolController {
|
|||||||
*/
|
*/
|
||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
@PostMapping("/file/chunk_merge")
|
@PostMapping("/file/chunk_merge")
|
||||||
public ApiResp<String> fileChunkMerge(String fileMd5) {
|
public ApiResp<String> fileChunkMerge(String fileMd5, String fileExt) {
|
||||||
String path = fileUploadService.chunkMerge(fileMd5);
|
String path = fileUploadService.chunkMerge(fileMd5, fileExt);
|
||||||
return ApiResp.respOK(path);
|
return ApiResp.respOK(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.tiesheng.core.pojos.dao.CoreLogMessage;
|
|||||||
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
import com.tiesheng.core.pojos.dao.CoreLogOperation;
|
||||||
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
import com.tiesheng.message.pojos.MessageReqResp;
|
||||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
||||||
import com.tiesheng.util.ServletKit;
|
import com.tiesheng.util.ServletKit;
|
||||||
@@ -53,7 +54,7 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
*/
|
*/
|
||||||
public void addOperationLog(String title, String subject, Object params) {
|
public void addOperationLog(String title, String subject, Object params) {
|
||||||
CoreLogOperation operation = new CoreLogOperation();
|
CoreLogOperation operation = new CoreLogOperation();
|
||||||
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName(TsTokenConfig.get().getId());
|
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName(TsTokenConfig.get());
|
||||||
operation.setUserId(currentWebUser.getId());
|
operation.setUserId(currentWebUser.getId());
|
||||||
operation.setUserName(currentWebUser.getName());
|
operation.setUserName(currentWebUser.getName());
|
||||||
operation.setTitle(title);
|
operation.setTitle(title);
|
||||||
@@ -72,8 +73,9 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
* 添加登录日志
|
* 添加登录日志
|
||||||
*
|
*
|
||||||
* @param platformUnique
|
* @param platformUnique
|
||||||
|
* @param tokenBean
|
||||||
*/
|
*/
|
||||||
public void addLoginLog(CorePlatformUnique platformUnique) {
|
public void addLoginLog(CorePlatformUnique platformUnique, TokenBean tokenBean) {
|
||||||
|
|
||||||
HttpServletRequest request = ServletKit.getRequest();
|
HttpServletRequest request = ServletKit.getRequest();
|
||||||
String ip = ServletUtil.getClientIP(request);
|
String ip = ServletUtil.getClientIP(request);
|
||||||
@@ -82,7 +84,7 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
login.setUserId(platformUnique.getUserId());
|
login.setUserId(platformUnique.getUserId());
|
||||||
login.setPlatform(platformUnique.getPlatform());
|
login.setPlatform(platformUnique.getPlatform());
|
||||||
|
|
||||||
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName(platformUnique.getUserId());
|
CurrentWebUser currentWebUser = tieshengWebConfigurer.getCurrentUserName(tokenBean);
|
||||||
login.setUserName(currentWebUser.getName());
|
login.setUserName(currentWebUser.getName());
|
||||||
|
|
||||||
login.setIp(ip);
|
login.setIp(ip);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
saveOrUpdate(platformUnique);
|
saveOrUpdate(platformUnique);
|
||||||
|
|
||||||
// 添加登录日志
|
// 添加登录日志
|
||||||
coreLogService.addLoginLog(platformUnique);
|
coreLogService.addLoginLog(platformUnique,tokenBean);
|
||||||
}
|
}
|
||||||
return tokenBean;
|
return tokenBean;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ public class FileUploadService {
|
|||||||
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
|
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
|
||||||
tieshengWebConfigurer.uploadFileCheck(fileType);
|
tieshengWebConfigurer.uploadFileCheck(fileType);
|
||||||
|
|
||||||
FileUploadPath filePath = FileUploadPath.random();
|
FileUploadPath filePath = FileUploadPath.random(fileType);
|
||||||
|
|
||||||
InputStream stream = file.getInputStream();
|
InputStream stream = file.getInputStream();
|
||||||
FileUtil.writeFromStream(stream, filePath.getAbsolutePath());
|
FileUtil.writeFromStream(stream, filePath.getAbsolutePath());
|
||||||
@@ -107,7 +107,7 @@ public class FileUploadService {
|
|||||||
*
|
*
|
||||||
* @param fileMd5
|
* @param fileMd5
|
||||||
*/
|
*/
|
||||||
public String chunkMerge(String fileMd5) {
|
public String chunkMerge(String fileMd5, String fileExt) {
|
||||||
|
|
||||||
// 1,获取文件块的目录
|
// 1,获取文件块的目录
|
||||||
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
FileUploadPath folder = FileUploadPath.folder(fileMd5);
|
||||||
@@ -118,7 +118,7 @@ public class FileUploadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3,生成保存文件的路径
|
// 3,生成保存文件的路径
|
||||||
FileUploadPath uploadPath = FileUploadPath.random();
|
FileUploadPath uploadPath = FileUploadPath.random(fileExt);
|
||||||
|
|
||||||
// 4,获取块文件,此列表是已经排好序的列表
|
// 4,获取块文件,此列表是已经排好序的列表
|
||||||
List<File> chunkFiles = getSortedChunkFiles(new File(folder.getAbsolutePath()));
|
List<File> chunkFiles = getSortedChunkFiles(new File(folder.getAbsolutePath()));
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public interface TieshengWebConfigurer {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CurrentWebUser getCurrentUserName(String userId);
|
CurrentWebUser getCurrentUserName(TokenBean userId);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
server:
|
|
||||||
compression:
|
|
||||||
enabled: true
|
|
||||||
|
|
||||||
## Spring配置
|
|
||||||
spring:
|
|
||||||
|
|
||||||
servlet:
|
|
||||||
multipart:
|
|
||||||
max-file-size: 20MB
|
|
||||||
web:
|
|
||||||
resources:
|
|
||||||
static-locations: classpath:/static/,file:static/
|
|
||||||
mvc:
|
|
||||||
pathmatch:
|
|
||||||
matching-strategy: ant_path_matcher
|
|
||||||
|
|
||||||
## 日志
|
|
||||||
logging:
|
|
||||||
file:
|
|
||||||
name: logs/tiesheng.log
|
|
||||||
Reference in New Issue
Block a user