| @@ -55,7 +55,7 @@ public class CouponExpiringSchedule { | |||||
| wxCouponMapper.offExpiriedCouponByValidDate(mall.getTenantId()); | wxCouponMapper.offExpiriedCouponByValidDate(mall.getTenantId()); | ||||
| wxCouponMapper.offExpiriedCouponByMerchantStatus(mall.getTenantId()); | wxCouponMapper.offExpiriedCouponByMerchantStatus(mall.getTenantId()); | ||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); | |||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(mall.getTenantId()); | |||||
| wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); | wxCouponChannelMapper.offExpiriedCouponChannelByCouponStatus(mall.getTenantId()); | ||||
| }catch(Exception e) { | }catch(Exception e) { | ||||
| logger.error("couponExpiringSchedule error.mall:"+mall.getTenantId(),e); | logger.error("couponExpiringSchedule error.mall:"+mall.getTenantId(),e); | ||||
| @@ -66,7 +66,14 @@ public class CouponExpiringSchedule { | |||||
| @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架定向发放 | @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架定向发放 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void couponSendExpiringSchedule() { | public void couponSendExpiringSchedule() { | ||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(); | |||||
| List<WxMall> malls = getMalls(); | |||||
| for (WxMall mall : malls) { | |||||
| try { | |||||
| wxCouponSendMapper.offExpiriedCouponSendByCouponStatus(mall.getTenantId()); | |||||
| }catch(Exception e) { | |||||
| logger.error("couponExpiringSchedule error.mall:"+mall.getTenantId(),e); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架主动领取 | @Scheduled(cron = "0 10 0 * * ?") // 每天凌晨00:10 下架主动领取 | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.schedule; | package com.iformall.schedule; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.po.WxMall; | |||||
| import com.iformall.domain.po.WxProfitSharingOrder; | import com.iformall.domain.po.WxProfitSharingOrder; | ||||
| import com.iformall.enums.EnumProfitSharingOrderStatus; | import com.iformall.enums.EnumProfitSharingOrderStatus; | ||||
| import com.iformall.mapper.*; | import com.iformall.mapper.*; | ||||
| @@ -24,40 +25,51 @@ public class SharingOrderResultSchedule { | |||||
| @Autowired | @Autowired | ||||
| private WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | private WxProfitSharingOrderMapper wxProfitSharingOrderMapper; | ||||
| @Autowired | |||||
| WxMallMapper wxMallMapper; | |||||
| private List<WxMall> getMalls() { | |||||
| WxMall wxMall =new WxMall(); | |||||
| return wxMallMapper.findList(wxMall); | |||||
| } | |||||
| @Scheduled(cron = "0 15 0 * * ?") // 每天凌晨00:15更新分账结果 | @Scheduled(cron = "0 15 0 * * ?") // 每天凌晨00:15更新分账结果 | ||||
| //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | //@Scheduled(cron = "*/10 * * * * ?") // 测试10秒中一次 | ||||
| public void sharingOrderResultSchedule() { | public void sharingOrderResultSchedule() { | ||||
| WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | |||||
| wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); | |||||
| List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | |||||
| for(WxProfitSharingOrder sharingOrder : list) { | |||||
| try { | |||||
| ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); | |||||
| logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() | |||||
| + " ID:" +sharingOrder.getId() | |||||
| + " MSG:" + result.message); | |||||
| } catch (Exception e){ | |||||
| logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() | |||||
| + " ID:" +sharingOrder.getId() | |||||
| + " MSG:" + e.getMessage()); | |||||
| } | |||||
| } | |||||
| wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getCode()); | |||||
| list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | |||||
| for(WxProfitSharingOrder sharingOrder : list) { | |||||
| try { | |||||
| ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); | |||||
| logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() | |||||
| + " ID:" + sharingOrder.getId() | |||||
| + " MSG:" + result.message); | |||||
| } catch (Exception e){ | |||||
| logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() | |||||
| + " ID:" +sharingOrder.getId() | |||||
| + " MSG:" + e.getMessage()); | |||||
| } | |||||
| } | |||||
| List<WxMall> malls = getMalls(); | |||||
| for (WxMall mall: malls) { | |||||
| WxProfitSharingOrder wxProfitSharingOrder = new WxProfitSharingOrder(); | |||||
| wxProfitSharingOrder.setTenantId(mall.getTenantId()); | |||||
| wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getCode()); | |||||
| List<WxProfitSharingOrder> list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | |||||
| for(WxProfitSharingOrder sharingOrder : list) { | |||||
| try { | |||||
| ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); | |||||
| logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() | |||||
| + " ID:" +sharingOrder.getId() | |||||
| + " MSG:" + result.message); | |||||
| } catch (Exception e){ | |||||
| logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_ACCEPTED.getMessage() | |||||
| + " ID:" +sharingOrder.getId() | |||||
| + " MSG:" + e.getMessage()); | |||||
| } | |||||
| } | |||||
| wxProfitSharingOrder.setSharingStatus(EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getCode()); | |||||
| list = wxProfitSharingOrderMapper.findList(wxProfitSharingOrder); | |||||
| for(WxProfitSharingOrder sharingOrder : list) { | |||||
| try { | |||||
| ResultData result = wxProfitSharingOrderService.querySharingOrder(sharingOrder); | |||||
| logger.info("状态更新结果:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() | |||||
| + " ID:" + sharingOrder.getId() | |||||
| + " MSG:" + result.message); | |||||
| } catch (Exception e){ | |||||
| logger.error("状态更新失败:" + EnumProfitSharingOrderStatus.PROFIT_SHARING_PROCESSING.getMessage() | |||||
| + " ID:" +sharingOrder.getId() | |||||
| + " MSG:" + e.getMessage()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | } | ||||
| @@ -30,17 +30,17 @@ public class WxCUserCheckSchedule { | |||||
| //@Scheduled(cron = "0 0 8 * * ?") // 每天凌晨08:00对c_user扫描查重 | //@Scheduled(cron = "0 0 8 * * ?") // 每天凌晨08:00对c_user扫描查重 | ||||
| // @Scheduled(cron = "0 */1 * * * ?") // 测试1分钟一次 | // @Scheduled(cron = "0 */1 * * * ?") // 测试1分钟一次 | ||||
| public void cuserCheckDuplicate() { | |||||
| List<Map<String, Object>> mapList = cUserMapper.checkCountByTenantOpenId(); | |||||
| if(mapList.size()> 0) { | |||||
| String message = "wx_c_user异常,有重复数据"; | |||||
| logger.error(message); | |||||
| if(isFmException) { | |||||
| String[] receivers = fmExceptionEmails.split(","); | |||||
| //发送邮件 | |||||
| mailService.sendSimpleMail(receivers, message, message); | |||||
| } | |||||
| } | |||||
| } | |||||
| // public void cuserCheckDuplicate() { | |||||
| // | |||||
| // List<Map<String, Object>> mapList = cUserMapper.checkCountByTenantOpenId(); | |||||
| // if(mapList.size()> 0) { | |||||
| // String message = "wx_c_user异常,有重复数据"; | |||||
| // logger.error(message); | |||||
| // if(isFmException) { | |||||
| // String[] receivers = fmExceptionEmails.split(","); | |||||
| // //发送邮件 | |||||
| // mailService.sendSimpleMail(receivers, message, message); | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| } | } | ||||
| @@ -30,7 +30,7 @@ public interface WxCUserMapper extends CommonMapper<WxCUser, Long> { | |||||
| long countByChannel(WxCUser wxCUser); | long countByChannel(WxCUser wxCUser); | ||||
| List<Map<String, Object>> checkCountByTenantOpenId(); | |||||
| //List<Map<String, Object>> checkCountByTenantOpenId(); | |||||
| void updateUserId(WxCUser user); | void updateUserId(WxCUser user); | ||||
| @@ -17,7 +17,7 @@ public interface WxCouponSendMapper extends CommonMapper<WxCouponSend, String> { | |||||
| void updateStatusByCouponId(WxCouponSend wxCouponSend); | void updateStatusByCouponId(WxCouponSend wxCouponSend); | ||||
| void offExpiriedCouponSendByCouponStatus(); | |||||
| void offExpiriedCouponSendByCouponStatus(String tenantId); | |||||
| void updateBirthdayConfig(WxCouponSend wxCouponSend); | void updateBirthdayConfig(WxCouponSend wxCouponSend); | ||||
| @@ -168,10 +168,10 @@ | |||||
| and tenant_id = #{tenantId} | and tenant_id = #{tenantId} | ||||
| </update> | </update> | ||||
| <update id="offExpiriedCouponSendByCouponStatus"> | |||||
| <update id="offExpiriedCouponSendByCouponStatus" parameterType="String"> | |||||
| update wx_coupon_send cs, wx_coupon c | update wx_coupon_send cs, wx_coupon c | ||||
| set cs.status=1, cs.update_date = now() | set cs.status=1, cs.update_date = now() | ||||
| where c.id = cs.coupon_id and cs.status = 0 and | |||||
| where c.id = cs.coupon_id and cs.status = 0 and cs.tenant_id = #{tenantId} and | |||||
| ((c.status = 1) or (c.valid_type = 1 and c.valid_end_date < now())) | ((c.status = 1) or (c.valid_type = 1 and c.valid_end_date < now())) | ||||
| </update> | </update> | ||||
| <update id="reduceMerchantSend" parameterType="java.util.HashMap"> | <update id="reduceMerchantSend" parameterType="java.util.HashMap"> | ||||