فهرست منبع

修改发票管理逻辑

y 2 سال پیش
والد
کامیت
7d15fe97e0

+ 23 - 14
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountIncoiceServiceImpl.java

@@ -191,22 +191,31 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
         }
         //判断收款方是内部还是外部
         InvAccount revInvAccount = invAccountService.getById(revInvAccountCard.getAccountId());
+        InvAccount outInvAccount = invAccountService.getById(outInvAccountCard.getAccountId());
 
         //转账
-        if (revInvAccount.getOuterFlag().equals("0")) {
-            InvAccountExcel invAccountExcel = new InvAccountExcel();
-            invAccountExcel.setApplyAmount(invAccountIncoice.getPayoutMoney());
-            List<InvAccountCard> invAccountCards = insideTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
-            invAccountCardService.updateBatchById(invAccountCards);
-            invAccountOperateService.saveBatch(invAccountOperateList);
-
-        } else {
-            InvAccountExcel invAccountExcel = new InvAccountExcel();
-            invAccountExcel.setOutAccountQuality(revInvAccount.getOuterFlag());
-            invAccountExcel.setApplyAmount(invAccountIncoice.getPayoutMoney());
-            List<InvAccountCard> invAccountCards = enterDeTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
-            invAccountCardService.updateBatchById(invAccountCards);
-            invAccountOperateService.saveBatch(invAccountOperateList);
+        if (outInvAccount.getOuterFlag().equals("0")){
+            if (revInvAccount.getOuterFlag().equals("0")) {
+                InvAccountExcel invAccountExcel = new InvAccountExcel();
+                invAccountExcel.setApplyAmount(invAccountIncoice.getPayoutMoney());
+                List<InvAccountCard> invAccountCards = insideTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
+                invAccountCardService.updateBatchById(invAccountCards);
+                invAccountOperateService.saveBatch(invAccountOperateList);
+
+            } else {
+                InvAccountExcel invAccountExcel = new InvAccountExcel();
+                invAccountExcel.setOutAccountQuality(revInvAccount.getOuterFlag());
+                invAccountExcel.setApplyAmount(invAccountIncoice.getPayoutMoney());
+                List<InvAccountCard> invAccountCards = enterDeTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
+                invAccountCardService.updateBatchById(invAccountCards);
+                invAccountOperateService.saveBatch(invAccountOperateList);
+            }
+        }else {
+            InvAccountOperate invAccountOperate1 = new InvAccountOperate();
+            invAccountOperate1.setOutCardNum(invAccountIncoice1.getOutBankCardNum());
+            invAccountOperate1.setEnterCardId(invAccountIncoice1.getRevBankCardNum());
+            invAccountOperate1.setApplyAmount(invAccountIncoice.getPayoutMoney());
+            invAccountOperateService.insert(invAccountOperate1);
         }
 
 

+ 11 - 9
src/main/java/com/ydtech/modules/inv/service/impl/InvAccountOperateServiceImpl.java

@@ -103,15 +103,17 @@ public class InvAccountOperateServiceImpl extends ServiceImpl<InvAccountOperateM
         invAccountOperate.setCreateTime(LocalDateTime.now());
         insAccountOperateMapper.insert(invAccountOperate);
         List<InvAccountOp> list = new ArrayList<>();
-        for (Map.Entry<String, Object> entry:invAccountOperate.getOutProfit().entrySet()){
-            InvAccountOp invAccountOp = new InvAccountOp();
-            invAccountOp.setAccountId(enterAccount.getAccountId());
-            invAccountOp.setAccountName(account.getAccountName());
-            invAccountOp.setCardNum(invAccount.getBankCardNum());
-            invAccountOp.setCardName(invAccount.getBankName());
-            invAccountOp.setProfit(entry.getKey());
-            invAccountOp.setMoney(entry.getValue().toString());
-            list.add(invAccountOp);
+        if (invAccountOperate.getOutProfit()!=null){
+            for (Map.Entry<String, Object> entry:invAccountOperate.getOutProfit().entrySet()){
+                InvAccountOp invAccountOp = new InvAccountOp();
+                invAccountOp.setAccountId(enterAccount.getAccountId());
+                invAccountOp.setAccountName(account.getAccountName());
+                invAccountOp.setCardNum(invAccount.getBankCardNum());
+                invAccountOp.setCardName(invAccount.getBankName());
+                invAccountOp.setProfit(entry.getKey());
+                invAccountOp.setMoney(entry.getValue().toString());
+                list.add(invAccountOp);
+            }
         }
         invAccountOpService.saveBatch(list);
         return HttpResult.ok("新增收入成功");

+ 4 - 1
src/main/java/com/ydtech/modules/inv/utils/TransferUtils.java

@@ -89,6 +89,7 @@ public class TransferUtils {
             long dayStrokeNumExcess = Long.parseLong(outAccountCard.getDayStrokeNumExcess());
             //申请金额
             BigDecimal insAccountExcelApplyAmount = new BigDecimal(invAccountExcel.getApplyAmount());
+
             //转出账户现支出金额
             BigDecimal outAccountSpend = new BigDecimal(outAccountCard.getSpend());
 
@@ -222,7 +223,9 @@ public class TransferUtils {
      * @return
      */
     private static InvAccountCard outAccountBreakUtils(InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
-        enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).add(invAccountExcelApplyAmount).toString());
+        if (enterAccountCard.getBalance()!=null && !enterAccountCard.getBalance().isEmpty()){
+            enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).add(invAccountExcelApplyAmount).toString());
+        }
         return enterAccountCard;
     }