/**
 * Copyright 2019 DH
 * All right reserved.
 * 项目名称:
 * 创建日期:2022/8/31
 */
package org.springblade.modules.etl.controller;


import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.RequiredArgsConstructor;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
import org.springblade.jobtask.TaskManager;
import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointRelService;
import org.springblade.modules.baseinfo.monitorpoint.service.IMonitorPointService;
import org.springblade.modules.baseinfo.monitorsite.service.IMonitorSiteService;
import org.springblade.modules.etl.task.EtlBaseRtuInfoTask;
import org.springblade.modules.etl.task.EtlMpQrDataTask;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.concurrent.FutureTask;

/***
 * Date:2022/8/31
 * Title:文件所属模块（必须填写）
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author dylan
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@RestController
@RequestMapping("galaxy-business/etl/data")
@RequiredArgsConstructor
@Api(value = "数据抽取模块", tags = "数据抽取模块接口")
public class EtlDataController extends BladeController {

    @Resource
    private TaskManager taskManager;


    @GetMapping("/rtu/task")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页")
    public R<String> baseinfoTask() {
        EtlBaseRtuInfoTask task = new EtlBaseRtuInfoTask();
        FutureTask<Integer> futureTask = new FutureTask<>(task);
        taskManager.submitTask(futureTask);
        return R.data("任务已经提交");
    }

    @GetMapping("/mp/task")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页")
    public R<String> mpDataTask() {
        EtlMpQrDataTask task = new EtlMpQrDataTask();
        FutureTask<Integer> futureTask = new FutureTask<>(task);
        taskManager.submitTask(futureTask);
        return R.data("任务已经提交");
    }
}
