diff --git a/hai-order/src/main/java/com/web/controller/OrderPayController.java b/hai-order/src/main/java/com/web/controller/OrderPayController.java index f9cb676b..9183bc9c 100644 --- a/hai-order/src/main/java/com/web/controller/OrderPayController.java +++ b/hai-order/src/main/java/com/web/controller/OrderPayController.java @@ -9,6 +9,7 @@ import com.hai.common.pay.entity.WeChatPayReqInfo; import com.hai.common.pay.util.MD5Util; import com.hai.common.security.AESEncodeUtil; import com.hai.common.security.UserCenter; +import com.hai.common.utils.DateUtil; import com.hai.common.utils.ResponseMsgUtil; import com.hai.config.UnionPayConfig; import com.hai.config.WxOrderConfig; @@ -270,6 +271,8 @@ public class OrderPayController { weChatPayReqInfo.setTrade_type("JSAPI"); // 交易类型 weChatPayReqInfo.setAttach(null); // 附件参数 weChatPayReqInfo.setProfit_sharing(profitSharing); // 是否分账 Y:是 N:否 + weChatPayReqInfo.setTime_start(DateUtil.date2String(order.getCreateTime(), "yyyyMMddHHmmss")); + weChatPayReqInfo.setTime_expire(DateUtil.date2String(DateUtil.addMinute(order.getCreateTime(), 10), "yyyyMMddHHmmss")); //附加数据,区分订单类型 Map payMap = new HashMap<>(); diff --git a/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java b/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java index f8bfb563..cf139b1e 100644 --- a/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java +++ b/hai-service/src/main/java/com/hai/common/pay/WechatPayUtil.java @@ -1,5 +1,8 @@ package com.hai.common.pay; +import com.hai.common.exception.ErrorCode; +import com.hai.common.exception.ErrorHelp; +import com.hai.common.exception.SysCode; import com.hai.common.pay.entity.WeChatPayReqInfo; import com.hai.common.pay.entity.WechatCallBackInfo; import com.hai.common.pay.util.HttpReqUtil; @@ -73,6 +76,7 @@ public class WechatPayUtil { } else { log.error("微信支付 -> 组装支付参数:支付信息错误"); log.error("错误信息:" + unifiedOrderResultXmL); + throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "无法支付,请稍后重新提交订单支付!"); } return sortedMap;