jiazx0107@163.com
2024-01-20 fbcbe6c975554786683c38798ce8527d27993543
src/main/java/com/fzzy/protocol/bhzn/analysis/AnalysisService.java
@@ -3,6 +3,7 @@
import com.alibaba.fastjson.JSONObject;
import com.fzzy.api.Constant;
import com.fzzy.api.data.ApiCommonDevice;
import com.fzzy.api.data.DepotType;
import com.fzzy.api.data.GatewayDeviceType;
import com.fzzy.api.utils.BytesUtil;
import com.fzzy.api.utils.NumberUtil;
@@ -197,9 +198,6 @@
    private void analysisGrain2(IoMessage message, BaseReqData reqData, String grainStr, GrainCableData cableData) {
        GatewayDevice device = reqData.getDevice();
        // 获取完整的粮情包信息
        int cableZ = cableData.getCableZ();
        int cableY = cableData.getCableY();
        int cableX = cableData.getCableX();
        int sumNum = cableData.getSumNum();
        // 根据层行列获取指定长度
@@ -240,9 +238,13 @@
        String key = "GRAIN_" + message.getAddr();
        contextMapGrain.put(key, null);
        if (cableData.isCir()) {
        if (DepotType.TYPE_02.getCode().equals(device.getDepotType()) || DepotType.TYPE_04.getCode().equals(device.getDepotType())) {
            //筒仓
            analysisAndPush2(temps, reqData, thDto, cableData);
        } else if (DepotType.TYPE_03.getCode().equals(device.getDepotType())) {
            //储油罐
            analysisAndPush3(temps, reqData, thDto, cableData);
        } else {
            //平房仓
            analysisAndPush1(temps, reqData, thDto, cableData);
@@ -250,18 +252,30 @@
    }
    /**
     * 筒仓解析,解析第二步,解析到坐标数据
     * 筒仓推送
     *
     * @param temps
     * @param reqData
     * @param thDto
     * @param cableData
     */
    private void analysisAndPush2(List<Double> temps, BaseReqData reqData, THDto thDto, GrainCableData cableData) {
        //TODO
        log.info("---------------------------筒仓暂无实现---------------------------");
    }
    /**
     * 储油罐
     *
     * @param temps
     * @throws Exception
     */
    private void analysisAndPush2(List<Double> temps, BaseReqData reqData, THDto thDto, GrainCableData cableData) {
    private void analysisAndPush3(List<Double> temps, BaseReqData reqData, THDto thDto, GrainCableData cableData) {
        GatewayDevice device = reqData.getDevice();
        int cableZ = cableData.getCableZ();
        int cableY = cableData.getCableY();
        int cableX = cableData.getCableX();
        int sumNum = temps.size();
@@ -336,17 +350,17 @@
        JSONObject properties = new JSONObject();
        properties.put("data", JSONObject.toJSONString(outPut));
        properties.put("data", outPut);
        properties.put("timestamp", grain.getTimestamp());
        String height = this.getCacheHeight(device);
        if (StringUtils.isEmpty(height)) height = "0.0";
        properties.put("liquidHeight", height);
        grain.setProperties(properties.toJSONString());
        grain.setProperties(properties);
        //封装好的数据
        log.info("---浅圆仓封装完成----开始执行推送");
        log.info("---油罐仓信息封装完成----开始执行推送");
        reqData.setData(JSONObject.toJSONString(grain));