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

复制价格业务重构

parent 58df3636
...@@ -3448,8 +3448,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper, ...@@ -3448,8 +3448,6 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
if (productPriceDOList.size() > 0) { if (productPriceDOList.size() > 0) {
for (ProductPriceDO price : productPriceDOList) { for (ProductPriceDO price : productPriceDOList) {
ProductPriceAirCreateReqVO createReqVO = new ProductPriceAirCreateReqVO(); ProductPriceAirCreateReqVO createReqVO = new ProductPriceAirCreateReqVO();
BeanUtils.copyProperties(price, createReqVO); BeanUtils.copyProperties(price, createReqVO);
createReqVO.setProductId(Long.parseLong(dto.getProductId())); createReqVO.setProductId(Long.parseLong(dto.getProductId()));
...@@ -3469,24 +3467,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper, ...@@ -3469,24 +3467,17 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
ProductPriceStepDO freightPriceStep = new ProductPriceStepDO(); ProductPriceStepDO freightPriceStep = new ProductPriceStepDO();
ProductPriceStepDO clear = new ProductPriceStepDO(); ProductPriceStepDO clear = new ProductPriceStepDO();
if (createReqVO.getPriceType() == 1) { if (createReqVO.getPriceType() == 1) {
if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) { if (CollectionUtil.isNotEmpty(respVO.getFullPriceStepList())) {
List<ProductPriceStepPackagingDO> packagingList = new ArrayList<>(); respVO.getFullPriceStepList().forEach(pack -> {
respVO.getFullPricePackagingList().forEach(pack -> { ProductPriceStepDO priceStepDO = new ProductPriceStepDO();
BeanUtils.copyProperties(pack, priceStepDO);
createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList()); priceStepDO.setId(null);
priceStepDO.setStartNum(BigDecimal.valueOf(0));
ProductPriceStepDO packagingDO = new ProductPriceStepDO(); priceStepDO.setEndNum(BigDecimal.valueOf(0));
BeanUtils.copyProperties(pack, packagingDO); priceStepDO.setWeightUnit(price.getTransportPriceUnit());
packagingDO.setId(null); priceStepDO.setAllPrice(respVO.getAllPrice());
packagingDO.setStartNum(BigDecimal.valueOf(0)); priceStepDO.setAllPriceUnit(respVO.getAllPriceUnit());
packagingDO.setEndNum(BigDecimal.valueOf(0)); priceStepDO.setAllVolumeUnit(respVO.getAllVolumeUnit());
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.getSpecialList())) { if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) {
List<ProductPriceStepSpecialDO> specialList = new ArrayList<>(); List<ProductPriceStepSpecialDO> specialList = new ArrayList<>();
respVO.getSpecialList().forEach(sp -> { respVO.getSpecialList().forEach(sp -> {
...@@ -3495,94 +3486,93 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper, ...@@ -3495,94 +3486,93 @@ public class ProductPriceServiceImpl extends AbstractService<ProductPriceMapper,
specialDO.setId(null); specialDO.setId(null);
specialList.add(specialDO); specialList.add(specialDO);
}); });
packagingDO.setSpecialList(specialList); priceStepDO.setSpecialList(specialList);
} }
fullPriceStepList.add(priceStepDO);
ProductPriceStepPackagingDO stepPackagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, stepPackagingDO);
packagingList.add(stepPackagingDO);
packagingDO.setPackagingList(packagingList);
fullPriceStepList.add(packagingDO);
}); });
createReqVO.setFullPriceStepList(fullPriceStepList); createReqVO.setFullPriceStepList(fullPriceStepList);
} }
} else { } else {
if (CollectionUtil.isEmpty(respVO.getFreightPriceStepList())) { // if (CollectionUtil.isEmpty(respVO.getFreightPriceStepList())) {
BeanUtils.copyProperties(price, freightPriceStep); // BeanUtils.copyProperties(price, freightPriceStep);
freightPriceStep.setStartNum(BigDecimal.valueOf(0)); // freightPriceStep.setStartNum(BigDecimal.valueOf(0));
freightPriceStep.setEndNum(BigDecimal.valueOf(0)); // freightPriceStep.setEndNum(BigDecimal.valueOf(0));
freightPriceStep.setRankNum(1); // freightPriceStep.setRankNum(1);
freightPriceStep.setWeightUnit(price.getTransportPriceUnit()); // freightPriceStep.setWeightUnit(price.getTransportPriceUnit());
freightPriceStep.setProductPriceId(price.getId()); // freightPriceStep.setProductPriceId(price.getId());
if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) { // if (CollectionUtil.isNotEmpty(respVO.getSpecialList())) {
List<ProductPriceStepSpecialDO> specialDOList = new ArrayList<>(); // List<ProductPriceStepSpecialDO> specialDOList = new ArrayList<>();
respVO.getSpecialList().forEach(sp -> { // respVO.getSpecialList().forEach(sp -> {
ProductPriceStepSpecialDO d = new ProductPriceStepSpecialDO(); // ProductPriceStepSpecialDO d = new ProductPriceStepSpecialDO();
BeanUtils.copyProperties(sp, d); // BeanUtils.copyProperties(sp, d);
specialDOList.add(d); // specialDOList.add(d);
}); // });
specialDOList.stream().distinct(); // specialDOList.stream().distinct();
freightPriceStep.setSpecialList(specialDOList); // freightPriceStep.setSpecialList(specialDOList);
} // }
// // //
if (CollectionUtil.isNotEmpty(respVO.getFreightPricePackagingList())) { // if (CollectionUtil.isNotEmpty(respVO.getFreightPricePackagingList())) {
List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>(); // List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>();
respVO.getFreightPricePackagingList().forEach(pack -> { // respVO.getFreightPricePackagingList().forEach(pack -> {
ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO(); // ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, packagingDO); // BeanUtils.copyProperties(pack, packagingDO);
stepPackagingDOS.add(packagingDO); // stepPackagingDOS.add(packagingDO);
}); // });
stepPackagingDOS.stream().distinct(); // stepPackagingDOS.stream().distinct();
freightPriceStep.setPackagingList(stepPackagingDOS); // freightPriceStep.setPackagingList(stepPackagingDOS);
} // }
if (respVO.getPriceType() == 1) { // if (respVO.getPriceType() == 1) {
if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) { // if (CollectionUtil.isNotEmpty(respVO.getFullPricePackagingList())) {
List<ProductPriceStepPackagingDO> specialDOList = new ArrayList<>(); // List<ProductPriceStepPackagingDO> specialDOList = new ArrayList<>();
respVO.getFullPricePackagingList().forEach(pack -> { // respVO.getFullPricePackagingList().forEach(pack -> {
ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO(); // ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
BeanUtils.copyProperties(pack, packagingDO); // BeanUtils.copyProperties(pack, packagingDO);
packagingDO.setId(null); // packagingDO.setId(null);
//
specialDOList.add(packagingDO); // specialDOList.add(packagingDO);
}); // });
//
freightPriceStep.setPackagingList(specialDOList); // freightPriceStep.setPackagingList(specialDOList);
//
} // }
} else { // } else {
//
} // }
freightPriceStepList.add(freightPriceStep); // freightPriceStepList.add(freightPriceStep);
//
createReqVO.setFreightPriceStepList(freightPriceStepList); // createReqVO.setFreightPriceStepList(freightPriceStepList);
} else { // } else {
// createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList());
// }
if (CollectionUtil.isNotEmpty(respVO.getFreightPriceStepList())) {
createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList()); createReqVO.setFreightPriceStepList(respVO.getFreightPriceStepList());
} }
// if (CollectionUtil.isEmpty(respVO.getClearancePriceStepList())) {
if (CollectionUtil.isEmpty(respVO.getClearancePriceStepList())) { // BeanUtils.copyProperties(price, clear);
BeanUtils.copyProperties(price, clear); // clear.setStartNum(BigDecimal.valueOf(0));
clear.setStartNum(BigDecimal.valueOf(0)); // clear.setEndNum(BigDecimal.valueOf(0));
clear.setEndNum(BigDecimal.valueOf(0)); // clear.setRankNum(2);
clear.setRankNum(2); // clear.setWeightUnit(price.getClearancePriceUnit());
clear.setWeightUnit(price.getClearancePriceUnit()); // clear.setProductPriceId(price.getId());
clear.setProductPriceId(price.getId()); //
// if (CollectionUtil.isNotEmpty(respVO.getClearancePricePackagingList())) {
if (CollectionUtil.isNotEmpty(respVO.getClearancePricePackagingList())) { // List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>();
List<ProductPriceStepPackagingDO> stepPackagingDOS = new ArrayList<>(); // respVO.getClearancePricePackagingList().forEach(pack -> {
respVO.getClearancePricePackagingList().forEach(pack -> { // ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO();
ProductPriceStepPackagingDO packagingDO = new ProductPriceStepPackagingDO(); // BeanUtils.copyProperties(pack, packagingDO);
BeanUtils.copyProperties(pack, packagingDO); // stepPackagingDOS.add(packagingDO);
stepPackagingDOS.add(packagingDO); // });
}); // stepPackagingDOS.stream().distinct();
stepPackagingDOS.stream().distinct(); // clear.setPackagingList(stepPackagingDOS);
clear.setPackagingList(stepPackagingDOS); // }
} //
// clearancePriceStepList.add(clear);
clearancePriceStepList.add(clear); // createReqVO.setClearancePriceStepList(clearancePriceStepList);
createReqVO.setClearancePriceStepList(clearancePriceStepList); // } else {
} else { // createReqVO.setClearancePriceStepList(respVO.getClearancePriceStepList());
// }
if (CollectionUtil.isNotEmpty(respVO.getClearancePriceStepList())) {
createReqVO.setClearancePriceStepList(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