|
|
|
@ -26,6 +26,7 @@ import com.hai.order.service.OrderService; |
|
|
|
|
import com.hai.order.service.OrderPayService; |
|
|
|
|
import com.hai.order.type.OrderProductType; |
|
|
|
|
import com.hai.order.type.OrderStatus; |
|
|
|
|
import com.hai.order.type.PlatformType; |
|
|
|
|
import com.hai.service.*; |
|
|
|
|
import com.web.config.SysConst; |
|
|
|
|
import io.swagger.annotations.Api; |
|
|
|
@ -50,6 +51,7 @@ import java.util.concurrent.ThreadLocalRandom; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单支付 |
|
|
|
|
* |
|
|
|
|
* @className: OrderPayController |
|
|
|
|
* @author: HuRui |
|
|
|
|
* @date: 2022/8/30 |
|
|
|
@ -103,7 +105,7 @@ public class OrderPayController { |
|
|
|
|
@Resource |
|
|
|
|
private SecConfigService secConfigService; |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/wechatPay",method = RequestMethod.POST) |
|
|
|
|
@RequestMapping(value = "/wechatPay", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "微信支付") |
|
|
|
|
public ResponseData wechatPay(@RequestBody JSONObject body) { |
|
|
|
@ -112,9 +114,9 @@ public class OrderPayController { |
|
|
|
|
System.out.println("微信支付===================" + body); |
|
|
|
|
|
|
|
|
|
if (body == null |
|
|
|
|
|| StringUtils.isBlank(body.getString("orderNo")) |
|
|
|
|
// || body.getInteger("openIdType") == null
|
|
|
|
|
|| StringUtils.isBlank(body.getString("openId")) |
|
|
|
|
|| StringUtils.isBlank(body.getString("orderNo")) |
|
|
|
|
// || body.getInteger("openIdType") == null
|
|
|
|
|
|| StringUtils.isBlank(body.getString("openId")) |
|
|
|
|
) { |
|
|
|
|
log.error("wxPay error!", "参数错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
@ -122,7 +124,7 @@ public class OrderPayController { |
|
|
|
|
|
|
|
|
|
// 查询订单
|
|
|
|
|
HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); |
|
|
|
|
if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
log.error("wxPay ERROR", "订单不处于待支付状态"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); |
|
|
|
|
} |
|
|
|
@ -138,10 +140,18 @@ public class OrderPayController { |
|
|
|
|
WeChatPayReqInfo weChatPayReqInfo = new WeChatPayReqInfo(); |
|
|
|
|
weChatPayReqInfo.setAppid(SysConst.getSysConfig().getWxPayMchAppId()); // 公众号id
|
|
|
|
|
weChatPayReqInfo.setMch_id(SysConst.getSysConfig().getWxPayMchId()); // 商户号
|
|
|
|
|
if (openIdType != null && openIdType.equals(2)) { |
|
|
|
|
weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MP); // 商户号公众号
|
|
|
|
|
if (PlatformType.TYPE2.getNumber().equals(body.getInteger("platformType"))) { |
|
|
|
|
if (openIdType != null && openIdType.equals(2)) { |
|
|
|
|
weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_QYX_MP); // 商户号公众号
|
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_QYX_MINI); // 嗨森逛小程序
|
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MINI); // 嗨森逛小程序
|
|
|
|
|
if (openIdType != null && openIdType.equals(2)) { |
|
|
|
|
weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MP); // 商户号公众号
|
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_appid(WxOrderConfig.APPID_HSG_MINI); // 嗨森逛小程序
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 订单产品类型
|
|
|
|
@ -150,132 +160,149 @@ public class OrderPayController { |
|
|
|
|
orderTitle = productType.getName(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE1.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE2.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
if (PlatformType.TYPE2.getNumber().equals(body.getInteger("platformType"))) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1648729281); |
|
|
|
|
} else { |
|
|
|
|
if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE1.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE2.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE4.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE3.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { |
|
|
|
|
HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId()); |
|
|
|
|
if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) { |
|
|
|
|
// GZ_SINOPEC_QUOTA 单日限购数量
|
|
|
|
|
SecConfig gzSinopecQuota = secConfigService.findByCodeType("GZ_SINOPEC_QUOTA"); |
|
|
|
|
if (gzSinopecQuota != null |
|
|
|
|
&& couponService.userBuySourceLimitNumber(order.getMemId(),4) >= Integer.parseInt(gzSinopecQuota.getCodeValue())) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,已达单日限购数量"); |
|
|
|
|
} |
|
|
|
|
if (order.getMemDiscountId() != null) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE4.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { |
|
|
|
|
// 查询油站
|
|
|
|
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); |
|
|
|
|
if (store == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); |
|
|
|
|
} |
|
|
|
|
if (store.getPrestoreType().equals(1)) { |
|
|
|
|
if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { |
|
|
|
|
HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId()); |
|
|
|
|
if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) { |
|
|
|
|
// GZ_SINOPEC_QUOTA 单日限购数量
|
|
|
|
|
SecConfig gzSinopecQuota = secConfigService.findByCodeType("GZ_SINOPEC_QUOTA"); |
|
|
|
|
if (gzSinopecQuota != null |
|
|
|
|
&& couponService.userBuySourceLimitNumber(order.getMemId(), 4) >= Integer.parseInt(gzSinopecQuota.getCodeValue())) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法支付,已达单日限购数量"); |
|
|
|
|
} |
|
|
|
|
if (order.getMemDiscountId() != null) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE5.getNumber())) { |
|
|
|
|
HighCoupon coupon = couponService.getCouponById(order.getHighChildOrderList().get(0).getGoodsId()); |
|
|
|
|
if (coupon.getCouponSource() != null && coupon.getCouponSource().equals(4)) { |
|
|
|
|
if (order.getMemDiscountId() != null) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1634835264); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type1 ); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE6.getNumber())) { |
|
|
|
|
// 查询油站
|
|
|
|
|
HighMerchantStoreModel store = merchantStoreService.getMerchantStoreById(order.getHighChildOrderList().get(0).getGoodsId()); |
|
|
|
|
if (store == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未知的加油站"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(1)) { |
|
|
|
|
// 预存类型 0:非预存 1:预存门店
|
|
|
|
|
if (store.getPrestoreType().equals(0)) { |
|
|
|
|
// 第三方平台
|
|
|
|
|
HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId(), 1); |
|
|
|
|
if (merTripartitePlatform != null) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); |
|
|
|
|
// 是否分账
|
|
|
|
|
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true)?"Y":"N"; |
|
|
|
|
} |
|
|
|
|
if (store.getPrestoreType().equals(1)) { |
|
|
|
|
if (order.getTotalPrice().compareTo(gasService.getMerPriceByMerId(store.getMerchantId())) == 1) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "暂时无法进行支付,请联系平台客服"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type1); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(1)) { |
|
|
|
|
// 预存类型 0:非预存 1:预存门店
|
|
|
|
|
if (store.getPrestoreType().equals(0)) { |
|
|
|
|
// 第三方平台
|
|
|
|
|
HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId(), 1); |
|
|
|
|
if (merTripartitePlatform != null) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); |
|
|
|
|
// 是否分账
|
|
|
|
|
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2,GasChannelPayPlatformType.type1 ); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2, GasChannelPayPlatformType.type1); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3,GasChannelPayPlatformType.type1 ); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; |
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4,GasChannelPayPlatformType.type1 ); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3, GasChannelPayPlatformType.type1); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4, GasChannelPayPlatformType.type1); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type5.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type5, GasChannelPayPlatformType.type1); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type5.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type5,GasChannelPayPlatformType.type1 ); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(gasChannelConfig.getPayPlatformMerNo()); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true)?"Y":"N"; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE7.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE7.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE8.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1619676214); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE8.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1619676214); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE9.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
|
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
}else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1609882817); |
|
|
|
|
} else if (order.getProductType().equals(OrderProductType.PRODUCT_TYPE12.getNumber())) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1614670195); |
|
|
|
|
} else { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(WxOrderConfig.MCH_ID_1609882817); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// weChatPayReqInfo.setOpenid(openId);
|
|
|
|
|
weChatPayReqInfo.setSub_openid(body.getString("openId")); |
|
|
|
|
weChatPayReqInfo.setNonce_str(nonce_str); // 随机字符串
|
|
|
|
|
weChatPayReqInfo.setBody(orderTitle); // 商品描述
|
|
|
|
|
weChatPayReqInfo.setOut_trade_no(order.getOrderNo()); // 商户订单号
|
|
|
|
|
weChatPayReqInfo.setBody(orderTitle); // 商品描述
|
|
|
|
|
weChatPayReqInfo.setOut_trade_no(order.getOrderNo()); // 商户订单号
|
|
|
|
|
weChatPayReqInfo.setTotal_fee(total_fee); // 总金额
|
|
|
|
|
weChatPayReqInfo.setSpbill_create_ip("122.9.135.148"); // 终端ip
|
|
|
|
|
weChatPayReqInfo.setNotify_url(SysConst.getSysConfig().getWxPayNotifyUrl()); // 通知url
|
|
|
|
@ -286,11 +313,11 @@ public class OrderPayController { |
|
|
|
|
weChatPayReqInfo.setTime_expire(DateUtil.date2String(DateUtil.addMinute(order.getCreateTime(), 10), "yyyyMMddHHmmss")); |
|
|
|
|
|
|
|
|
|
//附加数据,区分订单类型
|
|
|
|
|
Map<String,String> payMap = new HashMap<>(); |
|
|
|
|
Map<String, String> payMap = new HashMap<>(); |
|
|
|
|
payMap.put("app_id", weChatPayReqInfo.getSub_appid()); |
|
|
|
|
payMap.put("api_key", SysConst.getSysConfig().getWxPayApiKey()); |
|
|
|
|
payMap.put("unified_order_url", SysConst.getSysConfig().getWxPayUnifiedOrderUrl()); |
|
|
|
|
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo,payMap); |
|
|
|
|
SortedMap<Object, Object> sortedMap = wechatPayUtil.goWechatPay(weChatPayReqInfo, payMap); |
|
|
|
|
|
|
|
|
|
order.setAccountMerchantNum(weChatPayReqInfo.getSub_mch_id()); |
|
|
|
|
order.setProfitSharingStatus(profitSharing.equals("Y")); |
|
|
|
@ -299,12 +326,12 @@ public class OrderPayController { |
|
|
|
|
return ResponseMsgUtil.success(sortedMap); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderController -> create() error!",e); |
|
|
|
|
log.error("OrderController -> create() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/cardPay",method = RequestMethod.POST) |
|
|
|
|
@RequestMapping(value = "/cardPay", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "卡支付") |
|
|
|
|
public ResponseData cardPay(@RequestBody JSONObject body) { |
|
|
|
@ -347,7 +374,7 @@ public class OrderPayController { |
|
|
|
|
} |
|
|
|
|
// 查询订单
|
|
|
|
|
HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); |
|
|
|
|
if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
log.error("OrderController --> cardPay() ERROR", "订单不处于待支付状态"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); |
|
|
|
|
} |
|
|
|
@ -369,7 +396,7 @@ public class OrderPayController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderPayController -> cardPay() error!",e); |
|
|
|
|
log.error("OrderPayController -> cardPay() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -487,7 +514,7 @@ public class OrderPayController { |
|
|
|
|
} |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/unionPay",method = RequestMethod.POST) |
|
|
|
|
@RequestMapping(value = "/unionPay", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "银联支付") |
|
|
|
|
public ResponseData unionPay(@RequestBody JSONObject body, HttpServletRequest request) { |
|
|
|
@ -498,11 +525,11 @@ public class OrderPayController { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); |
|
|
|
|
if(order == null) { |
|
|
|
|
if (order == null) { |
|
|
|
|
log.error("OrderController --> orderToPay() ERROR", "未找到订单信息"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.NOT_FOUND_ORDER, ""); |
|
|
|
|
} |
|
|
|
|
if(!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
log.error("OrderController --> orderToPay() ERROR", "订单不处于待支付状态"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); |
|
|
|
|
} |
|
|
|
|