From 5a91d975a6350b797dc81449320f5abe8d593165 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= <2450572350@qq.com> Date: Fri, 2 Jun 2023 09:13:37 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E5=BC=BA=E5=88=B6=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E7=BA=BF=E7=A8=8B=E5=8F=98=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java b/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java index 67943a1..f60d5b4 100644 --- a/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java +++ b/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java @@ -51,9 +51,10 @@ public class ArrHandle { continue; } WxMsgHandle.exec(privateChatMsg); - chatMsgThreadLocal.remove(); } catch (Exception e) { log.error(e); + }finally { + chatMsgThreadLocal.remove(); } } log.error("退出线程了"); @@ -72,9 +73,10 @@ public class ArrHandle { continue; } WxMsgHandle.exec(privateChatMsg); - chatMsgThreadLocal.remove(); } catch (Exception e) { log.error(e); + }finally { + chatMsgThreadLocal.remove(); } } log.error("退出线程了"); From a3d689d80a2c40ced904c5ea44bb42af172d7d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= <2450572350@qq.com> Date: Fri, 2 Jun 2023 09:47:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=91=E9=80=81?= =?UTF-8?q?=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/example/wxhk/msg/WxMsgHandle.java | 2 ++ .../src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java index 0c4f08a..8eccec9 100644 --- a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java +++ b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java @@ -148,6 +148,7 @@ public class WxMsgHandle { String substring = monery.substring(1); BigDecimal decimal = new BigDecimal(substring); log.info("扫码收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), next.getValue(), remark); + HttpSendUtil.发送文本(next.getValue(), StrUtil.format("扫码收款:{},备注:{}", decimal.stripTrailingZeros().toPlainString(), remark)); iterator.remove(); return false; } @@ -182,6 +183,7 @@ public class WxMsgHandle { String substring = monery.substring(1); BigDecimal decimal = new BigDecimal(substring); log.info("收款:{},付款人:{},付款备注:{}", decimal.stripTrailingZeros().toPlainString(), receiver_username, remark); + HttpSendUtil.发送文本(receiver_username, StrUtil.format("收到款项:{},备注:{}", decimal.stripTrailingZeros().toPlainString(), remark)); return false; } } diff --git a/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java b/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java index f60d5b4..a827f7d 100644 --- a/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java +++ b/java_client/src/main/java/com/example/wxhk/tcp/vertx/ArrHandle.java @@ -22,6 +22,9 @@ import java.util.concurrent.TimeUnit; @Component public class ArrHandle { + /** + * 线程处理消息队列,但是必须保证核心数大于2,其中必定要有一个线程可以单独处理交易队列信息 + */ public static final ThreadPoolExecutor sub = new ThreadPoolExecutor(4, 10, 30, TimeUnit.MINUTES, new LinkedBlockingQueue<>(), new NamedThreadFactory("sub", false)); public static final ThreadLocal chatMsgThreadLocal = new InheritableThreadLocal<>(); protected static final Log log = Log.get(); From a94dfa9f71fb78713471e991637876c08a6c9499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=B6=9B?= <2450572350@qq.com> Date: Fri, 2 Jun 2023 09:48:59 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=88=A4=E6=96=AD,?= =?UTF-8?q?=E9=81=BF=E5=85=8D=E6=8A=9B=E5=87=BA=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/com/example/wxhk/msg/WxMsgHandle.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java index 8eccec9..b43769b 100644 --- a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java +++ b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java @@ -206,7 +206,11 @@ public class WxMsgHandle { try { String content = chatMsg.getContent(); Document document = XmlUtil.parseXml(content); - Node paysubtype = document.getElementsByTagName("paysubtype").item(0); + NodeList paysubtype1 = document.getElementsByTagName("paysubtype"); + if(paysubtype1.getLength()==0){ + return true; + } + Node paysubtype = paysubtype1.item(0); if ("1".equals(paysubtype.getTextContent().trim())) { // 手机发出去的 String textContent = document.getElementsByTagName("receiver_username").item(0).getTextContent();