Authored by Lixiaodi

Merge branch 'dev_order' into test6.8.2

@@ -144,7 +144,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -144,7 +144,7 @@ public class PaymentServiceImpl implements IPaymentService {
144 } 144 }
145 145
146 AbstractOrderPaymentService paymentService = null; 146 AbstractOrderPaymentService paymentService = null;
147 - 147 + logger.info("orderCode is {}, type is {}", orderCode, codeMeta.getType());
148 // 买家订单 148 // 买家订单
149 if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){ 149 if (codeMeta.getType() == OrderCodeType.BUYER_TYPE.getType()){
150 paymentService = this.buyerOrderPaymentService; 150 paymentService = this.buyerOrderPaymentService;
@@ -154,7 +154,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -154,7 +154,7 @@ public class PaymentServiceImpl implements IPaymentService {
154 }else if(codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()){ 154 }else if(codeMeta.getType() == OrderCodeType.SELLER_RECHARGE_EARNEST_TYPE.getType()){
155 paymentService = this.merchantOrderPaymentService; 155 paymentService = this.merchantOrderPaymentService;
156 } 156 }
157 - 157 + logger.info("orderCode is {}, type is {}, service is {}", orderCode, codeMeta.getType(), paymentService);
158 return paymentService; 158 return paymentService;
159 } 159 }
160 160
@@ -576,7 +576,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -576,7 +576,7 @@ public class PaymentServiceImpl implements IPaymentService {
576 // 转账 576 // 转账
577 try { 577 try {
578 logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount); 578 logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
579 - JSONObject jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), alipayAccount, transferAmount); 579 + JSONObject jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), null, alipayAccount, transferAmount);
580 if (jsonObject == null) { 580 if (jsonObject == null) {
581 logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode); 581 logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
582 transfer.setStatus(3); 582 transfer.setStatus(3);
@@ -683,7 +683,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -683,7 +683,7 @@ public class PaymentServiceImpl implements IPaymentService {
683 // 转账 683 // 转账
684 try { 684 try {
685 logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, alipayAccount, amount); 685 logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, alipayAccount, amount);
686 - JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), alipayAccount, amount); 686 + JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), null, alipayAccount, amount);
687 if (jsonObject == null) { 687 if (jsonObject == null) {
688 logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode); 688 logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
689 transfer.setStatus(3); 689 transfer.setStatus(3);
@@ -890,7 +890,7 @@ public class PaymentServiceImpl implements IPaymentService { @@ -890,7 +890,7 @@ public class PaymentServiceImpl implements IPaymentService {
890 throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId); 890 throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId);
891 } 891 }
892 892
893 - JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), alipayAccount, amount); 893 + JSONObject jsonObject = alipayService.transferMoney(Long.toString(orderCode), null, alipayAccount, amount);
894 if (jsonObject == null) { 894 if (jsonObject == null) {
895 logger.warn("manualDeal 转账失败 , req is {}", req); 895 logger.warn("manualDeal 转账失败 , req is {}", req);
896 throw new ServiceException(500, "转账失败:阿里接口返回null"); 896 throw new ServiceException(500, "转账失败:阿里接口返回null");
@@ -137,9 +137,9 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -137,9 +137,9 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
137 * @param transferAmount 137 * @param transferAmount
138 * @return 138 * @return
139 */ 139 */
140 - public JSONObject transferMoney(String transferOrderCode, String alipayAccount, BigDecimal transferAmount){ 140 + public JSONObject transferMoney(String transferOrderCode, String alipayUid, String alipayAccount, BigDecimal transferAmount){
141 141
142 - Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayAccount, transferAmount); 142 + Map<String, String> queryParams = buildTransferParams(transferOrderCode, alipayUid, alipayAccount, transferAmount);
143 String respTxt = sendOpenApiRequest(transferOrderCode, queryParams); 143 String respTxt = sendOpenApiRequest(transferOrderCode, queryParams);
144 144
145 JSONObject result = null; 145 JSONObject result = null;
@@ -234,7 +234,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -234,7 +234,7 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
234 * @param orderData 234 * @param orderData
235 * @return 235 * @return
236 */ 236 */
237 - private Map<String, String> buildTransferParams(String transferOrderCode, String alipayAccount, BigDecimal transferAmount) { 237 + private Map<String, String> buildTransferParams(String transferOrderCode, String alipayUid, String alipayAccount, BigDecimal transferAmount) {
238 Map<String, String> params = new HashMap<String, String>(); 238 Map<String, String> params = new HashMap<String, String>();
239 params.put("app_id", getAppId()); 239 params.put("app_id", getAppId());
240 params.put("method", "alipay.fund.trans.toaccount.transfer"); 240 params.put("method", "alipay.fund.trans.toaccount.transfer");
@@ -246,8 +246,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService { @@ -246,8 +246,13 @@ public abstract class AlipayServiceAbstract extends AbstractPayService {
246 246
247 JSONObject bizJson = new JSONObject(); 247 JSONObject bizJson = new JSONObject();
248 bizJson.put("out_biz_no", transferOrderCode); // 商户转账唯一订单号 248 bizJson.put("out_biz_no", transferOrderCode); // 商户转账唯一订单号
249 - bizJson.put("payee_type", "ALIPAY_LOGONID");  
250 - bizJson.put("payee_account", alipayAccount); // 支付宝账号 249 + if(StringUtils.isNotBlank(alipayUid)) {
  250 + bizJson.put("payee_type", "ALIPAY_USERID");
  251 + bizJson.put("payee_account", alipayUid); // 支付宝uid
  252 + } else {
  253 + bizJson.put("payee_type", "ALIPAY_LOGONID");
  254 + bizJson.put("payee_account", alipayAccount); // 支付宝账号
  255 + }
251 bizJson.put("amount", transferAmount.toString()); 256 bizJson.put("amount", transferAmount.toString());
252 257
253 258