|
@@ -4,8 +4,6 @@ package com.ydtech.modules.inv.service.impl;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-import com.google.gson.JsonElement;
|
|
|
|
|
-import com.google.gson.JsonObject;
|
|
|
|
|
import com.ydtech.constants.enums.inv.InvoiceTypeEnum;
|
|
import com.ydtech.constants.enums.inv.InvoiceTypeEnum;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.exception.SystemException;
|
|
import com.ydtech.exception.SystemException;
|
|
@@ -14,7 +12,6 @@ import com.ydtech.modules.inv.model.*;
|
|
|
import com.ydtech.modules.inv.model.vo.InvAccountIncoiceQueryVo;
|
|
import com.ydtech.modules.inv.model.vo.InvAccountIncoiceQueryVo;
|
|
|
import com.ydtech.modules.inv.service.*;
|
|
import com.ydtech.modules.inv.service.*;
|
|
|
import com.ydtech.modules.inv.utils.EasyExcelUtils;
|
|
import com.ydtech.modules.inv.utils.EasyExcelUtils;
|
|
|
-import com.ydtech.modules.inv.utils.TransferUtils;
|
|
|
|
|
import com.ydtech.utils.StringUtils;
|
|
import com.ydtech.utils.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -26,8 +23,8 @@ import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
import java.math.RoundingMode;
|
|
|
import java.time.LocalDateTime;
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.ArrayList;
|
|
import java.util.ArrayList;
|
|
|
|
|
+import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import static com.ydtech.modules.inv.utils.TransferUtils.*;
|
|
import static com.ydtech.modules.inv.utils.TransferUtils.*;
|
|
|
|
|
|
|
@@ -122,6 +119,7 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
//资金流出
|
|
//资金流出
|
|
|
String fundFlow = invAccountIncoice1.getOtherUnit() + "→" + invAccountIncoice1.getInvoiceBy();
|
|
String fundFlow = invAccountIncoice1.getOtherUnit() + "→" + invAccountIncoice1.getInvoiceBy();
|
|
|
|
|
|
|
|
|
|
+ Date date = new Date();
|
|
|
|
|
|
|
|
//收入操作记录
|
|
//收入操作记录
|
|
|
InvAccountOperate invAccountOperate = new InvAccountOperate();
|
|
InvAccountOperate invAccountOperate = new InvAccountOperate();
|
|
@@ -136,6 +134,9 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
invAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
invAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
invAccountOperate.setCreateTime(LocalDateTime.now());
|
|
invAccountOperate.setCreateTime(LocalDateTime.now());
|
|
|
invAccountOperate.setEntProfit(entProfit);
|
|
invAccountOperate.setEntProfit(entProfit);
|
|
|
|
|
+ invAccountOperate.setDel(String.valueOf(date.getTime()));
|
|
|
|
|
+ invAccountOperate.setOutCardNum(outCard.getBankCardNum());
|
|
|
|
|
+ invAccountOperate.setEnterCardNum(entCard.getBankCardNum());
|
|
|
|
|
|
|
|
//支出操作记录
|
|
//支出操作记录
|
|
|
InvAccountOperate outInvAccountOperate = new InvAccountOperate();
|
|
InvAccountOperate outInvAccountOperate = new InvAccountOperate();
|
|
@@ -150,21 +151,11 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
outInvAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
outInvAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
outInvAccountOperate.setCreateTime(LocalDateTime.now());
|
|
outInvAccountOperate.setCreateTime(LocalDateTime.now());
|
|
|
outInvAccountOperate.setOutProfit(outProfit);
|
|
outInvAccountOperate.setOutProfit(outProfit);
|
|
|
|
|
+ outInvAccountOperate.setDel(String.valueOf(date.getTime()));
|
|
|
|
|
+ outInvAccountOperate.setOutCardNum(outCard.getBankCardNum());
|
|
|
|
|
+ outInvAccountOperate.setEnterCardNum(entCard.getBankCardNum());
|
|
|
|
|
|
|
|
|
|
|
|
|
- //归属列表
|
|
|
|
|
- List<InvAccountOp> list = new ArrayList<>();
|
|
|
|
|
- List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard, payoutMoney);
|
|
|
|
|
- List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard, payoutMoney);
|
|
|
|
|
- //将发票id放入 防止撤销发票时对应归属没删掉
|
|
|
|
|
- list1.forEach(invAccountOp -> {
|
|
|
|
|
- invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
|
|
- });
|
|
|
|
|
- list2.forEach(invAccountOp -> {
|
|
|
|
|
- invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
|
|
- });
|
|
|
|
|
- list.addAll(list1);
|
|
|
|
|
- list.addAll(list2);
|
|
|
|
|
|
|
|
|
|
//放入操作记录list中
|
|
//放入操作记录list中
|
|
|
List<InvAccountOperate> invAccountOperateList = new ArrayList<>();
|
|
List<InvAccountOperate> invAccountOperateList = new ArrayList<>();
|
|
@@ -180,6 +171,21 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
List<InvAccountCard> invAccountCards = insideTransfer(outCard, outInvAccount, entCard, revInvAccount, payoutMoney);
|
|
List<InvAccountCard> invAccountCards = insideTransfer(outCard, outInvAccount, entCard, revInvAccount, payoutMoney);
|
|
|
invAccountCardService.updateBatchById(invAccountCards);
|
|
invAccountCardService.updateBatchById(invAccountCards);
|
|
|
invAccountOperateService.saveBatch(invAccountOperateList);
|
|
invAccountOperateService.saveBatch(invAccountOperateList);
|
|
|
|
|
+
|
|
|
|
|
+ //归属列表
|
|
|
|
|
+ List<InvAccountOp> list = new ArrayList<>();
|
|
|
|
|
+ List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
|
|
|
|
|
+ List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
|
|
|
|
|
+ //将发票id放入 防止撤销发票时对应归属没删掉
|
|
|
|
|
+ list1.forEach(invAccountOp -> {
|
|
|
|
|
+ invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ list2.forEach(invAccountOp -> {
|
|
|
|
|
+ invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ list.addAll(list1);
|
|
|
|
|
+ list.addAll(list2);
|
|
|
|
|
+
|
|
|
invAccountOpService.saveBatch(list);
|
|
invAccountOpService.saveBatch(list);
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -189,6 +195,21 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
List<InvAccountCard> invAccountCards = enterDeTransfer(outCard, outInvAccount, entCard, revInvAccount, payoutMoney);
|
|
List<InvAccountCard> invAccountCards = enterDeTransfer(outCard, outInvAccount, entCard, revInvAccount, payoutMoney);
|
|
|
invAccountCardService.updateBatchById(invAccountCards);
|
|
invAccountCardService.updateBatchById(invAccountCards);
|
|
|
invAccountOperateService.saveBatch(invAccountOperateList);
|
|
invAccountOperateService.saveBatch(invAccountOperateList);
|
|
|
|
|
+
|
|
|
|
|
+ //归属列表
|
|
|
|
|
+ List<InvAccountOp> list = new ArrayList<>();
|
|
|
|
|
+ List<InvAccountOp> list1 = invAccountEntOpList(entProfit, revInvAccount, entCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
|
|
|
|
|
+ List<InvAccountOp> list2 = invAccountOutOpList(outProfit, outInvAccount, outCard, payoutMoney,invAccountOperateList.get(0).getAccountOperateId());
|
|
|
|
|
+ //将发票id放入 防止撤销发票时对应归属没删掉
|
|
|
|
|
+ list1.forEach(invAccountOp -> {
|
|
|
|
|
+ invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ list2.forEach(invAccountOp -> {
|
|
|
|
|
+ invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
|
|
+ });
|
|
|
|
|
+ list.addAll(list1);
|
|
|
|
|
+ list.addAll(list2);
|
|
|
|
|
+
|
|
|
invAccountOpService.saveBatch(list);
|
|
invAccountOpService.saveBatch(list);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -206,6 +227,7 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
invAccountOperate1.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
invAccountOperate1.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
invAccountOperate1.setOutProfit(outProfit);
|
|
invAccountOperate1.setOutProfit(outProfit);
|
|
|
invAccountOperate1.setEntProfit(entProfit);
|
|
invAccountOperate1.setEntProfit(entProfit);
|
|
|
|
|
+ outInvAccountOperate.setEnterCardNum(entCard.getBankCardNum());
|
|
|
invAccountOperateService.insert(invAccountOperate1);
|
|
invAccountOperateService.insert(invAccountOperate1);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -239,7 +261,7 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
InvAccountCard outAccount = invAccountCardService.getById(enInvAccountIncoice.getOutBankCardNum());
|
|
InvAccountCard outAccount = invAccountCardService.getById(enInvAccountIncoice.getOutBankCardNum());
|
|
|
|
|
|
|
|
//新增收入回滚操作
|
|
//新增收入回滚操作
|
|
|
- List<InvAccountCard> invAccount = quashOutsideTransfer(outAccount, enterAccount, enInvAccountIncoice);
|
|
|
|
|
|
|
+ List<InvAccountCard> invAccount = quashOutsideTransfer(outAccount, enterAccount, new BigDecimal(enInvAccountIncoice.getInvoiceMoney()));
|
|
|
InvAccountOperate invAccountOperate = new InvAccountOperate();
|
|
InvAccountOperate invAccountOperate = new InvAccountOperate();
|
|
|
invAccountOperate.setRevenueOutlay("1");
|
|
invAccountOperate.setRevenueOutlay("1");
|
|
|
invAccountOperate.setApplyAmount("发票撤销 收入撤销");
|
|
invAccountOperate.setApplyAmount("发票撤销 收入撤销");
|