From 2796636b70cb283bc63ada895d450b2618795bd4 Mon Sep 17 00:00:00 2001 From: hupeng Date: Thu, 18 Oct 2018 11:28:16 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8D=A1=E5=88=B8][=E4=BF=AE=E5=A4=8D]:?= =?UTF-8?q?=E5=AE=9A=E5=90=91=E5=8F=91=E5=88=B8=E8=87=AA=E5=8A=A8=E4=B8=8B?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../iformall/schedule/CouponExpiringSchedule.java | 14 ++++++++++++-- .../com/iformall/mapper/WxCouponSendMapper.java | 6 ++---- .../main/resources/mapper/WxCouponSendMapper.xml | 12 +++++++++++- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/mallinkAdmin/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java b/mallinkAdmin/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java index 3d514b742..8090df3b7 100644 --- a/mallinkAdmin/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java +++ b/mallinkAdmin/src/main/java/com/iformall/schedule/CouponExpiringSchedule.java @@ -20,9 +20,11 @@ public class CouponExpiringSchedule { @Autowired private WxCouponChannelMapper wxCouponChannelMapper; + @Autowired + private WxCouponSendMapper wxCouponSendMapper; - @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:05 + @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:05 作废过期券,商户禁用券 //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 public void couponExpiringSchedule() { @@ -30,7 +32,15 @@ public class CouponExpiringSchedule { wxCouponMapper.offExpiriedCouponByMerchantStatus(); } - @Scheduled(cron = "0 3 0 * * ?") // 每天凌晨00:03 + @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:10 下架定向发放 + //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 + public void couponSendExpiringSchedule() { + wxCouponSendMapper.offExpiriedCouponSendBySendEndTime(); + wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); + } + + + @Scheduled(cron = "0 5 0 * * ?") // 每天凌晨00:10 下架主动领取 //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 public void couponChannelExpiringSchedule() { diff --git a/mallinkService/src/main/java/com/iformall/mapper/WxCouponSendMapper.java b/mallinkService/src/main/java/com/iformall/mapper/WxCouponSendMapper.java index da20d3efa..272b12675 100644 --- a/mallinkService/src/main/java/com/iformall/mapper/WxCouponSendMapper.java +++ b/mallinkService/src/main/java/com/iformall/mapper/WxCouponSendMapper.java @@ -9,10 +9,8 @@ public interface WxCouponSendMapper extends CommonMapper { List findList(WxCouponSend wxCouponSend); void updateStatusByCouponId(WxCouponSend wxCouponSend); - - - - + void offExpiriedCouponSendBySendEndTime(); + void offExpiriedCouponSendByCouponStatus(); } diff --git a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml index 34f0666a1..3b8cedc53 100644 --- a/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml +++ b/mallinkService/src/main/resources/mapper/WxCouponSendMapper.xml @@ -101,8 +101,18 @@ + + update wx_coupon_send cs, wx_coupon c + set cs.status=1, cs.update_date = now() + where (cs.status = 0 and c.status = 1 and c.id = cs.coupon_id) + or (cs.status = 0 and c.valid_type = 1 and c.valid_end_date < now()) + - + + update wx_coupon_send + set status=1, update_date = now() + where status = 0 and send_end_time < now() +