package com.ruoyi.web.controller.chenyanlogin.controller;

import com.ruoyi.common.core.domain.AjaxResult;

import com.ruoyi.web.controller.chenyanlogin.service.HuiCunService;
import com.ruoyi.web.controller.chenyanlogin.service.impl.ZhwlCaller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;

@Api(tags ="慧村接口 同步")
@RestController
@RequestMapping("/huicun/")
public class GetHuiCunController {
    @Autowired
    private HuiCunService huiCunService;

    //基础数据查询接口
    @ApiOperation("基础数据查询接口")
    @GetMapping("/getBasicData")
    public AjaxResult getBasicData(){
        return huiCunService.getBasicData();

    }

    //关爱人群数据查询接口
    @ApiOperation("关爱人群数据查询接口")
    @GetMapping("/getCarePeopleData")
    public  AjaxResult getCarePeopleData(){
        return huiCunService.getCarePeopleData();
    }

    //事件上报数据查询接口
    @ApiOperation("事件上报数据查询接口")
    @GetMapping("/getSnapshotReportData")
    public  AjaxResult getSnapshotReportData(){
        return huiCunService.getSnapshotReportData();
    }

    //一键呼叫数据查询接口
    @ApiOperation("一键呼叫数据查询接口")
    @GetMapping("/getZhwlDeviceData")
    public  AjaxResult getZhwlDeviceData(){
        return huiCunService.getZhwlDeviceData();
    }

    @ApiOperation("一键呼叫数据查询接口（新）")
    @GetMapping("/getZhwlDeviceData/list")
    public  AjaxResult getZhwlDeviceData2(@RequestParam String deviceModelName,
                                          @RequestParam Integer state,
                                          @RequestParam Integer fullFlag,
                                          @RequestParam Integer pageNum,
                                          @RequestParam Integer pageSize) {
        ZhwlCaller.DeviceListQueryVO request = new ZhwlCaller.DeviceListQueryVO();
        request.setDeviceModelName(deviceModelName);
        request.setState(state);
        request.setFullFlag(ObjectUtils.isEmpty(fullFlag) ? 0 : fullFlag);
        request.setPageNum(ObjectUtils.isEmpty(pageNum) ? 1 : pageNum);
        request.setPageSize(ObjectUtils.isEmpty(pageSize) ? 1 : pageSize);
        return huiCunService.getZhwlDeviceData(request);
    }

    //积分排行数据查询接口
    @ApiOperation("积分排行数据查询接口")
    @GetMapping("/getPointRankData")
    public  AjaxResult getPointRankData(){
        return huiCunService.getPointRankData();
    }

    //文明红榜数据查询接口
    @ApiOperation("文明红榜数据查询接口")
    @GetMapping("/getCivilizedData")
    public  AjaxResult getCivilizedData(){
        return huiCunService.getCivilizedData();
    }

    //先进事迹资讯数据查询接口
    @ApiOperation("先进事迹资讯数据查询接口")
    @GetMapping("/getVillageNewsData")
    public  AjaxResult getVillageNewsData(){
        return huiCunService.getVillageNewsData();
    }

    //同步人口数据查询接口
    @ApiOperation("同步人口数据查询接口")
    @GetMapping("/syncVillagerData")
    public  AjaxResult syncVillagerData(){
        return huiCunService.syncVillagerData(0);
    }

    //同步房屋数据查询接口
    @ApiOperation("同步房屋数据查询接口")
    @GetMapping("/syncHouseData")
    public  AjaxResult syncHouseData(){
        return huiCunService.syncHouseData(0);
    }

    //同步补贴数据查询接口
    @ApiOperation("同步补贴数据查询接口")
    @GetMapping("/syncAllowanceData")
    public  AjaxResult syncAllowanceData(){
        return huiCunService.syncAllowanceData(0);
    }
}
