提交代码

master
胡锐 4 months ago committed by yuanye
parent 32379dc6a8
commit 9fb6819519
  1. 10
      order/src/main/java/com/order/controller/OrderPayController.java
  2. 6
      service/src/main/java/com/hfkj/service/pay/HuiPayService.java

@ -6,6 +6,7 @@ import com.hfkj.common.exception.ErrorHelp;
import com.hfkj.common.exception.SysCode; import com.hfkj.common.exception.SysCode;
import com.hfkj.common.security.UserCenter; import com.hfkj.common.security.UserCenter;
import com.hfkj.common.utils.ResponseMsgUtil; import com.hfkj.common.utils.ResponseMsgUtil;
import com.hfkj.config.CommonSysConst;
import com.hfkj.entity.BsMerPayConfig; import com.hfkj.entity.BsMerPayConfig;
import com.hfkj.entity.BsOrderOutside; import com.hfkj.entity.BsOrderOutside;
import com.hfkj.entity.BsUserCard; import com.hfkj.entity.BsUserCard;
@ -103,8 +104,13 @@ public class OrderPayController {
if (merPay == null) { if (merPay == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付");
} }
// appIdType 1: 公众号 2:小程序
if (body.getInteger("appIdType") != null && body.getInteger("appIdType") == 2) {
body.put("appId", CommonSysConst.getSysConfig().getWechatMaAppid());
}
// 请求支付渠道 // 请求支付渠道
Map<Object, Object> preorder = HuiPayService.preorder(merPay.getPayMerNo(), merPay.getPayMerKey(), body.getString("openId"), order); Map<Object, Object> preorder = HuiPayService.preorder(merPay.getPayMerNo(), merPay.getPayMerKey(), body.getString("appId"), body.getString("openId"), order);
for (OrderChildModel orderChild : order.getOrderChildList()) { for (OrderChildModel orderChild : order.getOrderChildList()) {
orderChild.setSettleAccount(merPay.getPayMerNo()); orderChild.setSettleAccount(merPay.getPayMerNo());
orderChild.setSettleAccountKey(merPay.getPayMerKey()); orderChild.setSettleAccountKey(merPay.getPayMerKey());
@ -146,7 +152,7 @@ public class OrderPayController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "商户未配置支付");
} }
// 请求支付渠道 // 请求支付渠道
Map<Object, Object> preorder = HuiPayService.preorder(merPay.getPayMerNo(), merPay.getPayMerKey(), body.getString("openId"), order); Map<Object, Object> preorder = HuiPayService.preorder(merPay.getPayMerNo(), merPay.getPayMerKey(), null, body.getString("openId"), order);
for (OrderChildModel orderChild : order.getOrderChildList()) { for (OrderChildModel orderChild : order.getOrderChildList()) {
orderChild.setSettleAccount(merPay.getPayMerNo()); orderChild.setSettleAccount(merPay.getPayMerNo());
orderChild.setSettleAccountKey(merPay.getPayMerKey()); orderChild.setSettleAccountKey(merPay.getPayMerKey());

@ -9,6 +9,7 @@ import com.hfkj.common.utils.HttpsUtils;
import com.hfkj.config.CommonSysConst; import com.hfkj.config.CommonSysConst;
import com.hfkj.model.order.OrderModel; import com.hfkj.model.order.OrderModel;
import com.hfkj.sysenum.order.OrderPayTypeEnum; import com.hfkj.sysenum.order.OrderPayTypeEnum;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -38,7 +39,7 @@ public class HuiPayService {
* @return * @return
* @throws Exception * @throws Exception
*/ */
public static Map<Object, Object> preorder(String merNo,String merKey,String openId,OrderModel order) throws Exception { public static Map<Object, Object> preorder(String merNo,String merKey,String appId,String openId,OrderModel order) throws Exception {
try { try {
log.info("=============== start 惠支付 start =================="); log.info("=============== start 惠支付 start ==================");
Map<String, Object> param = new HashMap<>(); Map<String, Object> param = new HashMap<>();
@ -50,6 +51,9 @@ public class HuiPayService {
} else if (OrderPayTypeEnum.type2.getCode() == order.getPayType()) { } else if (OrderPayTypeEnum.type2.getCode() == order.getPayType()) {
param.put("payMode", "ALIPAY"); param.put("payMode", "ALIPAY");
} }
if (StringUtils.isNotBlank(appId)) {
param.put("subAppid", appId);
}
param.put("totalAmount", order.getPayRealPrice()); param.put("totalAmount", order.getPayRealPrice());
param.put("profitSharing", "0"); param.put("profitSharing", "0");
param.put("subject", "购买产品"); param.put("subject", "购买产品");

Loading…
Cancel
Save