Compare commits
7 Commits
2.0.0.rc46
...
2.0.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b70c8121d | ||
|
|
fd30c5cf36 | ||
|
|
0310bd4a15 | ||
|
|
80ec6d2e3d | ||
|
|
d96f17b847 | ||
|
|
7648eef981 | ||
|
|
79087f33e4 |
@@ -1,8 +1,11 @@
|
|||||||
## 2.0.0.rc44
|
## 2.0.0.rc46
|
||||||
|
|
||||||
|
现在导入导出都接入底层流程,无需新增接口,只需要实现接口即可。
|
||||||
|
|
||||||
#### 优化导入导出过程
|
|
||||||
- 过程日志不再和操作日志同时存在
|
- 过程日志不再和操作日志同时存在
|
||||||
- 过程日志新增params参数
|
- 过程日志新增params参数
|
||||||
|
- 通过实现*TsImportHandler*接口编写导入逻辑
|
||||||
|
- 通过实现*TsExportHandler*接口编写导出逻辑
|
||||||
|
|
||||||
## 2.0.0.rc4
|
## 2.0.0.rc4
|
||||||
|
|
||||||
|
|||||||
24
pom.xml
24
pom.xml
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -35,6 +35,8 @@
|
|||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
|
||||||
|
<hutool.version>5.8.31</hutool.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<developers>
|
<developers>
|
||||||
@@ -58,61 +60,61 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-role</artifactId>
|
<artifactId>springboot-role</artifactId>
|
||||||
<version>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
<version>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ public class DemoWebConfigurer implements TieshengWebConfigurer, TsLoginConfigur
|
|||||||
RequestUserInfo info = new RequestUserInfo();
|
RequestUserInfo info = new RequestUserInfo();
|
||||||
info.setId(tokenBean.getId());
|
info.setId(tokenBean.getId());
|
||||||
info.setName(tokenBean.getExtra());
|
info.setName(tokenBean.getExtra());
|
||||||
info.setData(info);
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,11 +3,13 @@ package com.tiesheng.demo.controller;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.date.TimeInterval;
|
import cn.hutool.core.date.TimeInterval;
|
||||||
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.context.AnalysisContext;
|
import com.alibaba.excel.context.AnalysisContext;
|
||||||
import com.alibaba.excel.read.listener.ReadListener;
|
import com.alibaba.excel.read.listener.ReadListener;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.tiesheng.annotation.role.RoleAuthority;
|
import com.tiesheng.annotation.role.RoleAuthority;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.database.config.DbBackupConfig;
|
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.GlobalConfig;
|
||||||
import com.tiesheng.util.config.Ip2regionConfig;
|
import com.tiesheng.util.config.Ip2regionConfig;
|
||||||
import com.tiesheng.util.config.TsTokenConfig;
|
import com.tiesheng.util.config.TsTokenConfig;
|
||||||
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import com.tiesheng.util.pojos.ApiResp;
|
import com.tiesheng.util.pojos.ApiResp;
|
||||||
import com.tiesheng.util.pojos.FileUploadPath;
|
import com.tiesheng.util.pojos.FileUploadPath;
|
||||||
import com.tiesheng.util.service.TsCacheService;
|
import com.tiesheng.util.service.TsCacheService;
|
||||||
|
import com.tiesheng.util.service.http.OkHttpUtil;
|
||||||
import com.tiesheng.web.service.CoreLogService;
|
import com.tiesheng.web.service.CoreLogService;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
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.*;
|
||||||
|
|
||||||
@@ -201,4 +207,31 @@ public class TestController {
|
|||||||
return ApiResp.respOK("");
|
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());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
if (tokenBean != null) {
|
if (tokenBean != null) {
|
||||||
|
|
||||||
// 清除授权信息
|
// 清除授权信息
|
||||||
TsCacheService.of().remove(StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY,
|
TsCacheService.of().remove(StrUtil.format(TsAuthorityHandler.CACHE_AUTHORITY,
|
||||||
tokenBean.getRoleId(), tokenBean.getId()));
|
tokenBean.getRoleId(), tokenBean.getId()));
|
||||||
|
|
||||||
// 添加登录日志
|
// 添加登录日志
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-role</artifactId>
|
<artifactId>springboot-role</artifactId>
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ public class CoreRoleService extends TsServiceBase<CoreRoleGroupMapper, CoreRole
|
|||||||
coreRoleUserMapper.insert(roleUser);
|
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);
|
coreRoleUser.setIsDeleted(1);
|
||||||
coreRoleUserMapper.updateById(coreRoleUser);
|
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) {
|
public void onRoleChange(String roleId, String userId) {
|
||||||
TsCacheService.of().keys(StrUtil.format(TsAuthorityHandler.CACHE_HAS_AUTHORITY,
|
if (StrUtil.isEmpty(roleId)) {
|
||||||
roleId, userId)).forEach(key -> TsCacheService.of().remove(key));
|
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>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
<maven.compiler.source>8</maven.compiler.source>
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
<maven.compiler.target>8</maven.compiler.target>
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<hutool.version>5.8.31</hutool.version>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|||||||
@@ -68,11 +68,11 @@ public class TsCacheService {
|
|||||||
/**
|
/**
|
||||||
* 获取key
|
* 获取key
|
||||||
*
|
*
|
||||||
* @param pattern
|
* @param prefix
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public Set<String> keys(String pattern) {
|
public Set<String> keys(String prefix) {
|
||||||
return tsCacheHandler.keys(pattern);
|
return tsCacheHandler.keys(prefix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public interface TsAuthorityHandler {
|
public interface TsAuthorityHandler {
|
||||||
|
|
||||||
String CACHE_HAS_AUTHORITY = "CACHE:HAS_AUTHORITY:{}:{}";
|
String CACHE_AUTHORITY = "CACHE:AUTHORITY:{}:{}";
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -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>2.0.0.rc46</version>
|
<version>2.0.1</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ public class RoleAuthorityAspect {
|
|||||||
|
|
||||||
HttpServletRequest request = ServletKit.getRequest();
|
HttpServletRequest request = ServletKit.getRequest();
|
||||||
TokenBean tokenBean = tsTokenConfig.validToken(request, true);
|
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), ";")
|
List<String> authorityList = StrUtil.split(TsCacheService.of().get(cacheKey), ";")
|
||||||
.stream().filter(StrUtil::isNotEmpty).collect(Collectors.toList());
|
.stream().filter(StrUtil::isNotEmpty).collect(Collectors.toList());
|
||||||
if (CollUtil.isEmpty(authorityList)) {
|
if (CollUtil.isEmpty(authorityList)) {
|
||||||
|
|||||||
@@ -5,12 +5,12 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import com.tiesheng.annotation.role.RoleAuthority;
|
import com.tiesheng.annotation.role.RoleAuthority;
|
||||||
import com.tiesheng.util.service.role.TsAuthorityHandler;
|
import com.tiesheng.util.service.role.TsAuthorityHandler;
|
||||||
import org.springframework.aop.support.AopUtils;
|
import org.springframework.aop.support.AopUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.ApplicationContext;
|
import org.springframework.context.ApplicationContext;
|
||||||
import org.springframework.context.ApplicationListener;
|
import org.springframework.context.ApplicationListener;
|
||||||
import org.springframework.context.event.ContextRefreshedEvent;
|
import org.springframework.context.event.ContextRefreshedEvent;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@@ -20,12 +20,17 @@ import java.util.Map;
|
|||||||
@Service
|
@Service
|
||||||
public class RoleAuthorityCreator implements ApplicationListener<ContextRefreshedEvent> {
|
public class RoleAuthorityCreator implements ApplicationListener<ContextRefreshedEvent> {
|
||||||
|
|
||||||
@Resource
|
@Autowired(required = false)
|
||||||
TsAuthorityHandler tsAuthorityHandler;
|
TsAuthorityHandler tsAuthorityHandler;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||||
|
|
||||||
|
if (tsAuthorityHandler == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ApplicationContext applicationContext = event.getApplicationContext();
|
ApplicationContext applicationContext = event.getApplicationContext();
|
||||||
Map<String, Object> beansOfType = applicationContext.getBeansWithAnnotation(RoleAuthority.class);
|
Map<String, Object> beansOfType = applicationContext.getBeansWithAnnotation(RoleAuthority.class);
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ import com.tiesheng.web.util.ProcessSyncConsumer;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -32,11 +31,6 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 日志缓存
|
|
||||||
*/
|
|
||||||
private static final List<CoreLogOperation> cacheOperations = new ArrayList<>();
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TieshengWebConfigurer tieshengWebConfigurer;
|
TieshengWebConfigurer tieshengWebConfigurer;
|
||||||
@Autowired
|
@Autowired
|
||||||
@@ -180,14 +174,7 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
if (params != null) {
|
if (params != null) {
|
||||||
operation.setParams(JSON.toJSONString(params));
|
operation.setParams(JSON.toJSONString(params));
|
||||||
}
|
}
|
||||||
|
save(operation);
|
||||||
synchronized (CoreLogOperation.class) {
|
|
||||||
cacheOperations.add(operation);
|
|
||||||
if (cacheOperations.size() >= 100) {
|
|
||||||
getBaseMapper().batchInsert(cacheOperations);
|
|
||||||
cacheOperations.clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.tiesheng.web.service;
|
package com.tiesheng.web.service;
|
||||||
|
|
||||||
import cn.hutool.core.thread.ThreadUtil;
|
import cn.hutool.core.thread.ThreadUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.tiesheng.util.service.http.OkHttpUtil;
|
import com.tiesheng.util.service.http.OkHttpUtil;
|
||||||
import com.tiesheng.web.mapper.CoreLogApiMapper;
|
import com.tiesheng.web.mapper.CoreLogApiMapper;
|
||||||
@@ -32,10 +33,15 @@ public class LogApiOkHttpInterceptor implements Interceptor {
|
|||||||
Response response;
|
Response response;
|
||||||
try {
|
try {
|
||||||
response = chain.proceed(request);
|
response = chain.proceed(request);
|
||||||
ResponseBody peekBody = response.peekBody(Long.MAX_VALUE);
|
|
||||||
logApi.setRespBody(peekBody.string());
|
|
||||||
logApi.setResult(response.code());
|
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) {
|
} catch (Exception e) {
|
||||||
|
|
||||||
JSONObject object = new JSONObject();
|
JSONObject object = new JSONObject();
|
||||||
|
|||||||
Reference in New Issue
Block a user