//package com.huimv.datacollection.controller;
//
//import cn.hutool.core.date.DateTime;
//import cn.hutool.core.date.DateUtil;
//import com.alibaba.fastjson.JSONObject;
//import com.huimv.datacollection.service.DeviceUpDataService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
//import org.springframework.web.bind.annotation.RestController;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.io.BufferedReader;
//import java.io.IOException;
//import java.io.InputStreamReader;
//import java.nio.charset.StandardCharsets;
//
///**
// * <p>
// * 慧牧环控设备
// * </p>
// *
// * @author yinhao
// * @version 1.0
// * @date 2021/7/5 15:13
// */
//@Slf4j
//@RestController
//@RequestMapping(value = "/deviceData", method = RequestMethod.POST)
//public class HuimvDeviceController {
//
//
//    @Autowired
//    private DeviceUpDataService deviceUpDataService;
//
//
//    @RequestMapping(value = "/deviceChange", method = {RequestMethod.GET, RequestMethod.POST})
//    public void deviceUpAndDown(HttpServletRequest request, HttpServletResponse response) {
//        DateTime date = DateUtil.date();
//        log.info("开始时间------>" + date);
//
//        StringBuffer result = new StringBuffer();
//        BufferedReader br = null;
//        try {
//            br = new BufferedReader(new InputStreamReader(request.getInputStream(), StandardCharsets.UTF_8));
//            String temp;
//            while ((temp = br.readLine()) != null) {
//                result.append(temp);
//            }
//            JSONObject jsonData = JSONObject.parseObject(result.toString());
//            deviceUpDataService.saveDeviceUpData(jsonData);
//
//        } catch (IOException e) {
//            log.error(e.getMessage(), e);
//            //关闭字符输入流
//        } finally {
//            if (br != null) {
//                try {
//                    br.close();
//                } catch (IOException e) {
//                    log.error(e.getMessage(), e);
//                }
//            }
//
//        }
//    }
//}
