Compare commits
145 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf6d05c2b4 | ||
|
|
57f0e2ab82 | ||
|
|
cce180806b | ||
|
|
2a8a4ff337 | ||
|
|
e8cc8cf8f7 | ||
|
|
bb0e5098af | ||
|
|
6d91cc7c13 | ||
|
|
94f93f8a80 | ||
|
|
9363d08308 | ||
|
|
3797c0edd2 | ||
|
|
1cf97feabf | ||
|
|
bce848af7e | ||
|
|
a6b0062f8d | ||
| 885303e555 | |||
| 0cf30770f1 | |||
| 6a66f41925 | |||
|
|
2d8208e4dc | ||
|
|
c4ba637de7 | ||
|
|
7b0b9e0925 | ||
|
|
463ddf1b1e | ||
|
|
6fdc69fc2d | ||
|
|
fde73e57b9 | ||
|
|
8a517b09fd | ||
|
|
217d044940 | ||
|
|
9ecf58d75e | ||
|
|
5c0d47a011 | ||
|
|
08066f1367 | ||
|
|
9e7ed69d37 | ||
|
|
2793b2a634 | ||
|
|
9885e640e9 | ||
|
|
9b285db5bd | ||
|
|
abbfac2f08 | ||
|
|
fba88da506 | ||
|
|
cb6e1c85b2 | ||
|
|
2649070850 | ||
|
|
48a9d46d20 | ||
|
|
f8d7e49290 | ||
|
|
2cf88cefa7 | ||
|
|
9a56994342 | ||
|
|
a987689bd6 | ||
|
|
690dffa779 | ||
|
|
3ccbd6cd8e | ||
|
|
89e0c5d1d5 | ||
|
|
b15dbc6d4c | ||
|
|
2f6b5b0b05 | ||
|
|
832d615273 | ||
|
|
383a82e530 | ||
|
|
6531709c69 | ||
|
|
6aaf91a755 | ||
|
|
f1ac7d6886 | ||
|
|
2f07f9eb66 | ||
|
|
919cd47623 | ||
|
|
eb1c20b033 | ||
|
|
c1559e96be | ||
|
|
9ef7d2d4a2 | ||
|
|
b90e92f4cb | ||
|
|
cb816d0ff0 | ||
|
|
0470ca0b9a | ||
|
|
d38077b0f8 | ||
|
|
2621c6dedc | ||
|
|
456a95778c | ||
|
|
fd0976a30c | ||
|
|
e519781207 | ||
|
|
e602f4c658 | ||
|
|
a816acaddb | ||
|
|
278429157a | ||
|
|
143b100819 | ||
|
|
d0cd9aed0b | ||
|
|
3080d8a936 | ||
|
|
3f951dfe47 | ||
|
|
9c66dafe6b | ||
|
|
d6ed2b8037 | ||
|
|
02c2ccc0ff | ||
|
|
f27d8d1658 | ||
|
|
ba9d0da33f | ||
|
|
4690fa9f88 | ||
|
|
a9f218de89 | ||
|
|
55324199cd | ||
|
|
0b32559630 | ||
|
|
01cc4f16ad | ||
|
|
2b70c8121d | ||
|
|
fd30c5cf36 | ||
|
|
0310bd4a15 | ||
|
|
80ec6d2e3d | ||
|
|
d96f17b847 | ||
|
|
7648eef981 | ||
|
|
79087f33e4 | ||
|
|
d0289d38b3 | ||
|
|
90029faa53 | ||
|
|
ecb5aa1b29 | ||
|
|
1db8ef9d85 | ||
|
|
4bcae2f8d1 | ||
|
|
9bab4cdb25 | ||
|
|
856a9f01dd | ||
|
|
e57cd5e1c8 | ||
|
|
542e23ac1b | ||
|
|
6949f50c7c | ||
|
|
7b43ae3ce1 | ||
|
|
8ca283ca85 | ||
|
|
3728291e73 | ||
|
|
6997dea968 | ||
|
|
7f601c8e60 | ||
|
|
7adc2a7c4b | ||
|
|
f4f082cc86 | ||
|
|
d21d84bc87 | ||
|
|
60f996137f | ||
|
|
11c8d234ff | ||
|
|
125c681669 | ||
|
|
b9347013f0 | ||
|
|
3415f0836f | ||
|
|
22672c8a9e | ||
|
|
a405aa7057 | ||
|
|
e39dd646f5 | ||
|
|
2ca224f7a5 | ||
|
|
d4e97babf4 | ||
|
|
a1c75d010b | ||
|
|
9b6b3af33e | ||
|
|
91833a44bb | ||
|
|
8dc8709499 | ||
|
|
b34d9d6242 | ||
|
|
2c9519a35e | ||
|
|
f5dfce08ed | ||
|
|
5d4e97b206 | ||
|
|
82d3f471f9 | ||
|
|
316909dd61 | ||
|
|
5e308be3ba | ||
|
|
ba80cebc45 | ||
|
|
0f5cdb49c0 | ||
|
|
1ee4b4af30 | ||
|
|
bb38428708 | ||
|
|
a22467d4f1 | ||
|
|
ad90c83cf7 | ||
|
|
cdae6a9868 | ||
|
|
be08001f3f | ||
|
|
333d283e24 | ||
|
|
450d1fb869 | ||
|
|
1412782327 | ||
|
|
6127cd50a9 | ||
|
|
19f4d0395e | ||
|
|
d52edbb23c | ||
|
|
6c6d713c01 | ||
|
|
8ea34c3ee0 | ||
|
|
d357fa7c85 | ||
|
|
6332d1486b | ||
|
|
e709050ba3 |
25
.gitea/workflows/mvn-deploy.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
## 工作流触发时机
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
jobs:
|
||||
|
||||
## 任务名称
|
||||
local-deploy:
|
||||
|
||||
## 任务执行的服务器
|
||||
runs-on: tiesheng-local
|
||||
|
||||
## 任务步骤
|
||||
steps:
|
||||
|
||||
## 检出代码(固定配置)
|
||||
- name: Check out repository code
|
||||
uses: https://git.tieshengkeji.com/actions/checkout@v4
|
||||
|
||||
## maven打包
|
||||
- name: Maven deploy
|
||||
run: |
|
||||
mvn deploy
|
||||
@@ -1,7 +1,2 @@
|
||||
## 2.0.0.rc4
|
||||
|
||||
- perf:TsTokenConfig不在提供静态方法
|
||||
- perf:移除TsTokenAspect,由TokenWebMvcConfigurer替代,并实现TokenBean参数注入
|
||||
|
||||
|
||||
## 4.0.0
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>kepai-repo</id>
|
||||
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
```
|
||||
|
||||
21
CHANGELOG_v2.md
Normal file
@@ -0,0 +1,21 @@
|
||||
## 2.0.12
|
||||
|
||||
- 调整OkHttp日志
|
||||
|
||||
|
||||
## 2.0.0.rc46
|
||||
|
||||
现在导入导出都接入底层流程,无需新增接口,只需要实现接口即可。
|
||||
|
||||
- 过程日志不再和操作日志同时存在
|
||||
- 过程日志新增params参数
|
||||
- 通过实现*TsImportHandler*接口编写导入逻辑
|
||||
- 通过实现*TsExportHandler*接口编写导出逻辑
|
||||
|
||||
## 2.0.0.rc4
|
||||
|
||||
- perf:TsTokenConfig不在提供静态方法
|
||||
- perf:移除TsTokenAspect,由TokenWebMvcConfigurer替代,并实现TokenBean参数注入
|
||||
|
||||
|
||||
|
||||
52
pom.xml
@@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>springboot-parent</name>
|
||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||
@@ -14,7 +14,7 @@
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.6.4</version>
|
||||
<version>4.0.0</version>
|
||||
</parent>
|
||||
|
||||
<modules>
|
||||
@@ -23,18 +23,19 @@
|
||||
<module>springboot-login</module>
|
||||
<module>springboot-web</module>
|
||||
<module>springboot-util</module>
|
||||
<module>springboot-poi</module>
|
||||
<module>springboot-platform</module>
|
||||
<module>springboot-message</module>
|
||||
<module>springboot-encrypt</module>
|
||||
<module>springboot-annotation</module>
|
||||
<module>springboot-role</module>
|
||||
<module>springboot-chart</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
<hutool.version>5.8.42</hutool.version>
|
||||
</properties>
|
||||
|
||||
<developers>
|
||||
@@ -58,61 +59,49 @@
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-database</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-login</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-web</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-platform</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-message</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-encrypt</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-role</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
@@ -132,11 +121,18 @@
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>kepai-repo-plugin</id>
|
||||
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||
<id>tiesheng-repo-plugin</id>
|
||||
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>gitea</id>
|
||||
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
|
||||
BIN
springboot-ademo/.DS_Store
vendored
@@ -6,15 +6,15 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-ademo</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- 该模块不发布到maven仓库 -->
|
||||
<maven.deploy.skip>true</maven.deploy.skip>
|
||||
@@ -36,12 +36,18 @@
|
||||
<artifactId>easyexcel</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>redis.clients</groupId>
|
||||
<artifactId>jedis</artifactId>
|
||||
<version>3.7.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>kepai-repo</id>
|
||||
<url>http://git.kepai365.com/tiesheng/repository/raw/master</url>
|
||||
<id>tiesheng-repo</id>
|
||||
<url>https://git.tieshengkeji.com/api/packages/tieshengkeji/maven</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
|
||||
@@ -1,36 +1,39 @@
|
||||
package com.tiesheng.demo.config;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.tiesheng.web.pojos.RequestUserInfo;
|
||||
import com.tiesheng.web.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||
import com.tiesheng.util.pojos.TokenBean;
|
||||
import com.tiesheng.login.pojos.RequestUserInfo;
|
||||
import com.tiesheng.login.pojos.dao.CorePlatformUnique;
|
||||
import com.tiesheng.login.service.TsLoginConfigurer;
|
||||
import com.tiesheng.util.config.GlobalConfig;
|
||||
import com.tiesheng.util.pojos.TokenBean;
|
||||
import com.tiesheng.web.service.TieshengWebConfigurer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.Objects;
|
||||
|
||||
@Component
|
||||
public class DemoWebConfigurer implements TieshengWebConfigurer {
|
||||
|
||||
@Autowired
|
||||
GlobalConfig globalConfig;
|
||||
public class DemoWebConfigurer implements TieshengWebConfigurer, TsLoginConfigurer {
|
||||
|
||||
@Override
|
||||
public RequestUserInfo getCurrentUserName(TokenBean tokenBean) {
|
||||
RequestUserInfo info = new RequestUserInfo();
|
||||
info.setId("1");
|
||||
info.setName("test");
|
||||
info.setId(tokenBean.getId());
|
||||
info.setName(tokenBean.getExtra());
|
||||
return info;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TokenBean login(CorePlatformUnique platformUnique) {
|
||||
TokenBean tokenBean = null;
|
||||
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
||||
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
|
||||
tokenBean = new TokenBean(platformUnique.getUserId(), "super");
|
||||
} else if (Objects.equals(platformUnique.getUniqueId(), "1110290049")) {
|
||||
tokenBean = new TokenBean("1", "super");
|
||||
}
|
||||
|
||||
if (tokenBean != null) {
|
||||
tokenBean.setExtra("1110290049");
|
||||
}
|
||||
|
||||
return tokenBean;
|
||||
@@ -39,13 +42,11 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
|
||||
@Override
|
||||
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||
|
||||
// 默认跳转到mobile
|
||||
to = StrUtil.emptyToDefault(to, "mobile");
|
||||
bean.setEnvironmentType(to);
|
||||
|
||||
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
|
||||
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TsLoginConfigurer configureLogin() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
package com.tiesheng.demo.config;
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
|
||||
@Component
|
||||
public class DemoWebMvcConfigurer implements WebMvcConfigurer {
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
registry.addResourceHandler("/mobile/**").addResourceLocations("classpath:/mobile/0.0.13/");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
package com.tiesheng.demo.config;
|
||||
|
||||
|
||||
import com.tiesheng.web.service.CoreConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@@ -13,9 +11,6 @@ import javax.annotation.PostConstruct;
|
||||
@Component
|
||||
public class TestJobConfig {
|
||||
|
||||
@Autowired
|
||||
CoreConfigService coreConfigService;
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
}
|
||||
|
||||
@@ -1,36 +1,43 @@
|
||||
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.json.JSONUtil;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
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.util.pojos.TokenBean;
|
||||
import com.tiesheng.web.service.CoreLogService;
|
||||
import com.tiesheng.web.service.CoreMessageService;
|
||||
import com.tiesheng.web.util.ProcessImportConsumer;
|
||||
import com.tiesheng.database.config.DbBackupConfig;
|
||||
import com.tiesheng.demo.pojos.CustTokenBean;
|
||||
import com.tiesheng.demo.pojos.JsonTest;
|
||||
import com.tiesheng.demo.pojos.PoiBean;
|
||||
import com.tiesheng.demo.pojos.TestFile;
|
||||
import com.tiesheng.util.config.TsTokenConfig;
|
||||
import com.tiesheng.message.pojos.MessageReqResp;
|
||||
import com.tiesheng.message.pojos.UserChannel;
|
||||
import com.tiesheng.platform.config.ding.PlatformDingConfig;
|
||||
import com.tiesheng.platform.config.ding.bean.DingUserInfo;
|
||||
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.*;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
@@ -48,60 +55,88 @@ public class TestController {
|
||||
@Autowired
|
||||
EncryptConfig encryptConfig;
|
||||
@Autowired
|
||||
CoreMessageService coreMessageService;
|
||||
@Autowired
|
||||
CoreLogService coreLogService;
|
||||
@Autowired
|
||||
DbBackupConfig dbBackupConfig;
|
||||
@Autowired
|
||||
TsCacheService tsCacheService;
|
||||
@Autowired
|
||||
PlatformDingConfig platformDingConfig;
|
||||
|
||||
|
||||
@RequestMapping("/index")
|
||||
@TokenIgnore
|
||||
public ApiResp<String> index(TokenBean tokenBean) {
|
||||
return ApiResp.respOK("hello world");
|
||||
public void index(HttpServletResponse response) {
|
||||
globalConfig.redirectWithVer("mobile", "/test", response);
|
||||
}
|
||||
|
||||
@RequestMapping("/redirect")
|
||||
@TokenIgnore
|
||||
public void redirect(HttpServletResponse response) {
|
||||
@RoleAuthority("redirect")
|
||||
public ApiResp<JsonTest> redirect(HttpServletResponse response) {
|
||||
|
||||
ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
|
||||
coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
|
||||
@Override
|
||||
public int accept(List<String> list) {
|
||||
LogFactory.get().info("list: " + list.size());
|
||||
return 0;
|
||||
}
|
||||
String s1 = encryptConfig.passwdCreate("qU3?wE3{bX", "");
|
||||
LogFactory.get().info(s1);
|
||||
|
||||
@Override
|
||||
public String getFailFile() {
|
||||
LogFactory.get().info("getFailFile: " + strings.size());
|
||||
return null;
|
||||
}
|
||||
});
|
||||
JsonTest jsonTest = new JsonTest();
|
||||
jsonTest.setNow(DateUtil.date());
|
||||
jsonTest.setNow1(DateUtil.date());
|
||||
|
||||
LogFactory.get().info("strings: " + strings.size());
|
||||
String jsonString = JSON.toJSONString(jsonTest);
|
||||
LogFactory.get().info(jsonString);
|
||||
|
||||
String s = OkHttpUtil.get("http://toolbox.tieshengkeji.com/test/login/23232/3232");
|
||||
LogFactory.get().info(s);
|
||||
|
||||
// ArrayList<String> strings = CollUtil.newArrayList("11111", "22222");
|
||||
// coreLogService.addProcess("fdfd", strings, new ProcessImportConsumer<String>() {
|
||||
// @Override
|
||||
// public int accept(List<String> list) {
|
||||
// LogFactory.get().info("list: " + list.size());
|
||||
// return 0;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public String getFailFile() {
|
||||
// LogFactory.get().info("getFailFile: " + strings.size());
|
||||
// return null;
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// LogFactory.get().info("strings: " + strings.size());
|
||||
|
||||
|
||||
// tsTokenConfig.validToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzYwMDY4NzUsImlkIjoiMSIsImVudmlyb25tZW50VHlwZSI6Im1vYmlsZSIsInNlcnZpY2UiOiJjb250ZXN0LXJlc2VydmUiLCJleHRyYSI6IiJ9.nsfxEFpCNHC7eNCS5DJXdu1VDdnHrTjSfgrozND70Lc", true);
|
||||
globalConfig.redirect("mobile", "/test", response);
|
||||
// globalConfig.redirect("mobile", "/test", response);
|
||||
return ApiResp.respOK(jsonTest);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/send")
|
||||
@TokenIgnore
|
||||
public ApiResp<MessageReqResp> sendMessage() {
|
||||
public ApiResp<String> sendMessage(CustTokenBean tokenBean) {
|
||||
|
||||
MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
|
||||
JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));
|
||||
tokenBean.test();
|
||||
|
||||
return ApiResp.respOK(reqResp);
|
||||
// MessageReqResp reqResp = coreMessageService.send(new UserChannel("13567116463", "sms"),
|
||||
// JSONUtil.createObj().putOpt("action", "sms-visitor-invite"));
|
||||
|
||||
return ApiResp.respOK(null);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/export")
|
||||
@TokenIgnore
|
||||
public ApiResp<String> export() {
|
||||
|
||||
// tsCacheService.put("fdfhdfd", "fdfdfdfd");
|
||||
// String s = tsCacheService.get("fdfhdfd");
|
||||
// LogFactory.get().info("export: " + s);
|
||||
|
||||
platformDingConfig.syncDeptUser("", null, new Consumer<DingUserInfo>() {
|
||||
@Override
|
||||
public void accept(DingUserInfo dingUserInfo) {
|
||||
}
|
||||
});
|
||||
|
||||
// List<TestFile> list = new ArrayList<>();
|
||||
// list.add(new TestFile("11111"));
|
||||
// list.add(new TestFile("22222"));
|
||||
@@ -122,7 +157,7 @@ public class TestController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("searchIP")
|
||||
@PostMapping("searchIP")
|
||||
@TokenIgnore
|
||||
public ApiResp<String> searchIp() {
|
||||
String search = ip2regionConfig.search("127.0.0.1");
|
||||
@@ -130,17 +165,6 @@ public class TestController {
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("desensitize")
|
||||
@TokenIgnore
|
||||
public ApiResp<List<TestFile>> desensitize() {
|
||||
TestFile file = new TestFile("11111");
|
||||
file.setTest("111111");
|
||||
TestFile file1 = new TestFile("22222");
|
||||
file1.setTest("22222");
|
||||
return ApiResp.respOK(CollUtil.newArrayList(file, file1));
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("passwd")
|
||||
@TokenIgnore
|
||||
public ApiResp<String> passwd() {
|
||||
@@ -177,18 +201,33 @@ public class TestController {
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
@RequestMapping("poiTool")
|
||||
|
||||
@GetMapping("getwxacode")
|
||||
@TokenIgnore
|
||||
public ApiResp<String> poiTool() {
|
||||
TimeInterval timeInterval = new TimeInterval();
|
||||
|
||||
FileUploadPath file = FileUploadPath.file("/upload/test.xlsx");
|
||||
|
||||
ExcelUtil.getReader(new File(file.getAbsolutePath())).read();
|
||||
|
||||
System.out.println("timeInterval: " + timeInterval.interval());
|
||||
|
||||
return ApiResp.respOK("");
|
||||
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();
|
||||
if (execute1.body() != null) {
|
||||
FileUtil.writeFromStream(execute1.body().byteStream(), file.getAbsolutePath());
|
||||
execute1.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ApiException("每分钟最多生成5000个二维码,请稍后再试!");
|
||||
}
|
||||
return ApiResp.respOK(path.getHttpPath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.tiesheng.demo.pojos;
|
||||
|
||||
import com.tiesheng.util.pojos.TokenBean;
|
||||
|
||||
public class CustTokenBean extends TokenBean {
|
||||
|
||||
|
||||
public void test() {
|
||||
System.out.println("test: " + getId());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.tiesheng.demo.pojos;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class JsonTest {
|
||||
|
||||
private Date now;
|
||||
@JSONField(format = "yyyy-MM-dd")
|
||||
private Date now1;
|
||||
private String no;
|
||||
private String name;
|
||||
|
||||
private JsonTest child;
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// setter\getter
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public Date getNow() {
|
||||
return now;
|
||||
}
|
||||
|
||||
public void setNow(Date now) {
|
||||
this.now = now;
|
||||
}
|
||||
|
||||
public Date getNow1() {
|
||||
return now1;
|
||||
}
|
||||
|
||||
public void setNow1(Date now1) {
|
||||
this.now1 = now1;
|
||||
}
|
||||
|
||||
public String getNo() {
|
||||
return no;
|
||||
}
|
||||
|
||||
public void setNo(String no) {
|
||||
this.no = no;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public JsonTest getChild() {
|
||||
return child;
|
||||
}
|
||||
|
||||
public void setChild(JsonTest child) {
|
||||
this.child = child;
|
||||
}
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.tiesheng.demo.pojos;
|
||||
|
||||
import com.tiesheng.poi.pojos.PoiWriteBase;
|
||||
|
||||
|
||||
public class TestFile extends TestParent implements PoiWriteBase {
|
||||
|
||||
private String name;
|
||||
|
||||
public TestFile(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.tiesheng.demo.service;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tiesheng.message.config.aliyun.AliyunSmsHandler;
|
||||
import com.tiesheng.message.pojos.AliyunTempParam;
|
||||
import com.tiesheng.message.config.aliyun.AliyunTempParam;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Objects;
|
||||
@@ -15,16 +14,17 @@ public class DemoSmsHandler implements AliyunSmsHandler {
|
||||
@Override
|
||||
public AliyunTempParam handler(JSONObject obj) {
|
||||
|
||||
String action = obj.getStr("action");
|
||||
String action = obj.getString("action");
|
||||
|
||||
AliyunTempParam param = new AliyunTempParam();
|
||||
param.setSignName("智慧校园");
|
||||
|
||||
if (Objects.equals(action, "sms-visitor-invite")) {
|
||||
param.setTemplateCode("SMS_276125463");
|
||||
param.setTemplateParam(JSONUtil.createObj()
|
||||
.putOpt("date", DateUtil.today())
|
||||
);
|
||||
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("date", DateUtil.today());
|
||||
param.setTemplateParam(object);
|
||||
}
|
||||
|
||||
return param;
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.tiesheng.demo.service;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.tiesheng.util.pojos.TokenBean;
|
||||
import com.tiesheng.web.pojos.imex.ImportDealDTO;
|
||||
import com.tiesheng.web.service.imex.TsImportHandler;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@Service
|
||||
public class UserImportHandler implements TsImportHandler<String> {
|
||||
|
||||
@Override
|
||||
public List<String> ready(ImportDealDTO dto, TokenBean token) {
|
||||
return CollUtil.newArrayList("11111");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateUrl() {
|
||||
return "/template/xsxxzx_teacher_leader.xlsx";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAction() {
|
||||
return "user_import";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int batchHandler(List<String> list) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getResultFile() {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,17 @@ spring:
|
||||
url: jdbc:mysql://47.96.30.85:3306/com_tiesheng_web?useSSL=false&useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&queryTimeout=5400&allowMultiQueries=true&serverTimezone=GMT%2B8
|
||||
username: com_tiesheng_web
|
||||
password: 4Xo$XheGFc
|
||||
redis:
|
||||
url: redis://kyF0zUL3011111@47.96.30.85:6234
|
||||
database: 1
|
||||
|
||||
platform:
|
||||
ding:
|
||||
global:
|
||||
corpId: dingebe664cb3baf3a52a39a90f97fcb1e09
|
||||
agentId: 2474444028
|
||||
appKey: dingyvf1niiajfaajyo5
|
||||
appSecret: y6SGZ4fvPbdbj4RVbDWLeMBkGgplaOdnTA_9wN5TDdOV_Y47alYc1LDlIHjsBJE1
|
||||
wxmp:
|
||||
global:
|
||||
app-id: wxa0343fe519824651
|
||||
@@ -18,11 +27,12 @@ tiesheng:
|
||||
token:
|
||||
test-map:
|
||||
"1111":
|
||||
id: "1111"
|
||||
role-id: "student_bks"
|
||||
id: "1"
|
||||
role-id: "1822829641023524865"
|
||||
global:
|
||||
version: 2
|
||||
host: http://localhost:8100
|
||||
service: yrx
|
||||
aliyun:
|
||||
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
||||
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
||||
|
||||
@@ -18,8 +18,4 @@ spring:
|
||||
logging:
|
||||
file:
|
||||
name: runtime/logs/tiesheng.log
|
||||
tiesheng:
|
||||
token:
|
||||
ignore-paths:
|
||||
- /test/index
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 44 KiB |
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 42 KiB |
|
Before Width: | Height: | Size: 75 KiB After Width: | Height: | Size: 75 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
|
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 4.1 KiB After Width: | Height: | Size: 4.1 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 5.3 KiB After Width: | Height: | Size: 5.3 KiB |
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
@@ -0,0 +1,42 @@
|
||||
package com.tiesheng.demo;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.log.LogFactory;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONPath;
|
||||
import com.tiesheng.demo.pojos.JsonTest;
|
||||
import com.tiesheng.login.pojos.RequestUserInfo;
|
||||
|
||||
public class MainTest {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
MainTest test = new MainTest();
|
||||
test.testJsonSelf();
|
||||
|
||||
}
|
||||
|
||||
private void testJsonSelf() {
|
||||
RequestUserInfo info = new RequestUserInfo();
|
||||
info.setId("1");
|
||||
info.setName("name");
|
||||
info.setData(info);
|
||||
String jsonStr = JSON.toJSONString(info);
|
||||
LogFactory.get().info(jsonStr);
|
||||
}
|
||||
|
||||
|
||||
private void testJsonPath() {
|
||||
JsonTest jsonTest = new JsonTest();
|
||||
jsonTest.setNo("1111");
|
||||
jsonTest.setName("1111");
|
||||
jsonTest.setNow(DateUtil.date());
|
||||
jsonTest.setChild(jsonTest);
|
||||
|
||||
JSONPath jsonPath = JSONPath.compile("child.no");
|
||||
String eval = jsonPath.eval(jsonTest, String.class);
|
||||
LogFactory.get().info(eval);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -6,14 +6,14 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-annotation</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.tiesheng.annotation.desensitize;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
/**
|
||||
* @author hao
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Desensitize {
|
||||
|
||||
int prefix() default 1;
|
||||
|
||||
int suffix() default 1;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.tiesheng.annotation.role;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RoleAuthority {
|
||||
|
||||
|
||||
/**
|
||||
* 编号
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String value();
|
||||
|
||||
/**
|
||||
* 平台类型
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String platform() default "";
|
||||
|
||||
|
||||
/**
|
||||
* 分组
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String[] group() default {};
|
||||
|
||||
|
||||
/**
|
||||
* 依赖其他权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String[] deps() default {};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.tiesheng.annotation.role;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
@Target({ElementType.METHOD})
|
||||
@Documented
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface RoleIgnore {
|
||||
}
|
||||
@@ -6,29 +6,33 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-poi</artifactId>
|
||||
<artifactId>springboot-chart</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.22</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>easyexcel</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-util</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,111 @@
|
||||
package com.tiesheng.role.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.write.style.row.SimpleRowHeightStyleStrategy;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tiesheng.annotation.operation.OperationIgnore;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.role.pojos.dto.ChartTemplateCheck;
|
||||
import com.tiesheng.role.pojos.vo.TsTableVO;
|
||||
import com.tiesheng.role.service.ChartService;
|
||||
import com.tiesheng.role.util.AliExcelUtil;
|
||||
import com.tiesheng.util.config.GlobalConfig;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import com.tiesheng.util.pojos.FileUploadPath;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/chart/record")
|
||||
@RoleAuthority(value = "template", group = "chart")
|
||||
public class ChartRecordController {
|
||||
|
||||
@Resource
|
||||
ChartService chartService;
|
||||
@Resource
|
||||
GlobalConfig globalConfig;
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/check")
|
||||
@OperationIgnore
|
||||
public ApiResp<TsTableVO> check(@RequestBody @Valid ChartTemplateCheck dto) {
|
||||
|
||||
if (dto.getTemplate() == null) {
|
||||
dto.setTemplate(chartService.getById(dto.getTemplateId()));
|
||||
}
|
||||
if (dto.getTemplate() == null) {
|
||||
throw new ApiException("请选择或创建一个模版");
|
||||
}
|
||||
|
||||
try {
|
||||
List<JSONObject> chartRecordVOS = chartService.getBaseMapper()
|
||||
.recordCheck(dto.getTemplate().getTableName(), dto.getCountType(),
|
||||
dto.getTableXField(), dto.getWhere(),
|
||||
dto.getTemplate().getSField(),
|
||||
dto.getTableGroupBy());
|
||||
chartRecordVOS.forEach(it -> {
|
||||
it.put("xField", StrUtil.emptyToDefault(it.getString("xField"), "未分类"));
|
||||
});
|
||||
|
||||
return ApiResp.respOK(TsTableVO.of(dto.getTemplate(), chartRecordVOS));
|
||||
} catch (Exception e) {
|
||||
throw new ApiException("表或字段配置有误,请检查");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/export")
|
||||
@OperationIgnore
|
||||
public ApiResp<String> export(@RequestBody @Valid ChartTemplateCheck dto) {
|
||||
TsTableVO tsTableVO = check(dto).getData();
|
||||
if (tsTableVO.getDataSource().isEmpty()) {
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
List<List<String>> headers = new ArrayList<>();
|
||||
for (TsTableVO.TableColumn column : tsTableVO.getColumns()) {
|
||||
headers.add(CollUtil.newArrayList(column.getTitle()));
|
||||
}
|
||||
|
||||
List<List<String>> contents = new ArrayList<>();
|
||||
|
||||
for (JSONObject obj : tsTableVO.getDataSource()) {
|
||||
List<String> data = new ArrayList<>();
|
||||
|
||||
for (TsTableVO.TableColumn column : tsTableVO.getColumns()) {
|
||||
data.add(obj.getString(column.getDataIndex()));
|
||||
}
|
||||
contents.add(data);
|
||||
}
|
||||
|
||||
FileUploadPath xls = FileUploadPath.random("xls");
|
||||
EasyExcel.write(xls.getAbsolutePath())
|
||||
.sheet("数据统计")
|
||||
.registerWriteHandler(new AliExcelUtil.ChatColumnWidthStyleStrategy())
|
||||
.registerWriteHandler(new SimpleRowHeightStyleStrategy((short) 24, null))
|
||||
.registerWriteHandler(AliExcelUtil.getCustomStyle())
|
||||
.head(headers)
|
||||
.doWrite(contents);
|
||||
|
||||
return ApiResp.respOK(globalConfig.buildPath(xls.getHttpPath()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
package com.tiesheng.role.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.tiesheng.annotation.role.RoleAuthority;
|
||||
import com.tiesheng.annotation.token.TokenIgnore;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTable;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTemplate;
|
||||
import com.tiesheng.role.pojos.dto.ChartTableEditDTO;
|
||||
import com.tiesheng.role.pojos.dto.ChartTemplateEditDTO;
|
||||
import com.tiesheng.role.service.ChartService;
|
||||
import com.tiesheng.util.exception.ApiException;
|
||||
import com.tiesheng.util.pojos.ApiResp;
|
||||
import com.tiesheng.util.pojos.IdDTO;
|
||||
import com.tiesheng.util.pojos.PageDTO;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/chart/template")
|
||||
@RoleAuthority(value = "template", group = "chart")
|
||||
public class ChartTemplateController {
|
||||
|
||||
@Resource
|
||||
ChartService chartService;
|
||||
|
||||
|
||||
/**
|
||||
* 获取模版列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public ApiResp<List<CoreChartTemplate>> page(PageDTO dto) {
|
||||
|
||||
QueryWrapper<CoreChartTemplate> queryWrapper = new QueryWrapper<CoreChartTemplate>()
|
||||
.eq("is_deleted", 0)
|
||||
.like(StrUtil.isNotEmpty(dto.getKeyword()), "table_name", dto.getKeyword())
|
||||
.orderByAsc("sort");
|
||||
dto.likeColumns(queryWrapper, "name", "table_name", "table_title");
|
||||
|
||||
Page<CoreChartTemplate> page = dto.pageObj();
|
||||
chartService.page(page, queryWrapper);
|
||||
return ApiResp.respOK(page.getRecords(), page.getTotal());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模版列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/edit")
|
||||
public ApiResp<String> edit(@RequestBody @Valid ChartTemplateEditDTO dto) {
|
||||
dto.setSField(StrUtil.emptyToDefault(dto.getSField(), ""));
|
||||
CoreChartTemplate template = BeanUtil.copyProperties(dto, CoreChartTemplate.class);
|
||||
template.setExts(JSON.toJSONString(dto.getExts()));
|
||||
chartService.saveOrUpdate(template);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取模版列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/del")
|
||||
public ApiResp<String> del(@RequestBody @Valid IdDTO dto) {
|
||||
chartService.update(null, new UpdateWrapper<CoreChartTemplate>()
|
||||
.set("is_deleted", 1)
|
||||
.eq("id", dto.getId())
|
||||
.eq("is_deleted", 0)
|
||||
);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
///////////////////////////// 表信息
|
||||
|
||||
|
||||
/**
|
||||
* 获取模版列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/table/list")
|
||||
public ApiResp<List<CoreChartTable>> tableList(PageDTO dto) {
|
||||
List<CoreChartTable> list = chartService.getCoreChartTableMapper()
|
||||
.selectList(new QueryWrapper<CoreChartTable>()
|
||||
.eq("is_deleted", 0)
|
||||
.like(StrUtil.isNotEmpty(dto.getKeyword()), "table_name", dto.getKeyword())
|
||||
);
|
||||
return ApiResp.respOK(list, list.size());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取模版列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/table/edit")
|
||||
public ApiResp<String> tableEdit(@RequestBody @Valid ChartTableEditDTO dto) {
|
||||
|
||||
CoreChartTable exist = chartService.getCoreChartTableMapper().selectOne(
|
||||
new QueryWrapper<CoreChartTable>()
|
||||
.eq("table_name", dto.getTableName())
|
||||
.ne(StrUtil.isNotEmpty(dto.getId()), "id", dto.getId())
|
||||
.last("limit 1")
|
||||
);
|
||||
if (exist != null) {
|
||||
throw new ApiException("不可添加重复的表名");
|
||||
}
|
||||
|
||||
CoreChartTable template = BeanUtil.copyProperties(dto, CoreChartTable.class);
|
||||
template.setIsDeleted(0);
|
||||
template.setColumns(JSON.toJSONString(dto.getColumns()));
|
||||
if (StrUtil.isNotEmpty(dto.getId())) {
|
||||
chartService.getCoreChartTableMapper().updateById(template);
|
||||
} else {
|
||||
chartService.getCoreChartTableMapper().insert(template);
|
||||
}
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取模版列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/table/del")
|
||||
public ApiResp<String> tableDel(@RequestBody @Valid IdDTO dto) {
|
||||
chartService.getCoreChartTableMapper().update(null, new UpdateWrapper<CoreChartTable>()
|
||||
.set("is_deleted", 1)
|
||||
.eq("id", dto.getId())
|
||||
.eq("is_deleted", 0)
|
||||
);
|
||||
return ApiResp.respOK("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取table详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/table/info")
|
||||
@TokenIgnore
|
||||
public ApiResp<CoreChartTable> getTableInfo(String tableName) {
|
||||
return ApiResp.respOK(chartService.getCoreChartTableMapper().selectOne(new QueryWrapper<CoreChartTable>()
|
||||
.eq("is_deleted", 0)
|
||||
.eq("table_name", tableName)
|
||||
.last("limit 1")
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.tiesheng.role.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTable;
|
||||
|
||||
public interface CoreChartTableMapper extends BaseMapper<CoreChartTable> {
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.tiesheng.role.mapper;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTemplate;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CoreChartTemplateMapper extends BaseMapper<CoreChartTemplate> {
|
||||
/**
|
||||
* 根据字段查询数据
|
||||
*
|
||||
* @param table
|
||||
* @param xField
|
||||
* @param where
|
||||
* @param sField
|
||||
* @return
|
||||
*/
|
||||
List<JSONObject> recordCheck(@Param("table") String table,
|
||||
@Param("type") String type,
|
||||
@Param("xField") String xField,
|
||||
@Param("where") String where,
|
||||
@Param("sField") String sField,
|
||||
@Param("groupBy") String groupBy
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.tiesheng.role.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.util.pojos.DaoBase;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 图表-表信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "core_chart_table")
|
||||
public class CoreChartTable extends DaoBase {
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@TableField(value = "`table_name`")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "table_title")
|
||||
private String tableTitle;
|
||||
|
||||
/**
|
||||
* 所有字段
|
||||
*/
|
||||
@TableField(value = "`columns`")
|
||||
private String columns;
|
||||
|
||||
/**
|
||||
* 其他说明
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.tiesheng.role.pojos.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.tiesheng.util.pojos.DaoBase;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 图表-表信息
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "core_chart_template")
|
||||
public class CoreChartTemplate extends DaoBase {
|
||||
/**
|
||||
* 模版名称
|
||||
*/
|
||||
@TableField(value = "`name`")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 表名
|
||||
*/
|
||||
@TableField(value = "`table_name`")
|
||||
private String tableName;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@TableField(value = "table_title")
|
||||
private String tableTitle;
|
||||
|
||||
/**
|
||||
* 统计方式
|
||||
*/
|
||||
@TableField(value = "`type`")
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* X轴字段
|
||||
*/
|
||||
@TableField(value = "x_field")
|
||||
private String xField;
|
||||
|
||||
@TableField(value = "x_field_name")
|
||||
private String xFieldName;
|
||||
|
||||
/**
|
||||
* X轴格式化,只有X轴字段为date时有效
|
||||
*/
|
||||
@TableField(value = "x_format")
|
||||
private String xFormat;
|
||||
|
||||
/**
|
||||
* S轴字段
|
||||
*/
|
||||
@TableField(value = "s_field")
|
||||
private String sField;
|
||||
|
||||
@TableField(value = "s_field_name")
|
||||
private String sFieldName;
|
||||
|
||||
/**
|
||||
* 附件条件
|
||||
*/
|
||||
@TableField(value = "exts")
|
||||
private String exts;
|
||||
|
||||
/**
|
||||
* 其他说明
|
||||
*/
|
||||
@TableField(value = "remark")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField(value = "sort")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.tiesheng.role.pojos.dto;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChartTableEditDTO {
|
||||
|
||||
private String id;
|
||||
|
||||
@NotEmpty(message = "请输入【表名】")
|
||||
private String tableName;
|
||||
|
||||
@NotEmpty(message = "请输入【名称】")
|
||||
private String tableTitle;
|
||||
|
||||
@Size(min = 1, message = "请配置【表字段】")
|
||||
private List<TableColumn> columns;
|
||||
private String remark;
|
||||
|
||||
|
||||
@Data
|
||||
public static class TableColumn {
|
||||
private String key;
|
||||
private String type;
|
||||
private String remark;
|
||||
private String enums;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
package com.tiesheng.role.pojos.dto;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTemplate;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Data
|
||||
public class ChartTemplateCheck {
|
||||
|
||||
private String templateId;
|
||||
private CoreChartTemplate template;
|
||||
private String xFormat;
|
||||
private List<ChartTemplateEditDTO.TemplateExt> exts;
|
||||
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public String getTableXField() {
|
||||
String tmpXFormat = StrUtil.emptyToDefault(getXFormat(), getTemplate().getXFormat());
|
||||
if (StrUtil.isNotEmpty(tmpXFormat)) {
|
||||
return StrUtil.format("DATE_FORMAT({},'{}')", getTemplate().getXField(), tmpXFormat);
|
||||
}
|
||||
return getTemplate().getXField();
|
||||
}
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public String getTableGroupBy() {
|
||||
if (StrUtil.isNotEmpty(getTemplate().getSField())) {
|
||||
return StrUtil.format("{},{}", getTableXField(), getTemplate().getSField());
|
||||
}
|
||||
return getTableXField();
|
||||
}
|
||||
|
||||
public String getCountType() {
|
||||
if (Objects.equals(getTemplate().getType(), "count_1")) {
|
||||
return "count(1)";
|
||||
}
|
||||
return "sum(" + getTemplate().getType() + ")";
|
||||
}
|
||||
|
||||
|
||||
@JSONField(serialize = false)
|
||||
public String getWhere() {
|
||||
if (CollUtil.isEmpty(getExts())) {
|
||||
setExts(JSON.parseArray(getTemplate().getExts(), ChartTemplateEditDTO.TemplateExt.class));
|
||||
}
|
||||
if (CollUtil.isEmpty(getExts())) {
|
||||
return "";
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<>();
|
||||
for (ChartTemplateEditDTO.TemplateExt templateExt : getExts()) {
|
||||
if (templateExt.isErrorExt()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (Objects.equals(templateExt.getAction(), "eq")) {
|
||||
list.add(StrUtil.format("{} = '{}'", templateExt.getKey(), templateExt.getValue()));
|
||||
} else if (Objects.equals(templateExt.getAction(), "ne")) {
|
||||
list.add(StrUtil.format("{} != '{}'", templateExt.getKey(), templateExt.getValue()));
|
||||
} else if (Objects.equals(templateExt.getAction(), "btw")) {
|
||||
List<String> split = StrUtil.split(templateExt.getValue(), ",");
|
||||
if (split.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (split.size() == 1) {
|
||||
list.add(StrUtil.format("{} > '{}'", templateExt.getKey(), split.get(0)));
|
||||
} else {
|
||||
list.add(StrUtil.format("{} between '{}' and '{}'", templateExt.getKey(), split.get(0), split.get(1)));
|
||||
}
|
||||
} else if (Objects.equals(templateExt.getAction(), "nbtw")) {
|
||||
List<String> split = StrUtil.split(templateExt.getValue(), ",");
|
||||
if (split.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
if (split.size() == 1) {
|
||||
list.add(StrUtil.format("{} < '{}'", templateExt.getKey(), split.get(0)));
|
||||
} else {
|
||||
list.add(StrUtil.format("{} not between '{}' and '{}'", templateExt.getKey(), split.get(0), split.get(1)));
|
||||
}
|
||||
} else if (Objects.equals(templateExt.getAction(), "in")) {
|
||||
List<String> split = StrUtil.split(templateExt.getValue(), ",");
|
||||
if (split.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
list.add(StrUtil.format("{} in ({})", templateExt.getKey(), split.stream().map(it -> "'" + it + "'")
|
||||
.collect(Collectors.joining(","))));
|
||||
} else if (Objects.equals(templateExt.getAction(), "nin")) {
|
||||
List<String> split = StrUtil.split(templateExt.getValue(), ",");
|
||||
if (split.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
list.add(StrUtil.format("{} not in ({})", templateExt.getKey(), split.stream().map(it -> "'" + it + "'")
|
||||
.collect(Collectors.joining(","))));
|
||||
}
|
||||
}
|
||||
|
||||
return StrUtil.join(" and ", list);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.tiesheng.role.pojos.dto;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class ChartTemplateEditDTO {
|
||||
|
||||
private String id;
|
||||
|
||||
@NotEmpty(message = "请输入【模版名称】")
|
||||
private String name;
|
||||
|
||||
@NotEmpty(message = "请选择【表名】")
|
||||
private String tableName;
|
||||
private String tableTitle;
|
||||
|
||||
@NotEmpty(message = "请选择【X轴字段】")
|
||||
private String xField;
|
||||
private String xFieldName;
|
||||
private String xFormat;
|
||||
|
||||
private String sField;
|
||||
private String sFieldName;
|
||||
private String type;
|
||||
private List<TemplateExt> exts;
|
||||
private String remark;
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@Data
|
||||
public static class TemplateExt {
|
||||
private String key;
|
||||
private String action;
|
||||
private String value;
|
||||
|
||||
|
||||
/**
|
||||
* 该数据是否有效
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
public boolean isErrorExt() {
|
||||
return StrUtil.isEmpty(getKey()) || StrUtil.isEmpty(getAction()) || StrUtil.isEmpty(getValue());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.tiesheng.role.pojos.vo;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTemplate;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TsTableVO {
|
||||
|
||||
private List<TableColumn> columns;
|
||||
private List<JSONObject> dataSource;
|
||||
|
||||
|
||||
@Data
|
||||
public static class TableColumn {
|
||||
private String title;
|
||||
private String dataIndex;
|
||||
private String width;
|
||||
|
||||
public TableColumn(String title, String dataIndex) {
|
||||
this.title = title;
|
||||
this.dataIndex = dataIndex;
|
||||
}
|
||||
}
|
||||
|
||||
public TsTableVO addHeader(String title, String dataIndex) {
|
||||
if (getColumns() == null) {
|
||||
setColumns(CollUtil.newArrayList());
|
||||
}
|
||||
getColumns().add(new TableColumn(title, dataIndex));
|
||||
return this;
|
||||
}
|
||||
|
||||
public TsTableVO addData(JSONObject obj) {
|
||||
if (getDataSource() == null) {
|
||||
setDataSource(CollUtil.newArrayList());
|
||||
}
|
||||
getDataSource().add(obj);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public static TsTableVO of(CoreChartTemplate template, List<JSONObject> originData) {
|
||||
|
||||
TsTableVO tsTableVO = new TsTableVO();
|
||||
tsTableVO.addHeader(template.getXFieldName(), "xField");
|
||||
List<String> split = StrUtil.split(template.getSField(), ",");
|
||||
List<String> sFieldNameList = StrUtil.split(template.getSFieldName(), ",");
|
||||
if (!split.isEmpty() && split.size() == sFieldNameList.size()) {
|
||||
int idx = 0;
|
||||
for (String dataIndex : split) {
|
||||
tsTableVO.addHeader(CollUtil.get(sFieldNameList, idx), StrUtil.toCamelCase(dataIndex));
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
tsTableVO.addHeader("统计", "yField");
|
||||
tsTableVO.setDataSource(originData);
|
||||
return tsTableVO;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.tiesheng.role.service;
|
||||
|
||||
import com.tiesheng.role.mapper.CoreChartTableMapper;
|
||||
import com.tiesheng.role.mapper.CoreChartTemplateMapper;
|
||||
import com.tiesheng.role.pojos.dao.CoreChartTemplate;
|
||||
import com.tiesheng.util.service.TsServiceBase;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.Getter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class ChartService extends TsServiceBase<CoreChartTemplateMapper, CoreChartTemplate> {
|
||||
|
||||
@Getter
|
||||
@Resource
|
||||
CoreChartTableMapper coreChartTableMapper;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.tiesheng.role.util;
|
||||
|
||||
import com.alibaba.excel.metadata.Head;
|
||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||
import com.alibaba.excel.write.metadata.style.WriteFont;
|
||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||
import com.alibaba.excel.write.style.column.AbstractHeadColumnWidthStyleStrategy;
|
||||
import org.apache.poi.ss.usermodel.FillPatternType;
|
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment;
|
||||
import org.apache.poi.ss.usermodel.IndexedColors;
|
||||
import org.apache.poi.ss.usermodel.VerticalAlignment;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
*/
|
||||
public class AliExcelUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static HorizontalCellStyleStrategy getCustomStyle() {
|
||||
|
||||
// 头的策略
|
||||
WriteCellStyle headWriteCellStyle = new WriteCellStyle();
|
||||
WriteFont headWriteFont = new WriteFont();
|
||||
headWriteFont.setBold(true);
|
||||
headWriteFont.setFontHeightInPoints((short) 12);
|
||||
headWriteCellStyle.setWriteFont(headWriteFont);
|
||||
headWriteCellStyle.setFillBackgroundColor(IndexedColors.ROYAL_BLUE.getIndex());
|
||||
headWriteCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND);
|
||||
|
||||
// 内容的策略
|
||||
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
|
||||
WriteFont contentWriteFont = new WriteFont();
|
||||
contentWriteFont.setFontHeightInPoints((short) 11);
|
||||
contentWriteCellStyle.setWriteFont(contentWriteFont);
|
||||
contentWriteCellStyle.setWrapped(true);
|
||||
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER);
|
||||
|
||||
return new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
|
||||
}
|
||||
|
||||
public static class ChatColumnWidthStyleStrategy extends AbstractHeadColumnWidthStyleStrategy {
|
||||
|
||||
@Override
|
||||
protected Integer columnWidth(Head head, Integer integer) {
|
||||
if (head.getColumnIndex() == 0) {
|
||||
return 20;
|
||||
}
|
||||
return (head.getHeadNameList().get(0).length()) * 2 + 10;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
create table core_chart_table
|
||||
(
|
||||
id varchar(50) not null
|
||||
primary key,
|
||||
create_time datetime not null,
|
||||
update_time datetime not null,
|
||||
is_deleted int default 0 not null,
|
||||
table_name varchar(100) not null comment '表名',
|
||||
table_title varchar(500) not null comment '名称',
|
||||
columns text not null comment '所有字段',
|
||||
remark text null comment '其他说明'
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci
|
||||
comment '图表-表信息'
|
||||
row_format = DYNAMIC;
|
||||
|
||||
create table core_chart_template
|
||||
(
|
||||
id varchar(50) not null
|
||||
primary key,
|
||||
create_time datetime not null,
|
||||
update_time datetime not null,
|
||||
is_deleted int default 0 not null,
|
||||
name varchar(100) not null comment '模版名称',
|
||||
table_name varchar(100) not null comment '表名',
|
||||
table_title varchar(100) not null comment '名称',
|
||||
type varchar(50) default 'count_1' null comment '统计方式',
|
||||
x_field varchar(100) not null comment 'X轴字段',
|
||||
x_field_name varchar(500) not null comment 'X轴字段',
|
||||
x_format varchar(100) null comment 'X轴格式化,只有X轴字段为date时有效',
|
||||
s_field varchar(100) null comment 'S轴字段',
|
||||
s_field_name varchar(500) null comment 'S轴字段',
|
||||
exts text null comment '附件条件',
|
||||
remark text null comment '其他说明',
|
||||
sort int default 0 null comment '排序'
|
||||
)
|
||||
ENGINE = InnoDB
|
||||
CHARACTER SET = utf8mb4
|
||||
COLLATE = utf8mb4_general_ci
|
||||
comment '图表-表信息'
|
||||
row_format = DYNAMIC;
|
||||
@@ -0,0 +1,20 @@
|
||||
<?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.zaxy.alarm.mapper.CoreChartTableMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.zaxy.alarm.pojos.dao.CoreChartTable">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_chart_table-->
|
||||
<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="table_name" jdbcType="VARCHAR" property="tableName" />
|
||||
<result column="table_title" jdbcType="VARCHAR" property="tableTitle" />
|
||||
<result column="columns" jdbcType="LONGVARCHAR" property="columns" />
|
||||
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, `table_name`, table_title, `columns`, remark
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?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.zaxy.alarm.mapper.CoreChartTemplateMapper">
|
||||
<resultMap id="BaseResultMap" type="com.tiesheng.zaxy.alarm.pojos.dao.CoreChartTemplate">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table core_chart_template-->
|
||||
<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="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="table_name" jdbcType="VARCHAR" property="tableName" />
|
||||
<result column="table_title" jdbcType="VARCHAR" property="tableTitle" />
|
||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||
<result column="x_field" jdbcType="VARCHAR" property="xField" />
|
||||
<result column="x_field_name" jdbcType="VARCHAR" property="xFieldName" />
|
||||
<result column="x_format" jdbcType="VARCHAR" property="xFormat" />
|
||||
<result column="s_field" jdbcType="VARCHAR" property="sField" />
|
||||
<result column="s_field_name" jdbcType="VARCHAR" property="sFieldName" />
|
||||
<result column="exts" jdbcType="LONGVARCHAR" property="exts" />
|
||||
<result column="remark" jdbcType="LONGVARCHAR" property="remark" />
|
||||
<result column="sort" jdbcType="INTEGER" property="sort" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, create_time, update_time, is_deleted, `name`, `table_name`, table_title, `type`,
|
||||
x_field, x_field_name, x_format, s_field, s_field_name, exts, remark, sort
|
||||
</sql>
|
||||
|
||||
<select id="recordCheck" resultType="com.alibaba.fastjson.JSONObject">
|
||||
select ${xField} x_field,
|
||||
<if test="sField != null and sField != ''">
|
||||
${sField},
|
||||
</if>
|
||||
${type} y_field
|
||||
from ${table}
|
||||
where 1 = 1
|
||||
<if test="where != null and where != ''">
|
||||
and ${where}
|
||||
</if>
|
||||
<if test="groupBy != null and groupBy != ''">
|
||||
group by ${groupBy}
|
||||
</if>
|
||||
order by ${groupBy} asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -6,14 +6,14 @@
|
||||
<parent>
|
||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||
<artifactId>springboot-parent</artifactId>
|
||||
<version>2.0.0.rc5</version>
|
||||
<version>4.0.0.alpha1</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>springboot-database</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
@@ -9,13 +9,13 @@ import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.db.Db;
|
||||
import cn.hutool.db.Entity;
|
||||
import com.tiesheng.database.config.DbMigrationConfig;
|
||||
import jakarta.servlet.ServletContext;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
import javax.sql.DataSource;
|
||||
import java.io.InputStream;
|
||||
import java.sql.SQLException;
|
||||
|
||||