工作组催款提醒添加邮件发送失败提醒

This commit is contained in:
梁琦涛
2022-05-07 14:30:33 +08:00
parent 9f8de4fcec
commit a7d00cd791
@@ -379,37 +379,43 @@ public class PayWorkingGroupSubItemController extends JeroController<PayWorkingG
if(CollectionUtils.isEmpty(listPayContactsManagementTemporary)){
return Result.error("联系人不存在!");
}
List<String> listMsg = new ArrayList<>();
listPayWorkingGroupSubItem.forEach(p->{
List<PayWorkingGroupSubItemContacts> listNew = listPayWorkingGroupSubItemContacts.stream().filter(n->Objects.equals(n.getWorkingGroupSubId(),p.getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listNew)){
return;
}
List<PayContactsManagementTemporary> listContactsInfo = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(listNew.get(0).getContactsTemporaryId(),item.getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContactsInfo)){
return;
}
// 发送消息
SendMessageDTO sendMessageDTO = new SendMessageDTO();
if(!StringUtils.isBlank(listContactsInfo.get(0).getEmail())){
sendMessageDTO.setEmail(PasswordUtil.decrypt(listContactsInfo.get(0).getEmail()));
}
if(!StringUtils.isBlank(listContactsInfo.get(0).getPhone())){
sendMessageDTO.setToUser(PasswordUtil.decrypt(listContactsInfo.get(0).getPhone()));
sendMessageDTO.setPhone(PasswordUtil.decrypt(listContactsInfo.get(0).getPhone()));
}
HashMap<String,String> map = new HashMap<>();
map.put("projectName",payWorkingGroup.getWorkingGroupProject());
sendMessageDTO.setFromUser(sysUser.getUsername());
sendMessageDTO.setTemplateCode(CompanyMessageEnums.MSG11.getCode());
sendMessageDTO.setTemplateParam(map);
sendMessageDTO.setBusType("C_OPEN_TYPE11");
JSONObject json = new JSONObject();
json.put("id",p.getId());
sendMessageDTO.setBusId(json.toJSONString());
sendMessageService.SendMessageService(sendMessageDTO);
try{
List<PayWorkingGroupSubItemContacts> listNew = listPayWorkingGroupSubItemContacts.stream().filter(n->Objects.equals(n.getWorkingGroupSubId(),p.getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listNew)){
return;
}
List<PayContactsManagementTemporary> listContactsInfo = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(listNew.get(0).getContactsTemporaryId(),item.getId())).collect(Collectors.toList());
if(CollectionUtils.isEmpty(listContactsInfo)){
return;
}
// 发送消息
SendMessageDTO sendMessageDTO = new SendMessageDTO();
if(!StringUtils.isBlank(listContactsInfo.get(0).getEmail())){
sendMessageDTO.setEmail(PasswordUtil.decrypt(listContactsInfo.get(0).getEmail()));
}
if(!StringUtils.isBlank(listContactsInfo.get(0).getPhone())){
sendMessageDTO.setToUser(PasswordUtil.decrypt(listContactsInfo.get(0).getPhone()));
sendMessageDTO.setPhone(PasswordUtil.decrypt(listContactsInfo.get(0).getPhone()));
}
HashMap<String,String> map = new HashMap<>();
map.put("projectName",payWorkingGroup.getWorkingGroupProject());
sendMessageDTO.setFromUser(sysUser.getUsername());
sendMessageDTO.setTemplateCode(CompanyMessageEnums.MSG11.getCode());
sendMessageDTO.setTemplateParam(map);
sendMessageDTO.setBusType("C_OPEN_TYPE11");
JSONObject json = new JSONObject();
json.put("id",p.getId());
sendMessageDTO.setBusId(json.toJSONString());
sendMessageService.SendMessageService(sendMessageDTO);
}catch (Exception e){
if(e.getMessage().contains("邮件发送") && !listMsg.contains(p.getChargeCompanyTemporaryName() + "单位邮箱发送失败")){
listMsg.add(p.getChargeCompanyTemporaryName() + "单位邮箱发送失败");
}
}
});
return Result.OK("添加成功!");
return Result.OK("添加成功!",listMsg);
}
/**