package com.huimv.receiver.farm.controller;

import com.huimv.common.utils.Result;
import com.huimv.receiver.farm.service.ICenterDevice;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;

/**
 * @Project : huimv.shiwan
 * @Package : com.huimv.biosafety.uface.controller
 * @Description : TODO
 * @Version : 1.0
 * @Author : ZhuoNing
 * @Create : 2020-12-25
 **/
@RestController
@Slf4j
@RequestMapping(value = "/center/device")
public class CenterDeviceController {
    @Autowired
    private ICenterDevice iCenterDevice;

    @RequestMapping(value = "/syncAddFarmDevice")
    public Result syncAddDevice(@RequestBody String deviceData) throws UnsupportedEncodingException {
        System.out.println("接收远程推送数据>>"+deviceData);
        return iCenterDevice.syncAddFarmDevice(deviceData);
    }

    @RequestMapping(value = "/syncEditFarmDevice")
    public Result syncEditDevice(@RequestBody String deviceData) throws UnsupportedEncodingException {
        System.out.println("接收远程推送数据>>"+deviceData);
        return iCenterDevice.syncEditFarmDevice(deviceData);
    }

    @RequestMapping(value = "/syncRemoveFarmDevice")
    public Result syncRemoveDevice(@RequestBody String deviceData) throws UnsupportedEncodingException {
        System.out.println("接收远程推送数据>>"+deviceData);
        return iCenterDevice.syncRemoveDevice(deviceData);
    }

}
