Authored by LUOXC

返利不走钱包

... ... @@ -3,6 +3,8 @@ package com.yohoufo.order.service.handler.transfer;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.config.ConfigReader;
import com.yohoufo.dal.order.model.OrdersPayTransfer;
import com.yohoufo.dal.order.model.TradeBills;
import com.yohoufo.order.common.TradeType;
import com.yohoufo.order.service.transfer.TransferResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
... ... @@ -23,17 +25,19 @@ public class AlipayTransferChancelSelector {
/**
* 申请寄存返利的单数
*
* @return
*/
public int getDepositRebateOrderCnt(){
public int getDepositRebateOrderCnt() {
return configReader.getInt("ufo.order.pay.depositRebateCnt", 4);
}
/**
* 申请寄存返利一单返利数目
*
* @return
*/
public double getDepositRebateAmount(){
public double getDepositRebateAmount() {
return configReader.getDouble("ufo.order.pay.depositRebatePerAmount", 30);
}
... ... @@ -47,7 +51,11 @@ public class AlipayTransferChancelSelector {
return StringUtils.equals(lastTransferDate, nowDate);
}
public boolean isTransferWithWallet() {
public boolean isTransferWithWallet(TradeBills bills) {
TradeType tradeType = TradeType.getTradeTypeByCode(bills.getTradeType());
if (tradeType == TradeType.deposit_rebate) {
return false;
}
return configReader.getBoolean("ufo.order.pay.transferWithWallet", false);
}
... ... @@ -56,7 +64,7 @@ public class AlipayTransferChancelSelector {
}
public boolean isStopTransferWithAlipay(){
public boolean isStopTransferWithAlipay() {
boolean isStop = configReader.getBoolean("ufo.order.pay.isStop.transfer", false);
log.info("zk config [ufo.order.pay.isStop.transfer] value {}", isStop);
return isStop;
... ...
... ... @@ -522,7 +522,7 @@ public class PaymentServiceImpl implements IPaymentService {
try {
logger.info("{}, transfer alipayAccount={}, transferAmount={}", logTag, alipayAccount, transferAmount);
if (alipayTransferChancelSelector.isTransferWithWallet()) {
if (alipayTransferChancelSelector.isTransferWithWallet(record)) {
transfer.setInterfaceType(INTERFACE_TYPE_TRANSFER_WALLET);
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
transferWithWallet(logTag, record, buyerOrderCode, account, transferAmount, transfer);
... ... @@ -609,7 +609,7 @@ public class PaymentServiceImpl implements IPaymentService {
boolean exceedMillionAndSuccess = false;
transfer.setUpdateTime(now);
try {
if (alipayTransferChancelSelector.isTransferWithWallet()) {
if (alipayTransferChancelSelector.isTransferWithWallet(record)) {
transfer.setInterfaceType(INTERFACE_TYPE_TRANSFER_WALLET);
ordersPayTransferMapper.updateByPrimaryKeySelective(transfer);
TransferResult transferResult = walletTransferService.transfer(logTag, record);
... ...
... ... @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.error.exception.ServiceException;
import com.yohoufo.dal.order.model.TradeBills;
import com.yohoufo.order.common.TradeType;
import com.yohoufo.order.service.impl.PaymentServiceImpl;
import com.yohoufo.order.service.transfer.TransferResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -25,7 +27,7 @@ public class DefaultWalletTransferService implements WalletTransferService {
tradeBills.getUid(),
tradeBills.getOrderCode(),
tradeBills.getUserType(),
tradeBills.getTradeType(),
TradeType.getTradeTypeByCode(tradeBills.getTradeType()),
tradeBills.getAmount());
}
... ... @@ -33,17 +35,19 @@ public class DefaultWalletTransferService implements WalletTransferService {
Integer uid,
Long orderCode,
int useType,
int tradeType,
TradeType tradeType,
BigDecimal transferAmount) {
// 0:未知、1:订单货款、2:买家补偿金、3:卖家补偿金、4:保证金
Integer trgTradeType;
if (tradeType == 1) {
if (tradeType == TradeType.guarantee_cash) {
trgTradeType = 4;
} else if (tradeType == 2) {
} else if (tradeType == TradeType.goods_income) {
trgTradeType = 1;
} else if (tradeType == 3) {
trgTradeType = useType == 1 ? 2 : useType == 2 ? 3 : 0;
} else if (tradeType == TradeType.compensateIncome) {
trgTradeType = useType == PaymentServiceImpl.TargetUserType.buyer.getCode() ? 2
: useType == PaymentServiceImpl.TargetUserType.seller.getCode() ? 3
: 0;
} else {
trgTradeType = 0;
}
... ...