소스 검색

发票管理修复

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