jiangping
2023-10-30 d06c577a634528b11bc4b83c2769f48992913cad
server/services/src/main/java/com/doumee/service/business/impl/DeviceSubscribeServiceImpl.java
@@ -59,7 +59,8 @@
        }
        MqttLog mqttLog = new MqttLog();
        mqttLog.setMsgId(msgId);
        if(mqttLogMapper.selectCount(new QueryWrapper<MqttLog>().lambda().eq(MqttLog::getMsgId, msgId)) >0){
        int msgCount  =mqttLogMapper.selectCount(new QueryWrapper<MqttLog>().lambda().eq(MqttLog::getMsg, param).eq(MqttLog::getType, Constants.ZERO));
        if(msgCount>0){
            log.error("mqtt消息订阅==============已消费数据====="+param);
            return;
        }
@@ -70,7 +71,8 @@
            if(StringUtils.contains(topic, info)){
                //如果锁头信息上报
                Locks locks  = JSONObject.parseObject(param, Locks.class);
                locks.setId(lockid);
                locks.setSiteId(siteid);
                locks.setCode(lockid);
                locks.setInfo(logId);
                result = memberRidesService.mqttLockInfoEvent(locks);
                logInfo = "mqtt消息订阅锁头信息";
@@ -81,18 +83,20 @@
                JSONObject pjson  = JSONObject.parseObject(param);
                MemberRides bikes = new MemberRides();
                bikes.setBikeCode(pjson.getString("bikeCode"));
                bikes.setBackLockId( pjson.getString("lockId"));
                bikes.setBackSiteId( pjson.getString("siteId"));
                bikes.setBackLockId( lockid);
                bikes.setBackSiteId( siteid);
                bikes.setBackCommondId(logId);
                result = memberRidesService.mqttCloseBikeEvent(bikes);
                logInfo = "mqtt消息订阅还车消息";
                log.info("mqtt消息订阅=========还车==========成功");
            }
        }catch (BusinessException e){
            e.printStackTrace();
            logInfo = "mqtt消息订阅错误==="+e.getMessage();
            result =1;
        }catch (Exception e){
            logInfo = "mqtt消息订阅异常===";
            e.printStackTrace();
            logInfo = "mqtt消息订阅异常==="+e.getMessage();
            result =1;
        }
        createSubLog(topic,msgId,logId,result,param,logInfo);
@@ -109,6 +113,7 @@
        log.setType(Constants.ZERO);
        log.setMsg(param);
        log.setInfo(info);
        log.setIsdeleted(Constants.ZERO);
        log.setMsgId(msgId);
        mqttLogMapper.insert(log);
    }