package com.iformall.schedule;

import com.iformall.mapper.WxBillPropertyMapper;
import com.iformall.mapper.WxBillRentMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author luozukai
 */
@Component
public class LatePayBillActionSchedule {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    @Autowired
    private WxBillRentMapper wxBillRentMapper;
    @Autowired
    private WxBillPropertyMapper wxBillPropertyMapper;
    /**
     * 每天凌晨1点执行
     */
    @Scheduled(cron = "0 0 1 * * ?")
    public void updateBillStatus() {
        try {
            logger.info("账单滞纳金更新开始");
            wxBillRentMapper.insertBillAction();
            wxBillPropertyMapper.insertBillAction();

            wxBillRentMapper.autoAddLatePayPrice();
            wxBillPropertyMapper.autoAddLatePayPrice();
            logger.info("账单滞纳金更新结束");
        }catch (Exception e){
            logger.error("LatePayBillActionSchedule error! message:{}",e.getMessage());
            logger.error("LatePayBillActionSchedule error!",e);
        }
    }


}