* 'dev' of http://139.159.177.244:3000/hurui/hai-server:
  完成云闪付改造
  提交代码

# Conflicts:
#	hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
dev-discount
袁野 3 years ago
commit 016ab5a301
  1. 2
      hai-bweb/src/main/java/com/bweb/controller/OutRechargeOrderController.java
  2. 2
      hai-cweb/src/main/java/com/cweb/controller/HighTestController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/OutRechargeOrderController.java
  4. 2
      hai-cweb/src/main/java/com/cweb/controller/pay/CzOrderController.java
  5. 87
      hai-cweb/src/main/java/com/cweb/controller/pay/OrderController.java
  6. 4
      hai-cweb/src/main/java/com/cweb/controller/pay/TuanYouController.java
  7. 35
      hai-service/src/main/java/com/hai/common/utils/RequestUtils.java
  8. 40
      hai-service/src/main/java/com/hai/config/UnionPayConfig.java
  9. 40
      hai-service/src/main/java/com/hai/config/UnionStagingPayConfig.java
  10. 20
      hai-service/src/main/java/com/hai/config/WxOrderConfig.java
  11. 2
      hai-service/src/main/java/com/hai/service/impl/OutRechargeOrderServiceImpl.java
  12. 4
      hai-service/src/main/resources/dev/commonConfig.properties

