Compare commits

...

4 Commits

Author SHA1 Message Date
曾文豪
fc00bad49a publish 1.0.17 2023-12-27 15:46:16 +08:00
曾文豪
6dd4e19e39 publish 1.0.16 2023-12-06 16:43:31 +08:00
曾文豪
4373ec7c0e publish 1.0.15 2023-11-20 16:23:18 +08:00
曾文豪
5cc135d8e2 fix:兼容windows服务器的路径问题 2023-11-20 16:22:49 +08:00
16 changed files with 71 additions and 34 deletions

20
pom.xml
View File

@@ -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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</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>1.0.14</version> <version>1.0.17</version>
</dependency> </dependency>
<dependency> <dependency>

View File

@@ -6,11 +6,11 @@
<parent> <parent>
<groupId>com.tiesheng.springboot-parent</groupId> <groupId>com.tiesheng.springboot-parent</groupId>
<artifactId>springboot-parent</artifactId> <artifactId>springboot-parent</artifactId>
<version>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-ademo</artifactId> <artifactId>springboot-ademo</artifactId>
<version>1.0.14</version> <version>1.0.17</version>
<properties> <properties>
<maven.compiler.source>8</maven.compiler.source> <maven.compiler.source>8</maven.compiler.source>

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-annotation</artifactId> <artifactId>springboot-annotation</artifactId>

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-database</artifactId> <artifactId>springboot-database</artifactId>

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-encrypt</artifactId> <artifactId>springboot-encrypt</artifactId>

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-login</artifactId> <artifactId>springboot-login</artifactId>

View File

@@ -113,6 +113,7 @@ public class LoginController {
map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId()); map.put("corpId", platformDingConfig.getConfigBean(service).getCorpId());
map.put("service", service); map.put("service", service);
map.put("extra", extra); map.put("extra", extra);
map.put("context", globalConfig.getContextPath());
String query = URLUtil.buildQuery(map, Charset.defaultCharset()); String query = URLUtil.buildQuery(map, Charset.defaultCharset());
String configUrl = globalConfig.buildPath("/ding/index.html?" + query); String configUrl = globalConfig.buildPath("/ding/index.html?" + query);
try { try {

View File

@@ -24,10 +24,10 @@
corpId: getQueryString("corpId"), corpId: getQueryString("corpId"),
onSuccess: function (result) { onSuccess: function (result) {
let search = window.location.search + "&code=" + result.code; let search = window.location.search + "&code=" + result.code;
window.location.href = "/login/ding/oauth2/" + getQueryString("service") + search; window.location.replace(getQueryString("context") + "/login/ding/oauth2/" + getQueryString("service") + search);
}, },
onFail: function (err) { onFail: function (err) {
window.location.href = "./error.html?message=" + JSON.stringify(err); window.location.replace("./error.html?message=" + JSON.stringify(err));
} }
}) })

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-message</artifactId> <artifactId>springboot-message</artifactId>

View File

@@ -1,9 +1,12 @@
package com.tiesheng.message.config.aliyun; package com.tiesheng.message.config.aliyun;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Validator;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.ReUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.crypto.SecureUtil; import cn.hutool.crypto.SecureUtil;
import cn.hutool.extra.validation.ValidationUtil;
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;
@@ -139,7 +142,15 @@ public class AliyunSmsSender implements TieshengMessageSender {
@Override @Override
public MessageReqResp send(String user, JSONObject body) { public MessageReqResp send(String user, JSONObject body) {
return sendSms(user, body.getStr("template_code"), body); boolean mobile = Validator.isMobile(user);
if (!mobile) {
return null;
}
String templateCode = body.getStr("template_code");
if (StrUtil.isEmpty(templateCode)) {
return null;
}
return sendSms(user, templateCode, body);
} }
@Override @Override

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-platform</artifactId> <artifactId>springboot-platform</artifactId>

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-poi</artifactId> <artifactId>springboot-poi</artifactId>

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-util</artifactId> <artifactId>springboot-util</artifactId>

View File

@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.comparator.VersionComparator; 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.core.util.URLUtil;
import cn.hutool.extra.spring.SpringUtil; import cn.hutool.extra.spring.SpringUtil;
import cn.hutool.http.HttpGlobalConfig; import cn.hutool.http.HttpGlobalConfig;
import cn.hutool.log.LogFactory; import cn.hutool.log.LogFactory;
@@ -116,7 +117,8 @@ public class GlobalConfig {
if (FileUtil.exist(folder)) { if (FileUtil.exist(folder)) {
File[] files = FileUtil.ls(folder); File[] files = FileUtil.ls(folder);
for (File file : files) { for (File file : files) {
versions.add(StrUtil.subAfter(file.getAbsolutePath(), htmlDir, true)); String normalize = FileUtil.normalize(file.getAbsolutePath());
versions.add(StrUtil.subAfter(normalize, htmlDir, true));
} }
} }

View File

@@ -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>1.0.14</version> <version>1.0.17</version>
</parent> </parent>
<artifactId>springboot-web</artifactId> <artifactId>springboot-web</artifactId>

View File

@@ -28,10 +28,38 @@ public class CoreMessageService {
CoreLogMessageMapper coreLogMessageMapper; CoreLogMessageMapper coreLogMessageMapper;
/**
* 插入数据
*
* @param reqResp
*/
private void insertMessageLog(MessageReqResp reqResp) {
if (reqResp == null) {
return;
}
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
}
/**
* 发送所有消息
*
* @param userIds
* @param body
*/
public void all(List<String> userIds, JSONObject body) {
messageSenderList.stream().filter(TieshengMessageSender::support)
.forEach(sender -> {
for (String user : userIds) {
insertMessageLog(sender.send(user, body));
}
});
}
/** /**
* 发送消息 * 发送消息
* *
* @param title * @param channels
* @param body * @param body
* @param channels 消息通道如果为all时表示发送全部通道 * @param channels 消息通道如果为all时表示发送全部通道
*/ */
@@ -41,12 +69,8 @@ public class CoreMessageService {
} }
messageSenderList.stream().filter(TieshengMessageSender::support) messageSenderList.stream().filter(TieshengMessageSender::support)
.forEach(sender -> { .forEach(sender -> channels.stream().filter(it -> Objects.equals(it.getChannel(), sender.getChannel()))
channels.stream().filter(it -> Objects.equals(it.getChannel(), sender.getChannel())).forEach(it -> { .forEach(it -> insertMessageLog(sender.send(it.getUser(), body))));
MessageReqResp reqResp = sender.send(it.getUser(), body);
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class));
});
});
} }
@@ -54,7 +78,6 @@ public class CoreMessageService {
* 发送消息 * 发送消息
* *
* @param userChannel * @param userChannel
* @param title
* @param body * @param body
*/ */
public MessageReqResp send(UserChannel userChannel, JSONObject body) { public MessageReqResp send(UserChannel userChannel, JSONObject body) {
@@ -67,7 +90,7 @@ public class CoreMessageService {
sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support()); sender -> Objects.equals(sender.getChannel(), userChannel.getChannel()) && sender.support());
if (messageSender != null) { if (messageSender != null) {
MessageReqResp reqResp = messageSender.send(userChannel.getUser(), body); MessageReqResp reqResp = messageSender.send(userChannel.getUser(), body);
coreLogMessageMapper.insert(BeanUtil.copyProperties(reqResp, CoreLogMessage.class)); insertMessageLog(reqResp);
return reqResp; return reqResp;
} }
return null; return null;