Merge remote-tracking branch 'origin/feature_dev_20221025_message' into feature_dev_20221025_message
This commit is contained in:
+22
-12
@@ -6,11 +6,11 @@ package com.jero.common.constant.enums;
|
|||||||
* @auth zhn
|
* @auth zhn
|
||||||
*/
|
*/
|
||||||
public enum MessageTypeEnum {
|
public enum MessageTypeEnum {
|
||||||
READ("Subscription Notification","1"),
|
READ("Subscription Notification","订阅通知","1"),
|
||||||
WARN("Early Warning","2"),
|
WARN("Regulation Early Warning","法规预警","2"),
|
||||||
PUSH("Share / Forward","3"),
|
PUSH("Share / Forward","转发推送","3"),
|
||||||
HOMO_TASK("Homo Parameter Task","4"),
|
HOMO_TASK("Homo Parameter Task","","4"),
|
||||||
TASK("Regulation Compliance Task", "5"),
|
TASK("Regulation Compliance Task","", "5"),
|
||||||
//REGULATION_LIST_CONFIRMATION_TASK("Regulation List Confirmation Task", "6"), // 清单确认任务
|
//REGULATION_LIST_CONFIRMATION_TASK("Regulation List Confirmation Task", "6"), // 清单确认任务
|
||||||
//REGULATION_LIST_CONFIRMATION_NOTIFICATION("Regulation List Confirmation Notification", "7"), // 清单确认通知
|
//REGULATION_LIST_CONFIRMATION_NOTIFICATION("Regulation List Confirmation Notification", "7"), // 清单确认通知
|
||||||
//REGULATION_TASK_CONFIRMATION_TASK("Regulation Task Confirmation", "8"), // 任务确认任务
|
//REGULATION_TASK_CONFIRMATION_TASK("Regulation Task Confirmation", "8"), // 任务确认任务
|
||||||
@@ -21,19 +21,21 @@ public enum MessageTypeEnum {
|
|||||||
//DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知
|
//DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知
|
||||||
//PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知
|
//PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知
|
||||||
//VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知
|
//VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知
|
||||||
SYSTEMATIC_NOTIFICATION("Systematic Notification", "15"), // 系统通知
|
SYSTEMATIC_NOTIFICATION("Systematic Notification","", "15"), // 系统通知
|
||||||
LIST_CONFIRMATION("List Confirmation", "17"), // 清单确认
|
LIST_CONFIRMATION("List Confirmation", "","17"), // 清单确认
|
||||||
TASK_CONFIRMATION("Task Confirmation", "18"), // 任务确认
|
TASK_CONFIRMATION("Task Confirmation", "","18"), // 任务确认
|
||||||
COMPLIANCE_CONFIRMATION("Compliance Confirmation", "19"), // 符合性确认
|
COMPLIANCE_CONFIRMATION("Compliance Confirmation","", "19"), // 符合性确认
|
||||||
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments", "20"), // 法规意见收集
|
COLLECTION_OF_LEGISLATIVE_COMMENTS("Collection of Legislative Comments","", "20"), // 法规意见收集
|
||||||
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "21"), // 法规技术评估
|
REGULATORY_AND_TECHNICAL_ASSESSMENT("Regulatory and technical assessment", "","21"), // 法规技术评估
|
||||||
;
|
;
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
String nameCn;
|
||||||
String value;
|
String value;
|
||||||
|
|
||||||
private MessageTypeEnum(String name, String value) {
|
private MessageTypeEnum(String name,String nameCn, String value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
this.nameCn = nameCn;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,4 +54,12 @@ public enum MessageTypeEnum {
|
|||||||
public void setValue(String value) {
|
public void setValue(String value) {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getNameCn() {
|
||||||
|
return nameCn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNameCn(String nameCn) {
|
||||||
|
this.nameCn = nameCn;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
-9
@@ -2208,9 +2208,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
//飞书
|
//飞书
|
||||||
try {
|
try {
|
||||||
String contentInfoFeiShu = "In the "+ technologyTerritoryName
|
String contentInfoFeiShu = "In the "+ technologyTerritoryName
|
||||||
+ " technical field you subscribed to, the "
|
+ " technical field you subscribed to, the "+
|
||||||
+ serialNumber +" has been updated.";
|
category + " " + serialNumber +" has been updated.";
|
||||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFeiShu, MessageTypeEnum.PUSH.getName(), hrefTemp);
|
String contentInfoFeiShuCn = "您所订阅的" + technologyTerritoryName + "技术领域中更新了" + category + " " + serialNumber;;
|
||||||
|
|
||||||
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
|
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
|
||||||
|
feishuMsgVo.setUrl(hrefTemp);
|
||||||
|
feishuMsgVo.setContentEn(contentInfoFeiShu);
|
||||||
|
feishuMsgVo.setContent(contentInfoFeiShuCn);
|
||||||
|
|
||||||
|
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
|
||||||
|
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFeiShu, MessageTypeEnum.PUSH.getName(), hrefTemp);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("飞书消息推送失败");
|
log.error("飞书消息推送失败");
|
||||||
}
|
}
|
||||||
@@ -3354,6 +3363,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
}
|
}
|
||||||
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
|
//只要修改了标准,就需要向订阅用户发送消息(内容为-->XXX对“GB 7258 进行了修改请及时查看”)
|
||||||
//向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息
|
//向订阅领域管理中订阅了该技术领域的人和文档库中订阅了该条文档的人发送消息
|
||||||
|
// 只有技术领域变更为订阅的技术领域这一种情况发消息, 假如订阅了技术领域A,编辑的文档的技术领域也是A,这时编辑的是其他的字段,这种情况不发消息
|
||||||
Map<String, Object> mapTemp = new HashMap<>();
|
Map<String, Object> mapTemp = new HashMap<>();
|
||||||
mapTemp.put("domainId", map.get("technology_territory"));
|
mapTemp.put("domainId", map.get("technology_territory"));
|
||||||
mapTemp.put("documentId", map.get("id"));
|
mapTemp.put("documentId", map.get("id"));
|
||||||
@@ -3434,10 +3444,18 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
// thirdIdListAll = thirdIdListAll.stream().distinct().collect(Collectors.toList());
|
// thirdIdListAll = thirdIdListAll.stream().distinct().collect(Collectors.toList());
|
||||||
String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
|
String contentInfoFei = "In the " + technologyTerritoryNameEn + " technical field you subscribed to, the " +
|
||||||
category + " " + serialNumber+" has been updated.";
|
category + " " + serialNumber+" has been updated.";
|
||||||
|
String contentInfoFeiCn = "您所订阅的" + technologyTerritoryNameEn + "技术领域中更新了" + categoryCn + " " + serialNumber;
|
||||||
try {
|
try {
|
||||||
//跳转文档详情
|
//跳转文档详情
|
||||||
String url = backUrl + "/docManage/library/detail?id=" + id;
|
String url = backUrl + "/docManage/library/detail?id=" + id;
|
||||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
|
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
|
||||||
|
feishuMsgVo.setUrl(url);
|
||||||
|
feishuMsgVo.setContentEn(contentInfoFei);
|
||||||
|
feishuMsgVo.setContent(contentInfoFeiCn);
|
||||||
|
|
||||||
|
iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
|
||||||
|
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("文档新增飞书消息推送失败");
|
log.error("文档新增飞书消息推送失败");
|
||||||
}
|
}
|
||||||
@@ -3490,7 +3508,7 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
|||||||
//跳转文档详情
|
//跳转文档详情
|
||||||
String url = backUrl + "/docManage/library/detail?id=" + id;
|
String url = backUrl + "/docManage/library/detail?id=" + id;
|
||||||
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
feishuMsgVo.setTitle(MessageTypeEnum.READ.getName());
|
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
|
||||||
feishuMsgVo.setUrl(url);
|
feishuMsgVo.setUrl(url);
|
||||||
String replaceAll = contentInfoFei.replaceAll("\"", "<");
|
String replaceAll = contentInfoFei.replaceAll("\"", "<");
|
||||||
feishuMsgVo.setContentEn(replaceAll);
|
feishuMsgVo.setContentEn(replaceAll);
|
||||||
@@ -5190,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() + " 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.";
|
String contentTempCn = sysUser.getUsername() + "向您分享了" + StringUtils.join(list, ",") + "请查看.";
|
||||||
// FeishuMsgVo feishuMsgVo = getFeishuMsgVo(MessageTypeEnum.PUSH.getName(),null, contentTemp, encode);
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
// iFeishuService.sendCardMsg(thirdIdList.toArray(new String[]{}), feishuMsgVo);
|
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
|
||||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentTemp, MessageTypeEnum.PUSH.getName(), encode);
|
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) {
|
} catch (IOException e) {
|
||||||
log.error("飞书推送失败");
|
log.error("飞书推送失败");
|
||||||
|
|||||||
+19
-2
@@ -29,6 +29,7 @@ import com.jero.modules.dummy.service.IDummyInventoryInfoEOService;
|
|||||||
import com.jero.modules.dummy.service.IDummyReadEOService;
|
import com.jero.modules.dummy.service.IDummyReadEOService;
|
||||||
import com.jero.modules.dummy.vo.VirtualCreaterVo;
|
import com.jero.modules.dummy.vo.VirtualCreaterVo;
|
||||||
import com.jero.modules.feishu.service.IFeishuService;
|
import com.jero.modules.feishu.service.IFeishuService;
|
||||||
|
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||||
import com.jero.modules.oss.entity.OSSFile;
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
import com.jero.modules.oss.service.IOSSFileService;
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
import com.jero.modules.system.entity.SysAnnouncement;
|
import com.jero.modules.system.entity.SysAnnouncement;
|
||||||
@@ -366,6 +367,7 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
|||||||
List<DummyInventoryInfoEO> dummyInventoryInfoEOList = iDummyInventoryInfoEOService.list(lambdaQueryWrapper);
|
List<DummyInventoryInfoEO> dummyInventoryInfoEOList = iDummyInventoryInfoEOService.list(lambdaQueryWrapper);
|
||||||
String contentLog = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + "</br>";
|
String contentLog = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + "</br>";
|
||||||
String contentLogFeishu = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + " ";
|
String contentLogFeishu = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + " ";
|
||||||
|
String contentLogFeishuTemp = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows:" + " ";
|
||||||
|
|
||||||
if(dummyContentChangeEOList.size() == 0){
|
if(dummyContentChangeEOList.size() == 0){
|
||||||
//没有添加过需要进行第一次添加
|
//没有添加过需要进行第一次添加
|
||||||
@@ -449,7 +451,15 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
|||||||
if(thirdIdList.size() != 0){
|
if(thirdIdList.size() != 0){
|
||||||
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
|
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
|
||||||
try {
|
try {
|
||||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentLogFeishu, MessageTypeEnum.PUSH.getName(), href);
|
String contentInfoFeiCn = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:";
|
||||||
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
|
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
|
||||||
|
feishuMsgVo.setUrl(href);
|
||||||
|
feishuMsgVo.setContentEn(contentLogFeishuTemp);
|
||||||
|
feishuMsgVo.setContent(contentInfoFeiCn);
|
||||||
|
|
||||||
|
iFeishuService.sendCardMsgVirtua(thirdIdList.toArray(new String[]{}),feishuMsgVo,serialNumberAddList,serialNumberDeleteList);
|
||||||
|
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentLogFeishu, MessageTypeEnum.PUSH.getName(), href);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -490,8 +500,15 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
|
|||||||
//飞书
|
//飞书
|
||||||
if(thirdIdList.size() != 0){
|
if(thirdIdList.size() != 0){
|
||||||
String contentInfoTemp = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
|
String contentInfoTemp = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
|
||||||
|
String contentInfoFeiCn = "您订阅的虚拟清单"+ baseEO.getName()+"已被撤回.";
|
||||||
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
|
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
|
||||||
iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoTemp, MessageTypeEnum.PUSH.getName(), href);
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
|
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
|
||||||
|
feishuMsgVo.setUrl(href);
|
||||||
|
feishuMsgVo.setContentEn(contentInfoTemp);
|
||||||
|
feishuMsgVo.setContent(contentInfoFeiCn);
|
||||||
|
iFeishuService.sendCardMsgVirtua(thirdIdList.toArray(new String[]{}), feishuMsgVo,null,null);
|
||||||
|
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentInfoTemp, MessageTypeEnum.PUSH.getName(), href);
|
||||||
}
|
}
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
+19
@@ -5,6 +5,7 @@ import com.jero.modules.feishu.vo.FeishuMsg2Vo;
|
|||||||
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -48,6 +49,24 @@ public interface IFeishuService {
|
|||||||
*/
|
*/
|
||||||
String sendCardMsgDocument(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
|
String sendCardMsgDocument(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅领域(飞书消息)
|
||||||
|
* @param userIds
|
||||||
|
* @param feishuMsgVo
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
String sendCardMsgTerritory(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 虚拟清单(飞书消息)
|
||||||
|
* @param userIds
|
||||||
|
* @param feishuMsgVo
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
String sendCardMsgVirtua(String[] userIds, FeishuMsgVo feishuMsgVo, List<String> serialNumberAddList,List<String> serialNumberDeleteList) throws IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 翻译文本
|
* 翻译文本
|
||||||
* @param params
|
* @param params
|
||||||
|
|||||||
+210
-5
@@ -325,7 +325,6 @@ public class FeishuServiceImpl implements IFeishuService {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
contentSb.append("{\"tag\": \"hr\"},");
|
|
||||||
contentSb.append("{");
|
contentSb.append("{");
|
||||||
contentSb.append("\"actions\": [");
|
contentSb.append("\"actions\": [");
|
||||||
contentSb.append("{");
|
contentSb.append("{");
|
||||||
@@ -366,8 +365,6 @@ public class FeishuServiceImpl implements IFeishuService {
|
|||||||
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(1).toString());
|
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(1).toString());
|
||||||
JSONObject elementFour =
|
JSONObject elementFour =
|
||||||
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(3).toString());
|
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(3).toString());
|
||||||
JSONObject elementFive =
|
|
||||||
JSONObject.parseObject(JSONArray.parseArray(jsonObject.get("elements").toString()).get(4).toString());
|
|
||||||
|
|
||||||
//处理内容中的双引号(将尖括号替换成双引号)
|
//处理内容中的双引号(将尖括号替换成双引号)
|
||||||
JSONObject elementOne = getJsonObject(jsonObject, content);
|
JSONObject elementOne = getJsonObject(jsonObject, content);
|
||||||
@@ -378,13 +375,221 @@ public class FeishuServiceImpl implements IFeishuService {
|
|||||||
jsonArray.add(elementTwo);
|
jsonArray.add(elementTwo);
|
||||||
jsonArray.add(elementThree);
|
jsonArray.add(elementThree);
|
||||||
jsonArray.add(elementFour);
|
jsonArray.add(elementFour);
|
||||||
jsonArray.add(elementFive);
|
|
||||||
|
|
||||||
jsonObject.put("elements",jsonArray);
|
jsonObject.put("elements",jsonArray);
|
||||||
|
|
||||||
|
// 设置请求参数
|
||||||
|
JSONObject paramsMap = new JSONObject();
|
||||||
|
paramsMap.put("user_ids", userIds);
|
||||||
|
paramsMap.put("msg_type", "interactive");
|
||||||
|
paramsMap.put("card", jsonObject);
|
||||||
|
|
||||||
|
// 发送请求给飞书
|
||||||
|
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
|
||||||
|
// 获取返回结果
|
||||||
|
JSONObject tokenJson = JSONObject.parseObject(response);
|
||||||
|
if(!tokenJson.get("code").toString().equals("0")) {
|
||||||
|
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
|
||||||
|
}
|
||||||
|
return tokenJson.get("msg").toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅领域(飞书消息)
|
||||||
|
* @param userIds
|
||||||
|
* @param feishuMsgVo
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public String sendCardMsgTerritory(String[] userIds, FeishuMsgVo feishuMsgVo) throws IOException {
|
||||||
|
String token = getTenantAccessToken();
|
||||||
|
// 设置请求头
|
||||||
|
Map<String, String> headerMap = new HashMap<>();
|
||||||
|
headerMap.put("Authorization", "Bearer " + token);
|
||||||
|
headerMap.put("Content-Type", "application/json; charset=utf-8");
|
||||||
|
|
||||||
|
// 示例
|
||||||
|
StringBuilder contentSb = new StringBuilder();
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"elements\": [");
|
||||||
|
// 内容中文
|
||||||
|
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\",");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
};
|
||||||
|
contentSb.append("{\"tag\": \"hr\"},");
|
||||||
|
|
||||||
|
//内容英文
|
||||||
|
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\",");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
};
|
||||||
|
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"actions\": [");
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"button\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"view\",");
|
||||||
|
contentSb.append("\"tag\": \"plain_text\"");
|
||||||
|
contentSb.append("},");
|
||||||
|
contentSb.append("\"type\": \"primary\",");
|
||||||
|
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("],");
|
||||||
|
contentSb.append("\"tag\": \"action\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("],");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
contentSb.append("\"header\": {");
|
||||||
|
contentSb.append("\"template\": \"green\",");
|
||||||
|
contentSb.append("\"title\": {");
|
||||||
|
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
|
||||||
|
contentSb.append("\"tag\": \"plain_text\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("}");
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
|
||||||
|
|
||||||
|
// 设置请求参数
|
||||||
|
JSONObject paramsMap = new JSONObject();
|
||||||
|
paramsMap.put("user_ids", userIds);
|
||||||
|
paramsMap.put("msg_type", "interactive");
|
||||||
|
paramsMap.put("card", jsonObject);
|
||||||
|
|
||||||
|
// 发送请求给飞书
|
||||||
|
String response = HttpRequestUtil.getResponseOfPOST(batchSendMessageUrl, headerMap, paramsMap.toJSONString());
|
||||||
|
// 获取返回结果
|
||||||
|
JSONObject tokenJson = JSONObject.parseObject(response);
|
||||||
|
if(!tokenJson.get("code").toString().equals("0")) {
|
||||||
|
log.error("请求出现异常:" + tokenJson.get("msg") + " " + tokenJson);
|
||||||
|
}
|
||||||
|
return tokenJson.get("msg").toString();
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 虚拟清单发布(飞书消息)
|
||||||
|
* @param userIds
|
||||||
|
* @param feishuMsgVo
|
||||||
|
* @return
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
public String sendCardMsgVirtua(String[] userIds, FeishuMsgVo feishuMsgVo,
|
||||||
|
List<String> serialNumberAddList,List<String> serialNumberDeleteList) throws IOException {
|
||||||
|
String token = getTenantAccessToken();
|
||||||
|
// 设置请求头
|
||||||
|
Map<String, String> headerMap = new HashMap<>();
|
||||||
|
headerMap.put("Authorization", "Bearer " + token);
|
||||||
|
headerMap.put("Content-Type", "application/json; charset=utf-8");
|
||||||
|
|
||||||
|
// 示例
|
||||||
|
StringBuilder contentSb = new StringBuilder();
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"elements\": [");
|
||||||
|
// 内容中文
|
||||||
|
if (StrUtil.isNotEmpty(feishuMsgVo.getContent())){
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + feishuMsgVo.getContent() + "\"\n,");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
};
|
||||||
|
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
|
||||||
|
int count = 1;
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + count + ". 新增文档: " + StringUtils.join(serialNumberAddList,",") + "\"\n,");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
}
|
||||||
|
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
|
||||||
|
int count = 2;
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + count + ". 删除文档: " + StringUtils.join(serialNumberDeleteList,",") + "\"\n,");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
}
|
||||||
|
contentSb.append("{\"tag\": \"hr\"},");
|
||||||
|
|
||||||
|
//内容英文
|
||||||
|
if (StrUtil.isNotEmpty(feishuMsgVo.getContentEn())){
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + feishuMsgVo.getContentEn() + "\"\n,");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
};
|
||||||
|
|
||||||
|
if (ObjectUtils.isNotEmpty(serialNumberAddList)) {
|
||||||
|
int count = 1;
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + count + ". New regulations: " + StringUtils.join(serialNumberAddList,",") + "\"\n,");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
}
|
||||||
|
if (ObjectUtils.isNotEmpty(serialNumberDeleteList)) {
|
||||||
|
int count = 2;
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"div\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"" + count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + "\"\n,");
|
||||||
|
contentSb.append("\"tag\": \"lark_md\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("},");
|
||||||
|
}
|
||||||
|
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"actions\": [");
|
||||||
|
contentSb.append("{");
|
||||||
|
contentSb.append("\"tag\": \"button\",");
|
||||||
|
contentSb.append("\"text\": {");
|
||||||
|
contentSb.append("\"content\": \"view\",");
|
||||||
|
contentSb.append("\"tag\": \"plain_text\"");
|
||||||
|
contentSb.append("},");
|
||||||
|
contentSb.append("\"type\": \"primary\",");
|
||||||
|
contentSb.append("\"url\": \" "+ feishuMsgVo.getUrl() +" \"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("],");
|
||||||
|
contentSb.append("\"tag\": \"action\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("],");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
contentSb.append("\"header\": {");
|
||||||
|
contentSb.append("\"template\": \"green\",");
|
||||||
|
contentSb.append("\"title\": {");
|
||||||
|
contentSb.append("\"content\": \" " + feishuMsgVo.getTitle() + " \",");
|
||||||
|
contentSb.append("\"tag\": \"plain_text\"");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("}");
|
||||||
|
contentSb.append("}");
|
||||||
|
|
||||||
|
JSONObject jsonObject = JSONObject.parseObject(contentSb.toString());
|
||||||
|
|
||||||
// 设置请求参数
|
// 设置请求参数
|
||||||
JSONObject paramsMap = new JSONObject();
|
JSONObject paramsMap = new JSONObject();
|
||||||
|
|||||||
+15
-1
@@ -18,6 +18,7 @@ import com.jero.modules.document.enums.SearchEnum;
|
|||||||
import com.jero.modules.document.utils.ReadPdfUtil;
|
import com.jero.modules.document.utils.ReadPdfUtil;
|
||||||
import com.jero.modules.document.utils.ReadWordUtil;
|
import com.jero.modules.document.utils.ReadWordUtil;
|
||||||
import com.jero.modules.feishu.service.IFeishuService;
|
import com.jero.modules.feishu.service.IFeishuService;
|
||||||
|
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||||
import com.jero.modules.message.websocket.WebSocket;
|
import com.jero.modules.message.websocket.WebSocket;
|
||||||
import com.jero.modules.oss.entity.OSSFile;
|
import com.jero.modules.oss.entity.OSSFile;
|
||||||
import com.jero.modules.oss.service.IOSSFileService;
|
import com.jero.modules.oss.service.IOSSFileService;
|
||||||
@@ -886,7 +887,20 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
|
|||||||
this.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
|
this.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
|
||||||
//飞书
|
//飞书
|
||||||
try {
|
try {
|
||||||
this.iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), msgContentEN, MessageTypeEnum.PUSH.getName(), hrefFeishu);
|
//XXX向您分享了XXXXXXXXX,请查看。
|
||||||
|
//XXX shared xxxxxxxx with you. Please be reminded to check it out.
|
||||||
|
|
||||||
|
String contentInfoFeiCn = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看";
|
||||||
|
String msgContentENTemp = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out.";
|
||||||
|
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||||
|
feishuMsgVo.setTitle(MessageTypeEnum.PUSH.getNameCn()+"/"+MessageTypeEnum.PUSH.getName());
|
||||||
|
feishuMsgVo.setUrl(hrefFeishu);
|
||||||
|
feishuMsgVo.setContentEn(msgContentENTemp);
|
||||||
|
feishuMsgVo.setContent(contentInfoFeiCn);
|
||||||
|
|
||||||
|
this.iFeishuService.sendCardMsgTerritory(thirdIdList.toArray(new String[]{}), feishuMsgVo);
|
||||||
|
|
||||||
|
// this.iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), msgContentEN, MessageTypeEnum.PUSH.getName(), hrefFeishu);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
log.error("飞书推送失败");
|
log.error("飞书推送失败");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user