package cn.cecep.talroad.task;

import cn.cecep.talroad.data.analyse.task.transfer.rate.ElectricityAnalyseService;
import cn.cecep.talroad.data.analyse.task.transfer.rate.InorganizationAnalyseService;
import cn.cecep.talroad.data.analyse.task.transfer.rate.OnlineMonitoringAnalyseService;
import cn.cecep.talroad.data.analyse.task.transfer.rate.WorkingConditionsAnalyseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author hehongyu
 * @description: TODO
 * @date 2023/6/29 1:50
 */
@Slf4j
@Api(tags = "传输率 标签 定时任务")
@RestController
@RequestMapping("/transferTate")
public class TransferTateLabelTaskController {

    @Autowired
    private ElectricityAnalyseService electricityAnalyseService;
    @Autowired
    private InorganizationAnalyseService inorganizationAnalyseService;
    @Autowired
    private OnlineMonitoringAnalyseService onlineMonitoringAnalyseService;
    @Autowired
    private WorkingConditionsAnalyseService workingConditionsAnalyseService;

    @ApiOperation(value = "分表计电")
    @GetMapping("/electricity")
    public void electricityAnalyse(){
        try {
            electricityAnalyseService.transferRateAnalysis();
        }catch (Exception e){
            log.error("分表计电 传输率 打标签 失败！",e);
        }
    }

    @ApiOperation(value = "在线监测")
    @GetMapping("/onlineMonitoringAnalyse")
    public void onlineMonitoringAnalyse(){
        try {
            onlineMonitoringAnalyseService.transferRateAnalysis();
        }catch (Exception e){
            log.error("在线监测 传输率 打标签 失败！",e);
        }
    }

    @ApiOperation(value = "无组织")
    @GetMapping("/inorganizationAnalyse")
    public void inorganizationAnalyse(){
        try {
            inorganizationAnalyseService.transferRateAnalysis();
        }catch (Exception e){
            log.error("无组织 传输率 打标签 失败！",e);
        }
    }

    @ApiOperation(value = "工况")
    @GetMapping("/workingConditionsAnalyse")
    public void workingConditionsAnalyse(){
        try {
            workingConditionsAnalyseService.transferRateAnalysis();
        }catch (Exception e){
            log.error("工况 传输率 打标签 失败！",e);
        }
    }
}
