|
@@ -28,10 +28,11 @@ import com.yohoufo.order.model.PayRefundBo; |
|
@@ -28,10 +28,11 @@ import com.yohoufo.order.model.PayRefundBo; |
28
|
import com.yohoufo.order.model.PaymentData;
|
28
|
import com.yohoufo.order.model.PaymentData;
|
29
|
import com.yohoufo.order.model.TransferData;
|
29
|
import com.yohoufo.order.model.TransferData;
|
30
|
import com.yohoufo.order.model.request.PaymentRequest;
|
30
|
import com.yohoufo.order.model.request.PaymentRequest;
|
31
|
-import com.yohoufo.order.model.request.TranseferCellNode;
|
|
|
32
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
31
|
import com.yohoufo.order.model.request.TransferMoneyRequest;
|
33
|
import com.yohoufo.order.model.response.PaymentConfirmRsp;
|
32
|
import com.yohoufo.order.model.response.PaymentConfirmRsp;
|
34
|
import com.yohoufo.order.model.response.PrepayResponse;
|
33
|
import com.yohoufo.order.model.response.PrepayResponse;
|
|
|
34
|
+import com.yohoufo.order.mq.TopicConstants;
|
|
|
35
|
+import com.yohoufo.order.mq.producer.TradeMqSender;
|
35
|
import com.yohoufo.order.service.AbstractOrderPaymentService;
|
36
|
import com.yohoufo.order.service.AbstractOrderPaymentService;
|
36
|
import com.yohoufo.order.service.BuyerOrderPaymentService;
|
37
|
import com.yohoufo.order.service.BuyerOrderPaymentService;
|
37
|
import com.yohoufo.order.service.IPaymentService;
|
38
|
import com.yohoufo.order.service.IPaymentService;
|
|
@@ -49,7 +50,6 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; |
|
@@ -49,7 +50,6 @@ import com.yohoufo.order.service.support.codegenerator.bean.CodeMeta; |
49
|
import com.yohoufo.order.service.transfer.TransferResult;
|
50
|
import com.yohoufo.order.service.transfer.TransferResult;
|
50
|
import com.yohoufo.order.utils.LoggerUtils;
|
51
|
import com.yohoufo.order.utils.LoggerUtils;
|
51
|
import com.yohoufo.order.utils.PaymentHelper;
|
52
|
import com.yohoufo.order.utils.PaymentHelper;
|
52
|
-import lombok.val;
|
|
|
53
|
import org.apache.commons.collections.CollectionUtils;
|
53
|
import org.apache.commons.collections.CollectionUtils;
|
54
|
import org.apache.commons.lang3.StringUtils;
|
54
|
import org.apache.commons.lang3.StringUtils;
|
55
|
import org.slf4j.Logger;
|
55
|
import org.slf4j.Logger;
|
|
@@ -57,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
@@ -57,6 +57,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
57
|
import org.springframework.stereotype.Service;
|
57
|
import org.springframework.stereotype.Service;
|
58
|
|
58
|
|
59
|
import java.math.BigDecimal;
|
59
|
import java.math.BigDecimal;
|
|
|
60
|
+import java.util.Collections;
|
60
|
import java.util.Map;
|
61
|
import java.util.Map;
|
61
|
import java.util.Objects;
|
62
|
import java.util.Objects;
|
62
|
import java.util.Optional;
|
63
|
import java.util.Optional;
|
|
@@ -151,6 +152,9 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -151,6 +152,9 @@ public class PaymentServiceImpl implements IPaymentService { |
151
|
@Autowired
|
152
|
@Autowired
|
152
|
private TradeBillsService tradeBillsService;
|
153
|
private TradeBillsService tradeBillsService;
|
153
|
|
154
|
|
|
|
155
|
+ @Autowired
|
|
|
156
|
+ private TradeMqSender tradeMqSender;
|
|
|
157
|
+
|
154
|
/**
|
158
|
/**
|
155
|
* 获取主场的订单service
|
159
|
* 获取主场的订单service
|
156
|
* @param codeMeta
|
160
|
* @param codeMeta
|
|
@@ -576,87 +580,38 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -576,87 +580,38 @@ public class PaymentServiceImpl implements IPaymentService { |
576
|
*/
|
580
|
*/
|
577
|
@Database(ForceMaster = true)
|
581
|
@Database(ForceMaster = true)
|
578
|
public void transferMon(TransferMoneyRequest request){
|
582
|
public void transferMon(TransferMoneyRequest request){
|
579
|
- logger.info("transferMon转账开始,request = {}", request);
|
|
|
580
|
- long buyerOrderCode = request.getBuyerOrderCode();
|
|
|
581
|
- String logTag = String.format("transfer money orderCode is %s",buyerOrderCode);
|
|
|
582
|
- logger.info("transferMon参数检查");
|
|
|
583
|
- // 订单号check
|
|
|
584
|
- if (buyerOrderCode < 1L) {
|
|
|
585
|
- logger.warn("transferMonErr orderCode empty");
|
|
|
586
|
- throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
|
|
|
587
|
- }
|
|
|
588
|
- // 类型检查
|
|
|
589
|
- TransferCase transferCase = TransferCase.getTransferCase(request.getType());
|
|
|
590
|
- if (transferCase == null) {
|
|
|
591
|
- logger.warn("transferMonErr transferType invalid");
|
|
|
592
|
- throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
|
|
|
593
|
- }
|
583
|
+ TransferMoneyModel transferMoneyModel = new TransferMoneyModel(request).invoke();
|
|
|
584
|
+ String logTag = transferMoneyModel.getLogTag();
|
|
|
585
|
+ long buyerOrderCode = transferMoneyModel.getBuyerOrderCode();
|
|
|
586
|
+ TransferCase transferCase = transferMoneyModel.getTransferCase();
|
|
|
587
|
+ SellerOrder sellerOrder = transferMoneyModel.getSellerOrder();
|
|
|
588
|
+ long sellerOrderCode = transferMoneyModel.getSellerOrderCode();
|
|
|
589
|
+ Integer targetUid = transferMoneyModel.getTargetUid();
|
|
|
590
|
+ int now = transferMoneyModel.getNow();
|
594
|
|
591
|
|
595
|
- // 买家订单检查
|
|
|
596
|
- BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(buyerOrderCode);
|
|
|
597
|
- if (buyerOrder == null) {
|
|
|
598
|
- logger.warn("transferMonErr getOrderInfo buyer order not exist, orderCode is {}", buyerOrderCode);
|
|
|
599
|
- throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
600
|
- }
|
|
|
601
|
-
|
|
|
602
|
- BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(), buyerOrderCode);
|
|
|
603
|
- if (buyerOrderGoods == null) {
|
|
|
604
|
- logger.warn("transferMonErr buyerOrderGoods not exist, orderCode is {}", buyerOrderCode);
|
|
|
605
|
- throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
606
|
- }
|
|
|
607
|
-
|
|
|
608
|
- // 卖家订单检查
|
|
|
609
|
- Integer skup = buyerOrderGoods.getSkup();
|
|
|
610
|
- SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(skup);
|
|
|
611
|
- if (sellerOrder == null){
|
|
|
612
|
- logger.warn("transferMonErr getOrderInfo seller order not exist, skup is {}", buyerOrderGoods.getSkup());
|
|
|
613
|
- throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
614
|
- }
|
|
|
615
|
- Integer sellerUid = sellerOrder.getUid();
|
|
|
616
|
- long sellerOrderCode = sellerOrder.getOrderCode();
|
|
|
617
|
penaltyEarnestIfWalletSellerOrder(request.getPenaltyEarnestFunction(), request.getSwdType(), sellerOrder);
|
592
|
penaltyEarnestIfWalletSellerOrder(request.getPenaltyEarnestFunction(), request.getSwdType(), sellerOrder);
|
618
|
- val targetUserType = transferCase == EARNEST_MONEY_TO_BUYER ? TargetUserType.buyer : TargetUserType.seller;
|
|
|
619
|
- val targetUid = targetUserType == TargetUserType.buyer ? buyerOrder.getUid() : sellerUid;
|
|
|
620
|
|
593
|
|
621
|
- if (targetUid == null || targetUid < 1) {
|
|
|
622
|
- logger.warn("transferMonErr uid {} 不合法", targetUid);
|
|
|
623
|
- throw new ServiceException(400, "uid[" + targetUid + "]不合法");
|
|
|
624
|
- }
|
|
|
625
|
- int now = (int) (System.currentTimeMillis()/1000);
|
|
|
626
|
- // 查看是否已经有转账记录
|
|
|
627
|
- checkTransferExist(buyerOrderCode);
|
|
|
628
|
OrdersPayTransfer transfer = createTransfer(buyerOrderCode, sellerOrderCode, transferCase.getCode(), null, targetUid, BigDecimal.ZERO, now);
|
594
|
OrdersPayTransfer transfer = createTransfer(buyerOrderCode, sellerOrderCode, transferCase.getCode(), null, targetUid, BigDecimal.ZERO, now);
|
629
|
|
595
|
|
630
|
// 增加流水记录
|
596
|
// 增加流水记录
|
631
|
- TradeBills record = new TradeBills();
|
|
|
632
|
- record.setUid(targetUid);
|
|
|
633
|
- record.setOrderCode(buyerOrderCode);
|
|
|
634
|
- record.setUserType(targetUserType.getCode());
|
|
|
635
|
- record.setPayType(1);
|
|
|
636
|
- // 如果[全部货款->卖家],否则[补偿款->卖家或买家] 2:货款;3:补偿款
|
|
|
637
|
- record.setTradeType(transferCase == TransferCase.ALL_GOODS_MONEY_TO_SELLER ? 2 : 3);
|
|
|
638
|
- record.setIncomeOutcome(1);
|
|
|
639
|
- record.setTradeStatus(0);
|
|
|
640
|
- record.setCreateTime(now);
|
597
|
+ TradeBills record = transferMoneyModel.newTradeBills();
|
|
|
598
|
+
|
|
|
599
|
+ // 转账费
|
|
|
600
|
+ BigDecimal transferAmount = request.getTranseferCellNode().getAmount();
|
641
|
|
601
|
|
642
|
- logger.info("transferMon参数检查成功!插入初始化转账信息成功,接下来计算费用");
|
|
|
643
|
- TranseferCellNode transeferCellNode = request.getTranseferCellNode();
|
|
|
644
|
- // 算费
|
|
|
645
|
- BigDecimal transferAmount = transeferCellNode.getAmount();
|
|
|
646
|
- logger.info("transferMon计算费用结果为 {}", transferAmount);
|
|
|
647
|
if (transferAmount == null) {
|
602
|
if (transferAmount == null) {
|
648
|
- logger.warn("transferMonErr transferMon计算费用结果为 null, 不合法的金额");
|
|
|
649
|
- alarm("转账金额不合法", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为null");
|
603
|
+ logger.warn("{}, transfer amount is null", logTag);
|
|
|
604
|
+ alarm("转账金额不合法", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为空");
|
650
|
record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode());
|
605
|
record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode());
|
651
|
addTradeBills(record);
|
606
|
addTradeBills(record);
|
652
|
throw new ServiceException(400, "计算金额错误!:");
|
607
|
throw new ServiceException(400, "计算金额错误!:");
|
653
|
}
|
608
|
}
|
654
|
- transfer.setAmount(transferAmount);
|
609
|
+ logger.info("{}, transfer amount is {}", logTag, transferAmount);
|
655
|
record.setAmount(transferAmount);
|
610
|
record.setAmount(transferAmount);
|
656
|
- // 因为转账支付宝扣费累计计算,使用转账额
|
611
|
+ // ???因为转账支付宝扣费累计计算,使用转账额
|
657
|
record.setSystemAmount(transferAmount.multiply(new BigDecimal("-1")));
|
612
|
record.setSystemAmount(transferAmount.multiply(new BigDecimal("-1")));
|
658
|
if (transferAmount.compareTo(new BigDecimal("0.1")) < 0) {
|
613
|
if (transferAmount.compareTo(new BigDecimal("0.1")) < 0) {
|
659
|
- logger.warn("transferMonErr transferMon计算费用结果为 {}, 小于0.1", transferAmount);
|
614
|
+ logger.info("{}, transfer amount is {}, it less than 0.1", logTag, transferAmount);
|
660
|
alarm("转账金额小于0.1", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为" + transferAmount);
|
615
|
alarm("转账金额小于0.1", "ufo.order.transferMon", "订单号:" + buyerOrderCode + "操作类型(" + transferCase.getCode() + ")计算金额结果为" + transferAmount);
|
661
|
record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode());
|
616
|
record.setTradeStatus(BillTradeStatus.AMOUNT_IS_ILLEGAL.getCode());
|
662
|
addTradeBills(record);
|
617
|
addTradeBills(record);
|
|
@@ -665,29 +620,25 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -665,29 +620,25 @@ public class PaymentServiceImpl implements IPaymentService { |
665
|
|
620
|
|
666
|
AuthorizeResultRespVO account = getOneValidAlipayAccountOr(targetUid, invalidAccount -> {
|
621
|
AuthorizeResultRespVO account = getOneValidAlipayAccountOr(targetUid, invalidAccount -> {
|
667
|
if ("invalid".equals(invalidAccount)) {
|
622
|
if ("invalid".equals(invalidAccount)) {
|
668
|
- record.setTradeStatus(BillTradeStatus.YH_STORE_AMOUNT_WAIT_PAYMENT.getCode());
|
623
|
+ record.setTradeStatus(BillTradeStatus.YOHO_STORE_AMOUNT_WAIT_PAYMENT.getCode());
|
669
|
} else if ("invalid_hk".equals(invalidAccount)) {
|
624
|
} else if ("invalid_hk".equals(invalidAccount)) {
|
670
|
record.setTradeStatus(BillTradeStatus.HK_AMOUNT_WAIT_PAYMENT.getCode());
|
625
|
record.setTradeStatus(BillTradeStatus.HK_AMOUNT_WAIT_PAYMENT.getCode());
|
|
|
626
|
+ tradeMqSender.send(TopicConstants.HK_AMOUNT_WAIT_PAYMENT, Collections.singletonMap("uid", record.getUid()));
|
671
|
} else {
|
627
|
} else {
|
672
|
- record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode());
|
628
|
+ record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALIPAY_ACCOUNT.getCode());
|
673
|
}
|
629
|
}
|
674
|
addTradeBills(record);
|
630
|
addTradeBills(record);
|
675
|
- });
|
|
|
676
|
-
|
|
|
677
|
- if(account == null){
|
|
|
678
|
throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号");
|
631
|
throw new ServiceException(400, "uid[" + targetUid + "]没有获取到有效的支付宝账号");
|
679
|
- }
|
632
|
+ });
|
680
|
|
633
|
|
681
|
- if(StringUtils.isNotBlank(account.getAlipayId())) {
|
|
|
682
|
- transfer.setAlipayAccount(account.getAlipayId());
|
|
|
683
|
- } else if(StringUtils.isNotBlank(account.getAlipayAccount())) {
|
|
|
684
|
- transfer.setAlipayAccount(account.getAlipayAccount());
|
|
|
685
|
- }
|
634
|
+ tradeBillsMapper.insert(record);
|
686
|
|
635
|
|
|
|
636
|
+ String alipayAccount = StringUtils.isNotBlank(account.getAlipayId()) ? account.getAlipayId() : account.getAlipayAccount();
|
|
|
637
|
+ transfer.setAlipayAccount(alipayAccount);
|
687
|
transfer.setUpdateTime(now);
|
638
|
transfer.setUpdateTime(now);
|
688
|
- tradeBillsMapper.insert(record);
|
639
|
+ transfer.setAmount(transferAmount);
|
|
|
640
|
+
|
689
|
|
641
|
|
690
|
- String alipayAccount = transfer.getAlipayAccount();
|
|
|
691
|
// 转账
|
642
|
// 转账
|
692
|
try {
|
643
|
try {
|
693
|
logger.info("{}, transfer alipayAccount={}, transferAmount={}", logTag, alipayAccount, transferAmount);
|
644
|
logger.info("{}, transfer alipayAccount={}, transferAmount={}", logTag, alipayAccount, transferAmount);
|
|
@@ -758,7 +709,7 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -758,7 +709,7 @@ public class PaymentServiceImpl implements IPaymentService { |
758
|
|
709
|
|
759
|
if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId()) ) {
|
710
|
if (StringUtils.isBlank(aliPayAccount.getAlipayAccount()) && StringUtils.isBlank(aliPayAccount.getAlipayId()) ) {
|
760
|
logger.warn("transAllEarnestErr uid {} 支付宝账号不合法", account);
|
711
|
logger.warn("transAllEarnestErr uid {} 支付宝账号不合法", account);
|
761
|
- record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALI_ACCOUNT.getCode());
|
712
|
+ record.setTradeStatus(BillTradeStatus.NOT_EXIST_ALIPAY_ACCOUNT.getCode());
|
762
|
addTradeBills(record);
|
713
|
addTradeBills(record);
|
763
|
throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法");
|
714
|
throw new ServiceException(400, "uid[" + uid + "]支付宝账号不合法");
|
764
|
}
|
715
|
}
|
|
@@ -1455,5 +1406,120 @@ public class PaymentServiceImpl implements IPaymentService { |
|
@@ -1455,5 +1406,120 @@ public class PaymentServiceImpl implements IPaymentService { |
1455
|
}
|
1406
|
}
|
1456
|
|
1407
|
|
1457
|
|
1408
|
|
|
|
1409
|
+ private class TransferMoneyModel {
|
|
|
1410
|
+ private TransferMoneyRequest request;
|
|
|
1411
|
+ private long buyerOrderCode;
|
|
|
1412
|
+ private String logTag;
|
|
|
1413
|
+ private TransferCase transferCase;
|
|
|
1414
|
+ private SellerOrder sellerOrder;
|
|
|
1415
|
+ private long sellerOrderCode;
|
|
|
1416
|
+ private TargetUserType targetUserType;
|
|
|
1417
|
+ private Integer targetUid;
|
|
|
1418
|
+ private int now;
|
|
|
1419
|
+
|
|
|
1420
|
+ public TransferMoneyModel(TransferMoneyRequest request) {
|
|
|
1421
|
+ this.request = request;
|
|
|
1422
|
+ }
|
|
|
1423
|
+
|
|
|
1424
|
+ public long getBuyerOrderCode() {
|
|
|
1425
|
+ return buyerOrderCode;
|
|
|
1426
|
+ }
|
1458
|
|
1427
|
|
|
|
1428
|
+ public String getLogTag() {
|
|
|
1429
|
+ return logTag;
|
|
|
1430
|
+ }
|
|
|
1431
|
+
|
|
|
1432
|
+ public TransferCase getTransferCase() {
|
|
|
1433
|
+ return transferCase;
|
|
|
1434
|
+ }
|
|
|
1435
|
+
|
|
|
1436
|
+ public SellerOrder getSellerOrder() {
|
|
|
1437
|
+ return sellerOrder;
|
|
|
1438
|
+ }
|
|
|
1439
|
+
|
|
|
1440
|
+ public long getSellerOrderCode() {
|
|
|
1441
|
+ return sellerOrderCode;
|
|
|
1442
|
+ }
|
|
|
1443
|
+
|
|
|
1444
|
+ public TargetUserType getTargetUserType() {
|
|
|
1445
|
+ return targetUserType;
|
|
|
1446
|
+ }
|
|
|
1447
|
+
|
|
|
1448
|
+ public Integer getTargetUid() {
|
|
|
1449
|
+ return targetUid;
|
|
|
1450
|
+ }
|
|
|
1451
|
+
|
|
|
1452
|
+ public int getNow() {
|
|
|
1453
|
+ return now;
|
|
|
1454
|
+ }
|
|
|
1455
|
+
|
|
|
1456
|
+ public TransferMoneyModel invoke() {
|
|
|
1457
|
+ logger.info("transferMon转账开始,request = {}", request);
|
|
|
1458
|
+ buyerOrderCode = request.getBuyerOrderCode();
|
|
|
1459
|
+ logTag = String.format("transfer money orderCode is %s", buyerOrderCode);
|
|
|
1460
|
+ logger.info("transferMon参数检查");
|
|
|
1461
|
+ // 订单号check
|
|
|
1462
|
+ if (buyerOrderCode < 1L) {
|
|
|
1463
|
+ logger.warn("transferMonErr orderCode empty");
|
|
|
1464
|
+ throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
|
|
|
1465
|
+ }
|
|
|
1466
|
+ // 类型检查
|
|
|
1467
|
+ transferCase = TransferCase.getTransferCase(request.getType());
|
|
|
1468
|
+ if (transferCase == null) {
|
|
|
1469
|
+ logger.warn("transferMonErr transferType invalid");
|
|
|
1470
|
+ throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
|
|
|
1471
|
+ }
|
|
|
1472
|
+
|
|
|
1473
|
+ // 买家订单检查
|
|
|
1474
|
+ BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(buyerOrderCode);
|
|
|
1475
|
+ if (buyerOrder == null) {
|
|
|
1476
|
+ logger.warn("transferMonErr getOrderInfo buyer order not exist, orderCode is {}", buyerOrderCode);
|
|
|
1477
|
+ throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
1478
|
+ }
|
|
|
1479
|
+
|
|
|
1480
|
+ BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(), buyerOrderCode);
|
|
|
1481
|
+ if (buyerOrderGoods == null) {
|
|
|
1482
|
+ logger.warn("transferMonErr buyerOrderGoods not exist, orderCode is {}", buyerOrderCode);
|
|
|
1483
|
+ throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
1484
|
+ }
|
|
|
1485
|
+
|
|
|
1486
|
+ // 卖家订单检查
|
|
|
1487
|
+ Integer skup = buyerOrderGoods.getSkup();
|
|
|
1488
|
+ sellerOrder = sellerOrderMapper.selectBySkup(skup);
|
|
|
1489
|
+ if (sellerOrder == null){
|
|
|
1490
|
+ logger.warn("transferMonErr getOrderInfo seller order not exist, skup is {}", buyerOrderGoods.getSkup());
|
|
|
1491
|
+ throw new ServiceException(ServiceError.ORDER_NULL);
|
|
|
1492
|
+ }
|
|
|
1493
|
+ Integer sellerUid = sellerOrder.getUid();
|
|
|
1494
|
+ sellerOrderCode = sellerOrder.getOrderCode();
|
|
|
1495
|
+
|
|
|
1496
|
+ targetUserType = transferCase == EARNEST_MONEY_TO_BUYER ? TargetUserType.buyer : TargetUserType.seller;
|
|
|
1497
|
+ targetUid = targetUserType == TargetUserType.buyer ? buyerOrder.getUid() : sellerUid;
|
|
|
1498
|
+
|
|
|
1499
|
+ if (targetUid == null || targetUid < 1) {
|
|
|
1500
|
+ logger.warn("transferMonErr uid {} 不合法", targetUid);
|
|
|
1501
|
+ throw new ServiceException(400, "uid[" + targetUid + "]不合法");
|
|
|
1502
|
+ }
|
|
|
1503
|
+ now = (int) (System.currentTimeMillis() / 1000);
|
|
|
1504
|
+ // 查看是否已经有转账记录
|
|
|
1505
|
+ checkTransferExist(buyerOrderCode);
|
|
|
1506
|
+ return this;
|
|
|
1507
|
+ }
|
|
|
1508
|
+
|
|
|
1509
|
+
|
|
|
1510
|
+ public TradeBills newTradeBills(){
|
|
|
1511
|
+ // 增加流水记录
|
|
|
1512
|
+ TradeBills record = new TradeBills();
|
|
|
1513
|
+ record.setUid(targetUid);
|
|
|
1514
|
+ record.setOrderCode(buyerOrderCode);
|
|
|
1515
|
+ record.setUserType(targetUserType.getCode());
|
|
|
1516
|
+ record.setPayType(1);
|
|
|
1517
|
+ // 如果[全部货款->卖家],否则[补偿款->卖家或买家] 2:货款;3:补偿款
|
|
|
1518
|
+ record.setTradeType(transferCase == TransferCase.ALL_GOODS_MONEY_TO_SELLER ? 2 : 3);
|
|
|
1519
|
+ record.setIncomeOutcome(1);
|
|
|
1520
|
+ record.setTradeStatus(BillTradeStatus.NEW.getCode());
|
|
|
1521
|
+ record.setCreateTime(now);
|
|
|
1522
|
+ return record;
|
|
|
1523
|
+ }
|
|
|
1524
|
+ }
|
1459
|
} |
1525
|
} |