飞书消息--虚拟清单发布

This commit is contained in:
zhn
2023-04-10 16:59:34 +08:00
parent eb388b3399
commit 9c4b3bd755
@@ -28,8 +28,8 @@ import com.jero.modules.dummy.service.IDummyInventoryBaseEOService;
import com.jero.modules.dummy.service.IDummyInventoryInfoEOService;
import com.jero.modules.dummy.service.IDummyReadEOService;
import com.jero.modules.dummy.vo.VirtualCreaterVo;
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.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService;
import com.jero.modules.system.entity.SysAnnouncement;
@@ -56,6 +56,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -494,8 +495,9 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId());
List<String> thirdIdList = new ArrayList<>();
List<String> userIdList = new ArrayList<>();
if(userNameList.size() != 0){
List<String> userIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getId()).collect(Collectors.toList());
userIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getId()).collect(Collectors.toList());
thirdIdList = sysUserService.queryUserIdListByNameList(userNameList).stream().map(e -> e.getThirdId()).collect(Collectors.toList());
if(userIdList.size() != 0){
//封装消息的实体类
@@ -517,15 +519,39 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
String href = backUrl + "/virtualListDetails?name=" + baseEO.getName() + "&useExplain=" + baseEO.getUseExplain() +"&id=" + baseEO.getId() +"&title=维护虚拟清单";
try {
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);
// 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) {
String contentCn = "";
String contentEn = "";
if(!serialNumberAddList.isEmpty() && serialNumberDeleteList.isEmpty()){
contentCn = "1. 新增文档: " + StringUtils.join(serialNumberAddList,",");
contentEn = "1. New regulations: " + StringUtils.join(serialNumberAddList,",");
}
if(serialNumberAddList.isEmpty() && !serialNumberDeleteList.isEmpty()){
contentCn = "1. 删除文档: " + StringUtils.join(serialNumberDeleteList,",");
contentEn = "1. Remove regulations: " + StringUtils.join(serialNumberDeleteList,",");
}
if(!serialNumberAddList.isEmpty() && !serialNumberDeleteList.isEmpty()){
contentCn = "1. 新增文档: " + StringUtils.join(serialNumberAddList,",") + "\n"
+"2. 删除文档: " + StringUtils.join(serialNumberDeleteList,",");
contentEn = "1. New regulations: " + StringUtils.join(serialNumberAddList,",") + "\n"
+"2. Remove regulations: " + StringUtils.join(serialNumberDeleteList,",");
}
//飞书消息(模板-20230410
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentInfoFeiCn + "\n" + contentCn);
params.put("contentInfoFeiEn",contentLogFeishuTemp + "\n" + contentEn);
params.put("userIdList",userIdList);
params.put("back_url",href);
iFeishuService.sendMessageSubscriptionNotification(TemplateInfoEnum2.SUBSCRIPTION_INFORM.getValue(),params);
} catch (Exception e) {
e.printStackTrace();
}
}