|
@@ -106,4 +106,37 @@ public class RabbitMqController {
|
|
|
}
|
|
|
return "success";
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改机型重新创建MQ队列
|
|
|
+ * @param
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @GetMapping(value = "/updateEquipmentType")
|
|
|
+ @ResponseBody
|
|
|
+ public String updateEquipmentType(String clientId, String equipmentType){
|
|
|
+ if (StringUtils.isNotEmpty(clientId) && StringUtils.isNotEmpty(equipmentType)) {
|
|
|
+ // 删除MQ队列
|
|
|
+ amqpAdmin.deleteQueue(clientId);
|
|
|
+ // 重新创建队列
|
|
|
+ Map<String,Object> arg = new HashMap<>();
|
|
|
+ arg.put("x-message-ttl",1800000);
|
|
|
+ amqpAdmin.declareQueue(new Queue(clientId, true, false, false, arg));
|
|
|
+ HashMap<String, Object> objectObjectHashMap = new HashMap<>();
|
|
|
+ amqpAdmin.declareBinding(new Binding(clientId,
|
|
|
+ Binding.DestinationType.QUEUE,
|
|
|
+ equipmentType, clientId, objectObjectHashMap));
|
|
|
+ LambdaQueryWrapper<TEquipment> query = Wrappers.lambdaQuery();
|
|
|
+ query.eq(TEquipment::getClientId, clientId);
|
|
|
+ TEquipment equipment = tEquipmentService.getOne(query);
|
|
|
+ if(equipment != null){
|
|
|
+ equipment.setEquimentType(equipmentType);
|
|
|
+ tEquipmentService.updateById(equipment);
|
|
|
+ return "success";
|
|
|
+ }
|
|
|
+ return "找不到设备";
|
|
|
+ }
|
|
|
+
|
|
|
+ return "参数为空";
|
|
|
+ }
|
|
|
}
|