Authored by Lixiaodi

支付超过100万转账修改

... ... @@ -26,6 +26,8 @@ public class OrdersPayTransfer {
private Integer updateTime;
private String alipayTradeResult;
private Integer interfaceType;
public Integer getId() {
return id;
... ... @@ -122,4 +124,13 @@ public class OrdersPayTransfer {
public void setAlipayTradeResult(String alipayTradeResult) {
this.alipayTradeResult = alipayTradeResult == null ? null : alipayTradeResult.trim();
}
public Integer getInterfaceType() {
return interfaceType;
}
public void setInterfaceType(Integer interfaceType) {
this.interfaceType = interfaceType;
}
}
\ No newline at end of file
... ...
... ... @@ -13,13 +13,14 @@
<result column="status" property="status" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
<result column="interface_type" property="interfaceType" jdbcType="INTEGER" />
</resultMap>
<resultMap id="ResultMapWithBLOBs" type="com.yohoufo.dal.order.model.OrdersPayTransfer" extends="BaseResultMap" >
<result column="alipay_trade_result" property="alipayTradeResult" jdbcType="LONGVARCHAR" />
</resultMap>
<sql id="Base_Column_List" >
id, buyer_order_code, seller_order_code, alipay_trade_id, transfer_type, uid, alipay_account,
amount, status, create_time, update_time
amount, status, create_time, update_time,interface_type
</sql>
<sql id="Blob_Column_List" >
alipay_trade_result
... ... @@ -169,6 +170,9 @@
<if test="alipayTradeResult != null" >
alipay_trade_result = #{alipayTradeResult,jdbcType=LONGVARCHAR},
</if>
<if test="interfaceType != null" >
interface_type = #{interfaceType,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
... ...
... ... @@ -689,6 +689,7 @@ public class PaymentServiceImpl implements IPaymentService {
logger.info("transferMon开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", buyerOrderCode, alipayAccount, transferAmount);
if(exceedMillion()) {
transfer.setTransferType(2);
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
String resultStr = JSON.toJSONString(mapResult);
jsonObject = JSON.parseObject(resultStr);
... ... @@ -700,6 +701,7 @@ public class PaymentServiceImpl implements IPaymentService {
}
}
transfer.setTransferType(1);
jsonObject = alipayService.transferMoney(Long.toString(buyerOrderCode), account.getAlipayId(), account.getAlipayAccount(), transferAmount);
if (jsonObject == null) {
logger.warn("transferMonErr 转账失败 , orderCode is {}", buyerOrderCode);
... ... @@ -718,6 +720,7 @@ public class PaymentServiceImpl implements IPaymentService {
transfer.setAlipayTradeId(orderId);
transfer.setStatus(1);
} else if(exceedMillion(jsonObject)) {
transfer.setTransferType(2);
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, buyerOrderCode, account, transferAmount, now);
String resultStr = JSON.toJSONString(mapResult);
jsonObject = JSON.parseObject(resultStr);
... ... @@ -813,6 +816,7 @@ public class PaymentServiceImpl implements IPaymentService {
logger.info("transAllEarnest开始调用阿里接口参数buyerOrderCode={}, alipayAccount={}, transferAmount={}", orderCode, account, amount);
if(exceedMillion()) {
transfer.setTransferType(2);
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
String resultStr = JSON.toJSONString(mapResult);
jsonObject = JSON.parseObject(resultStr);
... ... @@ -824,6 +828,7 @@ public class PaymentServiceImpl implements IPaymentService {
}
}
transfer.setTransferType(1);
jsonObject = alipayService.transferMoney(Long.toString(orderCode), aliPayAccount.getAlipayId(), aliPayAccount.getAlipayAccount(), amount);
if (jsonObject == null) {
logger.warn("transAllEarnestErr 转账失败 , orderCode is {}", orderCode);
... ... @@ -843,6 +848,7 @@ public class PaymentServiceImpl implements IPaymentService {
transfer.setStatus(1);
return true;
} else if(exceedMillion(jsonObject)) {
transfer.setTransferType(2);
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), record, orderCode, aliPayAccount, amount, now);
String resultStr = JSON.toJSONString(mapResult);
jsonObject = JSON.parseObject(resultStr);
... ... @@ -1069,6 +1075,7 @@ public class PaymentServiceImpl implements IPaymentService {
}
}
JSONObject jsonObject = null;
Integer transferType = null;
try {
OrdersPayTransfer transfer = ordersPayTransferMapper.selectByBuyerOrderCode(orderCode);
if (transfer == null) {
... ... @@ -1077,16 +1084,14 @@ 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);
}
if(exceedMillion()) {
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;
}
if (transferType == 2) {
transferWhenExceedMillion(transfer.getId(), preSuccess, orderCode, account, amount, now);
return;
}
jsonObject = alipayService.transferMoney(Long.toString(orderCode), account.getAlipayId(), account.getAlipayAccount(), amount);
... ... @@ -1116,21 +1121,15 @@ public class PaymentServiceImpl implements IPaymentService {
transferSuccess.setStatus(1);
transferSuccess.setUpdateTime(now);
ordersPayTransferMapper.updateByPrimaryKeySelective(transferSuccess);
} else if(exceedMillion(jsonObject)) {
Map<String, String> mapResult = transferWhenExceedMillion(transfer.getId(), tradeBills, 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;
}
} else {
logger.warn("manualDealErr 返回code或者order_id不是成功状态,code={}, orderId={}", code, orderId);
// 上报
throw new ServiceException(500, "转账失败:返回code="+code+",order_id="+orderId);
}
} catch (Exception e) {
if (transferType != null && transferType == 2) {
return;
}
logger.warn("manualDealErr 转账失败 , orderCode is {}, msg is {}", orderCode, e.getMessage());
String alarmMsg = "订单号:" + orderCode + ",操作类型(转账),流水id=" + tradeBillsId + ",msg=" + e.getMessage();
if (jsonObject != null) {
... ...