浏览代码

发票管理修复

y 2 年之前
父节点
当前提交
2c3a3a5a98
共有 1 个文件被更改,包括 5 次插入0 次删除
  1. 5 0
      src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

+ 5 - 0
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -249,6 +249,11 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
 
             if(invAccountOperate.getInvoiceId() != null){
                 InvAccountIncoice byId = invAccountIncoiceService.getById(invAccountOperate.getInvoiceId());
+
+                if (new BigDecimal(byId.getPayoutMoney()).compareTo(new BigDecimal(invAccountOperate.getApplyAmount())) < 0){
+                    throw new SystemException("撤销金额大于已进账金额");
+                }
+
                 byId.setPayoutMoney(new BigDecimal(byId.getPayoutMoney()).subtract(new BigDecimal(invAccountOperate.getApplyAmount())).toString());
                 byId.setNotPayoutMoney(new BigDecimal(byId.getNotPayoutMoney()).add(new BigDecimal(invAccountOperate.getApplyAmount())).toString());
                 invAccountIncoiceService.updateById(byId);