新增消息发送接口
This commit is contained in:
@@ -0,0 +1,49 @@
|
|||||||
|
package com.cool.store.enums;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: MessageTypeEnum
|
||||||
|
* @Description:
|
||||||
|
* @date 2023-06-15 10:14
|
||||||
|
*/
|
||||||
|
public enum MessageTypeEnum {
|
||||||
|
|
||||||
|
SCHEDULE_REMINDER("schedule_reminder", "日历提醒事件", "img_v2_0709ece3-77a8-49a4-820f-f245b2a4fdag")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
private String imageMediaId;
|
||||||
|
|
||||||
|
MessageTypeEnum(String code, String name, String imageMediaId) {
|
||||||
|
this.code = code;
|
||||||
|
this.name = name;
|
||||||
|
this.imageMediaId = imageMediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getImageMediaId() {
|
||||||
|
return imageMediaId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getImageMediaId(String code){
|
||||||
|
for (MessageTypeEnum value : MessageTypeEnum.values()) {
|
||||||
|
if(value.code.equals(code)){
|
||||||
|
return value.imageMediaId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.cool.store.dto.message;
|
||||||
|
|
||||||
|
import com.cool.store.enums.MessageTypeEnum;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author zhangchenbiao
|
||||||
|
* @FileName: SendCardMessageDTO
|
||||||
|
* @Description:发送卡片消息
|
||||||
|
* @date 2023-06-15 11:05
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SendCardMessageDTO {
|
||||||
|
|
||||||
|
@ApiModelProperty("消息接收人")
|
||||||
|
private List<String> userIds;
|
||||||
|
|
||||||
|
@ApiModelProperty("消息链接")
|
||||||
|
private String messageUrl;
|
||||||
|
|
||||||
|
@ApiModelProperty("消息标题")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty("消息内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty("消息类型, MessageTypeEnum")
|
||||||
|
private MessageTypeEnum messageType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.cool.store.dto.enterprise.AuthScopeDTO;
|
|||||||
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
import com.cool.store.dto.enterprise.EnterpriseUserDTO;
|
||||||
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
import com.cool.store.dto.enterprise.SysDepartmentDTO;
|
||||||
import com.cool.store.dto.login.UserIdInfoDTO;
|
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.dto.response.ResultDTO;
|
||||||
import com.cool.store.entity.EnterpriseUserDO;
|
import com.cool.store.entity.EnterpriseUserDO;
|
||||||
import com.cool.store.enums.ErrorCodeEnum;
|
import com.cool.store.enums.ErrorCodeEnum;
|
||||||
@@ -17,6 +18,7 @@ import com.cool.store.utils.RestTemplateUtil;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.collections4.CollectionUtils;
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -311,4 +313,23 @@ public class ISVHttpRequest {
|
|||||||
}
|
}
|
||||||
return null;
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.cool.store.dto.calendar.CreateCalendarEventDTO;
|
|||||||
import com.cool.store.dto.calendar.DeleteCalendarEventDTO;
|
import com.cool.store.dto.calendar.DeleteCalendarEventDTO;
|
||||||
import com.cool.store.dto.calendar.UpdateCalendarEventDTO;
|
import com.cool.store.dto.calendar.UpdateCalendarEventDTO;
|
||||||
import com.cool.store.dto.calendar.UserCalendarsEventDTO;
|
import com.cool.store.dto.calendar.UserCalendarsEventDTO;
|
||||||
|
import com.cool.store.dto.message.SendCardMessageDTO;
|
||||||
import com.cool.store.dto.partner.DescribePhoneNumberDTO;
|
import com.cool.store.dto.partner.DescribePhoneNumberDTO;
|
||||||
import com.cool.store.dto.response.ResultDTO;
|
import com.cool.store.dto.response.ResultDTO;
|
||||||
import com.cool.store.entity.HyOpenAreaInfoDO;
|
import com.cool.store.entity.HyOpenAreaInfoDO;
|
||||||
@@ -200,7 +201,7 @@ public class TestController {
|
|||||||
return ResultDTO.successResult(isvHttpRequest.getUserCalendarsEvents(userId, startTime, endTime));
|
return ResultDTO.successResult(isvHttpRequest.getUserCalendarsEvents(userId, startTime, endTime));
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping(path = "/getIdentityCardInfo")
|
@GetMapping("/getIdentityCardInfo")
|
||||||
@ApiOperation("根据身份证正面解析获取数据")
|
@ApiOperation("根据身份证正面解析获取数据")
|
||||||
public ResponseResult<IdentityCardInfoVO> getIdentityCardInfo(@RequestParam(value = "faceImageUrl")String faceImageUrl){
|
public ResponseResult<IdentityCardInfoVO> getIdentityCardInfo(@RequestParam(value = "faceImageUrl")String faceImageUrl){
|
||||||
try {
|
try {
|
||||||
@@ -211,4 +212,14 @@ public class TestController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/sendFeiShuCardMessage")
|
||||||
|
public ResponseResult sendFeiShuCardMessage(@RequestBody SendCardMessageDTO param){
|
||||||
|
try {
|
||||||
|
isvHttpRequest.sendFeiShuCardMessage(param);
|
||||||
|
return ResponseResult.success();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new ServiceException(ErrorCodeEnum.IDENTITY_CARD_PARSE_FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public class SignValidateFilter implements Filter {
|
|||||||
|
|
||||||
private static List<String> patternList =
|
private static List<String> patternList =
|
||||||
Lists.newArrayList("/web/check/ok","/check/ok",
|
Lists.newArrayList("/web/check/ok","/check/ok",
|
||||||
"/partner/mini/program/doc.html","/partner/mini/program/v2/api-docs","/**/test/**","/partner/pc/feiShuLogin","/partner/pc/oss/getUploadFileConfig",
|
"/partner/mini/program/doc.html","/partner/mini/program/v2/api-docs","/**/test/**","/partner/mini/program/oss/getUploadFileConfig",
|
||||||
"/**/swagger*/**", "/**/webjars/**");
|
"/**/swagger*/**", "/**/webjars/**");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user