feat: 小程序订单过期返还券
This commit is contained in:
parent
ab78aa6ac8
commit
7995746c5d
|
|
@ -450,6 +450,25 @@ public class TbOrderInfoServiceImpl implements TbOrderInfoService {
|
||||||
keys.add(CacheKey.PRODUCT_SKU + detail.getShopId() + ":" + detail.getId());
|
keys.add(CacheKey.PRODUCT_SKU + detail.getShopId() + ":" + detail.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 查询是否消耗了积分优惠券返还对应的卷或商品
|
||||||
|
if (tbOrderInfo.getCouponInfoList() != null) {
|
||||||
|
OrderCouponInfoDTO couponInfoDTO = JSONObject.parseObject(tbOrderInfo.getCouponInfoList(), OrderCouponInfoDTO.class);
|
||||||
|
// 券返还
|
||||||
|
if (!couponInfoDTO.getOutRecordList().isEmpty()) {
|
||||||
|
couponInfoDTO.getOutRecordList().forEach(item -> {
|
||||||
|
item.setRefNum(item.getUseNum());
|
||||||
|
});
|
||||||
|
shopCouponService.refund(couponInfoDTO.getOutRecordList());
|
||||||
|
couponInfoDTO.setOutRecordList(new ArrayList<>());
|
||||||
|
tbOrderInfo.setCouponInfoList(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 返还积分
|
||||||
|
if (tbOrderInfo.getPointsNum() != null && tbOrderInfo.getPointsNum() != 0 && tbOrderInfo.getMemberId() != null) {
|
||||||
|
memberPointsService.addPoints(Long.valueOf(tbOrderInfo.getMemberId()), tbOrderInfo.getPointsNum(), "订单取消返还: " + tbOrderInfo.getPointsNum() + "积分", Long.valueOf(orderInfo.getId()));
|
||||||
|
}
|
||||||
|
|
||||||
mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, tbOrderInfo.getId());
|
mpCashierCartService.updateStateByOrderId(TableConstant.OrderInfo.Status.CLOSED, tbOrderInfo.getId());
|
||||||
String[] keysArray = keys.toArray(new String[keys.size()]);
|
String[] keysArray = keys.toArray(new String[keys.size()]);
|
||||||
redisUtils.del(keysArray);
|
redisUtils.del(keysArray);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue