use of org.hzero.boot.message.entity.WeChatSender in project choerodon-message by open-hand.
the class RelSendMessageController method sendAllMessageWithReceipt.
@ApiOperation(value = "关联发送消息,邮件/短信/站内信/微信/钉钉(返回发送结果,若服务端开启了异步发送则不返回)")
@Permission(level = ResourceLevel.ORGANIZATION)
@PostMapping("/all/with-receipt")
public ResponseEntity<List<Message>> sendAllMessageWithReceipt(@PathVariable("organizationId") Long organizationId, @RequestBody @Encrypt AllSender sender) {
List<Message> result = new ArrayList<>();
MessageSender messageSender = sender.getMessageSender();
WeChatSender weChatSender = sender.getWeChatSender();
DingTalkSender dingTalkSender = sender.getDingTalkSender();
if (messageSender != null) {
messageSender.setTenantId(organizationId);
validObject(messageSender);
result.addAll(relSendMessageService.relSendMessageReceipt(messageSender, organizationId));
}
if (weChatSender != null) {
weChatSender.setTenantId(organizationId);
validObject(weChatSender);
weChatSender.setLang(StringUtils.hasText(weChatSender.getLang()) ? weChatSender.getLang() : messageClientProperties.getDefaultLang());
result.addAll(relSendMessageService.relSendMessageReceipt(weChatSender));
}
if (dingTalkSender != null) {
dingTalkSender.setTenantId(organizationId);
validObject(dingTalkSender);
dingTalkSender.setLang(StringUtils.hasText(dingTalkSender.getLang()) ? dingTalkSender.getLang() : messageClientProperties.getDefaultLang());
result.addAll(relSendMessageService.relSendMessageReceipt(dingTalkSender));
}
return Results.success(result);
}
use of org.hzero.boot.message.entity.WeChatSender in project choerodon-message by open-hand.
the class RelSendMessageController method sendAllMessage.
@ApiOperation(value = "关联发送消息,邮件/短信/站内信/微信/钉钉")
@Permission(level = ResourceLevel.ORGANIZATION)
@PostMapping("/all")
public ResponseEntity<Map<String, Integer>> sendAllMessage(@PathVariable("organizationId") Long organizationId, @RequestBody @Encrypt AllSender sender) {
Map<String, Integer> result = new HashMap<>(16);
MessageSender messageSender = sender.getMessageSender();
WeChatSender weChatSender = sender.getWeChatSender();
DingTalkSender dingTalkSender = sender.getDingTalkSender();
if (messageSender != null) {
messageSender.setTenantId(organizationId);
validObject(messageSender);
result.putAll(relSendMessageService.relSendMessage(messageSender, organizationId));
}
if (weChatSender != null) {
weChatSender.setTenantId(organizationId);
validObject(weChatSender);
weChatSender.setLang(StringUtils.hasText(weChatSender.getLang()) ? weChatSender.getLang() : messageClientProperties.getDefaultLang());
result.putAll(relSendMessageService.relSendMessage(weChatSender));
}
if (dingTalkSender != null) {
dingTalkSender.setTenantId(organizationId);
validObject(dingTalkSender);
dingTalkSender.setLang(StringUtils.hasText(dingTalkSender.getLang()) ? dingTalkSender.getLang() : messageClientProperties.getDefaultLang());
result.putAll(relSendMessageService.relSendMessage(dingTalkSender));
}
return Results.success(result);
}
Aggregations