!328 fix & improve

Merge pull request !328 from OceansDeep/pg
This commit is contained in:
OceansDeep 2024-01-22 10:57:02 +00:00 committed by Gitee
commit b439d8283f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

View File

@ -35,7 +35,6 @@ import cn.lili.modules.goods.service.WholesaleService;
import cn.lili.modules.goods.sku.GoodsSkuBuilder;
import cn.lili.modules.goods.sku.render.SalesModelRender;
import cn.lili.modules.member.entity.dos.FootPrint;
import cn.lili.modules.member.service.MemberEvaluationService;
import cn.lili.modules.promotion.entity.dos.Coupon;
import cn.lili.modules.promotion.entity.dos.PromotionGoods;
import cn.lili.modules.promotion.entity.dto.search.PromotionGoodsSearchParams;
@ -98,11 +97,6 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
*/
@Autowired
private RocketmqCustomProperties rocketmqCustomProperties;
/**
* 会员评价
*/
@Autowired
private MemberEvaluationService memberEvaluationService;
/**
* 商品
*/
@ -675,7 +669,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
salesModelRenders.stream().filter(i -> i.getSalesMode().equals(goodsOperationDTO.getSalesModel())).findFirst().ifPresent(i -> i.renderBatch(goodsSkuList, goodsOperationDTO));
for (GoodsSku goodsSku : goodsSkuList) {
extendOldSkuValue(goodsSku);
this.renderImages(goodsSku);
this.renderImages(goodsSku, goodsOperationDTO.getGoodsGalleryList());
}
}
@ -707,7 +701,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
extendOldSkuValue(goodsSku);
// 商品销售模式渲染器
salesModelRenders.stream().filter(i -> i.getSalesMode().equals(goodsOperationDTO.getSalesModel())).findFirst().ifPresent(i -> i.renderSingle(goodsSku, goodsOperationDTO));
this.renderImages(goodsSku);
this.renderImages(goodsSku, goodsOperationDTO.getGoodsGalleryList());
}
/**
@ -732,16 +726,20 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
*
* @param goodsSku sku
*/
void renderImages(GoodsSku goodsSku) {
void renderImages(GoodsSku goodsSku, List<String> goodsImages) {
JSONObject jsonObject = JSONUtil.parseObj(goodsSku.getSpecs());
List<Map<String, String>> images = jsonObject.get("images", List.class);
List<String> images = jsonObject.getBeanList("images", String.class);
GoodsGallery goodsGallery;
if (images != null && !images.isEmpty()) {
GoodsGallery goodsGallery = goodsGalleryService.getGoodsGallery(images.get(0).get("url"));
goodsSku.setBig(goodsGallery.getOriginal());
goodsSku.setOriginal(goodsGallery.getOriginal());
goodsSku.setThumbnail(goodsGallery.getThumbnail());
goodsSku.setSmall(goodsGallery.getSmall());
goodsGallery = goodsGalleryService.getGoodsGallery(images.get(0));
} else {
goodsGallery = goodsGalleryService.getGoodsGallery(goodsImages.get(0));
}
goodsSku.setBig(goodsGallery.getOriginal());
goodsSku.setOriginal(goodsGallery.getOriginal());
goodsSku.setThumbnail(goodsGallery.getThumbnail());
goodsSku.setSmall(goodsGallery.getSmall());
}
/**