Compare commits

..

15 Commits
0.8.2 ... 0.8.7

Author SHA1 Message Date
2715557295@qq.com
86384a1f23 publish 0.8.7 2023-03-22 17:22:54 +08:00
2715557295@qq.com
d63b6ab094 publish 0.8.7 2023-03-22 16:52:51 +08:00
2715557295@qq.com
020d1d99e1 publish 0.8.6 2023-03-22 11:12:23 +08:00
曾文豪
32fb562775 publish 0.8.5 2023-03-14 14:20:56 +08:00
曾文豪
af50468743 perf: 调整token校验 2023-03-14 14:20:23 +08:00
曾文豪
cab794ecc4 Merge branch 'test-uploadDir' into 'master'
GlobalConfig新加uploadDir配置

See merge request tiesheng/tiesheng!2
2023-03-14 06:10:02 +00:00
‘毛文春’
0c511940aa GlobalConfig新加uploadDir配置 2023-03-14 14:03:53 +08:00
‘毛文春’
60dea50e43 修改 过滤不要需要验证的接口(path) 2023-03-14 14:01:11 +08:00
‘毛文春’
cbfeb09a22 修改 过滤不要需要验证的接口(path) 2023-03-13 17:45:29 +08:00
曾文豪
ef97488ea0 publish 0.8.4 2023-03-09 15:58:41 +08:00
曾文豪
8873053c06 perf: 优化脱敏工具,修复父类中脱敏注解无效的bug 2023-03-09 15:58:05 +08:00
曾文豪
a65ea27485 perf: 优化代码 2023-03-08 09:02:13 +08:00
曾文豪
4343601da1 perf: 更新changelog 2023-03-08 08:58:38 +08:00
曾文豪
f07e6d99e3 publish 0.8.3 2023-03-07 18:16:51 +08:00
曾文豪
fc4b3139aa perf: 调整文件上传的接口 2023-03-07 18:16:31 +08:00
33 changed files with 589 additions and 64 deletions

View File

@@ -1,3 +1,10 @@
## 0.8.3
### 调整
> 1优化返回数据加密
> 2上传文件接口调整统一为**application/json**格式;
## 0.8.0 ## 0.8.0
### 调整 ### 调整

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>0.8.2</version> <version>0.8.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.springboot-parent</groupId> <groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId> <artifactId>springboot-database</artifactId>
<version>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</version>
</dependency> </dependency>
<dependency> <dependency>

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>0.8.2</version> <version>0.8.7</version>
</parent> </parent>
<artifactId>springboot-ademo</artifactId> <artifactId>springboot-ademo</artifactId>

View File

