Newer
Older
newfiber-termite / newfiber-termites / newfiber-termites-dataup / src / main / java / com / newfiber / termite / controller / StatisticsController.java
package com.newfiber.termite.controller;

import com.newfiber.common.core.web.controller.BaseController;
import com.newfiber.common.core.web.domain.Result;
import com.newfiber.termite.domain.DeviceInfo;
import com.newfiber.termite.domain.ProjectInfo;
import com.newfiber.termite.domain.request.WarnMonitoringRequest;
import com.newfiber.termite.domain.request.WarnMonthAlarmsRequest;
import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest;
import com.newfiber.termite.domain.request.statistic.ProjectStatisticRequest;
import com.newfiber.termite.domain.request.statistic.SiteWarnDailySeqStatisticRequest;
import com.newfiber.termite.domain.request.statistic.SiteWarnTotalCountStatisticRequest;
import com.newfiber.termite.domain.response.TermiteInfoResponse;
import com.newfiber.termite.domain.response.WarnMonitoringResponse;
import com.newfiber.termite.domain.response.WarnMonthAlarmsResponse;
import com.newfiber.termite.domain.response.WarnMonthAlarmsResponseInfo;
import com.newfiber.termite.domain.response.statistic.ProjectStatistic;
import com.newfiber.termite.domain.response.statistic.ProjectStatisticDetail;
import com.newfiber.termite.domain.response.statistic.SiteDailyWarnCount;
import com.newfiber.termite.domain.response.statistic.SiteTotalWarnCount;
import com.newfiber.termite.service.IDeviceInfoService;
import com.newfiber.termite.service.IProjectInfoService;
import com.newfiber.termite.service.IStatisticsService;
import com.newfiber.termite.service.ITermiteService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.*;
import javax.annotation.Resource;

import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.constraints.NotNull;

/**
 * @author X.K
 * @date 2024-05-27
 */
@RestController
@RequestMapping("/statistics")
@Api(value = "统计", tags = "统计")
public class StatisticsController extends BaseController {

    @Resource
    private IStatisticsService statisticsService;





    @Resource
    private IDeviceInfoService deviceInfoService;


    /**
     *
     */
    @GetMapping("/warn_date_seq_statistic")
    @ApiOperation(value = "告警日期时间序列统计", position = 50)
    public Result<Map<String, List<SiteDailyWarnCount>>> warnDailySeqStatistic(SiteWarnDailySeqStatisticRequest request) {
        Map<String, List<SiteDailyWarnCount>> response = statisticsService.warnDailySeqStatistic(request);
        return success(response);
    }

    /**
     *
     */
    @GetMapping("/site_warn_total_count_statistic")
    @ApiOperation(value = "累计告警次数统计", position = 50)
    public Result<List<SiteTotalWarnCount>> siteWarnTotalCountStatistic(SiteWarnTotalCountStatisticRequest request) {
        List<SiteTotalWarnCount> response = statisticsService.siteWarnTotalCountStatistic(request);
        return success(response);
    }

    /**
     *
     */
    @GetMapping("/project_statistic")
    @ApiOperation(value = "项目信息统计", position = 50)
    public Result<ProjectStatistic> projectWarnTotalCountStatistic(ProjectStatisticRequest request) {
        ProjectStatistic response = statisticsService.projectWarnTotalCountStatistic(request);
        return success(response);
    }

    @GetMapping("/warn_month_alarms")
    @ApiOperation(value = "告警月份分析", position = 50)
    public Result<WarnMonthAlarmsResponse> warnMonthAlarms(WarnMonthAlarmsRequest request){
        WarnMonthAlarmsResponse  response = statisticsService.warnMonthAlarms(request);
        return success(response);
    }


    @GetMapping("/warn_monitoring")
    @ApiOperation(value = "监测预警", position = 50)
    public Result<WarnMonitoringResponse> warnMonitoring(WarnMonitoringRequest request){
        WarnMonitoringResponse response = statisticsService.warnMonitoring(request);
        return success(response);
    }



}