|
|
|
@@ -475,19 +475,40 @@ public class WxCarController extends BaseController { |
|
|
|
return new ResultData(Result.ERROR,"未设置停车商户."); |
|
|
|
} |
|
|
|
|
|
|
|
String receiverAccount = null; |
|
|
|
boolean isIsv = false; |
|
|
|
String apiKey = null; |
|
|
|
WxAppinfo cAppInfo = wxAppinfoService.getCAppInfoFromRedis(park.getTenantId(), EnumPayWay.PAY_WAY_WECHAT.getPlat()); |
|
|
|
if(cAppInfo == null){ |
|
|
|
throw new MallinkException(ErrorCode.APP_ID_NOT_FOUND.getCode(),"未查询到C端小程序"); |
|
|
|
} |
|
|
|
WxPayAccount payAccount = wxPayAccountService.getByIdFromRedis(cAppInfo.getPayId()); |
|
|
|
if(payAccount == null){ |
|
|
|
throw new MallinkException(ErrorCode.API_KEY_NOT_FOUND.getCode(),"未查询到payAccount."); |
|
|
|
} |
|
|
|
|
|
|
|
WxProfitPaymentReceiver receiver = wxProfitPaymentReceiverService.findReceiver(park, parkMerchant.getId(), EnumAppPlat.WX); |
|
|
|
if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { |
|
|
|
//查找小程序收款账户 |
|
|
|
receiverAccount = payAccount.getSubMchId(); |
|
|
|
isIsv = true; |
|
|
|
//查询商官商户 |
|
|
|
WxMerchant adminMerchant = wxMerchantService.findAdmin(park); |
|
|
|
if (null == adminMerchant) { |
|
|
|
return new ResultData(Result.ERROR,"未找到商管商户."); |
|
|
|
} |
|
|
|
receiver = wxProfitPaymentReceiverService.findReceiver(park, adminMerchant.getId(), EnumAppPlat.WX); |
|
|
|
if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { |
|
|
|
return new ResultData(Result.ERROR,"商管商户未设置收款账号."); |
|
|
|
} |
|
|
|
// WxMerchant adminMerchant = wxMerchantService.findAdmin(park); |
|
|
|
// if (null == adminMerchant) { |
|
|
|
// return new ResultData(Result.ERROR,"未找到商管商户."); |
|
|
|
// } |
|
|
|
// receiver = wxProfitPaymentReceiverService.findReceiver(park, adminMerchant.getId(), EnumAppPlat.WX); |
|
|
|
// if (null == receiver || StringUtils.isBlank(receiver.getReceiverAccount())) { |
|
|
|
// return new ResultData(Result.ERROR,"商管商户未设置收款账号."); |
|
|
|
// } |
|
|
|
}else { |
|
|
|
receiverAccount = receiver.getReceiverAccount(); |
|
|
|
Integer isvModel = (Integer)receiver.getReceiverParamValue(Constant.paymentReceiverParamIsv); |
|
|
|
if (EnumYesOrNo.YES.getCode() == isvModel) { |
|
|
|
isIsv = true; |
|
|
|
} |
|
|
|
apiKey = (String)receiver.getReceiverParamValue(Constant.paymentReceicerParamApiKey); |
|
|
|
} |
|
|
|
String receiverAccount = receiver.getReceiverAccount(); |
|
|
|
int rlength = receiverAccount.length(); |
|
|
|
//最大128 cuserId,cuserPhone,carNumber,merchantId,merchantAccount,parkOrderNo |
|
|
|
StringBuffer attachSb = new StringBuffer() |
|
|
|
@@ -501,18 +522,12 @@ public class WxCarController extends BaseController { |
|
|
|
} |
|
|
|
attachSb.append(payOrder.getParkOrderNumber()); |
|
|
|
//创建微信支付订单 |
|
|
|
boolean isIsv = false; |
|
|
|
Integer isvModel = (Integer)receiver.getReceiverParamValue(Constant.paymentReceiverParamIsv); |
|
|
|
if (EnumYesOrNo.YES.getCode() == isvModel) { |
|
|
|
isIsv = true; |
|
|
|
} |
|
|
|
final IdWorker idWorker = IdWorker.get(); |
|
|
|
String uniquePayOrderNo = carVendor.getMessage()+"_"+idWorker.nextId(); |
|
|
|
String apiKey = (String)receiver.getReceiverParamValue(Constant.paymentReceicerParamApiKey); |
|
|
|
String attach = attachSb.toString(); |
|
|
|
String productPre = "停车费支付,车场订单号";//中文签名错误 |
|
|
|
//String productPre = "ParkOrderId"; |
|
|
|
PayAdapterResult wxResult = wxParkPayService.createWxPayOrder(park,isIsv,false,user.getOpenId(), user.getAppId(), receiver.getReceiverAccount(), productPre+payOrder.getParkOrderNumber(), attach, uniquePayOrderNo, payOrder.getFee(), |
|
|
|
PayAdapterResult wxResult = wxParkPayService.createWxPayOrder(payAccount,cAppInfo,isIsv,false,user.getOpenId(), receiverAccount, productPre+payOrder.getParkOrderNumber(), attach, uniquePayOrderNo, payOrder.getFee(), |
|
|
|
"127.0.0.1", park.getPaidCallBack(), apiKey, new Date()); |
|
|
|
if (wxResult.isSuccess()) { |
|
|
|
return new ResultData(wxResult); |
|
|
|
|