@@ -41,7 +41,6 @@ public class TestController {
@RequestMapping("/index") @RequestMapping("/index")
@TokenIgnore
public ApiResp<String> index() { public ApiResp<String> index() {
TokenBean tokenBean = new TokenBean("11", "", "fdfd"); TokenBean tokenBean = new TokenBean("11", "", "fdfd");
@@ -67,7 +66,6 @@ public class TestController {
@RequestMapping("/export") @RequestMapping("/export")
@TokenIgnore
public ApiResp<String> export() { public ApiResp<String> export() {
// List<TestFile> list = new ArrayList<>(); // List<TestFile> list = new ArrayList<>();
@@ -102,7 +100,9 @@ public class TestController {
@TokenIgnore @TokenIgnore
public ApiResp<List<TestFile>> desensitize() { public ApiResp<List<TestFile>> desensitize() {
TestFile file = new TestFile("11111"); TestFile file = new TestFile("11111");
file.setTest("111111");
TestFile file1 = new TestFile("22222"); TestFile file1 = new TestFile("22222");
file1.setTest("22222");
return ApiResp.respOK(CollUtil.newArrayList(file, file1)); return ApiResp.respOK(CollUtil.newArrayList(file, file1));
} }

View File

@@ -1,27 +1,21 @@
package com.tiesheng.demo.pojos; package com.tiesheng.demo.pojos;
import com.tiesheng.annotation.desensitize.Desensitize;
import com.tiesheng.poi.pojos.PoiWriteBase; import com.tiesheng.poi.pojos.PoiWriteBase;
public class TestFile implements PoiWriteBase {
public class TestFile extends TestParent implements PoiWriteBase {
@Desensitize() private String name;
private String test;
public TestFile(String test) { public TestFile(String name) {
this.test = test; this.name = name;
} }
/////////////////////////////////////////////////////////////////////////// public String getName() {
// setter、getter return name;
///////////////////////////////////////////////////////////////////////////
public String getTest() {
return test;
} }
public void setTest(String test) { public void setName(String name) {
this.test = test; this.name = name;
} }
} }

View File

@@ -0,0 +1,33 @@
package com.tiesheng.demo.pojos;
import com.tiesheng.annotation.desensitize.Desensitize;
import com.tiesheng.poi.pojos.PoiWriteBase;
public class TestParent implements PoiWriteBase {
private String id;
@Desensitize()
private String test;
///////////////////////////////////////////////////////////////////////////
// setter、getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTest() {
return test;
}
public void setTest(String test) {
this.test = test;
}
}

View File

@@ -20,3 +20,7 @@ spring:
logging: logging:
file: file:
name: runtime/logs/tiesheng.log name: runtime/logs/tiesheng.log
tiesheng:
token:
ignore-paths:
- /test/index

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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</version>
</parent> </parent>
<artifactId>springboot-database</artifactId> <artifactId>springboot-database</artifactId>

View File

@@ -8,6 +8,7 @@ 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;
@@ -22,6 +23,7 @@ import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.Checksum; import java.util.zip.Checksum;
/** /**
@@ -92,6 +94,8 @@ public class DbMigrationInitializer implements ServletContextInitializer {
if (entity == null) { if (entity == null) {
return; return;
} }
AtomicReference<Integer> success= 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) {
@@ -104,11 +108,13 @@ public class DbMigrationInitializer implements ServletContextInitializer {
} }
try { try {
parameter.execute(sql); parameter.execute(sql);
success.getAndSet(success.get() + 1);
} catch (Exception ignore) { } catch (Exception ignore) {
fail.getAndSet(fail.get() + 1);
} }
} }
}); });
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")));

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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</version>
</parent> </parent>
<artifactId>springboot-login</artifactId> <artifactId>springboot-login</artifactId>

View File

@@ -1,5 +1,6 @@
package com.tiesheng.login.config.token; package com.tiesheng.login.config.token;
import cn.hutool.core.util.ObjUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.tiesheng.annotation.token.TokenIgnore; import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.util.ServletKit; import com.tiesheng.util.ServletKit;
@@ -50,8 +51,18 @@ public class TsTokenAspect {
// 过滤不要需要验证的接口path // 过滤不要需要验证的接口path
String requestURI = ServletKit.getRequest().getRequestURI(); String requestURI = ServletKit.getRequest().getRequestURI();
if (StrUtil.startWithAnyIgnoreCase(requestURI, tsTokenConfig.getIgnorePaths())) { String[] ignorePaths = tsTokenConfig.getIgnorePaths();
return; if (ObjUtil.isNotEmpty(ignorePaths)) {
for (String path : ignorePaths) {
if (path.contains("/**") &&
StrUtil.startWith(requestURI, path.replace("/**", ""))) {
// 通配路径
return;
} else if (requestURI.equals(path)) {
// 完整路径
return;
}
}
} }
// 过滤不要需要验证的接口(注解) // 过滤不要需要验证的接口(注解)

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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</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>0.8.2</version> <version>0.8.7</version>
</parent> </parent>
<artifactId>springboot-util</artifactId> <artifactId>springboot-util</artifactId>

View File

@@ -1,16 +1,12 @@
package com.tiesheng.util; package com.tiesheng.util;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeFilter;
import com.alibaba.fastjson.serializer.SerializerFeature; import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.support.config.FastJsonConfig; import com.alibaba.fastjson.support.config.FastJsonConfig;
import com.tiesheng.util.config.desensitize.DesensitizeValueFilter; import com.tiesheng.util.config.DesensitizeValueFilter;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class CommonUtil { public class CommonUtil {
@@ -40,13 +36,10 @@ public class CommonUtil {
*/ */
public static String writeJsonString(Object value) throws IOException { public static String writeJsonString(Object value) throws IOException {
FastJsonConfig fastJsonConfig = fastJsonConfig(); FastJsonConfig fastJsonConfig = fastJsonConfig();
SerializeFilter[] globalFilters = fastJsonConfig.getSerializeFilters();
List<SerializeFilter> allFilters = new ArrayList(Arrays.asList(globalFilters));
ByteArrayOutputStream outnew = new ByteArrayOutputStream(); ByteArrayOutputStream outnew = new ByteArrayOutputStream();
JSON.writeJSONStringWithFastJsonConfig(outnew, fastJsonConfig.getCharset(), JSON.writeJSONStringWithFastJsonConfig(outnew, fastJsonConfig.getCharset(),
value, fastJsonConfig.getSerializeConfig(), value, fastJsonConfig.getSerializeConfig(),
allFilters.toArray(new SerializeFilter[allFilters.size()]), fastJsonConfig.getSerializeFilters(),
fastJsonConfig.getDateFormat(), JSON.DEFAULT_GENERATE_FEATURE, fastJsonConfig.getDateFormat(), JSON.DEFAULT_GENERATE_FEATURE,
fastJsonConfig.getSerializerFeatures()); fastJsonConfig.getSerializerFeatures());
return outnew.toString(); return outnew.toString();

View File

@@ -1,7 +1,7 @@
package com.tiesheng.util.config.desensitize; package com.tiesheng.util.config;
import cn.hutool.core.util.ClassUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.ReflectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.serializer.ValueFilter; import com.alibaba.fastjson.serializer.ValueFilter;
import com.tiesheng.annotation.desensitize.Desensitize; import com.tiesheng.annotation.desensitize.Desensitize;
@@ -21,7 +21,7 @@ public class DesensitizeValueFilter implements ValueFilter {
return value; return value;
} }
Field field = ClassUtil.getDeclaredField(object.getClass(), name); Field field = ReflectUtil.getField(object.getClass(), name);
if (ObjectUtil.isEmpty(field)) { if (ObjectUtil.isEmpty(field)) {
return value; return value;
} }

View File

@@ -23,6 +23,7 @@ public class GlobalConfig {
private String host; private String host;
private String service; private String service;
private String version; private String version;
private String uploadDir = System.getProperty("user.dir");
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// 逻辑方法 // 逻辑方法
@@ -80,6 +81,15 @@ public class GlobalConfig {
// setter\getter // setter\getter
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
public String getUploadDir() {
return uploadDir;
}
public void setUploadDir(String uploadDir) {
this.uploadDir = uploadDir;
}
public String getHost() { public String getHost() {
return host; return host;
} }

View File

@@ -5,7 +5,9 @@ import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.CharUtil; 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.extra.spring.SpringUtil;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import com.tiesheng.util.config.GlobalConfig;
public class FileUploadPath { public class FileUploadPath {
@@ -46,7 +48,7 @@ public class FileUploadPath {
} }
pathBean.setHttpPath(tempPath); pathBean.setHttpPath(tempPath);
String tempAbs = String.format("%s/static%s", System.getProperty("user.dir"), tempPath); String tempAbs = String.format("%s/static%s", SpringUtil.getBean(GlobalConfig.class).getUploadDir(), tempPath);
tempAbs = FileUtil.normalize(tempAbs); tempAbs = FileUtil.normalize(tempAbs);
pathBean.setAbsolutePath(tempAbs); pathBean.setAbsolutePath(tempAbs);

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>0.8.2</version> <version>0.8.7</version>
</parent> </parent>
<artifactId>springboot-web</artifactId> <artifactId>springboot-web</artifactId>

View File

@@ -6,7 +6,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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;
import com.tiesheng.core.pojos.dao.CoreLogProcess;
import com.tiesheng.core.pojos.dto.PageDTO; import com.tiesheng.core.pojos.dto.PageDTO;
import com.tiesheng.core.pojos.vo.ProcessDetailVo;
import com.tiesheng.core.service.CoreLogService; import com.tiesheng.core.service.CoreLogService;
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;
@@ -88,4 +90,36 @@ public class LogController {
return ApiResp.respOK(page.getRecords(), page.getTotal()); return ApiResp.respOK(page.getRecords(), page.getTotal());
} }
/**
* 过程日志列表
*
* @return
*/
@GetMapping("/process/page")
public ApiResp<List<CoreLogProcess>> processPage(String type, @Valid PageDTO dto) {
QueryWrapper<CoreLogProcess> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_deleted", 0);
if (!StrUtil.isEmpty(type)) {
queryWrapper.eq("type", type);
}
dto.likeColumns(queryWrapper, "title");
queryWrapper.orderByDesc("create_time");
Page<CoreLogProcess> page = dto.pageObj();
coreLogService.getCoreLogProcessMapper().selectPage(page, queryWrapper);
return ApiResp.respOK(page.getRecords(), page.getTotal());
}
/**
* 过程日志详情
*
* @return
*/
@GetMapping("/process/detail")
public ApiResp<ProcessDetailVo> processPage(String id) {
ProcessDetailVo processDetail = coreLogService.getProcessDetail(id);
return ApiResp.respOK(processDetail);
}
} }

View File

@@ -4,6 +4,9 @@ package com.tiesheng.core.controller;
import cn.hutool.captcha.LineCaptcha; import cn.hutool.captcha.LineCaptcha;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import com.tiesheng.annotation.token.TokenIgnore; import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.core.pojos.dto.ChunkCheckDTO;
import com.tiesheng.core.pojos.dto.ChunkMergeDTO;
import com.tiesheng.core.pojos.dto.ChunkStartDTO;
import com.tiesheng.core.pojos.dto.ImageCodeDTO; 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;
@@ -68,8 +71,8 @@ public class ToolController {
*/ */
@TokenIgnore @TokenIgnore
@PostMapping(value = "/file/chunk_start") @PostMapping(value = "/file/chunk_start")
public ApiResp<String> fileChunkStart(String fileExt) { public ApiResp<String> fileChunkStart(@RequestBody ChunkStartDTO dto) {
fileUploadService.chunkStart(fileExt); fileUploadService.chunkStart(dto.getFileExt());
return ApiResp.respOK(""); return ApiResp.respOK("");
} }
@@ -81,8 +84,8 @@ public class ToolController {
*/ */
@TokenIgnore @TokenIgnore
@PostMapping("/file/chunk_check") @PostMapping("/file/chunk_check")
public ApiResp<Boolean> fileChunkCheck(String fileMd5, Integer chunk) { public ApiResp<Boolean> fileChunkCheck(@RequestBody ChunkCheckDTO dto) {
boolean exist = fileUploadService.chunkCheck(fileMd5, chunk); boolean exist = fileUploadService.chunkCheck(dto.getFileMd5(), dto.getChunk());
return ApiResp.respOK(exist); return ApiResp.respOK(exist);
} }
@@ -108,8 +111,8 @@ public class ToolController {
*/ */
@TokenIgnore @TokenIgnore
@PostMapping("/file/chunk_merge") @PostMapping("/file/chunk_merge")
public ApiResp<String> fileChunkMerge(String fileMd5, String fileExt) { public ApiResp<String> fileChunkMerge(@RequestBody ChunkMergeDTO dto) {
String path = fileUploadService.chunkMerge(fileMd5, fileExt); String path = fileUploadService.chunkMerge(dto.getFileMd5(), dto.getFileExt());
return ApiResp.respOK(path); return ApiResp.respOK(path);
} }

View File

@@ -0,0 +1,7 @@
package com.tiesheng.core.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tiesheng.core.pojos.dao.CoreLogProcess;
public interface CoreLogProcessMapper extends BaseMapper<CoreLogProcess> {
}

View File

@@ -0,0 +1,158 @@
package com.tiesheng.core.pojos.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tiesheng.core.pojos.DaoBase;
import java.util.Date;
/**
* 日志-过程
*/
@TableName(value = "core_log_process")
public class CoreLogProcess extends DaoBase {
/**
* 标题
*/
@TableField(value = "title")
private String title;
/**
* 总数
*/
@TableField(value = "total")
private Integer total;
/**
* 成功数
*/
@TableField(value = "success_num")
private Integer successNum;
/**
* 失败数
*/
@TableField(value = "fail_num")
private Integer failNum;
/**
* 类型import-导入sync-同步)
*/
@TableField(value = "`type`")
private String type;
/**
* 状态(0-未完成1-完成)
*/
@TableField(value = "`status`")
private Integer status;
/**
* 获取标题
*
* @return title - 标题
*/
public String getTitle() {
return title;
}
/**
* 设置标题
*
* @param title 标题
*/
public void setTitle(String title) {
this.title = title;
}
/**
* 获取总数
*
* @return total - 总数
*/
public Integer getTotal() {
return total;
}
/**
* 设置总数
*
* @param total 总数
*/
public void setTotal(Integer total) {
this.total = total;
}
/**
* 获取成功数
*
* @return success_num - 成功数
*/
public Integer getSuccessNum() {
return successNum;
}
/**
* 设置成功数
*
* @param successNum 成功数
*/
public void setSuccessNum(Integer successNum) {
this.successNum = successNum;
}
/**
* 获取失败数
*
* @return fail_num - 失败数
*/
public Integer getFailNum() {
return failNum;
}
/**
* 设置失败数
*
* @param failNum 失败数
*/
public void setFailNum(Integer failNum) {
this.failNum = failNum;
}
/**
* 获取类型import-导入sync-同步)
*
* @return type - 类型import-导入sync-同步)
*/
public String getType() {
return type;
}
/**
* 设置类型import-导入sync-同步)
*
* @param type 类型import-导入sync-同步)
*/
public void setType(String type) {
this.type = type;
}
/**
* 获取状态(0-未完成1-完成)
*
* @return status - 状态(0-未完成1-完成)
*/
public Integer getStatus() {
return status;
}
/**
* 设置状态(0-未完成1-完成)
*
* @param status 状态(0-未完成1-完成)
*/
public void setStatus(Integer status) {
this.status = status;
}
}

View File

@@ -0,0 +1,30 @@
package com.tiesheng.core.pojos.dto;
/**
* @author hao
*/
public class ChunkCheckDTO {
private String fileMd5;
private Integer chunk;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getFileMd5() {
return fileMd5;
}
public void setFileMd5(String fileMd5) {
this.fileMd5 = fileMd5;
}
public Integer getChunk() {
return chunk;
}
public void setChunk(Integer chunk) {
this.chunk = chunk;
}
}

View File

@@ -0,0 +1,30 @@
package com.tiesheng.core.pojos.dto;
/**
* @author hao
*/
public class ChunkMergeDTO {
private String fileMd5;
private String fileExt;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getFileMd5() {
return fileMd5;
}
public void setFileMd5(String fileMd5) {
this.fileMd5 = fileMd5;
}
public String getFileExt() {
return fileExt;
}
public void setFileExt(String fileExt) {
this.fileExt = fileExt;
}
}

View File

@@ -0,0 +1,21 @@
package com.tiesheng.core.pojos.dto;
/**
* @author hao
*/
public class ChunkStartDTO {
private String fileExt;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getFileExt() {
return fileExt;
}
public void setFileExt(String fileExt) {
this.fileExt = fileExt;
}
}

View File

@@ -0,0 +1,67 @@
package com.tiesheng.core.pojos.vo;
/**
* @author lgc
*/
public class ProcessDetailVo {
private String title;
private Integer total;
private Integer successNum;
private Integer failNum;
private String type;
private Integer status;
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public Integer getSuccessNum() {
return successNum;
}
public void setSuccessNum(Integer successNum) {
this.successNum = successNum;
}
public Integer getFailNum() {
return failNum;
}
public void setFailNum(Integer failNum) {
this.failNum = failNum;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@@ -4,14 +4,14 @@ import cn.hutool.core.bean.BeanUtil;
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.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tiesheng.core.mapper.CoreLogLoginMapper; import com.tiesheng.core.mapper.CoreLogLoginMapper;
import com.tiesheng.core.mapper.CoreLogMessageMapper; import com.tiesheng.core.mapper.CoreLogMessageMapper;
import com.tiesheng.core.mapper.CoreLogOperationMapper; import com.tiesheng.core.mapper.CoreLogOperationMapper;
import com.tiesheng.core.mapper.CoreLogProcessMapper;
import com.tiesheng.core.pojos.RequestUserInfo; import com.tiesheng.core.pojos.RequestUserInfo;
import com.tiesheng.core.pojos.dao.CoreLogLogin; import com.tiesheng.core.pojos.dao.*;
import com.tiesheng.core.pojos.dao.CoreLogMessage; import com.tiesheng.core.pojos.vo.ProcessDetailVo;
import com.tiesheng.core.pojos.dao.CoreLogOperation;
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.login.config.token.bean.TokenBean;
import com.tiesheng.message.pojos.MessageReqResp; import com.tiesheng.message.pojos.MessageReqResp;
@@ -37,6 +37,8 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
CoreLogMessageMapper coreLogMessageMapper; CoreLogMessageMapper coreLogMessageMapper;
@Autowired @Autowired
Ip2regionConfig ip2regionConfig; Ip2regionConfig ip2regionConfig;
@Autowired
CoreLogProcessMapper coreLogProcessMapper;
public CoreLogLoginMapper getLogLoginMapper() { public CoreLogLoginMapper getLogLoginMapper() {
return coreLogLoginMapper; return coreLogLoginMapper;
@@ -46,11 +48,57 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
return coreLogMessageMapper; return coreLogMessageMapper;
} }
/////////////////////////////////////////////////////////////////////////// public CoreLogProcessMapper getCoreLogProcessMapper() {
return coreLogProcessMapper;
}
///////////////////////////////////////////////////////////////////////////
// 操作日志 // 操作日志
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
/**
* 添加空的过程 返回id 用于更新
*/
public String addProcess() {
CoreLogProcess coreLogProcess = new CoreLogProcess();
coreLogProcessMapper.insert(coreLogProcess);
return coreLogProcess.getId();
}
/**
* 更新过程
*
* @param id 过程id
* @param title 过程标题/说明
* @param total 总数
* @param successNum 成功数
* @param failNum 失败数
* @param type 类型import-导出sync-同步)
* @param status 状态0-未完成1-完成)
*/
public void upProcess(String id, String title, Integer total, Integer successNum, Integer failNum, String type, Integer status) {
CoreLogProcess coreLogProcess = new CoreLogProcess();
coreLogProcess.setId(id);
coreLogProcess.setTitle(title);
coreLogProcess.setTotal(total);
coreLogProcess.setSuccessNum(successNum);
coreLogProcess.setFailNum(failNum);
coreLogProcess.setType(type);
coreLogProcess.setStatus(status);
coreLogProcessMapper.updateById(coreLogProcess);
}
/**
* 根据id 获取过程详情
*/
public ProcessDetailVo getProcessDetail(String id) {
QueryWrapper<CoreLogProcess> wrapper = new QueryWrapper<>();
wrapper.eq("id", id);
CoreLogProcess coreLogProcess = coreLogProcessMapper.selectOne(wrapper);
return BeanUtil.copyProperties(coreLogProcess, ProcessDetailVo.class);
}
/** /**
* 添加操作日志 * 添加操作日志
*/ */

View File

@@ -0,0 +1,44 @@
/*
Navicat Premium Data Transfer
Source Server : 47.96.30.85
Source Server Type : MySQL
Source Server Version : 50730
Source Host : localhost:3306
Source Schema : com_tiesheng_web
Target Server Type : MySQL
Target Server Version : 50730
File Encoding : 65001
Date: 22/03/2023 10:39:06
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for core_log_process
-- ----------------------------
CREATE TABLE `core_log_process` (
`id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT 0,
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标题',
`total` int(11) NOT NULL DEFAULT 0 COMMENT '总数',
`success_num` int(11) NOT NULL DEFAULT 0 COMMENT '成功数',
`fail_num` int(11) NOT NULL DEFAULT 0 COMMENT '失败数',
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'import' COMMENT '类型import-导入sync-同步)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '日志-过程' ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of core_log_process
-- ----------------------------
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE core_log_process ADD status int(6) default 0 COMMENT '状态0-未完成1-已完成)';
commit;

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tiesheng.core.mapper.CoreLogProcessMapper">
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreLogProcess">
<!--@mbg.generated-->
<!--@Table core_log_process-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="is_deleted" jdbcType="INTEGER" property="isDeleted" />
<result column="title" jdbcType="VARCHAR" property="title" />
<result column="total" jdbcType="INTEGER" property="total" />
<result column="success_num" jdbcType="INTEGER" property="successNum" />
<result column="fail_num" jdbcType="INTEGER" property="failNum" />
<result column="type" jdbcType="VARCHAR" property="type" />
<result column="status" jdbcType="INTEGER" property="status" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`,
`status`
</sql>
</mapper>