From 6e9d579cde59b29a06e481c7f0438c2a1fbaa882 Mon Sep 17 00:00:00 2001 From: admin <15939171744@163.com> Date: 星期二, 22 四月 2025 10:48:32 +0800 Subject: [PATCH] - --- billion-main/src/main/java/com/billion/main/plc/sub/OPCUaSubscription.java | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-) diff --git a/billion-main/src/main/java/com/billion/main/plc/sub/OPCUaSubscription.java b/billion-main/src/main/java/com/billion/main/plc/sub/OPCUaSubscription.java index f01ddcd..4d4090f 100644 --- a/billion-main/src/main/java/com/billion/main/plc/sub/OPCUaSubscription.java +++ b/billion-main/src/main/java/com/billion/main/plc/sub/OPCUaSubscription.java @@ -223,6 +223,8 @@ return Long.parseLong(value); } else if (type == Boolean.class || type == boolean.class) { return Boolean.parseBoolean(value); + } else if (type == Byte.class || type == byte.class) { + return Byte.parseByte(value); } else if (type == Date.class) { try { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); @@ -240,22 +242,23 @@ WebSocketUsers.sendMessageToUserByText(map.get("IGBT"), "21"); // 鍙戦�丠TTP璇锋眰 -// HttpResponse response = HttpRequest.post(Constants.SY_MES_URL) +// HttpResponse response = HttpRequest.post(Constants.WC_TEST_MES_URL) +// .header("token", "XNY") // .body(JSONUtil.toJsonStr(stationObject)) // .timeout(5000) // 璁剧疆瓒呮椂鏃堕棿 // .execute(); // System.out.println("--------------------------"+response.body()); -// log.info("鍙戦�佹暟鐩奙ES缁撴灉{}", response.body()); +// log.info("鍙戦�佹綅鏌碝ES缁撴灉{}", response.body()); // // 瑙f瀽鍝嶅簲 // if (response.isOk()) { // 璇锋眰鎴愬姛 // JSONObject jsonResponse = JSONUtil.parseObj(response.body()); -// String message = jsonResponse.getStr("message"); +// Integer code = jsonResponse.getInt("code"); // -// if ("ok".equals(message)) { -// // 鍝嶅簲涓嶆槸ok锛屼繚瀛樺け璐ヨ褰� -// saveMesFailRecord(stationObject, device, "鍝嶅簲姝e父锛�" + message, "1"); +// if (code == 200) { +// // 鍝嶅簲涓嶆槸200锛屼繚瀛樺け璐ヨ褰� +// saveMesFailRecord(stationObject, device, "鍝嶅簲姝e父锛�" + code, "1"); // }else { -// saveMesFailRecord(stationObject, device, "鍝嶅簲寮傚父锛�" + message,Constants.ZERO); +// saveMesFailRecord(stationObject, device, "鍝嶅簲寮傚父锛�" + code,Constants.ZERO); // } // } else { // // HTTP璇锋眰澶辫触锛屼繚瀛樺け璐ヨ褰� @@ -306,15 +309,15 @@ // 娓呯悊宸插鐞嗙殑鍘嗗彶鏁版嵁 List<DaFailRecord> unHandledList = failRecordService.list(new LambdaQueryWrapper<DaFailRecord>().eq(DaFailRecord::getStatus, "0")); for (DaFailRecord daFailRecord : unHandledList) { - HttpResponse response = HttpRequest.post(Constants.SY_MES_URL) + HttpResponse response = HttpRequest.post(Constants.WC_TEST_MES_URL) .body(JSONUtil.toJsonStr(daFailRecord.getRequestData())) .timeout(5000) // 璁剧疆瓒呮椂鏃堕棿 .execute(); // 瑙f瀽鍝嶅簲 if (response.isOk()) { // 璇锋眰鎴愬姛 JSONObject jsonResponse = JSONUtil.parseObj(response.body()); - String message = jsonResponse.getStr("message"); - if ("ok".equals(message)) { + Integer code = jsonResponse.getInt("code"); + if (code == 200) { failRecordService.deleteDaFailRecordById(daFailRecord.getId()); }else { this.updateFailRecordRetryCount(daFailRecord); -- Gitblit v1.9.3