...
|
...
|
@@ -678,7 +678,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
logger.info("transferMon uid {} 支付宝账号uid无值使用账号{}", targetUid, account.getAlipayAccount());
|
|
|
transfer.setAlipayAccount(account.getAlipayAccount());
|
|
|
}
|
|
|
|
|
|
transfer.setUpdateTime(now);
|
|
|
tradeBillsMapper.insert(record);
|
|
|
|
|
|
String alipayAccount = transfer.getAlipayAccount();
|
...
|
...
|
@@ -689,7 +689,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
|
|
|
|
|
|
if(exceedMillion()) {
|
|
|
transfer.setTransferType(2);
|
|
|
transfer.setInterfaceType(2);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
|
|
|
String resultStr = JSON.toJSONString(mapResult);
|
|
|
jsonObject = JSON.parseObject(resultStr);
|
...
|
...
|
@@ -701,7 +702,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
transfer.setTransferType(1);
|
|
|
transfer.setInterfaceType(1);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
|
|
|
if (jsonObject == null) {
|
|
|
logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
|
...
|
...
|
@@ -720,7 +722,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
transfer.setAlipayTradeId(orderId);
|
|
|
transfer.setStatus(1);
|
|
|
} else if(exceedMillion(jsonObject)) {
|
|
|
transfer.setTransferType(2);
|
|
|
transfer.setInterfaceType(2);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
|
|
|
String resultStr = JSON.toJSONString(mapResult);
|
|
|
jsonObject = JSON.parseObject(resultStr);
|
...
|
...
|
@@ -754,7 +757,6 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
return;
|
|
|
}
|
|
|
logger.info("transferMon最后更新状态 status= {}", transfer.getStatus());
|
|
|
transfer.setUpdateTime(now);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
// 100:成功;201:没有支付宝账号;202:金额不合法;299:转账失败
|
|
|
record.setTradeStatus(transfer.getStatus() == 1 ? 100 : 299);
|
...
|
...
|
@@ -812,11 +814,13 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
// 转账
|
|
|
JSONObject jsonObject = null;
|
|
|
boolean exceedMillionAndSuccess = false;
|
|
|
transfer.setUpdateTime(now);
|
|
|
try {
|
|
|
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
|
|
|
|
|
|
if(exceedMillion()) {
|
|
|
transfer.setTransferType(2);
|
|
|
transfer.setInterfaceType(2);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
|
|
|
String resultStr = JSON.toJSONString(mapResult);
|
|
|
jsonObject = JSON.parseObject(resultStr);
|
...
|
...
|
@@ -828,7 +832,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
}
|
|
|
|
|
|
transfer.setTransferType(1);
|
|
|
transfer.setInterfaceType(1);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount);
|
|
|
if (jsonObject == null) {
|
|
|
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
|
...
|
...
|
@@ -848,7 +853,8 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
transfer.setStatus(1);
|
|
|
return true;
|
|
|
} else if(exceedMillion(jsonObject)) {
|
|
|
transfer.setTransferType(2);
|
|
|
transfer.setInterfaceType(2);
|
|
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
|
|
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
|
|
|
String resultStr = JSON.toJSONString(mapResult);
|
|
|
jsonObject = JSON.parseObject(resultStr);
|
...
|
...
|
@@ -1075,7 +1081,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
}
|
|
|
}
|
|
|
JSONObject jsonObject = null;
|
|
|
Integer transferType = null;
|
|
|
Integer interfaceType = null;
|
|
|
try {
|
|
|
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode);
|
|
|
if (transfer == null) {
|
...
|
...
|
@@ -1084,16 +1090,16 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
if (transfer == null || transfer.getStatus() == 1) {
|
|
|
throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId);
|
|
|
}
|
|
|
transferType = transfer.getInterfaceType();
|
|
|
if (transferType == null || transferType < 1 || transferType > 2) {
|
|
|
throw new ServiceException(400, "转账记录接口类型有误,流水id=" + tradeBillsId);
|
|
|
}
|
|
|
interfaceType = transfer.getInterfaceType();
|
|
|
|
|
|
if (transferType == 2) {
|
|
|
logger.info("manualDeal orderCode={}, tradeBillId={}, 转账接口类型为 {}", orderCode, tradeBillsId, interfaceType);
|
|
|
if (interfaceType != null && interfaceType == 2) {
|
|
|
logger.info("manualDeal orderCode={}, tradeBillId={}, 转账接口类型为 超过100万的接口", orderCode, tradeBillsId);
|
|
|
transferWhenExceedMillion(transfer.getId(), preSuccess, orderCode, account, amount, now);
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
logger.info("manualDeal orderCode={}, tradeBillId={}, 转账接口类型为 小于100万的接口", orderCode, tradeBillsId);
|
|
|
jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
|
|
|
if (jsonObject == null) {
|
|
|
logger.warn("manualDeal 转账失败 , req is {}", req);
|
...
|
...
|
@@ -1127,7 +1133,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
throw new ServiceException(500, "转账失败:返回code="+code+",order_id="+orderId);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
if (transferType != null && transferType == 2) {
|
|
|
if (interfaceType != null && interfaceType == 2) {
|
|
|
return;
|
|
|
}
|
|
|
logger.warn("manualDealErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
|
...
|
...
|
|