From 3bf782ceb9411b81e5c03cadb73751f429e4051a Mon Sep 17 00:00:00 2001
From: “djh” <“3298565835@qq.com”>
Date: Tue, 18 Feb 2025 16:28:33 +0800
Subject: [PATCH] 煤矿缴费修改
---
exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java | 104 ++++++++++++++------
exam-system/src/main/java/com/gkhy/exam/pay/service/CoalPayService.java | 2
exam-system/src/main/java/com/gkhy/exam/pay/utils/BillSign.java | 30 +++--
exam-system/src/main/java/com/gkhy/exam/pay/utils/DemoUtils.java | 2
exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java | 87 +++++++++++++----
exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml | 12 +-
exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java | 13 ++
exam-system/src/main/java/com/gkhy/exam/pay/utils/config/PropertiesUtil.java | 2
exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayController.java | 3
exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml | 3
exam-system/src/main/java/com/gkhy/exam/pay/utils/SignCommond.java | 2
11 files changed, 185 insertions(+), 75 deletions(-)
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayController.java b/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayController.java
index 57aad87..615d394 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayController.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/controller/CoalPayController.java
@@ -7,6 +7,7 @@
import com.gkhy.exam.pay.entity.CoalPayStudent;
import com.gkhy.exam.pay.entity.PayReqData;
import com.gkhy.exam.pay.service.CoalPayService;
+import com.gkhy.exam.pay.utils.BillSignException;
import com.gkhy.exam.pay.utils.PayUtils;
import com.gkhy.exam.pay.utils.ResultVo;
import com.ruoyi.common.annotation.Anonymous;
@@ -121,7 +122,7 @@
@PostMapping("/topay")
@Anonymous
@ApiOperation(value = "缴费测试")
- public AjaxResult toPay() throws IOException {
+ public AjaxResult toPay() throws IOException, BillSignException {
return success(coalPayService.topay());
}
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java b/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java
index af7fb22..394e699 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/entity/CoalPayStudent.java
@@ -86,6 +86,11 @@
private String orderId;
/**
+ * 订单号
+ */
+ private String orderNo;
+
+ /**
* 票据
*/
private String fileData;
@@ -250,4 +255,12 @@
public void setGovPayStatus(Integer govPayStatus) {
this.govPayStatus = govPayStatus;
}
+
+ public String getOrderNo() {
+ return orderNo;
+ }
+
+ public void setOrderNo(String orderNo) {
+ this.orderNo = orderNo;
+ }
}
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/CoalPayService.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/CoalPayService.java
index c49350e..1015cf4 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/service/CoalPayService.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/CoalPayService.java
@@ -32,5 +32,5 @@
String teamPayMoney(CoalTeamPayReq coalTeamPayReq);
- ResultVo topay() throws IOException;
+ ResultVo topay() throws IOException, BillSignException;
}
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java
index d4116a9..bfd4605 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/service/impl/CoalPayServiceImpl.java
@@ -1,5 +1,6 @@
package com.gkhy.exam.pay.service.impl;
+import cn.com.jit.mof.bean.MOFVerifyResult;
import cn.com.jit.new_vstk.Bean.EnvelopResult;
import cn.com.jit.new_vstk.Bean.SignResult;
import cn.com.jit.new_vstk.Bean.VerifyResult;
@@ -14,10 +15,7 @@
import com.gkhy.exam.pay.mapper.CoalPayMapper;
import com.gkhy.exam.pay.service.CoalPayService;
import com.gkhy.exam.pay.service.CoalPayStudentService;
-import com.gkhy.exam.pay.utils.PayUtils;
-import com.gkhy.exam.pay.utils.ResultVo;
-import com.gkhy.exam.pay.utils.Sign;
-import com.gkhy.exam.pay.utils.SignDto;
+import com.gkhy.exam.pay.utils.*;
import com.ruoyi.common.constant.ResultConstants;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
@@ -39,12 +37,17 @@
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileReader;
import java.io.IOException;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
+
+import static com.gkhy.exam.pay.utils.DemoUtils.generateBase64StringToFile;
@Service
@Slf4j
@@ -258,6 +261,9 @@
if (student.getPayStatus()==1){
throw new BusinessException(this.getClass(),ResultConstants.BUSINESS_ERROR,"请勿重新缴费");
}
+ if (student.getGovPayStatus() == 2){
+ return student.getOrderId();
+ }
PayReqData payReqData = fillData(coalPayStudent,coalPay,coalCategories,coalTicket,1,null);
@@ -269,8 +275,9 @@
// throw new BusinessException(this.getClass(), ResultConstants.BUSINESS_ERROR, "签名验证错误");
// }
payStudent.setId(studentId);
- payStudent.setOrderId(resultVo.getRespdata().getOrderNo());
- payStudent.setGovPayStatus(1);
+ payStudent.setOrderId(resultVo.getRespdata().getOrderId());
+ payStudent.setOrderNo(resultVo.getRespdata().getOrderNo());
+ payStudent.setGovPayStatus(2);
payStudent.setPayCode(resultVo.getRespdata().getBillNo());
coalPayStudentService.updateByCoalPayStudent(payStudent);
return resultVo.getRespdata().getOrderId();
@@ -309,8 +316,9 @@
ResultVo resultVo = payUtils.sendApiPost(payReqData);
if (resultVo.getRespcode().equals("BUS0000")) {
payStudent.setCoalPayId(coalPay.getId());
- payStudent.setOrderId(resultVo.getRespdata().getOrderNo());
- payStudent.setGovPayStatus(1);
+ payStudent.setOrderId(resultVo.getRespdata().getOrderId());
+ payStudent.setOrderNo(resultVo.getRespdata().getOrderNo());
+ payStudent.setGovPayStatus(2);
payStudent.setPayCode(resultVo.getRespdata().getBillNo());
coalPayStudentService.updateByCoalPayIdAndStatus(payStudent);
return resultVo.getRespdata().getOrderId();
@@ -327,46 +335,46 @@
}
@Override
- public ResultVo topay() throws IOException {
+ public ResultVo topay() throws IOException, BillSignException {
PayReqData payReqData = new PayReqData();
PayReqData.Feedata feedatas = new PayReqData.Feedata();
//订单编号
- payReqData.setOrderNo("NC202502170905105061");
+ payReqData.setOrderNo("CO202502180328549421");
//订单总金额
- payReqData.setMoney(BigDecimal.valueOf(112));
+ payReqData.setMoney(BigDecimal.valueOf(159));
//子订单数目
- payReqData.setAmount(1);
+ payReqData.setAmount(2);
//缴费人姓名(单位填单位名称)阿克苏地区博安煤矿安全技术服务中心
- payReqData.setPayerName("阿克苏地区博安煤矿安全技术服务中心");
+ payReqData.setPayerName("闵强明");
//缴费人证件号(单位填同一信用代码)52652900789893140A
- payReqData.setCertNo("52652900789893140A");
+ payReqData.setCertNo("321023197209184616");
//缴款人类型(1个人 2单位)
- payReqData.setPayerType(2);
+ payReqData.setPayerType(1);
//开票单位社会信用代码12650000MB1A9612XD
- payReqData.setInvoiceSocialCode("11650000MB1957293J");
+ payReqData.setInvoiceSocialCode("65000023000000172848");
//开票人
- payReqData.setHandlingPerson("姜倩");
+ payReqData.setHandlingPerson("张三");
//复核人
- payReqData.setChecker("薄晓洁");
+ payReqData.setChecker("李四");
//单位编码547185129
payReqData.setEnterCode("547185129");
//订单描述(非必填)
- payReqData.setDesc("非煤安全作业理论考试-002002");
+ payReqData.setDesc("单位业务");
//订单明细
List<PayReqData.Feedata> feedatas1 = new ArrayList<>();
//数量
-// feedatas.setAmount(1);
-// //业务代码
-// feedatas.setBusCode("DZ12401");
-// //单价
-// feedatas.setPrice(BigDecimal.valueOf(56));
+ feedatas.setAmount(1);
+ //业务代码
+ feedatas.setBusCode("DZ011573");
+ //单价
+ feedatas.setPrice(BigDecimal.valueOf(56));
PayReqData.Feedata feedata = new PayReqData.Feedata();
- feedata.setBusCode("DZ002002");
- feedata.setAmount(2);
- feedata.setPrice(BigDecimal.valueOf(112));
-// feedatas1.add(feedatas);
+ feedata.setBusCode("DZ011574");
+ feedata.setAmount(1);
+ feedata.setPrice(BigDecimal.valueOf(103));
+ feedatas1.add(feedatas);
feedatas1.add(feedata);
payReqData.setFeeDatas(feedatas1);
log.info("请求参数:"+ JSONObject.toJSONString(payReqData));
@@ -374,7 +382,37 @@
PayUtils payUtils = new PayUtils();
ResultVo resultVo = payUtils.sendApiPost(payReqData);
+
String fileData = resultVo.getRespdata().getFileData();
+// String orderNo = resultVo.getRespdata().getOrderNo();
+// String xmlFilePath = "F:\\text/" + orderNo + ".xml";
+// generateBase64StringToFile(fileData, xmlFilePath);
+// String trr2 = "";
+// try {
+// File file2 = new File(xmlFilePath);
+// FileReader reader1 = new FileReader(file2);
+// BufferedReader bReader = new BufferedReader(reader1);
+// StringBuilder sb = new StringBuilder();
+// String s = "";
+// while ((s = bReader.readLine()) != null) {
+// sb.append(s);
+// }
+// bReader.close();
+// trr2 = sb.toString();
+// } catch (Exception e) {
+// e.printStackTrace();
+// }
+// log.info("拼接原文为trr2:"+trr2);
+//
+// BillSign billSign = new BillSign();
+// String signData="";
+// try {
+// signData = billSign.signBill(trr2);
+// } catch (BillSignException e) {
+// throw new RuntimeException(e);
+// } catch (Exception e) {
+// throw new RuntimeException(e);
+// }
//票据原文转为byte字节文件
byte[] decode = Base64.getDecoder().decode(fileData);
//byte字节文件转为xml字符串
@@ -386,10 +424,12 @@
throw new RuntimeException(e);
}
log.info("票据原文为:"+document.asXML());
+ BillSign billSign = new BillSign();
+ String s = billSign.readRefSignDto(document);
Element rootElement = document.getRootElement();
- SignResult sign = payUtils.sign(decode);
- VerifyResult verify = payUtils.verify(decode,sign.getSignData());
- SignDto signDto = new SignDto("SM3", "DETACH", new Date(), verify.getSubjectdn(), verify.getSn(), verify.getIssure());
+ SignResult sign = payUtils.sign(s);
+ MOFVerifyResult verify = payUtils.verify(sign.getSignData(),s);
+ SignDto signDto = new SignDto(verify.getSignTime(), new String(Base64.getEncoder().encode(sign.getSignData())), verify.getIssure(),verify.getSn());
log.info("拼接对象为:"+JSONObject.toJSONString(signDto));
Sign sign1 = new Sign();
Document signature = sign1.getSignature(signDto);
@@ -399,7 +439,7 @@
// EnvelopResult envelopResult = payUtils.encryptEnvelop(document.asXML().getBytes());
// log.info("制作数字信封为:"+ Arrays.toString(envelopResult.getEnvelopData()));
log.info("签名后票据为:"+document.asXML());
- ResultVo resultVo1 = payUtils.uploadXml(resultVo.getRespdata().getOrderNo(), document.asXML().getBytes());
+ ResultVo resultVo1 = payUtils.uploadXml(resultVo.getRespdata().getOrderNo(), document.asXML());
return resultVo1;
}
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/utils/BillSign.java b/exam-system/src/main/java/com/gkhy/exam/pay/utils/BillSign.java
index 3d509ec..ba555f1 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/utils/BillSign.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/utils/BillSign.java
@@ -1,10 +1,12 @@
package com.gkhy.exam.pay.utils;
+import com.alibaba.fastjson2.JSONObject;
import org.apache.commons.io.FileUtils;
import org.dom4j.*;
import java.io.File;
import java.io.IOException;
+import java.util.Map;
public class BillSign {
ISignCommond signCommond;
@@ -18,8 +20,10 @@
}
+ public BillSign(){}
- public String signBill(byte[] bytes) throws BillSignException {
+
+ public String signBill(byte[] bytes) throws Exception {
/* 41 */
return signBill(new String(bytes));
@@ -45,12 +49,14 @@
/* 62 */
throw new BillSignException("文件读取失败。文件名称" + file.getAbsolutePath(), e);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
}
- public String signBill(String xml) throws BillSignException {
+ public String signBill(String xml) throws Exception {
/* 78 */
Document xmlDoc = null;
@@ -82,9 +88,11 @@
}
- private Node genUnitSignNode(String plain) {
+ private Node genUnitSignNode(String plain) throws Exception {
/* 100 */
- SignDto signDto = this.signCommond.signSm3Detach(plain);
+ PayUtils payUtils = new PayUtils();
+ JSONObject jsonObject = payUtils.signFileV2(plain);
+ SignDto content = (SignDto) jsonObject.get("content");
/* 102 */
Document document = DocumentHelper.createDocument();
@@ -98,28 +106,28 @@
/* 107 */
signedInfo.addElement("Reference").addAttribute("URI", "/EInvoice/Header|/EInvoice/EInvoiceData");
/* 108 */
- signedInfo.addElement("SignatureAlgorithm").setText(signDto.getSignatureAlgorithm());
+ signedInfo.addElement("SignatureAlgorithm").setText(content.getSignatureAlgorithm());
/* 109 */
- signedInfo.addElement("SignatureFormat").setText(signDto.getSignatureFormat());
+ signedInfo.addElement("SignatureFormat").setText(content.getSignatureFormat());
/* 111 */
- signature.addElement("SignatureTime").setText(signDto.getSignatureTime());
+ signature.addElement("SignatureTime").setText(content.getSignatureTime());
/* 112 */
- signature.addElement("SignatureValue").setText(signDto.getSignatureValue());
+ signature.addElement("SignatureValue").setText(content.getSignatureValue());
/* 114 */
Element keyInfo = signature.addElement("KeyInfo");
/* 115 */
- keyInfo.addElement("SerialNumber").setText(signDto.getSerialNumber());
+ keyInfo.addElement("SerialNumber").setText(content.getSerialNumber());
/* 116 */
- keyInfo.addElement("X509IssuerName").setText(signDto.getIssuerDn());
+ keyInfo.addElement("X509IssuerName").setText(content.getIssuerDn());
/* 117 */
return (Node) signature;
}
- private String readRefSignDto(Document xmlDoc) throws BillSignException {
+ public String readRefSignDto(Document xmlDoc) throws BillSignException {
/* 130 */
Element root = xmlDoc.getRootElement();
/* 131 */
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/utils/DemoUtils.java b/exam-system/src/main/java/com/gkhy/exam/pay/utils/DemoUtils.java
index 685fa28..66612af 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/utils/DemoUtils.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/utils/DemoUtils.java
@@ -137,6 +137,8 @@
} catch (BillSignException e) {
e.printStackTrace();
return null;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
}
}
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java b/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
index 2d5d976..ab6c6e9 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/utils/PayUtils.java
@@ -1,5 +1,8 @@
package com.gkhy.exam.pay.utils;
+import cn.com.jit.mof.MOFClient;
+import cn.com.jit.mof.bean.MOFSignResult;
+import cn.com.jit.mof.bean.MOFVerifyResult;
import cn.com.jit.new_vstk.AdvanceSignClient;
import cn.com.jit.new_vstk.Bean.*;
import cn.com.jit.new_vstk.SignClient;
@@ -89,20 +92,22 @@
public ResultVo sendApiPost(PayReqData payReqData) throws IOException {
Map<String, String> param = new HashMap<>();
+ String appid = "A1749891493E4CDDBFE4506357B1F0AB";
+ String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/invoice.do";
- HttpPost httpPost = new HttpPost("http://finpt.xjcz.gov.cn/fs-service-test/fs-pay/invoice.do");
- log.info("请求地址:"+"http://finpt.xjcz.gov.cn/fs-service-test/fs-pay/invoice.do");
+ HttpPost httpPost = new HttpPost(orderUrl);
+ log.info("请求地址:"+orderUrl);
//请求参数转为json格式base64编码
String reqData = Base64.getEncoder().encodeToString(JSONObject.toJSONString(payReqData).getBytes());
- String mac = "ED76A5F1703540BE977D34780B371FEB" + "||" + reqData;
+ String mac = appid + "||" + reqData;
mac = DigestUtils.md5Hex(mac.getBytes());
- param.put("appid", "ED76A5F1703540BE977D34780B371FEB");
- log.info("请求appid:"+"ED76A5F1703540BE977D34780B371FEB");
+ param.put("appid", appid);
+ log.info("请求appid:"+appid);
param.put("reqdata", reqData);
param.put("mac", mac);
httpPost.setEntity(assemblyFormEntity(param, "utf-8"));
- HttpClient httpClient = getHttpClient("http://finpt.xjcz.gov.cn/fs-service-test/fs-pay/invoice.do");
+ HttpClient httpClient = getHttpClient(orderUrl);
HttpResultVo execute = httpClient.execute(httpPost, getResponseHandler());
String stringContent = execute.getStringContent();
ResultVo resultVo = JSONObject.parseObject(stringContent, ResultVo.class);
@@ -354,7 +359,7 @@
}
//上传财政电子票据签名文件
- public ResultVo uploadXml(String orderId, byte[] plain) throws IOException {
+ public ResultVo uploadXml(String orderId, String plain) throws IOException {
Map<String, String> params = new HashMap<>();
// Sign sign = new Sign();
@@ -364,21 +369,24 @@
// SignDto signDto = new SignDto("SM3", "Base64", new Date(), verify.getReturnData(), verify.getSerialNumber(), verify.getIssure());
// Element signature = sign.getSignature(signDto);
+ String appid = "A1749891493E4CDDBFE4506357B1F0AB";
+ String orderUrl = "http://finpt.xjcz.gov.cn/fs-service/fs-pay/uploadXml.do";
+
JSONObject jsonObject = new JSONObject();
jsonObject.put("orderNo",orderId);
- jsonObject.put("fileData", Base64.getEncoder().encodeToString(plain));
+ jsonObject.put("fileData", Base64.getEncoder().encodeToString(plain.getBytes()));
String reqdata = Base64.getEncoder().encodeToString(jsonObject.toJSONString().getBytes());
- String mac = "ED76A5F1703540BE977D34780B371FEB"+"||" +reqdata;
+ String mac = appid+"||" +reqdata;
mac = DigestUtils.md5Hex(mac.getBytes());
- params.put("appid","ED76A5F1703540BE977D34780B371FEB");
+ params.put("appid",appid);
params.put("reqdata",reqdata);
params.put("mac",mac);
- HttpPost httpPost = new HttpPost("http://finpt.xjcz.gov.cn/fs-service-test/fs-pay/uploadXml.do");
+ HttpPost httpPost = new HttpPost(orderUrl);
httpPost.setEntity(assemblyFormEntity(params,"utf-8"));
- HttpClient httpClient = getHttpClient("http://finpt.xjcz.gov.cn/fs-service-test/fs-pay/uploadXml.do");
+ HttpClient httpClient = getHttpClient(orderUrl);
HttpResultVo execute = httpClient.execute(httpPost, getResponseHandler());
String stringContent = execute.getStringContent();
ResultVo resultVo = JSONObject.parseObject(stringContent, ResultVo.class);
@@ -413,14 +421,53 @@
}
+ public JSONObject signFileV2(String fileData) throws Exception {
+ JSONObject xysfResult = new JSONObject();
+ String certId = "11650000MB1957293J";
+ MOFSignResult result = null;
+// Map<String, Object> mmp = new HashMap<>();
+
+ try {
+ String filePath = "F:\\text\\cssconfig.properties";
+ System.out.println("配置文件路径:" + filePath);
+ MOFClient client = new MOFClient(filePath);
+ System.out.println("证书标识为:" + certId);
+ System.out.println("待签名数据:" + fileData);
+ result = client.sign(certId, fileData.getBytes(StandardCharsets.UTF_8));
+ System.out.println("签名返回结果:" + JSONObject.toJSONString(result));
+ byte[] signData = result.getSignData();
+ String base64Str = new String(Base64.getEncoder().encode(signData));
+// mmp.put("signResult", base64Str);
+ MOFVerifyResult resultVer = client.verifySign(signData, fileData.getBytes(StandardCharsets.UTF_8));
+ System.out.println("验签结果为:" + JSONObject.toJSONString(resultVer));
+// mmp.put("issure", resultVer.getIssure());
+// mmp.put("sn", resultVer.getSn());
+// mmp.put("signTime", resultVer.getSignTime());
+ SignDto signDto = new SignDto(resultVer.getSignTime(),base64Str,resultVer.getIssure(),resultVer.getSn());
+ xysfResult.put("success", Boolean.valueOf(true));
+ xysfResult.put("content", signDto);
+ return xysfResult;
+ } catch (NewCSSException e) {
+ System.out.println("****签名失败****");
+ System.out.println("错误号为:" + e.getCode());
+ System.out.println("错误描述为:" + e.getDescription());
+ xysfResult.put("success", Boolean.valueOf(false));
+ xysfResult.put("msg", "系统错误");
+ return xysfResult;
+ }
+ }
+
+
+
//签名
- public SignResult sign(byte[] strData) {
+ public SignResult sign(String strData) {
SignResult result = null;
String certId = "11650000MB1957293J";
try {
- AdvanceSignClient client = new AdvanceSignClient("F:\\text\\cssconfig.properties");
- result = client.sign(certId,strData);
+ MOFClient client = new MOFClient("F:\\text\\cssconfig.properties");
+ result = client.sign(certId,strData.getBytes(StandardCharsets.UTF_8));
log.info("***签名成功***");
+ log.info("签名返回结果为:"+result);
byte[] signData = result.getSignData();
String s = new String(Base64.getEncoder().encode(signData));
log.info("签名结果为:"+s);
@@ -436,14 +483,12 @@
/**
* 验签名
*/
- public VerifyResult verify(byte[] strData,byte[] signData){
- VerifyResult verify = null;
+ public MOFVerifyResult verify(byte[] strData,String signData){
+ MOFVerifyResult verify = null;
try {
- SignClient client = new SignClient("F:\\text\\cssconfig.properties");
- byte[] plain = strData;
- byte[] sign = signData;
+ MOFClient client = new MOFClient("F:\\text\\cssconfig.properties");
- verify = client.verify(sign, plain);
+ verify = client.verifySign(strData, signData.getBytes(StandardCharsets.UTF_8));
log.info("验签成功");
log.info(" 证书subjectdn: " + verify.getSubjectdn());
log.info(" 证书issuer: " + verify.getIssure());
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/utils/SignCommond.java b/exam-system/src/main/java/com/gkhy/exam/pay/utils/SignCommond.java
index a5fd109..aaf9a89 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/utils/SignCommond.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/utils/SignCommond.java
@@ -17,7 +17,7 @@
// 将摘要转换为 Base64 编码的字符串
String signatureValue = Base64.getEncoder().encodeToString(hashBytes);
- SignDto signDto = new SignDto("SM3", "Base64", new Date(), signatureValue, "1234567890", "issuerDn");
+ SignDto signDto = new SignDto( new Date(), signatureValue, "1234567890", "issuerDn");
return signDto;
diff --git a/exam-system/src/main/java/com/gkhy/exam/pay/utils/config/PropertiesUtil.java b/exam-system/src/main/java/com/gkhy/exam/pay/utils/config/PropertiesUtil.java
index 2a98e26..e8f3038 100644
--- a/exam-system/src/main/java/com/gkhy/exam/pay/utils/config/PropertiesUtil.java
+++ b/exam-system/src/main/java/com/gkhy/exam/pay/utils/config/PropertiesUtil.java
@@ -3,7 +3,7 @@
/* */
/* */
-import com.xjhys.edu.fee.sdk.annotation.PropertiesConfig;
+//import com.xjhys.edu.fee.sdk.annotation.PropertiesConfig;
import java.io.IOException;
import java.io.InputStream;
diff --git a/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml b/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml
index fddcd40..1f0eecd 100644
--- a/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml
+++ b/exam-system/src/main/resources/mapper/pay/CoalPayStudentMapper.xml
@@ -4,7 +4,7 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.gkhy.exam.pay.mapper.CoalPayStudentMapper">
<sql id="selectCoalPayStudentVo">
- select id, coal_pay_id, name, id_card, phone, sex, pay_code, pay_status,pay_type,order_id,file_data,gov_pay_status, update_by, update_time, create_by, create_time, del_flag from coal_pay_student
+ select id, coal_pay_id, name, id_card, phone, sex, pay_code, pay_status,pay_type,order_id,order_no,file_data,gov_pay_status, update_by, update_time, create_by, create_time, del_flag from coal_pay_student
</sql>
<insert id="insertCoalPayStudent">
insert into coal_pay_student
@@ -19,6 +19,7 @@
<if test="payStatus != null">pay_status,</if>
<if test="payType != null">pay_type,</if>
<if test="orderId!=null">order_id,</if>
+ <if test="orderNo!=null">order_no,</if>
<if test="fileData!=null">file_data,</if>
<if test="govPayStatus!=null">gov_pay_status,</if>
<if test="createBy != null">create_by,</if>
@@ -38,6 +39,7 @@
<if test="payStatus != null">#{payStatus},</if>
<if test="payType != null">#{payType},</if>
<if test="orderId!=null">#{orderId},</if>
+ <if test="orderNo!=null">#{orderNo},</if>
<if test="fileData!=null">#{fileData},</if>
<if test="govPayStatus!=null">#{govPayStatus},</if>
<if test="createBy != null">#{createBy},</if>
@@ -66,6 +68,7 @@
<if test="payCode != null">pay_code = #{payCode},</if>
<if test="payStatus != null">pay_status = #{payStatus},</if>
<if test="orderId!=null">order_id=#{orderId},</if>
+ <if test="orderNo!=null">order_no=#{orderNo},</if>
<if test="fileData!=null">file_data=#{fileData},</if>
<if test="govPayStatus!=null">gov_pay_status=#{govPayStatus},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
@@ -83,10 +86,9 @@
</update>
<update id="updateByCoalPayIdAndStatus">
update coal_pay_student
- <trim prefix="SET" suffixOverrides=",">
- <if test="payType != null">pay_type = #{payType},</if>
- </trim>
- where coal_pay_id = #{coalPayId} and pay_status = 0
+ set order_id = #{orderId},order_no=#{orderNo},
+ gov_pay_status = #{govPayStatus},pay_code = #{payCode}
+ where coal_pay_id = #{coalPayId} and pay_status = 0 and pay_type = 2
</update>
<select id="selectByCoalPayId" resultType="com.gkhy.exam.pay.entity.CoalPayStudent">
diff --git a/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml b/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
index 2cabe3f..4e837a6 100644
--- a/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
+++ b/exam-system/src/main/resources/mapper/pay/NonCoalPayMapper.xml
@@ -269,8 +269,7 @@
t.gov_pay_status,
t.order_no
from non_coal_pay a
- inner join non_coal_pay_student t on t.non_coal_pay_id = a.id and t.del_flag = 0 and t.pay_status = 0 and
- t.order_id is null
+ inner join non_coal_pay_student t on t.non_coal_pay_id = a.id and t.del_flag = 0 and t.pay_status = 0
inner join non_coal_pay_category b on a.id = b.non_coal_pay_id and b.del_flag = 0
left join non_coal_category c on b.category_id = c.id and c.del_flag = 0
where a.del_flag = 0
--
Gitblit v1.9.2