Authored by LUOXC

todo

... ... @@ -10,11 +10,14 @@ import com.yohobuy.ufo.model.order.common.EntrySellerType;
import com.yohobuy.ufo.model.order.common.OrderCodeType;
import com.yohobuy.ufo.model.order.constants.OrderConstant;
import com.yohobuy.ufo.model.user.resp.AuthorizeResultRespVO;
import com.yohoufo.common.alarm.CommonAlarmEventPublisher;
import com.yohoufo.common.caller.UfoServiceCaller;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.dal.order.EntrySellerRechargeOrderMapper;
import com.yohoufo.dal.order.SellerWalletMapper;
import com.yohoufo.dal.order.StoredSellerMapper;
import com.yohoufo.dal.order.model.EntrySellerRechargeOrder;
import com.yohoufo.dal.order.model.SellerWallet;
import com.yohoufo.dal.order.model.StoredSeller;
import com.yohoufo.order.common.Payment;
import com.yohoufo.order.model.request.ShoppingRequest;
... ... @@ -44,7 +47,7 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
@Value("${deposit.prestore}")
private Double depositPreStore;
@Value("${seller_earnest_money_deposit_limit:100}")
@Value("${deposit.earnestMoneyDepositLimit:100}")
private BigDecimal earnestMoneyDepositLimit;
@Autowired
... ... @@ -82,6 +85,8 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
@Autowired
private SellerEnterApplyService sellerEnterApplyService;
@Autowired
SellerWalletMapper sellerWalletMapper;
/**
* 充值保证金
... ... @@ -104,8 +109,14 @@ public class StoredSellerDepositServiceImpl implements IStoredSellerDepositServi
throw new UfoServiceException(400, "不是入驻商户,无法充值!");
}
// TODO 获取剩余保证金金额
BigDecimal totalEarnestMoney = BigDecimal.ZERO;
// 获取当前保证金金额
SellerWallet sw = sellerWalletMapper.selectByUidAndType(uid, 1);
if (sw == null) {
logger.error("无法充值,钱包不存在,uid={}", uid);
CommonAlarmEventPublisher.publish("无法充值失败", "ufo.sellerOrder.depositRecharge", "钱包不存在uid=" + uid);
throw new UfoServiceException(400, "账户异常,无法充值!");
}
BigDecimal totalEarnestMoney = sw.getAmount();
if (totalEarnestMoney.add(amount).compareTo(earnestMoneyDepositLimit) > 0) {
throw new UfoServiceException(400, "账户余额不能超过" + earnestMoneyDepositLimit);
... ...