
package com.tmerclub.cloud.multishop.task;

import com.tmerclub.cloud.multishop.service.ShopAllinpayService;
import com.tmerclub.cloud.multishop.service.ShopDetailService;
import com.tmerclub.cloud.multishop.service.ShopWalletLogService;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;

/**
 * 店铺定时任务
 *
 * @Author lth
 * @Date 2021/7/9 13:35
 */
@Component
public class ShopTask {

    @Autowired
    private ShopDetailService shopDetailService;
    @Autowired
    private ShopWalletLogService shopWalletLogService;
    @Autowired
    private ShopAllinpayService shopAllinpayService;

    /**
     * 根据签约时间改变店铺状态
     */
    @XxlJob("changeShopStatus")
    public void changeShopStatus() {
        Date now = new Date();
        // 根据签约时间修改店铺状态
        if (shopAllinpayService.getIsAllinpay()) {
            return;
        }
        shopDetailService.changeShopStatusByContractTime(now);
    }
}
