飞书消息-认证参数收集定时任务

This commit is contained in:
zhn
2023-04-14 11:36:26 +08:00
parent d0838a675d
commit 9593973ec5
4 changed files with 129 additions and 53 deletions
@@ -21,7 +21,7 @@ public enum MessageTypeEnum {
//DESIGN_COMPLIANCE_NOTIFICATION("Design Compliance Notification", "12"), // 设计符合性通知
//PRE_HOMO_NOTIFICATION("Pre-Homo Notification", "13"), // Pre-Homo通知
//VALIDATION_COMPLIANCE_NOTIFICATION("Validation Compliance Notification", "14"), // 验证符合性通知
SYSTEMATIC_NOTIFICATION("Systematic Notification","", "15"), // 系统通知
SYSTEMATIC_NOTIFICATION("Systematic Notification","系统通知", "15"), // 系统通知
LIST_CONFIRMATION("List Confirmation", "","17"), // 清单确认
TASK_CONFIRMATION("Task Confirmation", "","18"), // 任务确认
COMPLIANCE_CONFIRMATION("Compliance Confirmation","", "19"), // 符合性确认
@@ -2312,7 +2312,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("initiator",currentUser.getUsername());
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_BACK.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_BACK.getValue(),params,null);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
@@ -2333,7 +2333,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("initiator",currentUser.getUsername());
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_BACK.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_BACK.getValue(),params,null);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
@@ -2421,7 +2421,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("dueDate","");
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_NO_DEADLINE.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_NO_DEADLINE.getValue(),params,null);
return updateBatchById(updateEOList);
}
@@ -2659,7 +2659,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("dueDate",sdf.format(deadline));
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,null);
} catch (Exception e) {
log.error("飞书消息推送失败");
@@ -2836,7 +2836,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("back_url_en",hrefFeishuEn);
// params.put("back_url_cn",(String)hrefFeishuMap.get("hrefFeishu_cn"));
// params.put("back_url_en",(String)hrefFeishuMap.get("hrefFeishu_en"));
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,null);
}
} catch (Exception e) {
log.error("飞书消息推送失败");
@@ -6249,19 +6249,30 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
String now = sdf.format(new Date());// 当前时间
QueryWrapper<ParamsManifestEO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("state", ManifestStateEnum.COLLECTING.getValue());
// queryWrapper.eq("id","391e08fd7ed54740a20924f174aa83a2");//测试使用
List<ParamsManifestEO> manifestEOS = paramsManifestEOService.list(queryWrapper);
for (ParamsManifestEO manifestEO : manifestEOS) {
//项目名称
ParamsManifestVO projectInfo = paramsManifestEOService.getProjectById(manifestEO.getProjectId(), manifestEO.getProjectVersion(), null);
if (ObjectUtils.isNotEmpty(projectInfo)) {
manifestEO.setProjectName(projectInfo.getProjectName());
//url
String urlParamsStr = parseUrlParams(manifestEO,null,null);
String urlParamsStr = parseUrlParams(manifestEO,null,projectInfo.getProjectNameEn());
String hrefFeishu = backUrl + "/ParameterItemCollection" + urlParamsStr;
String urlParamsStrCn = parseUrlParams(manifestEO,CutEnum.CN.getValue(),projectInfo.getProjectNameEn());
String urlParamsStrEn = parseUrlParams(manifestEO,CutEnum.EN.getValue(),projectInfo.getProjectNameEn());
String hrefFeishuCn = backUrl + "/ParameterItemCollection" + urlParamsStrCn;
String hrefFeishuEn = backUrl + "/ParameterItemCollection" + urlParamsStrEn;
//查出对应清单
List<ParamsCollectManifestEO> collectManifestEOS = paramsCollectManifestEOMapper.queryByParamManifestId(manifestEO.getId());
Map<String, List<String>> seven = new HashMap<>();
Map<String, List<String>> three = new HashMap<>();
Map<String, List<String>> today = new HashMap<>();
List<String> userIdList7 = new ArrayList<>();
List<String> userIdList3 = new ArrayList<>();
List<String> userIdList0 = new ArrayList<>();
String dueDate = "";
for (ParamsCollectManifestEO collectManifestEO : collectManifestEOS) {
String thirdId = null;
if (CollectManifestStateEnum.WAIT_SDT.getValue().equals(collectManifestEO.getState())
@@ -6271,6 +6282,9 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
SysUser sdt = sysUserService.getUserByName(collectManifestEO.getSdt());
if (ObjectUtils.isNotEmpty(sdt)) {
thirdId = sdt.getThirdId();
userIdList7.add(sdt.getId());
userIdList3.add(sdt.getId());
userIdList0.add(sdt.getId());
}
}
@@ -6281,16 +6295,21 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
SysUser dre = sysUserService.getUserByName(collectManifestEO.getDre());
if (ObjectUtils.isNotEmpty(dre)) {
thirdId = dre.getThirdId();
userIdList7.add(dre.getId());
userIdList3.add(dre.getId());
userIdList0.add(dre.getId());
}
}
}
//截止时间
if (ObjectUtils.isNotEmpty(thirdId) && ObjectUtils.isNotEmpty(collectManifestEO.getDeadline())) {
String deadline = sdf.format(collectManifestEO.getDeadline());
dueDate = sdf.format(collectManifestEO.getDeadline());
//判断日期
int days = 0;
long days = 0;
try {
days = (int) (sdf.parse(deadline).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000);
// days = (int) (sdf.parse(deadline).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000);
days = (sdf.parse(deadline).getTime() - sdf.parse(now).getTime()) / (24 * 60 * 60 * 1000L);;
} catch (Exception e) {
e.printStackTrace();
throw new JeroBootException("时间获取失败");
@@ -6305,7 +6324,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
}
}
String flag = "warn";
String title = MessageType2Enum.HOMO_PARAMETER_COLLECTION.getCn() + "/" + MessageType2Enum.HOMO_PARAMETER_COLLECTION.getEn();
String cnContentLower = "项目: " + projectInfo.getProjectName() +
"\n发起人: 系统通知";
@@ -6318,16 +6337,33 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<String> stringList = seven.get(key);
String join = StringUtils.join(stringList, ",");
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有7天到期,请及时查看处理");
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 7 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirds, feishuMsgVo);
} catch (IOException e) {
// FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
// feishuMsgVo.setTitle(title);
// feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有7天到期,请及时查看处理");
// feishuMsgVo.setCnContentLower(cnContentLower);
// feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 7 days. Please check and address it in a timely manner");
// feishuMsgVo.setEnContentLower(enContentLower);
// feishuMsgVo.setUrl(hrefFeishu);
// feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
// feishuService.sendCard(thirds, feishuMsgVo);
//
String contentInfoFeiCn = "您参与填写的参数" + join + ",还有7天到期,请及时查看处理。";
String contentInfoFeiEn = "The parameter " + join + " you filled in will expire in 7 days. Please check and address it in a timely manner.";
userIdList7 = userIdList7.stream().distinct().collect(Collectors.toList());
//飞书消息模板-20230410
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentInfoFeiCn);
params.put("contentInfoFeiEn",contentInfoFeiEn);
params.put("userIdList",userIdList7);
params.put("projectCn",projectInfo.getProjectName());
params.put("projectEn",projectInfo.getProjectNameEn());
params.put("initiatorCn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getNameCn());
params.put("initiatorEn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
params.put("dueDate",dueDate);
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,flag);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
}
@@ -6339,16 +6375,34 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<String> stringList = three.get(key);
String join = StringUtils.join(stringList, ",");
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有3天到期,请及时查看处理");
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 3 days. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirds, feishuMsgVo);
} catch (IOException e) {
// FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
// feishuMsgVo.setTitle(title);
// feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",还有3天到期,请及时查看处理");
// feishuMsgVo.setCnContentLower(cnContentLower);
// feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire in 3 days. Please check and address it in a timely manner");
// feishuMsgVo.setEnContentLower(enContentLower);
// feishuMsgVo.setUrl(hrefFeishu);
// feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
// feishuService.sendCard(thirds, feishuMsgVo);
String contentInfoFeiCn = "您参与填写的参数" + join + ",还有3天到期,请及时查看处理。";
String contentInfoFeiEn = "The parameter " + join + " you filled in will expire in 3 days. Please check and address it in a timely manner.";
userIdList3 = userIdList3.stream().distinct().collect(Collectors.toList());
//飞书消息模板-20230410
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentInfoFeiCn);
params.put("contentInfoFeiEn",contentInfoFeiEn);
params.put("userIdList",userIdList3);
params.put("projectCn",projectInfo.getProjectName());
params.put("projectEn",projectInfo.getProjectNameEn());
params.put("initiatorCn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getNameCn());
params.put("initiatorEn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
params.put("dueDate",dueDate);
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,flag);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
}
@@ -6360,16 +6414,34 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<String> stringList = today.get(key);
String join = StringUtils.join(stringList, ",");
try {
FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
feishuMsgVo.setTitle(title);
feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",将于今天到期,请及时查看处理");
feishuMsgVo.setCnContentLower(cnContentLower);
feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire today. Please check and address it in a timely manner");
feishuMsgVo.setEnContentLower(enContentLower);
feishuMsgVo.setUrl(hrefFeishu);
feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
feishuService.sendCard(thirds, feishuMsgVo);
} catch (IOException e) {
// FeishuMsg2Vo feishuMsgVo = new FeishuMsg2Vo();
// feishuMsgVo.setTitle(title);
// feishuMsgVo.setCnContentUpper("您参与填写的参数" + join + ",将于今天到期,请及时查看处理");
// feishuMsgVo.setCnContentLower(cnContentLower);
// feishuMsgVo.setEnContentUpper("The parameter " + join + " you filled in will expire today. Please check and address it in a timely manner");
// feishuMsgVo.setEnContentLower(enContentLower);
// feishuMsgVo.setUrl(hrefFeishu);
// feishuMsgVo.setColor(MsgColorEnum.GREEN.getValue()); // 颜色
// feishuService.sendCard(thirds, feishuMsgVo);
String contentInfoFeiCn = "您参与填写的参数" + join + ",将于今天到期,请及时查看处理。";
String contentInfoFeiEn = "The parameter " + join + " you filled in will expire today. Please check and address it in a timely manner.";
userIdList0 = userIdList0.stream().distinct().collect(Collectors.toList());
//飞书消息模板-20230410
Map<String,Object> params = new HashMap<>();
params.put("contentInfoFeiCn",contentInfoFeiCn);
params.put("contentInfoFeiEn",contentInfoFeiEn);
params.put("userIdList",userIdList0);
params.put("projectCn",projectInfo.getProjectName());
params.put("projectEn",projectInfo.getProjectNameEn());
params.put("initiatorCn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getNameCn());
params.put("initiatorEn",MessageTypeEnum.SYSTEMATIC_NOTIFICATION.getName());
params.put("dueDate",dueDate);
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,flag);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
}
@@ -6732,7 +6804,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("dueDate","");
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_NO_DEADLINE.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_NO_DEADLINE.getValue(),params,null);
return Result.OK("强制撤回成功!");
@@ -6868,7 +6940,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
params.put("dueDate",sdf.format(deadline));
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,null);
} catch (Exception e) {
log.error("飞书消息推送失败");
@@ -6930,7 +7002,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
params.put("dueDate",sdf.format(deadline));
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,null);
} catch (Exception e) {
log.error("飞书消息推送失败");
@@ -6984,7 +7056,7 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
params.put("dueDate",sdf.format(deadline));
params.put("back_url_cn",hrefFeishuCn);
params.put("back_url_en",hrefFeishuEn);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params);
feishuService.sendMessageHomoParameterCollection(TemplateInfoEnum2.HOMO_PARAMETER_COLLECTION_GREEN.getValue(),params,null);
} catch (Exception e) {
log.error("飞书消息推送失败");
}
@@ -6996,10 +7068,10 @@ public class ParamsCollectManifestEOServiceImpl extends ServiceImpl<ParamsCollec
List<String> stringList = today.get(thirdId);
if (ObjectUtils.isEmpty(stringList)) {
stringList = new ArrayList<>();
stringList.add("NIO-" + collectManifestEO.getNioNumber());
stringList.add(collectManifestEO.getNioNumber());
today.put(thirdId, stringList);
} else {
stringList.add("NIO-" + collectManifestEO.getNioNumber());
stringList.add(collectManifestEO.getNioNumber());
}
}
@@ -153,10 +153,10 @@ public interface IFeishuService {
void sendMessageRegulationOpinionCollection(String templeteId,Map<String,Object> params);
/**
* 飞书消息模板--认证参数收集(主题颜色为红色或绿色)
* 飞书消息模板--认证参数收集(主题颜色为绿色)
* @param templeteId
* @param params
*/
void sendMessageHomoParameterCollection(String templeteId,Map<String,Object> params);
void sendMessageHomoParameterCollection(String templeteId,Map<String,Object> params,String flag);
}
@@ -1581,7 +1581,7 @@ public class FeishuServiceImpl implements IFeishuService {
* @param params
*/
@Override
public void sendMessageHomoParameterCollection(String templeteId, Map<String, Object> params) {
public void sendMessageHomoParameterCollection(String templeteId, Map<String, Object> params,String flag) {
List<String> userIdList = (List<String>) params.get("userIdList");
if (CollectionUtils.isNotEmpty(userIdList)) {
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
@@ -1592,8 +1592,8 @@ public class FeishuServiceImpl implements IFeishuService {
String back_url_en = (String) params.get("back_url_en");
String projectCn = (String) params.get("projectCn");
String projectEn = (String) params.get("projectEn");
String initiator = (String) params.get("initiator");
// String initiatorEn = (String) params.get("initiatorEn");
String initiatorCn = (String) params.get("initiatorCn");
String initiatorEn = (String) params.get("initiatorEn");
String dueDate = (String) params.get("dueDate");
try {
for (String userId : userIdList) {
@@ -1610,8 +1610,12 @@ public class FeishuServiceImpl implements IFeishuService {
templateVariableMap.put("view_url_en",back_url_en);
templateVariableMap.put("projectCn"," " + projectCn);
templateVariableMap.put("projectEn"," " + projectEn);
templateVariableMap.put("initiator"," " + initiator);
// templateVariableMap.put("initiatorEn",initiatorEn);
templateVariableMap.put("initiatorCn"," " + initiatorCn);
if(StringUtils.isNotBlank(flag)){
templateVariableMap.put("initiatorEn"," " + initiatorEn);
}else{
templateVariableMap.put("initiatorEn"," " + initiatorCn);
}
templateVariableMap.put("dueDate"," " + dueDate);
larkMesJson.put("templateVariableMap",templateVariableMap);