@ -376,7 +376,7 @@ public class OutRechargeOrderController {
// 银联退款 // 银联退款
if (order.getPayType() == 4) { if (order.getPayType() == 4) {
// 订单退款 // 订单退款
JSONObject refund = UnionPayConfig.zwrefund(order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) { if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
} }

File diff suppressed because one or more lines are too long

@ -529,7 +529,7 @@ public class OutRechargeOrderController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,订单不处于待支付状态");
} }
return ResponseMsgUtil.success(unionPayConfig.upPreOrder(order.getOrderNo(), order.getPayPrice(), "话费充值", CommonSysConst.getSysConfig().getUnionPayTelNotifyUrl())); return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPayPrice(), "话费充值", CommonSysConst.getSysConfig().getUnionPayTelNotifyUrl(), request));
} catch (Exception e) { } catch (Exception e) {
log.error("orderToPay error!", e); log.error("orderToPay error!", e);

@ -234,7 +234,7 @@ public class CzOrderController {
// 银联退款 // 银联退款
if (order.getPayType() == 4) { if (order.getPayType() == 4) {
// 订单退款 // 订单退款
JSONObject refund = UnionPayConfig.zwrefund(order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) { if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
} }

@ -16,13 +16,8 @@ import com.hai.common.security.AESEncodeUtil;
import com.hai.common.security.Base64Util; import com.hai.common.security.Base64Util;
import com.hai.common.security.SessionObject; import com.hai.common.security.SessionObject;
import com.hai.common.security.UserCenter; import com.hai.common.security.UserCenter;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.*;
import com.hai.common.utils.MathUtils; import com.hai.config.*;
import com.hai.common.utils.ResponseMsgUtil;
import com.hai.config.CommonSysConst;
import com.hai.config.QianZhuConfig;
import com.hai.config.TuanYouConfig;
import com.hai.config.UnionPayConfig;
import com.hai.entity.*; import com.hai.entity.*;
import com.hai.enum_type.GoodsType; import com.hai.enum_type.GoodsType;
import com.hai.enum_type.PayType; import com.hai.enum_type.PayType;
@ -201,11 +196,11 @@ public class OrderController {
weChatPayReqInfo.setBody(map.get("body").toString()); //商品描述 weChatPayReqInfo.setBody(map.get("body").toString()); //商品描述
weChatPayReqInfo.setOut_trade_no(map.get("orderNo").toString()); //商户订单号 weChatPayReqInfo.setOut_trade_no(map.get("orderNo").toString()); //商户订单号
weChatPayReqInfo.setTotal_fee(total_fee); //总金额 weChatPayReqInfo.setTotal_fee(total_fee); //总金额
weChatPayReqInfo.setSpbill_create_ip("139.159.177.244"); //终端ip weChatPayReqInfo.setSpbill_create_ip("122.9.135.148"); //终端ip
weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getNotifyUrl()); //通知url weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getNotifyUrl()); //通知url
weChatPayReqInfo.setTrade_type("JSAPI"); //交易类型 weChatPayReqInfo.setTrade_type("JSAPI"); //交易类型
weChatPayReqInfo.setAttach(map.get("orderScene").toString()); weChatPayReqInfo.setAttach(map.get("orderScene").toString());
weChatPayReqInfo.setProfit_sharing("Y"); weChatPayReqInfo.setProfit_sharing("N");
//附加数据,区分订单类型 //附加数据,区分订单类型
Map<String,String> payMap = new HashMap<>(); Map<String,String> payMap = new HashMap<>();
@ -401,7 +396,7 @@ public class OrderController {
@RequestMapping(value="/unionPay",method = RequestMethod.POST) @RequestMapping(value="/unionPay",method = RequestMethod.POST)
@ResponseBody @ResponseBody
@ApiOperation(value = "银联支付") @ApiOperation(value = "银联支付")
public ResponseData unionPay(@RequestBody String reqBodyStr) { public ResponseData unionPay(@RequestBody String reqBodyStr,HttpServletRequest request) {
try { try {
if (StringUtils.isBlank(reqBodyStr)) { if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误"); log.error("orderToPay error!", "参数错误");
@ -454,7 +449,77 @@ public class OrderController {
} }
} }
return ResponseMsgUtil.success(unionPayConfig.upPreOrder(order.getOrderNo(), order.getPayPrice(), "购买商品", CommonSysConst.getSysConfig().getUnionPayNotifyUrl())); return ResponseMsgUtil.success(unionPayConfig.upPreOrder(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPayPrice(), "购买商品", CommonSysConst.getSysConfig().getUnionPayNotifyUrl(), request));
} catch (Exception e) {
log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e);
}
}
@RequestMapping(value="/unionStagingPay",method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "银联分期支付")
public ResponseData unionStagingPay(@RequestBody String reqBodyStr,HttpServletRequest request) {
try {
if (StringUtils.isBlank(reqBodyStr)) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
JSONObject jsonObject = JSONObject.parseObject(reqBodyStr);
Long orderId = jsonObject.getLong("orderId");
if ( orderId == null) {
log.error("orderToPay error!", "参数错误");
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, "");
}
HighOrder order = highOrderService.getOrderById(orderId);
if(order == null) {
log.error("OrderController --> orderToPay() ERROR", "未找到订单信息");
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, "");
}
//校验订单状态 订单状态:1 待支付 2 已支付 3.已完成 4. 已退款 5.已取消
if(order.getOrderStatus() != 1) {
log.error("OrderController --> orderToPay() ERROR", "订单不处于待支付状态");
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, "");
}
// 商品类型 1:卡卷 2:金币充值 3:加油站
for (HighChildOrder childOrder : order.getHighChildOrderList()) {
if (childOrder.getGiveawayType() == false && childOrder.getGoodsType() == 1) {
HighCoupon coupon = highCouponService.getCouponById(childOrder.getGoodsId());
// 支付类型:1.微信支付 2.金币支付
// if (coupon.getPayType() != 1) {
// log.error("OrderController --> orderToPay() ERROR", "只支持微信支持");
// throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, coupon.getCouponName() + ",只支持微信支付");
// }
}
if (childOrder.getGoodsType() == 3) {
// 查询账号余额
JSONObject accountInfo2JD = TuanYouConfig.queryCompanyAccountInfo2JD();
JSONArray result = accountInfo2JD.getJSONArray("result");
for (Object accountObject : result) {
JSONObject account = (JSONObject)accountObject;
// 1:汽油:2:柴油;3:天然气
if (account.getInteger("energyType").equals(childOrder.getGasOilType())) {
// 支付金额 大于 团油账号余额
if(order.getPayPrice().compareTo(account.getBigDecimal("accountBalance")) == 1){
log.error("OrderController --> orderToPay() ERROR", "无法进行支付,请联系平台客服");
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法进行支付,请联系平台客服");
}
}
}
}
}
String orgTrace = CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(0,4)
+CommonSysConst.getSysConfig().getUnionStagingPayOrgId().substring(CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length() - 4,CommonSysConst.getSysConfig().getUnionStagingPayOrgId().length())
+ DateUtil.format(new Date(), DateUtil.YMDHMS)
+ IDGenerator.nextId(6);
return ResponseMsgUtil.success(UnionStagingPayConfig.advancePay(order.getOrderNo(),order.getOrderNo(),order.getPayPrice(), "","", request));
} catch (Exception e) { } catch (Exception e) {
log.error("orderToPay error!", e); log.error("orderToPay error!", e);
return ResponseMsgUtil.exception(e); return ResponseMsgUtil.exception(e);

@ -123,7 +123,7 @@ public class TuanYouController {
// 订单是否处于当日的订单 // 订单是否处于当日的订单
if (DateUtil.isEffectiveDate(order.getPayTime(), startTime.getTime(), endTime.getTime())) { if (DateUtil.isEffectiveDate(order.getPayTime(), startTime.getTime(), endTime.getTime())) {
// 订单撤销 // 订单撤销
JSONObject refund = UnionPayConfig.cancel(order.getOrderNo(), order.getPaySerialNo()); JSONObject refund = UnionPayConfig.cancel(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPaySerialNo());
if (!refund.getString("resultcode").equals("00")) { if (!refund.getString("resultcode").equals("00")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage"));
} }
@ -135,7 +135,7 @@ public class TuanYouController {
} else { } else {
// 订单退款 // 订单退款
JSONObject refund = UnionPayConfig.zwrefund(order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID3, UnionPayConfig.TERM_ID3, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("00")) { if (!refund.getString("resultcode").equals("00")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("respMessage"));
} }

@ -5,32 +5,15 @@ public class RequestUtils {
public static String getIpAddress(HttpServletRequest request) { public static String getIpAddress(HttpServletRequest request) {
// 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址 // 获取请求主机IP地址,如果通过代理进来,则透过防火墙获取真实IP地址
String ip = request.getHeader("X-Forwarded-For"); String ip = request.getHeader("x-forwarded-for");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("Proxy-Client-IP");
ip = request.getHeader("Proxy-Client-IP"); }
} if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getHeader("WL-Proxy-Client-IP");
ip = request.getHeader("WL-Proxy-Client-IP"); }
} if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) { ip = request.getRemoteAddr();
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
} else if (ip.length() > 15) {
String[] ips = ip.split(",");
for (int index = 0; index < ips.length; index++) {
String strIp = ips[index];
if (!("unknown".equalsIgnoreCase(strIp))) {
ip = strIp;
break;
}
}
} }
return ip; return ip;
} }

