配置修改
This commit is contained in:
22
src/main/java/com/dpkj/common/config/ChsConfig.java
Normal file
22
src/main/java/com/dpkj/common/config/ChsConfig.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.dpkj.common.config;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2024/4/28 14:55
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@Component
|
||||
@ConfigurationProperties(prefix = "dpkj.chs")
|
||||
public class ChsConfig {
|
||||
|
||||
/**
|
||||
* 医保机构编码
|
||||
*/
|
||||
private String orgcode;
|
||||
|
||||
}
|
||||
36
src/main/java/com/dpkj/common/constant/ChsConst.java
Normal file
36
src/main/java/com/dpkj/common/constant/ChsConst.java
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.dpkj.common.constant;
|
||||
|
||||
public interface ChsConst {
|
||||
|
||||
/**
|
||||
* 电子凭证二维码解码接口
|
||||
*/
|
||||
String APITYPE_QRCODE = "ec.query";
|
||||
|
||||
/**
|
||||
* 医保电子凭证密码核验接口
|
||||
*/
|
||||
String APITYPE_VERIFY = "cn.nhsa.ec.pwd";
|
||||
|
||||
|
||||
/**
|
||||
* 终端医保电子凭证码解码接口
|
||||
*/
|
||||
String APITYPE_DECODE = "cn.nhsa.qrcode.get";
|
||||
|
||||
/**
|
||||
* 刷脸获取医保用户身份授权接口
|
||||
*/
|
||||
String APITYPE_AUTHORIZATION = "cn.nhsa.ec.auth";
|
||||
|
||||
/**
|
||||
* 刷脸授权获取医保身份接口
|
||||
*/
|
||||
String APITYPE_CHECK = "cn.nhsa.auth.check";
|
||||
|
||||
/**
|
||||
* 结算结果通知接口
|
||||
*/
|
||||
String APITYPE_Notify = "cn.nhsa.settle.notify";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.dpkj.modules.chs.controller;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.config.ChsConfig;
|
||||
import com.dpkj.common.constant.ChsConst;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.chs.dll.AlipayDll;
|
||||
import com.dpkj.modules.chs.entity.AlipayEcRequestData;
|
||||
import com.dpkj.modules.chs.service.IAlipayService;
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Pointer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/22 16:25
|
||||
* @Description: 医保模块-阿里设备
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/chs/alipay")
|
||||
public class AlipayController {
|
||||
|
||||
private final IAlipayService alipayService;
|
||||
|
||||
private final ChsConfig charsConfig;
|
||||
|
||||
|
||||
@GetMapping("test")
|
||||
public Result<?> test() {
|
||||
try {
|
||||
AlipayDll.Dll dll = AlipayDll.instance();
|
||||
// Native.load("libeay32", AlipayDll.Dll.class);
|
||||
// Native.load("ssleay32", AlipayDll.Dll.class);
|
||||
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
AlipayEcRequestData alipayEcRequestData = new AlipayEcRequestData()
|
||||
.setOrgId(charsConfig.getOrgcode())
|
||||
.setTransType(ChsConst.APITYPE_DECODE)
|
||||
.setData(data);
|
||||
String dataJson = JSONObject.toJSONString(alipayEcRequestData);
|
||||
|
||||
Pointer resultStr = new Memory(1024 * 10);
|
||||
String rs = dll.NationEcTrans(
|
||||
"http://172.16.11.13:5946/api/chs/qrCodeQuery",
|
||||
dataJson,
|
||||
resultStr
|
||||
);
|
||||
String rsStrString = resultStr.getString(0, "GB18030");
|
||||
Console.log(rsStrString);
|
||||
Console.log(rs);
|
||||
|
||||
return Result.ok("成功", rsStrString);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("qrCodeQuery")
|
||||
public Result<?> qrCodeQuery(@RequestBody JSONObject data) {
|
||||
try {
|
||||
|
||||
Console.log(data);
|
||||
return Result.ok("成功", null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.dpkj.modules.chs.controller;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.config.ChsConfig;
|
||||
import com.dpkj.common.constant.ChsConst;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.chs.dll.AlipayDll;
|
||||
import com.dpkj.modules.chs.entity.AlipayEcRequestData;
|
||||
import com.dpkj.modules.chs.service.IAlipayService;
|
||||
import com.dpkj.modules.chs.service.IHispayService;
|
||||
import com.sun.jna.Memory;
|
||||
import com.sun.jna.Pointer;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/22 16:25
|
||||
* @Description: 医保模块-HIS医保
|
||||
*/
|
||||
@Slf4j
|
||||
@AllArgsConstructor
|
||||
@RestController
|
||||
@RequestMapping("/chs/hispay")
|
||||
public class HispayController {
|
||||
|
||||
private final IHispayService hispayService;
|
||||
|
||||
private final ChsConfig charsConfig;
|
||||
|
||||
|
||||
@GetMapping("test")
|
||||
public Result<?> test() {
|
||||
try {
|
||||
|
||||
return Result.ok("成功", null);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("失败");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
59
src/main/java/com/dpkj/modules/chs/dll/AlipayDll.java
Normal file
59
src/main/java/com/dpkj/modules/chs/dll/AlipayDll.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.dpkj.modules.chs.dll;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/22 17:48
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
public class AlipayDll {
|
||||
|
||||
/**
|
||||
* 获取 AlipayDll 实例,同时注册 AlipayDll 控件。
|
||||
*
|
||||
* @return AlipayDll 实例
|
||||
* @throws DllRegistrationException 如果注册控件失败,抛出此异常
|
||||
*/
|
||||
public static Dll instance() throws DllRegistrationException {
|
||||
try {
|
||||
return Native.load("NationECCode", Dll.class);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
log.info("[AlipayDll][getPrintSDK][医保动态库] SDK注册失败:{}", e.getMessage());
|
||||
throw new DllRegistrationException("Failed to load AlipayDll library: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义自定义异常类,用于表示注册控件时发生的错误
|
||||
*/
|
||||
public static class DllRegistrationException extends Exception {
|
||||
public DllRegistrationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public DllRegistrationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定义接口映射本地库中的函数。
|
||||
*/
|
||||
public interface Dll extends Library {
|
||||
|
||||
/**
|
||||
* 设置打印端口和波特率。
|
||||
*
|
||||
* @return 返回操作结果代码
|
||||
*/
|
||||
String NationEcTrans(String strUrl, String InData, Pointer OutData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
59
src/main/java/com/dpkj/modules/chs/dll/HispayDll.java
Normal file
59
src/main/java/com/dpkj/modules/chs/dll/HispayDll.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.dpkj.modules.chs.dll;
|
||||
|
||||
import com.sun.jna.Library;
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Pointer;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/22 17:48
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
public class HispayDll {
|
||||
|
||||
/**
|
||||
* 获取 AlipayDll 实例,同时注册 AlipayDll 控件。
|
||||
*
|
||||
* @return AlipayDll 实例
|
||||
* @throws DllRegistrationException 如果注册控件失败,抛出此异常
|
||||
*/
|
||||
public static Dll instance() throws DllRegistrationException {
|
||||
try {
|
||||
return Native.load("PayClient", Dll.class);
|
||||
} catch (UnsatisfiedLinkError e) {
|
||||
log.info("[HispayDll][getPrintSDK][医保动态库] SDK注册失败:{}", e.getMessage());
|
||||
throw new DllRegistrationException("Failed to load AlipayDll library: ", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 定义自定义异常类,用于表示注册控件时发生的错误
|
||||
*/
|
||||
public static class DllRegistrationException extends Exception {
|
||||
public DllRegistrationException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public DllRegistrationException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 定义接口映射本地库中的函数。
|
||||
*/
|
||||
public interface Dll extends Library {
|
||||
|
||||
/**
|
||||
* 设置打印端口和波特率。
|
||||
*
|
||||
* @return 返回操作结果代码
|
||||
*/
|
||||
String NationEcTrans(String strUrl, String InData, Pointer OutData);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.dpkj.modules.chs.entity;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/23 11:56
|
||||
* @Description: 医保请求
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AlipayEcRequestData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
/**
|
||||
* 机构 ID 必填
|
||||
*/
|
||||
private String orgId;
|
||||
|
||||
/**
|
||||
* 交易类型 必填
|
||||
* ec.query: 电子凭证二维码解码接口
|
||||
* cn.nhsa.qrcode.get: 终端医保电子凭证码解码接口
|
||||
* cn.nhsa.auth.check:刷脸授权获取医保身份接口
|
||||
* cn.nhsa.ec.pwd: 医保电子凭证密码核验接口
|
||||
*/
|
||||
private String transType;
|
||||
|
||||
/**
|
||||
* 接口请求参数 JSON格式字符串 必填
|
||||
*/
|
||||
private JSONObject data;
|
||||
|
||||
/**
|
||||
* 扩展参数 JSON格式字符串
|
||||
*/
|
||||
private JSONObject extra;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.dpkj.modules.chs.service;
|
||||
|
||||
public interface IAlipayService {
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package com.dpkj.modules.chs.service;
|
||||
|
||||
public interface IHispayService {
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.dpkj.modules.chs.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import com.dpkj.modules.chs.dll.AlipayDll;
|
||||
import com.dpkj.modules.chs.service.IAlipayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/22 16:29
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class AlipayServiceImpl implements IAlipayService {
|
||||
|
||||
private AlipayDll.Dll dll = AlipayDll.instance();
|
||||
|
||||
|
||||
public AlipayServiceImpl() throws AlipayDll.DllRegistrationException {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[AlipayServiceImpl][postConstruct][医保DLL] 初始化动态链接库");
|
||||
initPrinter();
|
||||
}
|
||||
|
||||
|
||||
private void initPrinter() {
|
||||
Console.log(dll);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.dpkj.modules.chs.service.impl;
|
||||
|
||||
import cn.hutool.core.lang.Console;
|
||||
import com.dpkj.modules.chs.dll.HispayDll;
|
||||
import com.dpkj.modules.chs.service.IHispayService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
/**
|
||||
* @Auther: 萧道子
|
||||
* @Date: 2025/3/22 16:29
|
||||
* @Description:
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class HispayServiceImpl implements IHispayService {
|
||||
|
||||
private HispayDll.Dll dll = HispayDll.instance();
|
||||
|
||||
|
||||
public HispayServiceImpl() throws HispayDll.DllRegistrationException {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void postConstruct() {
|
||||
log.info("[HispayServiceImpl][postConstruct][医保DLL-HIS] 初始化动态链接库");
|
||||
initPrinter();
|
||||
}
|
||||
|
||||
|
||||
private void initPrinter() {
|
||||
Console.log(dll);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
dpkj:
|
||||
# 医保配置
|
||||
chs:
|
||||
# 医保机构编码
|
||||
orgcode: H53082800070
|
||||
file:
|
||||
# 文件保存地址
|
||||
path: G:\Temp\img
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
dpkj:
|
||||
# 医保配置
|
||||
chs:
|
||||
# 医保机构编码
|
||||
orgcode: H53082800070
|
||||
file:
|
||||
# 文件保存地址
|
||||
path: D:\Project\Express\upload
|
||||
|
||||
@@ -3,6 +3,23 @@
|
||||
<head>
|
||||
<title>挂号单</title>
|
||||
</head>
|
||||
<style>
|
||||
.x-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.x-start {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.x-end {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.x-bold {
|
||||
font-weight: 700;
|
||||
}
|
||||
</style>
|
||||
<body>
|
||||
<div style="font-size: 32px; margin-top: 20px;">
|
||||
<div style="">
|
||||
@@ -27,9 +44,12 @@
|
||||
<div style="margin-left: 35px;">总 费 用:<span th:text="${totalFee}"></span> 元</div>
|
||||
<div style="margin-left: 35px;">支付方式:<span th:text="${paymentMethod}"></span></div>
|
||||
<!-- <div style="margin-left: 35px;">订 单 号:<span style="font-size: 36px;" th:text="${orderNumber}"></span></div>-->
|
||||
<div style="margin-left: 35px;">交易流水:<span style="font-size: 35px;" th:text="${transactionNumber}"></span></div>
|
||||
<div style="margin-left: 35px;">交易流水:<span style="font-size: 35px;"
|
||||
th:text="${transactionNumber}"></span></div>
|
||||
<div style="width: 100%; text-align: center; margin-bottom: -20px;">
|
||||
<img style="display: inline-block; " th:src="${qrCodeBase64}" alt="QR Code"/>
|
||||
<img style="display: inline-block; "
|
||||
th:src="${qrCodeBase64}"
|
||||
alt="QR Code" />
|
||||
</div>
|
||||
</div>
|
||||
<div style="font-weight: 700; margin-top: 8px;">
|
||||
|
||||
BIN
src/main/resources/win32-x86/NationECCode.dll
Normal file
BIN
src/main/resources/win32-x86/NationECCode.dll
Normal file
Binary file not shown.
BIN
src/main/resources/win32-x86/PayClient.dll
Normal file
BIN
src/main/resources/win32-x86/PayClient.dll
Normal file
Binary file not shown.
Reference in New Issue
Block a user