认证清单流程操作-发送飞书消息。
This commit is contained in:
+13
@@ -16,6 +16,19 @@ public enum TemplateInfoEnum2 {
|
||||
CERTIFICATION_MESSAGE8("认证清单-任务提醒,已逾期","ctp_AAuDMwOPU71H"),
|
||||
//CERTIFICATION_MESSAGE9("认证清单-责任人分发(转办),第二责任人收到消息","ctp_AAuDM8YP6soc"),
|
||||
CERTIFICATION_MESSAGE10("认证工程师发起流程,责任人收到消息","ctp_AAuePL6rUK1L"),
|
||||
CERTIFICATION_MESSAGE11("责任人拒绝,认证工程师收到消息","ctp_AAu2ZrSEiB1V"),
|
||||
CERTIFICATION_MESSAGE12("责任人接受,认证工程师收到消息","ctp_AAuePL6r3B0I"),
|
||||
CERTIFICATION_MESSAGE13("studio修改认证工程师,被修改人收到消息",""),
|
||||
CERTIFICATION_MESSAGE14("studio修改符合性截止时间,认证工程师收到消息","ctp_AAuePL6r3XqN"),
|
||||
CERTIFICATION_MESSAGE15("认证工程师修改责任人,被修改人收到消息","ctp_AAu2ZrSE1z3f"),
|
||||
CERTIFICATION_MESSAGE16("认证工程师催办,责任人收到消息","ctp_AAuPfn0M0H6i"),
|
||||
CERTIFICATION_MESSAGE17("责任人下发工程师,工程师接收-任务","ctp_AAuPfn0MCwlH"),
|
||||
CERTIFICATION_MESSAGE18("任务提醒,责任人接收-任务 发起人催办责任人","ctp_AAuPh3LJ2Nex"),
|
||||
CERTIFICATION_MESSAGE19("任务提醒,责任人接收-任务 两周通知","ctp_AAuPh3LJKUZk"),
|
||||
CERTIFICATION_MESSAGE20("任务提醒,责任人接收-任务 一周通知","ctp_AAuXnIIM45B0"),
|
||||
CERTIFICATION_MESSAGE21("任务提醒,责任人接收-任务 当天","ctp_AAu2lBIgnWND"),
|
||||
CERTIFICATION_MESSAGE22("任务提醒,责任人接收-任务 逾期之后 每天通知","ctp_AAuPfn0MDOYu"),
|
||||
CERTIFICATION_MESSAGE23("责任人提交,发起人接收审查任务-任务","ctp_AAuPh3LJKoIX"),
|
||||
;
|
||||
|
||||
String name;
|
||||
|
||||
+81
-10
@@ -173,7 +173,7 @@ public class CertificationInventoryJob implements Job {
|
||||
}
|
||||
|
||||
Map<String, Object> sendMsgDataListMap = this.disposeSendMsgDataList(dutyPersonDataList);
|
||||
// 三天后结束的
|
||||
/*// 三天后结束的
|
||||
List<ProjectCertificationInventoryEO> threeDaysList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("threeDaysList");
|
||||
if(CollectionUtils.isNotEmpty(threeDaysList)){
|
||||
this.sendLarkCardMsgByTemplate(
|
||||
@@ -183,7 +183,32 @@ public class CertificationInventoryJob implements Job {
|
||||
threeDaysList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE6.getValue()
|
||||
);
|
||||
}*/
|
||||
|
||||
// 十四天后结束的
|
||||
List<ProjectCertificationInventoryEO> fourteenDaysList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("fourteenDaysList");
|
||||
if(CollectionUtils.isNotEmpty(fourteenDaysList)){
|
||||
this.sendLarkCardMsgByTemplate(
|
||||
projectLibraryBase,
|
||||
dutyPersonList,
|
||||
dutyPersonUserId,
|
||||
fourteenDaysList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE19.getValue()
|
||||
);
|
||||
}
|
||||
|
||||
// 七天后结束的
|
||||
List<ProjectCertificationInventoryEO> sevenDaysList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("sevenDaysList");
|
||||
if(CollectionUtils.isNotEmpty(sevenDaysList)){
|
||||
this.sendLarkCardMsgByTemplate(
|
||||
projectLibraryBase,
|
||||
dutyPersonList,
|
||||
dutyPersonUserId,
|
||||
sevenDaysList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE20.getValue()
|
||||
);
|
||||
}
|
||||
|
||||
// 当天结束的
|
||||
List<ProjectCertificationInventoryEO> currentDaysList = (List<ProjectCertificationInventoryEO>) sendMsgDataListMap.get("currentDaysList");
|
||||
if(CollectionUtils.isNotEmpty(currentDaysList)){
|
||||
@@ -192,7 +217,7 @@ public class CertificationInventoryJob implements Job {
|
||||
dutyPersonList,
|
||||
dutyPersonUserId,
|
||||
currentDaysList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE7.getValue()
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE21.getValue()
|
||||
);
|
||||
}
|
||||
// 逾期的
|
||||
@@ -203,7 +228,7 @@ public class CertificationInventoryJob implements Job {
|
||||
dutyPersonList,
|
||||
dutyPersonUserId,
|
||||
overdueList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE8.getValue()
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE22.getValue()
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -225,15 +250,31 @@ public class CertificationInventoryJob implements Job {
|
||||
calendar.add(Calendar.DATE,3);
|
||||
Date threeDays = calendar.getTime();
|
||||
|
||||
//获取后七天后的时间
|
||||
Calendar sevenCalendar=new GregorianCalendar();
|
||||
sevenCalendar.setTime(new Date());
|
||||
sevenCalendar.add(Calendar.DATE,7);
|
||||
Date sevenDays = sevenCalendar.getTime(); //fourteen
|
||||
|
||||
//获取后十四天后的时间
|
||||
Calendar fourteenCalendar=new GregorianCalendar();
|
||||
fourteenCalendar.setTime(new Date());
|
||||
fourteenCalendar.add(Calendar.DATE,14);
|
||||
Date fourteenDays = fourteenCalendar.getTime(); //fourteen
|
||||
|
||||
String threeDaysStr = sdf.format(threeDays);
|
||||
String sevenDaysStr = sdf.format(sevenDays);
|
||||
String fourteenDaysStr = sdf.format(fourteenDays);
|
||||
String currentDateStr = sdf.format(currentDate);
|
||||
|
||||
// 当天结束的
|
||||
List<ProjectCertificationInventoryEO> currentDaysList = dutyPersonDataList.stream().filter(data -> {
|
||||
boolean flag = false;
|
||||
//结束日期是当前日期
|
||||
if (StringUtils.equals(currentDateStr, sdf.format(data.getEndTime()))) {
|
||||
flag = true;
|
||||
if(data.getEndTime() != null){
|
||||
if (StringUtils.equals(currentDateStr, sdf.format(data.getEndTime()))) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
@@ -241,16 +282,39 @@ public class CertificationInventoryJob implements Job {
|
||||
// 三天后结束的
|
||||
List<ProjectCertificationInventoryEO> threeDaysList = dutyPersonDataList.stream().filter(data -> {
|
||||
boolean flag = false;
|
||||
//结束日期是当前日期
|
||||
if (StringUtils.equals(threeDaysStr, sdf.format(data.getEndTime()))) {
|
||||
flag = true;
|
||||
if(data.getEndTime() != null){
|
||||
if (StringUtils.equals(threeDaysStr, sdf.format(data.getEndTime()))) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 七天后结束的
|
||||
List<ProjectCertificationInventoryEO> sevenDaysList = dutyPersonDataList.stream().filter(data -> {
|
||||
boolean flag = false;
|
||||
if(data.getEndTime()!=null){
|
||||
if (StringUtils.equals(sevenDaysStr, sdf.format(data.getEndTime()))) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 十四天后结束的
|
||||
List<ProjectCertificationInventoryEO> fourteenDaysList = dutyPersonDataList.stream().filter(data -> {
|
||||
boolean flag = false;
|
||||
if(data.getEndTime() != null){
|
||||
if (StringUtils.equals(fourteenDaysStr, sdf.format(data.getEndTime()))) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 逾期的
|
||||
List<ProjectCertificationInventoryEO> overdueList = dutyPersonDataList.stream().filter(data -> {
|
||||
// 逾期3天、七天、14天
|
||||
/*// 逾期3天、七天、14天
|
||||
Calendar day3Later = new GregorianCalendar();
|
||||
day3Later.setTime(data.getEndTime());
|
||||
day3Later.add(Calendar.DATE, 3);
|
||||
@@ -270,13 +334,20 @@ public class CertificationInventoryJob implements Job {
|
||||
StringUtils.equals(sdf.format(overdue3Days), sdf.format(currentDate))
|
||||
|| StringUtils.equals(sdf.format(overdue7Days), sdf.format(currentDate))
|
||||
|| StringUtils.equals(sdf.format(overdue14Days), sdf.format(currentDate))
|
||||
);
|
||||
);*/
|
||||
// 只要早于当前日期都算逾期
|
||||
boolean flag = false;
|
||||
if(data.getEndTime() != null){
|
||||
flag = (data.getEndTime().before(currentDate));
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
result.put("currentDaysList",currentDaysList);
|
||||
result.put("threeDaysList",threeDaysList);
|
||||
result.put("overdueList",overdueList);
|
||||
result.put("sevenDaysList",sevenDaysList);
|
||||
result.put("fourteenDaysList",fourteenDaysList);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
+10
@@ -9,6 +9,7 @@ import com.jero.modules.project.entity.ProjectCertificationInventoryEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.system.entity.SysCategory;
|
||||
import com.jero.modules.system.entity.SysRole;
|
||||
import com.jero.modules.system.entity.SysUser;
|
||||
import com.jero.modules.todoCenter.entity.ProcessInfoDetailEO;
|
||||
import com.jero.modules.todoCenter.entity.ProcessInfoEO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
@@ -216,4 +217,13 @@ public interface IProjectCertificationInventoryEOService extends IService<Projec
|
||||
* @return
|
||||
*/
|
||||
Result<?> citeDeliverable(JSONObject json);
|
||||
|
||||
/**
|
||||
* 根据模板返送消息
|
||||
* @param projectCertificationInventoryEOS
|
||||
* @param templeteId
|
||||
* @param userIdList
|
||||
* @param userInfoList
|
||||
*/
|
||||
void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,String templeteId,List<String> userIdList,List<SysUser> userInfoList);
|
||||
}
|
||||
|
||||
+306
-3
@@ -160,6 +160,66 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
*/
|
||||
@Override
|
||||
public void editById(ProjectCertificationInventoryEO projectCertificationInventoryEO) {
|
||||
List<String> flowStatusList = new ArrayList<>();
|
||||
flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
|
||||
|
||||
QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
|
||||
certificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId());
|
||||
certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
|
||||
List<ProjectCertificationInventoryEO> editEndTimeCertificationInventoryEOS = this.list(certificationQueryWrap);
|
||||
|
||||
// 编辑截至日期发消息
|
||||
if(projectCertificationInventoryEO.getEndTime() != null){
|
||||
editEndTimeCertificationInventoryEOS = editEndTimeCertificationInventoryEOS.stream().filter(certificationInventory -> {
|
||||
boolean flag = false;
|
||||
if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if(CollectionUtils.isNotEmpty(editEndTimeCertificationInventoryEOS)){
|
||||
|
||||
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(editEndTimeCertificationInventoryEOS.get(0).getProjectLibraryId());
|
||||
List<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
|
||||
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
|
||||
|
||||
this.sendMessageByTemplateId(
|
||||
editEndTimeCertificationInventoryEOS,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(),
|
||||
userIdList,
|
||||
userInfoList
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 如果编辑了责任人,给责任人发消息
|
||||
if(StringUtils.isNotEmpty(projectCertificationInventoryEO.getDutyPerson())){
|
||||
QueryWrapper<ProjectCertificationInventoryEO> editDutyPersonCertificationQueryWrap = new QueryWrapper<>();
|
||||
editDutyPersonCertificationQueryWrap.lambda().eq(ProjectCertificationInventoryEO::getId,projectCertificationInventoryEO.getId());
|
||||
List<ProjectCertificationInventoryEO> editDutyPersonCertificationInventoryEOS = this.list(editDutyPersonCertificationQueryWrap);
|
||||
|
||||
editDutyPersonCertificationInventoryEOS = editDutyPersonCertificationInventoryEOS.stream().filter(certificationInventory -> {
|
||||
boolean flag = false;
|
||||
if(!StringUtils.equals(certificationInventory.getDutyPerson(),projectCertificationInventoryEO.getDutyPerson())){
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if(CollectionUtils.isNotEmpty(editDutyPersonCertificationInventoryEOS)){
|
||||
List<String> userIdList = editDutyPersonCertificationInventoryEOS.stream().map(ProjectCertificationInventoryEO::getDutyPerson).distinct().collect(Collectors.toList());
|
||||
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
|
||||
this.sendMessageByTemplateId(
|
||||
editDutyPersonCertificationInventoryEOS,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE15.getValue(),
|
||||
userIdList,
|
||||
userInfoList
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Date now = new Date();
|
||||
projectCertificationInventoryEO.setUpdateTime(now);
|
||||
saveOrUpdate(projectCertificationInventoryEO);
|
||||
@@ -293,6 +353,36 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
updateList.add(updateProjectCertificationInventoryEO);
|
||||
}
|
||||
|
||||
List<String> flowStatusList = new ArrayList<>();
|
||||
flowStatusList.add(CertificationInventoryFlowStatusEnum.TASK_TO_BE_CONFIRMED.getValue());
|
||||
|
||||
QueryWrapper<ProjectCertificationInventoryEO> certificationQueryWrap = new QueryWrapper<>();
|
||||
certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getId,idList);
|
||||
certificationQueryWrap.lambda().in(ProjectCertificationInventoryEO::getFlowStatus,flowStatusList);
|
||||
List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS = this.list(certificationQueryWrap);
|
||||
|
||||
if(CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)){
|
||||
projectCertificationInventoryEOS = projectCertificationInventoryEOS.stream().filter(certificationInventory -> {
|
||||
boolean flag = false;
|
||||
if(!projectCertificationInventoryEO.getEndTime().equals(certificationInventory.getEndTime())){
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtils.isNotEmpty(projectCertificationInventoryEOS)) {
|
||||
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId());
|
||||
List<String> userIdList = Arrays.asList(projectLibraryBase.getCertificationEngineer().split(","));
|
||||
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
|
||||
|
||||
this.sendMessageByTemplateId(
|
||||
projectCertificationInventoryEOS,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE14.getValue(),
|
||||
userIdList,
|
||||
userInfoList
|
||||
);
|
||||
}
|
||||
}
|
||||
if(CollectionUtils.isNotEmpty(updateList)){
|
||||
this.updateBatchById(updateList);
|
||||
}
|
||||
@@ -302,6 +392,62 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
return Result.OK("批量设置成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板发送消息
|
||||
* @param projectCertificationInventoryEOS
|
||||
* @param templeteId
|
||||
*/
|
||||
@Override
|
||||
public void sendMessageByTemplateId(List<ProjectCertificationInventoryEO> projectCertificationInventoryEOS,String templeteId,List<String> userIdList,List<SysUser> userInfoList){
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
|
||||
ProjectLibraryBase projectLibraryBase = this.projectLibraryBaseService.selectById(projectCertificationInventoryEOS.get(0).getProjectLibraryId());
|
||||
|
||||
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
|
||||
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
|
||||
|
||||
// 获取认证清单 - 飞书跳转链接
|
||||
Map<String, Object> hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN);
|
||||
String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN");
|
||||
String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN");
|
||||
|
||||
Map<String, Object> standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOS);
|
||||
String standName = (String) standNameAndItemName.get("standName");
|
||||
String itemName = (String) standNameAndItemName.get("itemName");
|
||||
|
||||
try {
|
||||
for (String userId : userIdList) {
|
||||
String thirdId = this.sysUserService.getUserThirdIdByUserId(userInfoList,userId);
|
||||
|
||||
if(StringUtils.isNotEmpty(thirdId)){
|
||||
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
|
||||
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOS);
|
||||
Date endTime = projectCertificationInventoryEOS.get(0).getEndTime();
|
||||
|
||||
JSONObject larkMesJson = new JSONObject();
|
||||
larkMesJson.put("template_id", templeteId);
|
||||
larkMesJson.put("userIds",thirdId);
|
||||
|
||||
Map<String,Object> templateVariableMap = new HashMap<>();
|
||||
templateVariableMap.put("projectNameCn",PRN_CN);
|
||||
templateVariableMap.put("projectNameEn",PRN_EN);
|
||||
templateVariableMap.put("standName",standName);
|
||||
templateVariableMap.put("itemName",itemName);
|
||||
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
|
||||
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
|
||||
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
|
||||
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
|
||||
templateVariableMap.put("operateUserName",currentUser.getUsername());
|
||||
|
||||
larkMesJson.put("templateVariableMap",templateVariableMap);
|
||||
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void importDisposeData(List<ProjectCertificationInventoryEO> datas, String cut) {
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
@@ -1201,6 +1347,9 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
if(CollectionUtils.isNotEmpty(projectCertificationInventoryLogEOList)){
|
||||
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
|
||||
}
|
||||
|
||||
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
|
||||
|
||||
try {
|
||||
this.updateBatchById(projectCertificationInventoryEOList);
|
||||
|
||||
@@ -1217,6 +1366,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
|
||||
// 给认证工程师分配待办中心的任务 认证工程师审查
|
||||
this.addProcessInfoDetailEO(processInfoDetailEOList,projectLibraryBase.getId(),CertificationFlowNodeEnum.RZGCSSC.getKey());
|
||||
|
||||
this.sendMessageByTemplateId(
|
||||
projectCertificationInventoryEOList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE23.getValue(),
|
||||
certificationEngineerList,
|
||||
certificationEngineers
|
||||
);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("责任人-提交任务失败:" + ex.getMessage());
|
||||
@@ -1253,6 +1409,10 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
}
|
||||
|
||||
ProjectLibraryBase projectLibraryBase = JSONObject.parseObject(JSONObject.toJSONString(json.get("projectLibraryBase")), ProjectLibraryBase.class);
|
||||
String certificationEngineer = projectLibraryBase.getCertificationEngineer();
|
||||
if(StringUtils.isEmpty(certificationEngineer)){
|
||||
throw new JeroBootException("该项目中认证工程师为空,请先维护认证工程师!");
|
||||
}
|
||||
|
||||
List<ProjectCertificationInventoryLogEO> projectCertificationInventoryLogEOList = new ArrayList<>();
|
||||
List<ProcessInfoDetailEO> processInfoDetailEOList = new ArrayList<>();
|
||||
@@ -1279,6 +1439,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
|
||||
}
|
||||
|
||||
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
|
||||
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
|
||||
|
||||
// 获取认证清单 - 飞书跳转链接
|
||||
Map<String, Object> hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN);
|
||||
String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN");
|
||||
String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN");
|
||||
|
||||
Map<String, Object> standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList);
|
||||
String standName = (String) standNameAndItemName.get("standName");
|
||||
String itemName = (String) standNameAndItemName.get("itemName");
|
||||
|
||||
try {
|
||||
List<String> certificationIdList = projectCertificationInventoryEOList.stream().map(ProjectCertificationInventoryEO::getId).distinct().collect(Collectors.toList());
|
||||
// 将当前责任人的待办任务转为已办
|
||||
@@ -1295,6 +1467,41 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
|
||||
// 责任人接受任务,将数据的状态更新为 结果待提交。
|
||||
this.updateBatchById(projectCertificationInventoryEOList);
|
||||
|
||||
|
||||
List<String> certificationEngineerList = Arrays.asList(certificationEngineer.split(","));
|
||||
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
|
||||
try {
|
||||
for (String userId : certificationEngineerList) {
|
||||
String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId);
|
||||
|
||||
if(StringUtils.isNotEmpty(thirdId)){
|
||||
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
|
||||
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
|
||||
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
|
||||
|
||||
JSONObject larkMesJson = new JSONObject();
|
||||
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE12.getValue());
|
||||
larkMesJson.put("userIds",thirdId);
|
||||
|
||||
Map<String,Object> templateVariableMap = new HashMap<>();
|
||||
templateVariableMap.put("projectNameCn",PRN_CN);
|
||||
templateVariableMap.put("projectNameEn",PRN_EN);
|
||||
templateVariableMap.put("standName",standName);
|
||||
templateVariableMap.put("itemName",itemName);
|
||||
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
|
||||
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
|
||||
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
|
||||
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
|
||||
templateVariableMap.put("operateUserName",currentUser.getUsername());
|
||||
|
||||
larkMesJson.put("templateVariableMap",templateVariableMap);
|
||||
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("责任人-接受任务失败:" + ex.getMessage());
|
||||
@@ -1357,6 +1564,18 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
this.projectCertificationInventoryLogEOService.insertBatch(projectCertificationInventoryLogEOList);
|
||||
}
|
||||
|
||||
String PRN_EN = projectLibraryBase.getProjectNameEn();//项目名称 英文
|
||||
String PRN_CN = projectLibraryBase.getProjectNameCn();//项目名称 中文
|
||||
|
||||
// 获取认证清单 - 飞书跳转链接
|
||||
Map<String, Object> hrefFeishuMap = this.getCertificationInventoryLinkHrefFeishu(projectLibraryBase.getId(), PRN_CN, PRN_EN);
|
||||
String hrefFeishu_CN = (String) hrefFeishuMap.get("hrefFeishu_CN");
|
||||
String hrefFeishu_EN = (String) hrefFeishuMap.get("hrefFeishu_EN");
|
||||
|
||||
Map<String, Object> standNameAndItemName = this.projectCertificationInventoryEOService.getStandNameAndItemName(projectCertificationInventoryEOList);
|
||||
String standName = (String) standNameAndItemName.get("standName");
|
||||
String itemName = (String) standNameAndItemName.get("itemName");
|
||||
|
||||
try {
|
||||
// 将当前责任人的待办任务转为已办
|
||||
LambdaUpdateWrapper<ProcessInfoDetailEO> detailUpdateWrap = new LambdaUpdateWrapper<>();
|
||||
@@ -1391,6 +1610,39 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
|
||||
// 责任人接受任务,将数据的状态更新为 结果待提交。
|
||||
this.updateBatchById(projectCertificationInventoryEOList);
|
||||
|
||||
List<SysUser> certificationEngineers = this.sysUserService.querySysUserListByIdList(certificationEngineerList);
|
||||
try {
|
||||
for (String userId : certificationEngineerList) {
|
||||
String thirdId = this.sysUserService.getUserThirdIdByUserId(certificationEngineers,userId);
|
||||
|
||||
if(StringUtils.isNotEmpty(thirdId)){
|
||||
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
|
||||
this.certificationInventoryEOListSortByEndTimeAsc(projectCertificationInventoryEOList);
|
||||
Date endTime = projectCertificationInventoryEOList.get(0).getEndTime();
|
||||
|
||||
JSONObject larkMesJson = new JSONObject();
|
||||
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE11.getValue());
|
||||
larkMesJson.put("userIds",thirdId);
|
||||
|
||||
Map<String,Object> templateVariableMap = new HashMap<>();
|
||||
templateVariableMap.put("projectNameCn",PRN_CN);
|
||||
templateVariableMap.put("projectNameEn",PRN_EN);
|
||||
templateVariableMap.put("standName",standName);
|
||||
templateVariableMap.put("itemName",itemName);
|
||||
templateVariableMap.put("Initiator",projectLibraryBase.getStudioEngineerName());
|
||||
templateVariableMap.put("endTime",DateUtils.formatDate(endTime));
|
||||
templateVariableMap.put("viewBtnUrlCn",hrefFeishu_CN);
|
||||
templateVariableMap.put("viewBtnUrlEn",hrefFeishu_EN);
|
||||
templateVariableMap.put("operateUserName",currentUser.getUsername());
|
||||
|
||||
larkMesJson.put("templateVariableMap",templateVariableMap);
|
||||
this.feishuService.batchSendLarkCardMsgByTemplate2(larkMesJson);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
log.error("责任人-拒绝任务失败:" + ex.getMessage());
|
||||
@@ -1906,6 +2158,15 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
});
|
||||
this.processInfoDetailEOService.updateBatchById(processInfoDetailEOList);
|
||||
}
|
||||
|
||||
List<String> userIdList = Arrays.asList(transferUserId.split(","));
|
||||
List<SysUser> userInfoList = this.sysUserService.querySysUserListByIdList(userIdList);
|
||||
this.sendMessageByTemplateId(
|
||||
projectCertificationInventoryEOList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE17.getValue(),
|
||||
userIdList,
|
||||
userInfoList
|
||||
);
|
||||
|
||||
// 获取认证清单 - 飞书跳转链接
|
||||
// 2023-03-15 去掉此消息
|
||||
@@ -2054,10 +2315,46 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
for (Map.Entry<String, List<ProjectCertificationInventoryEO>> map : certifycationInventoryListByDutyPersonMap.entrySet()) {
|
||||
String key = map.getKey();
|
||||
List<ProjectCertificationInventoryEO> value = map.getValue();
|
||||
List<String> userIdList = Arrays.asList(key.split(","));
|
||||
|
||||
String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,key);
|
||||
// 给责任人发消息
|
||||
this.sendMessageByTemplateId(
|
||||
value,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(),
|
||||
userIdList,
|
||||
dutyPersonList
|
||||
);
|
||||
|
||||
/*// 待提交数据 单独发消息
|
||||
List<ProjectCertificationInventoryEO> toBeSubmitDataList = value.stream().filter(v -> {
|
||||
boolean flag = false;
|
||||
if(StringUtils.equals(v.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
if (CollectionUtils.isNotEmpty(toBeSubmitDataList)) {
|
||||
|
||||
this.sendMessageByTemplateId(
|
||||
toBeSubmitDataList,
|
||||
TemplateInfoEnum2.CERTIFICATION_MESSAGE18.getValue(),
|
||||
userIdList,
|
||||
dutyPersonList
|
||||
);
|
||||
}*/
|
||||
|
||||
/*String thirdId = this.sysUserService.getUserThirdIdByUserId(dutyPersonList,key);
|
||||
|
||||
if(StringUtils.isNotEmpty(thirdId)){
|
||||
// 过滤掉 待提交的数据,正常发消息
|
||||
value = value.stream().filter(v -> {
|
||||
boolean flag = false;
|
||||
if(!StringUtils.equals(v.getFlowStatus(),CertificationInventoryFlowStatusEnum.RESULTS_TO_BE_SUBMITTED.getValue())){
|
||||
flag = true;
|
||||
}
|
||||
return flag;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
// 根据结束时间进行排序,获取最近的时间,发消息时使用。
|
||||
Collections.sort(value, new Comparator<ProjectCertificationInventoryEO>() {
|
||||
@Override
|
||||
@@ -2076,7 +2373,13 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
|
||||
try {
|
||||
JSONObject larkMesJson = new JSONObject();
|
||||
larkMesJson.put("template_id", TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue());
|
||||
|
||||
String templateId = TemplateInfoEnum2.CERTIFICATION_MESSAGE1.getValue();
|
||||
if(StringUtils.equals(operatorType,OperatorTypeEnum.CERTIFICATION_INVENTORY_CERTIFICATION_ENGINEER_EXPEDITING.getValue())){
|
||||
templateId = TemplateInfoEnum2.CERTIFICATION_MESSAGE16.getValue();
|
||||
}
|
||||
|
||||
larkMesJson.put("template_id", templateId);
|
||||
larkMesJson.put("userIds",thirdId);
|
||||
|
||||
Map<String,Object> templateVariableMap = new HashMap<>();
|
||||
@@ -2094,7 +2397,7 @@ public class ProjectCertificationInventoryEOServiceImpl extends ServiceImpl<Proj
|
||||
} catch (Exception e) {
|
||||
log.error("飞书消息推送失败");
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user