配置修改

This commit is contained in:
萧道子 2025-03-24 22:12:01 +08:00
parent 817450ea0b
commit e945c2cb1f
17 changed files with 552 additions and 51 deletions

136
pom.xml
View File

@ -136,6 +136,18 @@
<build> <build>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<!--打包时将resource下的文件一起打包-->
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
@ -151,60 +163,86 @@
</configuration> </configuration>
</plugin> </plugin>
<plugin> <!-- 生成API文档插件 -->
<!--<plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0</version> <version>3.0.0</version>
</plugin>-->
<!--打jar包排除资源文件和依赖jar同时外部的lib、resource目录加入到classpath中 用命令java -jar运行jar时就不需要用-Dloader.path指定外部资源路径了 不需要spring-boot-maven-plugin插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<!--MANIFEST.MF 中 Class-Path 加入前缀用命令java -jar运行jar时就不用-Dloader.path指定外部资源路径了-->
<classpathPrefix>lib/</classpathPrefix>
<!--jar包名字是否包含唯一版本标识-->
<useUniqueVersions>false</useUniqueVersions>
<!--指定含main方法的主类入口-->
<mainClass>com.dpkj.Application</mainClass>
</manifest>
<manifestEntries>
<!--MANIFEST.MF 中 Class-Path 加入资源文件目录用命令java -jar时就不用-Dloader.path指定外部资源路径了 -->
<Class-Path>resources/</Class-Path>
</manifestEntries>
</archive>
<!-- 打包时从jar包里排除资源文件 -->
<excludes>
<exclude>*.yml</exclude>
<exclude>*.xml</exclude>
<exclude>templates/**</exclude>
<exclude>win32-x86-64/**</exclude>
<exclude>win32-x86/**</exclude>
</excludes>
<!-- 指定项目打成jar包输出位置 -->
<outputDirectory>${project.build.directory}/output</outputDirectory>
</configuration>
</plugin>
<!-- 拷贝依赖jar包插件maven-jar-plugin只是打包排除文件 而把依赖jar包拷贝到外部lib目录就需要maven-dependency-plugin插件 -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/output/lib/</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<!--拷贝资源文件! 插件maven-jar-plugin只负责打包时排除文件 而把资源文件拷贝到外部resource目录就需要maven-dependency-plugin插件-->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-resources</id>
<phase>package</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<resources>
<resource>
<!--拷贝此目录下的所有文件到指定的外部目录。只负责拷贝而不是从jar包中排除-->
<directory>src/main/resources</directory>
</resource>
</resources>
<!-- 把“<resource><directory>”指定目录中的文件输出到此处指定目录 -->
<outputDirectory>${project.build.directory}/output/resources</outputDirectory>
</configuration>
</execution>
</executions>
</plugin> </plugin>
<!-- 不需要分开打包的就将下面的插件全部注释-->
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-dependency-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <id>copy-dependencies</id>-->
<!-- <phase>prepare-package</phase>-->
<!-- <goals>-->
<!-- <goal>copy-dependencies</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- &lt;!&ndash; 拷贝项目依赖包到lib/目录下 &ndash;&gt;-->
<!-- <outputDirectory>${project.build.directory}/lib</outputDirectory>-->
<!-- <overWriteReleases>false</overWriteReleases>-->
<!-- <overWriteSnapshots>false</overWriteSnapshots>-->
<!-- <overWriteIfNewer>true</overWriteIfNewer>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<!-- <plugin>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
<!-- <configuration>-->
<!-- <layout>ZIP</layout>-->
<!-- <includes>-->
<!-- <include>-->
<!-- <groupId>nothing</groupId>-->
<!-- <artifactId>nothing</artifactId>-->
<!-- </include>-->
<!-- </includes>-->
<!-- </configuration>-->
<!-- </plugin>-->
</plugins> </plugins>
<!--打包时将resource下的文件一起打包-->
<resources>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build> </build>

View 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;
}

View 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";
}

View File

@ -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("失败");
}
}
}

View File

@ -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("失败");
}
}
}

View 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);
}
}

View 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);
}
}

View File

@ -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;
}

View File

@ -0,0 +1,4 @@
package com.dpkj.modules.chs.service;
public interface IAlipayService {
}

View File

@ -0,0 +1,4 @@
package com.dpkj.modules.chs.service;
public interface IHispayService {
}

View File

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

View File

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

View File

@ -1,4 +1,8 @@
dpkj: dpkj:
# 医保配置
chs:
# 医保机构编码
orgcode: H53082800070
file: file:
# 文件保存地址 # 文件保存地址
path: G:\Temp\img path: G:\Temp\img

View File

@ -1,4 +1,8 @@
dpkj: dpkj:
# 医保配置
chs:
# 医保机构编码
orgcode: H53082800070
file: file:
# 文件保存地址 # 文件保存地址
path: D:\Project\Express\upload path: D:\Project\Express\upload

View File

@ -3,6 +3,23 @@
<head> <head>
<title>挂号单</title> <title>挂号单</title>
</head> </head>
<style>
.x-center {
text-align: center;
}
.x-start {
text-align: left;
}
.x-end {
text-align: right;
}
.x-bold {
font-weight: 700;
}
</style>
<body> <body>
<div style="font-size: 32px; margin-top: 20px;"> <div style="font-size: 32px; margin-top: 20px;">
<div style=""> <div style="">
@ -27,9 +44,12 @@
<div style="margin-left: 35px;">&ensp;&ensp;用:<span th:text="${totalFee}"></span>&thinsp;</div> <div style="margin-left: 35px;">&ensp;&ensp;用:<span th:text="${totalFee}"></span>&thinsp;</div>
<div style="margin-left: 35px;">支付方式:<span th:text="${paymentMethod}"></span></div> <div style="margin-left: 35px;">支付方式:<span th:text="${paymentMethod}"></span></div>
<!-- <div style="margin-left: 35px;">订&ensp;单&ensp;号:<span style="font-size: 36px;" th:text="${orderNumber}"></span></div>--> <!-- <div style="margin-left: 35px;">订&ensp;单&ensp;号:<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;"> <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> </div>
<div style="font-weight: 700; margin-top: 8px;"> <div style="font-weight: 700; margin-top: 8px;">

Binary file not shown.

Binary file not shown.