From 836ec39fdad422b1a148699a4c5fb8c5b4d395f0 Mon Sep 17 00:00:00 2001
From: zuoxiao <lf_zuo@163.com>
Date: 星期三, 25 六月 2025 11:04:33 +0800
Subject: [PATCH] feat(card): 添加管理类型卡写卡功能并优化卡片相关逻辑- 在 OperateTypeENUM 中添加 SUPPLEMENT 和 MANAGEMENT_CARD_WRITE 枚举值 - 在 SeManagementCard 中添加 cancelTime 和 state 字段 - 更新相关 mapper 和 XML 文件以支持新增字段 - 修改 CardSv 中的回调处理逻辑,支持管理类型卡写卡 - 优化 CreateManagementCardDto 中识别码的示例值
---
pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/mqtt/MqttClientPooledObjectFactory.java | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/mqtt/MqttClientPooledObjectFactory.java b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/mqtt/MqttClientPooledObjectFactory.java
index bd2eb0f..86fc682 100644
--- a/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/mqtt/MqttClientPooledObjectFactory.java
+++ b/pipIrr-platform/pipIrr-common/src/main/java/com/dy/common/mw/channel/mqtt/MqttClientPooledObjectFactory.java
@@ -5,6 +5,7 @@
import org.apache.commons.pool2.impl.DefaultPooledObject;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
+import org.eclipse.paho.client.mqttv3.persist.MemoryPersistence;
/**
* @Author: liurunyu
@@ -16,18 +17,26 @@
private final String broker;
private final String username;
private final String password;
+ private final Boolean useMemoryPersistence;
- public MqttClientPooledObjectFactory(String broker, String username, String password) {
+ public MqttClientPooledObjectFactory(String broker, String username, String password, boolean useMemoryPersistence) {
this.broker = broker;
this.username = username;
this.password = password;
+ this.useMemoryPersistence = useMemoryPersistence;
}
@Override
public MqttClient create() throws Exception {
String clientId = MqttClient.generateClientId();
- MqttClient client = new MqttClient(broker, clientId);
-
+ MqttClient client = null ;
+ // 浣跨敤鍐呭瓨鎸佷箙鍖栬�岄潪榛樿鐨勬枃浠舵寔涔呭寲
+ if (useMemoryPersistence) {
+ MemoryPersistence persistence = new MemoryPersistence();
+ client = new MqttClient(broker, clientId, persistence);
+ }else{
+ client = new MqttClient(broker, clientId);
+ }
MqttConnectOptions options = new MqttConnectOptions();
options.setUserName(username);
options.setPassword(password.toCharArray());
--
Gitblit v1.8.0