@ -1,6 +1,5 @@
package com.hai.config; package com.hai.config;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
@ -11,6 +10,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
@ -24,6 +24,18 @@ public class UnionPayConfig {
@Resource @Resource
private HighPayRecordMapper highPayRecordMapper; private HighPayRecordMapper highPayRecordMapper;
// 重庆惠昕石化有限责任公司
public final static String MER_ID1 = "83169055983W000";
public final static String TERM_ID1 = "XS000103";
// 重庆惠兑电子商务有限公司
public final static String MER_ID2 = "83169054816W999";
public final static String TERM_ID2 = "XS000104";
// 个体户黎杨珍
public final static String MER_ID3 = "83169054816W998";
public final static String TERM_ID3 = "XS000105";
/** /**
* 注意请勿随意调用会更新签名秘钥会导致接口签名错误 * 注意请勿随意调用会更新签名秘钥会导致接口签名错误
* 更新并获取签名密钥 * 更新并获取签名密钥
@ -47,17 +59,17 @@ public class UnionPayConfig {
* @return 响应信息 * @return 响应信息
* @throws Exception * @throws Exception
*/ */
public JSONObject upPreOrder(String orderNo, BigDecimal payPrice, String orderDesc,String notifyurl) throws Exception { public JSONObject upPreOrder(String merId, String termId, String orderNo, BigDecimal payPrice, String orderDesc, String notifyUrl, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid()); paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid());
paramMap.put("merid", CommonSysConst.getSysConfig().getUnionPayMerid()); paramMap.put("merid", merId);
paramMap.put("termid", CommonSysConst.getSysConfig().getUnionPayTermid()); paramMap.put("termid", termId);
paramMap.put("tradetrace", orderNo); paramMap.put("tradetrace", orderNo);
paramMap.put("opt", "upPreOrder"); paramMap.put("opt", "upPreOrder");
paramMap.put("tradetype", "APP"); paramMap.put("tradetype", "APP");
paramMap.put("tradeamt", payPrice.multiply(new BigDecimal("100")).intValue()); paramMap.put("tradeamt", payPrice.multiply(new BigDecimal("100")).intValue());
paramMap.put("body", orderDesc); paramMap.put("body", orderDesc);
paramMap.put("notifyurl", notifyurl); paramMap.put("notifyurl", notifyUrl);
String requestParam = generateRequestParam(paramMap); String requestParam = generateRequestParam(paramMap);
@ -90,11 +102,11 @@ public class UnionPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject tradeQuery(String paySerialNo) throws Exception { public static JSONObject tradeQuery(String merId,String termId,String paySerialNo) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid()); paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid());
paramMap.put("merid", CommonSysConst.getSysConfig().getUnionPayMerid()); paramMap.put("merid", merId);
paramMap.put("termid", CommonSysConst.getSysConfig().getUnionPayTermid()); paramMap.put("termid", termId);
paramMap.put("tradetrace", paySerialNo); paramMap.put("tradetrace", paySerialNo);
paramMap.put("opt", "tradeQuery"); paramMap.put("opt", "tradeQuery");
return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getUnionPayUrl(), generateRequestParam(paramMap), new HashMap<>()); return HttpsUtils.doPostForm(CommonSysConst.getSysConfig().getUnionPayUrl(), generateRequestParam(paramMap), new HashMap<>());
@ -109,11 +121,11 @@ public class UnionPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject zwrefund(String orderNo,String paySerialNo,Long refundPrice) throws Exception { public static JSONObject zwrefund(String merId,String termId,String orderNo,String paySerialNo,Long refundPrice) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid()); paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid());
paramMap.put("merid", CommonSysConst.getSysConfig().getUnionPayMerid()); paramMap.put("merid", merId);
paramMap.put("termid", CommonSysConst.getSysConfig().getUnionPayTermid()); paramMap.put("termid", termId);
paramMap.put("tradetrace", orderNo); paramMap.put("tradetrace", orderNo);
paramMap.put("oriwtorderid", paySerialNo); paramMap.put("oriwtorderid", paySerialNo);
paramMap.put("tradeamt", refundPrice); paramMap.put("tradeamt", refundPrice);
@ -128,11 +140,11 @@ public class UnionPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject cancel(String orderNo,String paySerialNo) throws Exception { public static JSONObject cancel(String merId,String termId,String orderNo,String paySerialNo) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid()); paramMap.put("channelid", CommonSysConst.getSysConfig().getUnionPayChannelid());
paramMap.put("merid", CommonSysConst.getSysConfig().getUnionPayMerid()); paramMap.put("merid", merId);
paramMap.put("termid", CommonSysConst.getSysConfig().getUnionPayTermid()); paramMap.put("termid", termId);
paramMap.put("tradetrace", orderNo); paramMap.put("tradetrace", orderNo);
paramMap.put("oriwtorderid", paySerialNo); paramMap.put("oriwtorderid", paySerialNo);
paramMap.put("opt", "cancel"); paramMap.put("opt", "cancel");

