|
|
@@ -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;
|
|
|
}
|
|
|
|