飞书消息-文档库编辑
This commit is contained in:
+14
-5
@@ -45,6 +45,7 @@ import com.jero.modules.document.vo.QueryConditionVO;
|
||||
import com.jero.modules.domain.entity.DomainUserRel;
|
||||
import com.jero.modules.domain.service.DomainUserRelService;
|
||||
import com.jero.modules.domain.service.impl.DomainManageServiceImpl;
|
||||
import com.jero.modules.feishu.enums.TemplateInfoEnum2;
|
||||
import com.jero.modules.feishu.service.IFeishuService;
|
||||
import com.jero.modules.feishu.vo.FeishuMsgVo;
|
||||
import com.jero.modules.home.entity.HomeDocumentDynamicEO;
|
||||
@@ -3731,20 +3732,28 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
|
||||
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
|
||||
feishuMsgVo.setTitle(MessageTypeEnum.READ.getNameCn()+"/"+MessageTypeEnum.READ.getName());
|
||||
feishuMsgVo.setUrl(url);
|
||||
String replaceAll = contentInfoFei.replaceAll("\"", "<");
|
||||
feishuMsgVo.setContentEn(replaceAll);
|
||||
// String replaceAll = contentInfoFei.replaceAll("\"", "<");
|
||||
feishuMsgVo.setContentEn(contentInfoFei);
|
||||
|
||||
String replaceAllCn = contentInfoFeiCn.replaceAll("<text class='highlight-class'>", "")
|
||||
.replaceAll("</text>","").replaceAll("\"", "<");
|
||||
.replaceAll("</text>","");
|
||||
// .replaceAll("\"", "<");
|
||||
feishuMsgVo.setContent(replaceAllCn);
|
||||
//
|
||||
iFeishuService.sendCardMsgDocument(userIdListUpdateFeishu.toArray(new String[]{}), feishuMsgVo);
|
||||
// iFeishuService.sendCardMsgDocument(userIdListUpdateFeishu.toArray(new String[]{}), feishuMsgVo);
|
||||
//飞书消息(模板-20230410)
|
||||
Map<String,Object> params = new HashMap<>();
|
||||
params.put("contentInfoFeiCn",replaceAllCn);
|
||||
params.put("contentInfoFeiEn",contentInfoFei);
|
||||
params.put("userIdList",userIdListUpdate);
|
||||
params.put("back_url",url);
|
||||
iFeishuService.sendMessageSubscriptionNotification(TemplateInfoEnum2.SUBSCRIPTION_INFORM.getValue(),params);
|
||||
|
||||
// String contentInfoFei = "In the "+category + " " + serialNumber +" you subscribed to, "+sysUser.getUsername()+" changed the " + sbStr.toString();;
|
||||
// //跳转文档详情
|
||||
// String url = backUrl + "/docManage/library/detail?id=" + id;
|
||||
// iFeishuService.batchSendMessage(userIdListUpdateFeishu.toArray(new String[]{}), contentInfoFei, MessageTypeEnum.READ.getName(), url);
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
log.error("文档新增飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
|
||||
+12
@@ -67,6 +67,18 @@ public enum TemplateInfoEnum2 {
|
||||
VALIDATION_COMPLIANCE_CONFIRMATION2("验证符合性流程-公用消息-红色","ctp_AAu2lBI6MV0i"),
|
||||
VALIDATION_COMPLIANCE_CONFIRMATION3("验证符合性流程-公用消息-黄色","ctp_AAupcD3RBbUV"),
|
||||
|
||||
/**
|
||||
* 订阅通知
|
||||
*/
|
||||
SUBSCRIPTION_INFORM("通用-订阅消息模板","ctp_AAfvdg0Cy90I"),
|
||||
|
||||
/**
|
||||
* 转发推送
|
||||
*/
|
||||
TRANSPOND_PUSH1("转发推送",""),
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
String name;
|
||||
|
||||
+7
@@ -130,4 +130,11 @@ public interface IFeishuService {
|
||||
* @throws IOException
|
||||
*/
|
||||
Result<?> batchSendLarkCardMsgByTemplate2(JSONObject json) throws IOException;
|
||||
|
||||
/**
|
||||
* 飞书消息模板--订阅通知
|
||||
* @param templeteId
|
||||
* @param params
|
||||
*/
|
||||
void sendMessageSubscriptionNotification(String templeteId,Map<String,Object> params);
|
||||
}
|
||||
|
||||
+39
-1
@@ -34,7 +34,12 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -1431,4 +1436,37 @@ public class FeishuServiceImpl implements IFeishuService {
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessageSubscriptionNotification(String templeteId, Map<String, Object> params) {
|
||||
List<String> userIdList = (List<String>) params.get("userIdList");
|
||||
if (CollectionUtils.isNotEmpty(userIdList)) {
|
||||
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
|
||||
|
||||
String contentCn = (String) params.get("contentInfoFeiCn");
|
||||
String contentEn = (String) params.get("contentInfoFeiEn");
|
||||
String back_url = (String) params.get("back_url");
|
||||
try {
|
||||
for (String userId : userIdList) {
|
||||
String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList,userId);
|
||||
if(StringUtils.isNotEmpty(thirdId)){
|
||||
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
|
||||
JSONObject larkMesJson = new JSONObject();
|
||||
larkMesJson.put("template_id", templeteId);
|
||||
larkMesJson.put("userIds",thirdId);
|
||||
Map<String,Object> templateVariableMap = new HashMap<>();
|
||||
templateVariableMap.put("contentInfoFeiCn",contentCn);
|
||||
templateVariableMap.put("contentInfoFeiEn",contentEn);
|
||||
templateVariableMap.put("view_url_cn",back_url);
|
||||
templateVariableMap.put("view_url_en",back_url);
|
||||
|
||||
larkMesJson.put("templateVariableMap",templateVariableMap);
|
||||
batchSendLarkCardMsgByTemplate2(larkMesJson);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user