Compare commits

..

9 Commits
0.1.3 ... 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
曾文豪
e862cdbf43 publish 0.1.6 2023-01-11 16:32:29 +08:00
曾文豪
d6faed4f68 perf:调整授权登录 2023-01-11 16:32:16 +08:00
曾文豪
ec4b0cbb1e publish 0.1.5 2023-01-11 16:25:38 +08:00
曾文豪
30fd68d430 perf:调整授权登录 2023-01-11 16:25:27 +08:00
曾文豪
ec865471cb publish 0.1.4 2023-01-11 15:46:14 +08:00
曾文豪
7d454e9c62 perf:调整授权登录 2023-01-11 15:46:02 +08:00
17 changed files with 80 additions and 45 deletions

20
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-parent</artifactId> <artifactId>springboot-parent</artifactId>
<version>0.1.3</version> <version>0.1.7</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</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-db-migration</artifactId> <artifactId>springboot-db-migration</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-login</artifactId> <artifactId>springboot-login</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-web</artifactId> <artifactId>springboot-web</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-util</artifactId> <artifactId>springboot-util</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-platform</artifactId> <artifactId>springboot-platform</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-message</artifactId> <artifactId>springboot-message</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-encrypt</artifactId> <artifactId>springboot-encrypt</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-annotation</artifactId> <artifactId>springboot-annotation</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.tiesheng</groupId> <groupId>com.tiesheng</groupId>
<artifactId>springboot-poi</artifactId> <artifactId>springboot-poi</artifactId>
<version>0.1.3</version> <version>0.1.7</version>
</dependency> </dependency>
<dependency> <dependency>

View File

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

View File

@@ -1,12 +1,23 @@
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(String userId) {
return null; return null;
@@ -14,6 +25,29 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
@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);
}
}
};
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

@@ -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;
}
} }

View File

@@ -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;
}
}

View File

@@ -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 = "";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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);
} }

View File

@@ -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()));