| @@ -10,6 +10,7 @@ import com.iformall.domain.po.WxMerchant; | |||||
| import com.iformall.enums.EnumPayWay; | import com.iformall.enums.EnumPayWay; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.mapper.WxCouponChannelMapper; | import com.iformall.mapper.WxCouponChannelMapper; | ||||
| import com.iformall.mapper.WxCouponMapper; | |||||
| import com.iformall.mapper.WxMerchantMapper; | import com.iformall.mapper.WxMerchantMapper; | ||||
| import com.iformall.service.QrCodeService; | import com.iformall.service.QrCodeService; | ||||
| import com.iformall.utils.Constant; | import com.iformall.utils.Constant; | ||||
| @@ -41,6 +42,9 @@ public class WxAppinfoController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| private WxCouponChannelMapper wxCouponChannelMapper; | private WxCouponChannelMapper wxCouponChannelMapper; | ||||
| @Autowired | |||||
| WxCouponMapper wxCouponMapper; | |||||
| ExecutorService fixedThreadPool = Executors.newFixedThreadPool(150); | ExecutorService fixedThreadPool = Executors.newFixedThreadPool(150); | ||||
| @@ -135,8 +139,5 @@ public class WxAppinfoController extends BaseController { | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -53,7 +53,7 @@ public class CouponExpiringSchedule { | |||||
| for (WxMall mall : malls) { | for (WxMall mall : malls) { | ||||
| try { | try { | ||||
| wxCouponMapper.offExpiriedCouponByValidDate(mall.getTenantId()); | wxCouponMapper.offExpiriedCouponByValidDate(mall.getTenantId()); | ||||
| wxCouponMapper.offExpiriedCouponByMerchantStatus(mall.getTenantId()); | |||||
| wxCouponMapper.offExpiriedCouponByMerchantStatus(mall.getTenantId(),wxCouponMapper.getValidMerchantProductIds(mall.getTenantId())); | |||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(mall.getTenantId()); | wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(mall.getTenantId()); | ||||
| wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); | wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); | ||||
| @@ -31,7 +31,8 @@ public interface WxCouponMapper extends CommonMapper<WxCoupon, Long> { | |||||
| void offExpiriedCouponByValidDate(@Param("tenantId")String tenantId); | void offExpiriedCouponByValidDate(@Param("tenantId")String tenantId); | ||||
| void offExpiriedCouponByMerchantStatus(@Param("tenantId")String tenantId); | |||||
| List<Long> getValidMerchantProductIds(@Param("tenantId")String tenantId); | |||||
| void offExpiriedCouponByMerchantStatus(@Param("tenantId")String tenantId,@Param("validIds")List<Long> validIds); | |||||
| /** | /** | ||||
| * 查询时间段内销售金额 | * 查询时间段内销售金额 | ||||
| @@ -713,16 +713,24 @@ | |||||
| where status = 0 and tenant_id =#{tenantId} 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" parameterType="String"> | |||||
| <update id="offExpiriedCouponByMerchantStatus" parameterType="HashMap"> | |||||
| 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 c.tenant_id =#{tenantId} and | |||||
| (select count(*) from wx_coupon_merchant cm, wx_merchant m | |||||
| where c.status = 0 and c.tenant_id =#{tenantId} | |||||
| <if test=" null != validIds "> | |||||
| and c.id not in | |||||
| <foreach collection="validIds" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| </update> | |||||
| <select id="getValidMerchantProductIds" resultType="Long"> | |||||
| select cm.product_id 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 cm.status = 0 | and cm.status = 0 | ||||
| and m.status = 1) = 0 | |||||
| </update> | |||||
| and m.status = 1 | |||||
| </select> | |||||
| <select id="findSaleMoneyByDate" | <select id="findSaleMoneyByDate" | ||||
| resultType="com.iformall.domain.vo.WxCouponStatisVo"> | resultType="com.iformall.domain.vo.WxCouponStatisVo"> | ||||