Przeglądaj źródła

已知问题修改

y 2 lat temu
rodzic
commit
63a52c76f3

+ 2 - 1
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -260,8 +260,9 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         InvAccountCard enterAccount = invAccountCardService.getById(enInvAccountIncoice.getRevBankCardNum());
         InvAccountCard outAccount = invAccountCardService.getById(enInvAccountIncoice.getOutBankCardNum());
 
+        InvAccount entAccount = invAccountService.getById(enterAccount.getAccountId());
         //新增收入回滚操作
-        List<InvAccountCard> invAccount = quashOutsideTransfer(outAccount, enterAccount, new BigDecimal(enInvAccountIncoice.getInvoiceMoney()));
+        List<InvAccountCard> invAccount = quashOutsideTransfer(outAccount, enterAccount, new BigDecimal(enInvAccountIncoice.getInvoiceMoney()),entAccount);
         InvAccountOperate invAccountOperate = new InvAccountOperate();
         invAccountOperate.setRevenueOutlay("1");
         invAccountOperate.setApplyAmount("发票撤销 收入撤销");

+ 2 - 1
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -200,7 +200,8 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
             String enterCardNum = invAccountOperate.getEnterCardNum();
             InvAccountCard outAccountCard = invAccountCardService.getById(outCardNum);
             InvAccountCard entAccountCard = invAccountCardService.getById(enterCardNum);
-            List<InvAccountCard> invAccountCards = quashOutsideTransfer(outAccountCard, entAccountCard, new BigDecimal(invAccountOperate.getApplyAmount()));
+            InvAccount entAccount = invAccountService.getById(entAccountCard.getAccountId());
+            List<InvAccountCard> invAccountCards = quashOutsideTransfer(outAccountCard, entAccountCard, new BigDecimal(invAccountOperate.getApplyAmount()),entAccount);
             List<InvAccountOp> opList = new ArrayList<>();
             invAccountOperates.forEach(invAccountOperate1 -> {
                 LambdaQueryWrapper<InvAccountOp> queryWrapper = new LambdaQueryWrapper<InvAccountOp>();

+ 16 - 9
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -3,6 +3,9 @@ package com.ydtech.modules.inv.utils;
 import com.alibaba.fastjson.JSONObject;
 import com.ydtech.exception.SystemException;
 import com.ydtech.modules.inv.model.*;
+import com.ydtech.modules.inv.service.InvAccountService;
+import com.ydtech.modules.inv.service.impl.InvAccountServiceImpl;
+import org.apache.bcel.generic.IF_ACMPEQ;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
@@ -334,9 +337,9 @@ public class TransferUtils {
     /**
      * 撤销发票方法
      */
-    public static List<InvAccountCard> quashOutsideTransfer(InvAccountCard outAccountCard, InvAccountCard enterAccountCard, BigDecimal applyAmount) {
+    public static List<InvAccountCard> quashOutsideTransfer(InvAccountCard outAccountCard, InvAccountCard enterAccountCard, BigDecimal applyAmount, InvAccount entInvAccount) {
         List<InvAccountCard> list = new ArrayList<>();
-        list.add(enterAccountBreakUtils(enterAccountCard, outAccountCard, applyAmount));
+        list.add(enterAccountBreakUtils(enterAccountCard, outAccountCard, applyAmount, entInvAccount));
         InvAccountCard invAccountCard = outAccountBreakUtils(outAccountCard, enterAccountCard, applyAmount);
         if (invAccountCard != null) {
             list.add(invAccountCard);
@@ -350,16 +353,20 @@ public class TransferUtils {
      *
      * @return
      */
-    private static InvAccountCard enterAccountBreakUtils(InvAccountCard enterAccountCard, InvAccountCard outAccountCard, BigDecimal invAccountExcelApplyAmount) {
-
-        if (enterAccountCard != null) {
-            if (outAccountCard != null){
-                if (enterAccountCard.getBalance().equals("0")) {
-                    throw new SystemException("账户余额不足");
+    private static InvAccountCard enterAccountBreakUtils(InvAccountCard enterAccountCard, InvAccountCard outAccountCard, BigDecimal invAccountExcelApplyAmount, InvAccount entInvAccount) {
+        if (entInvAccount.getOuterFlag().equals("0")) {
+            if (enterAccountCard != null) {
+                if (outAccountCard != null) {
+                    if (enterAccountCard.getBalance().equals("0")) {
+                        throw new SystemException("账户余额不足");
+                    }
                 }
             }
-            enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
+            if (enterAccountCard != null && enterAccountCard.getBalance().isEmpty()) {
+                enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
+            }
         }
+
         return enterAccountCard;
     }