package com.tofly.znb.task;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.tofly.znb.service.ZnbCbLogService;
import com.tofly.znb.service.ZnbZlLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Component
@Slf4j
@EnableScheduling
public class znbCbTask {
    @Autowired
    private ZnbCbLogService znbCbLogService;
    @Autowired
    private ZnbZlLogService znbZlLogService;
    /**
     * 生成被动抄表计划指令
     * 类似声派尔提供的接口
     */
    @Scheduled(cron = "${znbplancreate.cron_expression:-}")
    public void createZnbPlan() throws JsonProcessingException {

        // log.info("打印");
        //执行创建抄表计划
        String pch = znbCbLogService.CreateZnbPlanBySblbTask("3");
        //执行抄表
        znbCbLogService.ZnbPlanCb(pch);
    }

    @Scheduled(cron = "${znsb.kg_cron_expression:-}")
    public void znsbTask() {
        znbZlLogService.znbkgfTask();
    }
}
