|
|
@@ -3,6 +3,7 @@ package com.ydtech.modules.inv.utils;
|
|
|
import com.ydtech.constants.enums.inv.InsAccountOperateEnum;
|
|
|
import com.ydtech.exception.SystemException;
|
|
|
import com.ydtech.modules.inv.model.InvAccount;
|
|
|
+import com.ydtech.modules.inv.model.InvAccountCard;
|
|
|
import com.ydtech.modules.inv.model.InvAccountExcel;
|
|
|
import com.ydtech.modules.inv.model.InvAccountOperate;
|
|
|
|
|
|
@@ -56,36 +57,36 @@ public class TransferUtils {
|
|
|
/**
|
|
|
* 内部转内部方法
|
|
|
*/
|
|
|
- public static List<InvAccount> insideTransfer(InvAccount outAccount, InvAccount enterAccount, InvAccountExcel invAccountExcel) {
|
|
|
- List<InvAccount> list = new ArrayList<>();
|
|
|
- if (outAccount != null && enterAccount != null && invAccountExcel != null) {
|
|
|
+ public static List<InvAccountCard> insideTransfer(InvAccountCard outAccountCard, InvAccountCard enterAccountCard, InvAccountExcel invAccountExcel) {
|
|
|
+ List<InvAccountCard> list = new ArrayList<>();
|
|
|
+ if (outAccountCard != null && enterAccountCard != null && invAccountExcel != null) {
|
|
|
//公户单日转账剩余
|
|
|
- BigDecimal pubDayLinesExcess = new BigDecimal(outAccount.getPubDayLinesExcess());
|
|
|
+ BigDecimal pubDayLinesExcess = new BigDecimal(outAccountCard.getPubDayLinesExcess());
|
|
|
//私户单日转账剩余
|
|
|
- BigDecimal priDayLinesExcess = new BigDecimal(outAccount.getPriDayLinesExcess());
|
|
|
+ BigDecimal priDayLinesExcess = new BigDecimal(outAccountCard.getPriDayLinesExcess());
|
|
|
//公户年额度剩余
|
|
|
- BigDecimal pubYearExcess = new BigDecimal(outAccount.getPubYearExcess());
|
|
|
+ BigDecimal pubYearExcess = new BigDecimal(outAccountCard.getPubYearExcess());
|
|
|
//私户年额度剩余
|
|
|
- BigDecimal priYearExcess = new BigDecimal(outAccount.getPriYearExcess());
|
|
|
+ BigDecimal priYearExcess = new BigDecimal(outAccountCard.getPriYearExcess());
|
|
|
//对公单笔限额
|
|
|
- BigDecimal pubSingleLines = new BigDecimal(outAccount.getPubSingleLines());
|
|
|
+ BigDecimal pubSingleLines = new BigDecimal(outAccountCard.getPubSingleLines());
|
|
|
//对私单笔限额
|
|
|
- BigDecimal priSingleLines = new BigDecimal(outAccount.getPriSingleLines());
|
|
|
+ BigDecimal priSingleLines = new BigDecimal(outAccountCard.getPriSingleLines());
|
|
|
//单日转账笔数剩余
|
|
|
- long dayStrokeNumExcess = Long.parseLong(outAccount.getDayStrokeNumExcess());
|
|
|
+ long dayStrokeNumExcess = Long.parseLong(outAccountCard.getDayStrokeNumExcess());
|
|
|
//申请金额
|
|
|
BigDecimal insAccountExcelApplyAmount = new BigDecimal(invAccountExcel.getApplyAmount());
|
|
|
//转出账户现支出金额
|
|
|
- BigDecimal outAccountSpend = new BigDecimal(outAccount.getSpend());
|
|
|
+ BigDecimal outAccountSpend = new BigDecimal(outAccountCard.getSpend());
|
|
|
|
|
|
- if (enterAccount.getAccountQuality().equals("0")) {
|
|
|
+ if (enterAccountCard.getAccountQuality().equals("0")) {
|
|
|
//公户操作
|
|
|
if (pubSingleLines.compareTo(insAccountExcelApplyAmount) > 0){
|
|
|
//收入方增加余额
|
|
|
String remark = invAccountExcel.getRemark();
|
|
|
|
|
|
- list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccount,outAccountSpend));
|
|
|
- list.add(enterAccountUtils(remark, enterAccount, insAccountExcelApplyAmount));
|
|
|
+ list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccountCard,outAccountSpend));
|
|
|
+ list.add(enterAccountUtils(remark, enterAccountCard, insAccountExcelApplyAmount));
|
|
|
return list;
|
|
|
}
|
|
|
throw new SystemException("公户转账金额超出单笔限额");
|
|
|
@@ -93,8 +94,8 @@ public class TransferUtils {
|
|
|
if(priSingleLines.compareTo(insAccountExcelApplyAmount) > 0){
|
|
|
//私户操作
|
|
|
String remark = invAccountExcel.getRemark();
|
|
|
- list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccount));
|
|
|
- list.add(enterAccountUtils(remark, enterAccount, insAccountExcelApplyAmount));
|
|
|
+ list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccountCard));
|
|
|
+ list.add(enterAccountUtils(remark, enterAccountCard, insAccountExcelApplyAmount));
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
@@ -108,45 +109,45 @@ public class TransferUtils {
|
|
|
/**
|
|
|
* 外部转内部方法
|
|
|
*/
|
|
|
- public static InvAccount outsideTransfer(InvAccount enterAccount, InvAccountOperate invAccountOperate) {
|
|
|
- if (enterAccount == null && invAccountOperate == null) {
|
|
|
+ public static InvAccountCard outsideTransfer(InvAccountCard enterAccountCard, InvAccountOperate invAccountOperate) {
|
|
|
+ if (enterAccountCard == null && invAccountOperate == null) {
|
|
|
throw new SystemException("收入账户为空");
|
|
|
}
|
|
|
String remark = invAccountOperate.getRemark();
|
|
|
BigDecimal applyAmount = new BigDecimal(invAccountOperate.getApplyAmount());
|
|
|
|
|
|
- return enterAccountUtils(remark, enterAccount, applyAmount);
|
|
|
+ return enterAccountUtils(remark, enterAccountCard, applyAmount);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 内部转外部方法
|
|
|
*/
|
|
|
- public static List<InvAccount> enterDeTransfer(InvAccount outAccount, InvAccount enterAccount, InvAccountExcel invAccountExcel) {
|
|
|
- List<InvAccount> list = new ArrayList<>();
|
|
|
- if (outAccount != null && enterAccount != null && invAccountExcel != null) {
|
|
|
+ public static List<InvAccountCard> enterDeTransfer(InvAccountCard outAccountCard, InvAccountCard enterAccountCard, InvAccountExcel invAccountExcel) {
|
|
|
+ List<InvAccountCard> list = new ArrayList<>();
|
|
|
+ if (outAccountCard != null && enterAccountCard != null && invAccountExcel != null) {
|
|
|
//公户单日转账剩余
|
|
|
- BigDecimal pubDayLinesExcess = new BigDecimal(outAccount.getPubDayLinesExcess());
|
|
|
+ BigDecimal pubDayLinesExcess = new BigDecimal(outAccountCard.getPubDayLinesExcess());
|
|
|
//私户单日转账剩余
|
|
|
- BigDecimal priDayLinesExcess = new BigDecimal(outAccount.getPriDayLinesExcess());
|
|
|
+ BigDecimal priDayLinesExcess = new BigDecimal(outAccountCard.getPriDayLinesExcess());
|
|
|
//公户年额度剩余
|
|
|
- BigDecimal pubYearExcess = new BigDecimal(outAccount.getPubYearExcess());
|
|
|
+ BigDecimal pubYearExcess = new BigDecimal(outAccountCard.getPubYearExcess());
|
|
|
//私户年额度剩余
|
|
|
- BigDecimal priYearExcess = new BigDecimal(outAccount.getPriYearExcess());
|
|
|
+ BigDecimal priYearExcess = new BigDecimal(outAccountCard.getPriYearExcess());
|
|
|
//单日转账笔数剩余
|
|
|
- long dayStrokeNumExcess = Long.parseLong(outAccount.getDayStrokeNumExcess());
|
|
|
+ long dayStrokeNumExcess = Long.parseLong(outAccountCard.getDayStrokeNumExcess());
|
|
|
//申请金额
|
|
|
BigDecimal insAccountExcelApplyAmount = new BigDecimal(invAccountExcel.getApplyAmount());
|
|
|
//转出账户现支出金额
|
|
|
- BigDecimal outAccountSpend = new BigDecimal(outAccount.getSpend());
|
|
|
+ BigDecimal outAccountSpend = new BigDecimal(outAccountCard.getSpend());
|
|
|
|
|
|
if (invAccountExcel.getOutAccountQuality().equals("0")) {
|
|
|
//公户操作
|
|
|
- list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccount,outAccountSpend));
|
|
|
+ list.add(pubAccountUtils(dayStrokeNumExcess,pubDayLinesExcess,pubYearExcess,insAccountExcelApplyAmount,outAccountCard,outAccountSpend));
|
|
|
return list;
|
|
|
|
|
|
} else {
|
|
|
//私户操作
|
|
|
- list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccount));
|
|
|
+ list.add(priAccountUtils(dayStrokeNumExcess,priDayLinesExcess,insAccountExcelApplyAmount, priYearExcess,outAccountSpend,outAccountCard));
|
|
|
return list;
|
|
|
}
|
|
|
}
|
|
|
@@ -159,38 +160,38 @@ public class TransferUtils {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- private static InvAccount enterAccountUtils(String remark, InvAccount enterAccount, BigDecimal invAccountExcelApplyAmount) {
|
|
|
+ private static InvAccountCard enterAccountUtils(String remark, InvAccountCard enterAccountCard, BigDecimal invAccountExcelApplyAmount) {
|
|
|
switch (remark) {
|
|
|
case "0":
|
|
|
- enterAccount.setInsuranceProfit(new BigDecimal(enterAccount.getInsuranceProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setInsuranceProfit(new BigDecimal(enterAccountCard.getInsuranceProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
case "1":
|
|
|
- enterAccount.setClearingProfit(new BigDecimal(enterAccount.getClearingProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setClearingProfit(new BigDecimal(enterAccountCard.getClearingProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
case "2":
|
|
|
- enterAccount.setTianqinProfit(new BigDecimal(enterAccount.getTianqinProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setTianqinProfit(new BigDecimal(enterAccountCard.getTianqinProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
case "3":
|
|
|
- enterAccount.setParkProfit(new BigDecimal(enterAccount.getParkProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setParkProfit(new BigDecimal(enterAccountCard.getParkProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
case "4":
|
|
|
- enterAccount.setOtherProfit(new BigDecimal(enterAccount.getOtherProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setOtherProfit(new BigDecimal(enterAccountCard.getOtherProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
case "5":
|
|
|
- enterAccount.setFiscalProfit(new BigDecimal(enterAccount.getFiscalProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setFiscalProfit(new BigDecimal(enterAccountCard.getFiscalProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
case "6":
|
|
|
- enterAccount.setExteriorProfit(new BigDecimal(enterAccount.getExteriorProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ enterAccountCard.setExteriorProfit(new BigDecimal(enterAccountCard.getExteriorProfit()).add(invAccountExcelApplyAmount).toString());
|
|
|
break;
|
|
|
}
|
|
|
- enterAccount.setBalance(new BigDecimal(enterAccount.getBalance()).add(invAccountExcelApplyAmount).toString());
|
|
|
- return enterAccount;
|
|
|
+ enterAccountCard.setBalance(new BigDecimal(enterAccountCard.getBalance()).add(invAccountExcelApplyAmount).toString());
|
|
|
+ return enterAccountCard;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 公户扣除余额方法
|
|
|
*/
|
|
|
- private static InvAccount pubAccountUtils(long dayStrokeNumExcess, BigDecimal pubDayLinesExcess, BigDecimal pubYearExcess, BigDecimal invAccountExcelApplyAmount, InvAccount outAccount,BigDecimal outAccountSpend) {
|
|
|
+ private static InvAccountCard pubAccountUtils(long dayStrokeNumExcess, BigDecimal pubDayLinesExcess, BigDecimal pubYearExcess, BigDecimal invAccountExcelApplyAmount, InvAccountCard outAccountCard,BigDecimal outAccountSpend) {
|
|
|
//判断单日转账笔数是否超过
|
|
|
if (dayStrokeNumExcess <= 0) {
|
|
|
throw new SystemException("公户单日转账笔数不足");
|
|
|
@@ -205,20 +206,20 @@ public class TransferUtils {
|
|
|
}
|
|
|
|
|
|
//支出方减少余额
|
|
|
- outAccount.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
|
|
|
- outAccount.setBalance(new BigDecimal(outAccount.getBalance()).subtract(invAccountExcelApplyAmount).toString());
|
|
|
+ outAccountCard.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
|
|
|
+ outAccountCard.setBalance(new BigDecimal(outAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
|
|
|
//公户单日转账笔数减少
|
|
|
- outAccount.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
|
|
|
+ outAccountCard.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
|
|
|
//公户单日转账剩余减少
|
|
|
- outAccount.setPubDayLinesExcess(pubDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
+ outAccountCard.setPubDayLinesExcess(pubDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
//公户年额度减少
|
|
|
- outAccount.setPubYearExcess(pubYearExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
- return outAccount;
|
|
|
+ outAccountCard.setPubYearExcess(pubYearExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
+ return outAccountCard;
|
|
|
}
|
|
|
/**
|
|
|
* 私户扣除余额方法
|
|
|
*/
|
|
|
- private static InvAccount priAccountUtils(long dayStrokeNumExcess, BigDecimal priDayLinesExcess, BigDecimal invAccountExcelApplyAmount, BigDecimal priYearExcess, BigDecimal outAccountSpend,InvAccount outAccount) {
|
|
|
+ private static InvAccountCard priAccountUtils(long dayStrokeNumExcess, BigDecimal priDayLinesExcess, BigDecimal invAccountExcelApplyAmount, BigDecimal priYearExcess, BigDecimal outAccountSpend,InvAccountCard outAccountCard) {
|
|
|
if (dayStrokeNumExcess <= 0) {
|
|
|
throw new SystemException("私户单日转账笔数不足");
|
|
|
}
|
|
|
@@ -229,12 +230,12 @@ public class TransferUtils {
|
|
|
throw new SystemException("私户年额度不足");
|
|
|
}
|
|
|
|
|
|
- outAccount.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
|
|
|
- outAccount.setBalance(new BigDecimal(outAccount.getBalance()).subtract(invAccountExcelApplyAmount).toString());
|
|
|
- outAccount.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
|
|
|
- outAccount.setPriDayLinesExcess(priDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
- outAccount.setPriYearExcess(priYearExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
- return outAccount;
|
|
|
+ outAccountCard.setSpend(outAccountSpend.add(invAccountExcelApplyAmount).toString());
|
|
|
+ outAccountCard.setBalance(new BigDecimal(outAccountCard.getBalance()).subtract(invAccountExcelApplyAmount).toString());
|
|
|
+ outAccountCard.setDayStrokeNumExcess(String.valueOf(dayStrokeNumExcess - 1));
|
|
|
+ outAccountCard.setPriDayLinesExcess(priDayLinesExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
+ outAccountCard.setPriYearExcess(priYearExcess.subtract(invAccountExcelApplyAmount).toString());
|
|
|
+ return outAccountCard;
|
|
|
}
|
|
|
|
|
|
|