瀏覽代碼

提现金额不能为0

Qchen 2 年之前
父節點
當前提交
f4fad916d7
共有 1 個文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/main/java/com/ydtech/modules/admin/service/impl/SysDeptAccountServiceImpl.java

+ 5 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysDeptAccountServiceImpl.java

@@ -24,6 +24,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.math.BigDecimal;
+import java.math.BigInteger;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -82,6 +84,9 @@ public class SysDeptAccountServiceImpl extends ServiceImpl<SysDeptAccountMapper,
         if (sysDeptAccount.getAmount().compareTo(deptAccount.getManagementFee()) > 0) {
             throw new SystemException("提现金额大于机构账户金额");
         }
+        if (sysDeptAccount.getAmount().equals(new BigDecimal(BigInteger.ZERO))) {
+            throw new SystemException("提现金额不能为0");
+        }
         // 减去提现金额
         deptAccount.setManagementFee(deptAccount.getManagementFee().subtract(sysDeptAccount.getAmount()));
         sysDeptAccountService.updateById(deptAccount);