...
|
...
|
@@ -350,24 +350,25 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
public void transferSuccess(TransferData transferData) {
|
|
|
int now = (int) (System.currentTimeMillis()/1000);
|
|
|
Integer tradeBillsId = transferData.getTradeBillsId();
|
|
|
Integer transferId = transferData.getTransferId();
|
|
|
String orderCode = transferData.getOrderCode();
|
|
|
|
|
|
TradeBills tradeBills = tradeBillsMapper.selectByPrimaryKey(tradeBillsId);
|
|
|
if (tradeBills == null) {
|
|
|
throw new ServiceException(400, "transferSuccess:流水不存在");
|
|
|
}
|
|
|
if (tradeBills.getTradeStatus() != BillTradeStatus.TRANSFER_WAITING.getCode()) {
|
|
|
throw new ServiceException(400, "transferSuccess:该流水不是异步转账的");
|
|
|
}
|
|
|
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByPrimaryKey(transferId);
|
|
|
if (transfer == null) {
|
|
|
throw new ServiceException(400, "transferSuccess:转账记录不存在");
|
|
|
}
|
|
|
if (transfer.getStatus() == 1) {
|
|
|
throw new ServiceException(400, "transferSuccess:转账记录已经成功");
|
|
|
}
|
|
|
logger.info("transferSuccess 参数 tradeBillsId={}, tradeBillsId={}, orderCode={}", tradeBillsId, tradeBillsId, orderCode);
|
|
|
Integer transferId = transferData.getTransferId();
|
|
|
String orderCode = transferData.getOrderCode();
|
|
|
logger.info("transferSuccess 参数 transferId={}, tradeBillsId={}, orderCode={}", transferId, tradeBillsId, orderCode);
|
|
|
|
|
|
TradeBills tradeBills = tradeBillsMapper.selectByPrimaryKey(tradeBillsId);
|
|
|
logger.info("tradeBills is : {}", tradeBills);
|
|
|
if (tradeBills == null) {
|
|
|
throw new ServiceException(400, "transferSuccess:流水不存在");
|
|
|
}
|
|
|
if (tradeBills.getTradeStatus() != TradeBills.Status.TRANSFER_WAITING.getCode()) {
|
|
|
throw new ServiceException(400, "transferSuccess:该流水不是异步转账的");
|
|
|
}
|
|
|
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByPrimaryKey(transferId);
|
|
|
if (transfer == null) {
|
|
|
throw new ServiceException(400, "transferSuccess:转账记录不存在");
|
|
|
}
|
|
|
if (transfer.getStatus() == 1) {
|
|
|
throw new ServiceException(400, "transferSuccess:转账记录已经成功");
|
|
|
}
|
|
|
if(StringUtils.equals("S", transferData.getStatus())) {
|
|
|
// 更新成OK
|
|
|
TradeBills success = new TradeBills();
|
...
|
...
|
@@ -1114,8 +1115,14 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
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;
|
|
|
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), preSuccess, orderCode, account, amount, now);
|
|
|
String resultStr = JSON.toJSONString(mapResult);
|
|
|
jsonObject = JSON.parseObject(resultStr);
|
|
|
if(!StringUtils.equals("T", mapResult.get("is_success"))) {
|
|
|
throw new ServiceException(500, "转账失败:返回={}" + resultStr);
|
|
|
} else {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
logger.info("manualDeal orderCode={}, tradeBillId={}, 转账接口类型为 小于100万的接口", orderCode, tradeBillsId);
|
...
|
...
|
@@ -1152,9 +1159,9 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
throw new ServiceException(500, "转账失败:返回code="+code+",order_id="+orderId);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
if (interfaceType != null && interfaceType == 2) {
|
|
|
/*if (interfaceType != null && interfaceType == 2) {
|
|
|
return;
|
|
|
}
|
|
|
}*/
|
|
|
logger.warn("manualDealErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
|
|
|
String alarmMsg = "订单号:" + orderCode + ",操作类型(转账),流水id=" + tradeBillsId + ",msg=" + e.getMessage();
|
|
|
if (jsonObject != null) {
|
...
|
...
|
@@ -1180,14 +1187,15 @@ public class PaymentServiceImpl implements IPaymentService { |
|
|
Map<String, String> mapResult = alipayService.transferMoneyWhenExceedMillion(Long.toString(orderCode),
|
|
|
transferId + "_" + tradeBills.getId(), account.getAlipayId(), account.getAlipayAccount(),
|
|
|
account.getCertName(), amount);
|
|
|
logger.info("transferWhenExceedMillion 转账阿里接口(总金额超过100万)返回 {}", mapResult);
|
|
|
// success to wait
|
|
|
logger.info("transferWhenExceedMillion 转账阿里接口(总金额超过100万)返回 {}, orderCode is {}, transferId is {}, tradeBillsId is {}, alibillId is {}", mapResult, orderCode, transferId, tradeBills.getId(), transferId + "_" + tradeBills.getId());
|
|
|
// success to wait
|
|
|
if (StringUtils.equals("T", mapResult.get("is_success"))) {
|
|
|
tradeBills.setDealStatus(0);
|
|
|
tradeBills.setTradeStatus(BillTradeStatus.TRANSFER_WAITING.getCode());
|
|
|
// wait
|
|
|
tradeBillsMapper.updateSelectiveByPrimaryKey(tradeBills);
|
|
|
}
|
|
|
tradeBillsMapper.updateSelectiveByPrimaryKeyNoCondition(tradeBills);
|
|
|
logger.info("transferWhenExceedMillion 转账阿里接口(总金额超过100万)更新之后的tradeBill: {}", tradeBillsMapper.selectByPrimaryKey(tradeBills.getId()));
|
|
|
}
|
|
|
return mapResult;
|
|
|
}
|
|
|
|
...
|
...
|
|