| @@ -52,8 +52,8 @@ public class CouponExpiringSchedule { | |||||
| List<WxMall> malls = getMalls(); | List<WxMall> malls = getMalls(); | ||||
| for (WxMall mall : malls) { | for (WxMall mall : malls) { | ||||
| try { | try { | ||||
| wxCouponMapper.offExpiriedCouponByValidDate(); | |||||
| wxCouponMapper.offExpiriedCouponByMerchantStatus(); | |||||
| wxCouponMapper.offExpiriedCouponByValidDate(mall.getTenantId()); | |||||
| wxCouponMapper.offExpiriedCouponByMerchantStatus(mall.getTenantId()); | |||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); | wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); | ||||
| wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); | wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); | ||||
| @@ -28,9 +28,9 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| Integer backInventory(@Param("id")Long id,@Param("tenantId")String tenantId, @Param("number")Integer number,@Param("remainInventory")Integer remainInventory); | Integer backInventory(@Param("id")Long id,@Param("tenantId")String tenantId, @Param("number")Integer number,@Param("remainInventory")Integer remainInventory); | ||||
| void offExpiriedCouponByValidDate(); | |||||
| void offExpiriedCouponByValidDate(@Param("tenantId")String tenantId); | |||||
| void offExpiriedCouponByMerchantStatus(); | |||||
| void offExpiriedCouponByMerchantStatus(@Param("tenantId")String tenantId); | |||||
| /** | /** | ||||
| * 查询时间段内销售金额 | * 查询时间段内销售金额 | ||||
| @@ -684,15 +684,15 @@ | |||||
| update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and tenant_id =#{tenantId} and remain_inventory + #{number} <= inventory | update wx_coupon SET remain_inventory = remain_inventory + #{number} where id = #{id} and tenant_id =#{tenantId} and remain_inventory + #{number} <= inventory | ||||
| </update> | </update> | ||||
| <update id="offExpiriedCouponByValidDate"> | |||||
| <update id="offExpiriedCouponByValidDate" parameterType="String"> | |||||
| update wx_coupon SET status = 1, update_date = now() | update wx_coupon SET status = 1, update_date = now() | ||||
| where status = 0 and valid_type = 1 and valid_end_date < now() | |||||
| where status = 0 and tenant_id =#{tenantId} and valid_type = 1 and valid_end_date < now() | |||||
| </update> | </update> | ||||
| <update id="offExpiriedCouponByMerchantStatus"> | |||||
| <update id="offExpiriedCouponByMerchantStatus" parameterType="String"> | |||||
| update wx_coupon c | update wx_coupon c | ||||
| SET c.status = 1, c.update_date = now() | SET c.status = 1, c.update_date = now() | ||||
| where c.status = 0 and | |||||
| where c.status = 0 and c.tenant_id =#{tenantId} and | |||||
| (select count(*) from wx_coupon_merchant cm, wx_merchant m | (select count(*) from wx_coupon_merchant cm, wx_merchant m | ||||
| where m.id = cm.merchant_id | where m.id = cm.merchant_id | ||||
| and c.id = cm.product_id | and c.id = cm.product_id | ||||