@ -2,12 +2,14 @@ package com.hai.config;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.hai.common.utils.DateUtil; import com.hai.common.utils.DateUtil;
import com.hai.common.utils.RequestUtils;
import com.wechat.pay.contrib.apache.httpclient.util.PemUtil; import com.wechat.pay.contrib.apache.httpclient.util.PemUtil;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;
import com.hai.common.pay.util.sdk.WXPayConstants; import com.hai.common.pay.util.sdk.WXPayConstants;
import com.hai.common.utils.HttpsUtils; import com.hai.common.utils.HttpsUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.nio.file.Files; import java.nio.file.Files;
@ -26,27 +28,29 @@ public class UnionStagingPayConfig {
/** /**
* 银联分期支付H5预下单-标准 * 银联分期支付H5预下单-标准
* 文档地址 https://doc.eycard.cn/web/#/222?page_id=3183 * 文档地址 https://doc.eycard.cn/web/#/222?page_id=3183
* @param orderNo 订单 * @param prodTrace 产品流水 可重复记录订单生命周期无特殊需求同交易流水
* @param orgTrace 订单号 * @param orgTrace 订单号
* @param appId 支付宝微信云闪付商户应用ID一般情况下与获取openId时的应用一致 * @param openId 支付宝微信云闪付用户授权唯一标识(如果没有:-)
* @param openId 支付宝微信云闪付用户授权唯一标识(如果没有:-)
* @param payPrice 支付金额 单位 * @param payPrice 支付金额 单位
* @return 响应信息 * @return 响应信息
* @throws Exception * @throws Exception
*/ */
public static JSONObject advancePay(String orderNo, String orgTrace, BigDecimal payPrice, String appId,String openId, String notifyUrl) throws Exception { public static JSONObject advancePay(String prodTrace, String orgTrace, BigDecimal payPrice, String openId, String notifyUrl, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo()); paramMap.put("orgTermNo", CommonSysConst.getSysConfig().getUnionStagingPayOrgTermNo());
paramMap.put("prodTrace", orderNo); paramMap.put("prodTrace", prodTrace);
paramMap.put("orgTrace", orgTrace); paramMap.put("orgTrace", orgTrace);
paramMap.put("prodCode", "ISYH"); paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA"); paramMap.put("signType", "RSA");
JSONObject terminalInfo = new JSONObject();
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request));
paramMap.put("terminalinfo", terminalInfo.toJSONString());
Map<String, Object> bizDataMap = new HashMap<>(); Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue()); bizDataMap.put("transAmt", payPrice.multiply(new BigDecimal("100")).intValue());
bizDataMap.put("appId", appId);
bizDataMap.put("openId", openId); bizDataMap.put("openId", openId);
bizDataMap.put("notifyUrl", notifyUrl); bizDataMap.put("notifyUrl", notifyUrl);
paramMap.put("bizData", bizDataMap); paramMap.put("bizData", bizDataMap);
@ -65,7 +69,7 @@ public class UnionStagingPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject query(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate) throws Exception { public static JSONObject query(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
@ -74,6 +78,10 @@ public class UnionStagingPayConfig {
paramMap.put("prodCode", "ISYH"); paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA"); paramMap.put("signType", "RSA");
JSONObject terminalInfo = new JSONObject();
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request));
paramMap.put("terminalinfo", terminalInfo.toJSONString());
Map<String, Object> bizDataMap = new HashMap<>(); Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("oriOrgTrace", oriOrgTrace); bizDataMap.put("oriOrgTrace", oriOrgTrace);
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd"));
@ -93,7 +101,7 @@ public class UnionStagingPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject queryStaging(String orgTrace, String oriOrgTrace, String prodCode,Date oriBizDate) throws Exception { public static JSONObject queryStaging(String orgTrace, String oriOrgTrace, String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
@ -102,6 +110,10 @@ public class UnionStagingPayConfig {
paramMap.put("prodCode", "ISYH"); paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA"); paramMap.put("signType", "RSA");
JSONObject terminalInfo = new JSONObject();
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request));
paramMap.put("terminalinfo", terminalInfo.toJSONString());
Map<String, Object> bizDataMap = new HashMap<>(); Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("oriOrgTrace", oriOrgTrace); bizDataMap.put("oriOrgTrace", oriOrgTrace);
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd"));
@ -122,7 +134,7 @@ public class UnionStagingPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject standardRefund(String orgTrace, String oriOrgTrace, BigDecimal transAmt,String prodCode,Date oriBizDate) throws Exception { public static JSONObject standardRefund(String orgTrace, String oriOrgTrace, BigDecimal transAmt,String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
@ -131,6 +143,10 @@ public class UnionStagingPayConfig {
paramMap.put("prodCode", "ISYH"); paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA"); paramMap.put("signType", "RSA");
JSONObject terminalInfo = new JSONObject();
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request));
paramMap.put("terminalinfo", terminalInfo.toJSONString());
Map<String, Object> bizDataMap = new HashMap<>(); Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("oriOrgTrace", oriOrgTrace); bizDataMap.put("oriOrgTrace", oriOrgTrace);
bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd")); bizDataMap.put("oriBizDate", DateUtil.date2String(oriBizDate, "yyyyMMdd"));
@ -151,7 +167,7 @@ public class UnionStagingPayConfig {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static JSONObject mposfindrefund(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate) throws Exception { public static JSONObject mposfindrefund(String orgTrace, String oriOrgTrace,String prodCode,Date oriBizDate, HttpServletRequest request) throws Exception {
Map<String,Object> paramMap = new HashMap<>(); Map<String,Object> paramMap = new HashMap<>();
paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId()); paramMap.put("orgId", CommonSysConst.getSysConfig().getUnionStagingPayOrgId());
paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode()); paramMap.put("orgMerCode", CommonSysConst.getSysConfig().getUnionStagingPayOrgMerCode());
@ -160,6 +176,10 @@ public class UnionStagingPayConfig {
paramMap.put("prodCode", "ISYH"); paramMap.put("prodCode", "ISYH");
paramMap.put("signType", "RSA"); paramMap.put("signType", "RSA");
JSONObject terminalInfo = new JSONObject();
terminalInfo.put("terminalip", RequestUtils.getIpAddress(request));
paramMap.put("terminalinfo", terminalInfo.toJSONString());
Map<String, Object> bizDataMap = new HashMap<>(); Map<String, Object> bizDataMap = new HashMap<>();
bizDataMap.put("oriOrgTrace", oriOrgTrace); bizDataMap.put("oriOrgTrace", oriOrgTrace);
paramMap.put("bizData", bizDataMap); paramMap.put("bizData", bizDataMap);

@ -38,12 +38,30 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* 微信订单处理 * 微信订单处理m
*/ */
public class WxOrderConfig { public class WxOrderConfig {
private static final Logger log = LoggerFactory.getLogger(WxOrderConfig.class); private static final Logger log = LoggerFactory.getLogger(WxOrderConfig.class);
/**
* 微信支付商户号
* 个体户黎杨珍
*/
public static final String MCH_ID_1609882817 = "1609882817";
/**
* 微信支付商户号
* 重庆惠兑电子商务有限公司
*/
public static final String MCH_ID_1614670195 = "1614670195";
/**
* 微信支付商户号
* 惠昕贵州能源有限公司
*/
public static final String MCH_ID_1619676214 = "1619676214";
public static OrderRefundModel orderToRefund(String paySerialNo,BigDecimal totalFee,BigDecimal refundFee) throws Exception { public static OrderRefundModel orderToRefund(String paySerialNo,BigDecimal totalFee,BigDecimal refundFee) throws Exception {
Map<String,String> param = new HashMap<>(); Map<String,String> param = new HashMap<>();

@ -483,7 +483,7 @@ public class OutRechargeOrderServiceImpl implements OutRechargeOrderService {
// 银联退款 // 银联退款
if (order.getPayType() == 4) { if (order.getPayType() == 4) {
// 订单退款 // 订单退款
JSONObject refund = UnionPayConfig.zwrefund(order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue()); JSONObject refund = UnionPayConfig.zwrefund(UnionPayConfig.MER_ID2, UnionPayConfig.TERM_ID2, order.getOrderNo(), order.getPaySerialNo(), order.getPayRealPrice().multiply(new BigDecimal("100")).longValue());
if (!refund.getString("resultcode").equals("W6")) { if (!refund.getString("resultcode").equals("W6")) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg")); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, refund.getString("returnmsg"));
} }

@ -39,8 +39,8 @@ unionPayTelNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/notifyTel
unionStagingPayUrl=https://mtest.eycard.cn/ unionStagingPayUrl=https://mtest.eycard.cn/
unionStagingPayOrgId=ORG000000000001 unionStagingPayOrgId=ORG000000000001
unionStagingPayOrgMerCode=83169054816W999 unionStagingPayOrgMerCode=890000000123679
unionStagingPayOrgTermNo=XS000104 unionStagingPayOrgTermNo=W0616228
unionStagingPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0 unionStagingPaySignKey=1dfk0i0fl7ild07l2k5oj8dddikkivd0
unionStagingPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/stagingNotify unionStagingPayNotifyUrl=https://hsgcs.dctpay.com/crest/unionPay/stagingNotify

Loading…
Cancel
Save