|
@@ -5,10 +5,12 @@ import com.bz.rmcp.dap.model.DeviceOrigDataDTO;
|
|
import com.bz.rmcp.dap.model.OfflineData;
|
|
import com.bz.rmcp.dap.model.OfflineData;
|
|
import com.bz.rmcp.dap.mq.MqMessageSender;
|
|
import com.bz.rmcp.dap.mq.MqMessageSender;
|
|
import com.bz.rmcp.dap.service.DeviceDataService;
|
|
import com.bz.rmcp.dap.service.DeviceDataService;
|
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
@@ -37,11 +39,21 @@ public class RabbitMqMsgController {
|
|
@PostMapping("sendDeviceData")
|
|
@PostMapping("sendDeviceData")
|
|
public void sendDeviceData(){
|
|
public void sendDeviceData(){
|
|
Map<String,Object> param = new HashMap<>();
|
|
Map<String,Object> param = new HashMap<>();
|
|
- param.put("currentQuantity",107.4);
|
|
|
|
- param.put("valveState","1");
|
|
|
|
- param.put("temp","0");
|
|
|
|
|
|
+
|
|
param.put("WSV",90);
|
|
param.put("WSV",90);
|
|
|
|
+ param.put("VOL",3.56);
|
|
|
|
+ param.put("FORCED","0");
|
|
|
|
+ param.put("DISTURB","0");
|
|
|
|
+ param.put("OVERDRAFT","0");
|
|
|
|
+ param.put("ALARM","0");
|
|
|
|
+ param.put("VOL_STATUS","0");
|
|
|
|
+ param.put("VALVE","01");
|
|
|
|
+
|
|
|
|
+ /*param.put("WSV",90);
|
|
|
|
+ param.put("VOL_STATUS","0");
|
|
param.put("VALVE","01");
|
|
param.put("VALVE","01");
|
|
|
|
+ param.put("DISTURB","0");
|
|
|
|
+ param.put("REMOVE_STATUS","0");*/
|
|
|
|
|
|
Map<Date,String> map = new HashMap<>();
|
|
Map<Date,String> map = new HashMap<>();
|
|
map.put(new Date(), JSON.toJSONString(param));
|
|
map.put(new Date(), JSON.toJSONString(param));
|
|
@@ -49,7 +61,7 @@ public class RabbitMqMsgController {
|
|
DeviceOrigDataDTO dto = new DeviceOrigDataDTO();
|
|
DeviceOrigDataDTO dto = new DeviceOrigDataDTO();
|
|
dto.setId(1L);
|
|
dto.setId(1L);
|
|
dto.setAgentIdentifier("");
|
|
dto.setAgentIdentifier("");
|
|
- dto.setDeviceNo("11111111111");
|
|
|
|
|
|
+ dto.setDeviceNo("77777777");
|
|
dto.setMode("");
|
|
dto.setMode("");
|
|
dto.setType("");
|
|
dto.setType("");
|
|
dto.setManufacturer("");
|
|
dto.setManufacturer("");
|
|
@@ -62,4 +74,54 @@ public class RabbitMqMsgController {
|
|
|
|
|
|
deviceDataService.saveDeviceData(dto);
|
|
deviceDataService.saveDeviceData(dto);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @PostMapping("sendDeviceLoraData")
|
|
|
|
+ public void sendDeviceLoraData(
|
|
|
|
+ @ApiParam(value = "deviceNo", required = true) @RequestParam String deviceNo,
|
|
|
|
+ @ApiParam(value = "json", required = true,example = "{\"VOL\":3.56,\"ALARM\":\"0\",\"VOL_STATUS\":\"0\",\"VALVE\":\"01\",\"WSV\":90,\"FORCED\":\"0\",\"DISTURB\":\"0\",\"OVERDRAFT\":\"0\"}") @RequestParam String json
|
|
|
|
+ ){
|
|
|
|
+ Map<String,Object> param = JSON.parseObject(json, HashMap.class);
|
|
|
|
+ Map<Date,String> map = new HashMap<>();
|
|
|
|
+ map.put(new Date(), JSON.toJSONString(param));
|
|
|
|
+
|
|
|
|
+ DeviceOrigDataDTO dto = new DeviceOrigDataDTO();
|
|
|
|
+ dto.setId(1L);
|
|
|
|
+ dto.setAgentIdentifier("");
|
|
|
|
+ dto.setDeviceNo("77777777");
|
|
|
|
+ dto.setMode("");
|
|
|
|
+ dto.setType("");
|
|
|
|
+ dto.setManufacturer("");
|
|
|
|
+ dto.setOriginalDataFormat("");
|
|
|
|
+ dto.setOriginalData("");
|
|
|
|
+ dto.setParsedData(map);
|
|
|
|
+ dto.setEventTime(new Date());
|
|
|
|
+ dto.setReceiveTime(new Date());
|
|
|
|
+ deviceDataService.saveDeviceData(dto);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PostMapping("sendDeviceNbData")
|
|
|
|
+ public void sendDeviceNbData(
|
|
|
|
+ @ApiParam(value = "deviceNo", required = true) @RequestParam String deviceNo,
|
|
|
|
+ @ApiParam(value = "json", required = true,example = "{\"REMOVE_STATUS\":\"0\",\"VOL_STATUS\":\"0\",\"VALVE\":\"01\",\"WSV\":90,\"DISTURB\":\"0\"}") @RequestParam String json
|
|
|
|
+ ){
|
|
|
|
+
|
|
|
|
+ Map<String,Object> param = JSON.parseObject(json, HashMap.class);
|
|
|
|
+ Map<Date,String> map = new HashMap<>();
|
|
|
|
+ map.put(new Date(), JSON.toJSONString(param));
|
|
|
|
+
|
|
|
|
+ DeviceOrigDataDTO dto = new DeviceOrigDataDTO();
|
|
|
|
+ dto.setId(1L);
|
|
|
|
+ dto.setAgentIdentifier("");
|
|
|
|
+ dto.setDeviceNo("77777777");
|
|
|
|
+ dto.setMode("");
|
|
|
|
+ dto.setType("");
|
|
|
|
+ dto.setManufacturer("");
|
|
|
|
+ dto.setOriginalDataFormat("");
|
|
|
|
+ dto.setOriginalData("");
|
|
|
|
+ dto.setParsedData(map);
|
|
|
|
+ dto.setEventTime(new Date());
|
|
|
|
+ dto.setReceiveTime(new Date());
|
|
|
|
+ deviceDataService.saveDeviceData(dto);
|
|
|
|
+ }
|
|
}
|
|
}
|