Showing
3 changed files
with
24 additions
and
12 deletions
@@ -3,6 +3,8 @@ package com.yohoufo.order.service.handler.transfer; | @@ -3,6 +3,8 @@ package com.yohoufo.order.service.handler.transfer; | ||
3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
4 | import com.yoho.core.config.ConfigReader; | 4 | import com.yoho.core.config.ConfigReader; |
5 | import com.yohoufo.dal.order.model.OrdersPayTransfer; | 5 | import com.yohoufo.dal.order.model.OrdersPayTransfer; |
6 | +import com.yohoufo.dal.order.model.TradeBills; | ||
7 | +import com.yohoufo.order.common.TradeType; | ||
6 | import com.yohoufo.order.service.transfer.TransferResult; | 8 | import com.yohoufo.order.service.transfer.TransferResult; |
7 | import lombok.extern.slf4j.Slf4j; | 9 | import lombok.extern.slf4j.Slf4j; |
8 | import org.apache.commons.lang3.StringUtils; | 10 | import org.apache.commons.lang3.StringUtils; |
@@ -23,17 +25,19 @@ public class AlipayTransferChancelSelector { | @@ -23,17 +25,19 @@ public class AlipayTransferChancelSelector { | ||
23 | 25 | ||
24 | /** | 26 | /** |
25 | * 申请寄存返利的单数 | 27 | * 申请寄存返利的单数 |
28 | + * | ||
26 | * @return | 29 | * @return |
27 | */ | 30 | */ |
28 | - public int getDepositRebateOrderCnt(){ | 31 | + public int getDepositRebateOrderCnt() { |
29 | return configReader.getInt("ufo.order.pay.depositRebateCnt", 4); | 32 | return configReader.getInt("ufo.order.pay.depositRebateCnt", 4); |
30 | } | 33 | } |
31 | 34 | ||
32 | /** | 35 | /** |
33 | * 申请寄存返利一单返利数目 | 36 | * 申请寄存返利一单返利数目 |
37 | + * | ||
34 | * @return | 38 | * @return |
35 | */ | 39 | */ |
36 | - public double getDepositRebateAmount(){ | 40 | + public double getDepositRebateAmount() { |
37 | return configReader.getDouble("ufo.order.pay.depositRebatePerAmount", 30); | 41 | return configReader.getDouble("ufo.order.pay.depositRebatePerAmount", 30); |
38 | } | 42 | } |
39 | 43 | ||
@@ -47,7 +51,11 @@ public class AlipayTransferChancelSelector { | @@ -47,7 +51,11 @@ public class AlipayTransferChancelSelector { | ||
47 | return StringUtils.equals(lastTransferDate, nowDate); | 51 | return StringUtils.equals(lastTransferDate, nowDate); |
48 | } | 52 | } |
49 | 53 | ||
50 | - public boolean isTransferWithWallet() { | 54 | + public boolean isTransferWithWallet(TradeBills bills) { |
55 | + TradeType tradeType = TradeType.getTradeTypeByCode(bills.getTradeType()); | ||
56 | + if (tradeType == TradeType.deposit_rebate) { | ||
57 | + return false; | ||
58 | + } | ||
51 | return configReader.getBoolean("ufo.order.pay.transferWithWallet", false); | 59 | return configReader.getBoolean("ufo.order.pay.transferWithWallet", false); |
52 | } | 60 | } |
53 | 61 | ||
@@ -56,7 +64,7 @@ public class AlipayTransferChancelSelector { | @@ -56,7 +64,7 @@ public class AlipayTransferChancelSelector { | ||
56 | } | 64 | } |
57 | 65 | ||
58 | 66 | ||
59 | - public boolean isStopTransferWithAlipay(){ | 67 | + public boolean isStopTransferWithAlipay() { |
60 | boolean isStop = configReader.getBoolean("ufo.order.pay.isStop.transfer", false); | 68 | boolean isStop = configReader.getBoolean("ufo.order.pay.isStop.transfer", false); |
61 | log.info("zk config [ufo.order.pay.isStop.transfer] value {}", isStop); | 69 | log.info("zk config [ufo.order.pay.isStop.transfer] value {}", isStop); |
62 | return isStop; | 70 | return isStop; |
@@ -522,7 +522,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -522,7 +522,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
522 | try { | 522 | try { |
523 | logger.info("{}, transfer alipayAccount={}, transferAmount={}", logTag, alipayAccount, transferAmount); | 523 | logger.info("{}, transfer alipayAccount={}, transferAmount={}", logTag, alipayAccount, transferAmount); |
524 | 524 | ||
525 | - if (alipayTransferChancelSelector.isTransferWithWallet()) { | 525 | + if (alipayTransferChancelSelector.isTransferWithWallet(record)) { |
526 | transfer.setInterfaceType(INTERFACE_TYPE_TRANSFER_WALLET); | 526 | transfer.setInterfaceType(INTERFACE_TYPE_TRANSFER_WALLET); |
527 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); | 527 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); |
528 | transferWithWallet(logTag, record, buyerOrderCode, account, transferAmount, transfer); | 528 | transferWithWallet(logTag, record, buyerOrderCode, account, transferAmount, transfer); |
@@ -609,7 +609,7 @@ public class PaymentServiceImpl implements IPaymentService { | @@ -609,7 +609,7 @@ public class PaymentServiceImpl implements IPaymentService { | ||
609 | boolean exceedMillionAndSuccess = false; | 609 | boolean exceedMillionAndSuccess = false; |
610 | transfer.setUpdateTime(now); | 610 | transfer.setUpdateTime(now); |
611 | try { | 611 | try { |
612 | - if (alipayTransferChancelSelector.isTransferWithWallet()) { | 612 | + if (alipayTransferChancelSelector.isTransferWithWallet(record)) { |
613 | transfer.setInterfaceType(INTERFACE_TYPE_TRANSFER_WALLET); | 613 | transfer.setInterfaceType(INTERFACE_TYPE_TRANSFER_WALLET); |
614 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); | 614 | ordersPayTransferMapper.updateByPrimaryKeySelective(transfer); |
615 | TransferResult transferResult = walletTransferService.transfer(logTag, record); | 615 | TransferResult transferResult = walletTransferService.transfer(logTag, record); |
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject; | @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject; | ||
4 | import com.yoho.core.rest.client.ServiceCaller; | 4 | import com.yoho.core.rest.client.ServiceCaller; |
5 | import com.yoho.error.exception.ServiceException; | 5 | import com.yoho.error.exception.ServiceException; |
6 | import com.yohoufo.dal.order.model.TradeBills; | 6 | import com.yohoufo.dal.order.model.TradeBills; |
7 | +import com.yohoufo.order.common.TradeType; | ||
8 | +import com.yohoufo.order.service.impl.PaymentServiceImpl; | ||
7 | import com.yohoufo.order.service.transfer.TransferResult; | 9 | import com.yohoufo.order.service.transfer.TransferResult; |
8 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
@@ -25,7 +27,7 @@ public class DefaultWalletTransferService implements WalletTransferService { | @@ -25,7 +27,7 @@ public class DefaultWalletTransferService implements WalletTransferService { | ||
25 | tradeBills.getUid(), | 27 | tradeBills.getUid(), |
26 | tradeBills.getOrderCode(), | 28 | tradeBills.getOrderCode(), |
27 | tradeBills.getUserType(), | 29 | tradeBills.getUserType(), |
28 | - tradeBills.getTradeType(), | 30 | + TradeType.getTradeTypeByCode(tradeBills.getTradeType()), |
29 | tradeBills.getAmount()); | 31 | tradeBills.getAmount()); |
30 | } | 32 | } |
31 | 33 | ||
@@ -33,17 +35,19 @@ public class DefaultWalletTransferService implements WalletTransferService { | @@ -33,17 +35,19 @@ public class DefaultWalletTransferService implements WalletTransferService { | ||
33 | Integer uid, | 35 | Integer uid, |
34 | Long orderCode, | 36 | Long orderCode, |
35 | int useType, | 37 | int useType, |
36 | - int tradeType, | 38 | + TradeType tradeType, |
37 | BigDecimal transferAmount) { | 39 | BigDecimal transferAmount) { |
38 | 40 | ||
39 | // 0:未知、1:订单货款、2:买家补偿金、3:卖家补偿金、4:保证金 | 41 | // 0:未知、1:订单货款、2:买家补偿金、3:卖家补偿金、4:保证金 |
40 | Integer trgTradeType; | 42 | Integer trgTradeType; |
41 | - if (tradeType == 1) { | 43 | + if (tradeType == TradeType.guarantee_cash) { |
42 | trgTradeType = 4; | 44 | trgTradeType = 4; |
43 | - } else if (tradeType == 2) { | 45 | + } else if (tradeType == TradeType.goods_income) { |
44 | trgTradeType = 1; | 46 | trgTradeType = 1; |
45 | - } else if (tradeType == 3) { | ||
46 | - trgTradeType = useType == 1 ? 2 : useType == 2 ? 3 : 0; | 47 | + } else if (tradeType == TradeType.compensateIncome) { |
48 | + trgTradeType = useType == PaymentServiceImpl.TargetUserType.buyer.getCode() ? 2 | ||
49 | + : useType == PaymentServiceImpl.TargetUserType.seller.getCode() ? 3 | ||
50 | + : 0; | ||
47 | } else { | 51 | } else { |
48 | trgTradeType = 0; | 52 | trgTradeType = 0; |
49 | } | 53 | } |
-
Please register or login to post a comment