新增消息发送接口
This commit is contained in:
@@ -7,6 +7,7 @@ import com.cool.store.dto.enterprise.AuthScopeDTO;
|
||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
||||
import com.cool.store.dto.login.UserIdInfoDTO;
|
||||
import com.cool.store.dto.message.SendCardMessageDTO;
|
||||
import com.cool.store.dto.response.ResultDTO;
|
||||
import com.cool.store.entity.EnterpriseUserDO;
|
||||
import com.cool.store.enums.ErrorCodeEnum;
|
||||
@@ -17,6 +18,7 @@ import com.cool.store.utils.RestTemplateUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -311,4 +313,23 @@ public class ISVHttpRequest {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送飞书卡片消息
|
||||
* @param param
|
||||
*/
|
||||
public void sendFeiShuCardMessage(SendCardMessageDTO param) throws ApiException{
|
||||
if(CollectionUtils.isEmpty(param.getUserIds()) || StringUtils.isAnyBlank(param.getTitle(), param.getContent(), param.getMessageUrl()) || Objects.isNull(param.getMessageType())){
|
||||
return;
|
||||
}
|
||||
String url = isvDomain + "/sendFeiShuCardMessage";
|
||||
ResultDTO responseEntity = null;
|
||||
try {
|
||||
responseEntity = httpRestTemplateService.postForObject(url, param, ResultDTO.class);
|
||||
log.info("url:{}, response:{}", url, JSONObject.toJSONString(responseEntity));
|
||||
} catch (Exception e) {
|
||||
log.info("调用isv出错{}", e);
|
||||
throw new ApiException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user