Compare commits
8 Commits
2.0.0.rc44
...
2.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b70c8121d | ||
|
|
fd30c5cf36 | ||
|
|
0310bd4a15 | ||
|
|
80ec6d2e3d | ||
|
|
d96f17b847 | ||
|
|
7648eef981 | ||
|
|
79087f33e4 | ||
|
|
d0289d38b3 |
@@ -1,3 +1,12 @@
|
||||
## 2.0.0.rc46
|
||||
|
||||
现在导入导出都接入底层流程,无需新增接口,只需要实现接口即可。
|
||||
|
||||
- 过程日志不再和操作日志同时存在
|
||||
- 过程日志新增params参数
|
||||
- 通过实现*TsImportHandler*接口编写导入逻辑
|
||||
- 通过实现*TsExportHandler*接口编写导出逻辑
|
||||
|
||||
## 2.0.0.rc4
|
||||
|
||||
- perf:TsTokenConfig不在提供静态方法
|
||||
|
||||
24
pom.xml
24
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -35,6 +35,8 @@
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<hutool.version>5.8.31</hutool.version>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
@@ -58,61 +60,61 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-role</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
|
||||
@@ -25,7 +25,6 @@ public class DemoWebConfigurer implements TieshengWebConfigurer, TsLoginConfigur
|
||||
RequestUserInfo info = new RequestUserInfo();
|
||||
info.setId(tokenBean.getId());
|
||||
info.setName(tokenBean.getExtra());
|
||||
info.setData(info);
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,13 @@ package com.tiesheng.demo.controller;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.TimeInterval;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.context.AnalysisContext;
|
||||
import com.alibaba.excel.read.listener.ReadListener;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.database.config.DbBackupConfig;
|
||||
@@ -20,10 +22,14 @@ import com.tiesheng.util.config.EncryptConfig;
|
||||
import com.tiesheng.util.config.GlobalConfig;
|
||||
import com.tiesheng.util.config.Ip2regionConfig;
|
||||
import com.tiesheng.util.config.TsTokenConfig;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import com.tiesheng.util.pojos.FileUploadPath;
|
||||
import com.tiesheng.util.service.TsCacheService;
|
||||
import com.tiesheng.util.service.http.OkHttpUtil;
|
||||
import com.tiesheng.web.service.CoreLogService;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@@ -201,4 +207,31 @@ public class TestController {
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("getwxacode")
|
||||
@TokenIgnore
|
||||
public ApiResp<String> getwxacode() {
|
||||
String id = "test_1111111";
|
||||
FileUploadPath path = FileUploadPath.random("png");
|
||||
JSONObject paramJson = new JSONObject();
|
||||
paramJson.put("page", "pages/login/index");
|
||||
paramJson.put("scene", "no=" + id);
|
||||
paramJson.put("env_version", "develop");
|
||||
paramJson.put("width", 430);
|
||||
paramJson.put("is_hyaline", false);
|
||||
paramJson.put("auto_color", false);
|
||||
FileUploadPath file = FileUploadPath.file(id + ".png");
|
||||
try {
|
||||
Request request = OkHttpUtil.ofPost("https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token=" +
|
||||
"83_7xqG36kdgwuf8zzWLY3jtz7bg4ucziN-0oxbE0X9zBzwbjZ4S4Ss2RM9uHeSIcRp2K-wEp6MLzWhqo2AXj0Jpzd6IiJdUsRxqdHPvEWqAdOgt83vzZwdDf7tZBkGNGeAFASZS",
|
||||
paramJson);
|
||||
Response execute1 = OkHttpUtil.ofHttpClient().build().newCall(request).execute();
|
||||
FileUtil.writeFromStream(execute1.body().byteStream(), file.getAbsolutePath());
|
||||
execute1.close();
|
||||
} catch (Exception e) {
|
||||
throw new ApiException("每分钟最多生成5000个二维码,请稍后再试!");
|
||||
}
|
||||
return ApiResp.respOK(path.getHttpPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class UserImportHandler implements TsImportHandler<String> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailFile() {
|
||||
public String getResultFile() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-login</artifactId>
|
||||
|
||||
@@ -53,7 +53,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
||||
if (tokenBean != null) {
|
||||
|
||||
// 清除授权信息
|
||||
TsCacheService.of().remove(StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY,
|
||||
TsCacheService.of().remove(StrUtil.format(TsAuthorityHandler.CACHE_AUTHORITY,
|
||||
tokenBean.getRoleId(), tokenBean.getId()));
|
||||
|
||||
// 添加登录日志
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-message</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-role</artifactId>
|
||||
|
||||
@@ -154,7 +154,7 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
coreRoleUserMapper.insert(roleUser);
|
||||
}
|
||||
|
||||
onRoleChange(roleUser.getTypeId(), roleUser.getUserId());
|
||||
onRoleChange("", roleUser.getUserId());
|
||||
}
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
coreRoleUser.setIsDeleted(1);
|
||||
coreRoleUserMapper.updateById(coreRoleUser);
|
||||
|
||||
onRoleChange(coreRoleUser.getTypeId(), coreRoleUser.getUserId());
|
||||
onRoleChange("", coreRoleUser.getUserId());
|
||||
}
|
||||
|
||||
|
||||
@@ -179,8 +179,13 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
||||
* 当授权发生变化时
|
||||
*/
|
||||
public void onRoleChange(String roleId, String userId) {
|
||||
TsCacheService.of().keys(StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY,
|
||||
roleId, userId)).forEach(key -> TsCacheService.of().remove(key));
|
||||
if (StrUtil.isEmpty(roleId)) {
|
||||
TsCacheService.of().keys(StrUtil.replace(TsAuthorityHandler.CACHE_AUTHORITY,
|
||||
":{}", "")).forEach(key -> TsCacheService.of().remove(key));
|
||||
} else {
|
||||
TsCacheService.of().keys(StrUtil.format(TsAuthorityHandler.CACHE_AUTHORITY,
|
||||
roleId, userId)).forEach(key -> TsCacheService.of().remove(key));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-util</artifactId>
|
||||
@@ -15,7 +15,6 @@
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<hutool.version>5.8.31</hutool.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -68,11 +68,11 @@ public class TsCacheService {
|
||||
/**
|
||||
* 获取key
|
||||
*
|
||||
* @param pattern
|
||||
* @param prefix
|
||||
* @return
|
||||
*/
|
||||
public Set<String> keys(String pattern) {
|
||||
return tsCacheHandler.keys(pattern);
|
||||
public Set<String> keys(String prefix) {
|
||||
return tsCacheHandler.keys(prefix);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
@Service
|
||||
public interface TsAuthorityHandler {
|
||||
|
||||
String CACHE_HAS_AUTHORITY = "CACHE:HAS_AUTHORITY:{}:{}";
|
||||
String CACHE_AUTHORITY = "CACHE:AUTHORITY:{}:{}";
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc44</version>
|
||||
<version>2.0.1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-web</artifactId>
|
||||
|
||||
@@ -56,7 +56,7 @@ public class RoleAuthorityAspect {
|
||||
|
||||
HttpServletRequest request = ServletKit.getRequest();
|
||||
TokenBean tokenBean = tsTokenConfig.validToken(request, true);
|
||||
String cacheKey = StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY, tokenBean.getRoleId(), tokenBean.getId());
|
||||
String cacheKey = StrUtil.format(TsAuthorityHandler.CACHE_AUTHORITY, tokenBean.getRoleId(), tokenBean.getId());
|
||||
List<String> authorityList = StrUtil.split(TsCacheService.of().get(cacheKey), ";")
|
||||
.stream().filter(StrUtil::isNotEmpty).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(authorityList)) {
|
||||
|
||||
@@ -5,12 +5,12 @@ import cn.hutool.core.date.DateUtil;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.util.service.role.TsAuthorityHandler;
|
||||
import org.springframework.aop.support.AopUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -20,12 +20,17 @@ import java.util.Map;
|
||||
@Service
|
||||
public class RoleAuthorityCreator implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
@Resource
|
||||
@Autowired(required = false)
|
||||
TsAuthorityHandler tsAuthorityHandler;
|
||||
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
|
||||
if (tsAuthorityHandler == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationContext applicationContext = event.getApplicationContext();
|
||||
Map<String, Object> beansOfType = applicationContext.getBeansWithAnnotation(RoleAuthority.class);
|
||||
|
||||
|
||||
@@ -48,8 +48,8 @@ public class CoreLogProcess extends DaoBase {
|
||||
/**
|
||||
* 失败的文件
|
||||
*/
|
||||
@TableField(value = "fail_file")
|
||||
private String failFile;
|
||||
@TableField(value = "result_file")
|
||||
private String resultFile;
|
||||
|
||||
/**
|
||||
* 进度
|
||||
@@ -174,19 +174,19 @@ public class CoreLogProcess extends DaoBase {
|
||||
/**
|
||||
* 获取失败的文件
|
||||
*
|
||||
* @return fail_file - 失败的文件
|
||||
* @return result_file - 失败的文件
|
||||
*/
|
||||
public String getFailFile() {
|
||||
return failFile;
|
||||
public String getResultFile() {
|
||||
return resultFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置失败的文件
|
||||
*
|
||||
* @param failFile 失败的文件
|
||||
* @param resultFile 失败的文件
|
||||
*/
|
||||
public void setFailFile(String failFile) {
|
||||
this.failFile = failFile;
|
||||
public void setResultFile(String resultFile) {
|
||||
this.resultFile = resultFile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,7 @@ package com.tiesheng.web.pojos.vo;
|
||||
*/
|
||||
public class ProcessDetailVo {
|
||||
|
||||
private String title;
|
||||
private String id;
|
||||
|
||||
private Integer total;
|
||||
|
||||
@@ -15,13 +15,17 @@ public class ProcessDetailVo {
|
||||
|
||||
private Integer process;
|
||||
|
||||
private String type;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private String failFile;
|
||||
private String resultFile;
|
||||
|
||||
private String error;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
@@ -31,14 +35,6 @@ public class ProcessDetailVo {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public Integer getTotal() {
|
||||
return total;
|
||||
}
|
||||
@@ -63,20 +59,12 @@ public class ProcessDetailVo {
|
||||
this.failNum = failNum;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
public String getResultFile() {
|
||||
return resultFile;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getFailFile() {
|
||||
return failFile;
|
||||
}
|
||||
|
||||
public void setFailFile(String failFile) {
|
||||
this.failFile = failFile;
|
||||
public void setResultFile(String resultFile) {
|
||||
this.resultFile = resultFile;
|
||||
}
|
||||
|
||||
public Integer getProcess() {
|
||||
@@ -87,11 +75,4 @@ public class ProcessDetailVo {
|
||||
this.process = process;
|
||||
}
|
||||
|
||||
public String getError() {
|
||||
return error;
|
||||
}
|
||||
|
||||
public void setError(String error) {
|
||||
this.error = error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.tiesheng.web.util.ProcessSyncConsumer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -32,11 +31,6 @@ import java.util.List;
|
||||
@Service
|
||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
||||
|
||||
/**
|
||||
* 日志缓存
|
||||
*/
|
||||
private static final List<CoreLogOperation> cacheOperations = new ArrayList<>();
|
||||
|
||||
@Autowired
|
||||
TieshengWebConfigurer tieshengWebConfigurer;
|
||||
@Autowired
|
||||
@@ -92,7 +86,7 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
||||
});
|
||||
|
||||
// 执行结束
|
||||
coreLogProcess.setFailFile(consumer.getFailFile());
|
||||
coreLogProcess.setResultFile(consumer.getResultFile());
|
||||
coreLogProcess.setStatus(1);
|
||||
coreLogProcessMapper.updateById(coreLogProcess);
|
||||
});
|
||||
@@ -180,14 +174,7 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
||||
if (params != null) {
|
||||
operation.setParams(JSON.toJSONString(params));
|
||||
}
|
||||
|
||||
synchronized (CoreLogOperation.class) {
|
||||
cacheOperations.add(operation);
|
||||
if (cacheOperations.size() >= 100) {
|
||||
getBaseMapper().batchInsert(cacheOperations);
|
||||
cacheOperations.clear();
|
||||
}
|
||||
}
|
||||
save(operation);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.tiesheng.web.service;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tiesheng.util.service.http.OkHttpUtil;
|
||||
import com.tiesheng.web.mapper.CoreLogApiMapper;
|
||||
@@ -32,10 +33,15 @@ public class LogApiOkHttpInterceptor implements Interceptor {
|
||||
Response response;
|
||||
try {
|
||||
response = chain.proceed(request);
|
||||
ResponseBody peekBody = response.peekBody(Long.MAX_VALUE);
|
||||
logApi.setRespBody(peekBody.string());
|
||||
logApi.setResult(response.code());
|
||||
peekBody.close();
|
||||
|
||||
// 如果是json,xml,text,则保存记录
|
||||
if (response.body() != null && StrUtil.containsAll(response.body().contentType().toString(),
|
||||
"json", "xml", "text")) {
|
||||
ResponseBody peekBody = response.peekBody(Long.MAX_VALUE);
|
||||
logApi.setRespBody(peekBody.string());
|
||||
peekBody.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
|
||||
@@ -38,7 +38,7 @@ public class DefaultImexHandler implements TsImportHandler<String>, TsExportHand
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFailFile() {
|
||||
public String getResultFile() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ public interface ProcessImportConsumer<T> {
|
||||
|
||||
|
||||
/**
|
||||
* 获取失败的文件路径
|
||||
* 获取导入结果文件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getFailFile();
|
||||
String getResultFile();
|
||||
|
||||
}
|
||||
|
||||
@@ -73,6 +73,9 @@ CREATE TABLE `core_log_operation`
|
||||
|
||||
|
||||
alter table core_log_process
|
||||
modify params longtext null comment '异常说明';
|
||||
change error params longtext null comment '异常说明';
|
||||
|
||||
alter table core_log_process
|
||||
change fail_file result_file varchar(500) null comment '失败的文件';
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
<result column="fail_num" jdbcType="INTEGER" property="failNum" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="fail_file" jdbcType="VARCHAR" property="failFile" />
|
||||
<result column="result_file" jdbcType="VARCHAR" property="resultFile" />
|
||||
<result column="process" jdbcType="INTEGER" property="process" />
|
||||
<result column="params" jdbcType="LONGVARCHAR" property="params" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`,
|
||||
`status`, fail_file, error, `process`
|
||||
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`,
|
||||
`status`, result_file, `process`, params
|
||||
</sql>
|
||||
</mapper>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user