diff --git a/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java b/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java index 2e8e0de..2ffa58f 100644 --- a/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java +++ b/src/main/java/com/dpkj/modules/chs/service/impl/HispayServiceImpl.java @@ -1,7 +1,6 @@ package com.dpkj.modules.chs.service.impl; import cn.hutool.core.date.DateUtil; -import cn.hutool.core.lang.Console; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.XmlUtil; import com.alibaba.fastjson.JSON; @@ -13,7 +12,6 @@ import com.dpkj.modules.chs.service.IHispayService; import com.dpkj.modules.chs.vo.OutpatientBeginModel; import com.dpkj.modules.chs.vo.OutpatientFinalModel; import com.jacob.activeX.ActiveXComponent; -import com.jacob.com.ComThread; import com.jacob.com.Dispatch; import com.jacob.com.Variant; import lombok.extern.slf4j.Slf4j; @@ -41,7 +39,7 @@ public class HispayServiceImpl implements IHispayService { private ChsConfig chsConfig; // COM对象 - private Dispatch dispatch; + private static ActiveXComponent dispatch; @PostConstruct public void postConstruct() { @@ -54,10 +52,10 @@ public class HispayServiceImpl implements IHispayService { * @return com.jacob.activeX.ActiveXComponent * @author 萧道子 2025/5/21 */ - private Dispatch instanceActive() { + private static ActiveXComponent instanceActive() { try { // 初始化 - ComThread.InitSTA(); + // ComThread.InitSTA(); //容易导致线程发生阻塞 ActiveXComponent activeXComponent = new ActiveXComponent("PayClient.clsPayClient"); log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载成功"); return activeXComponent; @@ -75,7 +73,7 @@ public class HispayServiceImpl implements IHispayService { * @author 萧道子 2025/5/21 */ private void releaseActive() { - ComThread.Release(); + // ComThread.Release(); //容易导致线程发生阻塞 } /** @@ -130,9 +128,6 @@ public class HispayServiceImpl implements IHispayService { @Override public JSONObject readCode() { - // 加载资源 - // Dispatch dispatch = instanceActive(); - /** 1、组装参数 */ JSONObject val = new JSONObject() .fluentPut("cardtype", "9") // 1.就诊卡,2.医保卡,5.门诊号,6.患者姓名和电话号码,8.电子健康码/卡,9.医保电子凭证 @@ -150,8 +145,6 @@ public class HispayServiceImpl implements IHispayService { String resStr = vres.getStringRef(); log.info("[HispayServiceImpl][readCode][医保读卡-电子凭证] call返回值:{} 结果:{}", call, resStr); - // 释放资源 - // releaseActive(); /** 3、处理读卡结果 */ JSONObject result = verifyResult(resStr); @@ -164,8 +157,6 @@ public class HispayServiceImpl implements IHispayService { @Override public JSONObject readCard(String password) { - // 加载资源 - // Dispatch dispatch = instanceActive(); /** 1、组装参数 */ JSONObject val = new JSONObject() @@ -184,9 +175,6 @@ public class HispayServiceImpl implements IHispayService { String resStr = vres.getStringRef(); log.info("[HispayServiceImpl][readCard][医保读卡-医保卡] call返回值:{} 结果:{}", call, resStr); - // 释放资源 - // releaseActive(); - /** 3、处理读卡结果 */ JSONObject result = verifyResult(resStr); if (!result.containsKey("item")) { @@ -198,8 +186,6 @@ public class HispayServiceImpl implements IHispayService { private ResultData outpatientBudget(OutpatientBeginModel data) { - // 加载资源 - // Dispatch dispatch = instanceActive(); /** 1、组装参数 */ JSONObject val = new JSONObject() @@ -221,8 +207,6 @@ public class HispayServiceImpl implements IHispayService { String resStr = resVariant.getStringRef(); log.info("[HispayServiceImpl][outpatientBudget][门诊缴费-预算] call返回值:{} 结果:{}", call, resStr); - // 释放资源 - // releaseActive(); /** 3、处理结果 */ JSONObject result = verifyResult(resStr); @@ -249,8 +233,6 @@ public class HispayServiceImpl implements IHispayService { @Override public ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data) { - // 加载资源 - // ActiveXComponent dispatch = instanceActive(); /** 1、组装参数 */ String requestTime = DateUtil.now(); @@ -272,13 +254,6 @@ public class HispayServiceImpl implements IHispayService { String resStr = resVariant.getStringRef(); log.info("[HispayServiceImpl][chsCodeAsOutpatientFinal][门诊缴费-结算] call返回值:{} 结果:{}", call, resStr); - // 释放资源 - // releaseActive(); - - // TODO BEGIN 萧道子 2025/6/10 : 模拟参数 - // String resStr = "01234567892025-06-10 10:23:14"; - // TODO END 萧道子 2025/6/10 : 模拟参数 - /** 3、处理结果 */ JSONObject result = verifyResult(resStr);