Commit 79d5b30d by 吕明尚

修改自动更新优惠券促销价

parent e1fe8808
......@@ -2,6 +2,7 @@ package share.quartz.task;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dianping.openapi.sdk.api.tuangou.entity.TuangouReceiptGetConsumedReponseEntity;
import org.apache.commons.lang3.math.NumberUtils;
import org.slf4j.Logger;
......@@ -23,6 +24,7 @@ import share.system.service.impl.QPServiceImpl;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@Component("couponRetryTask")
public class CouponRetryTask {
@Autowired
......@@ -149,25 +151,25 @@ public class CouponRetryTask {
public void AutoUpdateCouponPromotionPrice() {
try {
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = new LambdaQueryWrapper<>();
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.isNull(SConsumerCoupon::getPromotionPrice);
LambdaQueryWrapper<SCoupon> sCouponLambdaQueryWrapper = Wrappers.lambdaQuery(SCoupon.class);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getPromotionPrice);
sCouponLambdaQueryWrapper.isNotNull(SCoupon::getSubPrice);
List<SCoupon> couponList = sCouponService.list(sCouponLambdaQueryWrapper);
LambdaQueryWrapper<SConsumerCoupon> consumerCouponWrapper = Wrappers.lambdaQuery(SConsumerCoupon.class);
consumerCouponWrapper.eq(SConsumerCoupon::getIsDelete, YesNoEnum.no.getIndex());
consumerCouponWrapper.eq(SConsumerCoupon::getUseStatus, UserStatusEnum.UNUSED.getCode());
consumerCouponWrapper.in(SConsumerCoupon::getCouponId, couponList.stream().map(SCoupon::getId).collect(Collectors.toList()));
consumerCouponWrapper.isNull(SConsumerCoupon::getPromotionPrice);
List<SConsumerCoupon> sConsumerCouponList = sConsumerCouponService.list(consumerCouponWrapper);
List<SConsumerCoupon> sConsumerCouponList = sConsumerCouponService.list(consumerCouponWrapper);
if (CollectionUtils.isEmpty(sConsumerCouponList)) {
return;
}
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 = sConsumerCouponList.subList(0, 100);
}
Map<Long, SCoupon> dealgroupCouponMap = couponList.stream()
.filter(coupon -> coupon.getDealgroupId() != null && coupon.getPlatformType().equals(PlatformTypeEnum.MEITUAN.getCode()))
......@@ -198,11 +200,11 @@ public class CouponRetryTask {
});
});
if (!CollectionUtils.isEmpty(sConsumerCouponList))
sConsumerCouponService.updateBatchById(sConsumerCouponList);
if (!CollectionUtils.isEmpty(sConsumerCouponList))
sConsumerCouponService.updateBatchById(sConsumerCouponList);
} catch (Exception e) {
e.printStackTrace();
}
}
}
......
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