y пре 2 година
родитељ
комит
2c3a3a5a98

+ 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);