Compare commits

...

36 Commits
0.8.2 ... 0.9.8

Author SHA1 Message Date
曾文豪
2f22b64c0e publish 0.9.8 2023-04-06 09:57:37 +08:00
曾文豪
4e6b108e7e publish 0.9.8 2023-04-06 09:54:01 +08:00
曾文豪
24629f06b4 publish 0.9.7 2023-04-06 00:05:49 +08:00
曾文豪
47c9251389 publish 0.9.7 2023-04-06 00:01:26 +08:00
曾文豪
dda5f64910 publish 0.9.7 2023-04-05 23:42:58 +08:00
曾文豪
704030729a publish 0.9.7 2023-04-05 23:38:21 +08:00
曾文豪
c708809a19 perf:登录导入进度 2023-04-05 23:36:51 +08:00
曾文豪
2bbec9b79a perf:登录调整 2023-04-05 23:06:09 +08:00
曾文豪
e19f27f597 publish 0.9.6 2023-03-31 16:33:21 +08:00
曾文豪
68781d4685 publish 0.9.5 2023-03-31 16:12:44 +08:00
曾文豪
da69124968 publish 0.9.4 2023-03-31 14:21:32 +08:00
曾文豪
8d9632bcaa perf:调整消息通知 2023-03-31 14:21:07 +08:00
曾文豪
1c0e63bf98 publish 0.9.3 2023-03-31 12:07:21 +08:00
曾文豪
c04d45431c publish 0.9.3 2023-03-31 11:54:21 +08:00
曾文豪
c5f8508a9e perf:增加版本对比器 2023-03-31 10:35:21 +08:00
曾文豪
06f295bb66 publish 0.9.2 2023-03-28 17:56:59 +08:00
曾文豪
bfc578e77c publish 0.9.1 2023-03-28 17:12:19 +08:00
曾文豪
b5c10fc224 feat:职位表增加扩展 2023-03-28 17:12:01 +08:00
曾文豪
60580b40a4 publish 0.9.0 2023-03-28 16:43:14 +08:00
曾文豪
af70808da6 feat:增加职位管理功能 2023-03-28 16:40:54 +08:00
2715557295@qq.com
c446ee8f75 publish 0.8.8 2023-03-24 09:39:04 +08:00
2715557295@qq.com
86384a1f23 publish 0.8.7 2023-03-22 17:22:54 +08:00
2715557295@qq.com
d63b6ab094 publish 0.8.7 2023-03-22 16:52:51 +08:00
2715557295@qq.com
020d1d99e1 publish 0.8.6 2023-03-22 11:12:23 +08:00
曾文豪
32fb562775 publish 0.8.5 2023-03-14 14:20:56 +08:00
曾文豪
af50468743 perf: 调整token校验 2023-03-14 14:20:23 +08:00
曾文豪
cab794ecc4 Merge branch 'test-uploadDir' into 'master'
GlobalConfig新加uploadDir配置

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

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -1,9 +1,21 @@
## 0.9.3
> 1增加版本对比器防止某些情况下版本对比失效
>
## 0.8.3
### 调整
> 1优化返回数据加密
> 2上传文件接口调整统一为**application/json**格式;
## 0.8.0
### 调整
> 1移除**PasswordUtil**类,新增**EncryptConfig**配置;
> 2默认启用网络请求的加解密前端请配合接口使用。
> 2默认启用网络请求的加解密前端请配合接口使用。
## 0.7.4

20
pom.xml
View File

@@ -6,7 +6,7 @@
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
<packaging>pom</packaging>
<name>springboot-parent</name>
<description>杭州铁晟科技有限公司基础依赖</description>
@@ -57,55 +57,55 @@
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-database</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-login</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-web</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-util</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-platform</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-message</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-encrypt</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-annotation</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-poi</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</dependency>
<dependency>

BIN
springboot-ademo/.DS_Store vendored Normal file

Binary file not shown.

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-ademo</artifactId>

View File

@@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableTransactionManagement
@SpringBootApplication
@EnableTieshengWeb(webConfigurer = DemoWebConfigurer.class)
@EnableEncryptConfig
//@EnableEncryptConfig
public class DemoApplication {
public static void main(String[] args) {

View File

@@ -27,30 +27,28 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
}
@Override
public LoginConfigurer loginConfigurer() {
return new LoginConfigurer() {
@Override
public TokenBean doLogin(CorePlatformUnique platformUnique, String to) {
public TokenBean login(CorePlatformUnique platformUnique) {
TokenBean tokenBean = null;
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
} else {
// 获取用户信息判断是否可登录
// 默认跳转到mobile
to = StrUtil.emptyToDefault(to, "mobile");
}
TokenBean tokenBean = null;
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
tokenBean = new TokenBean(platformUnique.getUserId(), to, globalConfig.getService());
} else {
// 获取用户信息判断是否可登录
}
return tokenBean;
}
@Override
public void redirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
if (Objects.equals(bean.getEnvironmentType(), "mobile")) {
globalConfig.redirect("mobile", "/?token=" + bean.toToken(), response);
}
}
};
return tokenBean;
}
@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);
}
}
}

View File

@@ -0,0 +1,32 @@
package com.tiesheng.demo.config;
import com.tiesheng.core.service.CoreConfigService;
import com.tiesheng.core.service.CoreJobService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
/**
* @author hao
*/
@Component
public class TestJobConfig {
@Autowired
CoreJobService coreJobService;
@Autowired
CoreConfigService coreConfigService;
@PostConstruct
public void init() {
coreConfigService.refreshFunc("230328001", "demo", "辅导员统计", "辅导员责任班级,学生展示");
// 辅导员职位
coreJobService.refresh("class_fdy", "辅导员", "辅导员", 1);
}
}

View File

@@ -4,10 +4,10 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.json.JSONUtil;
import cn.hutool.log.LogFactory;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.core.service.CoreMessageService;
import com.tiesheng.demo.pojos.TestFile;
import com.tiesheng.login.config.token.TsTokenConfig;
import com.tiesheng.login.config.token.bean.TokenBean;
import com.tiesheng.message.config.aliyun.AliyunSmsConfig;
import com.tiesheng.message.pojos.MessageReqResp;
import com.tiesheng.util.config.EncryptConfig;
import com.tiesheng.util.config.GlobalConfig;
@@ -31,17 +31,16 @@ public class TestController {
@Autowired
GlobalConfig globalConfig;
@Autowired
AliyunSmsConfig aliyunSmsConfig;
@Autowired
TsTokenConfig tsTokenConfig;
@Autowired
Ip2regionConfig ip2regionConfig;
@Autowired
EncryptConfig encryptConfig;
@Autowired
CoreMessageService coreMessageService;
@RequestMapping("/index")
@TokenIgnore
public ApiResp<String> index() {
TokenBean tokenBean = new TokenBean("11", "", "fdfd");
@@ -54,20 +53,22 @@ public class TestController {
@TokenIgnore
public void redirect(HttpServletResponse response) {
// tsTokenConfig.validToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzYwMDY4NzUsImlkIjoiMSIsImVudmlyb25tZW50VHlwZSI6Im1vYmlsZSIsInNlcnZpY2UiOiJjb250ZXN0LXJlc2VydmUiLCJleHRyYSI6IiJ9.nsfxEFpCNHC7eNCS5DJXdu1VDdnHrTjSfgrozND70Lc", true);
// globalConfig.redirect("mobile", "/test", response);
globalConfig.redirect("mobile", "/test", response);
}
@RequestMapping("/send")
@TokenIgnore
public ApiResp<MessageReqResp> sendMessage() {
MessageReqResp reqResp = aliyunSmsConfig.sendSms("13567116463", "SMS_154950909",
JSONUtil.createObj().putOpt("code", "123456"));
MessageReqResp reqResp = coreMessageService.send("13567116463", "SMS_154950909",
JSONUtil.createObj().putOpt("code", "123456"), "sms");
return ApiResp.respOK(reqResp);
}
@RequestMapping("/export")
@TokenIgnore
public ApiResp<String> export() {
// List<TestFile> list = new ArrayList<>();
@@ -102,7 +103,9 @@ public class TestController {
@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));
}

View File

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

View File

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

View File

@@ -21,7 +21,7 @@ tiesheng:
id: "1111"
global:
version: 2
host: http://localhost:8080
host: http://localhost:8100
aliyun:
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG

View File

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

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-annotation</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-database</artifactId>

View File

@@ -8,6 +8,7 @@ import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.db.Db;
import cn.hutool.db.Entity;
import cn.hutool.log.LogFactory;
import com.tiesheng.database.config.DbMigrationConfig;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletContextInitializer;
@@ -22,6 +23,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.Checksum;
/**
@@ -92,6 +94,8 @@ public class DbMigrationInitializer implements ServletContextInitializer {
if (entity == null) {
return;
}
AtomicReference<Integer> success= new AtomicReference<>(0);
AtomicReference<Integer> fail= new AtomicReference<>(0);
db.tx((VoidFunc1<Db>) parameter -> {
List<String> split = StrUtil.split(readUtf8, ";");
for (String sql : split) {
@@ -104,11 +108,13 @@ public class DbMigrationInitializer implements ServletContextInitializer {
}
try {
parameter.execute(sql);
success.getAndSet(success.get() + 1);
} catch (Exception ignore) {
fail.getAndSet(fail.get() + 1);
}
}
});
LogFactory.get().info("执行sql文件{},成功数:{},失败数:{}。",filename,success.get(),fail.get());
entity.set("checksum", checksum.getValue());
entity.set("update_time", DateUtil.date());
db.update(entity, Entity.create(dbMigrationConfig.getTable()).set("id", entity.get("id")));

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-encrypt</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-login</artifactId>

View File

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

View File

@@ -58,8 +58,8 @@ public class LoginController {
*/
@GetMapping("/unique/redirect")
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_redirect",
dto.getNo(), dto.getPlatform(), dto.getInfo()));
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
}
@@ -72,8 +72,8 @@ public class LoginController {
*/
@PostMapping("/unique/index")
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
dto.getNo(), dto.getPlatform(), dto.getInfo()));
if (tokenBean == null) {
throw new ApiException("登录失败");
}
@@ -120,8 +120,7 @@ public class LoginController {
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
dingUserInfo.getUserid(), "ding", dto.getTo(),
JSON.toJSONString(dingUserInfo)));
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
}
@@ -167,7 +166,7 @@ public class LoginController {
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
wxUserInfo.getOpenid(), "wxmp", dto.getTo(), JSON.toJSONString(wxUserInfo)));
wxUserInfo.getOpenid(), "wxmp", JSON.toJSONString(wxUserInfo)));
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
}
@@ -198,7 +197,7 @@ public class LoginController {
String openid = platformWxminiConfig.jscode2session(service, code);
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(configBean.getAppId(),
openid, "wxmini", "mini", "{}"));
openid, "wxmini", "{}"));
WxminiLoginVo loginVo = new WxminiLoginVo();
loginVo.setOpenid(openid);

View File

