package com.ruoyi.web.controller.visual;


import com.ruoyi.system.domain.*;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.system.dto.VisitingWebsiteRankingDTO;
import com.ruoyi.system.dto.WebSiteTenDaysHitsDTO;
import com.ruoyi.system.service.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/api/webSite/")
public class VisualController {

    @Autowired
    private IWebsiteAvailabilityMonitorService websiteAvailabilityMonitorService;
    @Autowired
    private IUnableToAccessWebsiteListTodayService unableToAccessWebsiteListTodayService;
    @Autowired
    private IWebSiteTenDaysHitsService webSiteTenDaysHitsService;
    @Autowired
    private IVisitingWebsiteRankingService visitingWebsiteRankingService;
    @Autowired
    private IColumnPageViewService columnPageViewService;
    @Autowired
    private IPopularInformationService popularInformationService;
    @Autowired
    private IMunicipalMisprintService municipalMisprintService;
    @Autowired
    private ICountyAndDistrictMisprintService countyAndDistrictMisprintService;
    @Autowired
    private IMunicipalErrorLinkMonitorService municipalErrorLinkMonitorService;
    @Autowired
    private ICensusElementsService censusElementsService;
    @Autowired
    private ICensusItemNegativeInformationService censusItemNegativeInformationService;
    @Autowired
    private IDailyTrafficRankingService dailyTrafficRankingService;
    @Autowired
    private IDailyUpdateRankingService dailyUpdateRankingService;
    @Autowired
    private ICountyDailyTrafficRankingService countyDailyTrafficRankingService;
    @Autowired
    private ICountyDailyUpdateRankingService countyDailyUpdateRankingService;
    @Autowired
    private IMunicipalInteractiveColumnsService municipalInteractiveColumnsService;
    @Autowired
    private IAreaInteractiveColumnsService areaInteractiveColumnsService;
    @Autowired
    private ICountyInteractiveColumnsService countyInteractiveColumnsService;


