package com.casic.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; import com.casic.model.ReceiveDataParam; import com.casic.model.ResponseData; import com.casic.service.DeviceService; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.util.Map; @Slf4j @RestController @RequestMapping("/casic") public class DeviceController { private final DeviceService deviceService; public DeviceController(DeviceService deviceService) { this.deviceService = deviceService; } @RequestMapping("/helloWord") public ResponseData helloWord() { return deviceService.testMysql(); } @PostMapping("/data/gas") public ResponseData saveDataGas(@RequestBody Map<String, Object> receiveData) { log.error("----------------------第三方燃气数据上报为{}",JSONObject.toJSONString(receiveData)); return deviceService.saveDataGas(receiveData); } }