From 3ce9e928e082ff8abf697dba560cbfbb412e89f8 Mon Sep 17 00:00:00 2001 From: yujian <yujian@123.com> Date: 星期一, 11 十一月 2019 15:45:02 +0800 Subject: [PATCH] 商城后台编辑 --- fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java index 52c4747..d27acd5 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/redpack/RedPackExchangeServiceImpl.java @@ -7,7 +7,6 @@ import javax.annotation.Resource; -import org.omg.CORBA.LongHolder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -19,6 +18,7 @@ import com.yeshi.fanli.entity.common.AdminUser; import com.yeshi.fanli.entity.money.UserMoneyDetail; import com.yeshi.fanli.entity.money.UserMoneyDetail.UserMoneyDetailTypeEnum; +import com.yeshi.fanli.entity.redpack.RedPackBalance; import com.yeshi.fanli.entity.redpack.RedPackDetail; import com.yeshi.fanli.entity.redpack.RedPackDetail.RedPackDetailTypeEnum; import com.yeshi.fanli.entity.redpack.RedPackExchange; @@ -89,12 +89,19 @@ throw new RedPackExchangeException(1, "鍙傛暟涓嶆纭�"); String extractBanlenMin = redPackConfigService.getValueByKey("extract_banlen_min"); - - BigDecimal balance = redPackBalanceService.getBalance(uid); - if (balance == null || balance.compareTo(new BigDecimal(extractBanlenMin)) < 0) + + RedPackBalance balance = redPackBalanceService.selectByPrimaryKey(uid); + if (balance == null) throw new RedPackExchangeException(1, "浣欓涓嶈冻" + extractBanlenMin + "鍏�"); - if (balance.compareTo(amount) < 0) + if (balance.getState() != null && balance.getState() == RedPackBalance.STATE_LOCKED) + throw new RedPackExchangeException(1, "绾㈠寘宸插皝绂侊紝鎰熻阿浣跨敤"); + + BigDecimal balanceMoney = balance.getMoney(); + if (balanceMoney == null || balanceMoney.compareTo(new BigDecimal(extractBanlenMin)) < 0) + throw new RedPackExchangeException(1, "浣欓涓嶈冻" + extractBanlenMin + "鍏�"); + + if (balanceMoney.compareTo(amount) < 0) throw new RedPackExchangeException(1, "鎻愮幇浣欓涓嶈冻"); -- Gitblit v1.8.0