Commit 910207c2 authored by 332784038@qq.com's avatar 332784038@qq.com

复制价格业务重构

parent 58df3636
......@@ -3448,8 +3448,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
if (productPriceDOList.size() > 0) {
for (ProductPriceDO price : productPriceDOList) {
ProductPriceAirCreateReqVO createReqVO = new ProductPriceAirCreateReqVO();
BeanUtils.copyProperties(price, createReqVO);
createReqVO.setProductId(Long.parseLong(dto.getProductId()));
......@@ -3469,24 +3467,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
ProductPriceStepDO freightPriceStep = new ProductPriceStepDO();
ProductPriceStepDO clear = new ProductPriceStepDO();
if (createReqVO.getPriceType() == 1) {
if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) {
List<ProductPriceStepPackagingDO> packagingList = new ArrayList<>();
respVO.getFullPricePackagingList().forEach(pack -> {
createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList());
ProductPriceStepDO packagingDO = new ProductPriceStepDO();
BeanUtils.copyProperties(pack, packagingDO);
packagingDO.setId(null);
packagingDO.setStartNum(BigDecimal.valueOf(0));
packagingDO.setEndNum(BigDecimal.valueOf(0));
packagingDO.setWeightUnit(price.getTransportPriceUnit());
// packagingDO.setTransportPrice(pack.getPackagingPrice());
// packagingDO.setTransportPriceUnit(pack.getPackagingPriceUnit());
// packagingDO.setTransportVolumeUnit(pack.getPackagingVolumeUnit());
packagingDO.setAllPrice(respVO.getAllPrice());
packagingDO.setAllPriceUnit(respVO.getAllPriceUnit());
packagingDO.setAllVolumeUnit(respVO.getAllVolumeUnit());
if (CollectionUtil.isNotEmpty(respVO.getFullPriceStepList())) {
respVO.getFullPriceStepList().forEach(pack -> {
ProductPriceStepDO priceStepDO = new ProductPriceStepDO();
BeanUtils.copyProperties(pack, priceStepDO);
priceStepDO.setId(null);
priceStepDO.setStartNum(BigDecimal.valueOf(0));
priceStepDO.setEndNum(BigDecimal.valueOf(0));
priceStepDO.setWeightUnit(price.getTransportPriceUnit());
priceStepDO.setAllPrice(respVO.getAllPrice());
priceStepDO.setAllPriceUnit(respVO.getAllPriceUnit());
priceStepDO.setAllVolumeUnit(respVO.getAllVolumeUnit());
if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) {
List<ProductPriceStepSpecialDO> specialList = new ArrayList<>();
respVO.getSpecialList().forEach(sp -> {
......@@ -3495,94 +3486,93 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
specialDO.setId(null);
specialList.add(specialDO);
});
packagingDO.setSpecialList(specialList);
priceStepDO.setSpecialList(specialList);
}
ProductPriceStepPackagingDO stepPackagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, stepPackagingDO);
packagingList.add(stepPackagingDO);
packagingDO.setPackagingList(packagingList);
fullPriceStepList.add(packagingDO);
fullPriceStepList.add(priceStepDO);
});
createReqVO.setFullPriceStepList(fullPriceStepList);
}
} else {
if (CollectionUtil.isEmpty(respVO.getFreightPriceStepList())) {
BeanUtils.copyProperties(price, freightPriceStep);
freightPriceStep.setStartNum(BigDecimal.valueOf(0));
freightPriceStep.setEndNum(BigDecimal.valueOf(0));
freightPriceStep.setRankNum(1);
freightPriceStep.setWeightUnit(price.getTransportPriceUnit());
freightPriceStep.setProductPriceId(price.getId());
if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) {
List<ProductPriceStepSpecialDO> specialDOList = new ArrayList<>();
respVO.getSpecialList().forEach(sp -> {
ProductPriceStepSpecialDO d = new ProductPriceStepSpecialDO();
BeanUtils.copyProperties(sp, d);
specialDOList.add(d);
});
specialDOList.stream().distinct();
freightPriceStep.setSpecialList(specialDOList);
}
//
if (CollectionUtil.isNotEmpty(respVO.getFreightPricePackagingList())) {
List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>();
respVO.getFreightPricePackagingList().forEach(pack -> {
ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, packagingDO);
stepPackagingDOS.add(packagingDO);
});
stepPackagingDOS.stream().distinct();
freightPriceStep.setPackagingList(stepPackagingDOS);
}
if (respVO.getPriceType() == 1) {
if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) {
List<ProductPriceStepPackagingDO> specialDOList = new ArrayList<>();
respVO.getFullPricePackagingList().forEach(pack -> {
ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, packagingDO);
packagingDO.setId(null);
specialDOList.add(packagingDO);
});
freightPriceStep.setPackagingList(specialDOList);
}
} else {
}
freightPriceStepList.add(freightPriceStep);
createReqVO.setFreightPriceStepList(freightPriceStepList);
} else {
// if (CollectionUtil.isEmpty(respVO.getFreightPriceStepList())) {
// BeanUtils.copyProperties(price, freightPriceStep);
// freightPriceStep.setStartNum(BigDecimal.valueOf(0));
// freightPriceStep.setEndNum(BigDecimal.valueOf(0));
// freightPriceStep.setRankNum(1);
// freightPriceStep.setWeightUnit(price.getTransportPriceUnit());
// freightPriceStep.setProductPriceId(price.getId());
// if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) {
// List<ProductPriceStepSpecialDO> specialDOList = new ArrayList<>();
// respVO.getSpecialList().forEach(sp -> {
// ProductPriceStepSpecialDO d = new ProductPriceStepSpecialDO();
// BeanUtils.copyProperties(sp, d);
// specialDOList.add(d);
// });
// specialDOList.stream().distinct();
// freightPriceStep.setSpecialList(specialDOList);
// }
// //
// if (CollectionUtil.isNotEmpty(respVO.getFreightPricePackagingList())) {
// List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>();
// respVO.getFreightPricePackagingList().forEach(pack -> {
// ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
// BeanUtils.copyProperties(pack, packagingDO);
// stepPackagingDOS.add(packagingDO);
// });
// stepPackagingDOS.stream().distinct();
// freightPriceStep.setPackagingList(stepPackagingDOS);
// }
// if (respVO.getPriceType() == 1) {
// if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) {
// List<ProductPriceStepPackagingDO> specialDOList = new ArrayList<>();
// respVO.getFullPricePackagingList().forEach(pack -> {
// ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
// BeanUtils.copyProperties(pack, packagingDO);
// packagingDO.setId(null);
//
// specialDOList.add(packagingDO);
// });
//
// freightPriceStep.setPackagingList(specialDOList);
//
// }
// } else {
//
// }
// freightPriceStepList.add(freightPriceStep);
//
// createReqVO.setFreightPriceStepList(freightPriceStepList);
// } else {
// createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList());
// }
if (CollectionUtil.isNotEmpty(respVO.getFreightPriceStepList())) {
createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList());
}
if (CollectionUtil.isEmpty(respVO.getClearancePriceStepList())) {
BeanUtils.copyProperties(price, clear);
clear.setStartNum(BigDecimal.valueOf(0));
clear.setEndNum(BigDecimal.valueOf(0));
clear.setRankNum(2);
clear.setWeightUnit(price.getClearancePriceUnit());
clear.setProductPriceId(price.getId());
if (CollectionUtil.isNotEmpty(respVO.getClearancePricePackagingList())) {
List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>();
respVO.getClearancePricePackagingList().forEach(pack -> {
ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, packagingDO);
stepPackagingDOS.add(packagingDO);
});
stepPackagingDOS.stream().distinct();
clear.setPackagingList(stepPackagingDOS);
}
clearancePriceStepList.add(clear);
createReqVO.setClearancePriceStepList(clearancePriceStepList);
} else {
// if (CollectionUtil.isEmpty(respVO.getClearancePriceStepList())) {
// BeanUtils.copyProperties(price, clear);
// clear.setStartNum(BigDecimal.valueOf(0));
// clear.setEndNum(BigDecimal.valueOf(0));
// clear.setRankNum(2);
// clear.setWeightUnit(price.getClearancePriceUnit());
// clear.setProductPriceId(price.getId());
//
// if (CollectionUtil.isNotEmpty(respVO.getClearancePricePackagingList())) {
// List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>();
// respVO.getClearancePricePackagingList().forEach(pack -> {
// ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
// BeanUtils.copyProperties(pack, packagingDO);
// stepPackagingDOS.add(packagingDO);
// });
// stepPackagingDOS.stream().distinct();
// clear.setPackagingList(stepPackagingDOS);
// }
//
// clearancePriceStepList.add(clear);
// createReqVO.setClearancePriceStepList(clearancePriceStepList);
// } else {
// createReqVO.setClearancePriceStepList(respVO.getClearancePriceStepList());
// }
if (CollectionUtil.isNotEmpty(respVO.getClearancePriceStepList())) {
createReqVO.setClearancePriceStepList(respVO.getClearancePriceStepList());
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment