工作组变更
This commit is contained in:
+35
-85
@@ -916,27 +916,23 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
}
|
||||
List<PayWorkingGroupSubItem> list = payWorkingGroupSubItemService.listByIds(Arrays.asList(s));
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
// todo 联系人关联表
|
||||
List<String> listMsg = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(list)){
|
||||
List<String> listContacts = new ArrayList<>();
|
||||
List<String> listOne = list.stream().map(PayWorkingGroupSubItem::getContactsTemporaryIdOne).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listOne)){
|
||||
listContacts.addAll(listOne);
|
||||
}
|
||||
List<String> listTwo = list.stream().map(PayWorkingGroupSubItem::getContactsTemporaryIdTwo).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listTwo)){
|
||||
listContacts.addAll(listTwo);
|
||||
}
|
||||
List<String> listThree = list.stream().map(PayWorkingGroupSubItem::getContactsTemporaryIdThree).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listThree)){
|
||||
listContacts.addAll(listThree);
|
||||
}
|
||||
// 获取所有联系人
|
||||
List<PayContactsManagementTemporary> listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listContacts);
|
||||
if(CollectionUtils.isEmpty(listPayContactsManagementTemporary)){
|
||||
throw new JeroBootException("联系人不存在!");
|
||||
List<String> listStr = list.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList());
|
||||
List<PayWorkingGroupSubItemContacts> listPayWorkingGroupSubItemContacts = payWorkingGroupSubItemContactsService.listByIds(listStr);
|
||||
List<PayContactsManagementTemporary> listPayContactsManagementTemporary = new ArrayList<>();
|
||||
if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){
|
||||
List<String> listContacts = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listContacts)){
|
||||
// 获取所有联系人
|
||||
listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listContacts);
|
||||
if(CollectionUtils.isEmpty(listPayContactsManagementTemporary)){
|
||||
throw new JeroBootException("联系人不存在!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<PayContactsManagementTemporary> finalListPayContactsManagementTemporary = listPayContactsManagementTemporary;
|
||||
list.forEach(p->{
|
||||
// 获取工作组信息
|
||||
PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(list.get(0).getWorkingGroupId());
|
||||
@@ -964,6 +960,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
String paymentStatus = payPaymentCheckService.getPaymentStatus(input.getReceivableAmount(),p.getPaidAmount(),p.getPaymentStatus());
|
||||
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getPaymentStatus,paymentStatus);
|
||||
updatePayWorkingGroupSubItem.eq(PayWorkingGroupSubItem::getId,p.getId());
|
||||
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeWay,PayProjectCommon.CHARGE_WAY3);
|
||||
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getCharge,input.getCharge());
|
||||
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getReceivableAmount,input.getReceivableAmount());
|
||||
updatePayWorkingGroupSubItem.set(PayWorkingGroupSubItem::getChargeNoticeNo,input.getChargeNoticeNo());
|
||||
@@ -974,18 +971,29 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
if(CollectionUtils.isEmpty(listFile)){
|
||||
return;
|
||||
}
|
||||
// 发消息 项目负责人发给企业联系人、工作组1、2、3联系人
|
||||
List<PayContactsManagementTemporary> listContactsOne = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(p.getContactsTemporaryIdOne(),item.getId())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listContactsOne)){
|
||||
if(CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){
|
||||
return;
|
||||
}
|
||||
List<PayWorkingGroupSubItemContacts> listNew = listPayWorkingGroupSubItemContacts.stream().filter(n->Objects.equals(n.getWorkingGroupSubId(),p.getId())).collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(listNew)){
|
||||
return;
|
||||
}
|
||||
List<String> listIds = listNew.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList());
|
||||
// 发消息 项目负责人发给企业联系人、工作组联系人
|
||||
List<PayContactsManagementTemporary> listContacts = finalListPayContactsManagementTemporary.stream().filter(item->listIds.contains(item.getId())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listContacts)) {
|
||||
return;
|
||||
}
|
||||
listContacts.forEach(m->{
|
||||
try {
|
||||
// 发送消息
|
||||
SendMessageDTO sendMessageDTO = new SendMessageDTO();
|
||||
if(!StringUtils.isBlank(listContactsOne.get(0).getEmail())){
|
||||
sendMessageDTO.setEmail(PasswordUtil.decrypt(listContactsOne.get(0).getEmail()));
|
||||
if(!StringUtils.isBlank(m.getEmail())){
|
||||
sendMessageDTO.setEmail(PasswordUtil.decrypt(m.getEmail()));
|
||||
}
|
||||
if(!StringUtils.isBlank(listContactsOne.get(0).getPhone())){
|
||||
sendMessageDTO.setToUser(PasswordUtil.decrypt(listContactsOne.get(0).getPhone()));
|
||||
sendMessageDTO.setPhone(PasswordUtil.decrypt(listContactsOne.get(0).getPhone()));
|
||||
if(!StringUtils.isBlank(m.getPhone())){
|
||||
sendMessageDTO.setToUser(PasswordUtil.decrypt(m.getPhone()));
|
||||
sendMessageDTO.setPhone(PasswordUtil.decrypt(m.getPhone()));
|
||||
}
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("projectName",payWorkingGroup.getWorkingGroupProject());
|
||||
@@ -1003,65 +1011,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl<PayWorkingGro
|
||||
listMsg.add(p.getChargeCompanyTemporaryName() + "单位邮箱发送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PayContactsManagementTemporary> listContactsTwo = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(p.getContactsTemporaryIdTwo(),item.getId())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listContactsTwo)){
|
||||
try {
|
||||
// 发送消息
|
||||
SendMessageDTO sendMessageDTO = new SendMessageDTO();
|
||||
if(!StringUtils.isBlank(listContactsTwo.get(0).getEmail())){
|
||||
sendMessageDTO.setEmail(PasswordUtil.decrypt(listContactsTwo.get(0).getEmail()));
|
||||
}
|
||||
if(!StringUtils.isBlank(listContactsTwo.get(0).getPhone())){
|
||||
sendMessageDTO.setToUser(PasswordUtil.decrypt(listContactsTwo.get(0).getPhone()));
|
||||
sendMessageDTO.setPhone(PasswordUtil.decrypt(listContactsTwo.get(0).getPhone()));
|
||||
}
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("projectName",payWorkingGroup.getWorkingGroupProject());
|
||||
sendMessageDTO.setFromUser(sysUserInfo.getUsername());
|
||||
sendMessageDTO.setTemplateCode(CompanyMessageEnums.MSG22.getCode());
|
||||
sendMessageDTO.setTemplateParam(map);
|
||||
sendMessageDTO.setBusType("C_OPEN_TYPE22");
|
||||
sendMessageDTO.setListFile(listFile);
|
||||
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() + "单位邮箱发送失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
List<PayContactsManagementTemporary> listContactsThree = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(p.getContactsTemporaryIdThree(),item.getId())).collect(Collectors.toList());
|
||||
if(!CollectionUtils.isEmpty(listContactsThree)){
|
||||
try {
|
||||
// 发送消息
|
||||
SendMessageDTO sendMessageDTO = new SendMessageDTO();
|
||||
if(!StringUtils.isBlank(listContactsThree.get(0).getEmail())){
|
||||
sendMessageDTO.setEmail(PasswordUtil.decrypt(listContactsThree.get(0).getEmail()));
|
||||
}
|
||||
if(!StringUtils.isBlank(listContactsThree.get(0).getPhone())){
|
||||
sendMessageDTO.setToUser(PasswordUtil.decrypt(listContactsThree.get(0).getPhone()));
|
||||
sendMessageDTO.setPhone(PasswordUtil.decrypt(listContactsThree.get(0).getPhone()));
|
||||
}
|
||||
HashMap<String,String> map = new HashMap<>();
|
||||
map.put("projectName",payWorkingGroup.getWorkingGroupProject());
|
||||
sendMessageDTO.setFromUser(sysUserInfo.getUsername());
|
||||
sendMessageDTO.setTemplateCode(CompanyMessageEnums.MSG22.getCode());
|
||||
sendMessageDTO.setTemplateParam(map);
|
||||
sendMessageDTO.setBusType("C_OPEN_TYPE22");
|
||||
sendMessageDTO.setListFile(listFile);
|
||||
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 listMsg;
|
||||
|
||||
Reference in New Issue
Block a user