|
@@ -689,6 +689,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -689,6 +689,7 @@ public class PaymentServiceImpl implements IPaymentService { |
689
|
logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
|
689
|
logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
|
690
|
|
690
|
|
691
|
if(exceedMillion()) {
|
691
|
if(exceedMillion()) {
|
|
|
692
|
+ transfer.setTransferType(2);
|
692
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
|
693
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
|
693
|
String resultStr = JSON.toJSONString(mapResult);
|
694
|
String resultStr = JSON.toJSONString(mapResult);
|
694
|
jsonObject = JSON.parseObject(resultStr);
|
695
|
jsonObject = JSON.parseObject(resultStr);
|
|
@@ -700,6 +701,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -700,6 +701,7 @@ public class PaymentServiceImpl implements IPaymentService { |
700
|
}
|
701
|
}
|
701
|
}
|
702
|
}
|
702
|
|
703
|
|
|
|
704
|
+ transfer.setTransferType(1);
|
703
|
jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
|
705
|
jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
|
704
|
if (jsonObject == null) {
|
706
|
if (jsonObject == null) {
|
705
|
logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
|
707
|
logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
|
|
@@ -718,6 +720,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -718,6 +720,7 @@ public class PaymentServiceImpl implements IPaymentService { |
718
|
transfer.setAlipayTradeId(orderId);
|
720
|
transfer.setAlipayTradeId(orderId);
|
719
|
transfer.setStatus(1);
|
721
|
transfer.setStatus(1);
|
720
|
} else if(exceedMillion(jsonObject)) {
|
722
|
} else if(exceedMillion(jsonObject)) {
|
|
|
723
|
+ transfer.setTransferType(2);
|
721
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
|
724
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
|
722
|
String resultStr = JSON.toJSONString(mapResult);
|
725
|
String resultStr = JSON.toJSONString(mapResult);
|
723
|
jsonObject = JSON.parseObject(resultStr);
|
726
|
jsonObject = JSON.parseObject(resultStr);
|
|
@@ -813,6 +816,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -813,6 +816,7 @@ public class PaymentServiceImpl implements IPaymentService { |
813
|
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
|
816
|
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
|
814
|
|
817
|
|
815
|
if(exceedMillion()) {
|
818
|
if(exceedMillion()) {
|
|
|
819
|
+ transfer.setTransferType(2);
|
816
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
|
820
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
|
817
|
String resultStr = JSON.toJSONString(mapResult);
|
821
|
String resultStr = JSON.toJSONString(mapResult);
|
818
|
jsonObject = JSON.parseObject(resultStr);
|
822
|
jsonObject = JSON.parseObject(resultStr);
|
|
@@ -824,6 +828,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -824,6 +828,7 @@ public class PaymentServiceImpl implements IPaymentService { |
824
|
}
|
828
|
}
|
825
|
}
|
829
|
}
|
826
|
|
830
|
|
|
|
831
|
+ transfer.setTransferType(1);
|
827
|
jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount);
|
832
|
jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount);
|
828
|
if (jsonObject == null) {
|
833
|
if (jsonObject == null) {
|
829
|
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
|
834
|
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
|
|
@@ -843,6 +848,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -843,6 +848,7 @@ public class PaymentServiceImpl implements IPaymentService { |
843
|
transfer.setStatus(1);
|
848
|
transfer.setStatus(1);
|
844
|
return true;
|
849
|
return true;
|
845
|
} else if(exceedMillion(jsonObject)) {
|
850
|
} else if(exceedMillion(jsonObject)) {
|
|
|
851
|
+ transfer.setTransferType(2);
|
846
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
|
852
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
|
847
|
String resultStr = JSON.toJSONString(mapResult);
|
853
|
String resultStr = JSON.toJSONString(mapResult);
|
848
|
jsonObject = JSON.parseObject(resultStr);
|
854
|
jsonObject = JSON.parseObject(resultStr);
|
|
@@ -1069,6 +1075,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1069,6 +1075,7 @@ public class PaymentServiceImpl implements IPaymentService { |
1069
|
}
|
1075
|
}
|
1070
|
}
|
1076
|
}
|
1071
|
JSONObject jsonObject = null;
|
1077
|
JSONObject jsonObject = null;
|
|
|
1078
|
+ Integer transferType = null;
|
1072
|
try {
|
1079
|
try {
|
1073
|
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode);
|
1080
|
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode);
|
1074
|
if (transfer == null) {
|
1081
|
if (transfer == null) {
|
|
@@ -1077,16 +1084,14 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1077,16 +1084,14 @@ public class PaymentServiceImpl implements IPaymentService { |
1077
|
if (transfer == null || transfer.getStatus() == 1) {
|
1084
|
if (transfer == null || transfer.getStatus() == 1) {
|
1078
|
throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId);
|
1085
|
throw new ServiceException(400, "转账记录已成功转账,流水id=" + tradeBillsId);
|
1079
|
}
|
1086
|
}
|
|
|
1087
|
+ transferType = transfer.getInterfaceType();
|
|
|
1088
|
+ if (transferType == null || transferType < 1 || transferType > 2) {
|
|
|
1089
|
+ throw new ServiceException(400, "转账记录接口类型有误,流水id=" + tradeBillsId);
|
|
|
1090
|
+ }
|
1080
|
|
1091
|
|
1081
|
- if(exceedMillion()) {
|
|
|
1082
|
- Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), preSuccess, orderCode, account, amount, now);
|
|
|
1083
|
- String resultStr = JSON.toJSONString(mapResult);
|
|
|
1084
|
- jsonObject = JSON.parseObject(resultStr);
|
|
|
1085
|
- if(!StringUtils.equals("T", mapResult.get("is_success"))) {
|
|
|
1086
|
- throw new ServiceException(500, "转账失败:返回={}" + resultStr);
|
|
|
1087
|
- } else {
|
|
|
1088
|
- return;
|
|
|
1089
|
- }
|
1092
|
+ if (transferType == 2) {
|
|
|
1093
|
+ transferWhenExceedMillion(transfer.getId(), preSuccess, orderCode, account, amount, now);
|
|
|
1094
|
+ return;
|
1090
|
}
|
1095
|
}
|
1091
|
|
1096
|
|
1092
|
jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
|
1097
|
jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
|
|
@@ -1116,21 +1121,15 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1116,21 +1121,15 @@ public class PaymentServiceImpl implements IPaymentService { |
1116
|
transferSuccess.setStatus(1);
|
1121
|
transferSuccess.setStatus(1);
|
1117
|
transferSuccess.setUpdateTime(now);
|
1122
|
transferSuccess.setUpdateTime(now);
|
1118
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transferSuccess);
|
1123
|
ordersPayTransferMapper.updateByPrimaryKeySelective(transferSuccess);
|
1119
|
- } else if(exceedMillion(jsonObject)) {
|
|
|
1120
|
- Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), tradeBills, orderCode, account, amount, now);
|
|
|
1121
|
- String resultStr = JSON.toJSONString(mapResult);
|
|
|
1122
|
- jsonObject = JSON.parseObject(resultStr);
|
|
|
1123
|
- if(!StringUtils.equals("T", mapResult.get("is_success"))) {
|
|
|
1124
|
- throw new ServiceException(500, "转账失败:返回={}" + resultStr);
|
|
|
1125
|
- } else {
|
|
|
1126
|
- return;
|
|
|
1127
|
- }
|
|
|
1128
|
} else {
|
1124
|
} else {
|
1129
|
logger.warn("manualDealErr 返回code或者order_id不是成功状态,code={}, orderId={}", code, orderId);
|
1125
|
logger.warn("manualDealErr 返回code或者order_id不是成功状态,code={}, orderId={}", code, orderId);
|
1130
|
// 上报
|
1126
|
// 上报
|
1131
|
throw new ServiceException(500, "转账失败:返回code="+code+",order_id="+orderId);
|
1127
|
throw new ServiceException(500, "转账失败:返回code="+code+",order_id="+orderId);
|
1132
|
}
|
1128
|
}
|
1133
|
} catch (Exception e) {
|
1129
|
} catch (Exception e) {
|
|
|
1130
|
+ if (transferType != null && transferType == 2) {
|
|
|
1131
|
+ return;
|
|
|
1132
|
+ }
|
1134
|
logger.warn("manualDealErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
|
1133
|
logger.warn("manualDealErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
|
1135
|
String alarmMsg = "订单号:" + orderCode + ",操作类型(转账),流水id=" + tradeBillsId + ",msg=" + e.getMessage();
|
1134
|
String alarmMsg = "订单号:" + orderCode + ",操作类型(转账),流水id=" + tradeBillsId + ",msg=" + e.getMessage();
|
1136
|
if (jsonObject != null) {
|
1135
|
if (jsonObject != null) {
|