文档库推送--发送飞书消息

This commit is contained in:
zhn
2022-10-26 17:09:33 +08:00
parent cf17a1a7a9
commit 494f41bb4f
3 changed files with 36 additions and 21 deletions
@@ -6,11 +6,11 @@ package com.jero.common.constant.enums;
* @auth zhn
*/
public enum MessageTypeEnum {
READ("Subscription Notification","1"),
WARN("Early Warning","2"),
PUSH("Share / Forward","3"),
HOMO_TASK("Homo Parameter Task","4"),
TASK("Regulation Compliance Task", "5"),
READ("Subscription Notification","订阅通知","1"),
WARN("Regulation Early Warning","法规预警","2"),
PUSH("Share / Forward","转发推送","3"),
HOMO_TASK("Homo Parameter Task","","4"),
TASK("Regulation Compliance Task","", "5"),
//REGULATION_LIST_CONFIRMATION_TASK("Regulation List Confirmation Task", "6"), // 清单确认任务
//REGULATION_LIST_CONFIRMATION_NOTIFICATION("Regulation List Confirmation Notification", "7"), // 清单确认通知
//REGULATION_TASK_CONFIRMATION_TASK("Regulation Task Confirmation", "8"), // 任务确认任务
@@ -21,19 +21,21 @@ public enum MessageTypeEnum {
//DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知
//PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知
//VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知
SYSTEMATIC_NOTIFICATION("Systematic Notification", "15"), // 系统通知
LIST_CONFIRMATION("List Confirmation", "17"), // 清单确认
TASK_CONFIRMATION("Task Confirmation", "18"), // 任务确认
COMPLIANCE_CONFIRMATION("Compliance Confirmation", "19"), // 符合性确认
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments", "20"), // 法规意见收集
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "21"), // 法规技术评估
SYSTEMATIC_NOTIFICATION("Systematic Notification","", "15"), // 系统通知
LIST_CONFIRMATION("List Confirmation", "","17"), // 清单确认
TASK_CONFIRMATION("Task Confirmation", "","18"), // 任务确认
COMPLIANCE_CONFIRMATION("Compliance Confirmation","", "19"), // 符合性确认
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments","", "20"), // 法规意见收集
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "","21"), // 法规技术评估
;
String name;
String nameCn;
String value;
private MessageTypeEnum(String name, String value) {
private MessageTypeEnum(String name,String nameCn, String value) {
this.name = name;
this.nameCn = nameCn;
this.value = value;
}
@@ -52,4 +54,12 @@ public enum MessageTypeEnum {
public void setValue(String value) {
this.value = value;
}
public String getNameCn() {
return nameCn;
}
public void setNameCn(String nameCn) {
this.nameCn = nameCn;
}
}
@@ -2213,7 +2213,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
String contentInfoFeiShuCn = "您所订阅的" + technologyTerritoryName + "技术领域中更新了" + category + " " + serialNumber;;
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getName());
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(hrefTemp);
feishuMsgVo.setContentEn(contentInfoFeiShu);
feishuMsgVo.setContent(contentInfoFeiShuCn);
@@ -3449,7 +3449,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//跳转文档详情
String url = backUrl + "/docManage/library/detail?id=" + id;
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getName());
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(url);
feishuMsgVo.setContentEn(contentInfoFei);
feishuMsgVo.setContent(contentInfoFeiCn);
@@ -3508,7 +3508,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
//跳转文档详情
String url = backUrl + "/docManage/library/detail?id=" + id;
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getName());
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(url);
String replaceAll = contentInfoFei.replaceAll("\"", "<");
feishuMsgVo.setContentEn(replaceAll);
@@ -5208,10 +5208,15 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
}
});
String contentTemp = sysUser.getUsername() + " shared " + StringUtils.join(list, ",") + " with you, please be reminded to check it out.";
// String contentTemp = sysUser.getUsername() + " pushed " + StringUtils.join(list, ",") + " to you. Please be reminded to check it out.";
// FeishuMsgVo feishuMsgVo = getFeishuMsgVo(MessageTypeEnum.PUSH.getName(),null, contentTemp, encode);
// iFeishuService.sendCardMsg(thirdIdList.toArray(new String[]{}), feishuMsgVo);
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
String contentTempCn = sysUser.getUsername() + "向您分享了" + StringUtils.join(list, ",") + "请查看.";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
feishuMsgVo.setUrl(encode);
feishuMsgVo.setContentEn(contentTemp);
feishuMsgVo.setContent(contentTempCn);
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}),feishuMsgVo);
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
}
} catch (IOException e) {
log.error("飞书推送失败");
@@ -453,7 +453,7 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
try {
String contentInfoFeiCn = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getName());
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(href);
feishuMsgVo.setContentEn(contentLogFeishuTemp);
feishuMsgVo.setContent(contentInfoFeiCn);
@@ -503,7 +503,7 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
String contentInfoFeiCn = "您订阅的虚拟清单"+ baseEO.getName()+"已被撤回.";
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setTitle(MessageTypeEnum.READ.getName());
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
feishuMsgVo.setUrl(href);
feishuMsgVo.setContentEn(contentInfoTemp);
feishuMsgVo.setContent(contentInfoFeiCn);