package com.jeelowcode.core.framework.config.job;

import cn.hutool.core.date.DateUtil;
import com.jeelowcode.core.framework.controller.BaseController;
import com.jeelowcode.core.framework.utils.FuncWeb;
import com.jeelowcode.framework.utils.model.ResultDataModel;
import com.jeelowcode.module.api.JeeLowCodeApi;
import com.jeelowcode.tool.framework.quartz.core.handler.JobHandler;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * 同步报表 获取阿里隐患工单 数据
 */
@Component
@Slf4j
public class SyncRiskDataJob extends BaseController implements JobHandler {

    @Autowired
    private JeeLowCodeApi jeeLowCodeApi;;

    @Override
    public String execute(String param) throws Exception {
        log.info("*********** 开始同步报表 获取阿里隐患工单数据 日志 ************");

        Map<String, Object> params = new HashMap<>();
        ResultDataModel pages = getReportDataList(param, params);
        jeeLowCodeApi.syncData(param,params,pages);

        int syncCount=pages.getRecords().size();
        String resultStr="*********** 同步报表 获取阿里隐患工单 数据完成，共同步了"+syncCount+"条 ************";
        log.info(resultStr);
        return resultStr;
    }
}
