|
|
@@ -3,13 +3,14 @@ package org.jeecg.modules.utils;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.google.gson.JsonArray;
|
|
|
+import com.google.gson.JsonObject;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.jeecg.common.zhutils.*;
|
|
|
import org.jeecg.modules.hlwpayaccount.entity.HlwPayAccountCmb;
|
|
|
import org.jeecg.modules.hlwpayaccount.entity.HlwPayRecord;
|
|
|
import org.jeecg.modules.hlwpayaccount.service.IHlwPayAccountCmbService;
|
|
|
-import org.jeecg.modules.hlwpayment.entity.HlwPayment;
|
|
|
import org.jeecg.modules.hlwpayment.entity.HlwPaymentDetail;
|
|
|
import org.jeecg.modules.hlwsubcontractor.entity.HlwSubcontractor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
@@ -53,13 +54,13 @@ public class PayRsaCommon {
|
|
|
List<HlwPayAccountCmb> hlwPayAccountCmbList = new ArrayList<>();
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//funCode接口名称
|
|
|
String funCode = PayConst.DCLISACC;
|
|
|
//业务类别
|
|
|
- obj_body.put("buscod", hlwSubcontractor.getBuscod());
|
|
|
+ obj_body.addProperty("buscod", hlwSubcontractor.getBuscod());
|
|
|
//业务模式
|
|
|
- obj_body.put("busmod", hlwSubcontractor.getBusmod());
|
|
|
+ obj_body.addProperty("busmod", hlwSubcontractor.getBusmod());
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
@@ -102,7 +103,7 @@ public class PayRsaCommon {
|
|
|
public static void NTAGTLS2(HlwSubcontractor hlwSubcontractor) {
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//funCode接口名称
|
|
|
String funCode = PayConst.NTAGTLS2;
|
|
|
//账户
|
|
|
@@ -110,13 +111,13 @@ public class PayRsaCommon {
|
|
|
/**
|
|
|
* 查询条件
|
|
|
*/
|
|
|
- JSONArray jsonArrayRequest = new JSONArray();
|
|
|
- JSONObject jsonObjectRequest = new JSONObject();
|
|
|
- jsonObjectRequest.put("buscod", hlwSubcontractor.getBuscod());
|
|
|
- jsonObjectRequest.put("accnbr", hlwPayAccountCmb.getAccnbr());
|
|
|
+ JsonArray jsonArrayRequest = new JsonArray();
|
|
|
+ JsonObject jsonObjectRequest = new JsonObject();
|
|
|
+ jsonObjectRequest.addProperty("buscod", hlwSubcontractor.getBuscod());
|
|
|
+ jsonObjectRequest.addProperty("accnbr", hlwPayAccountCmb.getAccnbr());
|
|
|
jsonArrayRequest.add(jsonObjectRequest);
|
|
|
//查询条件
|
|
|
- obj_body.put("ntagtls2x", jsonArrayRequest);
|
|
|
+ obj_body.add("ntagtls2x", jsonArrayRequest);
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
@@ -161,7 +162,7 @@ public class PayRsaCommon {
|
|
|
JSONObject jsonResponseBody = null;
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//支付总量
|
|
|
int payLength = hlgPaymentDetailList.size();
|
|
|
//funCode接口名称
|
|
|
@@ -171,54 +172,54 @@ public class PayRsaCommon {
|
|
|
/**
|
|
|
* 模式信息
|
|
|
*/
|
|
|
- JSONArray jsonArrayRequest1 = new JSONArray();
|
|
|
- JSONObject jsonObjectRequest1 = new JSONObject();
|
|
|
- jsonObjectRequest1.put("busmod", hlwSubcontractor.getBusmod());
|
|
|
+ JsonArray jsonArrayRequest1 = new JsonArray();
|
|
|
+ JsonObject jsonObjectRequest1 = new JsonObject();
|
|
|
+ jsonObjectRequest1.addProperty("busmod", hlwSubcontractor.getBusmod());
|
|
|
jsonArrayRequest1.add(jsonObjectRequest1);
|
|
|
/**
|
|
|
* 汇总信息
|
|
|
*/
|
|
|
- JSONArray jsonArrayRequest2 = new JSONArray();
|
|
|
- JSONObject jsonObjectRequest2 = new JSONObject();
|
|
|
+ JsonArray jsonArrayRequest2 = new JsonArray();
|
|
|
+ JsonObject jsonObjectRequest2 = new JsonObject();
|
|
|
//批次开始标志,’Y’表示批次开始
|
|
|
- jsonObjectRequest2.put("begtag", "Y");
|
|
|
+ jsonObjectRequest2.addProperty("begtag", "Y");
|
|
|
//批次结束标志,’Y’表示批次结束
|
|
|
- jsonObjectRequest2.put("endtag", "Y");
|
|
|
+ jsonObjectRequest2.addProperty("endtag", "Y");
|
|
|
//总金额
|
|
|
- jsonObjectRequest2.put("ttlamt", totalPayment);
|
|
|
+ jsonObjectRequest2.addProperty("ttlamt", totalPayment);
|
|
|
//总笔数
|
|
|
- jsonObjectRequest2.put("ttlcnt", String.valueOf(payLength));
|
|
|
+ jsonObjectRequest2.addProperty("ttlcnt", String.valueOf(payLength));
|
|
|
//总次数(该批次数据计划分多少次上传完,代发代扣系统要求第一次就要必输)
|
|
|
- jsonObjectRequest2.put("ttlnum", 1);
|
|
|
+ jsonObjectRequest2.addProperty("ttlnum", 1);
|
|
|
//本次金额
|
|
|
- jsonObjectRequest2.put("curamt", totalPayment);
|
|
|
+ jsonObjectRequest2.addProperty("curamt", totalPayment);
|
|
|
//本次笔数
|
|
|
- jsonObjectRequest2.put("curcnt", String.valueOf(payLength));
|
|
|
+ jsonObjectRequest2.addProperty("curcnt", String.valueOf(payLength));
|
|
|
//交易货币
|
|
|
- jsonObjectRequest2.put("ccynbr", PayConst.ccynbr);
|
|
|
+ jsonObjectRequest2.addProperty("ccynbr", PayConst.ccynbr);
|
|
|
//分行号
|
|
|
- jsonObjectRequest2.put("bbknbr", hlwPayAccountCmb.getBbknbr());
|
|
|
+ jsonObjectRequest2.addProperty("bbknbr", hlwPayAccountCmb.getBbknbr());
|
|
|
//账号
|
|
|
- jsonObjectRequest2.put("accnbr", hlwPayAccountCmb.getAccnbr());
|
|
|
+ jsonObjectRequest2.addProperty("accnbr", hlwPayAccountCmb.getAccnbr());
|
|
|
//货币市场
|
|
|
- jsonObjectRequest2.put("ccymkt", "0");
|
|
|
+ jsonObjectRequest2.addProperty("ccymkt", "0");
|
|
|
//交易代码(代发类型),默认代发其他
|
|
|
- jsonObjectRequest2.put("trstyp", hlwSubcontractor.getTrsTyp());
|
|
|
+ jsonObjectRequest2.addProperty("trstyp", hlwSubcontractor.getTrsTyp());
|
|
|
//用途
|
|
|
- jsonObjectRequest2.put("nusage", PayConst.NUSAGE);
|
|
|
+ jsonObjectRequest2.addProperty("nusage", PayConst.NUSAGE);
|
|
|
//业务参考号采用时间戳+8位随机数
|
|
|
String code = RandomRequest.getRandom(8);
|
|
|
String yurref = code + System.currentTimeMillis();
|
|
|
- jsonObjectRequest2.put("yurref", yurref);
|
|
|
+ jsonObjectRequest2.addProperty("yurref", yurref);
|
|
|
//网银审批标志
|
|
|
- jsonObjectRequest2.put("grtflg", hlwSubcontractor.getGrtFlg());
|
|
|
+ jsonObjectRequest2.addProperty("grtflg", hlwSubcontractor.getGrtFlg());
|
|
|
jsonArrayRequest2.add(jsonObjectRequest2);
|
|
|
/**
|
|
|
* 明细信息
|
|
|
*/
|
|
|
- JSONArray jsonArrayRequest3 = new JSONArray();
|
|
|
+ JsonArray jsonArrayRequest3 = new JsonArray();
|
|
|
for (int i = 0; i < payLength; i++) {
|
|
|
- JSONObject trs = new JSONObject();
|
|
|
+ JsonObject trs = new JsonObject();
|
|
|
HlwPaymentDetail hlgPaymentDetail = hlgPaymentDetailList.get(i);
|
|
|
//交易序号
|
|
|
//为8位纯数字,格式为:00000001、00000002...
|
|
|
@@ -231,36 +232,36 @@ public class PayRsaCommon {
|
|
|
}
|
|
|
return item;
|
|
|
}).iterator().next();
|
|
|
- trs.put("trxseq", trxseq);
|
|
|
+ trs.addProperty("trxseq", trxseq);
|
|
|
//账号
|
|
|
- trs.put("accnbr", hlgPaymentDetail.getCardNumber());
|
|
|
+ trs.addProperty("accnbr", hlgPaymentDetail.getCardNumber());
|
|
|
//户名
|
|
|
- trs.put("accnam", hlgPaymentDetail.getUserName());
|
|
|
+ trs.addProperty("accnam", hlgPaymentDetail.getUserName());
|
|
|
//四舍五入,保留俩位小数
|
|
|
BigDecimal bg = BigDecimal.valueOf(hlgPaymentDetail.getNetPayment()).setScale(2, RoundingMode.HALF_UP);
|
|
|
//金额
|
|
|
- trs.put("trsamt", bg.toString());
|
|
|
+ trs.addProperty("trsamt", bg.toString());
|
|
|
//系统内标志(Y:开户行是招商银行;N:开户行是他行)
|
|
|
- trs.put("bnkflg", hlgPaymentDetail.getBnkflg());
|
|
|
+ trs.addProperty("bnkflg", hlgPaymentDetail.getBnkflg());
|
|
|
if ("N".equals(hlgPaymentDetail.getBnkflg())) {
|
|
|
//他行开户行
|
|
|
- trs.put("eacbnk", hlgPaymentDetail.getEacbnk());
|
|
|
+ trs.addProperty("eacbnk", hlgPaymentDetail.getEacbnk());
|
|
|
//他行开户地址
|
|
|
- trs.put("eaccty", hlgPaymentDetail.getRcveaa());
|
|
|
+ trs.addProperty("eaccty", hlgPaymentDetail.getRcveaa());
|
|
|
} else {
|
|
|
//他行开户行
|
|
|
- trs.put("eacbnk", "");
|
|
|
+ trs.addProperty("eacbnk", "");
|
|
|
//他行开户地址
|
|
|
- trs.put("eaccty", "");
|
|
|
+ trs.addProperty("eaccty", "");
|
|
|
}
|
|
|
jsonArrayRequest3.add(trs);
|
|
|
}
|
|
|
/**
|
|
|
* 请求报文
|
|
|
*/
|
|
|
- obj_body.put("ntbusmody", jsonArrayRequest1);
|
|
|
- obj_body.put("ntagcagcx1", jsonArrayRequest2);
|
|
|
- obj_body.put("ntagcdtly1", jsonArrayRequest3);
|
|
|
+ obj_body.add("ntbusmody", jsonArrayRequest1);
|
|
|
+ obj_body.add("ntagcagcx1", jsonArrayRequest2);
|
|
|
+ obj_body.add("ntagcdtly1", jsonArrayRequest3);
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
@@ -307,25 +308,25 @@ public class PayRsaCommon {
|
|
|
JSONObject jsonResponseBody = null;
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//funCode接口名称
|
|
|
String funCode = PayConst.NTAGCINY;
|
|
|
/**
|
|
|
* 查询条件
|
|
|
*/
|
|
|
- JSONArray jsonArrayRequest = new JSONArray();
|
|
|
- JSONObject jsonObjectRequest = new JSONObject();
|
|
|
+ JsonArray jsonArrayRequest = new JsonArray();
|
|
|
+ JsonObject jsonObjectRequest = new JsonObject();
|
|
|
//业务类型
|
|
|
- jsonObjectRequest.put("buscod", hlwSubcontractor.getBuscod());
|
|
|
+ jsonObjectRequest.addProperty("buscod", hlwSubcontractor.getBuscod());
|
|
|
//业务参考号
|
|
|
- jsonObjectRequest.put("yurref", hlwPayRecord.getYurref());
|
|
|
+ jsonObjectRequest.addProperty("yurref", hlwPayRecord.getYurref());
|
|
|
//起始日期
|
|
|
- jsonObjectRequest.put("bgndat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyyMMdd"));
|
|
|
+ jsonObjectRequest.addProperty("bgndat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyyMMdd"));
|
|
|
//结束日期
|
|
|
- jsonObjectRequest.put("enddat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyyMMdd"));
|
|
|
+ jsonObjectRequest.addProperty("enddat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyyMMdd"));
|
|
|
jsonArrayRequest.add(jsonObjectRequest);
|
|
|
//查询条件
|
|
|
- obj_body.put("ntagcinyx1", jsonArrayRequest);
|
|
|
+ obj_body.add("ntagcinyx1", jsonArrayRequest);
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
@@ -373,19 +374,19 @@ public class PayRsaCommon {
|
|
|
JSONObject jsonObjectBody = null;
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//funCode接口名称
|
|
|
String funCode = PayConst.NTAGDINF;
|
|
|
/**
|
|
|
* 查询条件
|
|
|
*/
|
|
|
- JSONArray jsonArrayRequest = new JSONArray();
|
|
|
- JSONObject jsonObjectRequest = new JSONObject();
|
|
|
+ JsonArray jsonArrayRequest = new JsonArray();
|
|
|
+ JsonObject jsonObjectRequest = new JsonObject();
|
|
|
//流程实例号
|
|
|
- jsonObjectRequest.put("reqnbr", hlwPayRecord.getAgpseq());
|
|
|
+ jsonObjectRequest.addProperty("reqnbr", hlwPayRecord.getAgpseq());
|
|
|
jsonArrayRequest.add(jsonObjectRequest);
|
|
|
//查询条件
|
|
|
- obj_body.put("ntagdinfy1", jsonArrayRequest);
|
|
|
+ obj_body.add("ntagdinfy1", jsonArrayRequest);
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
@@ -431,7 +432,7 @@ public class PayRsaCommon {
|
|
|
JSONObject jsonObjectBody = null;
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//funCode接口名称
|
|
|
String funCode = PayConst.DCAGPPDF;
|
|
|
HlwPayAccountCmb hlwPayAccountCmb = getAccnbr(hlwSubcontractor);
|
|
|
@@ -439,21 +440,21 @@ public class PayRsaCommon {
|
|
|
* 查询条件
|
|
|
*/
|
|
|
//付款账户
|
|
|
- obj_body.put("payeac", hlwPayAccountCmb.getAccnbr());
|
|
|
+ obj_body.addProperty("payeac", hlwPayAccountCmb.getAccnbr());
|
|
|
//开始日期
|
|
|
- obj_body.put("begdat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyy-MM-dd"));
|
|
|
+ obj_body.addProperty("begdat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyy-MM-dd"));
|
|
|
//结束日期
|
|
|
- obj_body.put("enddat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyy-MM-dd"));
|
|
|
+ obj_body.addProperty("enddat", DateUtils.GetTime(hlwPayRecord.getCreateTime(), "yyyy-MM-dd"));
|
|
|
//业务类型
|
|
|
- obj_body.put("buscod", hlwSubcontractor.getBuscod());
|
|
|
+ obj_body.addProperty("buscod", hlwSubcontractor.getBuscod());
|
|
|
//业务模式
|
|
|
- obj_body.put("busmod", hlwSubcontractor.getBusmod());
|
|
|
+ obj_body.addProperty("busmod", hlwSubcontractor.getBusmod());
|
|
|
//业务参考号
|
|
|
- obj_body.put("ptyref", hlwPayRecord.getYurref());
|
|
|
+ obj_body.addProperty("ptyref", hlwPayRecord.getYurref());
|
|
|
//打印模式 S:逐笔打印:每笔明细生成一个PDF文件 M:批量打印:所有明细生成生成到一个PDF文件里面
|
|
|
- obj_body.put("prtmod", prtmod);
|
|
|
+ obj_body.addProperty("prtmod", prtmod);
|
|
|
//查询标记,首次查询请输入0
|
|
|
- obj_body.put("begidx", "0");
|
|
|
+ obj_body.addProperty("begidx", "0");
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|
|
|
@@ -490,14 +491,14 @@ public class PayRsaCommon {
|
|
|
JSONObject jsonObjectBody = null;
|
|
|
try {
|
|
|
// body
|
|
|
- JSONObject obj_body = new JSONObject();
|
|
|
+ JsonObject obj_body = new JsonObject();
|
|
|
//funCode接口名称
|
|
|
String funCode = PayConst.DCTASKID;
|
|
|
/**
|
|
|
* 查询条件
|
|
|
*/
|
|
|
//查询ID
|
|
|
- obj_body.put("taskid", taskId);
|
|
|
+ obj_body.addProperty("taskid", taskId);
|
|
|
String result = PayRequest.doRequest(obj_body, funCode, hlwSubcontractor.getUserId(), hlwSubcontractor.getPaymentUrl(),
|
|
|
RsaUtils.getPublicKeyStr(hlwSubcontractor.getPubKeyUrl()), RsaUtils.getPrivateKeyStr(hlwSubcontractor.getPriKeyUrl()), hlwSubcontractor.getAesKey());
|
|
|
if (StringUtils.isNotBlank(result)) {
|