package com.ruoyi.web.controller.visual;


import com.ruoyi.system.domain.UnableToAccessWebsiteListToday;
import com.ruoyi.common.core.domain.Result;
import com.ruoyi.system.domain.VisitingWebsiteRanking;
import com.ruoyi.system.domain.WebSiteTenDaysHits;
import com.ruoyi.system.domain.WebsiteAvailabilityMonitor;
import com.ruoyi.system.service.IUnableToAccessWebsiteListTodayService;
import com.ruoyi.system.service.IVisitingWebsiteRankingService;
import com.ruoyi.system.service.IWebSiteTenDaysHitsService;
import com.ruoyi.system.service.IWebsiteAvailabilityMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

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

    @Autowired
    private IWebsiteAvailabilityMonitorService websiteAvailabilityMonitorService;
    @Autowired
    private IUnableToAccessWebsiteListTodayService unableToAccessWebsiteListTodayService;
    @Autowired
    private IWebSiteTenDaysHitsService webSiteTenDaysHitsService;
    @Autowired
    private IVisitingWebsiteRankingService visitingWebsiteRankingService;


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

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

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

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


}
