代码优化,修复订单投诉问题
This commit is contained in:
@@ -253,14 +253,17 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
try {
|
||||
log.info("更新商品索引促销信息: {}", promotionsJsonStr);
|
||||
JSONObject jsonObject = JSONUtil.parseObj(promotionsJsonStr);
|
||||
// 转换为详细的促销信息(注:促销信息必须继承自 BasePromotions,且必须保证派生类存在与sdk包下)
|
||||
BasePromotions promotions = (BasePromotions) jsonObject.get("promotions",
|
||||
ClassLoaderUtil.loadClass(jsonObject.get("promotionsType").toString()));
|
||||
// 获取促销唯一key,由 促销类型 + 促销id 组成
|
||||
String esPromotionKey = jsonObject.get("esPromotionKey").toString();
|
||||
if (PromotionsScopeTypeEnum.PORTION_GOODS.name().equals(promotions.getScopeType())) {
|
||||
PromotionGoodsSearchParams searchParams = new PromotionGoodsSearchParams();
|
||||
searchParams.setPromotionId(promotions.getId());
|
||||
List<PromotionGoods> promotionGoodsList = this.promotionGoodsService.listFindAll(searchParams);
|
||||
List<String> skuIds = promotionGoodsList.stream().map(PromotionGoods::getSkuId).collect(Collectors.toList());
|
||||
// 更新商品索引促销信息(删除原索引中相关的促销信息,更新索引中促销信息)
|
||||
this.goodsIndexService.deleteEsGoodsPromotionByPromotionKey(skuIds, esPromotionKey);
|
||||
this.goodsIndexService.updateEsGoodsIndexByList(promotionGoodsList, promotions, esPromotionKey);
|
||||
} else if (PromotionsScopeTypeEnum.PORTION_GOODS_CATEGORY.name().equals(promotions.getScopeType())) {
|
||||
@@ -268,9 +271,11 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
searchParams.setCategoryPath(promotions.getScopeId());
|
||||
List<GoodsSku> goodsSkuByList = this.goodsSkuService.getGoodsSkuByList(searchParams);
|
||||
List<String> skuIds = goodsSkuByList.stream().map(GoodsSku::getId).collect(Collectors.toList());
|
||||
// 更新商品索引促销信息(删除原索引中相关的促销信息,更新索引中促销信息)
|
||||
this.goodsIndexService.deleteEsGoodsPromotionByPromotionKey(skuIds, esPromotionKey);
|
||||
this.goodsIndexService.updateEsGoodsIndexPromotions(skuIds, promotions, esPromotionKey);
|
||||
} else if (PromotionsScopeTypeEnum.ALL.name().equals(promotions.getScopeType())) {
|
||||
// 更新商品索引促销信息(删除原索引中相关的促销信息,更新索引中促销信息)
|
||||
this.goodsIndexService.deleteEsGoodsPromotionByPromotionKey(esPromotionKey);
|
||||
this.goodsIndexService.updateEsGoodsIndexAllByList(promotions, esPromotionKey);
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ public class CouponExecute implements EveryDayExecute {
|
||||
*/
|
||||
@Override
|
||||
public void execute() {
|
||||
//将过期优惠券变更为过期状体
|
||||
//将过期优惠券变更为过期状态
|
||||
LambdaUpdateWrapper<MemberCoupon> updateWrapper = new LambdaUpdateWrapper<MemberCoupon>()
|
||||
.eq(MemberCoupon::getMemberCouponStatus, MemberCouponStatusEnum.NEW.name())
|
||||
.le(MemberCoupon::getEndTime, new Date())
|
||||
|
||||
Reference in New Issue
Block a user