|
|
|
@ -239,15 +239,27 @@ public class OrderPayController { |
|
|
|
|
// 预存类型 0:非预存 1:预存门店
|
|
|
|
|
if (store.getPrestoreType().equals(0)) { |
|
|
|
|
// 第三方平台
|
|
|
|
|
HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId(), 1); |
|
|
|
|
if (merTripartitePlatform != null) { |
|
|
|
|
HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId()); |
|
|
|
|
// 微信直连
|
|
|
|
|
if (merTripartitePlatform != null && merTripartitePlatform.getPlatformType().equals(1)) { |
|
|
|
|
weChatPayReqInfo.setSub_mch_id(merTripartitePlatform.getPlatformMerNumber()); |
|
|
|
|
// 是否分账
|
|
|
|
|
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (merTripartitePlatform != null && merTripartitePlatform.getPlatformType().equals(2)) { |
|
|
|
|
payPlatformType = merTripartitePlatform.getPlatformType(); |
|
|
|
|
payPlatformKey = merTripartitePlatform.getPlatformMerKey(); |
|
|
|
|
payPlatformMerNo = merTripartitePlatform.getPlatformMerNumber(); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 是否分账
|
|
|
|
|
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
@ -421,6 +433,177 @@ public class OrderPayController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/alipay", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "支付宝支付") |
|
|
|
|
public ResponseData alipay(@RequestBody JSONObject body) { |
|
|
|
|
try { |
|
|
|
|
System.out.println("支付宝支付===================" + body); |
|
|
|
|
if (body == null |
|
|
|
|
|| StringUtils.isBlank(body.getString("orderNo")) |
|
|
|
|
|| StringUtils.isBlank(body.getString("userId")) |
|
|
|
|
) { |
|
|
|
|
log.error("wxPay error!", "参数错误"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.REQ_PARAMS_ERROR, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 查询订单
|
|
|
|
|
HighOrder order = orderService.getOrderDetailByNo(body.getString("orderNo")); |
|
|
|
|
if (!order.getOrderStatus().equals(OrderStatus.STATUS1.getNumber())) { |
|
|
|
|
log.error("wxPay ERROR", "订单不处于待支付状态"); |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ORDER_NO_STAY_PAY, ""); |
|
|
|
|
} |
|
|
|
|
// 是否分账
|
|
|
|
|
String profitSharing = "N"; |
|
|
|
|
// 订单标题
|
|
|
|
|
String orderTitle = "购买商品"; |
|
|
|
|
|
|
|
|
|
Integer payPlatformType = null; |
|
|
|
|
String payPlatformKey = null; |
|
|
|
|
String payPlatformMerNo = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, "暂时无法进行支付,请联系平台客服"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type1, GasChannelPayPlatformType.type2); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
if (store.getSourceType().equals(MerchantStoreSourceType.type1.getNumber())) { |
|
|
|
|
// 预存类型 0:非预存 1:预存门店
|
|
|
|
|
if (store.getPrestoreType().equals(0)) { |
|
|
|
|
// 第三方平台
|
|
|
|
|
HighMerchantTripartitePlatform merTripartitePlatform = merTripartitePlatformService.getDetail(store.getMerchantId()); |
|
|
|
|
if (merTripartitePlatform != null && merTripartitePlatform.getPlatformType().equals(GasChannelPayPlatformType.type2.getType())) { |
|
|
|
|
payPlatformType = merTripartitePlatform.getPlatformType(); |
|
|
|
|
payPlatformKey = merTripartitePlatform.getPlatformMerKey(); |
|
|
|
|
payPlatformMerNo = merTripartitePlatform.getPlatformMerNumber(); |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
// 是否分账
|
|
|
|
|
profitSharing = merTripartitePlatform.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type2.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type2); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
payPlatformType = gasChannelConfig.getPayPlatformType(); |
|
|
|
|
payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); |
|
|
|
|
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type3.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type3); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
payPlatformType = gasChannelConfig.getPayPlatformType(); |
|
|
|
|
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); |
|
|
|
|
payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type4.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type4); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
payPlatformType = gasChannelConfig.getPayPlatformType(); |
|
|
|
|
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); |
|
|
|
|
payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type5.getNumber())) { |
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type5); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
payPlatformType = gasChannelConfig.getPayPlatformType(); |
|
|
|
|
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); |
|
|
|
|
payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type6.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type6); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
payPlatformType = gasChannelConfig.getPayPlatformType(); |
|
|
|
|
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); |
|
|
|
|
payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else if (store.getSourceType().equals(MerchantStoreSourceType.type7.getNumber())) { |
|
|
|
|
|
|
|
|
|
// 查询支付配置
|
|
|
|
|
HighGasChannelConfig gasChannelConfig = gasChannelConfigService.getConfig(GasChannel.type7); |
|
|
|
|
if (gasChannelConfig == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
payPlatformType = gasChannelConfig.getPayPlatformType(); |
|
|
|
|
payPlatformMerNo = gasChannelConfig.getPayPlatformMerNo(); |
|
|
|
|
payPlatformKey = gasChannelConfig.getPayPlatformMerKey(); |
|
|
|
|
profitSharing = gasChannelConfig.getProfitSharingStatus().equals(true) ? "Y" : "N"; |
|
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未配置支付参数,请稍后重试!"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
JSONObject payParam = new JSONObject(); |
|
|
|
|
payParam.put("outTradeNo" , order.getOrderNo()); |
|
|
|
|
payParam.put("transType" , "JSAPI"); |
|
|
|
|
payParam.put("payMode" , "ALIPAY"); |
|
|
|
|
payParam.put("totalAmount" , order.getTotalPrice()); |
|
|
|
|
payParam.put("profitSharing" , profitSharing.equals("Y")?1:0); |
|
|
|
|
payParam.put("notifyUrl" , SysConst.getSysConfig().getHuiPayNotify()); |
|
|
|
|
payParam.put("subject" , orderTitle); |
|
|
|
|
payParam.put("userId" , body.getString("userId")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SortedMap<Object, Object> sortedMap = huiConfig.preorder(payParam, payPlatformKey, payPlatformMerNo); |
|
|
|
|
order.setAccountMerchantNum(payPlatformMerNo); |
|
|
|
|
order.setProfitSharingStatus(false); |
|
|
|
|
order.setPayChannel(payPlatformType); |
|
|
|
|
orderService.updateOrderData(order); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(sortedMap); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("OrderController -> create() error!", e); |
|
|
|
|
return ResponseMsgUtil.exception(e); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value = "/cardPay", method = RequestMethod.POST) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "卡支付") |
|
|
|
|