This commit is contained in:
2026-02-06 08:44:49 +08:00
parent 496f934e69
commit ba10731dfb
5 changed files with 38 additions and 25 deletions
+14 -12
View File
@@ -57,12 +57,12 @@ public class MsgApi {
/**
* @param channels 推送渠道 (INNER:站内消息; SMS:短信; Mail:邮件; WeChat:微信; DingTalk:钉钉;同时推送多个渠道用英文逗号分隔 )
* @param loginNameStr 字符串,多个工号用英文逗号分隔 ","
* @param mtype 消息类型; 0: 图文 1: 文字 2: 外链
* @param title 标题
* @param content 内容
* @param imageUrl 图片URL
* @param channels 推送渠道 (INNER:站内消息; SMS:短信; Mail:邮件; WeChat:微信; DingTalk:钉钉;同时推送多个渠道用英文逗号分隔 )
* @param loginNameStr 字符串,多个工号用英文逗号分隔 ","
* @param mtype 消息类型; 0: 图文 1: 文字 2: 外链
* @param title 标题
* @param content 内容
* @param imageUrl 图片URL
* @author zhf
* @description
*/
@@ -82,12 +82,12 @@ public class MsgApi {
}
/**
* @param channels 推送渠道 (INNER:站内消息; SMS:短信; Mail:邮件; WeChat:微信; DingTalk:钉钉;同时推送多个渠道用英文逗号分隔 )
* @param loginNameList 工号集合
* @param mtype 消息类型; 0: 图文 1: 文字 2: 外链
* @param title 标题
* @param content 内容
* @param imageUrl 图片URL
* @param channels 推送渠道 (INNER:站内消息; SMS:短信; Mail:邮件; WeChat:微信; DingTalk:钉钉;同时推送多个渠道用英文逗号分隔 )
* @param loginNameList 工号集合
* @param mtype 消息类型; 0: 图文 1: 文字 2: 外链
* @param title 标题
* @param content 内容
* @param imageUrl 图片URL
* @author zhf
* @description
*/
@@ -157,6 +157,7 @@ public class MsgApi {
/**
* 封装发送消息的参数
*
* @param channels
* @param loginNameList
* @param mtype
@@ -185,6 +186,7 @@ public class MsgApi {
/**
* 发送请求
*
* @param msgToken
* @param map
* @return
@@ -189,8 +189,8 @@ public class MsgNotifyController {
} else if (msgNotify.getSendMode().equals("two")) {
List<NutMap> userScopes = msgNotifyService.getUserScopes(msgNotify.getActivityGroupId());
if (flag) {
msgNotifyService.sendMsg(msgNotify.getSendTypes(), userScopes, msgNotify.getContent());
List<String> loginNames = userScopes.stream().map(v -> v.getString("loginName")).toList();
msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent());
}
userScopes.forEach(v -> {
if (flag) {
@@ -203,11 +203,8 @@ public class MsgNotifyController {
} else if (msgNotify.getSendMode().equals("three")) {
if (flag) {
List<User> user = dao.query(User.class, Cnd.where("id", "in", users));
List<NutMap> map = new ArrayList<>();
user.forEach(u -> {
map.add(NutMap.NEW().addv("userId", u.getLoginname()).addv("mobile", u.getMobile()));
});
msgNotifyService.sendMsg(msgNotify.getSendTypes(), map, msgNotify.getContent());
List<String> loginNames = user.stream().map(User::getLoginname).toList();
msgNotifyService.sendMsg2(msgNotify.getSendTypes(), loginNames, msgNotify.getContent());
}
for (String u : users) {
if (flag) {
@@ -49,6 +49,8 @@ public interface MsgNotifyService {
*/
void sendMsg(List<String> sendTypes, List<NutMap> receivers, String content);
void sendMsg2(List<String> sendTypes, List<String> loginNames, String content);
/**
* 查询活动设置人员
@@ -1,9 +1,12 @@
package io.v.nutz.zhgh.msgNotify.service.impl;
import cn.hutool.core.net.URLEncodeUtil;
import cn.hutool.core.util.URLUtil;
import io.v.nutz.base.service.impl.ViServiceImpl;
import io.v.nutz.base.utils.DateUtil;
import io.v.nutz.base.utils.MsgApi;
import io.v.nutz.sys.models.User;
import io.v.nutz.web.commons.base.Globals;
import io.v.nutz.web.commons.utils.ShiroUtil;
import io.v.nutz.zhgh.msgNotify.models.MsgNotify;
import io.v.nutz.zhgh.msgNotify.models.MsgNotifyUser;
@@ -124,7 +127,7 @@ public class MsgNotifyServiceImpl extends ViServiceImpl<MsgNotify> implements Ms
new Thread() {
@Override
public void run() {
if (sendTypes.contains("0")) {
if (sendTypes.contains("DingTalk")) {
// msgApi.sendMsg(content, null, null, null, "0", receivers);
}
if (sendTypes.contains("1")) {
@@ -144,6 +147,15 @@ public class MsgNotifyServiceImpl extends ViServiceImpl<MsgNotify> implements Ms
}
@Override
public void sendMsg2(List<String> sendTypes, List<String> loginNames, String content) {
if (sendTypes.contains("DingTalk")) {
String url = URLUtil.encode("/file_server/fileStreamPreview?id=fa777e529921481c903c259115cc79e7");
String link = Globals.AppDomain + "/assets/platform/plugins/pdfJs/web/viewer.html?file="+url;
// msgApi.sendMsg(sendTypes, loginNames, 2, "祝贺您获得家情共话观影券,请查收观影指南!", "电影券已发放,请查收指南!",null ,link);
}
}
/**
* 查询活动设置人员
@@ -255,11 +255,11 @@
</div>
<el-form-item label="发送方式" prop="sendTypes">
<el-checkbox-group v-model="formData.sendTypes" size="medium">
<el-checkbox :disabled="hold" border label="0">PC门户通知和移动校园</el-checkbox>
<el-checkbox :disabled="hold" border label="1">PC门户</el-checkbox>
<el-checkbox :disabled="hold" border label="2">移动校园</el-checkbox>
<el-checkbox :disabled="hold" border label="4">短信</el-checkbox>
<el-checkbox :disabled="hold" border label="5">微信企业号</el-checkbox>
<el-checkbox :disabled="hold" border label="DingTalk">钉钉</el-checkbox>
<!-- <el-checkbox :disabled="hold" border label="1">PC门户</el-checkbox>-->
<!-- <el-checkbox :disabled="hold" border label="2">移动校园</el-checkbox>-->
<!-- <el-checkbox :disabled="hold" border label="4">短信</el-checkbox>-->
<!-- <el-checkbox :disabled="hold" border label="5">微信企业号</el-checkbox>-->
</el-checkbox-group>
</el-form-item>