| | |
| | | import org.jeecg.common.util.RedisUtil; |
| | | import org.jeecg.modules.base.service.BaseCommonService; |
| | | import org.jeecg.modules.dry.api.EmqxApi; |
| | | import org.jeecg.modules.dry.entity.DryEqpType; |
| | | import org.jeecg.modules.dry.entity.DryEquipment; |
| | | import org.jeecg.modules.dry.entity.DryShop; |
| | | import org.jeecg.modules.dry.service.IDryEqpTypeService; |
| | | import org.jeecg.modules.dry.service.IDryEquipmentService; |
| | | import org.jeecg.modules.dry.service.IDryRealTimeDataService; |
| | | import org.jeecg.modules.dry.service.IDryShopService; |
| | |
| | | |
| | | @Autowired |
| | | private IDryEquipmentService equipmentService; |
| | | |
| | | @Autowired |
| | | private IDryEqpTypeService eqpTypeService; |
| | | |
| | | @Autowired |
| | | private IDryShopService dryShopService; |
| | |
| | | break; |
| | | case MqttConstant.SERVICE_REQ_PREFIX: |
| | | log.debug("收到设备详细信息查询请求"); |
| | | ThreadUtil.execute(() -> { |
| | | String tenantId = messageJson.getString("tenantId"); |
| | | if (tenantId!=null && tenantId.equals(TenantContext.getTenant())) { |
| | | String clientId = mqttUtil.getMqttClient().getClientId(); |
| | | String tenant = clientId.substring(clientId.lastIndexOf("_")+1); |
| | | if (tenantId!=null && tenantId.equals(tenant)) { |
| | | // 根据设备编码查询设备信息 |
| | | String code = messageJson.getString("code"); |
| | | DryEquipment equipmentVo = equipmentService.selectByTenantIdEquipmentId(tenantId,code); |
| | | // 根据设备车间id查询车间信息 |
| | | DryShop shop = dryShopService.getById(equipmentVo.getShopId()); |
| | | // 根据设备类型ID查询设备类型信息 |
| | | DryEqpType eqpType = eqpTypeService.getById(equipmentVo.getType()); |
| | | |
| | | JSONObject res = new JSONObject(); |
| | | |
| | | res.put("tenant", TenantContext.getTenant()); |
| | | res.put("tenant", clientId); |
| | | res.put("equipment", equipmentVo); |
| | | res.put("shop", shop); |
| | | res.put("eqpType", eqpType); |
| | | try { |
| | | MqttMessage sendMessage = new MqttMessage(res.toJSONString().getBytes()); |
| | | sendMessage.setQos(0); |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | |
| | | |
| | | break; |