|
|
@@ -130,6 +130,30 @@ public class CmsGoodsDonSpecServiceImpl extends ServiceImpl<GoodsDonSpecMapper,
|
|
|
spec.setGoodsId(insert.getGoodsId());
|
|
|
spec.setMaxId(maxId);
|
|
|
spec.setSpecsJson(Jsons.toJson(specs));
|
|
|
+ if (goods.getType() == 2) {
|
|
|
+ List<ReqGoodsSkuSpec> specJsonList = Jsons.parseList(spec.getSpecsJson(), ReqGoodsSkuSpec.class);
|
|
|
+ for (ReqGoodsSkuSpec skuSpec : specJsonList) {
|
|
|
+ if ("套餐".equals(skuSpec.getKey())) {
|
|
|
+ BigDecimal benefitsPrice = null;
|
|
|
+ for (ReqGoodsSkuSpec.Node value : skuSpec.getValues()) {
|
|
|
+ String benefitsList = value.getBenefitsList();
|
|
|
+ if (StrUtil.isEmpty(benefitsList)) {
|
|
|
+ value.setBenefitsPrice(null);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ List<GoodsDonSku> goodsDonSkus = Jsons.parseList(benefitsList, GoodsDonSku.class);
|
|
|
+ if (CollUtil.isEmpty(goodsDonSkus)) {
|
|
|
+ value.setBenefitsPrice(null);
|
|
|
+ }
|
|
|
+ List<Long> skuIds = goodsDonSkus.stream().map(GoodsDonSku::getId).collect(Collectors.toList());
|
|
|
+ benefitsPrice = goodsDonSkuMapper.sumMoneyBySkuId(skuIds);
|
|
|
+ value.setBenefitsPrice(benefitsPrice);
|
|
|
+ }
|
|
|
+ spec.setSpecsJson(Jsons.toJson(specJsonList));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
spec.setSpecNumber(specNumber);
|
|
|
spec.setSpecMapping(Jsons.toJson(map));
|
|
|
if (insert.getId() != null) {
|