package com.mosty.base.manager.task;

import com.mosty.base.manager.service.TbJcglDsfService;
import com.mosty.base.manager.service.TbJcglKhtjService;
import com.mosty.base.utils.DateUtils;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;

/**
 * @author dw
 * @since 2022/8/6
 * 规则：
 * 1.每天凌晨一点对昨天的绩效进行考核 (修改一小时统计一次)
 **/
@Slf4j
@Component
@AllArgsConstructor
public class TbJcglJxkhTask {

    private final TbJcglKhtjService tbJcglKhtjService;
    public static boolean jxkh = true;

    //    @Scheduled(cron = "0 0 1 * * ?")
    @Scheduled(cron = "0 59 0/1 * * ?")
    @Transactional
    public void run() {
        if (jxkh) {
            String time = DateUtils.getSystemDateString();
            this.tbJcglKhtjService.builder(time);
        }
    }
}
