package cn.cecep.talroad.task;

import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.data.analyse.task.service.FrequencyMeasurementTaskService;
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;

@Slf4j
@Api(tags = "手工监测频次不满足许可证要求")
@RestController
@RequestMapping("/data/measurement")
public class FrequencyMeasurementController {


    @Autowired
    private FrequencyMeasurementTaskService frequencyMeasurementTaskService;

    @GetMapping("/frequencyMeasurement")
    public AjaxResults<Void> frequencyMeasurement() {
        try {
            frequencyMeasurementTaskService.mainProcess();
        } catch (Exception e) {
            e.printStackTrace();
            log.error("手工监测频次不满足许可证要求失败. 原因：" + e.getMessage());
            return AjaxResults.error();
        }
        return AjaxResults.success();
    }



}
