package cn.cecep.talroad.task;

import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.data.analyse.task.execute.report.specifications.audit.*;
import io.swagger.annotations.Api;
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;

import java.util.Arrays;
import java.util.List;

/**
 * @author hehongyu
 * @description: 执行报告审核
 * @date 2023/8/13 15:56
 */
@Api(tags = "执行报告审核")
@RestController
@RequestMapping("/execute/report/audit")
@Slf4j
public class ExecuteReportAuditController {

    @Autowired
    private ExecuteReportAuditService executeReportAuditService;

    @GetMapping("/batch/execute")
    public AjaxResults<Void> audit(List<String> executeReportIds){
        try {
            executeReportAuditService.audit(executeReportIds);
            return AjaxResults.success();
        } catch (Exception e) {
            log.error("执行报告审核 批量审核 error . 原因:{}", e.getMessage(), e);
            return AjaxResults.error();
        }
    }


    /** ==============================以下为测试单个任务的执行=================================*/
    //序号 61  （正常监测时段）无组织废气污染物排放浓度监测数据统计表
    @Autowired
    FugitiveExhaustPollutantsService fugitiveExhaustPollutantsService;
    @GetMapping("fugitiveExhaustPollutantsService")
    public void fugitiveExhaustPollutantsServiceTest(){
        fugitiveExhaustPollutantsService.execute(Arrays.asList("1","2","3"));
    }
    //序号 64  非正常工况/特殊时段有组织废气污染物监测数据统计表
    @Autowired
    NotNormalOrgGasPollutantsService notNormalOrgGasPollutantsService;
    @GetMapping("notNormalOrgGasPollutantsService")
    public void notNormalOrgGasPollutantsServiceTest(){
        notNormalOrgGasPollutantsService.execute(Arrays.asList("1","2","3"));
    }
    //序号 67  超标排放信息
    @Autowired
    ExcessiveEmissionsService excessiveEmissionsService;
    @GetMapping("excessiveEmissionsService")
    public void excessiveEmissionsServiceTest(){
        excessiveEmissionsService.execute(Arrays.asList("1","2","3"));
    }
    //序号 68  附图附件-自行监测布点图
    @Autowired
    SelfMonitoringLayoutMapService selfMonitoringLayoutMapService;
    @GetMapping("selfMonitoringLayoutMapService")
    public void selfMonitoringLayoutMapServiceTest(){
        selfMonitoringLayoutMapService.execute(Arrays.asList("1","2","3"));
    }
    //序号 69  污染物实际排放计算过程
    @Autowired
    PollutantEmissionsCalculationProcessService pollutantEmissionsCalculationProcessService;
    @GetMapping("pollutantEmissionsCalculationProcessService")
    public void pollutantEmissionsCalculationProcessServiceTest(){
        pollutantEmissionsCalculationProcessService.execute(Arrays.asList("1","2","3"));
    }
    //序号 70 台账管理情况表
    @Autowired
    LedgerManagementStatusTableService ledgerManagementStatusTableService;
    @GetMapping("ledgerManagementStatusTableService")
    public void ledgerManagementStatusTableServiceTest(){
        ledgerManagementStatusTableService.execute(Arrays.asList("1","2","3"));
    }
    // 需要66 差异20
    @Autowired
    ExcessiveDifferenceService excessiveDifferenceService;
    @GetMapping("excessiveDifferenceService")
    public void excessiveDifferenceServiceTest(){
        excessiveDifferenceService.execute(Arrays.asList("1","2","3" ));
    }
}
