sendFeiShuNotice

This commit is contained in:
苏竹红
2023-07-24 15:57:59 +08:00
parent 629d392533
commit 7487ce218b

View File

@@ -1,10 +1,12 @@
package com.cool.store.service.impl; package com.cool.store.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.cool.store.dto.message.SendCardMessageDTO; import com.cool.store.dto.message.SendCardMessageDTO;
import com.cool.store.enums.FeiShuNoticeMsgEnum; import com.cool.store.enums.FeiShuNoticeMsgEnum;
import com.cool.store.enums.MessageTypeEnum; import com.cool.store.enums.MessageTypeEnum;
import com.cool.store.http.ISVHttpRequest; import com.cool.store.http.ISVHttpRequest;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@@ -26,13 +28,17 @@ public class NoticeService {
private ISVHttpRequest isvHttpRequest; private ISVHttpRequest isvHttpRequest;
public void sendFeiShuNotice(FeiShuNoticeMsgEnum feiShuNoticeMsgEnum, List<String> userIds,Object... objects) { public void sendFeiShuNotice(FeiShuNoticeMsgEnum feiShuNoticeMsgEnum, List<String> userIds,Object... objects) {
try{ try{
SendCardMessageDTO sendCardMessageDTO = new SendCardMessageDTO(); if (CollectionUtils.isEmpty(userIds)){
sendCardMessageDTO.setUserIds(userIds); log.info("sendFeiShuNotice_feiShuNoticeMsgEnum:{} userIds:{},objects:{}",feiShuNoticeMsgEnum.getTitle(), JSONObject.toJSONString(userIds),JSONObject.toJSONString(objects));
sendCardMessageDTO.setMessageType(MessageTypeEnum.SCHEDULE_REMINDER); return;
sendCardMessageDTO.setMessageUrl(linkUrl); }
sendCardMessageDTO.setTitle(feiShuNoticeMsgEnum.getTitle()); SendCardMessageDTO sendCardMessageDTO = new SendCardMessageDTO();
sendCardMessageDTO.setContent(MessageFormat.format(feiShuNoticeMsgEnum.getContent(),objects)); sendCardMessageDTO.setUserIds(userIds);
isvHttpRequest.sendFeiShuCardMessage(sendCardMessageDTO); sendCardMessageDTO.setMessageType(MessageTypeEnum.SCHEDULE_REMINDER);
sendCardMessageDTO.setMessageUrl(linkUrl);
sendCardMessageDTO.setTitle(feiShuNoticeMsgEnum.getTitle());
sendCardMessageDTO.setContent(MessageFormat.format(feiShuNoticeMsgEnum.getContent(),objects));
isvHttpRequest.sendFeiShuCardMessage(sendCardMessageDTO);
}catch (Exception e){ }catch (Exception e){
log.info("发送飞书通知失败"); log.info("发送飞书通知失败");
} }