@@ -5,15 +5,13 @@ public class DoLoginInfo {
private String appId;
private String unique;
private String platform;
private String to;
private String info;
private String extra;
public DoLoginInfo(String appId, String unique, String platform, String to, String info) {
public DoLoginInfo(String appId, String unique, String platform, String info) {
this.appId = appId;
this.unique = unique;
this.platform = platform;
this.to = to;
this.info = info;
}
@@ -45,14 +43,6 @@ public class DoLoginInfo {
this.platform = platform;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getInfo() {
return info;
}

View File

@@ -7,6 +7,7 @@ public class UniqueIndexDTO extends LoginToInfo {
private String no;
private String extra;
private String info;
private String platform = "web";
///////////////////////////////////////////////////////////////////////////
// setter\getter
@@ -38,4 +39,12 @@ public class UniqueIndexDTO extends LoginToInfo {
public void setInfo(String info) {
this.info = info;
}
public String getPlatform() {
return platform;
}
public void setPlatform(String platform) {
this.platform = platform;
}
}

View File

@@ -23,7 +23,7 @@ public interface TieshengLoginConfigurer {
/**
* 授权登录回调
*
* @param tokenBean
* @param bean
*/
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-message</artifactId>

View File

@@ -2,13 +2,13 @@ package com.tiesheng.message.config.aliyun;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.tiesheng.message.pojos.MessageReqResp;
import com.tiesheng.message.service.TieshengMessageConfigurer;
import org.springframework.beans.factory.annotation.Autowired;
import com.tiesheng.message.service.TieshengMessageSender;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;
@@ -22,16 +22,13 @@ import java.util.*;
*/
@Configuration
@ConfigurationProperties(prefix = "tiesheng.aliyun")
public class AliyunSmsConfig {
public class AliyunSmsSender implements TieshengMessageSender {
/**
* 请求地址
*/
private static final String ENDPOINT = "https://dysmsapi.aliyuncs.com";
@Autowired
TieshengMessageConfigurer tieshengMessageConfigurer;
private String accessKeyId;
private String accessKeySecret;
private String signName;
@@ -62,7 +59,7 @@ public class AliyunSmsConfig {
*/
public MessageReqResp sendSms(String phoneNumbers, String templateCode, JSONObject params) {
MessageReqResp reqResp = new MessageReqResp();
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
reqResp.setTarget(phoneNumbers);
reqResp.setResult(1);
reqResp.setContent(JSONUtil.createObj()
@@ -115,11 +112,24 @@ public class AliyunSmsConfig {
reqResp.setToast(respObj.getStr("Message"));
}
tieshengMessageConfigurer.onMessageSend("阿里云短信", reqResp);
return reqResp;
}
@Override
public MessageReqResp send(String user, String title, Object body) {
return sendSms(user, title, (JSONObject) body);
}
@Override
public String getChannel() {
return "sms";
}
@Override
public boolean support() {
return StrUtil.isAllNotEmpty(accessKeyId, accessKeySecret, signName);
}
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////

View File

@@ -2,6 +2,8 @@ package com.tiesheng.message.pojos;
public class MessageReqResp {
private String type;
/**
* 发送对象
*/
@@ -28,10 +30,22 @@ public class MessageReqResp {
*/
private String toast;
public MessageReqResp(String type) {
this.type = type;
}
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getTarget() {
return target;
}

View File

@@ -1,23 +0,0 @@
package com.tiesheng.message.service;
import cn.hutool.json.JSONUtil;
import cn.hutool.log.LogFactory;
import com.tiesheng.message.pojos.MessageReqResp;
/**
* @author hao
*/
public interface TieshengMessageConfigurer {
/**
* 消息发送后
*
* @param reqResp
*/
default void onMessageSend(String type, MessageReqResp reqResp) {
LogFactory.get().info(JSONUtil.toJsonStr(reqResp));
}
}

View File

@@ -0,0 +1,39 @@
package com.tiesheng.message.service;
import com.tiesheng.message.pojos.MessageReqResp;
/**
* @author hao
*/
public interface TieshengMessageSender {
/**
* 发送消息
*
* @param user
* @param title
* @param content
* @param body
* @param channel 消息通道,如果为空表示所有通道
* @return 返回的内容,如果为空表示发送成功
*/
MessageReqResp send(String user, String title, Object body);
/**
* 获取通道
*
* @return
*/
String getChannel();
/**
* 是否支持
*
* @return
*/
boolean support();
}

View File

@@ -1,11 +0,0 @@
package com.tiesheng.message.service.impl;
import com.tiesheng.message.service.TieshengMessageConfigurer;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Configuration;
@Configuration
@ConditionalOnMissingBean(value = TieshengMessageConfigurer.class, ignored = DefaultMessageConfigurer.class)
public class DefaultMessageConfigurer implements TieshengMessageConfigurer {
}

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-platform</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-poi</artifactId>

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-util</artifactId>

View File

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

View File

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

View File

@@ -1,5 +1,7 @@
package com.tiesheng.util.config;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.comparator.VersionComparator;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.spring.SpringUtil;
@@ -12,6 +14,8 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
* @author hao
@@ -23,6 +27,7 @@ public class GlobalConfig {
private String host;
private String service;
private String version;
private String uploadDir = System.getProperty("user.dir");
///////////////////////////////////////////////////////////////////////////
// 逻辑方法
@@ -61,15 +66,22 @@ public class GlobalConfig {
* @param route
*/
public void redirect(String htmlDir, String route, HttpServletResponse response) {
if (!StrUtil.endWith(htmlDir, "/")) {
htmlDir = htmlDir + "/";
}
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
try {
Resource[] resources = patternResolver.getResources(String.format("classpath*:static/%s/*/index.html", htmlDir));
if (resources.length == 0) {
Resource[] resources = patternResolver.getResources(String.format("classpath*:static/%s*/index.html", htmlDir));
List<String> versions = new ArrayList<>();
for (Resource resource : resources) {
String path = FileUtil.normalize(resource.getURL().getPath());
versions.add(StrUtil.subBetween(path, htmlDir, "/index.html"));
}
if (CollUtil.isEmpty(versions)) {
throw new ApiException("无法重定向,请检查资源");
}
String filename = resources[resources.length - 1].getURL().getPath();
filename = FileUtil.normalize(filename);
String path = buildPath(String.format("/%s%s#%s", htmlDir, StrUtil.subAfter(filename, htmlDir, true), route));
CollUtil.sort(versions, (o1, o2) -> -VersionComparator.INSTANCE.compare(o1, o2));
String path = buildPath(String.format("/%s%s/index.html#%s", htmlDir, versions.get(0), route));
response.sendRedirect(path);
} catch (IOException e) {
LogFactory.get().info(e);
@@ -80,6 +92,15 @@ public class GlobalConfig {
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getUploadDir() {
return uploadDir;
}
public void setUploadDir(String uploadDir) {
this.uploadDir = uploadDir;
}
public String getHost() {
return host;
}

View File

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

View File

@@ -0,0 +1,36 @@
package com.tiesheng.util.pojos;
public class IdName {
private String id;
private String name;
private String extra;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getExtra() {
return extra;
}
public void setExtra(String extra) {
this.extra = extra;
}
}

View File

@@ -6,7 +6,7 @@
<parent>
<groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId>
<version>0.8.2</version>
<version>0.9.8</version>
</parent>
<artifactId>springboot-web</artifactId>

View File

@@ -1,13 +1,16 @@
package com.tiesheng.core.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tiesheng.annotation.token.TokenIgnore;
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
import com.tiesheng.core.pojos.dto.PageDTO;
import com.tiesheng.core.pojos.dto.config.ConfigFuncDTO;
import com.tiesheng.core.pojos.dto.config.ConfigSystemDTO;
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
import com.tiesheng.core.service.CoreConfigService;
@@ -16,6 +19,7 @@ import com.tiesheng.util.pojos.ApiResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
@@ -95,4 +99,34 @@ public class ConfigController {
}
/**
* 功能点列表
*
* @return
*/
@GetMapping("/func/page")
public ApiResp<List<CoreConfigFunc>> funcList(Integer isUsed, PageDTO dto) {
QueryWrapper<CoreConfigFunc> queryWrapper = new QueryWrapper<CoreConfigFunc>().eq("is_deleted", 0);
if (isUsed != null) {
queryWrapper.eq("is_used", isUsed);
}
dto.likeColumns(queryWrapper, "name");
Page<CoreConfigFunc> page = dto.pageObj();
coreConfigService.getFuncMapper().selectPage(page, queryWrapper);
return ApiResp.respOK(page.getRecords(), page.getTotal());
}
/**
* 功能点更新
*
* @param dto
* @return
*/
@PostMapping("/func/update")
public ApiResp<String> funcUpdate(@Valid @RequestBody ConfigFuncDTO dto) {
CoreConfigFunc configFunc = BeanUtil.copyProperties(dto, CoreConfigFunc.class);
coreConfigService.getFuncMapper().updateById(configFunc);
return ApiResp.respOK("");
}
}

View File

@@ -0,0 +1,120 @@
package com.tiesheng.core.controller;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tiesheng.core.pojos.dao.CoreJob;
import com.tiesheng.core.pojos.dto.IdDTO;
import com.tiesheng.core.pojos.dto.PageDTO;
import com.tiesheng.core.pojos.dto.job.JobUpdateDTO;
import com.tiesheng.core.pojos.dto.job.JobUpdateRxDTO;
import com.tiesheng.core.pojos.dto.job.JobUserAssignDTO;
import com.tiesheng.core.pojos.dto.job.JobUserOwner;
import com.tiesheng.core.service.CoreJobService;
import com.tiesheng.login.config.token.TsTokenConfig;
import com.tiesheng.util.exception.ApiException;
import com.tiesheng.util.pojos.ApiResp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
/**
* @author hao
*/
@RestController
@RequestMapping("/job")
public class JobController {
@Autowired
CoreJobService coreJobService;
/**
* 获取职位列表
*
* @return
*/
@GetMapping("/list")
public ApiResp<List<CoreJob>> list(PageDTO dto) {
QueryWrapper<CoreJob> queryWrapper = new QueryWrapper<CoreJob>().eq("is_deleted", 0);
dto.likeColumns(queryWrapper, "name");
List<CoreJob> jobList = coreJobService.list(queryWrapper);
return ApiResp.respOK(jobList);
}
/**
* 添加、编辑职位
*
* @return
*/
@PostMapping("/update")
public ApiResp<String> update(@Valid @RequestBody JobUpdateDTO dto) {
CoreJob job = BeanUtil.copyProperties(dto, CoreJob.class);
if (!StrUtil.isEmpty(job.getId())) {
CoreJob byId = coreJobService.getById(job.getId());
if (byId != null && byId.getIsSystem() == 1) {
throw new ApiException("系统配置,无法编辑");
}
}
coreJobService.saveOrUpdate(job);
return ApiResp.respOK("");
}
/**
* 获取关系
*
* @param dto
* @return
*/
@GetMapping("/func/rx")
public ApiResp<List<String>> funcRx(@Valid IdDTO dto) {
List<String> list = coreJobService.getBaseMapper().getJobFunc(dto.getId(), null);
return ApiResp.respOK(list);
}
/**
* 更新职位关系
*
* @return
*/
@PostMapping("/func/rx")
public ApiResp<String> updateJobRx(@Valid @RequestBody JobUpdateRxDTO dto) {
coreJobService.updateJobRx(dto.getJobId(), StrUtil.split(dto.getPoints(), ","));
return ApiResp.respOK("");
}
/**
* 用户职位分配
*
* @return
*/
@PostMapping("/user/assign")
public ApiResp<String> userAssign(@Valid @RequestBody JobUserAssignDTO dto) {
coreJobService.userAssign(dto.getUserId(), dto.getJobId());
return ApiResp.respOK("");
}
/**
* 获取用户自己的
*
* @return
*/
@GetMapping("/user/owner")
public ApiResp<List<JobUserOwner>> userOwner() {
List<JobUserOwner> coreJobUsers = coreJobService.getJobUserMapper().list(TsTokenConfig.get().getId());
coreJobUsers.forEach(it -> {
List<String> list = coreJobService.getBaseMapper().getJobFunc(it.getJobId(), 1);
it.setPoints(list);
});
return ApiResp.respOK(coreJobUsers);
}
}

View File

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

View File

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

View File

@@ -0,0 +1,11 @@
package com.tiesheng.core.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
import com.tiesheng.util.pojos.IdName;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CoreConfigFuncMapper extends BaseMapper<CoreConfigFunc> {
}

View File

@@ -0,0 +1,36 @@
package com.tiesheng.core.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tiesheng.core.pojos.dao.CoreJob;
import com.tiesheng.util.pojos.IdName;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CoreJobMapper extends BaseMapper<CoreJob> {
/**
* 清除职位的关联关系
*
* @param jobId
*/
void clearJobFunc(@Param("jobId") String jobId);
/**
* 更新关联关系
*
* @param pointList
*/
void updateJobFunc(@Param("list") List<IdName> pointList);
/**
* 获取关联的func
*
* @param jobId
* @return
*/
List<String> getJobFunc(@Param("jobId") String jobId, @Param("isUsed") Integer isUsed);
}

View File

@@ -0,0 +1,18 @@
package com.tiesheng.core.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tiesheng.core.pojos.dao.CoreJobUser;
import com.tiesheng.core.pojos.dto.job.JobUserOwner;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CoreJobUserMapper extends BaseMapper<CoreJobUser> {
/**
* 获取指定用户的职位和功能点
*
* @param userId
* @return
*/
List<JobUserOwner> list(@Param("userId") String userId);
}

View File

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

View File

@@ -0,0 +1,110 @@
package com.tiesheng.core.pojos.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tiesheng.core.pojos.DaoBase;
import java.util.Date;
/**
* 职位-功能点
*/
@TableName(value = "core_config_func")
public class CoreConfigFunc extends DaoBase {
/**
* 业务
*/
@TableField(value = "service")
private String service;
/**
* 名称
*/
@TableField(value = "`name`")
private String name;
/**
* 其他说明
*/
@TableField(value = "remark")
private String remark;
/**
* 是否启用
*/
@TableField(value = "is_used")
private Integer isUsed;
/**
* 获取业务
*
* @return service - 业务
*/
public String getService() {
return service;
}
/**
* 设置业务
*
* @param service 业务
*/
public void setService(String service) {
this.service = service;
}
/**
* 获取名称
*
* @return name - 名称
*/
public String getName() {
return name;
}
/**
* 设置名称
*
* @param name 名称
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取其他说明
*
* @return remark - 其他说明
*/
public String getRemark() {
return remark;
}
/**
* 设置其他说明
*
* @param remark 其他说明
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* 获取是否启用
*
* @return is_used - 是否启用
*/
public Integer getIsUsed() {
return isUsed;
}
/**
* 设置是否启用
*
* @param isUsed 是否启用
*/
public void setIsUsed(Integer isUsed) {
this.isUsed = isUsed;
}
}

View File

@@ -0,0 +1,86 @@
package com.tiesheng.core.pojos.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tiesheng.core.pojos.DaoBase;
import java.util.Date;
/**
* 职位
*/
@TableName(value = "core_job")
public class CoreJob extends DaoBase {
/**
* 名称
*/
@TableField(value = "`name`")
private String name;
/**
* 其他说明
*/
@TableField(value = "remark")
private String remark;
/**
* 是否系统
*/
@TableField(value = "is_system")
private Integer isSystem;
/**
* 获取名称
*
* @return name - 名称
*/
public String getName() {
return name;
}
/**
* 设置名称
*
* @param name 名称
*/
public void setName(String name) {
this.name = name;
}
/**
* 获取其他说明
*
* @return remark - 其他说明
*/
public String getRemark() {
return remark;
}
/**
* 设置其他说明
*
* @param remark 其他说明
*/
public void setRemark(String remark) {
this.remark = remark;
}
/**
* 获取是否系统
*
* @return is_system - 是否系统
*/
public Integer getIsSystem() {
return isSystem;
}
/**
* 设置是否系统
*
* @param isSystem 是否系统
*/
public void setIsSystem(Integer isSystem) {
this.isSystem = isSystem;
}
}

View File

@@ -0,0 +1,158 @@
package com.tiesheng.core.pojos.dao;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.tiesheng.core.pojos.DaoBase;
import java.util.Date;
/**
* 职位-用户
*/
@TableName(value = "core_job_user")
public class CoreJobUser extends DaoBase {
/**
* 用户id
*/
@TableField(value = "user_id")
private String userId;
/**
* 用户
*/
@TableField(value = "job_id")
private String jobId;
/**
* 扩展1
*/
@TableField(value = "ext1")
private String ext1;
/**
* 扩展2
*/
@TableField(value = "ext2")
private String ext2;
/**
* 扩展3
*/
@TableField(value = "ext3")
private String ext3;
/**
* 扩展文本
*/
@TableField(value = "ext_text")
private String extText;
/**
* 获取用户id
*
* @return user_id - 用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置用户id
*
* @param userId 用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取用户
*
* @return job_id - 用户
*/
public String getJobId() {
return jobId;
}
/**
* 设置用户
*
* @param jobId 用户
*/
public void setJobId(String jobId) {
this.jobId = jobId;
}
/**
* 获取扩展1
*
* @return ext1 - 扩展1
*/
public String getExt1() {
return ext1;
}
/**
* 设置扩展1
*
* @param ext1 扩展1
*/
public void setExt1(String ext1) {
this.ext1 = ext1;
}
/**
* 获取扩展2
*
* @return ext2 - 扩展2
*/
public String getExt2() {
return ext2;
}
/**
* 设置扩展2
*
* @param ext2 扩展2
*/
public void setExt2(String ext2) {
this.ext2 = ext2;
}
/**
* 获取扩展3
*
* @return ext3 - 扩展3
*/
public String getExt3() {
return ext3;
}
/**
* 设置扩展3
*
* @param ext3 扩展3
*/
public void setExt3(String ext3) {
this.ext3 = ext3;
}
/**
* 获取扩展文本
*
* @return ext_text - 扩展文本
*/
public String getExtText() {
return extText;
}
/**
* 设置扩展文本
*
* @param extText 扩展文本
*/
public void setExtText(String extText) {
this.extText = extText;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -0,0 +1,23 @@
package com.tiesheng.core.pojos.dto;
import javax.validation.constraints.NotEmpty;
public class IdDTO {
@NotEmpty(message = "需要ID")
private String id;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

View File

@@ -0,0 +1,45 @@
package com.tiesheng.core.pojos.dto.config;
public class ConfigFuncDTO {
private String id;
private String name;
private String remark;
private Integer isUsed;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Integer getIsUsed() {
return isUsed;
}
public void setIsUsed(Integer isUsed) {
this.isUsed = isUsed;
}
}

View File

@@ -0,0 +1,40 @@
package com.tiesheng.core.pojos.dto.job;
import javax.validation.constraints.NotEmpty;
public class JobUpdateDTO {
private String id;
@NotEmpty(message = "请输入职位名称")
private String name;
private String remark;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
}

View File

@@ -0,0 +1,30 @@
package com.tiesheng.core.pojos.dto.job;
import javax.validation.constraints.NotEmpty;
public class JobUpdateRxDTO {
@NotEmpty(message = "请选择职位")
private String jobId;
private String points;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getPoints() {
return points;
}
public void setPoints(String points) {
this.points = points;
}
}

View File

@@ -0,0 +1,31 @@
package com.tiesheng.core.pojos.dto.job;
import javax.validation.constraints.NotEmpty;
public class JobUserAssignDTO {
@NotEmpty(message = "请选择用户")
private String userId;
@NotEmpty(message = "请选择职位")
private String jobId;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
}

View File

@@ -0,0 +1,40 @@
package com.tiesheng.core.pojos.dto.job;
import com.tiesheng.util.pojos.IdName;
import java.util.List;
public class JobUserOwner {
private String jobId;
private String jobName;
private List<String> points;
///////////////////////////////////////////////////////////////////////////
// setter\getter
///////////////////////////////////////////////////////////////////////////
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public String getJobName() {
return jobName;
}
public void setJobName(String jobName) {
this.jobName = jobName;
}
public List<String> getPoints() {
return points;
}
public void setPoints(List<String> points) {
this.points = points;
}
}

View File

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

View File

@@ -1,7 +1,9 @@
package com.tiesheng.core.service;
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
import com.tiesheng.core.mapper.CoreConfigFuncMapper;
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -14,8 +16,37 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
@Autowired
CoreConfigEnumMapper coreConfigEnumMapper;
@Autowired
CoreConfigFuncMapper coreConfigFuncMapper;
public CoreConfigEnumMapper getEnumMapper() {
return coreConfigEnumMapper;
}
public CoreConfigFuncMapper getFuncMapper() {
return coreConfigFuncMapper;
}
/**
* 刷新功能点
*
* @param id
* @param service
* @param name
* @param remark
*/
public void refreshFunc(String id, String service, String name, String remark) {
CoreConfigFunc jobPoint = new CoreConfigFunc();
jobPoint.setId(id);
jobPoint.setService(service);
jobPoint.setName(name);
jobPoint.setRemark(remark);
try {
coreConfigFuncMapper.insert(jobPoint);
} catch (Exception e) {
coreConfigFuncMapper.updateById(jobPoint);
}
}
}

View File

@@ -0,0 +1,97 @@
package com.tiesheng.core.service;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tiesheng.core.mapper.CoreJobMapper;
import com.tiesheng.core.mapper.CoreJobUserMapper;
import com.tiesheng.core.pojos.dao.CoreJob;
import com.tiesheng.core.pojos.dao.CoreJobUser;
import com.tiesheng.util.pojos.IdName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* @author hao
*/
@Service
public class CoreJobService extends TsServiceBase<CoreJobMapper, CoreJob> {
@Autowired
CoreJobUserMapper coreJobUserMapper;
public CoreJobUserMapper getJobUserMapper() {
return coreJobUserMapper;
}
/**
* 刷新职位
*
* @param name
* @param remark
* @param isSystem
*/
public void refresh(String id, String name, String remark, Integer isSystem) {
CoreJob coreJob = new CoreJob();
coreJob.setId(id);
coreJob.setName(name);
coreJob.setRemark(remark);
coreJob.setIsSystem(isSystem);
saveOrUpdate(coreJob);
}
/**
* 更新关联关系
*
* @param jobId
* @param points
*/
public void updateJobRx(String jobId, List<String> points) {
List<IdName> nameList = new ArrayList<>();
for (String s : points) {
IdName id = new IdName();
id.setId(IdUtil.getSnowflakeNextIdStr());
id.setName(jobId);
id.setExtra(s);
nameList.add(id);
}
if (StrUtil.isEmpty(jobId)) {
return;
}
getBaseMapper().clearJobFunc(jobId);
if (CollUtil.isNotEmpty(nameList)) {
getBaseMapper().updateJobFunc(nameList);
}
}
/**
* 分配职位
*
* @param userId
* @param jobId
*/
public void userAssign(String userId, String jobId) {
CoreJobUser jobUser = coreJobUserMapper.selectOne(new QueryWrapper<CoreJobUser>()
.eq("is_deleted", 0)
.eq("user_id", userId)
.eq("job_id", jobId)
);
if (jobUser == null) {
jobUser = new CoreJobUser();
}
jobUser.setUserId(userId);
jobUser.setJobId(jobId);
if (StrUtil.isEmpty(jobUser.getId())) {
coreJobUserMapper.insert(jobUser);
} else {
coreJobUserMapper.updateById(jobUser);
}
}
}

View File

@@ -1,33 +1,40 @@
package com.tiesheng.core.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.tiesheng.core.mapper.CoreLogLoginMapper;
import com.tiesheng.core.mapper.CoreLogMessageMapper;
import com.tiesheng.core.mapper.CoreLogOperationMapper;
import com.tiesheng.core.mapper.CoreLogProcessMapper;
import com.tiesheng.core.pojos.RequestUserInfo;
import com.tiesheng.core.pojos.dao.CoreLogLogin;
import com.tiesheng.core.pojos.dao.CoreLogMessage;
import com.tiesheng.core.pojos.dao.CoreLogOperation;
import com.tiesheng.core.pojos.dao.CoreLogProcess;
import com.tiesheng.core.pojos.dao.CorePlatformUnique;
import com.tiesheng.core.pojos.vo.ProcessDetailVo;
import com.tiesheng.core.util.ProcessImportConsumer;
import com.tiesheng.core.util.ProcessSyncConsumer;
import com.tiesheng.login.config.token.TsTokenConfig;
import com.tiesheng.login.config.token.bean.TokenBean;
import com.tiesheng.message.pojos.MessageReqResp;
import com.tiesheng.message.service.TieshengMessageConfigurer;
import com.tiesheng.util.ServletKit;
import com.tiesheng.util.config.Ip2regionConfig;
import com.tiesheng.util.exception.ApiException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.util.List;
/**
* @author hao
*/
@Service
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> implements TieshengMessageConfigurer {
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
@Autowired
TieshengWebConfigurer tieshengWebConfigurer;
@@ -37,6 +44,8 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
CoreLogMessageMapper coreLogMessageMapper;
@Autowired
Ip2regionConfig ip2regionConfig;
@Autowired
CoreLogProcessMapper coreLogProcessMapper;
public CoreLogLoginMapper getLogLoginMapper() {
return coreLogLoginMapper;
@@ -46,6 +55,95 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
return coreLogMessageMapper;
}
public CoreLogProcessMapper getCoreLogProcessMapper() {
return coreLogProcessMapper;
}
///////////////////////////////////////////////////////////////////////////
// 导入日志
///////////////////////////////////////////////////////////////////////////
/**
* 添加导入过程
*
* @param title 标题
* @param list 要导入的数据
*/
public <T> CoreLogProcess addProcess(String title, List<T> list, ProcessImportConsumer consumer) {
if (CollUtil.isEmpty(list)) {
throw new ApiException("文件中不存在数据");
}
CoreLogProcess coreLogProcess = new CoreLogProcess();
coreLogProcess.setTitle(title);
coreLogProcess.setTotal(list.size());
coreLogProcess.setType("import");
coreLogProcess.setSuccessNum(0);
coreLogProcess.setFailNum(0);
coreLogProcessMapper.insert(coreLogProcess);
ThreadUtil.execute(() -> {
CollUtil.split(list, 100).forEach((it) -> {
int accept = consumer.accept(it);
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + accept);
coreLogProcess.setFailNum(coreLogProcess.getFailNum() + 100 - accept);
if (coreLogProcess.getFailNum() + coreLogProcess.getSuccessNum() == list.size()) {
coreLogProcess.setFailFile(consumer.getFailFile());
coreLogProcess.setStatus(1);
}
coreLogProcessMapper.updateById(coreLogProcess);
});
});
return coreLogProcess;
}
/**
* 添加同步过程
*
* @param title
* @param consumer
* @return
*/
public CoreLogProcess addProcess(String title, ProcessSyncConsumer consumer) {
CoreLogProcess coreLogProcess = new CoreLogProcess();
coreLogProcess.setTitle(title);
coreLogProcess.setTotal(0);
coreLogProcess.setType("sync");
coreLogProcess.setSuccessNum(0);
coreLogProcess.setFailNum(0);
coreLogProcessMapper.insert(coreLogProcess);
ThreadUtil.execute(() -> {
int pageSize = 1000;
int pageNum = 1, lastCount = pageSize;
while (lastCount == pageSize) {
lastCount = consumer.accept(pageNum, pageSize);
coreLogProcess.setSuccessNum(coreLogProcess.getSuccessNum() + lastCount);
if (lastCount != pageSize) {
coreLogProcess.setStatus(1);
}
coreLogProcessMapper.updateById(coreLogProcess);
pageNum++;
}
});
return coreLogProcess;
}
/**
* 根据id 获取过程详情
*/
public ProcessDetailVo getProcessDetail(String id) {
QueryWrapper<CoreLogProcess> wrapper = new QueryWrapper<>();
wrapper.eq("id", id);
CoreLogProcess coreLogProcess = coreLogProcessMapper.selectOne(wrapper);
return BeanUtil.copyProperties(coreLogProcess, ProcessDetailVo.class);
}
///////////////////////////////////////////////////////////////////////////
// 操作日志
///////////////////////////////////////////////////////////////////////////
@@ -99,22 +197,4 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
coreLogLoginMapper.insert(login);
}
///////////////////////////////////////////////////////////////////////////
// 消息日志
///////////////////////////////////////////////////////////////////////////
/**
* 添加消息日志
*
* @param type
* @param reqResp
*/
@Override
public void onMessageSend(String type, MessageReqResp reqResp) {
CoreLogMessage coreLogMessage = BeanUtil.copyProperties(reqResp, CoreLogMessage.class);
coreLogMessage.setType(type);
coreLogMessageMapper.insert(coreLogMessage);
}
}

View File

@@ -0,0 +1,74 @@
package com.tiesheng.core.service;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.StrUtil;
import com.tiesheng.core.mapper.CoreLogMessageMapper;
import com.tiesheng.core.pojos.dao.CoreLogMessage;
import com.tiesheng.message.pojos.MessageReqResp;
import com.tiesheng.message.service.TieshengMessageSender;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* @author hao
*/
@Service
public class CoreMessageService {
@Autowired
List<TieshengMessageSender> messageSenderList;
@Autowired
CoreLogMessageMapper coreLogMessageMapper;
/**
* 发送消息
*
* @param user
* @param title
* @param body
* @param channels 消息通道如果为all时表示发送全部通道
*/
public void multiple(String user, String title, Object body, String... channels) {
if (StrUtil.isEmpty(user) || ArrayUtil.isEmpty(channels)) {
return;
}
messageSenderList.forEach(sender -> {
boolean isChannel = ArrayUtil.contains(channels, sender.getChannel()) || ArrayUtil.contains(channels, "all");
if (sender.support() && isChannel) {
MessageReqResp reqResp = sender.send(user, title, body);
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
}
});
}
/**
* 发送消息
*
* @param user
* @param title
* @param body
*/
public MessageReqResp send(String user, String title, Object body, String channel) {
if (StrUtil.isEmpty(user) || StrUtil.isEmpty(channel)) {
return null;
}
TieshengMessageSender messageSender = CollUtil.findOne(messageSenderList,
sender -> Objects.equals(sender.getChannel(), channel) && sender.support());
if (messageSender != null) {
MessageReqResp reqResp = messageSender.send(user, title, body);
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
return reqResp;
}
return null;
}
}

View File

@@ -35,7 +35,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
platformUnique.setInfo(loginInfo.getInfo());
saveOrUpdate(platformUnique);
TokenBean tokenBean = tieshengWebConfigurer.loginConfigurer().doLogin(platformUnique, loginInfo.getTo());
TokenBean tokenBean = tieshengWebConfigurer.login(platformUnique);
if (tokenBean != null) {
// 添加登录日志
coreLogService.addLoginLog(platformUnique, tokenBean);
@@ -45,7 +45,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
@Override
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
tieshengWebConfigurer.loginConfigurer().redirect(bean, to, extra, response);
tieshengWebConfigurer.redirect(bean, to, extra, response);
}

View File

@@ -54,36 +54,22 @@ public interface TieshengWebConfigurer {
return uploadPath;
}
/**
* 配置登录
* 登录逻辑
*
* @param platformUnique
* @return
*/
LoginConfigurer loginConfigurer();
TokenBean login(CorePlatformUnique platformUnique);
interface LoginConfigurer {
/**
* 登录逻辑
*
* @param platformUnique
* @return
*/
TokenBean doLogin(CorePlatformUnique platformUnique, String to);
/**
* 登录重定向
*
* @param bean
* @param extra
* @param response
*/
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
}
/**
* 登录重定向
*
* @param bean
* @param extra
* @param response
*/
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
}

View File

@@ -0,0 +1,25 @@
package com.tiesheng.core.util;
import java.util.List;
public interface ProcessImportConsumer {
/**
* 处理数据
*
* @param list
* @param <T>
* @return 返回成功的数量
*/
<T> int accept(List<T> list);
/**
* 获取失败的文件路径
*
* @return
*/
String getFailFile();
}

View File

@@ -0,0 +1,16 @@
package com.tiesheng.core.util;
public interface ProcessSyncConsumer {
/**
* 分页数据
*
* @param pageNum
* @param pageSize
* @return 返回成功的数量
*/
int accept(Integer pageNum, Integer pageSize);
}

View File

@@ -1,22 +0,0 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for core_log_login
-- ----------------------------
CREATE TABLE `core_log_login`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
`user_name` varchar(255) DEFAULT NULL COMMENT '用户姓名',
`platform` varchar(50) DEFAULT NULL COMMENT '登录方式',
`ip` varchar(100) DEFAULT NULL COMMENT 'ip',
`address` varchar(255) DEFAULT NULL COMMENT 'ip地址',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-登录';
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,23 +0,0 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for core_log_message
-- ----------------------------
CREATE TABLE `core_log_message`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`type` varchar(50) DEFAULT NULL COMMENT '类型',
`target` varchar(255) DEFAULT NULL COMMENT '发送对象',
`content` text COMMENT '发送内容',
`resp_body` text COMMENT '返回结果',
`result` int(6) NOT NULL DEFAULT '0' COMMENT '结果',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
ROW_FORMAT = DYNAMIC COMMENT ='日志-消息';
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -1,7 +1,6 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
CREATE TABLE `core_config_enum`
(
`id` varchar(50) NOT NULL,
@@ -16,20 +15,6 @@ CREATE TABLE `core_config_enum`
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-枚举';
CREATE TABLE `core_log_operation`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
`title` varchar(255) DEFAULT NULL COMMENT '标题',
`subject` varchar(500) DEFAULT NULL COMMENT '小标题',
`params` text COMMENT '其他参数',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-操作';
CREATE TABLE `core_config_system`
(
@@ -48,6 +33,27 @@ CREATE TABLE `core_config_system`
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-系统';
-- ----------------------------
-- Table structure for core_config_func
-- ----------------------------
CREATE TABLE `core_config_func`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`service` varchar(20) DEFAULT NULL COMMENT '业务',
`name` varchar(255) DEFAULT NULL COMMENT '名称',
`remark` varchar(500) DEFAULT NULL COMMENT '其他说明',
`is_used` int(6) NOT NULL DEFAULT '0' COMMENT '是否启用',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='职位-功能点';
-- ----------------------------
-- Table for data
-- ----------------------------
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
`config_type`, `remark`, `extra`, `read_only`)
VALUES ('manager_web_copyright', '2022-02-23 16:52:48', '2022-02-23 16:52:49', 0, 'manager_web_copyright',

View File

@@ -0,0 +1,69 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for core_job
-- ----------------------------
CREATE TABLE `core_job`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`name` varchar(255) DEFAULT NULL COMMENT '名称',
`remark` varchar(500) DEFAULT NULL COMMENT '其他说明',
`is_system` int(6) NOT NULL DEFAULT '0' COMMENT '是否系统',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='职位';
-- ----------------------------
-- Table structure for core_job_func
-- ----------------------------
CREATE TABLE `core_job_func`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`job_id` varchar(50) DEFAULT NULL COMMENT '职位id',
`point_id` varchar(50) DEFAULT NULL COMMENT ' 功能点id',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='职位-功能关系';
-- ----------------------------
-- Table structure for core_job_user
-- ----------------------------
CREATE TABLE `core_job_user`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`user_id` varchar(50) NOT NULL COMMENT '用户id',
`job_id` varchar(50) NOT NULL COMMENT '用户',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='职位-用户';
-- ----------------------------
-- Table change for core_job_user
-- ----------------------------
alter table core_job_user
add ext1 varchar(255) null comment '扩展1';
alter table core_job_user
add ext2 varchar(255) null comment '扩展2';
alter table core_job_user
add ext3 varchar(500) null comment '扩展3';
alter table core_job_user
add ext_text text null comment '扩展文本';
alter table core_job_func
change point_id func_id varchar(50) DEFAULT NULL COMMENT ' 功能点id';
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,87 @@
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for core_log_login
-- ----------------------------
CREATE TABLE `core_log_login`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
`user_name` varchar(255) DEFAULT NULL COMMENT '用户姓名',
`platform` varchar(50) DEFAULT NULL COMMENT '登录方式',
`ip` varchar(100) DEFAULT NULL COMMENT 'ip',
`address` varchar(255) DEFAULT NULL COMMENT 'ip地址',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-登录';
-- ----------------------------
-- Table structure for core_log_message
-- ----------------------------
CREATE TABLE `core_log_message`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`type` varchar(50) DEFAULT NULL COMMENT '类型',
`target` varchar(255) DEFAULT NULL COMMENT '发送对象',
`content` text COMMENT '发送内容',
`resp_body` text COMMENT '返回结果',
`result` int(6) NOT NULL DEFAULT '0' COMMENT '结果',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4
ROW_FORMAT = DYNAMIC COMMENT ='日志-消息';
-- ----------------------------
-- Table structure for core_log_process
-- ----------------------------
CREATE TABLE `core_log_process`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT 0,
`title` varchar(255) NULL DEFAULT NULL COMMENT '标题',
`total` int(11) NOT NULL DEFAULT 0 COMMENT '总数',
`success_num` int(11) NOT NULL DEFAULT 0 COMMENT '成功数',
`fail_num` int(11) NOT NULL DEFAULT 0 COMMENT '失败数',
`type` varchar(50) NOT NULL DEFAULT 'import' COMMENT '类型import-导入sync-同步)',
PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB
CHARACTER SET = utf8mb4
COLLATE = utf8mb4_general_ci COMMENT = '日志-过程'
ROW_FORMAT = Dynamic;
ALTER TABLE core_log_process
ADD status int(6) default 0 COMMENT '状态0-未完成1-已完成)';
ALTER TABLE core_log_process
ADD fail_file varchar(500) null default null COMMENT '失败的文件';
-- ----------------------------
-- Table structure for core_log_operation
-- ----------------------------
CREATE TABLE `core_log_operation`
(
`id` varchar(50) NOT NULL,
`create_time` datetime NOT NULL,
`update_time` datetime NOT NULL,
`is_deleted` int(6) NOT NULL DEFAULT '0',
`user_id` varchar(50) DEFAULT NULL COMMENT '用户id',
`user_name` varchar(255) DEFAULT NULL COMMENT '用户名称',
`title` varchar(255) DEFAULT NULL COMMENT '标题',
`subject` varchar(500) DEFAULT NULL COMMENT '小标题',
`params` text COMMENT '其他参数',
PRIMARY KEY (`id`)
) ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='日志-操作';
SET FOREIGN_KEY_CHECKS = 1;

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tiesheng.core.mapper.CoreConfigFuncMapper">
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreConfigFunc">
<!--@mbg.generated-->
<!--@Table core_config_func-->
<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="service" jdbcType="VARCHAR" property="service"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
<result column="is_used" jdbcType="INTEGER" property="isUsed"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, create_time, update_time, is_deleted, service, `name`, remark,is_used
</sql>
</mapper>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tiesheng.core.mapper.CoreJobMapper">
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreJob">
<!--@mbg.generated-->
<!--@Table core_job-->
<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="remark" jdbcType="VARCHAR" property="remark" />
<result column="is_system" jdbcType="INTEGER" property="isSystem" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, create_time, update_time, is_deleted, `name`, remark, is_system
</sql>
<delete id="clearJobFunc">
delete from core_job_func where job_id=#{jobId}
</delete>
<update id="updateJobFunc">
insert into core_job_func(
id, create_time, update_time, is_deleted, job_id, func_id
) VALUES
<foreach collection="list" index="index" item="as" separator=",">
(#{as.id},
now(),
now(),
0,
#{as.name},
#{as.extra}
)
</foreach>
</update>
<select id="getJobFunc" resultType="java.lang.String">
select cjf.func_id from core_job_func cjf
left join core_config_func ccf on ccf.id=cjf.func_id
where cjf.job_id=#{jobId}
<if test="isUsed != null">
and ccf.is_used=#{isUsed}
</if>
</select>
</mapper>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.tiesheng.core.mapper.CoreJobUserMapper">
<resultMap id="BaseResultMap" type="com.tiesheng.core.pojos.dao.CoreJobUser">
<!--@mbg.generated-->
<!--@Table core_job_user-->
<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="user_id" jdbcType="VARCHAR" property="userId" />
<result column="job_id" jdbcType="VARCHAR" property="jobId" />
<result column="ext1" jdbcType="VARCHAR" property="ext1" />
<result column="ext2" jdbcType="VARCHAR" property="ext2" />
<result column="ext3" jdbcType="VARCHAR" property="ext3" />
<result column="ext_text" jdbcType="LONGVARCHAR" property="extText" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, create_time, update_time, is_deleted, user_id, job_id, ext1, ext2, ext3, ext_text
</sql>
<select id="list" resultType="com.tiesheng.core.pojos.dto.job.JobUserOwner">
select cju.job_id,
cj.name job_name
from core_job_user cju
left join core_job cj on cj.id = cju.job_id
where cju.is_deleted=0 and cju.user_id=#{userId}
</select>
</mapper>

View File

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