From ddefa6dc2532bf0a405d216a8fa8e2a4bb0bf96f Mon Sep 17 00:00:00 2001
From: jiazx0107@163.com <jiazx0107@163.com>
Date: 星期六, 18 十一月 2023 14:17:42 +0800
Subject: [PATCH] 增加HTTP地磅协议实现
---
src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 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 7cfcb3e..c9d3ec5 100644
--- a/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
+++ b/src/main/java/com/fzzy/gateway/hx2023/service/ScGatewayTestServiceImpl.java
@@ -1,12 +1,13 @@
package com.fzzy.gateway.hx2023.service;
import com.alibaba.fastjson2.JSONObject;
+import com.fzzy.api.data.GatewayDeviceType;
import com.fzzy.api.data.PushProtocol;
import com.fzzy.api.utils.DateUtil;
import com.fzzy.api.utils.NumberUtil;
import com.fzzy.async.fzzy40.Fzzy40CommonService;
import com.fzzy.async.fzzy40.entity.Fz40Grain;
-import com.fzzy.gateway.api.GatewayDeviceReportService;
+import com.fzzy.gateway.GatewayUtils;
import com.fzzy.gateway.api.GatewayDeviceTestService;
import com.fzzy.gateway.data.BaseReqData;
import com.fzzy.gateway.data.BaseResp;
@@ -288,7 +289,7 @@
headers.setDeviceName(device.getDeviceName());
headers.setProductId(device.getProductId());
headers.setOrgId(device.getOrgId());
- headers.setMsgId(ScConstant.getMessageId());
+ headers.setMsgId(reqData.getMessageId());
grain.setHeaders(headers);
GrainOutPut outPut = new GrainOutPut();
@@ -341,12 +342,21 @@
outPut.setTemperature(temperature);
- grain.setOutPut(outPut);
+ grain.setOutput(JSONObject.toJSONString(outPut));
+
+
+ GatewayDevice gatewayDeviceWeather = GatewayUtils.getCacheByDeviceTypeOne(GatewayDeviceType.TYPE_09.getCode());
//姘旇薄淇℃伅
GrainWeather weatherStation = new GrainWeather();
weatherStation.setMessageId(ScConstant.getMessageId());
- weatherStation.setId(device.getDeviceId());
+ weatherStation.setMessgeId(weatherStation.getMessageId());
+
+ if (null != gatewayDeviceWeather) {
+ weatherStation.setId(gatewayDeviceWeather.getDeviceId());
+ } else {
+ weatherStation.setId(device.getDeviceId());
+ }
weatherStation.setAirPressure(weather.getPressure());
weatherStation.setHumidity(weather.getHumidity());
weatherStation.setPm(weather.getAir_pm25());
@@ -356,7 +366,7 @@
weatherStation.setWindDirection(weather.getWin());
weatherStation.setWindPower(weather.getWin_meter());
weatherStation.setWindSpeed(weather.getWin_speed());
- grain.setWeatherStation(weatherStation);
+ grain.setWeatherStation(JSONObject.toJSONString(weatherStation));
return new BaseResp(JSONObject.toJSONString(grain));
}
--
Gitblit v1.9.3