Authored by qinchao

增加方法

... ... @@ -45,6 +45,8 @@ public interface IPaymentService {
void transferMon(TransferMoneyRequest request);
void transferMonCheck(TransferMoneyRequest request);
void manualDeal(ManualDealRequest req);
}
... ...
... ... @@ -572,6 +572,64 @@ public class PaymentServiceImpl implements IPaymentService {
}
}
/**
* 专门提供给鉴定通过,不通过的校验
* @param request
*/
@Database(ForceMaster = true)
public void transferMonCheck(TransferMoneyRequest request){
logger.info("transferMonCheck begin ");
long buyerOrderCode = request.getBuyerOrderCode();
int transferType = request.getType();
// 订单号check
if (buyerOrderCode < 1) {
logger.warn("transferMonErr orderCode empty");
throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
}
// 类型检查
if (transferType < 1 || transferType > 3) {
logger.warn("transferMonErr transferType invalid");
throw new ServiceException(ServiceError.ORDER_REQUEST_PARM_IS_EMPTY);
}
// 买家订单检查
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(buyerOrderCode);
if (buyerOrder == null) {
logger.warn("transferMonErr getOrderInfo buyer order not exist, orderCode is {}", buyerOrderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
BuyerOrderGoods buyerOrderGoods = buyerOrderGoodsMapper.selectByOrderCode(buyerOrder.getUid(), buyerOrderCode);
if (buyerOrderGoods == null) {
logger.warn("transferMonErr buyerOrderGoods not exist, orderCode is {}", buyerOrderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
}
// 卖家订单检查
SellerOrder sellerOrder = sellerOrderMapper.selectBySkup(buyerOrderGoods.getSkup());
if (sellerOrder == null){
logger.warn("transferMonErr getOrderInfo seller order not exist, skup is {}", buyerOrderGoods.getSkup());
throw new ServiceException(ServiceError.ORDER_NULL);
}
long sellerOrderCode = sellerOrder.getOrderCode();
Integer targetUid = transferType == 1 ? sellerOrder.getUid() : buyerOrder.getUid();
if (targetUid == null || targetUid < 1) {
logger.warn("transferMonErr uid {} 不合法", targetUid);
throw new ServiceException(400, "uid[" + targetUid + "]不合法");
}
int now = (int) (System.currentTimeMillis()/1000);
// 查看是否已经有转账记录
OrdersPayTransfer exist = ordersPayTransferMapper.selectByBuyerOrderCode(buyerOrderCode);
if (exist != null) {
logger.warn("transferMonErr OrdersPayTransfer has exist, orderCode is {}", buyerOrderCode);
throw new ServiceException(400, "订单已经处理过");
}
logger.info("transferMonCheck end ");
}
@Override
@Database(ForceMaster = true)
public void manualDeal(ManualDealRequest req) {
... ...