记得上下班打卡 | git大法好,push需谨慎

Commit f17acf1e authored by 张国柄's avatar 张国柄

Merge remote-tracking branch 'origin/dev_20211205' into pre

parents 4d2f17d3 ba088ce5
......@@ -28,9 +28,10 @@ public class CandyMgtCouponTaskController {
@PutMapping("issue/coupons")
public ResponseDto<String> issueCoupons() {
LocalDateTime now = LocalDateTime.now();
LambdaQueryWrapper<CandyMgtCoupon> queryWrapper = Wrappers.lambdaQuery(CandyMgtCoupon.class)
.eq(CandyMgtCoupon::getState, 0)
.le(CandyMgtCoupon::getEventAt, LocalDateTime.now())
.le(CandyMgtCoupon::getEventAt, now)
.orderByAsc(CandyMgtCoupon::getEventAt);
List<CandyMgtCoupon> list = platformCandyMgtCouponService.list(queryWrapper);
int taskSize = CollectionUtils.isEmpty(list) ? -1 : list.size(), pl = 0;
......@@ -39,9 +40,13 @@ public class CandyMgtCouponTaskController {
for (int i = 0; i < taskSize; i++) {
CandyMgtCoupon mgtCoupon = list.get(i);
mgtCoupon.setState(9);
mgtCoupon.setUpdatedAt(now);
}
if (platformCandyMgtCouponService.updateBatchById(list)) {
for (int i = 0; i < taskSize; i++) {
CandyMgtCoupon mgtCoupon = list.get(i);
try {
if (platformCandyMgtCouponService.updateById(mgtCoupon)) {
try {
LambdaQueryWrapper<CandyCoupon> couponLambdaQueryWrapper = Wrappers.lambdaQuery(CandyCoupon.class)
.eq(CandyCoupon::getState, 1).eq(CandyCoupon::getCouponId, mgtCoupon.getCouponId());
CandyCoupon coupon = platformCandyCouponService.getOne(couponLambdaQueryWrapper);
......@@ -77,13 +82,12 @@ public class CandyMgtCouponTaskController {
mgtCoupon.getMcouponId(), coupon.getCouType(), coupon.getBindType(), mgtCoupon.getEventAmt(), mgtCoupon.getEventType());
pl++;
} catch (Exception e) {
log.error("发放券任务总数:{},任务{}处理异常[mcouponId:{}]", taskSize, i, mgtCoupon.getMcouponId(), e);
}
} catch (Exception e) {
log.error("发放券任务总数:{},任务{}处理异常[mcouponId:{}]", taskSize, i, mgtCoupon.getMcouponId(), e);
}
}
log.info("发放券任务总数:{},成功处理任务数:{} >>> END END END", taskSize, pl);
return ResponseDto.success(String.format("发放券任务总数:%s,成功处理任务数:%s", taskSize, pl));
}
}
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