MrShi
18 小时以前 e4f9739d74323aacf09d139700f22a383910ee97
server/dmmall_admin/src/main/java/com/doumee/task/ScheduleTool.java
@@ -62,6 +62,9 @@
    @Autowired
    private IntegralService integralService;
    @Autowired
    private MemberCouponService memberCouponService;
    /**
     * 是否开发者
     */
@@ -122,9 +125,9 @@
    /**
     * 定时取消 未支付订单信息
     */
//    @Scheduled(fixedDelay = 1000L * 10L )
    @Scheduled(fixedDelay = 1000L * 10L )
    public void cancelGoodsOrder(){
        goodsorderService.autoCancel();
        goodsorderService.autoCancelOrder();
    }
    /**
@@ -152,9 +155,23 @@
        activitySignService.autoCancelSign();
    }
    /**
     * 定时通知用户优惠券即将过期
     * 每天早上 9 点执行,通知 7 天内即将过期的优惠券
     */
    @Scheduled(cron = "0 0 9 * * ?")
    public void notifyCouponExpired() {
        if (timing) {
            System.out.println("开始执行优惠券过期通知任务--------Begin------");
            try {
                // 提前 3 天通知
                memberCouponService.notifyExpiredCoupon(7);
                System.out.println("优惠券过期通知任务执行成功--------End------");
            } catch (Exception e) {
                System.out.println("优惠券过期通知任务执行失败:" + e.getMessage());
            }
        }
    }
    /**
     * 发送get请求
@@ -258,4 +275,39 @@
        }
    }
    /**
     * 定时处理积分过期
     * 每天凌晨 2 点执行
     */
    @Scheduled(cron = "0 0 2 1 * ?")
    public void autoExpiredIntegral() {
        if (timing) {
            System.out.println("开始执行积分过期处理任务--------Begin------");
            try {
                integralService.expiredIntegral();
                System.out.println("积分过期处理任务执行成功--------End------");
            } catch (Exception e) {
                System.out.println("积分过期处理任务执行失败:" + e.getMessage());
            }
        }
    }
    /**
     * 定时发送积分即将过期通知
     * 每天凌晨 2 点执行
     */
    @Scheduled(cron = "0 0 2 25 * ?")
    public void autoExpiredIntegralNotice() {
        if (timing) {
            System.out.println("开始执行积分即将过期通知处理任务--------Begin------");
            try {
                integralService.expiredIntegralNotice();
                System.out.println("积分即将过期通知处理任务执行成功--------End------");
            } catch (Exception e) {
                System.out.println("积分即将过期通知处理任务执行失败:" + e.getMessage());
            }
        }
    }
}