| @@ -14,6 +14,11 @@ public class PayProperty { | |||||
| */ | */ | ||||
| private boolean real; | private boolean real; | ||||
| /** | |||||
| * 是否分账 | |||||
| */ | |||||
| private boolean share; | |||||
| public boolean isReal() { | public boolean isReal() { | ||||
| return real; | return real; | ||||
| } | } | ||||
| @@ -21,4 +26,12 @@ public class PayProperty { | |||||
| public void setReal(boolean real) { | public void setReal(boolean real) { | ||||
| this.real = real; | this.real = real; | ||||
| } | } | ||||
| public boolean isShare() { | |||||
| return share; | |||||
| } | |||||
| public void setShare(boolean share) { | |||||
| this.share = share; | |||||
| } | |||||
| } | } | ||||
| @@ -39,4 +39,5 @@ mapper: | |||||
| - com.simple.common.CommonMapper | - com.simple.common.CommonMapper | ||||
| pay: | pay: | ||||
| real: true | |||||
| real: true | |||||
| share: false | |||||
| @@ -14,6 +14,11 @@ public class PayProperty { | |||||
| */ | */ | ||||
| private boolean real; | private boolean real; | ||||
| /** | |||||
| * 是否分账 | |||||
| */ | |||||
| private boolean share; | |||||
| public boolean isReal() { | public boolean isReal() { | ||||
| return real; | return real; | ||||
| } | } | ||||
| @@ -21,4 +26,12 @@ public class PayProperty { | |||||
| public void setReal(boolean real) { | public void setReal(boolean real) { | ||||
| this.real = real; | this.real = real; | ||||
| } | } | ||||
| public boolean isShare() { | |||||
| return share; | |||||
| } | |||||
| public void setShare(boolean share) { | |||||
| this.share = share; | |||||
| } | |||||
| } | } | ||||
| @@ -39,4 +39,5 @@ mapper: | |||||
| - com.simple.common.CommonMapper | - com.simple.common.CommonMapper | ||||
| pay: | pay: | ||||
| real: true | |||||
| real: true | |||||
| share: false | |||||
| @@ -16,6 +16,11 @@ public class PayProperty { | |||||
| */ | */ | ||||
| private boolean real; | private boolean real; | ||||
| /** | |||||
| * 是否分账 | |||||
| */ | |||||
| private boolean share; | |||||
| public boolean isReal() { | public boolean isReal() { | ||||
| return real; | return real; | ||||
| } | } | ||||
| @@ -23,4 +28,12 @@ public class PayProperty { | |||||
| public void setReal(boolean real) { | public void setReal(boolean real) { | ||||
| this.real = real; | this.real = real; | ||||
| } | } | ||||
| public boolean isShare() { | |||||
| return share; | |||||
| } | |||||
| public void setShare(boolean share) { | |||||
| this.share = share; | |||||
| } | |||||
| } | } | ||||
| @@ -72,7 +72,7 @@ public class WxPayOrderController extends BaseController { | |||||
| try { | try { | ||||
| record.setIp(IPUtil.getIpAddr(request)); | record.setIp(IPUtil.getIpAddr(request)); | ||||
| return wxPayOrderService.createPayOrder(payProperty.isReal(), appInfo, user, record, EnumPayWay.PAY_WAY_WECHAT); | |||||
| return wxPayOrderService.createPayOrder(payProperty.isReal(), payProperty.isShare(), appInfo, user, record, EnumPayWay.PAY_WAY_WECHAT); | |||||
| } catch (MallinkException e) { | } catch (MallinkException e) { | ||||
| logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | logger.error("payment wechat, order create error, req 2: " + record.toString() + ", e:" + e.getMessage()); | ||||
| return new ResultData(e.getErrorCode(), e.getMessage()); | return new ResultData(e.getErrorCode(), e.getMessage()); | ||||
| @@ -40,3 +40,4 @@ mapper: | |||||
| pay: | pay: | ||||
| real: true | real: true | ||||
| share: false | |||||
| @@ -18,7 +18,7 @@ public interface WxPayOrderService { | |||||
| * @param payWay | * @param payWay | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| ResultData createPayOrder(boolean isReal, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay); | |||||
| ResultData createPayOrder(boolean isReal, boolean isShare, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay); | |||||
| /** | /** | ||||
| * 微信支付订单查询 | * 微信支付订单查询 | ||||
| @@ -84,7 +84,7 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| "\"XML_FORMAT_ERROR\":{\"detail\":\"XML格式错误\t\",\"reason\":\"XML格式错误\",\"reason\":\"请检查XML参数格式是否正确\"}}"); | "\"XML_FORMAT_ERROR\":{\"detail\":\"XML格式错误\t\",\"reason\":\"XML格式错误\",\"reason\":\"请检查XML参数格式是否正确\"}}"); | ||||
| @Override | @Override | ||||
| public ResultData createPayOrder(boolean isReal, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay) { | |||||
| public ResultData createPayOrder(boolean isReal, boolean isShare, WxAppinfo appInfo, WxCUser user, WxPayOrder record, EnumPayWay payWay) { | |||||
| final IdWorker idworker = IdWorker.get(); | final IdWorker idworker = IdWorker.get(); | ||||
| try { | try { | ||||
| @@ -152,7 +152,10 @@ public class WxPayOrderServiceImpl implements WxPayOrderService { | |||||
| Date futureDate = new Date(); | Date futureDate = new Date(); | ||||
| futureDate.setTime(currentDate.getTime() + 15*60*1000); | futureDate.setTime(currentDate.getTime() + 15*60*1000); | ||||
| wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | wxPayOrderP.setTime_expire(Utility.getDataFormatStringYYYYMMDDHHmmss(futureDate)); // 15分钟后结束 | ||||
| wxPayOrderP.setSign(WxPayment.createSign(BeanUtils.toStringMap(wxPayOrderP), payAccount.getApiKey())); | |||||
| Map<String, String> payOrderMap = BeanUtils.toStringMap(wxPayOrderP); | |||||
| if(isShare) | |||||
| payOrderMap.put("profit_sharing", "Y"); | |||||
| wxPayOrderP.setSign(WxPayment.createSign(payOrderMap, payAccount.getApiKey())); | |||||
| String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); | String response = WxPay.pushOrder(BeanUtils.toStringMap(wxPayOrderP)); | ||||
| logger.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); | logger.info("pay order, wechat pushOrder, " + wxPayOrderP.toString() + ", response: " + response.toString()); | ||||
| Map<String, String> returnMap = WxPayment.xmlToMap(response); | Map<String, String> returnMap = WxPayment.xmlToMap(response); | ||||