Commit f3168d9f authored by 王淑君's avatar 王淑君

修改接口

parent 733bc154
......@@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
/**
* 消息通知接口调用
......@@ -61,24 +62,27 @@ public class MTNotificationApiRequestClient {
if("dev".equalsIgnoreCase(serverType)) {
return true;
}
Ret ret = new Ret();
List<String> receiIdListtake = new ArrayList<>();
String receive = "";
String corpId = "";
List<SysUser> personnelsList = sysUserMapper.selectByIds(Arrays.asList(new String[]{message.getRecipientId()}));
List<SysUser> personnelsList = sysUserMapper.selectByIds(Arrays.asList(message.getRecipientId().split(","))
.stream()
.map(s -> s.trim())
.collect(Collectors.toList()));
if (null !=personnelsList && personnelsList.size() >0) {
SysUser personnels = personnelsList.get(0);
for (SysUser personnels: personnelsList){
if (null != personnels && null != personnels.getAccountId()) {
receiIdListtake.add(personnels.getAccountId());
receive = personnels.getAccountId();
corpId = personnels.getCorpId();
}
}
MTNotificationSendReqDTO mtNotificationSendReqDTO = MTNotificationSendReqDTO.builder().title(noticeTitle).content(message.getInfoText())
.channels("ALL").targetId(message.getBusinessId()).receiverIds(receiIdListtake).build();
mtNotificationSendReqDTO.setSenderName("排班");
mtNotificationSendReqDTO.setSenderName("智学");
mtNotificationSendReqDTO.setChannels("ALL");
mtNotificationSendReqDTO.setCategoryCodes(Arrays.asList(new String[]{"SHIFTS"}));
mtNotificationSendReqDTO.setCategoryCodes(Arrays.asList(new String[]{"EDUCATION"}));
if (StrUtil.isNotEmpty(corpId))
mtNotificationSendReqDTO.setCorpId(corpId);
else
......@@ -87,23 +91,21 @@ public class MTNotificationApiRequestClient {
String url = this.noticePropertiesUrl + "noticeType="+dealWithTitle(noticeTitle)+"&id="+receive + "&infoText="+UrlUtil.Utf8URLencode(message.getInfoText())
+"&messageId="+message.getBusinessId() +"&createDate="+ UrlUtil.Utf8URLencodeTime(df.format(message.getCreateDate()))+"&from=zx";
mtNotificationSendReqDTO.setProperties(new HashMap<String, String>(){{
put("url", url);
}});
Ret ret = new Ret();
mtNotificationSendReqDTO.setProperties(new HashMap<String, String>(){{ put("url", url); }});
try {
ret = notificationFeignClient.sendMessage(mtNotificationSendReqDTO, "app", (long) 1);
}catch (Exception ex){
log.error("----------------------------------------------------调用智信通知失败!----------------------------------------------------------");
// throw new BizCommonException("调用智信通知失败");
}
}
}
if(ret != null && "M0000".equals(ret.getCode())){
return true;
}
return false;
}
private String dealWithTitle(String title){
// (GO_WORK_INFO:上班提醒";HAND_WORK_INFO:交班提醒;TAKE_WORK_INFO:接班提醒;FEEDBACK_WORK_INFO:反馈提醒;CHANGE_WORK_INFO","调班通知)
String result = "";
switch(title){
case "回复提醒" :
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment