Browse Source

修噶PDA自提图片提交删除

single_db
caoyizhong 10 months ago
parent
commit
64c91fc492
  1. 72
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

72
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -2090,55 +2090,51 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
*/
@Override
public R updateReceivedImage(BillLadingAppDTO billLadingAppDTO) {
//修改数据
if(ObjectUtils.isNotNull(billLadingAppDTO.getRemark())){
DistrilbutionBillLadingEntity billLadingEntity = new DistrilbutionBillLadingEntity();
billLadingEntity.setId(billLadingAppDTO.getBillLadingId());
billLadingEntity.setRemark(billLadingAppDTO.getRemark());
baseMapper.updateById(billLadingEntity);
}
//查询全部的图片
List<DistributionPrintEntity> printEntityList = distributionPrintService.list(Wrappers.<DistributionPrintEntity>query().lambda()
.eq(DistributionPrintEntity::getBillLadingId, billLadingAppDTO.getBillLadingId())
);
List<BillLadingAppDTO.Print> addList = new ArrayList<>(); //添加的图片
ListIterator<DistributionPrintEntity> distributionPrintEntityListIterator = printEntityList.listIterator();
List<BillLadingAppDTO.Print> aid = billLadingAppDTO.getPrintList().stream().filter(i -> ObjectUtils.isNull(i.getId())).collect(Collectors.toList());//添加的图片
List<BillLadingAppDTO.Print> 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<BillLadingAppDTO.Print> 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<BillLadingAppDTO.Print> 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<Long> collect = printEntityList.stream().map(DistributionPrintEntity::getId).collect(Collectors.toList());
distributionPrintService.deleteLogic(collect);
}
//新增
List<DistributionPrintEntity> 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<DistributionPrintEntity> 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);
}
/**

Loading…
Cancel
Save