diff --git a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java index d645ec842..1031efd6f 100644 --- a/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java +++ b/blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java @@ -2090,55 +2090,51 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl printEntityList = distributionPrintService.list(Wrappers.query().lambda() .eq(DistributionPrintEntity::getBillLadingId, billLadingAppDTO.getBillLadingId()) ); - List addList = new ArrayList<>(); //添加的图片 - ListIterator distributionPrintEntityListIterator = printEntityList.listIterator(); + List aid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNull(i.getId())).collect(Collectors.toList());//添加的图片 + List uid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNotNull(i.getId())).collect(Collectors.toList()); //保存的图片 //添加图片 - billLadingAppDTO.getPrintList().stream().collect(Collectors.groupingBy(BillLadingAppDTO.Print::getState)) - .forEach((k,v) ->{ - - List aid = v.stream().filter(i -> ObjectUtils.isNull(i.getId())).collect(Collectors.toList());//添加的图片 - addList.addAll(aid); + //处理不需要的图片 + while (distributionPrintEntityListIterator.hasNext()){ + for (BillLadingAppDTO.Print q : uid) { + DistributionPrintEntity next = distributionPrintEntityListIterator.next(); + if(q.getId().toString().equals(next.getId().toString())){ + distributionPrintEntityListIterator.remove(); + } - List uid = v.stream().filter(i -> ObjectUtils.isNotNull(i.getId())).collect(Collectors.toList()); //保存的图片 - uid.forEach(q ->{ - //处理不需要的图片 - while (distributionPrintEntityListIterator.hasNext()){ - DistributionPrintEntity next = distributionPrintEntityListIterator.next(); - if(q.getId().equals(next.getId())){ - distributionPrintEntityListIterator.remove(); - } - } - }); - }); - //清除需要删除的图片 + } + } + //清除需要删除的图片 if(!printEntityList.isEmpty()){ List collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList()); distributionPrintService.deleteLogic(collect); } - //新增 - List list2 = new ArrayList<>(); - billLadingAppDTO.getPrintList().forEach(print -> { - DistributionPrintEntity distributionPrintEntity = new DistributionPrintEntity(); - distributionPrintEntity.setBillLadingId(billLadingAppDTO.getBillLadingId()); - distributionPrintEntity.setGenre(Integer.parseInt(print.getState())); - distributionPrintEntity.setSite(print.getUrl()); - distributionPrintEntity.setSiteName(print.getName()); - list2.add(distributionPrintEntity); - }); - - return R.status(distributionPrintService.saveBatch(list2)); + if(!aid.isEmpty()){ + //新增 + List list2 = new ArrayList<>(); + aid.forEach(print -> { + DistributionPrintEntity distributionPrintEntity = new DistributionPrintEntity(); + distributionPrintEntity.setBillLadingId(billLadingAppDTO.getBillLadingId()); + distributionPrintEntity.setGenre(Integer.parseInt(print.getState())); + distributionPrintEntity.setSite(print.getUrl()); + distributionPrintEntity.setSiteName(print.getName()); + list2.add(distributionPrintEntity); + }); + distributionPrintService.saveBatch(list2); + } + //修改数据 + if(ObjectUtils.isNotNull(billLadingAppDTO.getRemark())){ + DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity(); + billLadingEntity.setId(billLadingAppDTO.getBillLadingId()); + billLadingEntity.setRemark(billLadingAppDTO.getRemark()); + baseMapper.updateById(billLadingEntity); + return R.status(true); + } + return R.status(false); } /**