Merge pull request #162 from sglmsn/sgssxln

逻辑优化,注释更新
This commit is contained in:
ttttupup 2023-06-02 14:11:02 +08:00 committed by GitHub
commit 777faa5673
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -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();

View File

@ -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<PrivateChatMsg> 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("退出线程了");