From 69e8acc5dd1f760eb60e914472c151bfa8126a52 Mon Sep 17 00:00:00 2001
From: vince <757871790@qq.com>
Date: 星期三, 03 七月 2024 17:08:20 +0800
Subject: [PATCH] 修改测温

---
 src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java b/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
index aeb01f0..2181f31 100644
--- a/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
+++ b/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
@@ -1,5 +1,6 @@
 package com.fzzy.gateway.hx2023.service;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.fzzy.api.data.DepotType;
 import com.fzzy.api.data.GatewayDeviceType;
@@ -220,7 +221,7 @@
         weightInfo.setWeightUnit("KG");
 
         JSONObject jsonObject = new JSONObject();
-        jsonObject.put("weightInfo", weightInfo);
+        jsonObject.put("weightInfo", JSON.toJSONString(weightInfo));
 
         packet.setProperties(jsonObject);
 
@@ -342,7 +343,7 @@
         outPut.setTemperature(temperature);
         List<GrainTH> ths = new ArrayList<>();
 
-        ths.add(new GrainTH(weather.getTem() != null ? weather.getTem() + "" : "", weather.getHumidity() != null ? weather.getHumidity() + "" : "", "1"));
+        ths.add(new GrainTH(weather.getTem() != null ? weather.getTem() + "" : "", weather.getHumidity() != null ? weather.getHumidity().replaceAll("%","") + "" : "", "1"));
         outPut.setTemperatureAndhumidity(ths);
 
         grain.setOutput(JSONObject.toJSONString(outPut));
@@ -361,7 +362,7 @@
             weatherStation.setId(device.getDeviceId());
         }
         weatherStation.setAirPressure(weather.getPressure());
-        weatherStation.setHumidity(weather.getHumidity());
+        weatherStation.setHumidity(weather.getHumidity().replaceAll("%",""));
         weatherStation.setPm(weather.getAir_pm25());
         weatherStation.setRadiation("0");
         weatherStation.setRainfallAmount(weather.getWea());

--
Gitblit v1.9.3