This commit is contained in:
JyuHsin
2026-03-05 16:19:34 +08:00
parent d16b5ce96e
commit dbcbd92be9
6 changed files with 40 additions and 14 deletions
@@ -26,7 +26,7 @@ public interface SmsService {
* @param content 内容
* @param link 链接
*/
void send(String loginName, String title, String content, String link);
void send(String loginName, String title, String content, String url, String mobileUrl);
/**
* 群发 多人接收内容相同时使用该方法
@@ -35,5 +35,5 @@ public interface SmsService {
* @param content 内容
* @param link 链接
*/
void massSend(List<String> loginNames, String title, String content, String link);
void massSend(List<String> loginNames, String title, String content, String url, String mobileUrl);
}
@@ -44,21 +44,21 @@ public class SmsJshvcServiceImpl implements SmsService {
@Override
public void send(String loginName, String title, String content) {
send(loginName, "智慧工会", content, null);
send(loginName, "智慧工会", content, null, null);
}
@Override
public void send(String loginName, String title, String content, String link) {
public void send(String loginName, String title, String content, String url, String mobileUrl) {
Map<String, String> paramMap = Map.of("userId", loginName);
doSend(title, content, List.of(paramMap), link);
doSend(title, content, List.of(paramMap), url, mobileUrl);
}
@Override
public void massSend(List<String> loginNames, String title, String content, String link) {
public void massSend(List<String> loginNames, String title, String content, String url, String mobileUrl) {
List<Map<String, String>> receivers = loginNames.stream()
.map(name -> Map.of("userId", name))
.toList();
doSend(title, content, receivers, link);
doSend(title, content, receivers, url, mobileUrl);
}
/**
@@ -73,7 +73,7 @@ public class SmsJshvcServiceImpl implements SmsService {
* @param content
* @param receivers
*/
private void doSend(String title, String content, List<Map<String, String>> receivers, String link) {
private void doSend(String title, String content, List<Map<String, String>> receivers, String pcUrl, String mobileUrl) {
if (Lang.isEmpty(receivers)) {
log.error("send fail by receivers is null");
@@ -94,13 +94,15 @@ public class SmsJshvcServiceImpl implements SmsService {
paramsMap.put("content", content);
paramsMap.put("sendType", "5");
paramsMap.put("receivers", receivers);
if (StrUtil.isBlank(link)) {
if (StrUtil.isBlank(pcUrl) && StrUtil.isBlank(mobileUrl)) {
paramsMap.put("wxSendType", "text");
} else {
paramsMap.put("wxSendType", "textcard");
paramsMap.put("mobileUrl", link);
paramsMap.put("pcUrl", pcUrl);
paramsMap.put("mobileUrl", mobileUrl);
// 这是图文卡片,后面用到再对接吧
// paramsMap.put("qyWeChatImgUrl", "");
paramsMap.put("urlDesc", "查看详情");
}
log.debug("send params: {}", Json.toJson(paramsMap));
@@ -1,6 +1,7 @@
package com.budwk.app.flow.listenter;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONObject;
import com.budwk.app.flow.constant.FlowConst;
import com.budwk.app.flow.engine.event.ProcessEvent;
import com.budwk.app.flow.engine.event.ProcessEventListener;
@@ -10,6 +11,7 @@ import com.budwk.app.flow.entity.ProcessTaskActor;
import com.budwk.app.flow.enums.ProcessEventTypeEnum;
import com.budwk.app.todo.service.TodoService;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.web.commons.base.Globals;
import com.budwk.app.zhgh.dayofficework.message.service.GlobalMessageSendService;
import lombok.extern.slf4j.Slf4j;
import org.nutz.dao.Cnd;
@@ -67,7 +69,10 @@ public class ProcessTaskStartEventListener implements ProcessEventListener {
if (!List.of("superadmin" ,"CS2025015", "20182040").contains(SecurityUtil.getUserLoginname())) {
break;
}
globalMessageSendService.sendMessage(taskDisplayName, message, 2, List.of(taskActor.getActorId()), null);
JSONObject config = new JSONObject();
config.set("pcUrl", Globals.AppDomain + task.getFormKey());
config.set("mobileUrl", Globals.AppDomain + task.getH5FormKey());
globalMessageSendService.sendMessage(taskDisplayName, message, 2, List.of(taskActor.getActorId()), config);
}
todoService.saveTask(task);
@@ -14,6 +14,10 @@ import com.budwk.app.todo.service.TodoService;
import com.budwk.app.web.commons.auth.utils.SecurityUtil;
import com.budwk.app.web.commons.base.Globals;
import com.wisedu.casp.sdk.api.BaseResponse;
import com.wisedu.casp.sdk.api.mc.ChannelInfo;
import com.wisedu.casp.sdk.api.mc.GetEnableChannelByTypeRequest;
import com.wisedu.casp.sdk.api.mc.GetEnableChannelByTypeResponse;
import com.wisedu.casp.sdk.api.mc.constants.ChannelType_Constants;
import com.wisedu.casp.sdk.api.tdc.constants.*;
import com.wisedu.casp.sdk.api.tdc.model.*;
import com.wisedu.casp.sdk.api.tdc.pushtask.ProcessInstanceRealDeleteRequest;
@@ -29,6 +33,7 @@ import org.nutz.integration.jedis.RedisService;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.json.Json;
import org.nutz.lang.Lang;
import org.nutz.lang.util.NutMap;
import java.util.Arrays;
@@ -105,6 +110,20 @@ public class TodoServiceImpl implements TodoService {
insertModel.setApplicationModel(applicationModel);
request.setInsertModel(Collections.singletonList(insertModel));
/*Client channelClient = new DefaultClient(TodoPlatformConfig.TODO_PLATFORM_BASE_URL, TodoPlatformConfig.TODO_APP_ID, TodoPlatformConfig.TODO_APP_SECRET);
GetEnableChannelByTypeRequest channelByTypeRequest = new GetEnableChannelByTypeRequest();
channelByTypeRequest.setChannelType(ChannelType_Constants.QYWECHAT);
GetEnableChannelByTypeResponse channelByTypeResponse = channelClient.execute(channelByTypeRequest);
log.info("获取待办消息渠道,接口响应数据:{}", Json.toJson(channelByTypeResponse));
if (channelByTypeResponse.isSuccess()) {
List<ChannelInfo> list = channelByTypeResponse.getData();
if(Lang.isNotEmpty(list)) {
request.setIsSendMsg(1);
request.setSendChannels("1184803022838996992");
request.setWxSendType("textcard");
}
}*/
log.info("新增待办任务,请求参数:{}", Json.toJson(request));
BaseResponse response = client.execute(request);
log.info("新增待办任务,接口响应数据:{}", Json.toJson(response));
@@ -42,7 +42,7 @@ public class WechatEnterpriseMessageSendStrategy implements GlobalMessageSendStr
@Override
public boolean isEnabled() {
return GlobalMessageSendStrategy.super.isEnabled();
return true;
}
@Override
@@ -82,6 +82,6 @@ public class WechatEnterpriseMessageSendStrategy implements GlobalMessageSendStr
return;
}
List<String> list = users.stream().map(Sys_user::getLoginname).toList();
smsService.massSend(list, title, content, "");
smsService.massSend(list, title, content, config.getStr("pcUrl"), config.getStr("mobileUrl"));
}
}
@@ -62,7 +62,7 @@ layout("/layouts/platform.html"){
<el-button @click="onView(row)" size="mini" type="primary">查看</el-button>
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onEdit(row)" size="mini" type="primary">编辑</el-button>
<el-button v-if="row.canRevoke" size="mini" type="danger" @click="onRevoke(row)">撤回</el-button>
<el-button v-if="row.taskKey === 'startTask' || !row.instanceId" @click="onDelete(row.id)" size="mini" type="danger">
<el-button @click="onDelete(row.id)" size="mini" type="danger">
删除
</el-button>
</template>