Browse Source

10-24 收款产品数量与金币数量校验

milestone-20251016-现金管理
lijianlin 1 month ago
parent
commit
e6a0c4d283
  1. 18
      src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java

18
src/main/java/com/example/demo/serviceImpl/cash/CashCollectionServiceImpl.java

@ -57,8 +57,13 @@ public class CashCollectionServiceImpl implements CashCollectionService {
if(cashCollection.getGoodsName()== null){
throw new IllegalArgumentException("商品名不能为空");
}
if(cashCollection.getGoodNum()== null && cashCollection.getPermanentGold()== null && cashCollection.getFreeGold()== null){
throw new IllegalArgumentException("商品数量或金币数量不能为空");
if (cashCollection.getGoodsName().equals("金币充值")){
if( cashCollection.getPermanentGold()== 0 && cashCollection.getFreeGold()== 0){
throw new IllegalArgumentException("金币数量不能为空");}
}
if (!cashCollection.getGoodsName().equals("金币充值")){
if( cashCollection.getGoodNum()== 0 ){
throw new IllegalArgumentException("产品数量不能为空");}
}
if(cashCollection.getPaymentCurrency()== null){
throw new IllegalArgumentException("支付币种不能为空");
@ -145,8 +150,13 @@ public class CashCollectionServiceImpl implements CashCollectionService {
if(cashRecord.getGoodsName()== null){
throw new IllegalArgumentException("商品名不能为空");
}
if(cashRecord.getGoodNum()== null){
throw new IllegalArgumentException("商品数量不能为空");
if (cashRecord.getGoodsName().equals("金币充值")){
if( cashRecord.getPermanentGold()== 0 && cashRecord.getFreeGold()== 0){
throw new IllegalArgumentException("金币数量不能为空");}
}
if (!cashRecord.getGoodsName().equals("金币充值")){
if( cashRecord.getGoodNum()== 0 ){
throw new IllegalArgumentException("产品数量不能为空");}
}
if(cashRecord.getPaymentCurrency()== null){
throw new IllegalArgumentException("支付币种不能为空");

Loading…
Cancel
Save