移动医保
This commit is contained in:
@@ -13,7 +13,7 @@ echo 1、关闭端口进程:%PROT%
|
|||||||
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%PROT%"') do taskkill /pid %%m -t -f
|
for /f "tokens=1-5" %%i in ('netstat -ano^|findstr ":%PROT%"') do taskkill /pid %%m -t -f
|
||||||
|
|
||||||
echo 2、启动本地程序
|
echo 2、启动本地程序
|
||||||
start %CHSPATH%/javaw.exe -Dfile.encoding=utf-8 -Djava.library.path=%CHSPATH% -Dlog.path=%~dp0 -jar %~dp0\%NAME%.jar --server.port=%PROT%
|
start %CHSPATH%/javaw.exe -Dfile.encoding=utf-8 -Djava.library.path="%CHSPATH%;%CHSPATH%/CHSInterfaceYn" -Dlog.path=%~dp0 -jar %~dp0\%NAME%.jar --server.port=%PROT%
|
||||||
|
|
||||||
:: 延迟5秒
|
:: 延迟5秒
|
||||||
timeout /NOBREAK /T 5 >nul
|
timeout /NOBREAK /T 5 >nul
|
||||||
|
|||||||
@@ -1,275 +0,0 @@
|
|||||||
package com.dpkj.modules.chs.hispad.service.impl;
|
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import cn.hutool.core.util.XmlUtil;
|
|
||||||
import com.alibaba.fastjson.JSON;
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
|
||||||
import com.dpkj.common.config.PadChsConfig;
|
|
||||||
import com.dpkj.common.config.HisConfig;
|
|
||||||
import com.dpkj.common.vo.ResultData;
|
|
||||||
import com.dpkj.modules.chs.hispad.constant.ChsPayStateConst;
|
|
||||||
import com.dpkj.modules.chs.hispad.service.IHispayService;
|
|
||||||
import com.dpkj.modules.chs.hispad.vo.OutpatientBeginModel;
|
|
||||||
import com.dpkj.modules.chs.hispad.vo.OutpatientFinalModel;
|
|
||||||
import com.jacob.activeX.ActiveXComponent;
|
|
||||||
import com.jacob.com.Dispatch;
|
|
||||||
import com.jacob.com.Variant;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.w3c.dom.Document;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Auther: 萧道子
|
|
||||||
* @Date: 2025/3/22 16:29
|
|
||||||
* @Description:
|
|
||||||
*/
|
|
||||||
@Slf4j
|
|
||||||
@Service
|
|
||||||
// @AllArgsConstructor
|
|
||||||
public class HispayServiceImpl implements IHispayService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private HisConfig hisConfig;
|
|
||||||
@Autowired
|
|
||||||
private PadChsConfig chsPadConfig;
|
|
||||||
|
|
||||||
// COM对象
|
|
||||||
private static ActiveXComponent dispatch;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
public void postConstruct() {
|
|
||||||
dispatch = instanceActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取HIS医保实例
|
|
||||||
*
|
|
||||||
* @return com.jacob.activeX.ActiveXComponent
|
|
||||||
* @author 萧道子 2025/5/21
|
|
||||||
*/
|
|
||||||
private static ActiveXComponent instanceActive() {
|
|
||||||
try {
|
|
||||||
// 初始化
|
|
||||||
// ComThread.InitSTA(); //容易导致线程发生阻塞
|
|
||||||
ActiveXComponent activeXComponent = new ActiveXComponent("PayClient.clsPayClient");
|
|
||||||
log.info("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载成功");
|
|
||||||
return activeXComponent;
|
|
||||||
} catch (UnsatisfiedLinkError e) {
|
|
||||||
log.error("[HispayServiceImpl][instanceActive][HIS医保COM库] 加载失败:{}", e.getMessage());
|
|
||||||
throw new RuntimeException("HIS医保COM库加载失败:" + e.getMessage(), e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 释放资源
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
* @author 萧道子 2025/5/21
|
|
||||||
*/
|
|
||||||
private void releaseActive() {
|
|
||||||
// ComThread.Release(); //容易导致线程发生阻塞
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 处理参数
|
|
||||||
*
|
|
||||||
* @param params : 请求参数
|
|
||||||
* @param password : 密码
|
|
||||||
* @return java.lang.String
|
|
||||||
* @author 萧道子 2025/5/27
|
|
||||||
*/
|
|
||||||
private String processParameters(JSONObject params, String password) {
|
|
||||||
JSONObject req = new JSONObject() {{
|
|
||||||
put("timestamp", ""); // 请求发送时间 DateUtil.format(DateUtil.date(), "yyyyMMddHHmmss")
|
|
||||||
put("requestid", ""); // 唯一请求id IDGenerator.getSnowflakeIdToStr()
|
|
||||||
put("operid", ""); // 调用者代码 hisConfig.getOperationId()
|
|
||||||
put("password", password); // 密码
|
|
||||||
put("params", params);
|
|
||||||
}};
|
|
||||||
Document document = XmlUtil.mapToXml(req, "request");
|
|
||||||
return XmlUtil.toStr(document, "UTF-8", false, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 校验结果
|
|
||||||
*
|
|
||||||
* @param resStr :
|
|
||||||
* @return com.alibaba.fastjson.JSONObject
|
|
||||||
* @author 萧道子 2025/5/28
|
|
||||||
*/
|
|
||||||
private JSONObject verifyResult(String resStr) {
|
|
||||||
|
|
||||||
if (StrUtil.isBlank(resStr)) {
|
|
||||||
throw new RuntimeException("信息获取失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> resMap = XmlUtil.xmlToMap(resStr);
|
|
||||||
JSONObject resJson = new JSONObject(resMap);
|
|
||||||
|
|
||||||
if (StrUtil.equals(resJson.getString("resultCode"), "1")) {
|
|
||||||
throw new RuntimeException(resJson.getString("resultMessage"));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!resJson.containsKey("result")) {
|
|
||||||
throw new RuntimeException("result数据为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
return resJson.getJSONObject("result");
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONObject readCode() {
|
|
||||||
/** 1、组装参数 */
|
|
||||||
JSONObject val = new JSONObject()
|
|
||||||
.fluentPut("cardtype", "9") // 1.就诊卡,2.医保卡,5.门诊号,6.患者姓名和电话号码,8.电子健康码/卡,9.医保电子凭证
|
|
||||||
.fluentPut("cardno", "") // 患者就诊卡号
|
|
||||||
.fluentPut("sfzh", "") // 身份证号
|
|
||||||
.fluentPut("hzxm", "") // 患者姓名
|
|
||||||
.fluentPut("phone", ""); // 患者电话号码
|
|
||||||
String params = processParameters(val, null);
|
|
||||||
log.debug("[HispayServiceImpl][readCode][医保读卡-电子凭证] 接口入参:{}", params);
|
|
||||||
|
|
||||||
/** 2、调用COM函数 */
|
|
||||||
Variant vres = new Variant("", true);
|
|
||||||
Variant call = Dispatch.call(dispatch, "fRun", "BMZXX010", params, vres);
|
|
||||||
|
|
||||||
String resStr = vres.getStringRef();
|
|
||||||
log.debug("[HispayServiceImpl][readCode][医保读卡-电子凭证] call返回值:{} 结果:{}", call, resStr);
|
|
||||||
|
|
||||||
|
|
||||||
/** 3、处理读卡结果 */
|
|
||||||
JSONObject result = verifyResult(resStr);
|
|
||||||
if (!result.containsKey("item")) {
|
|
||||||
throw new RuntimeException("item数据为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.getJSONObject("item");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JSONObject readCard(String password) {
|
|
||||||
|
|
||||||
/** 1、组装参数 */
|
|
||||||
JSONObject val = new JSONObject()
|
|
||||||
.fluentPut("cardtype", "2") // 1.就诊卡,2.医保卡,5.门诊号,6.患者姓名和电话号码,8.电子健康码/卡,9.医保电子凭证
|
|
||||||
.fluentPut("cardno", "") // 患者就诊卡号
|
|
||||||
.fluentPut("sfzh", "") // 身份证号
|
|
||||||
.fluentPut("hzxm", "") // 患者姓名
|
|
||||||
.fluentPut("phone", ""); // 患者电话号码
|
|
||||||
String params = processParameters(val, password);
|
|
||||||
log.debug("[HispayServiceImpl][readCard][医保读卡-医保卡] 接口入参:{}", params);
|
|
||||||
|
|
||||||
/** 2、调用COM函数 */
|
|
||||||
Variant vres = new Variant("", true);
|
|
||||||
Variant call = Dispatch.call(dispatch, "fRun", "BMZXX010", params, vres);
|
|
||||||
|
|
||||||
String resStr = vres.getStringRef();
|
|
||||||
log.debug("[HispayServiceImpl][readCard][医保读卡-医保卡] call返回值:{} 结果:{}", call, resStr);
|
|
||||||
|
|
||||||
/** 3、处理读卡结果 */
|
|
||||||
JSONObject result = verifyResult(resStr);
|
|
||||||
if (!result.containsKey("item")) {
|
|
||||||
throw new RuntimeException("item数据为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
return result.getJSONObject("item");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private ResultData outpatientBudget(OutpatientBeginModel data) {
|
|
||||||
|
|
||||||
/** 1、组装参数 */
|
|
||||||
JSONObject val = new JSONObject()
|
|
||||||
.fluentPut("patid", data.getPatientId()) // 病人ID
|
|
||||||
.fluentPut("cfxhhj", data.getPrescriptionNo()) // 划价单据,格式:单据1,单据2,单据3
|
|
||||||
.fluentPut("czksfbz", "0") // 是否扣院内账户,0不使用院内账户,1使用院内账户(默认不使用院内账户)
|
|
||||||
.fluentPut("zfjsbz", "0") // 是否自费结算,0根据医保代码缴费,1自费结算(默认自费结算)
|
|
||||||
.fluentPut("ybrc", ""); // 医保入参,xml节点
|
|
||||||
String params = processParameters(val, data.getPassword());
|
|
||||||
log.debug("[HispayServiceImpl][outpatientBudget][门诊缴费-预算] 接口入参:{}", params);
|
|
||||||
|
|
||||||
String requestTime = DateUtil.now();
|
|
||||||
|
|
||||||
/** 2、调用COM函数 */
|
|
||||||
Variant resVariant = new Variant("", true);
|
|
||||||
Variant call = Dispatch.call(dispatch, "fRun", "BMZJF001", params, resVariant);
|
|
||||||
|
|
||||||
String responseTime = DateUtil.now();
|
|
||||||
String resStr = resVariant.getStringRef();
|
|
||||||
log.debug("[HispayServiceImpl][outpatientBudget][门诊缴费-预算] call返回值:{} 结果:{}", call, resStr);
|
|
||||||
|
|
||||||
|
|
||||||
/** 3、处理结果 */
|
|
||||||
JSONObject result = verifyResult(resStr);
|
|
||||||
|
|
||||||
return new ResultData()
|
|
||||||
.setRequestTime(requestTime)
|
|
||||||
.setRequestContent(params)
|
|
||||||
.setResponseTime(responseTime)
|
|
||||||
.setPatientId(data.getPatientId())
|
|
||||||
.setResponseContent(resStr)
|
|
||||||
.setResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultData chsCodeAsOutpatientBegin(OutpatientBeginModel data) {
|
|
||||||
// 用户读卡-生成token
|
|
||||||
JSONObject userInfo = readCode();
|
|
||||||
String patientId = userInfo.getString("patid");
|
|
||||||
data.setPatientId(patientId);
|
|
||||||
|
|
||||||
// 更新常量状态 已读卡
|
|
||||||
ChsPayStateConst.put(data.getPrescriptionNo(), 1);
|
|
||||||
|
|
||||||
return outpatientBudget(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ResultData chsCodeAsOutpatientFinal(OutpatientFinalModel data) {
|
|
||||||
|
|
||||||
/** 1、组装参数 */
|
|
||||||
String requestTime = DateUtil.now();
|
|
||||||
data.setPaytime(requestTime);
|
|
||||||
JSONObject val = ((JSONObject) JSON.toJSON(data))
|
|
||||||
.fluentPut("czksfbz", "0") // 是否扣院内账户,与预算保持一致
|
|
||||||
.fluentPut("zfjsbz", "0") // 是否自费结算,与预算保持一致,0根据病人医保代码结算,1自费结算
|
|
||||||
.fluentPut("ybrc", "")
|
|
||||||
.fluentPut("ptlsh", "")
|
|
||||||
.fluentPut("jysm", "");
|
|
||||||
String params = processParameters(val, null);
|
|
||||||
log.debug("[HispayServiceImpl][chsCodeAsOutpatientFinal][门诊缴费-结算] 接口入参:{}", params);
|
|
||||||
|
|
||||||
/** 2、调用COM函数 */
|
|
||||||
Variant resVariant = new Variant("", true);
|
|
||||||
Variant call = Dispatch.call(dispatch, "fRun", "BMZJF002", params, resVariant);
|
|
||||||
|
|
||||||
String responseTime = DateUtil.now();
|
|
||||||
String resStr = resVariant.getStringRef();
|
|
||||||
log.debug("[HispayServiceImpl][chsCodeAsOutpatientFinal][门诊缴费-结算] call返回值:{} 结果:{}", call, resStr);
|
|
||||||
|
|
||||||
/** 3、处理结果 */
|
|
||||||
JSONObject result = verifyResult(resStr);
|
|
||||||
|
|
||||||
return new ResultData()
|
|
||||||
.setRequestTime(requestTime)
|
|
||||||
.setRequestContent(params)
|
|
||||||
.setResponseTime(responseTime)
|
|
||||||
.setPatientId(data.getPatid())
|
|
||||||
.setResponseContent(resStr)
|
|
||||||
.setResult(result);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -24,12 +24,12 @@ public class PadChsPayDll {
|
|||||||
EcDll dll = Native.load("NationECCode", EcDll.class);
|
EcDll dll = Native.load("NationECCode", EcDll.class);
|
||||||
|
|
||||||
// 加载动态库
|
// 加载动态库
|
||||||
Native.load("libeay32", EcDll.class);
|
/*Native.load("libeay32", EcDll.class);
|
||||||
Native.load("ssleay32", EcDll.class);
|
Native.load("ssleay32", EcDll.class);*/
|
||||||
|
|
||||||
return dll;
|
return dll;
|
||||||
} catch (UnsatisfiedLinkError e) {
|
} catch (UnsatisfiedLinkError e) {
|
||||||
log.info("[PadChsPayDll][instance][国家级医保动态库] SDK注册失败:{}", e.getMessage());
|
log.info("[PadChsPayDll][instance][PAD医保DLL] SDK注册失败:{}", e.getMessage());
|
||||||
throw new DllRegistrationException("Failed to load PadChsPayDll library: ", e);
|
throw new DllRegistrationException("Failed to load PadChsPayDll library: ", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,11 +51,14 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void postConstruct() {
|
public void postConstruct() {
|
||||||
log.info("[AliScanFaceServiceImpl][postConstruct][支付宝刷脸DLL] 初始化动态链接库");
|
log.info("[AliScanFaceServiceImpl][postConstruct][支付宝刷脸DLL] 初始化动态链接库");
|
||||||
|
Thread thread = new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
this.iniAbcpAbsolute();
|
iniAbcpAbsolute();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("[AliScanFaceServiceImpl][postConstruct][56][支付宝刷脸初始化失败:] :{}", e.getMessage());
|
log.info("[AliScanFaceServiceImpl][postConstruct][56][支付宝刷脸初始化失败:] :{}", e.getMessage());
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
thread.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,13 +81,13 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
/**
|
/**
|
||||||
* 1、获取刷脸"刷脸去初始化服务"的ftoken返回值
|
* 1、获取刷脸"刷脸去初始化服务"的ftoken返回值
|
||||||
*/
|
*/
|
||||||
//参数
|
// 参数
|
||||||
JSONObject zolozConfig = new JSONObject().fluentPut("installAngle", 90);
|
JSONObject zolozConfig = new JSONObject().fluentPut("installAngle", 90);
|
||||||
JSONObject params = new JSONObject()
|
JSONObject params = new JSONObject()
|
||||||
.fluentPut("serviceId", aliFaceConfig.getServiceId())
|
.fluentPut("serviceId", aliFaceConfig.getServiceId())
|
||||||
.fluentPut("zolozConfig", zolozConfig);
|
.fluentPut("zolozConfig", zolozConfig);
|
||||||
String json = params.toJSONString();
|
String json = params.toJSONString();
|
||||||
String service_code = AliFaceConstants.SMILEVERIFYNIN_V1; //调用的组件编码:初始化
|
String service_code = AliFaceConstants.SMILEVERIFYNIN_V1; // 调用的组件编码:初始化
|
||||||
Result<Object> startServiceIniResult = this.startServiceIni(json, service_code);
|
Result<Object> startServiceIniResult = this.startServiceIni(json, service_code);
|
||||||
log.info("[AliScanFaceServiceImpl][aliFacePay][72][1、获取刷脸去初始化服务的结果] :{}", startServiceIniResult.toString());
|
log.info("[AliScanFaceServiceImpl][aliFacePay][72][1、获取刷脸去初始化服务的结果] :{}", startServiceIniResult.toString());
|
||||||
if (startServiceIniResult.isSuccess()) {
|
if (startServiceIniResult.isSuccess()) {
|
||||||
@@ -95,7 +98,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
/**
|
/**
|
||||||
* 2、调用后端的支付宝统一收单交易支付接口、存入hisPay
|
* 2、调用后端的支付宝统一收单交易支付接口、存入hisPay
|
||||||
*/
|
*/
|
||||||
aliOrderVo.setAuthCode(ftoken);//Demo值:"fp128d26333fa66e66e7f34c493d30cdh76"
|
aliOrderVo.setAuthCode(ftoken);// Demo值:"fp128d26333fa66e66e7f34c493d30cdh76"
|
||||||
JSONObject serverParams = (JSONObject) JSON.toJSON(aliOrderVo);
|
JSONObject serverParams = (JSONObject) JSON.toJSON(aliOrderVo);
|
||||||
log.info("[AliScanFaceServiceImpl][aliFacePay][83][调用后端的支付宝统一收单交易支付接口参数] :{}", serverParams.toString());
|
log.info("[AliScanFaceServiceImpl][aliFacePay][83][调用后端的支付宝统一收单交易支付接口参数] :{}", serverParams.toString());
|
||||||
|
|
||||||
@@ -111,11 +114,11 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
|
|
||||||
return Result.ok(serverResult);
|
return Result.ok(serverResult);
|
||||||
} else {
|
} else {
|
||||||
//调用ABCP 刷脸初始化服务失败
|
// 调用ABCP 刷脸初始化服务失败
|
||||||
log.error("[AliScanFaceServiceImpl][aliFacePay][299]调用ABCP 刷脸初始化服务失败 :{}", startServiceIniResult.getMessage());
|
log.error("[AliScanFaceServiceImpl][aliFacePay][299]调用ABCP 刷脸初始化服务失败 :{}", startServiceIniResult.getMessage());
|
||||||
return Result.error(startServiceIniResult.getMessage());
|
return Result.error(startServiceIniResult.getMessage());
|
||||||
}
|
}
|
||||||
}else {
|
} else {
|
||||||
return Result.error("执行iniAbcpAbsolute初始化失败");
|
return Result.error("执行iniAbcpAbsolute初始化失败");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -141,28 +144,28 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
System.out.println("DLL 存在: " + dllFile.exists());
|
System.out.println("DLL 存在: " + dllFile.exists());
|
||||||
if (dllFile.exists()) {
|
if (dllFile.exists()) {
|
||||||
|
|
||||||
//组装参数
|
// 组装参数
|
||||||
JSONObject params = new JSONObject()
|
JSONObject params = new JSONObject()
|
||||||
.fluentPut("appId", aliFaceConfig.getAppId()) //应用ID
|
.fluentPut("appId", aliFaceConfig.getAppId()) // 应用ID
|
||||||
.fluentPut("merchantId", aliFaceConfig.getMerchantId()) //签约商家的 PID,以 2088 开头
|
.fluentPut("merchantId", aliFaceConfig.getMerchantId()) // 签约商家的 PID,以 2088 开头
|
||||||
.fluentPut("deviceNum", aliFaceConfig.getDeviceNum())//商家机具终端编号,每台设备保持唯一
|
.fluentPut("deviceNum", aliFaceConfig.getDeviceNum())// 商家机具终端编号,每台设备保持唯一
|
||||||
.fluentPut("partnerId", aliFaceConfig.getPartnerId());//服务商的 PID
|
.fluentPut("partnerId", aliFaceConfig.getPartnerId());// 服务商的 PID
|
||||||
String json = params.toJSONString();
|
String json = params.toJSONString();
|
||||||
|
|
||||||
//指定支付宝LOT SDK的本地库路径
|
// 指定支付宝LOT SDK的本地库路径
|
||||||
AbcpInvoke.SetAPIPathFile(aliFaceConfig.getDllPath());
|
AbcpInvoke.SetAPIPathFile(aliFaceConfig.getDllPath());
|
||||||
|
|
||||||
// 使用 CountDownLatch 实现线程同步
|
// 使用 CountDownLatch 实现线程同步
|
||||||
CountDownLatch latch = new CountDownLatch(1);
|
CountDownLatch latch = new CountDownLatch(1);
|
||||||
CountDownLatch latchFinish = new CountDownLatch(1);
|
CountDownLatch latchFinish = new CountDownLatch(1);
|
||||||
|
|
||||||
//获取返回数据
|
// 获取返回数据
|
||||||
AtomicReference<Integer> processCode = new AtomicReference<>();
|
AtomicReference<Integer> processCode = new AtomicReference<>();
|
||||||
AtomicReference<String> processResult = new AtomicReference<>();
|
AtomicReference<String> processResult = new AtomicReference<>();
|
||||||
AtomicReference<Integer> finishCode = new AtomicReference<>();
|
AtomicReference<Integer> finishCode = new AtomicReference<>();
|
||||||
AtomicReference<String> finishResult = new AtomicReference<>();
|
AtomicReference<String> finishResult = new AtomicReference<>();
|
||||||
|
|
||||||
//创建回调实例
|
// 创建回调实例
|
||||||
AbcpInvoke.CallbackRsp callbackRsp = new AbcpInvoke.CallbackRsp() {
|
AbcpInvoke.CallbackRsp callbackRsp = new AbcpInvoke.CallbackRsp() {
|
||||||
@Override
|
@Override
|
||||||
public void OnProcess(int code, String subCode, String subMsg, String result) {
|
public void OnProcess(int code, String subCode, String subMsg, String result) {
|
||||||
@@ -187,7 +190,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//初始化
|
// 初始化
|
||||||
log.info("[AliScanFaceServiceImpl][iniAbcpAbsolute][175][0、ABCP调用iniAbcpAbsolute初始化参数][appId:{}][appVersion:{}][json:{}] ", aliFaceConfig.getAppId(), aliFaceConfig.getAppVersion(), json);
|
log.info("[AliScanFaceServiceImpl][iniAbcpAbsolute][175][0、ABCP调用iniAbcpAbsolute初始化参数][appId:{}][appVersion:{}][json:{}] ", aliFaceConfig.getAppId(), aliFaceConfig.getAppVersion(), json);
|
||||||
AbcpInvoke.AbcpInit(aliFaceConfig.getAppId(), aliFaceConfig.getAppVersion(), json, callbackRsp);
|
AbcpInvoke.AbcpInit(aliFaceConfig.getAppId(), aliFaceConfig.getAppVersion(), json, callbackRsp);
|
||||||
|
|
||||||
@@ -234,14 +237,14 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
CountDownLatch latchFinish = new CountDownLatch(1);
|
CountDownLatch latchFinish = new CountDownLatch(1);
|
||||||
AtomicReference<Result<Object>> finishResultRef = new AtomicReference<>();
|
AtomicReference<Result<Object>> finishResultRef = new AtomicReference<>();
|
||||||
|
|
||||||
//获取返回数据
|
// 获取返回数据
|
||||||
AtomicReference<Integer> processCode = new AtomicReference<>();
|
AtomicReference<Integer> processCode = new AtomicReference<>();
|
||||||
AtomicReference<String> processResult = new AtomicReference<>();
|
AtomicReference<String> processResult = new AtomicReference<>();
|
||||||
AtomicReference<Integer> finishCode = new AtomicReference<>();
|
AtomicReference<Integer> finishCode = new AtomicReference<>();
|
||||||
AtomicReference<String> finishResult = new AtomicReference<>();
|
AtomicReference<String> finishResult = new AtomicReference<>();
|
||||||
|
|
||||||
|
|
||||||
//接收结果
|
// 接收结果
|
||||||
Map<String, String> res = new HashMap<>();
|
Map<String, String> res = new HashMap<>();
|
||||||
|
|
||||||
AbcpInvoke.CallbackRsp callbackRsp = new AbcpInvoke.CallbackRsp() {
|
AbcpInvoke.CallbackRsp callbackRsp = new AbcpInvoke.CallbackRsp() {
|
||||||
@@ -272,7 +275,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//调用
|
// 调用
|
||||||
log.info("[AliScanFaceServiceImpl][startService][141][ABCP调用刷脸初始化服务-调用AbcpStartService参数][appId:{}][service_code:{}][json:{}] ", appId, service_code, json.toString());
|
log.info("[AliScanFaceServiceImpl][startService][141][ABCP调用刷脸初始化服务-调用AbcpStartService参数][appId:{}][service_code:{}][json:{}] ", appId, service_code, json.toString());
|
||||||
AbcpInvoke.AbcpStartService(appId, service_code, json, callbackRsp);
|
AbcpInvoke.AbcpStartService(appId, service_code, json, callbackRsp);
|
||||||
|
|
||||||
@@ -307,7 +310,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
JSONObject jsonObject = JSONObject.parseObject(finishResult.get());
|
JSONObject jsonObject = JSONObject.parseObject(finishResult.get());
|
||||||
log.info("[AliScanFaceServiceImpl][startServiceIni][252][ABCP调用刷脸初始化服务-finish回调结果] :{}", jsonObject.toString());
|
log.info("[AliScanFaceServiceImpl][startServiceIni][252][ABCP调用刷脸初始化服务-finish回调结果] :{}", jsonObject.toString());
|
||||||
if (jsonObject.containsKey("ftoken")) {
|
if (jsonObject.containsKey("ftoken")) {
|
||||||
res.put("ftoken", jsonObject.getString("ftoken"));//ftoken参数的有效期为2分钟
|
res.put("ftoken", jsonObject.getString("ftoken"));// ftoken参数的有效期为2分钟
|
||||||
res.put("barCode", jsonObject.getString("barCode"));
|
res.put("barCode", jsonObject.getString("barCode"));
|
||||||
finishResultRef.set(Result.ok("ABCP调用刷脸初始化finish服务成功", res));
|
finishResultRef.set(Result.ok("ABCP调用刷脸初始化finish服务成功", res));
|
||||||
} else {
|
} else {
|
||||||
@@ -318,7 +321,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//结果返回
|
// 结果返回
|
||||||
log.info("[AliScanFaceServiceImpl][startServiceIni][266][][ABCP调用刷脸初始化服务成功返回结果:] :{}", finishResultRef.get());
|
log.info("[AliScanFaceServiceImpl][startServiceIni][266][][ABCP调用刷脸初始化服务成功返回结果:] :{}", finishResultRef.get());
|
||||||
return finishResultRef.get();
|
return finishResultRef.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -365,7 +368,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
//调用
|
// 调用
|
||||||
log.info("[AliScanFaceServiceImpl][stopService][222][调用AbcpTaskStopService参数][appId:{}][service_code:{}][json:{}] ", appId, service_code, json.toString());
|
log.info("[AliScanFaceServiceImpl][stopService][222][调用AbcpTaskStopService参数][appId:{}][service_code:{}][json:{}] ", appId, service_code, json.toString());
|
||||||
AbcpInvoke.AbcpTaskStopService(appId, service_code, json, callbackRsp);
|
AbcpInvoke.AbcpTaskStopService(appId, service_code, json, callbackRsp);
|
||||||
|
|
||||||
@@ -381,7 +384,7 @@ public class AliScanFaceServiceImpl implements IAliScanFaceService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//结果返回
|
// 结果返回
|
||||||
return resultRef.get();
|
return resultRef.get();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
Reference in New Issue
Block a user