Newer
Older
smartwell_demos / src / main / java / com / casic / controller / ThirdDataController.java
package com.casic.controller;

import com.alibaba.fastjson.JSON;
import com.casic.model.CommConfigDTO;
import com.casic.model.PressureDataParam;
import com.casic.model.ResponseData;
import com.casic.service.ThirdDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/push")
@Slf4j
public class ThirdDataController {

    private final ThirdDataService thirdDataService;

    public ThirdDataController(ThirdDataService thirdDataService) {
        this.thirdDataService = thirdDataService;
    }

    @RequestMapping("/pressure/data")
    public Object getDeviceRecentData(@RequestBody PressureDataParam pressureData) {
        return thirdDataService.getDeviceRecentData(pressureData);
    }

    @RequestMapping("/data")
    public Object getDeviceData(@RequestBody Map<String, Object> pressureDataMap) {
        System.out.println(JSON.toJSON(pressureDataMap));
        Map map = new HashMap();
        map.put("method", "setParams");
        Map param = new HashMap();
        param.put("ip", "大胆猜测下");
        map.put("status", 200);
        map.put("params", param);
        map.put("timeout", "3000");
        return map;
    }

}