|
@@ -3,6 +3,7 @@ package com.caimei365.order.service.impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.caimei365.order.components.HeliPayUtil;
|
|
|
+import com.caimei365.order.components.OnlinePostFormUtil;
|
|
|
import com.caimei365.order.components.WeChatService;
|
|
|
import com.caimei365.order.constant.Constant;
|
|
|
import com.caimei365.order.mapper.BaseMapper;
|
|
@@ -840,67 +841,113 @@ public class HeliPayServiceImpl implements HeliPayService {
|
|
|
List<BankCodeVo> B2B = payOrderMapper.findB2BBankCode();
|
|
|
List<BankCodeVo> B2C = payOrderMapper.findB2CBankCode();
|
|
|
Map<String, Object> banks = new HashMap<>(2);
|
|
|
- banks.put("B2B",B2B);
|
|
|
- banks.put("B2C",B2C);
|
|
|
+ banks.put("B2B", B2B);
|
|
|
+ banks.put("B2C", B2C);
|
|
|
return ResponseJson.success("获取成功", banks);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public ResponseJson<JSONObject> getPayOrderResult(String mbOrderId, Integer orderFlag) throws IntrospectionException, InvocationTargetException, IllegalAccessException {
|
|
|
+ public ResponseJson<JSONObject> getPayOrderResult(String mbOrderId, Integer orderFlag, Integer shopOrderId) throws IntrospectionException, InvocationTargetException, IllegalAccessException {
|
|
|
log.info("--------进入交易订单查询接口----------");
|
|
|
- QueryOrderVo queryOrderVo = new QueryOrderVo();
|
|
|
- queryOrderVo.setP1_bizType("AppPayQuery");
|
|
|
- queryOrderVo.setP2_orderId(mbOrderId);
|
|
|
- if (0 == orderFlag) {
|
|
|
- queryOrderVo.setP3_customerNumber(Constant.CUSTOMERNUM);
|
|
|
- } else {
|
|
|
- String splitCode = payOrderMapper.getSplitCodeByMbOrderId(mbOrderId);
|
|
|
- queryOrderVo.setP3_customerNumber(splitCode);
|
|
|
- }
|
|
|
- Map<String, String> map = MyBeanUtils.convertBean(queryOrderVo, new LinkedHashMap());
|
|
|
- String oriMessage = MyBeanUtils.getSignedByPresetParameter(map, QueryOrderVo.NEED_SIGN_PARAMS);
|
|
|
//区分网银和其他产品
|
|
|
String payType = baseMapper.findType(mbOrderId);
|
|
|
if ("12".equals(payType) || "17".equals(payType)) {
|
|
|
- oriMessage += Constant.SPLIT + Constant.WANGYIN;
|
|
|
+ String customerNumber = "";
|
|
|
+ if (0 == orderFlag) {
|
|
|
+ customerNumber = Constant.CUSTOMERNUM;
|
|
|
+ } else {
|
|
|
+ if (null == shopOrderId) {
|
|
|
+ return ResponseJson.error("子订单Id不能为空!", null);
|
|
|
+ }
|
|
|
+ String splitCode = payOrderMapper.getSplitCodeByShopOrderId(shopOrderId);
|
|
|
+ if (null == splitCode) {
|
|
|
+ return ResponseJson.error("订单信息不正确!", null);
|
|
|
+ }
|
|
|
+ customerNumber = splitCode;
|
|
|
+ }
|
|
|
+ Map<String, String> sPara = new HashMap<String, String>();
|
|
|
+ sPara.put("P1_bizType", "OnlineQuery");
|
|
|
+ sPara.put("P2_orderId", mbOrderId);
|
|
|
+ sPara.put("P3_customerNumber", customerNumber);
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ sb.append("&").append("OnlineQuery").append("&").append(mbOrderId).append("&")
|
|
|
+ .append(customerNumber).append("&").append(WANGYIN);
|
|
|
+ String sign = Disguiser.disguiseMD5(sb.toString());
|
|
|
+ sPara.put("sign", sign);
|
|
|
+ try {
|
|
|
+ OnlineCheckVo on= OnlinePostFormUtil.postForm(sPara, YL, sign, OnlineCheckVo.class);
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(on), JSONObject.class);
|
|
|
+ if (!"0000".equals(on.getRt2_retCode())) {
|
|
|
+ log.info("查询失败:" + on.toString());
|
|
|
+ return ResponseJson.error("查询失败",jsonObject);
|
|
|
+ } else {
|
|
|
+ String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(on, OnlineCheckVo.NEED_SIGN_PARAMS);
|
|
|
+ log.info("组装返回结果签名串:" + assemblyRespOriSign);
|
|
|
+ assemblyRespOriSign += Constant.SPLIT + WANGYIN;
|
|
|
+ String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
|
|
|
+ if(!checkSign.equals(on.getSign())){
|
|
|
+ return ResponseJson.error("验签失败",jsonObject);
|
|
|
+ }else{
|
|
|
+ return ResponseJson.success("查询成功",jsonObject);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
} else {
|
|
|
- oriMessage += Constant.SPLIT + Constant.SAOMA;
|
|
|
- }
|
|
|
- log.info("签名原文串:" + oriMessage);
|
|
|
- String sign = Disguiser.disguiseMD5(oriMessage.trim());
|
|
|
- log.info("签名串:" + sign);
|
|
|
- map.put("sign", sign);
|
|
|
- log.info("发送参数:" + map);
|
|
|
- Map<String, Object> resultMap = HttpClientService.getHttpResp(map, Constant.REQUEST_URL);
|
|
|
- log.info("响应结果:" + resultMap);
|
|
|
- if ((Integer) resultMap.get("statusCode") == HttpStatus.SC_OK) {
|
|
|
- String resultMsg = (String) resultMap.get("response");
|
|
|
- QueryOrderResponseVo queryOrderResponseVo = JSONObject.parseObject(resultMsg, QueryOrderResponseVo.class);
|
|
|
- String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(queryOrderResponseVo, QueryOrderResponseVo.NEED_SIGN_PARAMS);
|
|
|
- log.info("组装返回结果签名串:" + assemblyRespOriSign);
|
|
|
- if ("12".equals(payType) || "17".equals(payType)) {
|
|
|
- assemblyRespOriSign += Constant.SPLIT + Constant.WANGYIN;
|
|
|
+ QueryOrderVo queryOrderVo = new QueryOrderVo();
|
|
|
+ queryOrderVo.setP1_bizType("AppPayQuery");
|
|
|
+ queryOrderVo.setP2_orderId(mbOrderId);
|
|
|
+ if (0 == orderFlag) {
|
|
|
+ queryOrderVo.setP3_customerNumber(Constant.CUSTOMERNUM);
|
|
|
} else {
|
|
|
- assemblyRespOriSign += Constant.SPLIT + Constant.SAOMA;
|
|
|
+ if (null == shopOrderId) {
|
|
|
+ return ResponseJson.error("子订单Id不能为空!", null);
|
|
|
+ }
|
|
|
+ String splitCode = payOrderMapper.getSplitCodeByShopOrderId(shopOrderId);
|
|
|
+ if (null == splitCode) {
|
|
|
+ return ResponseJson.error("订单信息不正确!", null);
|
|
|
+ }
|
|
|
+ queryOrderVo.setP3_customerNumber(splitCode);
|
|
|
}
|
|
|
- String responseSign = queryOrderResponseVo.getSign();
|
|
|
- log.info("响应签名:" + responseSign);
|
|
|
- String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
|
|
|
- if (checkSign.equals(responseSign)) {
|
|
|
- if ("0000".equals(queryOrderResponseVo.getRt2_retCode())) {
|
|
|
- JSONObject jsonObject = JSONObject.parseObject(resultMsg, JSONObject.class);
|
|
|
- return ResponseJson.success("查询成功", jsonObject);
|
|
|
+
|
|
|
+ Map<String, String> map = MyBeanUtils.convertBean(queryOrderVo, new LinkedHashMap());
|
|
|
+ String oriMessage = MyBeanUtils.getSignedByPresetParameter(map, QueryOrderVo.NEED_SIGN_PARAMS);
|
|
|
+ oriMessage += Constant.SPLIT + Constant.SAOMA;
|
|
|
+ log.info("签名原文串:" + oriMessage);
|
|
|
+ String sign = Disguiser.disguiseMD5(oriMessage.trim());
|
|
|
+ log.info("md5加密签名串:" + sign);
|
|
|
+ map.put("sign", sign);
|
|
|
+ log.info("发送参数:" + map);
|
|
|
+ Map<String, Object> resultMap = HttpClientService.getHttpResp(map, Constant.REQUEST_URL);
|
|
|
+ log.info("响应结果:" + resultMap);
|
|
|
+ if ((Integer) resultMap.get("statusCode") == HttpStatus.SC_OK) {
|
|
|
+ String resultMsg = (String) resultMap.get("response");
|
|
|
+ QueryOrderResponseVo queryOrderResponseVo = JSONObject.parseObject(resultMsg, QueryOrderResponseVo.class);
|
|
|
+ String assemblyRespOriSign = MyBeanUtils.getSignedByPresetParameter(queryOrderResponseVo, QueryOrderResponseVo.NEED_SIGN_PARAMS);
|
|
|
+ log.info("组装返回结果签名串:" + assemblyRespOriSign);
|
|
|
+ assemblyRespOriSign += Constant.SPLIT + Constant.SAOMA;
|
|
|
+ String responseSign = queryOrderResponseVo.getSign();
|
|
|
+ log.info("响应签名:" + responseSign);
|
|
|
+ String checkSign = Disguiser.disguiseMD5(assemblyRespOriSign.trim());
|
|
|
+ if (checkSign.equals(responseSign)) {
|
|
|
+ if ("0000".equals(queryOrderResponseVo.getRt2_retCode())) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(resultMsg, JSONObject.class);
|
|
|
+ return ResponseJson.success("查询成功", jsonObject);
|
|
|
+ } else {
|
|
|
+ return ResponseJson.error("验签失败", null);
|
|
|
+ }
|
|
|
} else {
|
|
|
return ResponseJson.error("验签失败", null);
|
|
|
}
|
|
|
} else {
|
|
|
- return ResponseJson.error("验签失败", null);
|
|
|
+ return ResponseJson.error("查询失败", null);
|
|
|
}
|
|
|
- } else {
|
|
|
- return ResponseJson.error("查询失败", null);
|
|
|
}
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public String unionCallback(UnionResVo res) throws IntrospectionException, InvocationTargetException, IllegalAccessException {
|
|
|
log.info("******************** 网银支付异步回调 start *******************");
|