diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java index 57d64f11..25e66dd3 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/controller/PayWorkingGroupSubItemController.java @@ -39,6 +39,7 @@ import com.jero.project.entity.PayWorkingGroup; import com.jero.project.entity.PayWorkingGroupSubItem; import com.jero.project.entity.PayWorkingGroupSubItemContacts; import com.jero.project.service.IPayWorkingGroupService; +import com.jero.project.service.IPayWorkingGroupSubItemContactsService; import com.jero.project.service.IPayWorkingGroupSubItemService; import com.jero.project.vo.SetChargeInput; import com.jero.project.vo.excel.PayWorkingGroupSubItemExcel; @@ -97,6 +98,8 @@ public class PayWorkingGroupSubItemController extends JeroController excelList = new ArrayList<>(); - for (PayWorkingGroupSubItem workingGroupSubItem : exportList) { - PayWorkingGroupSubItemExcel excel = new PayWorkingGroupSubItemExcel(); - BeanUtils.copyProperties(workingGroupSubItem,excel); - List listPayWorkingGroupSubItemContacts = workingGroupSubItem.getPayWorkingGroupSubItemContactsList(); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ - listPayWorkingGroupSubItemContacts.sort(Comparator.comparing(PayWorkingGroupSubItemContacts::getOrderNum)); - List listIds = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); - List listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listIds); - for (int i = 0; i < listPayWorkingGroupSubItemContacts.size(); i++) { - PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = listPayWorkingGroupSubItemContacts.get(i); - List temporary = listPayContactsManagementTemporary.stream().filter(s->Objects.equals(s.getId(),payWorkingGroupSubItemContacts.getContactsTemporaryId())).collect(Collectors.toList()); - String email = ""; - String phone = ""; - String name = payWorkingGroupSubItemContacts.getContactsTemporaryName(); - String remark = payWorkingGroupSubItemContacts.getRemarks(); - if(!CollectionUtils.isEmpty(temporary)){ - email = temporary.get(0).getEmail(); - if (StringUtils.isNotBlank(email)){ - email = PasswordUtil.decrypt(email); + if(!CollectionUtils.isEmpty(exportList)){ + List listWGSIds = exportList.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList()); + LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); + queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,listWGSIds); + List payWorkingGroupSubItemContactsList = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); + for (PayWorkingGroupSubItem workingGroupSubItem : exportList) { + PayWorkingGroupSubItemExcel excel = new PayWorkingGroupSubItemExcel(); + BeanUtils.copyProperties(workingGroupSubItem,excel); + List listPayWorkingGroupSubItemContacts = payWorkingGroupSubItemContactsList.stream().filter(o->Objects.equals(workingGroupSubItem.getId(),o.getWorkingGroupSubId())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + listPayWorkingGroupSubItemContacts.sort(Comparator.comparing(PayWorkingGroupSubItemContacts::getOrderNum)); + List listIds = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); + List listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listIds); + for (int i = 0; i < listPayWorkingGroupSubItemContacts.size(); i++) { + PayWorkingGroupSubItemContacts payWorkingGroupSubItemContacts = listPayWorkingGroupSubItemContacts.get(i); + List temporary = listPayContactsManagementTemporary.stream().filter(s->Objects.equals(s.getId(),payWorkingGroupSubItemContacts.getContactsTemporaryId())).collect(Collectors.toList()); + String email = ""; + String phone = ""; + String name = payWorkingGroupSubItemContacts.getContactsTemporaryName(); + String remark = payWorkingGroupSubItemContacts.getRemarks(); + if(!CollectionUtils.isEmpty(temporary)){ + email = temporary.get(0).getEmail(); + if (StringUtils.isNotBlank(email)){ + email = PasswordUtil.decrypt(email); + } + phone = temporary.get(0).getPhone(); + if (StringUtils.isNotBlank(phone)){ + phone = PasswordUtil.decrypt(phone); + } } - phone = temporary.get(0).getPhone(); - if (StringUtils.isNotBlank(phone)){ - phone = PasswordUtil.decrypt(phone); + switch (i){ + case 0: + excel.setContactsNameOne(name); + excel.setRemarksOne(remark); + excel.setContactsEmailOne(email); + excel.setContactsPhoneOne(phone); + break; + case 1: + excel.setContactsNameTwo(name); + excel.setRemarksTwo(remark); + excel.setContactsEmailTwo(email); + excel.setContactsPhoneTwo(phone); + break; + case 2: + excel.setContactsNameThree(name); + excel.setRemarksThree(remark); + excel.setContactsEmailThree(email); + excel.setContactsPhoneThree(phone); + break; + case 3: + excel.setContactsNameFour(name); + excel.setRemarksFour(remark); + excel.setContactsEmailFour(email); + excel.setContactsPhoneFour(phone); + break; + case 4: + excel.setContactsNameFive(name); + excel.setRemarksFive(remark); + excel.setContactsEmailFive(email); + excel.setContactsPhoneFive(phone); + break; + case 5: + excel.setContactsNameSix(name); + excel.setRemarksSix(remark); + excel.setContactsEmailSix(email); + excel.setContactsPhoneSix(phone); + break; + case 6: + excel.setContactsNameSeven(name); + excel.setRemarksSeven(remark); + excel.setContactsEmailSeven(email); + excel.setContactsPhoneSeven(phone); + break; + case 7: + excel.setContactsNameEight(name); + excel.setRemarksEight(remark); + excel.setContactsEmailEight(email); + excel.setContactsPhoneEight(phone); + break; + case 8: + excel.setContactsNameNine(name); + excel.setRemarksNine(remark); + excel.setContactsEmailNine(email); + excel.setContactsPhoneNine(phone); + break; + case 9: + excel.setContactsNameTen(name); + excel.setRemarksTen(remark); + excel.setContactsEmailTen(email); + excel.setContactsPhoneTen(phone); + break; + default:break; } } - switch (i){ - case 0: - excel.setContactsNameOne(name); - excel.setRemarksOne(remark); - excel.setContactsEmailOne(email); - excel.setContactsPhoneOne(phone); - break; - case 1: - excel.setContactsNameTwo(name); - excel.setRemarksTwo(remark); - excel.setContactsEmailTwo(email); - excel.setContactsPhoneTwo(phone); - break; - case 2: - excel.setContactsNameThree(name); - excel.setRemarksThree(remark); - excel.setContactsEmailThree(email); - excel.setContactsPhoneThree(phone); - break; - case 3: - excel.setContactsNameFour(name); - excel.setRemarksFour(remark); - excel.setContactsEmailFour(email); - excel.setContactsPhoneFour(phone); - break; - case 4: - excel.setContactsNameFive(name); - excel.setRemarksFive(remark); - excel.setContactsEmailFive(email); - excel.setContactsPhoneFive(phone); - break; - case 5: - excel.setContactsNameSix(name); - excel.setRemarksSix(remark); - excel.setContactsEmailSix(email); - excel.setContactsPhoneSix(phone); - break; - case 6: - excel.setContactsNameSeven(name); - excel.setRemarksSeven(remark); - excel.setContactsEmailSeven(email); - excel.setContactsPhoneSeven(phone); - break; - case 7: - excel.setContactsNameEight(name); - excel.setRemarksEight(remark); - excel.setContactsEmailEight(email); - excel.setContactsPhoneEight(phone); - break; - case 8: - excel.setContactsNameNine(name); - excel.setRemarksNine(remark); - excel.setContactsEmailNine(email); - excel.setContactsPhoneNine(phone); - break; - case 9: - excel.setContactsNameTen(name); - excel.setRemarksTen(remark); - excel.setContactsEmailTen(email); - excel.setContactsPhoneTen(phone); - break; - default:break; - } } + excelList.add(excel); } - excelList.add(excel); } return super.exportListXls(excelList, PayWorkingGroupSubItemExcel.class, "工作组成员"); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/entity/PayWorkingGroupSubItemContacts.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/entity/PayWorkingGroupSubItemContacts.java index d9e1cbe8..ec5e46a9 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/entity/PayWorkingGroupSubItemContacts.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/entity/PayWorkingGroupSubItemContacts.java @@ -65,16 +65,16 @@ public class PayWorkingGroupSubItemContacts implements Serializable { @ApiModelProperty(value = "创建人") private String createBy; /**创建时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "创建时间") private Date createTime; /**更新人*/ @ApiModelProperty(value = "更新人") private String updateBy; /**更新时间*/ - @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd") - @DateTimeFormat(pattern="yyyy-MM-dd") + @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") @ApiModelProperty(value = "更新时间") private Date updateTime; } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java index 5a0726e4..b62b8ab0 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupSubItemServiceImpl.java @@ -124,31 +124,31 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl queryPageList(Page page, PayWorkingGroupSubItem payWorkingGroupSubitem,String paymentDate) { IPage payWorkingGroupSubItemIPage = payWorkingGroupSubItemMapper.queryPageList(page, payWorkingGroupSubitem, paymentDate); - if (StringUtils.isNotBlank(payWorkingGroupSubitem.getMeetingId())){ - List records = payWorkingGroupSubItemIPage.getRecords(); - if(!CollectionUtils.isEmpty(records)){ - // 获取企业联系人 - List listIds = records.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList()); - LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); - queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,listIds); - List payWorkingGroupSubItemContactsList = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); - for (PayWorkingGroupSubItem workingGroupSubItem : records) { + List records = payWorkingGroupSubItemIPage.getRecords(); + if(!CollectionUtils.isEmpty(records)){ + // 获取企业联系人 + List listIds = records.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList()); + LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); + queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,listIds); + List payWorkingGroupSubItemContactsList = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); + for (PayWorkingGroupSubItem workingGroupSubItem : records) { + if (StringUtils.isNotBlank(payWorkingGroupSubitem.getMeetingId())) { String workingGroupSubItemId = workingGroupSubItem.getId(); LambdaQueryWrapper wrapper = new LambdaQueryWrapper<>(); - wrapper.eq(PayMeetingRemindRecord::getSubitemId,workingGroupSubItemId); - wrapper.eq(PayMeetingRemindRecord::getMeetingId,payWorkingGroupSubitem.getMeetingId()); + wrapper.eq(PayMeetingRemindRecord::getSubitemId, workingGroupSubItemId); + wrapper.eq(PayMeetingRemindRecord::getMeetingId, payWorkingGroupSubitem.getMeetingId()); int count = payMeetingRemindRecordService.count(wrapper); - if (count>0){ + if (count > 0) { workingGroupSubItem.setRemind(PayProjectCommon.YES); - }else { + } else { workingGroupSubItem.setRemind(PayProjectCommon.NO); } - if(!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)){ - List pwg = payWorkingGroupSubItemContactsList.stream().filter(p->Objects.equals(p.getWorkingGroupSubId(),workingGroupSubItem.getId())).collect(Collectors.toList()); - if(!CollectionUtils.isEmpty(pwg)){ - pwg.sort(Comparator.comparing(PayWorkingGroupSubItemContacts::getOrderNum)); - workingGroupSubItem.setPayWorkingGroupSubItemContactsList(pwg); - } + } + if(!CollectionUtils.isEmpty(payWorkingGroupSubItemContactsList)){ + List pwg = payWorkingGroupSubItemContactsList.stream().filter(p->Objects.equals(p.getWorkingGroupSubId(),workingGroupSubItem.getId())).collect(Collectors.toList()); + if(!CollectionUtils.isEmpty(pwg)){ + pwg.sort(Comparator.comparing(PayWorkingGroupSubItemContacts::getOrderNum)); + workingGroupSubItem.setPayWorkingGroupSubItemContactsList(pwg); } } } @@ -157,8 +157,17 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listPayWorkingGroupSubItemContacts = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); + if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + long oldNum = listPayWorkingGroupSubItemContacts.size(); + long newNum = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsId).collect(Collectors.toList()).stream().distinct().count(); + if(oldNum != newNum){ + throw new JeroBootException("企业联系人重复"); + } + } + if(Objects.equals(payWorkingGroupSubItem.getChargeWay(),PayProjectCommon.CHARGE_WAY2)){ if(Objects.isNull(payWorkingGroupSubItem.getReceivableAmount())){ throw new JeroBootException("应收金额不能为空"); @@ -167,7 +176,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listPayWorkingGroupSubItemContactsNew = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); // 添加联系人表 - List listPayWorkingGroupSubItemContacts = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); - if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ - for (int i = 0; i < listPayWorkingGroupSubItemContacts.size(); i++) { - listPayWorkingGroupSubItemContacts.get(i).setOrderNum(i+1); - listPayWorkingGroupSubItemContacts.get(i).setWorkingGroupId(payWorkingGroupSubItem.getWorkingGroupId()); - listPayWorkingGroupSubItemContacts.get(i).setWorkingGroupSubId(payWorkingGroupSubItem.getId()); + if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)){ + for (int i = 0; i < listPayWorkingGroupSubItemContactsNew.size(); i++) { + listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i+1); + listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupId(payWorkingGroupSubItem.getWorkingGroupId()); + listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupSubId(payWorkingGroupSubItem.getId()); } - payWorkingGroupSubItemContactsService.saveBatch(listPayWorkingGroupSubItemContacts); + payWorkingGroupSubItemContactsService.saveBatch(listPayWorkingGroupSubItemContactsNew); } List listFile = new ArrayList<>(); // 获取收费通知 @@ -325,6 +334,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl listPayWorkingGroupSubItemContactsNew = payWorkingGroupSubItem.getPayWorkingGroupSubItemContactsList(); + // 添加联系人表 + if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContactsNew)){ + for (int i = 0; i < listPayWorkingGroupSubItemContactsNew.size(); i++) { + listPayWorkingGroupSubItemContactsNew.get(i).setOrderNum(i+1); + listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupId(payWorkingGroupSubItem.getWorkingGroupId()); + listPayWorkingGroupSubItemContactsNew.get(i).setWorkingGroupSubId(payWorkingGroupSubItem.getId()); + } + payWorkingGroupSubItemContactsService.saveBatch(listPayWorkingGroupSubItemContactsNew); + } payWorkingGroupSubItem.setChargeUse(PayProjectCommon.CHARGE_USE1); // 变更应收金额,重新校验状态 ProjectStatusVO projectStatusVO = projectDetailService.getStatus(payWorkingGroupSubItem.getId(),payWorkingGroupSubItem.getReceivableAmount(),payWorkingGroupSubItem.getNeedInvoice()); @@ -458,7 +478,7 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl{ List listPayWorkingGroupSubItemContacts = p.getPayWorkingGroupSubItemContactsList(); if(!CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ - listPayWorkingGroupSubItemContacts.forEach(s->{ - s.setWorkingGroupId(p.getWorkingGroupId()); - s.setWorkingGroupSubId(p.getId()); - }); + for (int i = 0; i < listPayWorkingGroupSubItemContacts.size(); i++) { + listPayWorkingGroupSubItemContacts.get(i).setWorkingGroupId(p.getWorkingGroupId()); + listPayWorkingGroupSubItemContacts.get(i).setWorkingGroupSubId(p.getId()); + listPayWorkingGroupSubItemContacts.get(i).setOrderNum(i + 1); + } payWorkingGroupSubItemContactsService.saveBatch(listPayWorkingGroupSubItemContacts); } PayIncomeContract payIncomeContract = p.getPayIncomeContract(); @@ -794,9 +815,9 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl"); + msg.append("第").append(count + 3).append("行:企业联系人").append(c).append("与企业联系人").append(num).append("重复,请修改。
"); }else{ - map.put(name,3); + map.put(name,num); } if (!CollectionUtils.isEmpty(listCompany)) { // 通过联系人获取联系人id @@ -1158,15 +1179,13 @@ public class PayWorkingGroupSubItemServiceImpl extends ServiceImpl