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..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 @@ -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; } } @@ -204,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(); 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..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(); @@ -51,9 +54,10 @@ public class ArrHandle { continue; } WxMsgHandle.exec(privateChatMsg); - chatMsgThreadLocal.remove(); } catch (Exception e) { log.error(e); + }finally { + chatMsgThreadLocal.remove(); } } log.error("退出线程了"); @@ -72,9 +76,10 @@ public class ArrHandle { continue; } WxMsgHandle.exec(privateChatMsg); - chatMsgThreadLocal.remove(); } catch (Exception e) { log.error(e); + }finally { + chatMsgThreadLocal.remove(); } } log.error("退出线程了");