|
@@ -422,11 +422,12 @@ public class MQTask implements InitializingBean {
|
|
|
|
|
|
/**
|
|
|
* 每天有过期的优惠券提醒
|
|
|
+ * 在这个定时任务里面,不提醒生日优惠券,不提醒T1/T2兑换券,生日优惠券当天会有提醒生日福利,T1/T2优惠券会45天提醒一次,85天提醒一次
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
// @Scheduled(cron = "0 0 */1 * * ?")//每小时执行一次
|
|
|
// @Scheduled(cron = "0 0/2 * * * ?")//每2分钟执行一次
|
|
|
- @Scheduled(cron = "0 0 9 * * ?")//每天早上9点触发
|
|
|
+ @Scheduled(cron = "0 0 8 * * ?")//每天早上9点触发
|
|
|
public void expiredCouponRemind() throws Exception {
|
|
|
logger.info("---------------- 过期优惠券提醒开始 ---------------");
|
|
|
CouponItemDto couponItemDto = new CouponItemDto();
|
|
@@ -561,4 +562,102 @@ public class MQTask implements InitializingBean {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * T1/T2优惠券会45天提醒一次,85天提醒一次
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "0 0 8 * * ?")//每天早上8点触发
|
|
|
+ public void registerMember() throws Exception {
|
|
|
+ logger.info("---------------- T1/T2优惠券提醒-开始 ---------------");
|
|
|
+ //45天未使用优惠券的券
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.add(Calendar.DATE, -45);//45天前
|
|
|
+ CouponItem couponItem = new CouponItem();
|
|
|
+ couponItem.setCouponId(10000);
|
|
|
+ couponItem.setCouponReceiveDate(calendar.getTime());
|
|
|
+ List<CouponItemDto> couponItemDtoList = couponItemService.getNoUseCouponList(couponItem);
|
|
|
+ if(couponItemDtoList!=null && couponItemDtoList.size()>0){
|
|
|
+ logger.info("---------------- 45天未使用优惠券的券 - 前当前任务处理数量-"+ couponItemDtoList.size() +" ---------------");
|
|
|
+ for (CouponItemDto couponItemDto:couponItemDtoList) {
|
|
|
+ try {
|
|
|
+ sendMessageUtil.servicePush(
|
|
|
+ "亲爱的用户,您的T1/T2滤芯兑换券有效期还有45天",
|
|
|
+ "T1/T2滤芯兑换券",
|
|
|
+ "45天后失效",
|
|
|
+ "可在“服务中心-会员中心-会员专享”查看,请尽快使用。",
|
|
|
+ couponItemDto.getUseropenid(),
|
|
|
+ ResultInfo.COUPON_URL_2);
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("注册成功提醒使用优惠券失败,失败openId:" + couponItemDto.getUseropenid()+",优惠券ID:"+couponItemDto.getCouponItemId());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("---------------- 注册会员未使用优惠券提醒-结束 ---------------");
|
|
|
+ }
|
|
|
+
|
|
|
+ //85天未使用优惠券的券
|
|
|
+ Calendar nowcalendar = Calendar.getInstance();
|
|
|
+ nowcalendar.setTime(new Date());
|
|
|
+ nowcalendar.add(Calendar.DATE, -85);//85天前
|
|
|
+ CouponItem nowcouponItem = new CouponItem();
|
|
|
+ nowcouponItem.setCouponId(10000);
|
|
|
+ nowcouponItem.setCouponReceiveDate(nowcalendar.getTime());
|
|
|
+ List<CouponItemDto> nowcouponItemDtoList = couponItemService.getNoUseCouponList(nowcouponItem);
|
|
|
+ if(nowcouponItemDtoList!=null && nowcouponItemDtoList.size()>0){
|
|
|
+ logger.info("---------------- 85天未使用优惠券的券 - 前当前任务处理数量-"+ nowcouponItemDtoList.size() +" ---------------");
|
|
|
+ for (CouponItemDto couponItemDto:nowcouponItemDtoList) {
|
|
|
+ try {
|
|
|
+ sendMessageUtil.servicePush(
|
|
|
+ "亲爱的用户,您的T1/T2滤芯兑换券即将到期",
|
|
|
+ "T1/T2滤芯兑换券",
|
|
|
+ "5天后失效",
|
|
|
+ "可在“服务中心-会员中心-会员专享”查看,请尽快使用。",
|
|
|
+ couponItemDto.getUseropenid(),
|
|
|
+ ResultInfo.COUPON_URL_2);
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("注册成功提醒使用优惠券失败,失败openId:" + couponItemDto.getUseropenid()+",优惠券ID:"+couponItemDto.getCouponItemId());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("---------------- T1/T2优惠券提醒-结束 ---------------");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 关注一个月后未注册,推送注册信息
|
|
|
+ * @throws Exception
|
|
|
+ */
|
|
|
+ @Scheduled(cron = "0 0 8 * * ?")//每天早上8点触发
|
|
|
+ public void mqRegisterMember() throws Exception {
|
|
|
+ logger.info("---------------- 关注用户过一个月还未注册,推送注册信息-开始 ---------------");
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(new Date());
|
|
|
+ calendar.add(Calendar.DATE, -30);//30天前
|
|
|
+
|
|
|
+ Member member = new Member();
|
|
|
+ member.setUserSubDate(calendar.getTime());
|
|
|
+ List<Member> memberList = memberService.getNoRegister(member);
|
|
|
+
|
|
|
+ if(memberList!=null && memberList.size()>0){
|
|
|
+ logger.info("---------------- 当前任务处理数量-"+ memberList.size() +" ---------------");
|
|
|
+ for (Member m:memberList) {
|
|
|
+ try {
|
|
|
+ sendMessageUtil.registerMember(
|
|
|
+ "欢迎关注WaterO水时代公众号。现在注册会员,即可赠送100积分,享受购买滤芯年套装直减100元优惠,还送T1/T2滤芯兑换券!",
|
|
|
+ "服务中心-会员中心-成为会员",
|
|
|
+ "400-8006692",
|
|
|
+ "赶紧注册会员吧!更多惊喜等你来!",
|
|
|
+ m.getUserOpenid(),
|
|
|
+ ResultInfo.HUIYUAN_URL);
|
|
|
+ }catch (Exception e){
|
|
|
+ logger.info("关注用户过一个月还未注册,推送注册信息失败,失败openId:" + member.getUserOpenid());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ logger.info("---------------- 关注用户过一个月还未注册,推送注册信息-结束 ---------------");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}
|