Commit e555606f by 吕明尚

增加自动更新优惠券促销金额

parent 768681f2
...@@ -14,12 +14,10 @@ import share.common.enums.PlatformTypeEnum; ...@@ -14,12 +14,10 @@ import share.common.enums.PlatformTypeEnum;
import share.common.enums.UserStatusEnum; import share.common.enums.UserStatusEnum;
import share.common.enums.YesNoEnum; import share.common.enums.YesNoEnum;
import share.system.domain.SConsumerCoupon; import share.system.domain.SConsumerCoupon;
import share.system.domain.SCoupon;
import share.system.domain.SOrder; import share.system.domain.SOrder;
import share.system.domain.SStore; import share.system.domain.SStore;
import share.system.service.ISConsumerCouponService; import share.system.service.*;
import share.system.service.ISStoreService;
import share.system.service.QPService;
import share.system.service.TiktokService;
import share.system.service.impl.QPServiceImpl; import share.system.service.impl.QPServiceImpl;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -34,6 +32,8 @@ public class CouponRetryTask { ...@@ -34,6 +32,8 @@ public class CouponRetryTask {
@Autowired @Autowired
private ISConsumerCouponService sConsumerCouponService; private ISConsumerCouponService sConsumerCouponService;
@Autowired @Autowired
private ISCouponService sCouponService;
@Autowired
private ISStoreService storeService; private ISStoreService storeService;
@Autowired @Autowired
private QPService qpService; private QPService qpService;
...@@ -108,6 +108,35 @@ public class CouponRetryTask { ...@@ -108,6 +108,35 @@ public class CouponRetryTask {
} }
} }
//更新优惠券促销金额
public void AutoUpdateCouponPromotionPrice() {
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.isNull(SConsumerCoupon::getPromotionPrice);
List<SConsumerCoupon> sConsumerCouponList = sConsumerCouponService.list(consumerCouponWrapper);
LambdaQueryWrapper<SCoupon> sCouponLambdaQueryWrapper = new LambdaQueryWrapper<>();
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getPromotionPrice);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getSubPrice);
List<SCoupon> couponList = sCouponService.list(sCouponLambdaQueryWrapper);
if (sConsumerCouponList.size() > 100) {
sConsumerCouponList = sConsumerCouponList.subList(0, 100);
}
sConsumerCouponList.stream().forEach(item -> {
if (item.getPlatformType().equals(PlatformTypeEnum.MEITUAN.getCode())) {
item.setPromotionPrice(couponList.stream().filter(coupon -> coupon.getDealgroupId().equals(item.getDealgroupId())).findFirst().get().getPromotionPrice());
} else if (item.getPlatformType().equals(PlatformTypeEnum.TIKTOK.getCode())) {
item.setPromotionPrice(couponList.stream().filter(coupon -> coupon.getTiktokSkuId().equals(item.getTiktokSkuId())).findFirst().get().getPromotionPrice());
} else if (item.getPlatformType().equals(PlatformTypeEnum.SELF.getCode())) {
item.setPromotionPrice(couponList.stream().filter(coupon -> coupon.getId().equals(item.getCouponId())).findFirst().get().getPromotionPrice());
item.setSubPrice(couponList.stream().filter(coupon -> coupon.getId().equals(item.getCouponId())).findFirst().get().getSubPrice());
}
});
if (!CollectionUtils.isEmpty(sConsumerCouponList))
sConsumerCouponService.updateBatchById(sConsumerCouponList);
}
//补齐美团团购id //补齐美团团购id
public void AutoGenerateTuangouId() { public void AutoGenerateTuangouId() {
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
......
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