Authored by qinchao

增加方法

@@ -45,6 +45,8 @@ public interface IPaymentService { @@ -45,6 +45,8 @@ public interface IPaymentService {
45 45
46 void transferMon(TransferMoneyRequest request); 46 void transferMon(TransferMoneyRequest request);
47 47
  48 + void transferMonCheck(TransferMoneyRequest request);
  49 +
48 50
49 void manualDeal(ManualDealRequest req); 51 void manualDeal(ManualDealRequest req);
50 } 52 }
@@ -571,6 +571,64 @@ public class PaymentServiceImpl implements IPaymentService { @@ -571,6 +571,64 @@ public class PaymentServiceImpl implements IPaymentService {
571 logger.info("transferMon最后更新状态完成,转账结束, buyerOrderCode is {}!", buyerOrderCode); 571 logger.info("transferMon最后更新状态完成,转账结束, buyerOrderCode is {}!", buyerOrderCode);
572 } 572 }
573 } 573 }
  574 +
  575 + /**
  576 + * 专门提供给鉴定通过,不通过的校验
  577 + * @param request
  578 + */
  579 + @Database(ForceMaster = true)
  580 + public void transferMonCheck(TransferMoneyRequest request){
  581 + logger.info("transferMonCheck begin ");
  582 + long buyerOrderCode = request.getBuyerOrderCode();
  583 + int transferType = request.getType();
  584 +
  585 + // 订单号check
  586 + if (buyerOrderCode < 1) {
  587 + logger.warn("transferMonErr orderCode empty");
  588 + throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
  589 + }
  590 + // 类型检查
  591 + if (transferType < 1 || transferType > 3) {
  592 + logger.warn("transferMonErr transferType invalid");
  593 + throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
  594 + }
  595 +
  596 + // 买家订单检查
  597 + BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(buyerOrderCode);
  598 + if (buyerOrder == null) {
  599 + logger.warn("transferMonErr getOrderInfo buyer order not exist, orderCode is {}", buyerOrderCode);
  600 + throw new ServiceException(ServiceError.ORDER_NULL);
  601 + }
  602 +
  603 + BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(), buyerOrderCode);
  604 + if (buyerOrderGoods == null) {
  605 + logger.warn("transferMonErr buyerOrderGoods not exist, orderCode is {}", buyerOrderCode);
  606 + throw new ServiceException(ServiceError.ORDER_NULL);
  607 + }
  608 +
  609 + // 卖家订单检查
  610 + SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(buyerOrderGoods.getSkup());
  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 +
  616 + long sellerOrderCode = sellerOrder.getOrderCode();
  617 + Integer targetUid = transferType == 1 ? sellerOrder.getUid() : buyerOrder.getUid();
  618 +
  619 + if (targetUid == null || targetUid < 1) {
  620 + logger.warn("transferMonErr uid {} 不合法", targetUid);
  621 + throw new ServiceException(400, "uid[" + targetUid + "]不合法");
  622 + }
  623 + int now = (int) (System.currentTimeMillis()/1000);
  624 + // 查看是否已经有转账记录
  625 + OrdersPayTransfer exist = ordersPayTransferMapper.selectByBuyerOrderCode(buyerOrderCode);
  626 + if (exist != null) {
  627 + logger.warn("transferMonErr OrdersPayTransfer has exist, orderCode is {}", buyerOrderCode);
  628 + throw new ServiceException(400, "订单已经处理过");
  629 + }
  630 + logger.info("transferMonCheck end ");
  631 + }
574 632
575 @Override 633 @Override
576 @Database(ForceMaster = true) 634 @Database(ForceMaster = true)