|
|
@@ -1,5 +1,10 @@ |
|
|
package com.iformall.schedule; |
|
|
package com.iformall.schedule; |
|
|
|
|
|
|
|
|
|
|
|
import com.iformall.domain.po.WxCouponChannel; |
|
|
|
|
|
import com.iformall.domain.po.WxGame; |
|
|
|
|
|
import com.iformall.enums.EnumCouponChannelStatus; |
|
|
|
|
|
import com.iformall.enums.EnumCouponChannelType; |
|
|
|
|
|
import com.iformall.enums.EnumGameStatus; |
|
|
import com.iformall.mapper.*; |
|
|
import com.iformall.mapper.*; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.Logger; |
|
|
import org.slf4j.LoggerFactory; |
|
|
import org.slf4j.LoggerFactory; |
|
|
@@ -9,6 +14,8 @@ import org.springframework.stereotype.Component; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Propagation; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
@Component |
|
|
@Component |
|
|
public class CouponExpiringSchedule { |
|
|
public class CouponExpiringSchedule { |
|
|
|
|
|
|
|
|
@@ -26,6 +33,9 @@ public class CouponExpiringSchedule { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private WxScreenAdMapper wxScreenAdMapper; |
|
|
private WxScreenAdMapper wxScreenAdMapper; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private WxGameMapper wxGameMapper; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券 |
|
|
@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券 |
|
|
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 |
|
|
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 |
|
|
@@ -64,4 +74,29 @@ public class CouponExpiringSchedule { |
|
|
public void couponChannel2ExpiringSchedule() { |
|
|
public void couponChannel2ExpiringSchedule() { |
|
|
wxCouponChannelMapper.offExpiriedCouponChannel2ByEndTime(); |
|
|
wxCouponChannelMapper.offExpiriedCouponChannel2ByEndTime(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Scheduled(cron = "0 20 0 * * ?") // 每天凌晨00:20 下架游戏 |
|
|
|
|
|
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 |
|
|
|
|
|
public void gameExpiringSchedule() { |
|
|
|
|
|
WxGame wxGame = new WxGame(); |
|
|
|
|
|
wxGame.setStatus(EnumGameStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
|
|
|
|
|
|
List<WxGame> list = wxGameMapper.findList(wxGame); |
|
|
|
|
|
list.stream().forEach(g->{ |
|
|
|
|
|
WxCouponChannel couponChannel = new WxCouponChannel(); |
|
|
|
|
|
couponChannel.setTenantId(g.getTenantId()); |
|
|
|
|
|
couponChannel.setTargetAd(EnumCouponChannelType.COUPON_CHANNEL_ID_GAME.getCode()); |
|
|
|
|
|
couponChannel.setSubTargetId(g.getId()); |
|
|
|
|
|
couponChannel.setStatus(EnumCouponChannelStatus.STATUS_THROW_IN.getCode()); |
|
|
|
|
|
int count = wxCouponChannelMapper.countCouponChannel(couponChannel); |
|
|
|
|
|
if (count == 0) { |
|
|
|
|
|
WxGame record = new WxGame(); |
|
|
|
|
|
record.setId(g.getId()); |
|
|
|
|
|
record.setStatus(EnumGameStatus.STATUS_TAKE_OFFF.getCode()); |
|
|
|
|
|
wxGameMapper.updateByPrimaryKeySelective(record); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |