From 5ee61d4e17bd520707da2e9ec648d2000bee8ea8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A2=81=E7=90=A6=E6=B6=9B?= Date: Tue, 26 Apr 2022 15:31:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E7=BB=84=E5=8F=98=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PayWorkingGroupSubItemController.java | 22 ++++++++++++++----- .../PayWorkingGroupSubItemServiceImpl.java | 18 +++++++-------- 2 files changed, 26 insertions(+), 14 deletions(-) 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 25e66dd3..52092e3b 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 @@ -367,15 +367,27 @@ public class PayWorkingGroupSubItemController extends JeroController listContacts = listPayWorkingGroupSubItem.stream().map(PayWorkingGroupSubItem::getContactsTemporaryIdOne).collect(Collectors.toList()); + List listIds = listPayWorkingGroupSubItem.stream().map(PayWorkingGroupSubItem::getId).collect(Collectors.toList()); + LambdaQueryWrapper queryPayWorkingGroupSubItemContacts = new LambdaQueryWrapper<>(); + queryPayWorkingGroupSubItemContacts.in(PayWorkingGroupSubItemContacts::getWorkingGroupSubId,listIds); + // 查询序号为1的联系人 + queryPayWorkingGroupSubItemContacts.eq(PayWorkingGroupSubItemContacts::getOrderNum,1); + List listPayWorkingGroupSubItemContacts = payWorkingGroupSubItemContactsService.list(queryPayWorkingGroupSubItemContacts); + if(CollectionUtils.isEmpty(listPayWorkingGroupSubItemContacts)){ + return Result.error("联系人不存在!"); + } + List listContacts = listPayWorkingGroupSubItemContacts.stream().map(PayWorkingGroupSubItemContacts::getContactsTemporaryId).collect(Collectors.toList()); List listPayContactsManagementTemporary = payContactsManagementTemporaryService.listByIds(listContacts); if(CollectionUtils.isEmpty(listPayContactsManagementTemporary)){ return Result.error("联系人不存在!"); } - // todo 联系人关联表 + listPayWorkingGroupSubItem.forEach(p->{ - List listContactsInfo = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(p.getContactsTemporaryIdOne(),item.getId())).collect(Collectors.toList()); + List listNew = listPayWorkingGroupSubItemContacts.stream().filter(n->Objects.equals(n.getWorkingGroupSubId(),p.getId())).collect(Collectors.toList()); + if(CollectionUtils.isEmpty(listNew)){ + return; + } + List listContactsInfo = listPayContactsManagementTemporary.stream().filter(item->Objects.equals(listNew.get(0).getContactsTemporaryId(),item.getId())).collect(Collectors.toList()); if(CollectionUtils.isEmpty(listContactsInfo)){ return; } @@ -432,7 +444,7 @@ public class PayWorkingGroupSubItemController extends JeroController finalListPayContactsManagementTemporary = listPayContactsManagementTemporary; + // 获取工作组信息 + PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(list.get(0).getWorkingGroupId()); + if(Objects.isNull(payWorkingGroup)){ + throw new JeroBootException("工作组不存在!"); + } + SysUser sysUserInfo = sysUserService.getById(payWorkingGroup.getPrincipalIdA()); + if(Objects.isNull(sysUserInfo)){ + throw new JeroBootException("负责人不存在!"); + } list.forEach(p->{ - // 获取工作组信息 - PayWorkingGroup payWorkingGroup = payWorkingGroupService.getById(list.get(0).getWorkingGroupId()); - if(Objects.isNull(payWorkingGroup)){ - throw new JeroBootException("工作组不存在!"); - } - SysUser sysUserInfo = sysUserService.getById(payWorkingGroup.getPrincipalIdA()); - if(Objects.isNull(sysUserInfo)){ - throw new JeroBootException("负责人不存在!"); - } LambdaUpdateWrapper updatePayWorkingGroupSubItem = new LambdaUpdateWrapper<>(); // 变更应收金额,重新校验状态 ProjectStatusVO projectStatusVO = projectDetailService.getStatus(p.getId(),input.getReceivableAmount(),p.getNeedInvoice());