package com.chinaitop.depot.intelligent.pushs.controller;

import com.chinaitop.depot.intelligent.basicdata.model.TNtinfo;
import com.chinaitop.depot.intelligent.basicdata.service.GasService;
import com.chinaitop.depot.intelligent.pushs.service.GasPushsService;
import com.chinaitop.depot.intelligent.pushs.service.GrainPushsService;
import com.chinaitop.depot.intelligent.pushs.service.InsectPushsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Maps;
import com.unissoft.model.ResponseEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping(value = "/intelligents/pushs")
@Api(value = "PushsController", description = "http推送数据")
public class PushsController {

    @Resource
    private GasPushsService gasPushsService;

    @Resource
    private InsectPushsService insectPushsService;

    @Resource
    private GrainPushsService grainPushsService;

    @RequestMapping(value = "/uploadGasData", method = RequestMethod.POST)
    @ApiOperation(value = "上传气体检测数据", notes = "上传气体检测数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dataSource", value = "数据来源", paramType = "form"),
            @ApiImplicitParam(name = "gasData", value = "需要上传的气体数据", paramType = "form")
    })
    public ResponseEntity uploadGasData(String dataSource,String gasData) {
        return gasPushsService.uploadGasData( dataSource, gasData,"");
    }

    @RequestMapping(value = "/uploadInsectPestData", method = RequestMethod.POST)
    @ApiOperation(value = "上传虫害检测数据", notes = "上传虫害检测数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dataSource", value = "数据来源", paramType = "form"),
            @ApiImplicitParam(name = "insectPestData", value = "虫害数据", paramType = "form")
    })
    public ResponseEntity uploadInsectPestData(String dataSource,String insectPestData) {
        return insectPushsService.uploadInsectPestData( dataSource, insectPestData);
    }

    @RequestMapping(value = "/uploadGrainTemperatureData", method = RequestMethod.POST)
    @ApiOperation(value = "上传粮温检测数据", notes = "上传粮温检测数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "dataSource", value = "数据来源", paramType = "form"),
            @ApiImplicitParam(name = "grainTemperatureData", value = "粮温检测数据", paramType = "form")
    })
    public ResponseEntity uploadGrainTemperatureData(String dataSource,String grainTemperatureData) {
        return grainPushsService.uploadGrainTemperatureData( dataSource, grainTemperatureData);
    }



}
