publish 1.1.1

This commit is contained in:
曾文豪
2024-04-17 13:46:51 +08:00
parent ef34146563
commit 5942c4cea4
17 changed files with 264 additions and 26 deletions

20
pom.xml
View File

@@ -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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</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.1.0</version> <version>1.1.1</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-ademo</artifactId> <artifactId>springboot-ademo</artifactId>
<version>1.1.0</version> <version>1.1.1</version>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-annotation</artifactId> <artifactId>springboot-annotation</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-database</artifactId> <artifactId>springboot-database</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-encrypt</artifactId> <artifactId>springboot-encrypt</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-login</artifactId> <artifactId>springboot-login</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-message</artifactId> <artifactId>springboot-message</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-platform</artifactId> <artifactId>springboot-platform</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-poi</artifactId> <artifactId>springboot-poi</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-util</artifactId> <artifactId>springboot-util</artifactId>

View File

@@ -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.1.0</version> <version>1.1.1</version>
</parent> </parent>
<artifactId>springboot-web</artifactId> <artifactId>springboot-web</artifactId>
@@ -85,7 +85,7 @@
<dependency> <dependency>
<groupId>com.tiesheng.springboot-parent</groupId> <groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-encrypt</artifactId> <artifactId>springboot-encrypt</artifactId>
</dependency> </dependency><dependency><groupId>org.apache.xmlbeans</groupId><artifactId>xmlbeans</artifactId><version>3.1.0</version><scope>compile</scope></dependency>
</dependencies> </dependencies>

View File

@@ -0,0 +1,34 @@
package com.tiesheng.core.config.template;
import com.tiesheng.core.pojos.dto.TemplateDealDTO;
import org.springframework.stereotype.Service;
@Service
public class TieshengTemplateHandler implements ToolTemplateHandler {
@Override
public String handler(TemplateDealDTO dto) {
return "";
}
@Override
public String getTemplateUrl() {
return "";
}
@Override
public Object getParms(Object params) {
return "";
}
@Override
public String getAction() {
return "";
}
@Override
public int getSort() {
return 0;
}
}

View File

@@ -0,0 +1,54 @@
package com.tiesheng.core.config.template;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.core.pojos.dto.TemplateDealDTO;
import org.springframework.stereotype.Service;
@Service
public interface ToolTemplateHandler {
/**
* 处理对象
*
* @param dto
* @return
*/
String handler(TemplateDealDTO dto);
/**
* 获取模版地址
*
* @return
*/
String getTemplateUrl();
Object getParms(Object params);
/**
* 动作说明(唯一)
*
* @return
*/
String getAction();
/**
* 排序如果action相同只会使用sort大的来处理
*
* @return
*/
int getSort();
/**
* 获取模版ID
*
* @return
*/
default String getTeamplateId() {
return StrUtil.format("{}_{}", getAction(), getSort());
}
}

View File

@@ -2,20 +2,26 @@ package com.tiesheng.core.controller;
import cn.hutool.captcha.LineCaptcha; import cn.hutool.captcha.LineCaptcha;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.annotation.token.TokenIgnore; import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.core.pojos.dto.ChunkCheckDTO; import com.tiesheng.core.config.template.ToolTemplateHandler;
import com.tiesheng.core.pojos.dto.ChunkMergeDTO; import com.tiesheng.core.pojos.dto.*;
import com.tiesheng.core.pojos.dto.ChunkStartDTO; import com.tiesheng.core.pojos.vo.TemplateInfoVO;
import com.tiesheng.core.pojos.dto.ImageCodeDTO;
import com.tiesheng.core.pojos.vo.PicVerifyVo; import com.tiesheng.core.pojos.vo.PicVerifyVo;
import com.tiesheng.core.service.FileUploadService; import com.tiesheng.core.service.FileUploadService;
import com.tiesheng.core.service.TimedCacheService; import com.tiesheng.core.service.TimedCacheService;
import com.tiesheng.util.exception.ApiException;
import com.tiesheng.util.pojos.ApiResp; import com.tiesheng.util.pojos.ApiResp;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/** /**
* 工具类 * 工具类
* *
@@ -29,6 +35,8 @@ public class ToolController {
TimedCacheService timedCacheService; TimedCacheService timedCacheService;
@Autowired @Autowired
FileUploadService fileUploadService; FileUploadService fileUploadService;
@Autowired
List<ToolTemplateHandler> templateHandlerList;
/** /**
@@ -117,4 +125,40 @@ public class ToolController {
} }
@TokenIgnore
@GetMapping("/template/info")
public ApiResp<TemplateInfoVO> templateInfo(TemplateInfoDTO dto) {
List<ToolTemplateHandler> collect = templateHandlerList.stream()
.filter(it -> Objects.equals(it.getAction(), dto.getAction()))
.sorted((it, it2) -> it2.getSort() - it.getSort())
.collect(Collectors.toList());
if (CollUtil.isEmpty(collect)) {
throw new ApiException("没有找到对应的模版");
}
ToolTemplateHandler toolTemplateHandler = collect.get(0);
TemplateInfoVO template = new TemplateInfoVO();
template.setTemplateUrl(toolTemplateHandler.getTemplateUrl());
template.setParams(toolTemplateHandler.getParms(dto.getParams()));
template.setTemplateId(toolTemplateHandler.getTeamplateId());
return ApiResp.respOK(template);
}
@TokenIgnore
@PostMapping("/template/deal")
public ApiResp<String> templateDeal(@RequestBody TemplateDealDTO dto) {
List<ToolTemplateHandler> collect = templateHandlerList.stream().
filter(it -> Objects.equals(it.getTeamplateId(), dto.getTemplateId()))
.collect(Collectors.toList());
if (CollUtil.isEmpty(collect)) {
throw new ApiException("模版ID不存在");
}
return ApiResp.respOK(collect.get(0).handler(dto));
}
} }

View File

@@ -0,0 +1,41 @@
package com.tiesheng.core.pojos.dto;
import javax.validation.constraints.NotEmpty;
public class TemplateDealDTO {
@NotEmpty(message = "模版ID")
private String templateId;
@NotEmpty(message = "文件路径必填")
private String file;
@NotEmpty(message = "文件参数必填")
private Object params;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getFile() {
return file;
}
public void setFile(String file) {
this.file = file;
}
public Object getParams() {
return params;
}
public void setParams(Object params) {
this.params = params;
}
}

View File

@@ -0,0 +1,28 @@
package com.tiesheng.core.pojos.dto;
public class TemplateInfoDTO {
private String action;
private Object params;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getAction() {
return action;
}
public void setAction(String action) {
this.action = action;
}
public Object getParams() {
return params;
}
public void setParams(Object params) {
this.params = params;
}
}

View File

@@ -0,0 +1,37 @@
package com.tiesheng.core.pojos.vo;
public class TemplateInfoVO {
private String templateId;
private String templateUrl;
private Object params;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public String getTemplateUrl() {
return templateUrl;
}
public void setTemplateUrl(String templateUrl) {
this.templateUrl = templateUrl;
}
public Object getParams() {
return params;
}
public void setParams(Object params) {
this.params = params;
}
}