新设备flag=1 ;老设备type=5
This commit is contained in:
parent
31b41ca39d
commit
9edb776849
|
@ -31,6 +31,7 @@ public class OutSideServiceImpl implements OutSideService {
|
|||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode rootNode = objectMapper.readTree(jsonData);
|
||||
for (JsonNode sensorNode : rootNode.get("sensorDatas")) {
|
||||
if (sensorNode.get("flag").asInt()==1) {
|
||||
sensorData.setSn(sn);
|
||||
sensorData.setFlag(sensorNode.get("flag").asText());
|
||||
sensorData.setDs(sensorNode.get("gas_value").asText());
|
||||
|
@ -51,6 +52,7 @@ public class OutSideServiceImpl implements OutSideService {
|
|||
sensorData.setReportTime(DateUtils.getTime());
|
||||
outSideMapper.insertDevice(sensorData);
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
|
@ -82,14 +84,16 @@ public class OutSideServiceImpl implements OutSideService {
|
|||
// 判断是否是数组
|
||||
if (rootNode.isArray()) {
|
||||
for (JsonNode node : rootNode) {
|
||||
if (node.get("type").asInt()==5) {
|
||||
SensorData sd = insertOldData(node);
|
||||
|
||||
outSideMapper.insertDevice(sd);
|
||||
}
|
||||
} else {
|
||||
SensorData sd = insertOldData(rootNode);
|
||||
outSideMapper.insertDevice(sd);
|
||||
}
|
||||
}
|
||||
// else {
|
||||
// SensorData sd = insertOldData(rootNode);
|
||||
// outSideMapper.insertDevice(sd);
|
||||
// }
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue