package com.huimv.receiver.cloud.controller;

import com.huimv.receiver.cloud.service.IEnviron;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.text.ParseException;

/**
 * @Project : huimv.shiwan
 * @Package : com.huimv.biosafety.uface.controller
 * @Description : TODO
 * @Version : 1.0
 * @Author : ZhuoNing
 * @Create : 2020-12-25
 **/
@CrossOrigin
@RestController
@RequestMapping(value = "/receiver/cloud/environ")
public class EnvironController {
    @Autowired
    private IEnviron environ;

    //接收小时环保
    @RequestMapping(value = "/putHourEnviron",method = RequestMethod.POST)
    public void receivetHourEnviron(@RequestParam(value = "data",required = true) String data) throws ParseException {
        //
        environ.handleEnvironJSONObject(data);
    }

    //接收实时环保数据
    @RequestMapping(value = "/putRealTimeEnviron",method = RequestMethod.POST)
    public void receiveRealTimeEnviron(@RequestParam(value = "data",required = true) String data){
        System.out.println("处理实时环保数据："+data);
    }

    //接收分钟环保数据
    @RequestMapping(value = "/putMinuteEnviron",method = RequestMethod.POST)
    public void putMinuteEnviron(@RequestParam(value = "data",required = true) String data) throws ParseException {
        System.out.println("接收并处理分钟环保数据："+data);
        //
        environ.handleMinuteJSONObject(data);
    }
}