    /**
     * 网站可用性实时监测-数据推送接口
     */
    @PostMapping("putWebsiteAvailabilityMonitor")
    @ResponseBody
    public Result<?> insertBatchWebsiteAvailabilityMonitor(@RequestBody List<WebsiteAvailabilityMonitor> list) {
        log.info("网站可用性实时监测:{}",list);
        websiteAvailabilityMonitorService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 本日无法访问网站列表-数据推送接口
     */
    @PostMapping("putUnableToAccessWebsiteListToday")
    @ResponseBody
    public Result<?> insertBatchUnableToAccessWebsiteListToday(@RequestBody List<UnableToAccessWebsiteListToday> list) {
        log.info("本日无法访问网站列表:{}",list);
        unableToAccessWebsiteListTodayService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府网站十日内点击量-数据推送接口
     */
    @PostMapping("putWebSiteTenDaysHits")
    @ResponseBody
    public Result<?> insertBatchWebSiteTenDaysHits(@RequestBody WebSiteTenDaysHitsDTO dto) {
        log.info("市政府网站十日内点击量:{}",dto);
        webSiteTenDaysHitsService.insertBatch(dto);
        return Result.ok();
    }

    /**
     * 市政府门户网站访问情况监测-全国各省访问吉林市政府网站排名-数据推送接口
     */
    @PostMapping("putVisitingWebsiteRanking")
    @ResponseBody
    public Result<?> insertBatchVisitingWebsiteRanking(@RequestBody VisitingWebsiteRankingDTO dto) {
        log.info("全国各省访问吉林市政府网站排名:{}",dto);
        visitingWebsiteRankingService.insertBatch(dto);
        return Result.ok();
    }

    /**
     * 市政府门户网站访问情况监测-门户网站栏目浏览量排名-数据推送接口
     */
    @PostMapping("putColumnPageView")
    @ResponseBody
    public Result<?> insertColumnPageView(@RequestBody List<ColumnPageView> list) {
        log.info("门户网站栏目浏览量排名:{}",list);
        columnPageViewService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府门户网站访问情况监测-每日最受欢迎信息排名-数据推送接口
     */
    @PostMapping("putPopularInformation")
    @ResponseBody
    public Result<?> insertPopularInformation(@RequestBody List<PopularInformation> list) {
        log.info("每日最受欢迎信息排名:{}",list);
        popularInformationService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府门户网站错别字监测-市政府工作部门-数据推送接口
     */
    @PostMapping("putMunicipalMisprint")
    @ResponseBody
    public Result<?> insertMunicipalMisprint(@RequestBody List<MunicipalMisprint> list) {
        log.info("市政府门户网站错别字监测-市政府工作部门:{}",list);
        municipalMisprintService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府门户网站错别字监测-县(市)区政府-数据推送接口
     */
    @PostMapping("putCountyAndDistrictMisprint")
    @ResponseBody
    public Result<?> insertCountyAndDistrictMisprint(@RequestBody List<CountyAndDistrictMisprint> list) {
        log.info("市政府门户网站错别字监测-县(市)区政府:{}",list);
        countyAndDistrictMisprintService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府门户网站错误链接监测-市政府门户网站错误链接监测-数据推送接口
     */
    @PostMapping("putMunicipalErrorLinkMonitor")
    @ResponseBody
    public Result<?> insertMunicipalErrorLinkMonitor(@RequestBody List<MunicipalErrorLinkMonitor> list) {
        log.info("市政府门户网站错误链接监测-市政府门户网站错误链接监测:{}",list);
        municipalErrorLinkMonitorService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 网站普查指标监测-网站普查要素-数据推送接口
     */
    @PostMapping("putCensusElements")
    @ResponseBody
    public Result<?> insertCensusElements(@RequestBody List<CensusElements> list) {
        log.info("网站普查指标监测-网站普查要素:{}",list);
        censusElementsService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 网站普查指标监测-网站普查单项否信息-数据推送接口
     */
    @PostMapping("putCensusItemNegativeInformation")
    @ResponseBody
    public Result<?> insertCensusItemNegativeInformation(@RequestBody List<CensusItemNegativeInformation> list) {
        log.info("网站普查指标监测-网站普查单项否信息:{}",list);
        censusItemNegativeInformationService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市直部门日更新访问量排名-市直部门日访问量排名-数据推送接口
     */
    @PostMapping("putDailyTrafficRanking")
    @ResponseBody
    public Result<?> insertDailyTrafficRanking(@RequestBody List<DailyTrafficRanking> list) {
        log.info("市直部门日更新访问量排名-市直部门日访问量排名:{}",list);
        dailyTrafficRankingService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市直部门日更新访问量排名-市直部门日更新量排名-数据推送接口
     */
    @PostMapping("putDailyUpdateRanking")
    @ResponseBody
    public Result<?> insertDailyUpdateRanking(@RequestBody List<DailyUpdateRanking> list) {
        log.info("市直部门日更新访问量排名-市直部门日更新量排名:{}",list);
        dailyUpdateRankingService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 县(市)区政府日更新访问量排名-县(市)区政府日访问量排名-数据推送接口
     */
    @PostMapping("putCountyDailyTrafficRanking")
    @ResponseBody
    public Result<?> insertCountyDailyTrafficRanking(@RequestBody List<CountyDailyTrafficRanking> list) {
        log.info("县(市)区政府日更新访问量排名-县(市)区政府日访问量排名:{}",list);
        countyDailyTrafficRankingService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 县（市）区政府日更新访问量排名 - 县（市）区政府日更新量排名-数据推送接口
     */
    @PostMapping("putCountyDailyUpdateRanking")
    @ResponseBody
    public Result<?> insertCountyDailyUpdateRanking(@RequestBody List<CountyDailyUpdateRanking> list) {
        log.info("县（市）区政府日更新访问量排名 - 县（市）区政府日更新量排名:{}",list);
        countyDailyUpdateRankingService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府网站群互动类栏目更新情况-市直部门-数据推送接口
     */
    @PostMapping("putMunicipalInteractiveColumns")
    @ResponseBody
    public Result<?> insertMunicipalInteractiveColumns(@RequestBody List<MunicipalInteractiveColumns> list) {
        log.info("市政府网站群互动类栏目更新情况-市直部门:{}",list);
        municipalInteractiveColumnsService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府网站群互动类栏目更新情况-区、开发区-数据推送接口
     */
    @PostMapping("putAreaInteractiveColumns")
    @ResponseBody
    public Result<?> insertAreaInteractiveColumns(@RequestBody List<AreaInteractiveColumns> list) {
        log.info("市政府网站群互动类栏目更新情况-区、开发区:{}",list);
        areaInteractiveColumnsService.insertBatch(list);
        return Result.ok();
    }

    /**
     * 市政府网站群互动类栏目更新情况告警展示-县（市）-数据推送接口
     */
    @PostMapping("putCountyInteractiveColumns")
    @ResponseBody
    public Result<?> insertCountyInteractiveColumns(@RequestBody List<CountyInteractiveColumns> list) {
        log.info("市政府网站群互动类栏目更新情况告警展示-县（市）:{}",list);
        countyInteractiveColumnsService.insertBatch(list);
        return Result.ok();
    }


}
