工商银行微信支付对接
This commit is contained in:
parent
77b6346b33
commit
4901db65ac
8 changed files with 489 additions and 72 deletions
16
pom.xml
16
pom.xml
|
|
@ -390,6 +390,22 @@
|
||||||
<artifactId>geodesy</artifactId>
|
<artifactId>geodesy</artifactId>
|
||||||
<version>1.1.3</version>
|
<version>1.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.icbc</groupId>
|
||||||
|
<artifactId>icbc-api-sdk-cop</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.icbc</groupId>
|
||||||
|
<artifactId>icbc-api-sdk-cop-io</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.icbc</groupId>
|
||||||
|
<artifactId>icbc-hsm</artifactId>
|
||||||
|
<version>1.0.5</version>
|
||||||
|
</dependency>
|
||||||
<!--<dependency>-->
|
<!--<dependency>-->
|
||||||
<!--<groupId>com.baidu.aip</groupId>-->
|
<!--<groupId>com.baidu.aip</groupId>-->
|
||||||
<!-- <artifactId>java-sdk</artifactId>-->
|
<!-- <artifactId>java-sdk</artifactId>-->
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import org.jaudiotagger.audio.AudioFileIO;
|
||||||
import org.jaudiotagger.audio.mp3.MP3AudioHeader;
|
import org.jaudiotagger.audio.mp3.MP3AudioHeader;
|
||||||
import org.jaudiotagger.audio.mp3.MP3File;
|
import org.jaudiotagger.audio.mp3.MP3File;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
|
@ -30,6 +31,8 @@ import java.util.*;
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AliFileUploadController {
|
public class AliFileUploadController {
|
||||||
|
|
||||||
|
@Value("${file.upload.path}")
|
||||||
|
public String filePath = "";
|
||||||
|
|
||||||
private final CommonInfoService commonRepository;
|
private final CommonInfoService commonRepository;
|
||||||
|
|
||||||
|
|
@ -67,7 +70,7 @@ public class AliFileUploadController {
|
||||||
String http = commonRepository.findOne(19).getValue();
|
String http = commonRepository.findOne(19).getValue();
|
||||||
String[] split = http.split("://");
|
String[] split = http.split("://");
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
|
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = http +fileName;
|
String url = http +fileName;
|
||||||
|
|
@ -109,7 +112,7 @@ public class AliFileUploadController {
|
||||||
String http = commonRepository.findOne(19).getValue();
|
String http = commonRepository.findOne(19).getValue();
|
||||||
String[] split = http.split("://");
|
String[] split = http.split("://");
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
|
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
String url = http +fileName;
|
String url = http +fileName;
|
||||||
|
|
@ -152,7 +155,7 @@ public class AliFileUploadController {
|
||||||
String http = commonRepository.findOne(19).getValue();
|
String http = commonRepository.findOne(19).getValue();
|
||||||
String[] split = http.split("://");
|
String[] split = http.split("://");
|
||||||
// 上传文件路径
|
// 上传文件路径
|
||||||
String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
|
// String filePath ="/www/wwwroot/"+split[1]+"/file/uploadPath";
|
||||||
// 上传并返回新文件名称
|
// 上传并返回新文件名称
|
||||||
String fileName = FileUploadUtils.upload(filePath, file);
|
String fileName = FileUploadUtils.upload(filePath, file);
|
||||||
url = http +fileName;
|
url = http +fileName;
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.io.BufferedReader;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.*;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -145,76 +143,100 @@ public class ApiWeiXinPayController {
|
||||||
|
|
||||||
@PostMapping("/notifyJsApi")
|
@PostMapping("/notifyJsApi")
|
||||||
@ApiOperation("微信回调")
|
@ApiOperation("微信回调")
|
||||||
public String notifyJsApi(HttpServletRequest request) {
|
public void notifyJsApi(HttpServletRequest req, HttpServletResponse resp) {
|
||||||
String resXml = "";
|
PrintWriter out = null;
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = request.getInputStream();
|
String result = wxService.icbcPayBack(req,3);
|
||||||
//将InputStream转换成xmlString
|
resp.setContentType("application/json; charset=utf-8");
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
out = resp.getWriter();
|
||||||
StringBuilder sb = new StringBuilder();
|
out.write(result);
|
||||||
String line = null;
|
|
||||||
try {
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
sb.append(line + "\n");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.info(e.getMessage());
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
inputStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resXml = sb.toString();
|
|
||||||
String result = wxService.payBack(resXml,3);
|
|
||||||
log.info("成功");
|
|
||||||
log.info(result);
|
|
||||||
return result;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("微信手机支付失败:" + e.getMessage(),e);
|
log.error("【工商银行】微信支付回调处理失败,请检查原因!!!,{}", e.getMessage());
|
||||||
String result = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[报文为空]]></return_msg>" + "</xml> ";
|
} finally {
|
||||||
log.info("失败");
|
out.flush();
|
||||||
log.info(result);
|
out.close();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
// String resXml = "";
|
||||||
|
// try {
|
||||||
|
// InputStream inputStream = request.getInputStream();
|
||||||
|
// //将InputStream转换成xmlString
|
||||||
|
// BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
// StringBuilder sb = new StringBuilder();
|
||||||
|
// String line = null;
|
||||||
|
// try {
|
||||||
|
// while ((line = reader.readLine()) != null) {
|
||||||
|
// sb.append(line + "\n");
|
||||||
|
// }
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// log.info(e.getMessage());
|
||||||
|
// } finally {
|
||||||
|
// try {
|
||||||
|
// inputStream.close();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// resXml = sb.toString();
|
||||||
|
// String result = wxService.payBack(resXml,3);
|
||||||
|
// log.info("成功");
|
||||||
|
// log.info(result);
|
||||||
|
// return result;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.info("微信手机支付失败:" + e.getMessage(),e);
|
||||||
|
// String result = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[报文为空]]></return_msg>" + "</xml> ";
|
||||||
|
// log.info("失败");
|
||||||
|
// log.info(result);
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/notifyJsApiShop")
|
@PostMapping("/notifyJsApiShop")
|
||||||
@ApiOperation("微信回调")
|
@ApiOperation("微信回调")
|
||||||
public String notifyJsApiShop(HttpServletRequest request) {
|
public void notifyJsApiShop(HttpServletRequest req, HttpServletResponse resp) {
|
||||||
String resXml = "";
|
PrintWriter out = null;
|
||||||
try {
|
try {
|
||||||
InputStream inputStream = request.getInputStream();
|
String result = wxService.icbcPayBack(req,4);
|
||||||
//将InputStream转换成xmlString
|
resp.setContentType("application/json; charset=utf-8");
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
out = resp.getWriter();
|
||||||
StringBuilder sb = new StringBuilder();
|
out.write(result);
|
||||||
String line = null;
|
|
||||||
try {
|
|
||||||
while ((line = reader.readLine()) != null) {
|
|
||||||
sb.append(line + "\n");
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
log.info(e.getMessage());
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
inputStream.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resXml = sb.toString();
|
|
||||||
String result = wxService.payBack(resXml,4);
|
|
||||||
log.info("成功");
|
|
||||||
log.info(result);
|
|
||||||
return result;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.info("微信手机支付失败:" + e.getMessage(),e);
|
log.error("【工商银行】微信支付回调处理失败,请检查原因!!!,{}", e.getMessage());
|
||||||
String result = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[报文为空]]></return_msg>" + "</xml> ";
|
} finally {
|
||||||
log.info("失败");
|
out.flush();
|
||||||
log.info(result);
|
out.close();
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
// String resXml = "";
|
||||||
|
// try {
|
||||||
|
// InputStream inputStream = request.getInputStream();
|
||||||
|
// //将InputStream转换成xmlString
|
||||||
|
// BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream));
|
||||||
|
// StringBuilder sb = new StringBuilder();
|
||||||
|
// String line = null;
|
||||||
|
// try {
|
||||||
|
// while ((line = reader.readLine()) != null) {
|
||||||
|
// sb.append(line + "\n");
|
||||||
|
// }
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// log.info(e.getMessage());
|
||||||
|
// } finally {
|
||||||
|
// try {
|
||||||
|
// inputStream.close();
|
||||||
|
// } catch (IOException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// resXml = sb.toString();
|
||||||
|
// String result = wxService.payBack(resXml,4);
|
||||||
|
// log.info("成功");
|
||||||
|
// log.info(result);
|
||||||
|
// return result;
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// log.info("微信手机支付失败:" + e.getMessage(),e);
|
||||||
|
// String result = "<xml>" + "<return_code><![CDATA[FAIL]]></return_code>" + "<return_msg><![CDATA[报文为空]]></return_msg>" + "</xml> ";
|
||||||
|
// log.info("失败");
|
||||||
|
// log.info(result);
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/notifyMp")
|
@PostMapping("/notifyMp")
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,8 @@ public interface WxService {
|
||||||
|
|
||||||
String payBack(String resXml,Integer type);
|
String payBack(String resXml,Integer type);
|
||||||
|
|
||||||
|
String icbcPayBack(HttpServletRequest request, Integer type) throws Exception;
|
||||||
|
|
||||||
boolean refund(String ordersNo);
|
boolean refund(String ordersNo);
|
||||||
|
|
||||||
Result wxTicketOrder(Long userId, Long ticketsId, Integer buyNum, Integer payType,HttpServletRequest request) throws Exception;
|
Result wxTicketOrder(Long userId, Long ticketsId, Integer buyNum, Integer payType,HttpServletRequest request) throws Exception;
|
||||||
|
|
@ -33,4 +35,5 @@ public interface WxService {
|
||||||
Result payCoupon(Long userId, Long couponId, Integer buyNum, Integer payType, HttpServletRequest request) throws Exception;
|
Result payCoupon(Long userId, Long couponId, Integer buyNum, Integer payType, HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
Result buyBucket(Integer num, Long userId, Integer classify,HttpServletRequest request) throws Exception;
|
Result buyBucket(Integer num, Long userId, Integer classify,HttpServletRequest request) throws Exception;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,12 +1,21 @@
|
||||||
package com.sqx.modules.pay.service.impl;
|
package com.sqx.modules.pay.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.crypto.digest.DigestUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.github.wxpay.sdk.WXPay;
|
import com.github.wxpay.sdk.WXPay;
|
||||||
import com.github.wxpay.sdk.WXPayConstants;
|
import com.github.wxpay.sdk.WXPayConstants;
|
||||||
import com.github.wxpay.sdk.WXPayUtil;
|
import com.github.wxpay.sdk.WXPayUtil;
|
||||||
|
import com.icbc.api.DefaultIcbcClient;
|
||||||
|
import com.icbc.api.IcbcApiException;
|
||||||
|
import com.icbc.api.IcbcConstants;
|
||||||
|
import com.icbc.api.request.CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1;
|
||||||
|
import com.icbc.api.response.CardbusinessAggregatepayB2cOnlineConsumepurchaseResponseV1;
|
||||||
|
import com.icbc.api.utils.IcbcSignature;
|
||||||
|
import com.icbc.api.utils.WebUtils;
|
||||||
import com.sqx.common.utils.DateUtils;
|
import com.sqx.common.utils.DateUtils;
|
||||||
import com.sqx.common.utils.Result;
|
import com.sqx.common.utils.Result;
|
||||||
import com.sqx.modules.app.dao.UserMoneyDao;
|
import com.sqx.modules.app.dao.UserMoneyDao;
|
||||||
|
|
@ -55,8 +64,11 @@ import org.springframework.stereotype.Service;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author fang
|
* @author fang
|
||||||
* @date 2020/2/26
|
* @date 2020/2/26
|
||||||
|
|
@ -289,6 +301,14 @@ public class WxServiceImpl implements WxService {
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private Result pay(Double moneys, Integer classify, Long userId, String outTradeNo, HttpServletRequest request, Integer shop) throws Exception {
|
private Result pay(Double moneys, Integer classify, Long userId, String outTradeNo, HttpServletRequest request, Integer shop) throws Exception {
|
||||||
|
if(classify == 3){
|
||||||
|
return this.icbcPay(moneys, classify, userId, outTradeNo, request, shop);
|
||||||
|
}else{
|
||||||
|
return this.defaultPay(moneys, classify, userId, outTradeNo, request, shop);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Result defaultPay(Double moneys, Integer classify, Long userId, String outTradeNo, HttpServletRequest request, Integer shop) throws Exception{
|
||||||
//h5服务域名配置
|
//h5服务域名配置
|
||||||
CommonInfo oneu = commonInfoService.findOne(19);
|
CommonInfo oneu = commonInfoService.findOne(19);
|
||||||
String url;
|
String url;
|
||||||
|
|
@ -643,6 +663,343 @@ public class WxServiceImpl implements WxService {
|
||||||
return xmlBack;
|
return xmlBack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static final String ICBC_MCH_ID = "150537540002";//商户编号
|
||||||
|
private static final String ICBC_MER_PRTCL_NO = "150537540002";//收单产品协议编号
|
||||||
|
private static final String ICBC_APPID = "11000000000000051225";
|
||||||
|
private static final String MY_PRIVATE_KEY = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCx24qZDrnPwAOwFJDmBcdEn+gkPj3tIfDi9nptHobqIPIwwZwtsQ20FxzYTG4QCcuFw4iDGb/VL4oxY4cjkWKjlAkVe6eyFdffiA2+toXK/Nu/U/UkcknHxeNE8CGyf/iV+yEwEiiWZ7zjNvXPGcWG+6IZkk4H9iOKwh2xbk3sd50em95meIxgKDOsaKoJ3VvCJs4ajNt8ly+V6B/at7qMF20XoQG7Qtmm1FCv05QVEH3JIYLg7N4TllYEAxKrTz4Wr4/qiiQ/dVRl6pxkDodJ/8UraFfYbsuOizeGZpAaj8lgkljwD9k32ov1X3GSNbG8EZTMJ7mSH5VWGI+w1Eh7AgMBAAECggEAZQwoOEFHjCK5daaZlDYgOnrnNwAtyrYH18rVT32ShR5muxCknMkE0hZ3iuQRfAc0nDC1NFbCyGoUB29WbfzBn9IRPyVb5y/Fz/fKZ1nntaXna1JV6nkMNfXV42rSmklegEeHWXpXmOwjQqwNB7bKpJ/+Pq0CrD9JfiI/IHlcyEVShNTR3SCxpye8Vkca1/HOBcI/aRLJ0t/xkKBXfkJOpUo7QLvEwhqZN0m/Z+AE84TNNscKNDiNmWDCfntFFzuFIbjYXUrkZwWNDU+LCYtOZ6/WXLrFpp2UoeVdJACBxAHqmaNSZltgavH3swDkMswSwj/gt7lK4k/U8rpp3uw3sQKBgQDW5ddgyyXoADRLyvNiqjRNBayaekdgUZwjs3mMQ9tkAuk+hWCGPNHAM+iIkSmjP5x3ajBrLKAPpN1/iJ0aloi9CAICXCoD4B/lfANc6njZxeIWKEZjV4hUYfXsGp57EHGlgDlAKk727IxfsHJeW7gq9KX5aao1qHyT8Yo8FhyzjwKBgQDT4BQ2o4rBCF0okJDJXgF9WexI3LD+N02Tfd9Yuz8zWaM5wgPw2EDPnwp7jrlA6IcCgn/xlAWCZAHzvD/CIg33BH0bqB9LDkJHHNwmCscczw55jwa2RXJfQFDSZ2lFggAB/01ByyU0ex1Px/Q+p2ykueYbWmQV8xst7ZL03Yu2VQKBgF1417fYZQKGpDibbEXsNpeR8kO3EDjLBplYxXPHSDQ2N/Hj3dpFtg5eBbTxPyUs1Af0/l5/qJdlZJrGd19LPurKAuW35OaOpBETYfsWWb6Pngl5NzSarEfX3Dn4UhrBSk1senp4bKRmu6AbhYOZbX/xrgfQeCKiyJ0pILGGBLHtAoGBAJiHXIXpPl6w8r/dMx6EOnZPYjciCZk5nvNrTnrGcj05brSJ4+RjCmVtjVJd8Se1PlykLg9wDHdOH8mj4BKWCY+m/5oFcmHKJhSjxijs4WLv/O+t85sMa8X+uzB9md+cMv09GhUfde1OJE/nFwJz7Va5LdrLO/pBRXPO8FivlYDxAoGBAKnjcXz3rDyXIQZSG7f81P7FudPeHbX4aywI9yWHzXjcHADVwniEBLxR0oE35Wu0gAcmnGB7aJxNqBgIBrc4VU8yJA896gKaneq20JCVKBcfB6EuHJwK31MF/YCA4JnHhuqaJ91JMnOWHkn/6DJlxbvIc+VDtW7czkvhgFS73JDN"; //应用私钥
|
||||||
|
private static final String APIGW_PUBLIC_KEY = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCMpjaWjngB4E3ATh+G1DVAmQnIpiPEFAEDqRfNGAVvvH35yDetqewKi0l7OEceTMN1C6NPym3zStvSoQayjYV+eIcZERkx31KhtFu9clZKgRTyPjdKMIth/wBtPKjL/5+PYalLdomM4ONthrPgnkN4x4R0+D4+EBpXo8gNiAFsNwIDAQAB";
|
||||||
|
private static final String DECIVE_INFO = "qHYmicPTZyKO452IV4A2stOozmLj2aYu";
|
||||||
|
private Result icbcPay(Double moneys, Integer classify, Long userId, String outTradeNo, HttpServletRequest httpRequest, Integer shop) throws Exception{
|
||||||
|
UserEntity userEntity = userService.queryByUserId(userId);
|
||||||
|
|
||||||
|
String url = "https://gw.open.icbc.com.cn/" ; //https://gw-sandbox.open.icbc.com.cn https://gw.open.icbc.com.cn
|
||||||
|
String action = "api/cardbusiness/aggregatepay/b2c/online/consumepurchase/V1";
|
||||||
|
|
||||||
|
// UiIcbcClient client = new UiIcbcClient(APP_ID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY, IcbcConstants.CHARSET_UTF8);
|
||||||
|
////签名类型为RSA时,需传入appid,私钥和网关公钥,签名类型使用定值IcbcConstants.SIGN_TYPE_RSA,其他参数使用缺省值
|
||||||
|
DefaultIcbcClient client = new DefaultIcbcClient(ICBC_APPID, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY, APIGW_PUBLIC_KEY);
|
||||||
|
|
||||||
|
CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1 request = new CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1();
|
||||||
|
request.setServiceUrl(url + action);
|
||||||
|
CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1.CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1Biz bizContent = new CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1.CardbusinessAggregatepayB2cOnlineConsumepurchaseRequestV1Biz();
|
||||||
|
request.setBizContent(bizContent);
|
||||||
|
|
||||||
|
//回调
|
||||||
|
String notifyUrl = commonInfoService.findOne(19).getValue() + (shop != null ? "/sqx_fast/app/wxPay/notifyJsApiShop" : "/sqx_fast/app/wxPay/notifyJsApi");
|
||||||
|
//微信商户key
|
||||||
|
// config.setKey(commonInfoService.findOne(75).getValue());
|
||||||
|
//微信商户号mchId
|
||||||
|
String mchId = commonInfoService.findOne(76).getValue();
|
||||||
|
//openid
|
||||||
|
String openId = shop != null ? userEntity.getShopOpenId() : userEntity.getOpenId();
|
||||||
|
//商户appid
|
||||||
|
String mchAppid = shop != null ? commonInfoService.findOne(239).getValue() : commonInfoService.findOne(45).getValue();
|
||||||
|
//后台服务名称
|
||||||
|
String name = commonInfoService.findOne(12).getValue();
|
||||||
|
//订单金额
|
||||||
|
String money = String.valueOf(AmountCalUtils.mul(moneys, 100).intValue());
|
||||||
|
|
||||||
|
bizContent.setMer_id(ICBC_MCH_ID); //商户编号
|
||||||
|
bizContent.setOut_trade_no(outTradeNo); //商户订单号
|
||||||
|
bizContent.setPay_mode("9");
|
||||||
|
bizContent.setAccess_type("9");
|
||||||
|
bizContent.setMer_prtcl_no(ICBC_MER_PRTCL_NO); //收单产品协议编号
|
||||||
|
bizContent.setOrig_date_time(DateUtil.format(new Date(), "yyyy-MM-dd'T'HH:mm:ss")); //交易日期时间,格式为yyyy-MM-dd’T’HH:mm:ss
|
||||||
|
bizContent.setDecive_info(DECIVE_INFO); //设备号
|
||||||
|
bizContent.setBody(name); // 微信商品描述
|
||||||
|
bizContent.setFee_type("001"); //交易币种,目前工行只支持使用人民币(001)支付
|
||||||
|
bizContent.setSpbill_create_ip(HttpClientUtil.getIpAddress(httpRequest)); //用户端IP
|
||||||
|
bizContent.setTotal_fee(money); //订单金额,单位为分
|
||||||
|
bizContent.setMer_url(notifyUrl); //异步通知商户URL,端口必须为443或80
|
||||||
|
bizContent.setShop_appid(mchAppid);
|
||||||
|
bizContent.setIcbc_appid(ICBC_APPID);
|
||||||
|
bizContent.setOpen_id(openId);
|
||||||
|
// bizContent.setMer_acct("6212880200000038618");
|
||||||
|
// bizContent.setExpire_time("120");
|
||||||
|
// bizContent.setAttach("{ \"id\": \"SZTX001\", \"name\": \"腾大餐厅\", \"area_code\": \"440305\", \"address\": \"科技园中一路腾讯大厦\" }");
|
||||||
|
bizContent.setNotify_type("HS"); //通知类型
|
||||||
|
bizContent.setResult_type("0"); //结果发送类型 无论支付成功或者失败
|
||||||
|
// bizContent.setPay_limit("no_credit"); //10 支付方式限定
|
||||||
|
// bizContent.setOrder_apd_inf(""); //订单附加信息
|
||||||
|
// bizContent.setDetail("");
|
||||||
|
// bizContent.setReturn_url(""); //支付成功回显页面,支付成功后,跳转至该页面显示 当access_type=5且pay_mode=10才有效
|
||||||
|
// bizContent.setQuit_url(""); //用户付款中途退出返回商户网站的地址(仅对浏览器内支付时有效)当access_type=5且pay_mode=10才有效
|
||||||
|
// bizContent.setCust_name(""); //实名认证
|
||||||
|
// bizContent.setCust_cert_type("");
|
||||||
|
// bizContent.setCust_cert_no("");
|
||||||
|
// bizContent.setGoods_tag(""); //订单优惠标记
|
||||||
|
// bizContent.setAcq_addn_data("xxx"); //订单详细信息
|
||||||
|
|
||||||
|
CardbusinessAggregatepayB2cOnlineConsumepurchaseResponseV1 response;
|
||||||
|
try {
|
||||||
|
response = client.execute(request);
|
||||||
|
log.info("----调用icbc支付回调:{}", JSONObject.toJSONString(response));
|
||||||
|
if (response.getReturnCode() == 0) {
|
||||||
|
JSONObject wxDataPackage = JSONObject.parseObject(response.getWx_data_package());
|
||||||
|
Map<String, String> param = new HashMap<>();
|
||||||
|
String appid = wxDataPackage.getString("appid");
|
||||||
|
param.put("appid", appid);
|
||||||
|
param.put("partnerid", wxDataPackage.getString("partnerid"));
|
||||||
|
param.put("prepayid", wxDataPackage.getString("prepayid"));
|
||||||
|
param.put("noncestr", wxDataPackage.getString("noncestr"));
|
||||||
|
param.put("timestamp", wxDataPackage.getString("timestamp"));
|
||||||
|
/*param.put("sign", WXPayUtil.generateSignature(param, config.getKey(),
|
||||||
|
WXPayConstants.SignType.MD5));*/
|
||||||
|
// String stringSignTemp = "appId=" + config.getAppID() + "&nonceStr=" + generateNonceStr + "&package=prepay_id=" + response.get("prepay_id") + "&signType=MD5&timeStamp=" + currentTimeMillis + "" + "&key=" + config.getKey();
|
||||||
|
// String sign = MD5Util.md5Encrypt32Upper(stringSignTemp).toUpperCase();
|
||||||
|
param.put("sign", wxDataPackage.getString("sign"));
|
||||||
|
param.put("outtradeno", outTradeNo);
|
||||||
|
param.put("package", wxDataPackage.getString("package"));//给前端返回的值
|
||||||
|
param.put("mweb_url", wxDataPackage.getString("mweb_url"));
|
||||||
|
// param.put("trade_type", response.getTrade_type());
|
||||||
|
param.put("return_msg", response.getReturnMsg());
|
||||||
|
param.put("result_code", response.getReturnCode() + "");
|
||||||
|
param.put("signType", "MD5");
|
||||||
|
return Result.success().put("data", param);
|
||||||
|
} else {
|
||||||
|
// 失败
|
||||||
|
// System.out.println("response:" + JSON.toJSONString(response));
|
||||||
|
// System.out.println("ReturnCode:"+response.getReturnCode());
|
||||||
|
// System.out.println("ReturnMsg:"+response.getReturnMsg());
|
||||||
|
return Result.error("获取订单失败" + response.getReturnMsg());
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (IcbcApiException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return Result.error("获取订单失败");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String icbcPayBack(HttpServletRequest request, Integer type) throws Exception {
|
||||||
|
log.info("工商支付回调:");
|
||||||
|
//接收参数
|
||||||
|
JSONObject bizContent = JSON.parseObject(request.getParameter("biz_content"));
|
||||||
|
String msgId = bizContent.getString("msg_id");
|
||||||
|
|
||||||
|
//应答参数
|
||||||
|
JSONObject responseBizContent = new JSONObject();
|
||||||
|
responseBizContent.put("msg_id", msgId);
|
||||||
|
|
||||||
|
//我们的订单编号
|
||||||
|
String out_trade_no = bizContent.getString("out_trade_no");
|
||||||
|
//第三方订单流水号
|
||||||
|
String transactionId = bizContent.getString("third_trade_no");
|
||||||
|
|
||||||
|
String appid = type == 3 ? commonInfoService.findOne(45).getValue() : commonInfoService.findOne(239).getValue();
|
||||||
|
String notifyUrl = (type == 3 ? "/sqx_fast/app/wxPay/notifyJsApiShop" : "/sqx_fast/app/wxPay/notifyJsApi");
|
||||||
|
//返回码
|
||||||
|
String returnCode = bizContent.getString("return_code");
|
||||||
|
if (this.icbcCheckSign(request, notifyUrl)) {
|
||||||
|
if ("0".equals(returnCode)) {
|
||||||
|
// log.error("微信支付订单号" + notifyMap.get("transaction_id"));
|
||||||
|
// String transactionId = notifyMap.get("transaction_id");
|
||||||
|
if (out_trade_no != null) {
|
||||||
|
// 注意特殊情况:订单已经退款,但收到了支付结果成功的通知,不应把商户的订单状态从退款改成支付成功
|
||||||
|
// 注意特殊情况:微信服务端同样的通知可能会多次发送给商户系统,所以数据持久化之前需要检查是否已经处理过了,处理了直接返回成功标志
|
||||||
|
//业务数据持久化
|
||||||
|
PayDetails payDetails = payDetailsDao.selectByOrderId(out_trade_no);
|
||||||
|
if (payDetails.getState() == 0) {
|
||||||
|
payDetails.setState(1);
|
||||||
|
payDetails.setPayTime(DateUtils.format(new Date(), DateUtils.DATE_TIME_PATTERN));
|
||||||
|
payDetails.setTradeNo(transactionId);
|
||||||
|
payDetailsDao.updateById(payDetails);
|
||||||
|
if (payDetails.getType() == 1) {
|
||||||
|
//设置查询条件
|
||||||
|
QueryWrapper<PayOrder> queryWrapper = new QueryWrapper<>();
|
||||||
|
//根据订单编号去查询订单
|
||||||
|
queryWrapper.eq("orders_no", out_trade_no);
|
||||||
|
//去订单表中查询到该订单
|
||||||
|
PayOrder orders = payOrderDao.selectOne(queryWrapper);
|
||||||
|
//改变订单状态
|
||||||
|
orders.setState(1);
|
||||||
|
orders.setPayWay(type);
|
||||||
|
//设置订单更新时间
|
||||||
|
orders.setUpdateTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
||||||
|
payOrderDao.updateById(orders);
|
||||||
|
//调用处理接口
|
||||||
|
userMoneyDao.updateMayMoney(1, orders.getUserId(), orders.getMoney());
|
||||||
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||||
|
userMoneyDetails.setUserId(orders.getUserId());
|
||||||
|
userMoneyDetails.setTitle("微信充值");
|
||||||
|
userMoneyDetails.setContent("微信充值:" + orders.getPayMoney());
|
||||||
|
userMoneyDetails.setType(1);
|
||||||
|
userMoneyDetails.setMoney(orders.getMoney());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
userMoneyDetails.setCreateTime(sdf.format(new Date()));
|
||||||
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
|
} else if (payDetails.getType() == 2) {
|
||||||
|
Orders orders = ordersDao.selectOne(new QueryWrapper<Orders>().eq("orders_no", payDetails.getOrderId()));
|
||||||
|
GoodsSku goodsSku = goodsSkuService.getById(orders.getSkuId());
|
||||||
|
goodsSku.setStock(goodsSku.getStock() - orders.getOrderNumber());
|
||||||
|
goodsSkuService.updateById(goodsSku);
|
||||||
|
UserEntity userEntity = userService.selectUserById(orders.getUserId());
|
||||||
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||||
|
userMoneyDetails.setMoney(orders.getPayMoney());
|
||||||
|
userMoneyDetails.setUserId(orders.getUserId());
|
||||||
|
userMoneyDetails.setContent("微信支付订单");
|
||||||
|
userMoneyDetails.setTitle("下单成功,订单号:" + orders.getOrdersNo());
|
||||||
|
userMoneyDetails.setType(2);
|
||||||
|
userMoneyDetails.setOrdersNo(orders.getOrdersNo());
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
userMoneyDetails.setCreateTime(simpleDateFormat.format(new Date()));
|
||||||
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
|
MessageInfo messageInfo = new MessageInfo();
|
||||||
|
messageInfo.setContent("订单下单成功:" + orders.getOrdersNo());
|
||||||
|
messageInfo.setTitle("订单通知");
|
||||||
|
messageInfo.setState(String.valueOf(4));
|
||||||
|
messageInfo.setUserName(userEntity.getUserName());
|
||||||
|
messageInfo.setUserId(String.valueOf(userEntity.getUserId()));
|
||||||
|
messageInfo.setCreateAt(simpleDateFormat.format(new Date()));
|
||||||
|
messageInfo.setIsSee("0");
|
||||||
|
messageService.saveBody(messageInfo);
|
||||||
|
if (StringUtil.isNotBlank(userEntity.getClientid())) {
|
||||||
|
userService.pushToSingle(messageInfo.getTitle(), messageInfo.getContent(), userEntity.getClientid());
|
||||||
|
}
|
||||||
|
orders.setState("4");
|
||||||
|
orders.setIsRemind(0);
|
||||||
|
orders.setPayWay(2);
|
||||||
|
|
||||||
|
OrderTaking orderTaking = orderTakingService.getById(orders.getOrderTakingId());
|
||||||
|
|
||||||
|
ordersDao.updateById(orders);
|
||||||
|
} else if (payDetails.getType() == 3) {
|
||||||
|
HelpOrder helpOrder = JSONObject.parseObject(payDetails.getRemark(), HelpOrder.class);
|
||||||
|
UserEntity userEntity = userService.selectUserById(helpOrder.getUserId());
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String date = sdf.format(new Date());
|
||||||
|
helpOrder.setStatus(2);
|
||||||
|
helpOrder.setCreateTime(date);
|
||||||
|
helpOrder.setMoney(helpOrder.getCommission());
|
||||||
|
CommonInfo one = commonInfoService.findOne(120);
|
||||||
|
String value = one.getValue();
|
||||||
|
Double mul = AmountCalUtils.mul(helpOrder.getCommission().doubleValue(), Double.parseDouble(value));
|
||||||
|
BigDecimal sub = AmountCalUtils.sub(helpOrder.getMoney(), BigDecimal.valueOf(mul));
|
||||||
|
helpOrder.setCommission(sub);
|
||||||
|
helpOrder.setPayWay(2);
|
||||||
|
helpOrderDao.insert(helpOrder);
|
||||||
|
|
||||||
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||||
|
userMoneyDetails.setUserId(helpOrder.getUserId());
|
||||||
|
userMoneyDetails.setTitle("万能任务");
|
||||||
|
userMoneyDetails.setContent("万能任务微信支付扣款:" + helpOrder.getMoney());
|
||||||
|
userMoneyDetails.setType(2);
|
||||||
|
userMoneyDetails.setMoney(helpOrder.getMoney());
|
||||||
|
userMoneyDetails.setCreateTime(date);
|
||||||
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
|
if (userEntity.getClientid() != null) {
|
||||||
|
userService.pushToSingle("派发订单", "您的订单已经派发成功!", userEntity.getClientid());
|
||||||
|
}
|
||||||
|
MessageInfo messageInfo = new MessageInfo();
|
||||||
|
messageInfo.setContent("您的订单已经派发成功!");
|
||||||
|
messageInfo.setTitle("订单通知");
|
||||||
|
messageInfo.setState(String.valueOf(4));
|
||||||
|
messageInfo.setUserName(userEntity.getUserName());
|
||||||
|
messageInfo.setUserId(String.valueOf(userEntity.getUserId()));
|
||||||
|
messageService.saveBody(messageInfo);
|
||||||
|
} else if (payDetails.getType() == 4) {
|
||||||
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
BigDecimal money = BigDecimal.valueOf(payDetails.getMoney());
|
||||||
|
userMoneyDao.updateSafetyMoney(1, payDetails.getUserId(), money);
|
||||||
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||||
|
userMoneyDetails.setClassify(4);
|
||||||
|
userMoneyDetails.setUserId(payDetails.getUserId());
|
||||||
|
userMoneyDetails.setTitle("[保证金]缴纳保证金");
|
||||||
|
userMoneyDetails.setContent("缴纳保证金,保证金增加:" + money);
|
||||||
|
userMoneyDetails.setType(1);
|
||||||
|
userMoneyDetails.setMoney(money);
|
||||||
|
userMoneyDetails.setCreateTime(sdf.format(new Date()));
|
||||||
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
|
UserMoney userMoney = userMoneyService.selectUserMoneyByUserId(payDetails.getUserId());
|
||||||
|
userMoneyService.updateSafetyMoneyWay(userMoney.getId(), 1, payDetails.getOrderId());
|
||||||
|
UserEntity userEntity = userService.selectUserById(payDetails.getUserId());
|
||||||
|
userEntity.setIsSafetyMoney(1);
|
||||||
|
userService.updateById(userEntity);
|
||||||
|
} else if (payDetails.getType() == 5) {
|
||||||
|
List<Orders> ordersList = JSONObject.parseArray(payDetails.getRemark(), Orders.class);
|
||||||
|
for (Orders orders : ordersList) {
|
||||||
|
GoodsSku goodsSku = goodsSkuService.getById(orders.getSkuId());
|
||||||
|
goodsSku.setStock(goodsSku.getStock() - orders.getOrderNumber());
|
||||||
|
goodsSkuService.updateById(goodsSku);
|
||||||
|
UserEntity userEntity = userService.selectUserById(orders.getUserId());
|
||||||
|
UserMoneyDetails userMoneyDetails = new UserMoneyDetails();
|
||||||
|
userMoneyDetails.setMoney(orders.getPayMoney());
|
||||||
|
userMoneyDetails.setUserId(orders.getUserId());
|
||||||
|
userMoneyDetails.setContent("微信支付订单");
|
||||||
|
userMoneyDetails.setTitle("下单成功,订单号:" + orders.getOrdersNo());
|
||||||
|
userMoneyDetails.setType(2);
|
||||||
|
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
userMoneyDetails.setCreateTime(simpleDateFormat.format(new Date()));
|
||||||
|
userMoneyDetailsService.save(userMoneyDetails);
|
||||||
|
MessageInfo messageInfo = new MessageInfo();
|
||||||
|
messageInfo.setContent("订单下单成功:" + orders.getOrdersNo());
|
||||||
|
messageInfo.setTitle("订单通知");
|
||||||
|
messageInfo.setState(String.valueOf(4));
|
||||||
|
messageInfo.setUserName(userEntity.getUserName());
|
||||||
|
messageInfo.setUserId(String.valueOf(userEntity.getUserId()));
|
||||||
|
messageInfo.setCreateAt(simpleDateFormat.format(new Date()));
|
||||||
|
messageInfo.setIsSee("0");
|
||||||
|
messageService.saveBody(messageInfo);
|
||||||
|
if (StringUtil.isNotBlank(userEntity.getClientid())) {
|
||||||
|
userService.pushToSingle(messageInfo.getTitle(), messageInfo.getContent(), userEntity.getClientid());
|
||||||
|
}
|
||||||
|
orders.setState("4");
|
||||||
|
orders.setIsRemind(0);
|
||||||
|
orders.setPayWay(2);
|
||||||
|
|
||||||
|
OrderTaking orderTaking = orderTakingService.getById(orders.getOrderTakingId());
|
||||||
|
ordersDao.updateById(orders);
|
||||||
|
}
|
||||||
|
} else if (payDetails.getType() == 6) {
|
||||||
|
ticketsService.businessCallback(2, payDetails.getUserId(), BigDecimal.valueOf(payDetails.getMoney()), payDetails.getRelationId(), payDetails.getBuyNum(), payDetails.getTradeNo());
|
||||||
|
} else if (payDetails.getType() == 7) {
|
||||||
|
couponUserService.businessCallback(2, payDetails.getUserId(), payDetails.getRelationId(), payDetails.getBuyNum(), BigDecimal.valueOf(payDetails.getMoney()));
|
||||||
|
} else if (payDetails.getType() == 8) {
|
||||||
|
userService.bucketCallback(payDetails.getUserId(), payDetails.getBuyNum(), BigDecimal.valueOf(payDetails.getMoney()), payDetails.getClassify());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// System.err.println("微信手机支付回调成功订单号:" + out_trade_no + "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
responseBizContent.put("return_code", 0);
|
||||||
|
responseBizContent.put("return_msg", "success");
|
||||||
|
}else {
|
||||||
|
responseBizContent.put("return_code", -1);
|
||||||
|
responseBizContent.put("return_msg", "icbc sign not pass.");
|
||||||
|
}
|
||||||
|
|
||||||
|
String signStr = "\"response_biz_content\":" + responseBizContent.toJSONString() + "," + "\"sign_type\":\"RSA2\"";
|
||||||
|
String sign = IcbcSignature.sign(signStr, IcbcConstants.SIGN_TYPE_RSA2, MY_PRIVATE_KEY,"UTF-8","");
|
||||||
|
|
||||||
|
JSONObject resp = new JSONObject();
|
||||||
|
resp.put("response_biz_content", responseBizContent);
|
||||||
|
resp.put("sign_type", "RSA2");
|
||||||
|
resp.put("sign", sign);
|
||||||
|
|
||||||
|
return resp.toJSONString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean icbcCheckSign(HttpServletRequest request, String path) {
|
||||||
|
Map<String, String> params = new HashMap<>();
|
||||||
|
String sign = request.getParameter("sign");
|
||||||
|
params.put("from", request.getParameter("from"));
|
||||||
|
params.put("api", request.getParameter("api"));
|
||||||
|
params.put("app_id", request.getParameter("app_id"));
|
||||||
|
params.put("charset", request.getParameter("charset"));
|
||||||
|
params.put("format", request.getParameter("format"));
|
||||||
|
params.put("timestamp", request.getParameter("timestamp"));
|
||||||
|
params.put("biz_content", request.getParameter("biz_content"));
|
||||||
|
//目前上行网关签名暂时仅支持RSA
|
||||||
|
params.put("sign_type", request.getParameter("sign_type"));
|
||||||
|
|
||||||
|
String signStr= WebUtils.buildOrderedSignStr(path, params);
|
||||||
|
try {
|
||||||
|
//注意:此次用的是RSA,和下单时不一样
|
||||||
|
return IcbcSignature.verify(signStr, IcbcConstants.SIGN_TYPE_RSA, APIGW_PUBLIC_KEY, request.getParameter("charset"), sign);
|
||||||
|
} catch (IcbcApiException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public String getGeneralOrder() {
|
public String getGeneralOrder() {
|
||||||
Date date = new Date();
|
Date date = new Date();
|
||||||
|
|
@ -780,4 +1137,14 @@ public class WxServiceImpl implements WxService {
|
||||||
return pay(money.doubleValue(), classify, payDetails.getUserId(), payDetails.getOrderId(), request, null);
|
return pay(money.doubleValue(), classify, payDetails.getUserId(), payDetails.getOrderId(), request, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String timestamp = DateUtil.format(DateUtil.date(), "yyyy-MM-dd HH:mm:ss");
|
||||||
|
String rawToken = "100000002" + "2ry7EXwNHE3zOtUpEUqj1BdkFGuIna67TmKExNxG" + "1740728660";
|
||||||
|
String hashedToken = DigestUtil.sha256Hex(rawToken);
|
||||||
|
String encodedToken = cn.hutool.core.codec.Base64.encode(hashedToken);
|
||||||
|
System.out.println(System.currentTimeMillis()/1000);
|
||||||
|
System.out.println(hashedToken);
|
||||||
|
System.out.println(encodedToken);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -32,4 +32,6 @@ spring:
|
||||||
wall:
|
wall:
|
||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
file:
|
||||||
|
upload:
|
||||||
|
path: /mnt/file/
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
url: jdbc:mysql://${DB_URL:127.0.0.1}:3306/songshui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
url: jdbc:mysql://${DB_URL:127.0.0.1}:3306/songshui?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||||
username: ${DB_NAME}
|
username: songshui
|
||||||
password: ${DB_PASSWORD}
|
password: CwMi2d2eF3SLtfZ2
|
||||||
initial-size: 10
|
initial-size: 10
|
||||||
max-active: 100
|
max-active: 100
|
||||||
min-idle: 10
|
min-idle: 10
|
||||||
|
|
@ -32,4 +32,6 @@ spring:
|
||||||
wall:
|
wall:
|
||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
file:
|
||||||
|
upload:
|
||||||
|
path: /mnt/file/
|
||||||
|
|
@ -32,4 +32,6 @@ spring:
|
||||||
wall:
|
wall:
|
||||||
config:
|
config:
|
||||||
multi-statement-allow: true
|
multi-statement-allow: true
|
||||||
|
file:
|
||||||
|
upload:
|
||||||
|
path: /mnt/file/
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue