| | |
| | | @Transactional |
| | | public Result<?> realTimeDataHandle(RealTimeDataVo realTimeDataVo) { |
| | | TenantContext.setTenant(realTimeDataVo.getTenantid() + ""); |
| | | log.info("实时数据:" + realTimeDataVo.toString()); |
| | | // log.info("实时数据:" + realTimeDataVo.toString()); |
| | | |
| | | |
| | | // 1 查询或创建工单 |
| | |
| | | @Transactional |
| | | public Result<?> realTimeDataHandle(RealTimeDataParentVo realTimeDataParentVo) { |
| | | TenantContext.setTenant(realTimeDataParentVo.getTenantid() + ""); |
| | | log.info("实时数据:" + realTimeDataParentVo.toString()); |
| | | // log.info("实时数据:" + realTimeDataParentVo.toString()); |
| | | if (realTimeDataParentVo.getRealTime() != null) { |
| | | RealTimeDataVo realTimeDataVo = realTimeDataParentVo.getRealTime(); |
| | | |
| | |
| | | List<DryFaultRecordVo> faultList = new ArrayList<DryFaultRecordVo>((dryFaultMap.values())); |
| | | MqMessage<List<DryFaultRecordVo>> mqMessage = new MqMessage<>(faultList, tenantId, recTopic); |
| | | //发送广播 |
| | | log.error("广播给:{}", recTopic); |
| | | // log.error("广播给:{}", recTopic); |
| | | mqttUtil.sendMqttMessage(MqttConstant.SERVICE_BROADCAST_TENANT_REAL_FAULT, mqMessage, 1); |
| | | |
| | | |
| | |
| | | List<DryFaultRecord> result = new ArrayList<>(); |
| | | if (StringUtils.isEmpty(fault)) return result; |
| | | //数据样本:"eqp_fault": "滚筒降超时-报警,风机过流报警,滚筒升超时-报警,风箱升报警", |
| | | System.err.println((faultType == 1 ? "类型:故障" : "类型:报警") + DateUtils.formatDateTime() + "--" + fault); |
| | | // System.err.println((faultType == 1 ? "类型:故障" : "类型:报警") + DateUtils.formatDateTime() + "--" + fault); |
| | | //redis中的故障 |
| | | Map<Object, Object> rFauMap = redisUtil.hmget(String.format(MqttConstant.MQTT_REAL_FAULT, tenantId)); |
| | | Map<String, Object> redFauMap = rFauMap.entrySet().stream() |
| | |
| | | faultRecordService.save(vo); |
| | | redisUtil.hdel(String.format(MqttConstant.MQTT_REAL_FAULT, tenantId), key); |
| | | result.add(vo); |
| | | System.err.println((faultType == 1 ? "类型:故障" : "类型:报警") + DateUtils.formatDateTime() + "存入数据库"); |
| | | // System.err.println((faultType == 1 ? "类型:故障" : "类型:报警") + DateUtils.formatDateTime() + "存入数据库"); |
| | | } |
| | | }); |
| | | |