合并分支 'feature_dev_20221025_message' 到 'dev_2nd_period_test'

Feature dev 20221025 message

查看合并请求 laws-nio/laws-weilai!225
This commit is contained in:
高嵩
2022-10-31 15:48:00 +08:00
9 changed files with 1177 additions and 349 deletions
@@ -4,7 +4,7 @@ public enum MsgColorEnum {
GREEN("其他","green"),
RED("任务被拒绝","red"),
YELLOW("任务","yellow");
YELLOW("任务","yellow");
String label;
String value;
@@ -5265,15 +5265,20 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
// String contentInfo = sysUser.getUsername() + " pushed " + StringUtils.join(hrefList, ",") + " to you. Please be reminded to check it out.";
// String title = StringUtils.join(serialNumberList, ",") + " has been pushed to you, please check";
String contentEnNo = sysUser.getUsername() + " shared " + StringUtils.join(serialNumberList, ",") + " with you, please be reminded to check it out.";
String contentInfoEnYes = sysUser.getUsername() + " shared " + StringUtils.join(hrefList, ",") + " with you, please be reminded to check it out.";
String contentInfoCnNo = sysUser.getUsername() + "向您分享了" + StringUtils.join(serialNumberList, ",") + "请查看.";
String contentInfoCnYes = sysUser.getUsername() + "向您分享了" + StringUtils.join(hrefList, ",") + "请查看.";
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
title,
content,
contentInfo,
contentEnNo,
contentInfoEnYes,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,
null);
contentInfoCnNo,
contentInfoCnYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
@@ -42,6 +42,7 @@ import com.jero.modules.system.service.ISysUserService;
import com.jero.modules.system.service.impl.SysCategoryServiceImpl;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -409,31 +410,83 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
//发消息
int count = 1;
List<String> hrefListAdd = new ArrayList<>();
if(serialNumberAddList.size() != 0){
List<String> hrefList = new ArrayList<>();
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectAdd) {
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
"&title=" + dummyInventoryInfoEO.getTitle() +
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
hrefList.add(href);
hrefListAdd.add(href);
}
contentLog += count+". New regulations: " + StringUtils.join(hrefList,",") + "</br>";
contentLog += count+". New regulations: " + StringUtils.join(hrefListAdd,",") + "</br>";
contentLogFeishu += count+". New regulations: " + StringUtils.join(serialNumberAddList,",") + " ";
count++;
}
List<String> hrefListDelete = new ArrayList<>();
if(serialNumberDeleteList.size() != 0){
List<String> hrefList = new ArrayList<>();
for (DummyInventoryInfoEO dummyInventoryInfoEO : collectDelete) {
String href = "<a href='/docManage/library/detail?id=" + dummyInventoryInfoEO.getBussDocumentLibraryId() +
"&title=" + dummyInventoryInfoEO.getTitle() +
"&serial_number=" + dummyInventoryInfoEO.getSerialNumber() + "'" + " target='_blank'>" + dummyInventoryInfoEO.getSerialNumber() + "</a>";
hrefList.add(href);
hrefListDelete.add(href);
}
contentLog += count + ". Remove regulations: " + StringUtils.join(hrefList,",") + "</br>";
contentLog += count + ". Remove regulations: " + StringUtils.join(hrefListDelete,",") + "</br>";
contentLogFeishu += count + ". Remove regulations: " + StringUtils.join(serialNumberDeleteList,",") + " ";
}
if(serialNumberAddList.size() != 0 || serialNumberDeleteList.size() != 0){
int countNo = 1;
StringBuilder sbContentNo = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentNo.append(countNo+". New regulations: "+StringUtils.join(serialNumberAddList,",")+", ");
countNo ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentNo.append(countNo+". Remove regulations: "+StringUtils.join(serialNumberDeleteList,","));
}
int countYes = 1;
StringBuilder sbContentYes = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentYes.append(countYes+". New regulations: "+StringUtils.join(hrefListAdd,",")+"</br>");
countYes ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentYes.append(countYes+". Remove regulations: "+StringUtils.join(hrefListDelete,","));
}
//消息英文--不带标签
String contentNo = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows" + sbContentNo;
//消息英文--带标签
String contentYes = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated as follows"+ "</br>" + sbContentYes;;
int countInfoNo = 1;
StringBuilder sbContentINfoNo = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentINfoNo.append(countInfoNo+". 新增文档: "+StringUtils.join(serialNumberAddList,",")+", ");
countInfoNo ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentINfoNo.append(countInfoNo+". 删除文档: "+StringUtils.join(serialNumberDeleteList,","));
}
int countInfoYes = 1;
StringBuilder sbContentInfoYes = new StringBuilder();
if(ObjectUtils.isNotEmpty(serialNumberAddList)){
sbContentInfoYes.append(countInfoYes+". 新增文档: "+StringUtils.join(hrefListAdd,",")+"</br>");
countInfoYes ++;
}
if(ObjectUtils.isNotEmpty(serialNumberDeleteList)){
sbContentInfoYes.append(countInfoYes+". 删除文档: "+StringUtils.join(hrefListDelete,","));
}
//消息中文--不带标签
String contentInfoNo = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+sbContentINfoNo;
//消息中文--带标签
String contentInfoYes = "您所订阅的"+baseEO.getName()+"虚拟清单已更新,更新内容如下:"+"</br>"+sbContentInfoYes;
List<String> userNameList = dummyReadEOService.queryReadUserInfo(dummyInventoryBaseEO.getId());
List<String> thirdIdList = new ArrayList<>();
if(userNameList.size() != 0){
@@ -444,12 +497,12 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been updated.";
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
title,
contentLog,
contentNo,
contentYes,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,
null);
contentInfoNo,
contentInfoYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
}
@@ -499,13 +552,16 @@ public class DummyInventoryBaseEOServiceImpl extends ServiceImpl<DummyInventoryB
String title = "The "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
//Please note that the XX virtual list you subscribed to has been withdrawn.
String contentLog = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
String contentCn = "您订阅的虚拟清单"+ baseEO.getName()+"已被撤回.";
String contentInfoEn = "Please note that the "+ baseEO.getName()+" virtual list you subscribed to has been withdrawn.";
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
title,
contentLog,
contentInfoEn,
contentInfoEn,
MessageTypeEnum.READ.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,null);
contentCn,contentCn);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(dummyInventoryBaseEO.getId(), title);
}
@@ -881,8 +881,24 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
String ContentENNo = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out.";
String ContentInfoENYes = currentUser.getUsername()+" shared " + problemKnowledgeBaseTitle + " with you.Please be reminded to check it out."+ " " + href;
String contentCnNo = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看.";
String contentInfoCnYes = currentUser.getUsername()+"向您分享了"+problemKnowledgeBaseTitle+",请查看"+ " " + href;
//封装消息的实体类
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList, msgTitle, msgContentEN, contentInfo,MessageTypeEnum.PUSH.getValue(),MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
SysAnnouncement sysAnnouncement = getSysAnnouncement(userIdList,
msgTitle,
ContentENNo,
ContentInfoENYes,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCnNo,
contentInfoCnYes);
this.sysAnnouncementService.saveAnnouncement(sysAnnouncement);
this.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
@@ -922,7 +938,9 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
String content,
String contentInfo,
String messageType,
String initiator) {
String initiator,
String contentCn,
String contentInfoCn) {
SysAnnouncement sysAnnouncement = new SysAnnouncement();
sysAnnouncement.setInitiator(initiator);
sysAnnouncement.setDelFlag("0");
@@ -934,6 +952,8 @@ public class ProblemKnowledgeBaseEOServiceImpl extends ServiceImpl<ProblemKnowle
sysAnnouncement.setMsgContent(content);
sysAnnouncement.setMsgContentInfo(contentInfo);
sysAnnouncement.setUserIds(StringUtils.join(userIdList, ","));
sysAnnouncement.setMsgContentCn(contentCn);
sysAnnouncement.setMsgContentInfoCn(contentInfoCn);
return sysAnnouncement;
}
}
@@ -1,7 +1,13 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
@@ -15,8 +21,11 @@ import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.project.service.IProjectLawsInventoryEOService;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
@@ -24,6 +33,7 @@ import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@@ -49,16 +59,24 @@ public class InventoryAffirmJob implements Job {
@Autowired
private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper;
@Autowired
private IFeishuService feishuService;
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
/**
* 清单任务到达截止时间后,给用户发送消息
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
log.info("清单确认流程,定时任务开启 =====================================================");
//获取状态为待确认的数据
log.info("清单确认流程,定时任务开启 =====================================================");
/* //获取状态为待确认的数据
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getInventoryAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
@@ -96,125 +114,269 @@ public class InventoryAffirmJob implements Job {
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
List<String> threeDaysUserIdList = new ArrayList<>();
List<String> currentDaysUserIdList = new ArrayList<>();
Map<String, List<String>> threeDaysMap = new HashMap<>();
Map<String, List<String>> currentDaysMap = new HashMap<>();
Map<String, List<String>> overdueMap = new HashMap<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) {
if(StringUtils.equals(projectLibraryBase.getId(),projectLawsInventoryEO.getProjectLibraryId())){
if(projectLawsInventoryEO.getInventoryAffirmDueDate() != null){
//如果清单确认结束日期是当前日期
if(StringUtils.equals(currentDateStr,sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
List<String> currentDaysUserIdList = new ArrayList<>();
if(StringUtils.isEmpty(projectLawsInventoryEO.getSendMsgFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
currentDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
}
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
currentDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
// currentDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
//}
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
// currentDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//}
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
currentDaysUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
projectLawsInventoryEO.setSendMsgFlag(SendMsgFlagEnum.FALSE.getValue());
projectLawsInventoryEOMapper.updateById(projectLawsInventoryEO);
}
if (ObjectUtils.isNotEmpty(currentDaysUserIdList)) {
currentDaysMap.put(projectLawsInventoryEO.getId(), currentDaysUserIdList);
}
}
//如果清单确认结束时间是当前系统时间后三天
if(StringUtils.equals(threeDaysStr,sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
List<String> threeDaysUserIdList = new ArrayList<>();
if(StringUtils.isEmpty(projectLawsInventoryEO.getSendMsgCurrentFlag())){
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
threeDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
}
if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
threeDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())){
// threeDaysUserIdList.add(projectLawsInventoryEO.getRegulationOwnerId());
//}
//if(StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerId()) && StringUtils.isEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())){
// threeDaysUserIdList.add(projectLawsInventoryEO.getHomologationEngineerId());
//}
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
threeDaysUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
projectLawsInventoryEO.setSendMsgCurrentFlag(SendMsgFlagEnum.FALSE.getValue());
projectLawsInventoryEOMapper.updateById(projectLawsInventoryEO);
}
if (ObjectUtils.isNotEmpty(threeDaysUserIdList)) {
threeDaysMap.put(projectLawsInventoryEO.getId(), threeDaysUserIdList);
}
}
//逾期3天、七天、14天
Calendar day3Later=new GregorianCalendar();
day3Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
day3Later.add(Calendar.DATE,3);
Date overdue3Days = day3Later.getTime();
Calendar day7Later=new GregorianCalendar();
day7Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
day7Later.add(Calendar.DATE,7);
Date overdue7Days = day7Later.getTime();
Calendar day14Later=new GregorianCalendar();
day14Later.setTime(projectLawsInventoryEO.getInventoryAffirmDueDate());
day14Later.add(Calendar.DATE,14);
Date overdue14Days = day14Later.getTime();
if(StringUtils.equals(sdf.format(overdue3Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))
||StringUtils.equals(sdf.format(overdue7Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))
||StringUtils.equals(sdf.format(overdue14Days),sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()))){
List<String> overdueUserIdList = new ArrayList<>();
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getHomologationEngineerSubmitStatus())||StringUtils.isNotEmpty(projectLawsInventoryEO.getRegulationOwnerSubmitStatus())) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
overdueUserIdList.add(projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
if (ObjectUtils.isNotEmpty(overdueUserIdList)) {
overdueMap.put(projectLawsInventoryEO.getId(), overdueUserIdList);
}
}
}
}
}
if(CollectionUtils.isNotEmpty(threeDaysUserIdList)){
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务确认剩余处理时间还有3天,请及时查看处理";*/
//项目名称
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectLibraryBase.getProjectVersion();
if(!threeDaysMap.isEmpty()){
for (String key : threeDaysMap.keySet()) {
List<String> threeDaysUserIdList = threeDaysMap.get(key);
threeDaysUserIdList = threeDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(threeDaysUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务将于3天后到期,请及时查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
*//*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务确认剩余处理时间还有3天,请及时查看处理";*//*
// XXX .
String msgContentEN = "The remaining processing time for the regulation task confirmation for "
+ projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()+ " "
+ projectLibraryBase.getTargetMarket()
+ " are 3 days. Please check and address it in a timely manner.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//String msgContentEN = "The remaining processing time for the regulation task confirmation for "
// + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()+ " "
// + projectLibraryBase.getTargetMarket()
// + " are 3 days. Please check and address it in a timely manner.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Regulation Task Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The remaining processing time for the task are 3 days. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation Task Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
// sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, threeDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, threeDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(CollectionUtils.isNotEmpty(currentDaysUserIdList)){
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
if(!currentDaysMap.isEmpty()){
for (String key : currentDaysMap.keySet()) {
List<String> currentDaysUserIdList = currentDaysMap.get(key);
currentDaysUserIdList = currentDaysUserIdList.stream().distinct().collect(Collectors.toList());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(currentDaysUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务今天即将到期,请尽快查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " +projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire today. Please check and address the task ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
/*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*/
String msgContentEN = "The regulation task confirmation for "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ " will expire today. Please check and address it in a timely manner.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation Task Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
*//*String msgContentCN = "您" + projectLibraryBase.getProjectName() + "(项目名称)法规清单的任务今天即将结束,请及时查看处理*//*
//String msgContentEN = "The regulation task confirmation for "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + " will expire today. Please check and address it in a timely manner.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName()+ " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! The task will expire today. Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Regulation Task Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, currentDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
//projectLawsInventoryEOService.sendMessage(msgTitle, msgContentEN, currentDaysUserIdList, projectLibraryBase.getId(), sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
}
if(!overdueMap.isEmpty()){
for (String key : overdueMap.keySet()) {
List<String> overdueUserIdList = overdueMap.get(key);
overdueUserIdList = overdueUserIdList.stream().distinct().collect(Collectors.toList());
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(overdueUserIdList);
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务已逾期,请尽快处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知" +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is overdue. Please address it ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName() +
"\nDue Date: " + dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
}
}
}
}*/
log.info("清单确认流程,定时任务结束 =====================================================");
}
}
@@ -0,0 +1,271 @@
package com.jero.modules.project.job;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.modules.document.entity.BussDocumentLibraryEO;
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
import com.jero.modules.project.entity.ProjectLibraryBase;
import com.jero.modules.project.entity.ProjectNameInfoEO;
import com.jero.modules.project.entity.ProjectYearNameInfoEO;
import com.jero.modules.project.enums.InventoryAffirmStatusEnum;
import com.jero.modules.project.enums.JumpLinkEnum;
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
import com.jero.modules.project.mapper.ProjectNameInfoEOMapper;
import com.jero.modules.project.mapper.ProjectYearNameInfoEOMapper;
import com.jero.modules.system.entity.SysUser;
import com.jero.modules.system.service.ISysUserService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Slf4j
public class TaskAffirmJob implements Job {
@Autowired
private ProjectLawsInventoryEOMapper projectLawsInventoryEOMapper;
@Autowired
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
@Autowired
private ProjectNameInfoEOMapper projectNameInfoEOMapper;
@Autowired
private ProjectYearNameInfoEOMapper projectYearNameInfoEOMapper;
@Autowired
private IFeishuService feishuService;
@Value(value = "${jero.backUrl}")
private String backUrl;
@Autowired
private ISysUserService sysUserService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
/**
* 任务确认流程定时
* @param context
* @throws JobExecutionException
*/
@Override
public void execute(JobExecutionContext context) throws JobExecutionException {
log.info("任务确认流程,定时任务开启 =====================================================");
QueryWrapper<ProjectLawsInventoryEO> queryWrapperInventory = new QueryWrapper<>();
queryWrapperInventory.lambda().eq(ProjectLawsInventoryEO::getTaskAffirmStatus, InventoryAffirmStatusEnum.LIST_TO_CONFIRM.getValue());
List<ProjectLawsInventoryEO> projectLawsInventoryEOList = projectLawsInventoryEOMapper.selectList(queryWrapperInventory);
if (ObjectUtils.isNotEmpty(projectLawsInventoryEOList)) {
List<String> projectLibraryIdList = projectLawsInventoryEOList.stream().distinct()
.map(ProjectLawsInventoryEO::getProjectLibraryId).collect(Collectors.toList());
QueryWrapper<ProjectLibraryBase> queryWrapper = new QueryWrapper<>();
queryWrapper.lambda().in(ProjectLibraryBase::getId,projectLibraryIdList);
List<ProjectLibraryBase> projectLibraryBaseList = projectLibraryBaseMapper.selectList(queryWrapper);
if (ObjectUtils.isNotEmpty(projectLibraryBaseList)) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date currentDate = new Date();
//获取后三天前的时间
Calendar calendar=new GregorianCalendar();
calendar.setTime(new Date());
calendar.add(Calendar.DATE,3);
Date threeDays = calendar.getTime();
String threeDaysStr = sdf.format(threeDays);
String currentDateStr = sdf.format(currentDate);
for (ProjectLibraryBase projectLibraryBase : projectLibraryBaseList) {
QueryWrapper<ProjectNameInfoEO> projectNameInfoEOQueryWrapper = new QueryWrapper<>();
projectNameInfoEOQueryWrapper.lambda().eq(ProjectNameInfoEO::getId, projectLibraryBase.getProjectNameId());
ProjectNameInfoEO projectNameInfoEO = projectNameInfoEOMapper.selectOne(projectNameInfoEOQueryWrapper);
QueryWrapper<ProjectYearNameInfoEO> projectYearInfoEOQueryWrapper = new QueryWrapper<>();
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId, projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
Map<String, String> threeDaysMap = new HashMap<>();
Map<String, String> currentDaysMap = new HashMap<>();
Map<String, String> overdueMap = new HashMap<>();
for (ProjectLawsInventoryEO projectLawsInventoryEO : projectLawsInventoryEOList) {
if (StringUtils.equals(projectLibraryBase.getId(), projectLawsInventoryEO.getProjectLibraryId())) {
if (projectLawsInventoryEO.getTaskAffirmDueDate() != null) {
//结束日期是当前日期
if (StringUtils.equals(currentDateStr, sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()))) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
currentDaysMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
//如果清单确认结束时间是当前系统时间后三天
if (StringUtils.equals(threeDaysStr, sdf.format(projectLawsInventoryEO.getTaskAffirmDueDate()))) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
threeDaysMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
//逾期3天、七天、14天
Calendar day3Later = new GregorianCalendar();
day3Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
day3Later.add(Calendar.DATE, 3);
Date overdue3Days = day3Later.getTime();
Calendar day7Later = new GregorianCalendar();
day7Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
day7Later.add(Calendar.DATE, 7);
Date overdue7Days = day7Later.getTime();
Calendar day14Later = new GregorianCalendar();
day14Later.setTime(projectLawsInventoryEO.getTaskAffirmDueDate());
day14Later.add(Calendar.DATE, 14);
Date overdue14Days = day14Later.getTime();
if (StringUtils.equals(sdf.format(overdue3Days), sdf.format(currentDate))
|| StringUtils.equals(sdf.format(overdue7Days), sdf.format(currentDate))
|| StringUtils.equals(sdf.format(overdue14Days), sdf.format(currentDate))) {
if (StringUtils.isNotEmpty(projectLawsInventoryEO.getEngineeringInterfacePerson())) {
overdueMap.put(projectLawsInventoryEO.getId(), projectLawsInventoryEO.getEngineeringInterfacePerson());
}
}
}
}
}
//飞书跳转链接
String hrefFeishu = backUrl
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink()
+ projectLibraryBase.getId()
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//项目名称
String PRN = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + "-" + projectLibraryBase.getTargetMarket() + "-" + projectLibraryBase.getProjectVersion();
if (!threeDaysMap.isEmpty()) {
for (String key : threeDaysMap.keySet()) {
String[] ids = threeDaysMap.get(key).split(",");
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务将于3天后到期,请及时查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire in 3 days. Please check and address it in a timely manner. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
if (!currentDaysMap.isEmpty()) {
for (String key : currentDaysMap.keySet()) {
String[] ids = currentDaysMap.get(key).split(",");
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务今天即将到期,请尽快查看处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知");
feishuMsgVo.setEnContentUpper("Hello! This task will expire today. Please check and address the task ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
if (!overdueMap.isEmpty()) {
for (String key : overdueMap.keySet()) {
String[] ids = overdueMap.get(key).split(",");
List<String> thirdIdList = new ArrayList<>();
List<SysUser> sysUsers = sysUserService.listByIds(Arrays.asList(ids));
if (ObjectUtils.isNotEmpty(sysUsers)) {
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//法规中英文
ProjectLawsInventoryEO projectLawsInventoryEO = projectLawsInventoryEOMapper.selectById(key);
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务已逾期,请尽快处理,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + PRN +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: 系统通知" +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is overdue. Please address it ASAP. Thank you!");
feishuMsgVo.setEnContentLower("Project:" + PRN +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn() +
"\nInitiator: " + MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName() +
"\nDue Date: " + dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.YELLOW.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
}
}
}
log.info("任务确认流程,定时任务结束 =====================================================");
}
}
@@ -19,7 +19,9 @@ import com.jero.common.api.vo.Result;
import com.jero.common.constant.CommonConstant;
import com.jero.common.constant.WebsocketConst;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.MessageType2Enum;
import com.jero.common.constant.enums.MessageTypeEnum;
import com.jero.common.constant.enums.MsgColorEnum;
import com.jero.common.exception.JeroBootException;
import com.jero.common.system.query.QueryGenerator;
import com.jero.common.system.vo.LoginUser;
@@ -35,6 +37,7 @@ import com.jero.modules.dummy.service.impl.DummyInventoryBaseEOServiceImpl;
import com.jero.modules.dummy.util.DeepCopyListUtil;
import com.jero.modules.dummy.util.ListDiff;
import com.jero.modules.feishu.service.IFeishuService;
import com.jero.modules.feishu.vo.FeishuMsg2Vo;
import com.jero.modules.feishu.vo.FeishuMsgVo;
import com.jero.modules.message.websocket.WebSocket;
import com.jero.modules.oss.entity.OSSFile;
@@ -229,6 +232,12 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
@Autowired
private IProcessInfoDetailEOService processInfoDetailEOService;
@Autowired
private IFeishuService feishuService;
@Autowired
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
/**
* 保存
*
@@ -1395,6 +1404,10 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
QueryWrapper<ProjectYearNameInfoEO> projectYearInfoEOQueryWrapper = new QueryWrapper<>();
projectYearInfoEOQueryWrapper.lambda().eq(ProjectYearNameInfoEO::getId,projectLibraryBase.getYearNameId());
ProjectYearNameInfoEO projectYearNameInfoEO = projectYearNameInfoEOMapper.selectOne(projectYearInfoEOQueryWrapper);
//项目名称
String projectVersion = (com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getParentId()) && com.jero.modules.system.util.StringUtils.isBlank(projectLibraryBase.getProjectVersion())) ? "00" : projectLibraryBase.getProjectVersion();
String projectName = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() + "-" + projectVersion;
//TODO 切换成枚举不要在代码里出现魔数
if(StringUtils.equals(operatorType, OperatorTypeEnum.INVENTORY_AFFIRM.getValue())){
String ids = json.getString("ids");
@@ -1495,21 +1508,25 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
if(CollectionUtils.isNotEmpty(userIdList)){
userIdList = userIdList.stream().distinct().collect(Collectors.toList());
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//消息内容
String msgContentEN = currentUser.getUsername() + " initiated the regulation list confirmation for "
+ projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ". The due date is " + inventoryAffirmDueDate+ ". Please check and address it in a timely manner.";
String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation list confirmation task to complete";
//String msgContentEN = currentUser.getUsername() + " initiated the regulation list confirmation for "
// + projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ". The due date is " + inventoryAffirmDueDate+ ". Please check and address it in a timely manner.";
//String msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation list confirmation task to complete";
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! Please check and address this task in a timely manner.");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(studioUserInfo.getUsername());
feishuMsgVo.setDueDate(inventoryAffirmDueDate);
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! Please check and address this task in a timely manner.");
//feishuMsgVo.setTaskType("Regulation List Confirmation");
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setInitiator(studioUserInfo.getUsername());
//feishuMsgVo.setDueDate(inventoryAffirmDueDate);
//飞书跳转链接
String hrefFeishu = backUrl
@@ -1518,20 +1535,39 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,请及时查看处理此项任务,谢谢!");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + inventoryAffirmDueDate);
feishuMsgVo.setEnContentUpper("Please check and address the task in a timely manner. Thank you!");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: "+ inventoryAffirmDueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,currentUser.getUsername());
//sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,currentUser.getUsername());
//往待办中心添加数据
ProcessInfoEO processInfoEO = new ProcessInfoEO();
@@ -1632,24 +1668,24 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//消息内容
String msgContentEN = "";
String msgTitle = "";
//String msgContentEN = "";
//String msgTitle = "";
if(isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue()) || isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())){
msgContentEN = "The regulation list confirmation" +" of "+projectLawsInventoryEO.getSerialNumber() +" for "
+ projectNameInfoEO.getProjectName() +" is rejected by " +currentUser.getUsername() +". Please check and address it in a timely manner.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() +
": You have a regulation list confirmation task to complete";
//msgContentEN = "The regulation list confirmation" +" of "+projectLawsInventoryEO.getSerialNumber() +" for "
// + projectNameInfoEO.getProjectName() +" is rejected by " +currentUser.getUsername() +". Please check and address it in a timely manner.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() +
// ": You have a regulation list confirmation task to complete";
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! This task is rejected by " +currentUser.getUsername()+ ". Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(studioUserInfo.getUsername());
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! This task is rejected by " +currentUser.getUsername()+ ". Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Regulation List Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setInitiator(studioUserInfo.getUsername());
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//飞书跳转链接
String hrefFeishu = backUrl
@@ -1659,38 +1695,62 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
List<String> userIdList = new ArrayList<>();
userIdList.add(projectLibraryBase.getStudioEngineer());
sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername());
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername());
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务被"+ currentUser.getUsername() +"拒绝,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is rejected by "+ currentUser.getUsername() +". Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: "+ dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.RED.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
if(isProjectRole == Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue()) || isProjectRole == Integer.parseInt(ProjectRoleEnum.REGULATI_AND_HOMOLOGATION_ENGINEER.getValue())){
msgContentEN = "The regulation list confirmation of "+projectLawsInventoryEO.getSerialNumber() + " for "
+ projectNameInfoEO.getProjectName() +" is rejected by " + currentUser.getUsername() +". Please check and address it in a timely manner.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() +
": You have a regulation list confirmation task to complete";
//msgContentEN = "The regulation list confirmation of "+projectLawsInventoryEO.getSerialNumber() + " for "
// + projectNameInfoEO.getProjectName() +" is rejected by " + currentUser.getUsername() +". Please check and address it in a timely manner.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket() +
// ": You have a regulation list confirmation task to complete";
// 飞书消息封装
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
feishuMsgVo.setContent("Hello! This task is rejected by "+currentUser.getUsername()+". Please check and address it in a timely manner.");
feishuMsgVo.setTaskType("Regulation List Confirmation");
feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(studioUserInfo.getUsername());
feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//feishuMsgVo.setContent("Hello! This task is rejected by "+currentUser.getUsername()+". Please check and address it in a timely manner.");
//feishuMsgVo.setTaskType("Regulation List Confirmation");
//feishuMsgVo.setRegulationNo(projectLawsInventoryEO.getSerialNumber());
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setInitiator(studioUserInfo.getUsername());
//feishuMsgVo.setDueDate(sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate()));
//飞书跳转链接
String hrefFeishu = backUrl
@@ -1700,21 +1760,46 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket();
//系统内部跳转链接
String href = "<a href='"
+ JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ "&targetMarket=" + projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String href = "<a href='"
// + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getLink() + projectLibraryId + JumpLinkEnum.INVENTORY_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + "&targetMarket=" + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
List<String> userIdList = new ArrayList<>();
userIdList.add(projectLibraryBase.getStudioEngineer());
sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername());
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
//sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername());
String dueDate = sdf.format(projectLawsInventoryEO.getInventoryAffirmDueDate());
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(MessageType2Enum.REGULATION_LIST_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_LIST_CONFIRMATION.getEn());
feishuMsgVo.setCnContentUpper("您好,该任务被"+ currentUser.getUsername() +"拒绝,请及时查看处理");
feishuMsgVo.setCnContentLower("项目: " + projectName +
"\n法规: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\n发起人: " + currentUser.getUsername() +
"\n截止时间: " + dueDate);
feishuMsgVo.setEnContentUpper("Hello! This task is rejected by "+ currentUser.getUsername() +". Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower("Project: " + projectName +
"\nRegulation No: " + projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle() +
"\nInitiator: " + currentUser.getUsername() +
"\nDue Date: "+ dueDate);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.RED.getValue()); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
@@ -1725,7 +1810,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
this.updateProcessInfoDetail(projectLawsInventoryEO.getId());
//如果法规认证工程师都提交通过法规清单 清单确认状态为接受 并且给当前项目的studio发送消息
if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.ACCEPTED.getValue())){
/*if(StringUtils.equals(inventoryAffirmStatus,InventoryAffirmStatusEnum.ACCEPTED.getValue())){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
//消息内容
String msgContentEN = "The regulation list confirmation of "
@@ -1766,7 +1851,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
List<String> userIdList = new ArrayList<>();
userIdList.add(projectLibraryBase.getStudioEngineer());
sendMessage(msgTitle, msgContentEN,userIdList,projectLibraryId,sendMessageMap, feishuMsgVo, MessageTypeEnum.LIST_CONFIRMATION,studioUserInfo.getUsername());
}
}*/
}
}
}else {
@@ -2345,7 +2430,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
String id = jsonObject.getString("id"); //法规清单id
String currentUserId = jsonObject.getString("currentUserId"); //当前操作用户id
String taskAffirmDueDate = jsonObject.getString("taskAffirmDueDate"); //截止日期
String serialNumber = jsonObject.getString("serialNumber"); //编号
//String serialNumber = jsonObject.getString("serialNumber"); //编号
String projectLibraryId = jsonObject.getString("projectLibraryId"); //项目库id
String engineeringInterfacePerson = jsonObject.getString("engineeringInterfacePerson"); //工程接口人id
@@ -2370,115 +2455,201 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
SysUser sysUser = sysUserMapper.selectOne(new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, currentUserId));
String msgContentEN = "";
//String msgContentEN = "";
String msgTitle = "";
List<String> userIdList = new ArrayList<>();
FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
//FeishuMsgVo feishuMsgVo = new FeishuMsgVo();
MessageTypeEnum messageTypeEnum = null;
String taskType = "";
//MessageTypeEnum messageTypeEnum = null;
//String taskType = "";
String initiator = "";
String initiatorLark = "";
String cnContentUpper = "";//中文上部分
String cnContentLower = "";//中文下部分
String enContentUpper = "";//英文上部分
String enContentLower = "";//英文下部分
String color = "";//颜色
ProjectLibraryBase LibraryBase = projectLibraryBaseService.queryById(projectLibraryId, CutEnum.CN.getValue()).get(0);
String PRN = LibraryBase.getProjectName();//项目名称
String LAW_CN = projectLawsInventoryEO.getSerialNumber() + " " + projectLawsInventoryEO.getTitle();//法规
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(projectLawsInventoryEO.getStandId());
String LAW_EN = projectLawsInventoryEO.getSerialNumber() + " " + bussDocumentLibraryEO.getTitleEn();//法规
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue())) {
userIdList.add(engineeringInterfacePerson);
msgContentEN = sysUser.getUsername() + " initiated the regulation task confirmation of " + projectNameInfoEO.getProjectName()
+ ". The due date is " + taskAffirmDueDate + ". Please check and address it in a timely manner.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//msgContentEN = sysUser.getUsername() + " initiated the regulation task confirmation of " + projectNameInfoEO.getProjectName()
// + ". The due date is " + taskAffirmDueDate + ". Please check and address it in a timely manner.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
feishuMsgVo.setContent("Hello! Please check and address this task in a timely manner.");
//feishuMsgVo.setContent("Hello! Please check and address this task in a timely manner.");
messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
taskType = "Regulation Task Confirmation";
//messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
//taskType = "Regulation Task Confirmation";
initiator = studioUserInfo.getUsername();
initiatorLark = studioUserInfo.getUsername();
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + initiatorLark +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + initiatorLark +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
color = MsgColorEnum.GREEN.getValue();
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue())) {
String dreUserId = jsonObject.getString("dreUserId"); //dre用户id
userIdList.add(dreUserId);
msgContentEN = sysUser.getUsername() + " has assigned the regulation task confirmation of " + serialNumber + " in "+ projectNameInfoEO.getProjectName()
+ " to you. The due date is " +taskAffirmDueDate+ ". Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//msgContentEN = sysUser.getUsername() + " has assigned the regulation task confirmation of " + serialNumber + " in "+ projectNameInfoEO.getProjectName()
// + " to you. The due date is " +taskAffirmDueDate+ ". Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has assigned the task. Please check and and handle it in time.");
//feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has assigned the task. Please check and and handle it in time.");
messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
taskType = "Regulation Task Confirmation";
//messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
//taskType = "Regulation Task Confirmation";
initiator = studioUserInfo.getUsername();
initiatorLark = studioUserInfo.getUsername();
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ sysUser.getUsername() +"向您询问意见,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! "+ sysUser.getUsername() +" asked you for opinion. Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
color = MsgColorEnum.GREEN.getValue();
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue())) {
userIdList.add(engineeringInterfacePerson);
msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". The due date is " +taskAffirmDueDate+ ". Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". The due date is " +taskAffirmDueDate+ ". Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has rejected the task. Please check and and handle it in time.");
//feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has rejected the task. Please check and and handle it in time.");
messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
taskType = "Regulation Task Confirmation";
//messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
//taskType = "Regulation Task Confirmation";
initiator = studioUserInfo.getUsername();
initiatorLark = studioUserInfo.getUsername();
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
cnContentUpper = "您好,该任务被"+ sysUser.getUsername() +"退回,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! This task is rejected by "+ sysUser.getUsername() +". Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
color = MsgColorEnum.GREEN.getValue();
} else if (StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_DRE_ACCEPTED.getValue())) {
userIdList.add(engineeringInterfacePerson);
msgContentEN = sysUser.getUsername() + " has submitted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". The due date is " +taskAffirmDueDate+ ". Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//msgContentEN = sysUser.getUsername() + " has submitted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". The due date is " +taskAffirmDueDate+ ". Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has submitted the task. Please check and and handle it in time.");
//feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has submitted the task. Please check and and handle it in time.");
messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
taskType = "Regulation Task Confirmation";
//messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
//taskType = "Regulation Task Confirmation";
initiator = studioUserInfo.getUsername();
initiatorLark = studioUserInfo.getUsername();
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
cnContentUpper = "您好,"+ sysUser.getUsername() +"已向您提交回复,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! "+ sysUser.getUsername() +" has replied to you. Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
color = MsgColorEnum.GREEN.getValue();
} else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_REJECTED_MSG.getValue())){
userIdList.add(projectLibraryBase.getStudioEngineer());
msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation to complete";
//msgContentEN = sysUser.getUsername() + " has rejected the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation to complete";
feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has rejected the task. Please check and and handle it in time.");
//feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has rejected the task. Please check and and handle it in time.");
messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
taskType = "Regulation Task Confirmation";
//messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
//taskType = "Regulation Task Confirmation";
initiator = studioUserInfo.getUsername();
initiatorLark = studioUserInfo.getUsername();
} else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ACCEPTED_MSG.getValue())){
msgTitle = MessageType2Enum.REGULATION_TASK_CONFIRMATION.getCn() + "/" + MessageType2Enum.REGULATION_TASK_CONFIRMATION.getEn();
cnContentUpper = "您好,该任务被"+ sysUser.getUsername() +"拒绝,请及时查看处理";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + sysUser.getUsername() +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! This task is rejected by "+ sysUser.getUsername() +". Please check and address it in a timely manner";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + sysUser.getUsername() +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
color = MsgColorEnum.RED.getValue();
} /*else if(StringUtils.equals(msgType, MsgTypeEnum.TASK_AFFIRM_ACCEPTED_MSG.getValue())){
userIdList.add(projectLibraryBase.getStudioEngineer());
msgContentEN = sysUser.getUsername() + " has accepted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". Please check and handle it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a regulation task confirmation notification to check";
//msgContentEN = sysUser.getUsername() + " has accepted the regulation task confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". Please check and handle it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a regulation task confirmation notification to check";
feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has accepted the task. Please check and and handle it in time.");
//feishuMsgVo.setContent("Hello! " + sysUser.getUsername() + " has accepted the task. Please check and and handle it in time.");
messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
taskType = "Regulation Task Confirmation";
//messageTypeEnum = MessageTypeEnum.TASK_CONFIRMATION;
//taskType = "Regulation Task Confirmation";
initiator = studioUserInfo.getUsername();
initiatorLark = studioUserInfo.getUsername();
} else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_START_MSG.getValue())){
} */else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_START_MSG.getValue())){
String designDutyId = jsonObject.getString("designDutyId"); //设计符合性责任人id
userIdList.add(designDutyId);
msgContentEN = "You recieved the design compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". The due date is " + sdf.format(projectLawsInventoryEO.getDesignDueDate()) + ". Please check and address it in a timely manner.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = "You recieved the design compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". The due date is " + sdf.format(projectLawsInventoryEO.getDesignDueDate()) + ". Please check and address it in a timely manner.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setContent("Hello! Please address the task in a timely manner.");
//feishuMsgVo.setContent("Hello! Please address the task in a timely manner.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Design Compliance Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Design Compliance Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
@@ -2488,15 +2659,15 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} else if(StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_START_MSG.getValue())){
String prehomoDutyId = jsonObject.getString("prehomoDutyId"); //pre-Home责任人id
userIdList.add(prehomoDutyId);
msgContentEN = "You recieved the Pre-Homo task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". The due date is " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()) + ". Please check and address it in a timely manner.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = "You recieved the Pre-Homo task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". The due date is " + sdf.format(projectLawsInventoryEO.getPrehomoDueDate()) + ". Please check and address it in a timely manner.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setContent("Hello! Please address the task in a timely manner.");
//feishuMsgVo.setContent("Hello! Please address the task in a timely manner.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Pre-Homo Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Pre-Homo Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
@@ -2507,36 +2678,50 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} else if(StringUtils.equals(msgType, MsgTypeEnum.VERIFY_START_MSG.getValue())){
String verifyDutyId = jsonObject.getString("verifyDutyId"); //验证符合性责任人id
userIdList.add(verifyDutyId);
msgContentEN = "You recieved the validation compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". The due date is " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()) + ". Please check and address it in a timely manner.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = "You recieved the validation compliance task of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". The due date is " + sdf.format(projectLawsInventoryEO.getVerifyDueDate()) + ". Please check and address it in a timely manner.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setContent("Hello! Please address the task in a timely manner.");
//feishuMsgVo.setContent("Hello! Please address the task in a timely manner.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Validation Compliance Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Validation Compliance Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, projectLawsInventoryEO.getVerifyInitiatorId())
);
initiatorLark = initiatorLarkInfo.getUsername();
msgTitle = MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getCn() + "/" + MessageType2Enum.VALIDATION_COMPLIANCE_CONFIRMATION.getEn();
cnContentUpper = "您好,请及时查看处理此项任务,谢谢!";
cnContentLower = "项目: " + PRN +
"\n法规: " + LAW_CN +
"\n发起人: " + initiatorLark +
"\n截止时间: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
enContentUpper = "Hello! Please check and address the task in a timely manner. Thank you!";
enContentLower = "Project: " + PRN +
"\nRegulation No: " + LAW_EN +
"\nInitiator: " + initiatorLark +
"\nDue Date: " + sdf.format(projectLawsInventoryEO.getVerifyDueDate());
color = MsgColorEnum.GREEN.getValue();
} else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_CHARGE_PERSON_SUBMIT_MSG.getValue())){
String designInitiatorId = jsonObject.getString("designInitiatorId"); //设计符合性发起人id
userIdList.add(designInitiatorId);
msgContentEN = sysUser.getUsername() + " has submitted the design compliance confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". Please check and review it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = sysUser.getUsername() + " has submitted the design compliance confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". Please check and review it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner.");
//feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Design Compliance Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Design Compliance Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
feishuMsgVo.setAssignee(sysUser.getUsername());
//feishuMsgVo.setAssignee(sysUser.getUsername());
// SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
// new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, projectLawsInventoryEO.getDesignInitiatorId())
// );
@@ -2544,18 +2729,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} else if(StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_CHARGE_PERSON_SUBMIT_MSG.getValue())){
String prehomoInitiatorId = jsonObject.getString("prehomoInitiatorId"); //pre-Home发起人id
userIdList.add(prehomoInitiatorId);
msgContentEN = sysUser.getUsername() + " has submitted the Pre-Homo confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". Please check and review it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = sysUser.getUsername() + " has submitted the Pre-Homo confirmation of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". Please check and review it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner.");
//feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Pre-Homo Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Pre-Homo Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
feishuMsgVo.setAssignee(sysUser.getUsername());
//feishuMsgVo.setAssignee(sysUser.getUsername());
// SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
// new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, projectLawsInventoryEO.getPrehomoInitiatorId())
// );
@@ -2563,18 +2748,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} else if(StringUtils.equals(msgType, MsgTypeEnum.VERIFY_CHARGE_PERSON_SUBMIT_MSG.getValue())){
String verifyInitiatorId = jsonObject.getString("verifyInitiatorId"); //验证符合性发起人id
userIdList.add(verifyInitiatorId);
msgContentEN = sysUser.getUsername() + " has submitted the validation compliance confirmation " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ ". Please check and review it in time.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = sysUser.getUsername() + " has submitted the validation compliance confirmation " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + ". Please check and review it in time.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner.");
//feishuMsgVo.setContent("Hello! The compliance confirmation has been submitted. Please check and review it in a timely manner.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Validation Compliance Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Validation Compliance Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
feishuMsgVo.setAssignee(sysUser.getUsername());
//feishuMsgVo.setAssignee(sysUser.getUsername());
// SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
// new QueryWrapper<SysUser>().lambda().eq(SysUser::getId, projectLawsInventoryEO.getVerifyInitiatorId())
// );
@@ -2582,15 +2767,15 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
}else if(StringUtils.equals(msgType, MsgTypeEnum.DESIGN_INITIATOR_ACCEPTED_MSG.getValue())){
String designDutyId = jsonObject.getString("designDutyId"); //设计符合性责任人id
userIdList.add(designDutyId);
msgContentEN = "The design compliance information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ " you submitted has been approved.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a design compliance task to complete";
//msgContentEN = "The design compliance information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + " you submitted has been approved.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a design compliance task to complete";
feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved.");
//feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Design Compliance Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Design Compliance Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
@@ -2600,15 +2785,15 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} else if(StringUtils.equals(msgType, MsgTypeEnum.PREHOMO_INITIATOR_ACCEPTED_MSG.getValue())){
String prehomoDutyId = jsonObject.getString("prehomoDutyId"); //pre-Home责任人id
userIdList.add(prehomoDutyId);
msgContentEN = "The Pre-Homo confirmation information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ " you submitted has been approved.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a Pre-Homo task to complete";
//msgContentEN = "The Pre-Homo confirmation information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + " you submitted has been approved.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a Pre-Homo task to complete";
feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved.");
//feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Pre-Homo Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Pre-Homo Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
@@ -2618,15 +2803,15 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
} else if(StringUtils.equals(msgType, MsgTypeEnum.VERIFY_INITIATOR_ACCEPTED_MSG.getValue())){
String verifyDutyId = jsonObject.getString("verifyDutyId"); //验证符合性责任人id
userIdList.add(verifyDutyId);
msgContentEN = "The validation compliance information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
+ " you submitted has been approved.";
msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
+ ": You have a validation compliance task to complete";
//msgContentEN = "The validation compliance information of " + serialNumber +" in "+ projectNameInfoEO.getProjectName()
// + " you submitted has been approved.";
//msgTitle = projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket()
// + ": You have a validation compliance task to complete";
feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved.");
//feishuMsgVo.setContent("Hello! The compliance information you submitted has been approved.");
messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
taskType = "Validation Compliance Confirmation";
//messageTypeEnum = MessageTypeEnum.COMPLIANCE_CONFIRMATION;
//taskType = "Validation Compliance Confirmation";
initiator = MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName();
SysUser initiatorLarkInfo = this.sysUserMapper.selectOne(
@@ -2635,18 +2820,18 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
initiatorLark = initiatorLarkInfo.getUsername();
}
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgContentEN)){
if(CollectionUtils.isNotEmpty(userIdList) && StringUtils.isNotEmpty(msgTitle)){
feishuMsgVo.setTaskType(taskType);
feishuMsgVo.setRegulationNo(serialNumber);
feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
feishuMsgVo.setInitiator(initiatorLark);
feishuMsgVo.setDueDate(taskAffirmDueDate);
//feishuMsgVo.setTaskType(taskType);
//feishuMsgVo.setRegulationNo(serialNumber);
//feishuMsgVo.setProject(projectNameInfoEO.getProjectName() + "-" + projectYearNameInfoEO.getYearName() + " " + projectLibraryBase.getTargetMarket());
//feishuMsgVo.setInitiator(initiatorLark);
//feishuMsgVo.setDueDate(taskAffirmDueDate);
//飞书跳转链接
String hrefFeishu = "";
//系统内部跳转链接
String href = "";
//String href = "";
if(StringUtils.equals(msgType,MsgTypeEnum.TASK_AFFIRM_START_MSG.getValue())
||StringUtils.equals(msgType,MsgTypeEnum.TASK_AFFIRM_ISSUE_DRE_MSG.getValue())
||StringUtils.equals(msgType,MsgTypeEnum.TASK_AFFIRM_DRE_REJECTED.getValue())
@@ -2656,7 +2841,7 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
{
hrefFeishu = backUrl
+ JumpLinkEnum.TASK_AFFIRM_LINK.getLink();
href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
//href = "<a href='" + JumpLinkEnum.TASK_AFFIRM_LINK.getLink() + "'>" + " View details" + "</a>";
}else if(StringUtils.equals(msgType,MsgTypeEnum.DESIGN_START_MSG.getValue())
||StringUtils.equals(msgType,MsgTypeEnum.PREHOMO_START_MSG.getValue())
||StringUtils.equals(msgType,MsgTypeEnum.VERIFY_START_MSG.getValue())
@@ -2674,21 +2859,40 @@ public class ProjectLawsInventoryEOServiceImpl extends ServiceImpl<ProjectLawsIn
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ projectLibraryBase.getTargetMarket();
href = "<a href='"
+ JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
+ "&projectName=" + projectNameInfoEO.getProjectName() + "-"
+ projectYearNameInfoEO.getYearName()
+ projectLibraryBase.getTargetMarket()
+ "'>" + " View details" + "</a>";
//href = "<a href='"
// + JumpLinkEnum.DESIGN_AFFIRM_LINK.getLink() + projectLibraryBase.getId() + JumpLinkEnum.DESIGN_AFFIRM_LINK.getType()
// + "&projectName=" + projectNameInfoEO.getProjectName() + "-"
// + projectYearNameInfoEO.getYearName()
// + projectLibraryBase.getTargetMarket()
// + "'>" + " View details" + "</a>";
}
String contentInfo = msgContentEN + " " + href;
Map<String,Object> sendMessageMap = new HashMap<>();
sendMessageMap.put("hrefFeishu",hrefFeishu);
sendMessageMap.put("contentInfo",contentInfo);
//String contentInfo = msgContentEN + " " + href;
//Map<String,Object> sendMessageMap = new HashMap<>();
//sendMessageMap.put("hrefFeishu",hrefFeishu);
//sendMessageMap.put("contentInfo",contentInfo);
//发送消息
sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,initiator);
//sendMessage(msgTitle, msgContentEN,userIdList,id,sendMessageMap, feishuMsgVo, messageTypeEnum,initiator);
List<SysUser> sysUsers = sysUserService.listByIds(userIdList);
List<String> thirdIdList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(sysUsers)){
thirdIdList = sysUsers.stream().map(SysUser::getThirdId).collect(Collectors.toList());
}
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(msgTitle);
feishuMsgVo.setCnContentUpper(cnContentUpper);
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper(enContentUpper);
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(color); // 颜色
feishuService.sendCard(thirdIdList.toArray(new String[thirdIdList.size()]), feishuMsgVo);
} catch (IOException e) {
log.error("飞书消息推送失败");
}
}
}
@@ -373,7 +373,7 @@ public class LawsWarnService {
thirdIdList.addAll(thirdId);
}
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
//查询文档
List<Map<String, Object>> mapList = bussDocumentLibraryEOMapper.selectMapsAll(documentIds);
List<String> serialNumberList = new ArrayList<>();
@@ -409,27 +409,52 @@ public class LawsWarnService {
"&serial_number=" + map.get("serial_number") + "'" + " target='_blank'>" + map.get("serial_number") + "</a>";
urlList.add(url);
hrefList.add(href+timeContent);
//推送多条时, 每条单独发消息
//编号, 标题, 新车型实施日期, 在产车实施日期
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String serialNumber = StringUtils.valueOf(map.get("serial_number"));
String titleCn = StringUtils.valueOf(map.get("title"));
String titleEn = StringUtils.valueOf(map.get("title_en"));
String newType = "";
if(ObjectUtils.isNotEmpty(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"))){
newType = sdf.format(map.get("xin1_che1_xing2_shi2_shi1_ri4_qi1"));
}
String newVehicle = "";
if(ObjectUtils.isNotEmpty(map.get("implement_time"))){
newVehicle = sdf.format(map.get("implement_time"));
}
//消息-英文
String contentNo = sysUser.getUsername() +" shared Regulation Early Warning infomation with you, "
+"Regulation No: "+serialNumber+",Title: "+titleEn+",New Type Execution Date: "+newType+",New Vehicle Execution Date: "+newVehicle;
String contentInfoYes = sysUser.getUsername() +" shared Regulation Early Warning infomation with you, "+"</br>"
+"Regulation No: "+href+"</br>"
+"Title: "+titleEn+"</br>"
+"New Type Execution Date: "+newType+"</br>"
+"New Vehicle Execution Date: "+newVehicle;
//消息中文
String contentCnNo = sysUser.getUsername() +"向您分享了法规预警信息, "+"编号: "+serialNumber+",标题: "+titleCn+",新车型实施日期: "+newType+",在产车实施日期: "+newVehicle;
String contentInfoCnYes = sysUser.getUsername() +"向您分享了法规预警信息,"+"</br>"
+"编号: "+href+"</br>"
+"标题: "+titleCn+"</br>"
+"新车型实施日期: "+newType+"</br>"
+"在产车实施日期: "+newVehicle;
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
null,
contentNo,
contentInfoYes,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
contentCnNo,contentInfoCnYes);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfoCnYes);
}
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String content = StringUtils.join(serialNumberList, ",") + " has been shared with you, please check.";
//消息详情模板
// XXX has pushed GB 7258 to you as the implementation date of vehicle production is XXXX-XX-XX
// GB 7258 to you as the implementation date of vehicle production is XXXX-XX-XX Please be reminded to check it out.
String contentInfo = sysUser.getUsername() + " has pushed " + StringUtils.join(hrefList, ",") + ", Please be reminded to check it out.";
String title = content;
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
content,
contentInfo,
MessageTypeEnum.PUSH.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,null);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(thirdIdList, ","), contentInfo);
//飞书
try {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -473,7 +498,7 @@ public class LawsWarnService {
} catch (IOException e) {
e.printStackTrace();
}
bussDocumentLibraryEOService.sendWebsocket(documentIds, contentInfo);
bussDocumentLibraryEOService.sendWebsocket(documentIds, documentIds);
return "推送成功";
}
@@ -124,27 +124,33 @@ public class TimedTaskWarn implements Job {
//当前时间的前12个月
String beforeTimeSixTen = beforeTime(12,xin1Che1Xing2Shi2Shi1Ri4Qi1);
if(currentTime.equals(beforeTimeSix) || currentTime.equals(beforeTimeSixTen) || currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
//发送站内消息和飞书消息
String format = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
String content = "The implementation date of the " + category +" "+ serialNumber
+ " new model you subscribed to is "+format+",please pay attention to check";
String contentInfo = "The implementation date of the " + category +" "+ href
+ " new model you subscribed to is "+format+",please pay attention to check";
String msgTitle = content;
sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
}
// if(currentTime.equals(beforeTimeSix) || currentTime.equals(beforeTimeSixTen) || currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
// //发送站内消息和飞书消息
// String format = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
// String content = "The implementation date of the " + category +" "+ serialNumber
// + " new model you subscribed to is "+format+",please pay attention to check";
// String contentInfo = "The implementation date of the " + category +" "+ href
// + " new model you subscribed to is "+format+",please pay attention to check";
// String msgTitle = content;
// sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
// }
if(currentTime.equals(beforeTimeSixTen)){
//发送飞书消息(提前一年)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href);
}
if(currentTime.equals(beforeTimeSix)){
//发送飞书消息(提前6个月)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href);
}
if(currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str)){
//发送飞书消息(当天)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href);
}
}
@@ -165,19 +171,25 @@ public class TimedTaskWarn implements Job {
String contentInfo = "The implementation date of the " + category +" "+ href
+ " production vehicle you subscribed to is "+format+",please pay attention to check";
String msgTitle = content;
sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
// sendMessage(msgTitle, content,contentInfo,content, url, userIdList, thirdIdList);
}
if(currentTime.equals(beforeTimeSixTen)){
//发送飞书消息(提前一年)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"1");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"1",sdf,href);
}
if(currentTime.equals(beforeTimeSix)){
//发送飞书消息(提前6个月)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"6");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"6",sdf,href);
}
if(currentTime.equals(implementTimeStr)){
//发送飞书消息(当天)
sendFeishu(sdf, bussDocumentLibraryEO, url, thirdIdList,"0");
//站内消息
sendMessage(bussDocumentLibraryEO, userIdList,"0",sdf,href);
}
}
}
@@ -224,25 +236,98 @@ public class TimedTaskWarn implements Job {
}
}
private void sendMessage(String title, String content,String contentInfo,String contentFeiShu, String url, List<String> userIdList, List<String> thirdIdList) {
//站内消息
// private void sendMessage(String title, String content,String contentInfo,String contentFeiShu, String url, List<String> userIdList, List<String> thirdIdList) {
// //站内消息
// //封装消息的实体类
// SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
// title,
// content,
// contentInfo,
// MessageTypeEnum.WARN.getValue(),
// MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
// null,null);
// sysAnnouncementService.saveAnnouncement(sysAnnouncement);
// bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), content);
//
//// //飞书消息
//// try {
//// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentFeiShu, MessageTypeEnum.WARN.getName(), url);
//// } catch (IOException e) {
//// e.printStackTrace();
//// }
// }
private void sendMessage(BussDocumentLibraryEO bussDocumentLibraryEO,
List<String> userIdList,
String flag,
SimpleDateFormat sdf,
String href) {
String number = bussDocumentLibraryEO.getSerialNumber();
String title = bussDocumentLibraryEO.getTitle();
String titleEn = bussDocumentLibraryEO.getTitleEn();
Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1();
Date implementTime = bussDocumentLibraryEO.getImplementTime();
String newType = "";
String newVehicle = "";
if(ObjectUtils.isNotEmpty(xin1Che1Xing2Shi2Shi1Ri4Qi1)){
newType = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
}
if(ObjectUtils.isNotEmpty(implementTime)){
newVehicle = sdf.format(implementTime);
}
String contentCn = "";
String contentInfoCn = "";
String contentEn = "";
String contentInfoEn = "";
//"</br>"
contentCn = ",编号: "+number
+",标题: "+title
+",新车型实施日期: "+newType
+",在产车实施日期: "+newVehicle;
contentInfoCn = "编号: "+href+"</br>"
+"标题: "+title+"</br>"
+"新车型实施日期: "+newType+"</br>"
+"在产车实施日期: "+newVehicle;
contentEn = ",Regulation No: "+number
+",Title: "+titleEn
+",New Type Execution Date: "+newType
+",New Vehicle Execution Date: "+newVehicle;
contentInfoEn = "Regulation No: "+href+"</br>"
+"Title: "+titleEn+"</br>"
+"New Type Execution Date: "+newType+"</br>"
+"New Vehicle Execution Date: "+newVehicle;
if("1".equals(flag)){
contentCn = "您所订阅的法规将于1年后实施"+contentCn;
contentInfoCn = "您所订阅的法规将于1年后实施"+"</br>"+contentInfoCn;
contentEn = "The regulation you subscribed to will be implemented in one year"+contentEn;
contentInfoEn = "The regulation you subscribed to will be implemented in one year"+"</br>"+contentInfoEn;
}
if("6".equals(flag)){
contentCn = "您所订阅的法规将于6个月后实施"+contentCn;
contentInfoCn = "您所订阅的法规将于6个月后实施"+"</br>"+contentInfoCn;
contentEn = "The regulation you subscribed to will be implemented in six months"+contentEn;
contentInfoEn = "The regulation you subscribed to will be implemented in six months"+"</br>"+contentInfoEn;
}
if("0".equals(flag)){
contentCn = "您所订阅的法规已实施"+contentCn;
contentInfoCn = "您所订阅的法规已实施"+"</br>"+contentInfoCn;
contentEn = "The regulation you subscribed to is implemented"+contentEn;
contentInfoEn = "The regulation you subscribed to is implemented"+"</br>"+contentInfoEn;
}
//封装消息的实体类
SysAnnouncement sysAnnouncement = bussDocumentLibraryEOService.getSysAnnouncement(userIdList,
title,
content,
contentInfo,
contentEn,
contentInfoEn,
MessageTypeEnum.WARN.getValue(),
MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName(),
null,null);
contentCn,contentInfoCn);
sysAnnouncementService.saveAnnouncement(sysAnnouncement);
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), content);
// //飞书消息
// try {
// iFeishuService.batchSendMessage(thirdIdList.toArray(new String[]{}), contentFeiShu, MessageTypeEnum.WARN.getName(), url);
// } catch (IOException e) {
// e.printStackTrace();
// }
bussDocumentLibraryEOService.sendWebsocket(StringUtils.join(userIdList, ","), contentInfoEn);
}
private String beforeTime (int month,Date date){