fix: hiwork消息跳转
This commit is contained in:
+12
-14
@@ -43,6 +43,7 @@ public class HiworkMsgServiceImpl implements IHiworkMsgService {
|
|||||||
private final static String LINK = "link"; // 消息类型-文本
|
private final static String LINK = "link"; // 消息类型-文本
|
||||||
private final static String MSG_TYPE = "msgtype"; // 消息类型
|
private final static String MSG_TYPE = "msgtype"; // 消息类型
|
||||||
private final static String CONTENT = "content"; // 消息内容
|
private final static String CONTENT = "content"; // 消息内容
|
||||||
|
private final static String MESSAGE_URL = "messageUrl"; // 消息内容
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: liao
|
* @Author: liao
|
||||||
@@ -69,14 +70,9 @@ public class HiworkMsgServiceImpl implements IHiworkMsgService {
|
|||||||
|
|
||||||
// 消息体
|
// 消息体
|
||||||
JSONObject msgJsonObject = new JSONObject();
|
JSONObject msgJsonObject = new JSONObject();
|
||||||
|
msgJsonObject.put(MSG_TYPE, TEXT);
|
||||||
JSONObject textJsonObject = new JSONObject();
|
JSONObject textJsonObject = new JSONObject();
|
||||||
textJsonObject.put(CONTENT, content);
|
textJsonObject.put(CONTENT, content);
|
||||||
if (StrUtil.isBlank(messageUrl)) {
|
|
||||||
msgJsonObject.put(MSG_TYPE, TEXT);
|
|
||||||
} else {
|
|
||||||
msgJsonObject.put(MSG_TYPE, LINK);
|
|
||||||
textJsonObject.put("messageUrl", messageUrl);
|
|
||||||
}
|
|
||||||
msgJsonObject.put(TEXT, textJsonObject);
|
msgJsonObject.put(TEXT, textJsonObject);
|
||||||
hiworkDingDingMsg.setMsg(msgJsonObject);
|
hiworkDingDingMsg.setMsg(msgJsonObject);
|
||||||
|
|
||||||
@@ -109,6 +105,8 @@ public class HiworkMsgServiceImpl implements IHiworkMsgService {
|
|||||||
hiworkSystemMsg.setSendName(loginUser.getRealname());
|
hiworkSystemMsg.setSendName(loginUser.getRealname());
|
||||||
// 消息标题
|
// 消息标题
|
||||||
hiworkSystemMsg.setTitle(title);
|
hiworkSystemMsg.setTitle(title);
|
||||||
|
// 消息类型
|
||||||
|
hiworkSystemMsg.setMessageType(messageType);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(receiverIdList)) {
|
if (CollectionUtils.isEmpty(receiverIdList)) {
|
||||||
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "receiverIdList");
|
throw new JeroBootException(ResultCommon.EMPTY_COMMON, "receiverIdList");
|
||||||
@@ -128,17 +126,17 @@ public class HiworkMsgServiceImpl implements IHiworkMsgService {
|
|||||||
|
|
||||||
// 消息体
|
// 消息体
|
||||||
JSONObject msgJsonObject = new JSONObject();
|
JSONObject msgJsonObject = new JSONObject();
|
||||||
|
msgJsonObject.put(MSG_TYPE, TEXT);
|
||||||
|
|
||||||
JSONObject textJsonObject = new JSONObject();
|
JSONObject textJsonObject = new JSONObject();
|
||||||
textJsonObject.put(CONTENT, content);
|
textJsonObject.put(CONTENT, content);
|
||||||
if (StrUtil.isBlank(messageUrl)) {
|
|
||||||
msgJsonObject.put(MSG_TYPE, TEXT);
|
JSONObject linkJsonObject = new JSONObject();
|
||||||
hiworkSystemMsg.setMessageType("01");
|
linkJsonObject.put(MESSAGE_URL, messageUrl);
|
||||||
} else {
|
|
||||||
msgJsonObject.put(MSG_TYPE, LINK);
|
|
||||||
textJsonObject.put("messageUrl", messageUrl);
|
|
||||||
hiworkSystemMsg.setMessageType("04");
|
|
||||||
}
|
|
||||||
msgJsonObject.put(TEXT, textJsonObject);
|
msgJsonObject.put(TEXT, textJsonObject);
|
||||||
|
msgJsonObject.put(LINK, linkJsonObject);
|
||||||
|
|
||||||
hiworkSystemMsg.setMsg(msgJsonObject);
|
hiworkSystemMsg.setMsg(msgJsonObject);
|
||||||
|
|
||||||
log.info("发送Hiwork系统消息: {}", JSONObject.toJSONString(hiworkSystemMsg));
|
log.info("发送Hiwork系统消息: {}", JSONObject.toJSONString(hiworkSystemMsg));
|
||||||
|
|||||||
+2
-14
@@ -41,8 +41,6 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
|||||||
private Boolean isSend;
|
private Boolean isSend;
|
||||||
@Value("${hiwork.isHiworkDingDingSend}")
|
@Value("${hiwork.isHiworkDingDingSend}")
|
||||||
private Boolean isHiworkDingDingSend;
|
private Boolean isHiworkDingDingSend;
|
||||||
@Value("${hiwork.dingdingUrlPrefix}")
|
|
||||||
private String dingdingUrlPrefix;
|
|
||||||
@Value("${hiwork.hiworkUrlPrefix}")
|
@Value("${hiwork.hiworkUrlPrefix}")
|
||||||
private String hiworkUrlPrefix;
|
private String hiworkUrlPrefix;
|
||||||
|
|
||||||
@@ -101,18 +99,8 @@ public class SendMessageServiceImpl implements SendMessageAPI {
|
|||||||
if ("5".equals(type)) {
|
if ("5".equals(type)) {
|
||||||
// Hiwork钉钉消息
|
// Hiwork钉钉消息
|
||||||
sendMsgHandle = new DingDingSendMsgHandle();
|
sendMsgHandle = new DingDingSendMsgHandle();
|
||||||
if (isHiworkDingDingSend) {
|
sendMsgHandle.SendMsg(sendMessageDTO.getToUserId(), sysMessageTemplate.getTemplateName(), sysMessageTemplate.getTemplateContent(), null, null);
|
||||||
String messageUrl = hiworkUrlPrefix + finalOpenPage;
|
|
||||||
// 将tempUrl编码
|
|
||||||
String encodeUrl = null;
|
|
||||||
try {
|
|
||||||
encodeUrl = URLEncoder.encode(messageUrl, StandardCharsets.UTF_8.name());
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
throw new JeroBootException("钉钉消息跳转url编码异常", e);
|
|
||||||
}
|
|
||||||
messageUrl = dingdingUrlPrefix + encodeUrl + "&pc_slide=true";
|
|
||||||
sendMsgHandle.SendMsg(sendMessageDTO.getToUserId(), sysMessageTemplate.getTemplateName(), sysMessageTemplate.getTemplateContent(), finalOpenType, messageUrl);
|
|
||||||
}
|
|
||||||
} else if ("6".equals(type)) {
|
} else if ("6".equals(type)) {
|
||||||
// Hiwork系统消息
|
// Hiwork系统消息
|
||||||
sendMsgHandle = new SystemSendMsgHandle();
|
sendMsgHandle = new SystemSendMsgHandle();
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ hiwork:
|
|||||||
# 统一消息集成
|
# 统一消息集成
|
||||||
messageUrl: taskapi/task.basedata/notice/noticeCalls/send
|
messageUrl: taskapi/task.basedata/notice/noticeCalls/send
|
||||||
# 是否发送消息
|
# 是否发送消息
|
||||||
isSend: false
|
isSend: true
|
||||||
# 是否推送统一待办
|
# 是否推送统一待办
|
||||||
isWorkflow: false
|
isWorkflow: false
|
||||||
# 前端调用地址
|
# 前端调用地址
|
||||||
@@ -417,11 +417,9 @@ hiwork:
|
|||||||
appkey: dingshfclphtivrd0r7k
|
appkey: dingshfclphtivrd0r7k
|
||||||
appsecret: dqhom_17n6BC8pmLeaf5wNp4aV_4XSt_aYn-dNBo8z__-79NjVvZhDJ_M2REdxRc
|
appsecret: dqhom_17n6BC8pmLeaf5wNp4aV_4XSt_aYn-dNBo8z__-79NjVvZhDJ_M2REdxRc
|
||||||
# dingding和Hiwork是否发送消息
|
# dingding和Hiwork是否发送消息
|
||||||
isHiworkDingDingSend: false
|
isHiworkSend: false
|
||||||
#hiwork消息跳转前缀
|
#hiwork消息跳转前缀
|
||||||
hiworkUrlPrefix: "http://srms-test.sinotruk.com"
|
hiworkUrlPrefix: "http://srms-test.sinotruk.com"
|
||||||
#hiwork钉钉消息跳转前缀
|
|
||||||
dingdingUrlPrefix: "dingtalk://dingtalkclient/page/link?url="
|
|
||||||
|
|
||||||
# 汽车标准数字化平台ASMS
|
# 汽车标准数字化平台ASMS
|
||||||
asms:
|
asms:
|
||||||
|
|||||||
@@ -392,8 +392,6 @@ hiwork:
|
|||||||
isHiworkDingDingSend: false
|
isHiworkDingDingSend: false
|
||||||
#hiwork消息跳转前缀
|
#hiwork消息跳转前缀
|
||||||
hiworkUrlPrefix: "http://srms-test.sinotruk.com"
|
hiworkUrlPrefix: "http://srms-test.sinotruk.com"
|
||||||
#hiwork钉钉消息跳转前缀
|
|
||||||
dingdingUrlPrefix: "dingtalk://dingtalkclient/page/link?url="
|
|
||||||
|
|
||||||
# 汽车标准数字化平台ASMS
|
# 汽车标准数字化平台ASMS
|
||||||
asms:
|
asms:
|
||||||
|
|||||||
@@ -392,8 +392,6 @@ hiwork:
|
|||||||
isHiworkDingDingSend: true
|
isHiworkDingDingSend: true
|
||||||
#hiwork消息跳转前缀
|
#hiwork消息跳转前缀
|
||||||
hiworkUrlPrefix: "http://srms-test.sinotruk.com"
|
hiworkUrlPrefix: "http://srms-test.sinotruk.com"
|
||||||
#hiwork钉钉消息跳转前缀
|
|
||||||
dingdingUrlPrefix: "dingtalk://dingtalkclient/page/link?url="
|
|
||||||
|
|
||||||
# 汽车标准数字化平台ASMS
|
# 汽车标准数字化平台ASMS
|
||||||
asms:
|
asms:
|
||||||
|
|||||||
Reference in New Issue
Block a user