Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24629f06b4 | ||
|
|
47c9251389 | ||
|
|
dda5f64910 | ||
|
|
704030729a | ||
|
|
c708809a19 | ||
|
|
2bbec9b79a | ||
|
|
e19f27f597 | ||
|
|
68781d4685 | ||
|
|
da69124968 | ||
|
|
8d9632bcaa | ||
|
|
1c0e63bf98 | ||
|
|
c04d45431c | ||
|
|
c5f8508a9e | ||
|
|
06f295bb66 | ||
|
|
bfc578e77c | ||
|
|
b5c10fc224 | ||
|
|
60580b40a4 | ||
|
|
af70808da6 | ||
|
|
c446ee8f75 | ||
|
|
86384a1f23 | ||
|
|
d63b6ab094 |
@@ -1,3 +1,8 @@
|
|||||||
|
## 0.9.3
|
||||||
|
|
||||||
|
> 1,增加版本对比器,防止某些情况下版本对比失效;
|
||||||
|
>
|
||||||
|
|
||||||
## 0.8.3
|
## 0.8.3
|
||||||
|
|
||||||
### 调整
|
### 调整
|
||||||
|
|||||||
20
pom.xml
20
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<name>springboot-parent</name>
|
<name>springboot-parent</name>
|
||||||
<description>杭州铁晟科技有限公司基础依赖</description>
|
<description>杭州铁晟科技有限公司基础依赖</description>
|
||||||
@@ -57,55 +57,55 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|||||||
BIN
springboot-ademo/.DS_Store
vendored
Normal file
BIN
springboot-ademo/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-ademo</artifactId>
|
<artifactId>springboot-ademo</artifactId>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
|||||||
@EnableTransactionManagement
|
@EnableTransactionManagement
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableTieshengWeb(webConfigurer = DemoWebConfigurer.class)
|
@EnableTieshengWeb(webConfigurer = DemoWebConfigurer.class)
|
||||||
@EnableEncryptConfig
|
//@EnableEncryptConfig
|
||||||
public class DemoApplication {
|
public class DemoApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|||||||
@@ -27,30 +27,28 @@ public class DemoWebConfigurer implements TieshengWebConfigurer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoginConfigurer loginConfigurer() {
|
public TokenBean login(CorePlatformUnique platformUnique) {
|
||||||
return new LoginConfigurer() {
|
TokenBean tokenBean = null;
|
||||||
@Override
|
if (!StrUtil.isEmpty(platformUnique.getUserId())) {
|
||||||
public TokenBean doLogin(CorePlatformUnique platformUnique, String to) {
|
tokenBean = new TokenBean(platformUnique.getUserId(), "", globalConfig.getService());
|
||||||
|
} else {
|
||||||
|
// 获取用户信息判断是否可登录
|
||||||
|
|
||||||
// 默认跳转到mobile
|
}
|
||||||
to = StrUtil.emptyToDefault(to, "mobile");
|
|
||||||
|
|
||||||
TokenBean tokenBean = null;
|
return tokenBean;
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,10 +4,10 @@ import cn.hutool.core.collection.CollUtil;
|
|||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import cn.hutool.log.LogFactory;
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
|
import com.tiesheng.core.service.CoreMessageService;
|
||||||
import com.tiesheng.demo.pojos.TestFile;
|
import com.tiesheng.demo.pojos.TestFile;
|
||||||
import com.tiesheng.login.config.token.TsTokenConfig;
|
import com.tiesheng.login.config.token.TsTokenConfig;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.message.config.aliyun.AliyunSmsConfig;
|
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
import com.tiesheng.message.pojos.MessageReqResp;
|
||||||
import com.tiesheng.util.config.EncryptConfig;
|
import com.tiesheng.util.config.EncryptConfig;
|
||||||
import com.tiesheng.util.config.GlobalConfig;
|
import com.tiesheng.util.config.GlobalConfig;
|
||||||
@@ -31,13 +31,13 @@ public class TestController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
GlobalConfig globalConfig;
|
GlobalConfig globalConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
AliyunSmsConfig aliyunSmsConfig;
|
|
||||||
@Autowired
|
|
||||||
TsTokenConfig tsTokenConfig;
|
TsTokenConfig tsTokenConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
Ip2regionConfig ip2regionConfig;
|
Ip2regionConfig ip2regionConfig;
|
||||||
@Autowired
|
@Autowired
|
||||||
EncryptConfig encryptConfig;
|
EncryptConfig encryptConfig;
|
||||||
|
@Autowired
|
||||||
|
CoreMessageService coreMessageService;
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/index")
|
@RequestMapping("/index")
|
||||||
@@ -53,14 +53,17 @@ public class TestController {
|
|||||||
@TokenIgnore
|
@TokenIgnore
|
||||||
public void redirect(HttpServletResponse response) {
|
public void redirect(HttpServletResponse response) {
|
||||||
// tsTokenConfig.validToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzYwMDY4NzUsImlkIjoiMSIsImVudmlyb25tZW50VHlwZSI6Im1vYmlsZSIsInNlcnZpY2UiOiJjb250ZXN0LXJlc2VydmUiLCJleHRyYSI6IiJ9.nsfxEFpCNHC7eNCS5DJXdu1VDdnHrTjSfgrozND70Lc", true);
|
// tsTokenConfig.validToken("eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJleHAiOjE2NzYwMDY4NzUsImlkIjoiMSIsImVudmlyb25tZW50VHlwZSI6Im1vYmlsZSIsInNlcnZpY2UiOiJjb250ZXN0LXJlc2VydmUiLCJleHRyYSI6IiJ9.nsfxEFpCNHC7eNCS5DJXdu1VDdnHrTjSfgrozND70Lc", true);
|
||||||
// globalConfig.redirect("mobile", "/test", response);
|
globalConfig.redirect("mobile", "/test", response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/send")
|
@RequestMapping("/send")
|
||||||
|
@TokenIgnore
|
||||||
public ApiResp<MessageReqResp> sendMessage() {
|
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);
|
return ApiResp.respOK(reqResp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ tiesheng:
|
|||||||
id: "1111"
|
id: "1111"
|
||||||
global:
|
global:
|
||||||
version: 2
|
version: 2
|
||||||
host: http://localhost:8080
|
host: http://localhost:8100
|
||||||
aliyun:
|
aliyun:
|
||||||
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
access-key-id: LTAI5tJtbgBCnTY5eS4SmrTf
|
||||||
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
access-key-secret: JIHqpRUFffCHhXaJEVvWN31WcexWqG
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-annotation</artifactId>
|
<artifactId>springboot-annotation</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-database</artifactId>
|
<artifactId>springboot-database</artifactId>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.db.Db;
|
import cn.hutool.db.Db;
|
||||||
import cn.hutool.db.Entity;
|
import cn.hutool.db.Entity;
|
||||||
|
import cn.hutool.log.LogFactory;
|
||||||
import com.tiesheng.database.config.DbMigrationConfig;
|
import com.tiesheng.database.config.DbMigrationConfig;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
import org.springframework.boot.web.servlet.ServletContextInitializer;
|
||||||
@@ -22,6 +23,7 @@ import java.sql.SQLException;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.zip.Checksum;
|
import java.util.zip.Checksum;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -92,6 +94,8 @@ public class DbMigrationInitializer implements ServletContextInitializer {
|
|||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
AtomicReference<Integer> success= new AtomicReference<>(0);
|
||||||
|
AtomicReference<Integer> fail= new AtomicReference<>(0);
|
||||||
db.tx((VoidFunc1<Db>) parameter -> {
|
db.tx((VoidFunc1<Db>) parameter -> {
|
||||||
List<String> split = StrUtil.split(readUtf8, ";");
|
List<String> split = StrUtil.split(readUtf8, ";");
|
||||||
for (String sql : split) {
|
for (String sql : split) {
|
||||||
@@ -104,11 +108,13 @@ public class DbMigrationInitializer implements ServletContextInitializer {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
parameter.execute(sql);
|
parameter.execute(sql);
|
||||||
|
success.getAndSet(success.get() + 1);
|
||||||
} catch (Exception ignore) {
|
} catch (Exception ignore) {
|
||||||
|
fail.getAndSet(fail.get() + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
LogFactory.get().info("执行sql文件{},成功数:{},失败数:{}。",filename,success.get(),fail.get());
|
||||||
entity.set("checksum", checksum.getValue());
|
entity.set("checksum", checksum.getValue());
|
||||||
entity.set("update_time", DateUtil.date());
|
entity.set("update_time", DateUtil.date());
|
||||||
db.update(entity, Entity.create(dbMigrationConfig.getTable()).set("id", entity.get("id")));
|
db.update(entity, Entity.create(dbMigrationConfig.getTable()).set("id", entity.get("id")));
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-encrypt</artifactId>
|
<artifactId>springboot-encrypt</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-login</artifactId>
|
<artifactId>springboot-login</artifactId>
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ public class LoginController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/unique/redirect")
|
@GetMapping("/unique/redirect")
|
||||||
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
public void uniqueIndex(UniqueIndexDTO dto, HttpServletResponse response) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_redirect",
|
||||||
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,8 +72,8 @@ public class LoginController {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/unique/index")
|
@PostMapping("/unique/index")
|
||||||
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
public ApiResp<String> uniqueIndex(@RequestBody UniqueIndexDTO dto) {
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("unique_index_web",
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo("web_unique_index",
|
||||||
dto.getNo(), "web", dto.getTo(), dto.getInfo()));
|
dto.getNo(), dto.getPlatform(), dto.getInfo()));
|
||||||
if (tokenBean == null) {
|
if (tokenBean == null) {
|
||||||
throw new ApiException("登录失败");
|
throw new ApiException("登录失败");
|
||||||
}
|
}
|
||||||
@@ -120,8 +120,7 @@ public class LoginController {
|
|||||||
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
String ddUserId = platformDingConfig.getUserIdByCode(service, dto.getCode());
|
||||||
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
DingUserInfo dingUserInfo = platformDingConfig.topapiV2UserGet(service, ddUserId);
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(dingUserInfo.getAppId(),
|
||||||
dingUserInfo.getUserid(), "ding", dto.getTo(),
|
dingUserInfo.getUserid(), "ding", JSON.toJSONString(dingUserInfo)));
|
||||||
JSON.toJSONString(dingUserInfo)));
|
|
||||||
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
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) {
|
public void wxmpOauth2(@PathVariable String service, CodeExtraDTO dto, HttpServletResponse response) {
|
||||||
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
WxUserInfo wxUserInfo = platformWxmpConfig.getOAuth2AccessToken(service, dto.getCode());
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(wxUserInfo.getAppId(),
|
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);
|
tieshengLoginConfigurer.onLoginRedirect(tokenBean, dto.getTo(), dto.getExtra(), response);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -198,7 +197,7 @@ public class LoginController {
|
|||||||
String openid = platformWxminiConfig.jscode2session(service, code);
|
String openid = platformWxminiConfig.jscode2session(service, code);
|
||||||
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
|
WxConfigBean configBean = platformWxminiConfig.getConfigBean(service);
|
||||||
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(configBean.getAppId(),
|
TokenBean tokenBean = tieshengLoginConfigurer.doLogin(new DoLoginInfo(configBean.getAppId(),
|
||||||
openid, "wxmini", "mini", "{}"));
|
openid, "wxmini", "{}"));
|
||||||
|
|
||||||
WxminiLoginVo loginVo = new WxminiLoginVo();
|
WxminiLoginVo loginVo = new WxminiLoginVo();
|
||||||
loginVo.setOpenid(openid);
|
loginVo.setOpenid(openid);
|
||||||
|
|||||||
@@ -5,15 +5,13 @@ public class DoLoginInfo {
|
|||||||
private String appId;
|
private String appId;
|
||||||
private String unique;
|
private String unique;
|
||||||
private String platform;
|
private String platform;
|
||||||
private String to;
|
|
||||||
private String info;
|
private String info;
|
||||||
private String extra;
|
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.appId = appId;
|
||||||
this.unique = unique;
|
this.unique = unique;
|
||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
this.to = to;
|
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,14 +43,6 @@ public class DoLoginInfo {
|
|||||||
this.platform = platform;
|
this.platform = platform;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getTo() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTo(String to) {
|
|
||||||
this.to = to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getInfo() {
|
public String getInfo() {
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class UniqueIndexDTO extends LoginToInfo {
|
|||||||
private String no;
|
private String no;
|
||||||
private String extra;
|
private String extra;
|
||||||
private String info;
|
private String info;
|
||||||
|
private String platform = "web";
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
@@ -38,4 +39,12 @@ public class UniqueIndexDTO extends LoginToInfo {
|
|||||||
public void setInfo(String info) {
|
public void setInfo(String info) {
|
||||||
this.info = info;
|
this.info = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getPlatform() {
|
||||||
|
return platform;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPlatform(String platform) {
|
||||||
|
this.platform = platform;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ public interface TieshengLoginConfigurer {
|
|||||||
/**
|
/**
|
||||||
* 授权登录回调
|
* 授权登录回调
|
||||||
*
|
*
|
||||||
* @param tokenBean
|
* @param bean
|
||||||
*/
|
*/
|
||||||
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-message</artifactId>
|
<artifactId>springboot-message</artifactId>
|
||||||
|
|||||||
@@ -2,13 +2,13 @@ package com.tiesheng.message.config.aliyun;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.crypto.SecureUtil;
|
import cn.hutool.crypto.SecureUtil;
|
||||||
import cn.hutool.http.HttpUtil;
|
import cn.hutool.http.HttpUtil;
|
||||||
import cn.hutool.json.JSONObject;
|
import cn.hutool.json.JSONObject;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
import com.tiesheng.message.pojos.MessageReqResp;
|
||||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
import com.tiesheng.message.service.TieshengMessageSender;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@@ -22,16 +22,13 @@ import java.util.*;
|
|||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
@ConfigurationProperties(prefix = "tiesheng.aliyun")
|
@ConfigurationProperties(prefix = "tiesheng.aliyun")
|
||||||
public class AliyunSmsConfig {
|
public class AliyunSmsSender implements TieshengMessageSender {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 请求地址
|
* 请求地址
|
||||||
*/
|
*/
|
||||||
private static final String ENDPOINT = "https://dysmsapi.aliyuncs.com";
|
private static final String ENDPOINT = "https://dysmsapi.aliyuncs.com";
|
||||||
|
|
||||||
@Autowired
|
|
||||||
TieshengMessageConfigurer tieshengMessageConfigurer;
|
|
||||||
|
|
||||||
private String accessKeyId;
|
private String accessKeyId;
|
||||||
private String accessKeySecret;
|
private String accessKeySecret;
|
||||||
private String signName;
|
private String signName;
|
||||||
@@ -62,7 +59,7 @@ public class AliyunSmsConfig {
|
|||||||
*/
|
*/
|
||||||
public MessageReqResp sendSms(String phoneNumbers, String templateCode, JSONObject params) {
|
public MessageReqResp sendSms(String phoneNumbers, String templateCode, JSONObject params) {
|
||||||
|
|
||||||
MessageReqResp reqResp = new MessageReqResp();
|
MessageReqResp reqResp = new MessageReqResp("阿里云短信");
|
||||||
reqResp.setTarget(phoneNumbers);
|
reqResp.setTarget(phoneNumbers);
|
||||||
reqResp.setResult(1);
|
reqResp.setResult(1);
|
||||||
reqResp.setContent(JSONUtil.createObj()
|
reqResp.setContent(JSONUtil.createObj()
|
||||||
@@ -115,11 +112,24 @@ public class AliyunSmsConfig {
|
|||||||
reqResp.setToast(respObj.getStr("Message"));
|
reqResp.setToast(respObj.getStr("Message"));
|
||||||
}
|
}
|
||||||
|
|
||||||
tieshengMessageConfigurer.onMessageSend("阿里云短信", reqResp);
|
|
||||||
|
|
||||||
return 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
|
// setter\getter
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
@@ -2,6 +2,8 @@ package com.tiesheng.message.pojos;
|
|||||||
|
|
||||||
public class MessageReqResp {
|
public class MessageReqResp {
|
||||||
|
|
||||||
|
private String type;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送对象
|
* 发送对象
|
||||||
*/
|
*/
|
||||||
@@ -28,10 +30,22 @@ public class MessageReqResp {
|
|||||||
*/
|
*/
|
||||||
private String toast;
|
private String toast;
|
||||||
|
|
||||||
|
public MessageReqResp(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// setter\getter
|
// setter\getter
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
public String getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(String type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
public String getTarget() {
|
public String getTarget() {
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -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();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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 {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-platform</artifactId>
|
<artifactId>springboot-platform</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-poi</artifactId>
|
<artifactId>springboot-poi</artifactId>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-util</artifactId>
|
<artifactId>springboot-util</artifactId>
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.tiesheng.util.config;
|
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.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.extra.spring.SpringUtil;
|
import cn.hutool.extra.spring.SpringUtil;
|
||||||
@@ -12,6 +14,8 @@ import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
@@ -62,15 +66,22 @@ public class GlobalConfig {
|
|||||||
* @param route
|
* @param route
|
||||||
*/
|
*/
|
||||||
public void redirect(String htmlDir, String route, HttpServletResponse response) {
|
public void redirect(String htmlDir, String route, HttpServletResponse response) {
|
||||||
|
if (!StrUtil.endWith(htmlDir, "/")) {
|
||||||
|
htmlDir = htmlDir + "/";
|
||||||
|
}
|
||||||
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
PathMatchingResourcePatternResolver patternResolver = new PathMatchingResourcePatternResolver();
|
||||||
try {
|
try {
|
||||||
Resource[] resources = patternResolver.getResources(String.format("classpath*:static/%s/*/index.html", htmlDir));
|
Resource[] resources = patternResolver.getResources(String.format("classpath*:static/%s*/index.html", htmlDir));
|
||||||
if (resources.length == 0) {
|
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("无法重定向,请检查资源");
|
throw new ApiException("无法重定向,请检查资源");
|
||||||
}
|
}
|
||||||
String filename = resources[resources.length - 1].getURL().getPath();
|
CollUtil.sort(versions, (o1, o2) -> -VersionComparator.INSTANCE.compare(o1, o2));
|
||||||
filename = FileUtil.normalize(filename);
|
String path = buildPath(String.format("/%s%s/index.html#%s", htmlDir, versions.get(0), route));
|
||||||
String path = buildPath(String.format("/%s%s#%s", htmlDir, StrUtil.subAfter(filename, htmlDir, true), route));
|
|
||||||
response.sendRedirect(path);
|
response.sendRedirect(path);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LogFactory.get().info(e);
|
LogFactory.get().info(e);
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.tiesheng.springboot-parent</groupId>
|
<groupId>com.tiesheng.springboot-parent</groupId>
|
||||||
<artifactId>springboot-parent</artifactId>
|
<artifactId>springboot-parent</artifactId>
|
||||||
<version>0.8.6</version>
|
<version>0.9.7</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>springboot-web</artifactId>
|
<artifactId>springboot-web</artifactId>
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
package com.tiesheng.core.controller;
|
package com.tiesheng.core.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.tiesheng.annotation.token.TokenIgnore;
|
import com.tiesheng.annotation.token.TokenIgnore;
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigEnum;
|
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.dao.CoreConfigSystem;
|
||||||
import com.tiesheng.core.pojos.dto.PageDTO;
|
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.ConfigSystemDTO;
|
||||||
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
import com.tiesheng.core.pojos.dto.config.EnumTypeDTO;
|
||||||
import com.tiesheng.core.service.CoreConfigService;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
import java.util.List;
|
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("");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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> {
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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);
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,11 +5,12 @@ import com.baomidou.mybatisplus.annotation.TableField;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.tiesheng.core.pojos.DaoBase;
|
import com.tiesheng.core.pojos.DaoBase;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 日志-过程
|
* 日志-过程
|
||||||
*/
|
*/
|
||||||
@TableName(value = "core_log_process")
|
@TableName(value = "core_log_process")
|
||||||
public class CoreLogProcess extends DaoBase {
|
public class CoreLogProcess extends DaoBase {
|
||||||
/**
|
/**
|
||||||
@@ -36,12 +37,24 @@ public class CoreLogProcess extends DaoBase {
|
|||||||
@TableField(value = "fail_num")
|
@TableField(value = "fail_num")
|
||||||
private Integer failNum;
|
private Integer failNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 失败的文件
|
||||||
|
*/
|
||||||
|
@TableField(value = "fail_file")
|
||||||
|
private String failFile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 类型(import-导入,sync-同步)
|
* 类型(import-导入,sync-同步)
|
||||||
*/
|
*/
|
||||||
@TableField(value = "`type`")
|
@TableField(value = "`type`")
|
||||||
private String type;
|
private String type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态(0-未完成,1-完成)
|
||||||
|
*/
|
||||||
|
@TableField(value = "`status`")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取标题
|
* 获取标题
|
||||||
*
|
*
|
||||||
@@ -114,6 +127,14 @@ public class CoreLogProcess extends DaoBase {
|
|||||||
this.failNum = failNum;
|
this.failNum = failNum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFailFile() {
|
||||||
|
return failFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFailFile(String failFile) {
|
||||||
|
this.failFile = failFile;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取类型(import-导入,sync-同步)
|
* 获取类型(import-导入,sync-同步)
|
||||||
*
|
*
|
||||||
@@ -131,4 +152,22 @@ public class CoreLogProcess extends DaoBase {
|
|||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,18 @@ public class ProcessDetailVo {
|
|||||||
|
|
||||||
private String type;
|
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() {
|
public String getTitle() {
|
||||||
return title;
|
return title;
|
||||||
}
|
}
|
||||||
@@ -54,4 +66,12 @@ public class ProcessDetailVo {
|
|||||||
public void setType(String type) {
|
public void setType(String type) {
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getFailFile() {
|
||||||
|
return failFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFailFile(String failFile) {
|
||||||
|
this.failFile = failFile;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package com.tiesheng.core.service;
|
package com.tiesheng.core.service;
|
||||||
|
|
||||||
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
|
import com.tiesheng.core.mapper.CoreConfigEnumMapper;
|
||||||
|
import com.tiesheng.core.mapper.CoreConfigFuncMapper;
|
||||||
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
import com.tiesheng.core.mapper.CoreConfigSystemMapper;
|
||||||
|
import com.tiesheng.core.pojos.dao.CoreConfigFunc;
|
||||||
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
import com.tiesheng.core.pojos.dao.CoreConfigSystem;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -14,8 +16,37 @@ public class CoreConfigService extends TsServiceBase<CoreConfigSystemMapper, Cor
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
CoreConfigEnumMapper coreConfigEnumMapper;
|
CoreConfigEnumMapper coreConfigEnumMapper;
|
||||||
|
@Autowired
|
||||||
|
CoreConfigFuncMapper coreConfigFuncMapper;
|
||||||
|
|
||||||
public CoreConfigEnumMapper getEnumMapper() {
|
public CoreConfigEnumMapper getEnumMapper() {
|
||||||
return coreConfigEnumMapper;
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.tiesheng.core.service;
|
package com.tiesheng.core.service;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
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.core.util.StrUtil;
|
||||||
import cn.hutool.extra.servlet.ServletUtil;
|
import cn.hutool.extra.servlet.ServletUtil;
|
||||||
import cn.hutool.json.JSONUtil;
|
import cn.hutool.json.JSONUtil;
|
||||||
@@ -10,24 +12,29 @@ import com.tiesheng.core.mapper.CoreLogMessageMapper;
|
|||||||
import com.tiesheng.core.mapper.CoreLogOperationMapper;
|
import com.tiesheng.core.mapper.CoreLogOperationMapper;
|
||||||
import com.tiesheng.core.mapper.CoreLogProcessMapper;
|
import com.tiesheng.core.mapper.CoreLogProcessMapper;
|
||||||
import com.tiesheng.core.pojos.RequestUserInfo;
|
import com.tiesheng.core.pojos.RequestUserInfo;
|
||||||
import com.tiesheng.core.pojos.dao.*;
|
import com.tiesheng.core.pojos.dao.CoreLogLogin;
|
||||||
|
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.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.TsTokenConfig;
|
||||||
import com.tiesheng.login.config.token.bean.TokenBean;
|
import com.tiesheng.login.config.token.bean.TokenBean;
|
||||||
import com.tiesheng.message.pojos.MessageReqResp;
|
|
||||||
import com.tiesheng.message.service.TieshengMessageConfigurer;
|
|
||||||
import com.tiesheng.util.ServletKit;
|
import com.tiesheng.util.ServletKit;
|
||||||
import com.tiesheng.util.config.Ip2regionConfig;
|
import com.tiesheng.util.config.Ip2regionConfig;
|
||||||
|
import com.tiesheng.util.exception.ApiException;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hao
|
* @author hao
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> implements TieshengMessageConfigurer {
|
public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLogOperation> {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
TieshengWebConfigurer tieshengWebConfigurer;
|
TieshengWebConfigurer tieshengWebConfigurer;
|
||||||
@@ -51,39 +58,79 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
public CoreLogProcessMapper getCoreLogProcessMapper() {
|
public CoreLogProcessMapper getCoreLogProcessMapper() {
|
||||||
return coreLogProcessMapper;
|
return coreLogProcessMapper;
|
||||||
}
|
}
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// 操作日志
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 导入日志
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加空的过程 返回id 用于更新
|
* 添加导入过程
|
||||||
|
*
|
||||||
|
* @param title 标题
|
||||||
|
* @param list 要导入的数据
|
||||||
*/
|
*/
|
||||||
public String addProcess() {
|
public <T> CoreLogProcess addProcess(String title, List<T> list, ProcessImportConsumer consumer) {
|
||||||
|
if (CollUtil.isEmpty(list)) {
|
||||||
|
throw new ApiException("文件中不存在数据");
|
||||||
|
}
|
||||||
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
||||||
|
coreLogProcess.setTitle(title);
|
||||||
|
coreLogProcess.setTotal(list.size());
|
||||||
|
coreLogProcess.setType("import");
|
||||||
|
coreLogProcess.setSuccessNum(0);
|
||||||
|
coreLogProcess.setFailNum(0);
|
||||||
coreLogProcessMapper.insert(coreLogProcess);
|
coreLogProcessMapper.insert(coreLogProcess);
|
||||||
return coreLogProcess.getId();
|
|
||||||
|
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 id 过程id
|
* @param title
|
||||||
* @param title 过程标题/说明
|
* @param consumer
|
||||||
* @param total 总数
|
* @return
|
||||||
* @param successNum 成功数
|
|
||||||
* @param failNum 失败数
|
|
||||||
* @param type 类型(import-导出,sync-同步)
|
|
||||||
*/
|
*/
|
||||||
public void upProcess(String id, String title, Integer total, Integer successNum, Integer failNum, String type) {
|
public CoreLogProcess addProcess(String title, ProcessSyncConsumer consumer) {
|
||||||
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
CoreLogProcess coreLogProcess = new CoreLogProcess();
|
||||||
coreLogProcess.setId(id);
|
|
||||||
coreLogProcess.setTitle(title);
|
coreLogProcess.setTitle(title);
|
||||||
coreLogProcess.setTotal(total);
|
coreLogProcess.setTotal(0);
|
||||||
coreLogProcess.setSuccessNum(successNum);
|
coreLogProcess.setType("sync");
|
||||||
coreLogProcess.setFailNum(failNum);
|
coreLogProcess.setSuccessNum(0);
|
||||||
coreLogProcess.setType(type);
|
coreLogProcess.setFailNum(0);
|
||||||
coreLogProcessMapper.updateById(coreLogProcess);
|
coreLogProcessMapper.insert(coreLogProcess);
|
||||||
|
|
||||||
|
ThreadUtil.execute(() -> {
|
||||||
|
int pageSize = 1000;
|
||||||
|
int pageNum = 1, lastCount = pageSize;
|
||||||
|
while (lastCount == pageSize) {
|
||||||
|
lastCount = consumer.accept(pageNum, pageSize);
|
||||||
|
coreLogProcess.setSuccessNum(lastCount);
|
||||||
|
if (lastCount != pageSize) {
|
||||||
|
coreLogProcess.setStatus(1);
|
||||||
|
}
|
||||||
|
coreLogProcessMapper.updateById(coreLogProcess);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return coreLogProcess;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,6 +143,9 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
return BeanUtil.copyProperties(coreLogProcess, ProcessDetailVo.class);
|
return BeanUtil.copyProperties(coreLogProcess, ProcessDetailVo.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// 操作日志
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -146,22 +196,4 @@ public class CoreLogService extends TsServiceBase<CoreLogOperationMapper, CoreLo
|
|||||||
coreLogLoginMapper.insert(login);
|
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -35,7 +35,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
platformUnique.setInfo(loginInfo.getInfo());
|
platformUnique.setInfo(loginInfo.getInfo());
|
||||||
saveOrUpdate(platformUnique);
|
saveOrUpdate(platformUnique);
|
||||||
|
|
||||||
TokenBean tokenBean = tieshengWebConfigurer.loginConfigurer().doLogin(platformUnique, loginInfo.getTo());
|
TokenBean tokenBean = tieshengWebConfigurer.login(platformUnique);
|
||||||
if (tokenBean != null) {
|
if (tokenBean != null) {
|
||||||
// 添加登录日志
|
// 添加登录日志
|
||||||
coreLogService.addLoginLog(platformUnique, tokenBean);
|
coreLogService.addLoginLog(platformUnique, tokenBean);
|
||||||
@@ -45,7 +45,7 @@ public class CorePlatformUniqueService extends TsServiceBase<CorePlatformUniqueM
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
public void onLoginRedirect(TokenBean bean, String to, String extra, HttpServletResponse response) {
|
||||||
tieshengWebConfigurer.loginConfigurer().redirect(bean, to, extra, response);
|
tieshengWebConfigurer.redirect(bean, to, extra, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -54,36 +54,22 @@ public interface TieshengWebConfigurer {
|
|||||||
return uploadPath;
|
return uploadPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 配置登录
|
* 登录逻辑
|
||||||
*
|
*
|
||||||
|
* @param platformUnique
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
LoginConfigurer loginConfigurer();
|
TokenBean login(CorePlatformUnique platformUnique);
|
||||||
|
|
||||||
|
/**
|
||||||
interface LoginConfigurer {
|
* 登录重定向
|
||||||
|
*
|
||||||
/**
|
* @param bean
|
||||||
* 登录逻辑
|
* @param extra
|
||||||
*
|
* @param response
|
||||||
* @param platformUnique
|
*/
|
||||||
* @return
|
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
||||||
*/
|
|
||||||
TokenBean doLogin(CorePlatformUnique platformUnique, String to);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 登录重定向
|
|
||||||
*
|
|
||||||
* @param bean
|
|
||||||
* @param extra
|
|
||||||
* @param response
|
|
||||||
*/
|
|
||||||
void redirect(TokenBean bean, String to, String extra, HttpServletResponse response);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.tiesheng.core.util;
|
||||||
|
|
||||||
|
public interface ProcessSyncConsumer {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页数据
|
||||||
|
*
|
||||||
|
* @param pageNum
|
||||||
|
* @param pageSize
|
||||||
|
* @return 返回成功的数量
|
||||||
|
*/
|
||||||
|
int accept(Integer pageNum, Integer pageSize);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -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;
|
|
||||||
@@ -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;
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
Navicat Premium Data Transfer
|
|
||||||
|
|
||||||
Source Server : 47.96.30.85
|
|
||||||
Source Server Type : MySQL
|
|
||||||
Source Server Version : 50730
|
|
||||||
Source Host : localhost:3306
|
|
||||||
Source Schema : com_tiesheng_web
|
|
||||||
|
|
||||||
Target Server Type : MySQL
|
|
||||||
Target Server Version : 50730
|
|
||||||
File Encoding : 65001
|
|
||||||
|
|
||||||
Date: 22/03/2023 10:39:06
|
|
||||||
*/
|
|
||||||
|
|
||||||
SET NAMES utf8mb4;
|
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Table structure for core_log_process
|
|
||||||
-- ----------------------------
|
|
||||||
CREATE TABLE `core_log_process` (
|
|
||||||
`id` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL,
|
|
||||||
`create_time` datetime NOT NULL,
|
|
||||||
`update_time` datetime NOT NULL,
|
|
||||||
`is_deleted` int(6) NOT NULL DEFAULT 0,
|
|
||||||
`title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '标题',
|
|
||||||
`total` int(11) NOT NULL DEFAULT 0 COMMENT '总数',
|
|
||||||
`success_num` int(11) NOT NULL DEFAULT 0 COMMENT '成功数',
|
|
||||||
`fail_num` int(11) NOT NULL DEFAULT 0 COMMENT '失败数',
|
|
||||||
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'import' COMMENT '类型(import-导入,sync-同步)',
|
|
||||||
PRIMARY KEY (`id`) USING BTREE
|
|
||||||
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '日志-过程' ROW_FORMAT = Dynamic;
|
|
||||||
|
|
||||||
-- ----------------------------
|
|
||||||
-- Records of core_log_process
|
|
||||||
-- ----------------------------
|
|
||||||
|
|
||||||
SET FOREIGN_KEY_CHECKS = 1;
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
SET NAMES utf8mb4;
|
SET NAMES utf8mb4;
|
||||||
SET FOREIGN_KEY_CHECKS = 0;
|
SET FOREIGN_KEY_CHECKS = 0;
|
||||||
|
|
||||||
|
|
||||||
CREATE TABLE `core_config_enum`
|
CREATE TABLE `core_config_enum`
|
||||||
(
|
(
|
||||||
`id` varchar(50) NOT NULL,
|
`id` varchar(50) NOT NULL,
|
||||||
@@ -16,20 +15,6 @@ CREATE TABLE `core_config_enum`
|
|||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-枚举';
|
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`
|
CREATE TABLE `core_config_system`
|
||||||
(
|
(
|
||||||
@@ -48,6 +33,27 @@ CREATE TABLE `core_config_system`
|
|||||||
) ENGINE = InnoDB
|
) ENGINE = InnoDB
|
||||||
DEFAULT CHARSET = utf8mb4 COMMENT ='配置-系统';
|
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`,
|
INSERT INTO `core_config_system`(`id`, `create_time`, `update_time`, `is_deleted`, `config_key`, `config_val`,
|
||||||
`config_type`, `remark`, `extra`, `read_only`)
|
`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',
|
VALUES ('manager_web_copyright', '2022-02-23 16:52:48', '2022-02-23 16:52:49', 0, 'manager_web_copyright',
|
||||||
@@ -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;
|
||||||
@@ -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;
|
||||||
@@ -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>
|
||||||
49
springboot-web/src/main/resources/mapper/CoreJobMapper.xml
Normal file
49
springboot-web/src/main/resources/mapper/CoreJobMapper.xml
Normal 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>
|
||||||
@@ -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>
|
||||||
@@ -13,9 +13,12 @@
|
|||||||
<result column="success_num" jdbcType="INTEGER" property="successNum" />
|
<result column="success_num" jdbcType="INTEGER" property="successNum" />
|
||||||
<result column="fail_num" jdbcType="INTEGER" property="failNum" />
|
<result column="fail_num" jdbcType="INTEGER" property="failNum" />
|
||||||
<result column="type" jdbcType="VARCHAR" property="type" />
|
<result column="type" jdbcType="VARCHAR" property="type" />
|
||||||
|
<result column="status" jdbcType="INTEGER" property="status" />
|
||||||
|
<result column="fail_file" jdbcType="VARCHAR" property="failFile" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
<sql id="Base_Column_List">
|
<sql id="Base_Column_List">
|
||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`
|
id, create_time, update_time, is_deleted, title, total, success_num, fail_num, `type`,
|
||||||
|
`status`, fail_file
|
||||||
</sql>
|
</sql>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user