vince
2025-03-06 88763f2ae21e9d3771ba744577edcc2d344802a6
src/main/java/com/fzzy/protocol/fzzy/analysis/AnalysisGrain.java
@@ -13,6 +13,7 @@
import com.fzzy.gateway.entity.GatewayDevice;
import com.fzzy.gateway.hx2023.ScConstant;
import com.fzzy.gateway.hx2023.data.*;
import com.fzzy.protocol.ProtocolUtils;
import com.fzzy.protocol.fzzy.builder.SimpleCommandBuilder;
import com.fzzy.protocol.fzzy.cmd.BaseRemoteImpl;
import com.fzzy.protocol.fzzy.data.ReMessage;
@@ -93,13 +94,13 @@
    private void buildBizInfo1(Response2102 response) {
        //获取请求信息
        BaseReqData reqData = ServerUtils.getSyncReq(response.getHouseId());
        BaseReqData reqData = ProtocolUtils.getSyncReq(response.getHouseId());
        log.info("--粮情封装解析,获取到请求命令参数----");
        if (null == reqData) {
            log.error("--粮情封装解析,未获取到请求相关参数----");
            return;
        }
        log.info(reqData.toString());
        int cableZ = Integer.valueOf(response.getLay());
        int cableY = Integer.valueOf(response.getRow());
@@ -142,7 +143,7 @@
            }
            //数据优化
            if (curTemp > 35) {
            if (curTemp > 40) {
                curTemp = response.getTAvg();
            }
@@ -158,7 +159,11 @@
        }
        outPut.setTemperature(temperature);
        List<GrainTH> ths = new ArrayList<>();
        ths.add(new GrainTH(response.getTIn()!=null?response.getTIn()+"":"",response.getHIn()!=null?response.getHIn()+"":"","1"));
        outPut.setTemperatureAndhumidity(ths);
        //grain.setOutput(JSONObject.toJSONString(outPut));
        grain.setOutput(com.alibaba.fastjson2.JSONObject.toJSONString(outPut));
@@ -179,7 +184,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());
@@ -194,10 +199,10 @@
        log.info("---粮情机械封装完成----开始执行推送");
        reqData.setData(JSONObject.toJSONString(grain));
        doPushGrain(reqData);
        doPushGrain(reqData,grain);
    }
    private void doPushGrain(BaseReqData reqData) {
    private void doPushGrain(BaseReqData reqData,GrainData grainData) {
        GatewayDeviceReportService reportService = gatewayRemoteManager.getDeviceReportService(reqData.getDevice().getPushProtocol());
        if (null == reportService) {
@@ -205,6 +210,8 @@
            return;
        }
        reportService.reportGrainData(reqData);
        reqData.setData(reportService.grainData2GatewayApiInfoKafka(grainData,reqData.getDevice()).getData());
        reportService.reportGrainDataByKafka(reqData);
    }
    private void returnMsg(ApiCommonDevice ser) {