Compare commits

...

3 Commits
0.1.6 ... 0.1.7

Author SHA1 Message Date
曾文豪
3f59d00092 publish 0.1.7 2023-01-12 11:58:44 +08:00
曾文豪
2e8969f249 perf:文件上传保留后缀 2023-01-12 11:58:23 +08:00
曾文豪
ebb99ced78 perf:增加登录例子 2023-01-11 16:43:33 +08:00
14 changed files with 60 additions and 26 deletions

20
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -57,55 +57,55 @@
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-db-migration</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-login</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-web</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-util</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-platform</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-message</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-encrypt</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-annotation</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-poi</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</dependency>
<dependency>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-ademo</artifactId>

View File

@@ -1,12 +1,23 @@
package com.tiesheng.demo.config;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.core.pojos.CurrentWebUser;
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
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 javax.servlet.http.HttpServletResponse;
import java.util.Objects;
@Component
public class DemoWebConfigurer implements TieshengWebConfigurer {
@Autowired
GlobalConfig globalConfig;
@Override
public CurrentWebUser getCurrentUserName(String userId) {
return null;
@@ -14,6 +25,29 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
@Override
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);
}
}
};
}
}

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-db-migration</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-encrypt</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-message</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-platform</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-poi</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-util</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.1.6</version>
<version>0.1.7</version>
</parent>
<artifactId>springboot-web</artifactId>

View File

@@ -108,8 +108,8 @@ public class ToolController {
*/
@TokenIgnore
@PostMapping("/file/chunk_merge")
public ApiResp<String> fileChunkMerge(String fileMd5) {
String path = fileUploadService.chunkMerge(fileMd5);
public ApiResp<String> fileChunkMerge(String fileMd5, String fileExt) {
String path = fileUploadService.chunkMerge(fileMd5, fileExt);
return ApiResp.respOK(path);
}

View File

@@ -40,7 +40,7 @@ public class FileUploadService {
String fileType = FileTypeUtil.getType(file.getInputStream(), file.getOriginalFilename());
tieshengWebConfigurer.uploadFileCheck(fileType);
FileUploadPath filePath = FileUploadPath.random();
FileUploadPath filePath = FileUploadPath.random(fileType);
InputStream stream = file.getInputStream();
FileUtil.writeFromStream(stream, filePath.getAbsolutePath());
@@ -107,7 +107,7 @@ public class FileUploadService {
*
* @param fileMd5
*/
public String chunkMerge(String fileMd5) {
public String chunkMerge(String fileMd5, String fileExt) {
// 1获取文件块的目录
FileUploadPath folder = FileUploadPath.folder(fileMd5);
@@ -118,7 +118,7 @@ public class FileUploadService {
}
// 3生成保存文件的路径
FileUploadPath uploadPath = FileUploadPath.random();
FileUploadPath uploadPath = FileUploadPath.random(fileExt);
// 4获取块文件此列表是已经排好序的列表
List<File> chunkFiles = getSortedChunkFiles(new File(folder.getAbsolutePath()));