Selaa lähdekoodia

[游戏][修改]:当游戏所有券下架后,定时下架游戏

release_toaliyun_real
hupeng 7 vuotta sitten
vanhempi
commit
7e4d3de784
3 muutettua tiedostoa jossa 42 lisäystä ja 0 poistoa
  1. +35
    -0
      mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java
  2. +2
    -0
      mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java
  3. +5
    -0
      mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml

+ 35
- 0
mallinkSchedule/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java Näytä tiedosto

@@ -1,5 +1,10 @@
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 org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -9,6 +14,8 @@ import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Component
public class CouponExpiringSchedule {

@@ -26,6 +33,9 @@ public class CouponExpiringSchedule {
@Autowired
private WxScreenAdMapper wxScreenAdMapper;

@Autowired
private WxGameMapper wxGameMapper;


@Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券
//@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次
@@ -64,4 +74,29 @@ public class CouponExpiringSchedule {
public void couponChannel2ExpiringSchedule() {
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);
}
});
}


}

+ 2
- 0
mallinkService/src/main/java/com/iformall/mapper/WxCouponChannelMapper.java Näytä tiedosto

@@ -13,6 +13,8 @@ public interface WxCouponChannelMapper extends CommonMapper<WxCouponChannel, Str

int countCoupon(WxCouponChannel wxCouponChannel);

int countCouponChannel(WxCouponChannel wxCouponChannel);

List<WxCouponChannelVo> findVoList(WxCouponChannel wxCouponChannel);

WxCouponCVo findVoDetail(@Param("id")Long id);


+ 5
- 0
mallinkService/src/main/resources/mapper/WxCouponChannelMapper.xml Näytä tiedosto

@@ -220,6 +220,11 @@
<include refid="dynamicWhereConditions" />
</select>

<select id="countCouponChannel" parameterType="com.iformall.domain.po.WxCouponChannel" resultType="java.lang.Integer">
select count(*) from wx_coupon_channel cc
<include refid="dynamicWhereConditions" />
</select>

<update id="offExpiriedCouponChannelByEndTime">
update wx_coupon_channel SET status = 1, update_date = now()
where status = 0 and end_time &lt; now()


Ladataan…
Peruuta
Tallenna