消息卡片跳转指定页问题修复

This commit is contained in:
feng.li
2023-12-25 11:54:04 +08:00
parent e97de23d9c
commit 9beb5d39e8
2 changed files with 13 additions and 5 deletions

View File

@@ -16,6 +16,8 @@ import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.MessageFormat;
import java.util.Arrays;
import java.util.HashMap;
@@ -82,11 +84,17 @@ public class EventCenterHttpRequest {
public void sendFeiShuNotice(FeiShuNoticeMsgEnum msgEnum, List<String> receiverIds, Object... objects) throws ApiException {
//1. 组织消息参数SendMsgRequest 的 cardParams需要填入的参数为模板中 ${} 中的参数
HashMap<String, String> cardParams = new HashMap<>();
String PCPath = msgEnum.getPCPath();
String mobilePath = msgEnum.getMobilePath();
String pathVariable = getPathVariable(msgEnum, objects);
String PCWholePath = PCLinkUrl + PCPath + pathVariable;
String mobileWholePath = mobileLinkUrl + mobilePath + pathVariable;
String PCPath = null;
String mobilePath = null;
try {
PCPath = URLEncoder.encode(msgEnum.getPCPath() + pathVariable, "UTF-8");
mobilePath = URLEncoder.encode(msgEnum.getMobilePath() + pathVariable, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw new ApiException("URL 编码错误");
}
String PCWholePath = PCLinkUrl + PCPath;
String mobileWholePath = mobileLinkUrl + mobilePath;
cardParams.put("title", msgEnum.getTitle());
cardParams.put("content", MessageFormat.format(msgEnum.getContent(),objects));
cardParams.put("img_key", msgEnum.getImageMediaId());

View File

@@ -53,7 +53,7 @@ public class EventRequestTest extends AbstractJUnit4SpringContextTests {
// //7. 面试预约申请
// eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.INTERVIEW_APPOINTMENT, Arrays.asList("34f4a9ga"), "测试", "1008611", "2023-10-24 16:40:07");
//8. 会销协作通知
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.EXHIBITION_COLLABORATOR, Arrays.asList("34f4a9ga"), "6", "老大", "会销", "2023-12-31", "系东方大酒店");
eventCenterHttpRequest.sendFeiShuNotice(FeiShuNoticeMsgEnum.EXHIBITION_COLLABORATOR, Arrays.asList("34f4a9ga"), "4", "老大", "会销", "2023-12-31", "系东方大酒店");
}
@Test