|
|
@@ -87,24 +87,23 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
//进账金额
|
|
|
String payoutMoney = new BigDecimal(invAccountIncoice.getPayoutMoney()).toString();
|
|
|
invAccountIncoice1.setPayoutMoney(new BigDecimal(invAccountIncoice1.getPayoutMoney()).add(new BigDecimal(payoutMoney)).toString());
|
|
|
- invAccountIncoice1.setNotPayoutMoney(new BigDecimal(invAccountIncoice1.getInvoiceMoney()).subtract(new BigDecimal(invAccountIncoice1.getPayoutMoney())).subtract(new BigDecimal(payoutMoney)).toString());
|
|
|
+ invAccountIncoice1.setNotPayoutMoney(new BigDecimal(invAccountIncoice1.getInvoiceMoney()).subtract(new BigDecimal(invAccountIncoice1.getPayoutMoney())).toString());
|
|
|
invAccountIncoice1.setPayoutTime(invAccountIncoice.getPayoutTime());
|
|
|
|
|
|
if (invAccountIncoice1.getNotPayoutMoney().equals("0")) {
|
|
|
invAccountIncoice1.setClearFlag("1");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ String fundFlow = invAccountIncoice1.getOtherUnit() + "→" + invAccountIncoice1.getInvoiceBy();
|
|
|
//修改发票增加卡的收入
|
|
|
InvAccountOperate invAccountOperate = new InvAccountOperate();
|
|
|
invAccountOperate.setEnterCardId(bankCardNum);
|
|
|
invAccountOperate.setApplyAmount(payoutMoney);
|
|
|
invAccountOperate.setRevenueOutlay("0");
|
|
|
- invAccountOperate.setFundFlow(invAccountIncoice.getFundFlow());
|
|
|
+ invAccountOperate.setFundFlow(fundFlow);
|
|
|
invAccountOperate.setPayMethod(invAccountIncoice.getPayMethod());
|
|
|
invAccountOperate.setCompany(invAccountIncoice1.getOtherUnit());
|
|
|
invAccountOperate.setFundUse(invAccountIncoice.getFundUse());
|
|
|
- invAccountOperate.setRemark(invAccountIncoice.getRemark());
|
|
|
invAccountOperate.setFundFen(invAccountIncoice.getFundFen());
|
|
|
invAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
//计算收入百分比
|
|
|
@@ -123,37 +122,37 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
|
|
|
|
|
|
List<InvAccountOp> list = new ArrayList<>();
|
|
|
- for (Map.Entry<String, Object> entry:invAccountOperate.getOutProfit().entrySet()){
|
|
|
- InvAccountOp invAccountOp = new InvAccountOp();
|
|
|
- invAccountOp.setAccountId(invAccountIncoice1.getAccountId());
|
|
|
- invAccountOp.setAccountName(account.getAccountName());
|
|
|
- invAccountOp.setCardNum(entCard.getBankCardNum());
|
|
|
- invAccountOp.setCardName(entCard.getBankName());
|
|
|
- invAccountOp.setProfit(entry.getKey());
|
|
|
- invAccountOp.setMoney(entry.getValue().toString());
|
|
|
- invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
- list.add(invAccountOp);
|
|
|
+ for (Map.Entry<String, Object> entry : invAccountIncoice.getEntProfit().entrySet()) {
|
|
|
+ if (Integer.parseInt(entry.getValue().toString()) != 0) {
|
|
|
+ InvAccountOp invAccountOp = new InvAccountOp();
|
|
|
+ invAccountOp.setAccountId(invAccountIncoice1.getAccountId());
|
|
|
+ invAccountOp.setAccountName(account.getAccountName());
|
|
|
+ invAccountOp.setCardNum(entCard.getBankCardNum());
|
|
|
+ invAccountOp.setCardName(entCard.getBankName());
|
|
|
+ invAccountOp.setProfit(entry.getKey());
|
|
|
+ invAccountOp.setMoney(new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountIncoice.getPayoutMoney())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).toString());
|
|
|
+ invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
+ list.add(invAccountOp);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
//支出操作
|
|
|
InvAccountOperate outInvAccountOperate = new InvAccountOperate();
|
|
|
- outInvAccountOperate.setEnterCardId(invAccountIncoice1.getOutBankCardNum());
|
|
|
+ outInvAccountOperate.setEnterCardId(bankCardNum);
|
|
|
outInvAccountOperate.setApplyAmount(payoutMoney);
|
|
|
outInvAccountOperate.setRevenueOutlay("1");
|
|
|
- outInvAccountOperate.setFundFlow(invAccountIncoice.getFundFlow());
|
|
|
+ outInvAccountOperate.setFundFlow(fundFlow);
|
|
|
outInvAccountOperate.setPayMethod(invAccountIncoice.getPayMethod());
|
|
|
outInvAccountOperate.setCompany(invAccountIncoice1.getOtherUnit());
|
|
|
outInvAccountOperate.setFundUse(invAccountIncoice.getFundUse());
|
|
|
outInvAccountOperate.setFundFen(invAccountIncoice.getFundFen());
|
|
|
- outInvAccountOperate.setRemark(invAccountIncoice.getRemark());
|
|
|
outInvAccountOperate.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
//计算支出百分比
|
|
|
JSONObject outProfit = invAccountIncoice.getOutProfit();
|
|
|
JSONObject outJsonObject = new JSONObject();
|
|
|
for (Map.Entry<String, Object> entry : outProfit.entrySet()) {
|
|
|
- BigDecimal multiply = new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountIncoice.getPayoutMoney())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP);
|
|
|
+ BigDecimal multiply = new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountIncoice.getPayoutMoney())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).negate();
|
|
|
outJsonObject.put(entry.getKey(), multiply.negate());
|
|
|
}
|
|
|
outInvAccountOperate.setOutProfit(outJsonObject);
|
|
|
@@ -164,22 +163,21 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
invAccountOperateList.add(invAccountOperate);
|
|
|
|
|
|
|
|
|
- for (Map.Entry<String, Object> entry:outInvAccountOperate.getOutProfit().entrySet()){
|
|
|
- InvAccountOp invAccountOp = new InvAccountOp();
|
|
|
- invAccountOp.setAccountId(invAccountIncoice1.getAccountId());
|
|
|
- invAccountOp.setAccountName(account.getAccountName());
|
|
|
- invAccountOp.setCardNum(outCard.getBankCardNum());
|
|
|
- invAccountOp.setCardName(outCard.getBankName());
|
|
|
- invAccountOp.setProfit(entry.getKey());
|
|
|
- invAccountOp.setMoney(entry.getValue().toString());
|
|
|
- invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
- list.add(invAccountOp);
|
|
|
+ for (Map.Entry<String, Object> entry : outInvAccountOperate.getOutProfit().entrySet()) {
|
|
|
+ if (Integer.parseInt(entry.getValue().toString()) != 0) {
|
|
|
+ InvAccountOp invAccountOp = new InvAccountOp();
|
|
|
+ invAccountOp.setAccountId(invAccountIncoice1.getAccountId());
|
|
|
+ invAccountOp.setAccountName(account.getAccountName());
|
|
|
+ invAccountOp.setCardNum(outCard.getBankCardNum());
|
|
|
+ invAccountOp.setCardName(outCard.getBankName());
|
|
|
+ invAccountOp.setProfit(entry.getKey());
|
|
|
+ invAccountOp.setMoney(new BigDecimal(String.valueOf(entry.getValue())).multiply(new BigDecimal(invAccountIncoice.getPayoutMoney())).divide(new BigDecimal("100"), 2, RoundingMode.HALF_UP).negate().toString());
|
|
|
+ invAccountOp.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
+ list.add(invAccountOp);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
|
- invAccountOpService.saveBatch(list);
|
|
|
-
|
|
|
-
|
|
|
//支出卡号
|
|
|
String outBankCardNum = invAccountIncoice1.getOutBankCardNum();
|
|
|
//支出账户
|
|
|
@@ -194,13 +192,14 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
InvAccount outInvAccount = invAccountService.getById(outInvAccountCard.getAccountId());
|
|
|
|
|
|
//转账
|
|
|
- if (outInvAccount.getOuterFlag().equals("0")){
|
|
|
+ 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);
|
|
|
+ invAccountOpService.saveBatch(list);
|
|
|
|
|
|
} else {
|
|
|
InvAccountExcel invAccountExcel = new InvAccountExcel();
|
|
|
@@ -209,12 +208,20 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
List<InvAccountCard> invAccountCards = enterDeTransfer(outInvAccountCard, revInvAccountCard, invAccountExcel);
|
|
|
invAccountCardService.updateBatchById(invAccountCards);
|
|
|
invAccountOperateService.saveBatch(invAccountOperateList);
|
|
|
+ invAccountOpService.saveBatch(list);
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
InvAccountOperate invAccountOperate1 = new InvAccountOperate();
|
|
|
invAccountOperate1.setOutCardNum(invAccountIncoice1.getOutBankCardNum());
|
|
|
invAccountOperate1.setEnterCardId(invAccountIncoice1.getRevBankCardNum());
|
|
|
- invAccountOperate1.setApplyAmount(invAccountIncoice.getPayoutMoney());
|
|
|
+ invAccountOperate1.setApplyAmount(payoutMoney);
|
|
|
+ invAccountOperate1.setRevenueOutlay("0");
|
|
|
+ invAccountOperate1.setFundFlow(fundFlow);
|
|
|
+ invAccountOperate1.setPayMethod(invAccountIncoice.getPayMethod());
|
|
|
+ invAccountOperate1.setCompany(invAccountIncoice1.getOtherUnit());
|
|
|
+ invAccountOperate1.setFundUse(invAccountIncoice.getFundUse());
|
|
|
+ invAccountOperate1.setFundFen(invAccountIncoice.getFundFen());
|
|
|
+ invAccountOperate1.setInvoiceId(invAccountIncoice1.getInvoiceId());
|
|
|
invAccountOperateService.insert(invAccountOperate1);
|
|
|
}
|
|
|
|
|
|
@@ -315,12 +322,12 @@ public class InvAccountIncoiceServiceImpl extends ServiceImpl<InvAccountIncoiceM
|
|
|
}
|
|
|
});
|
|
|
File folder = new File(uploadFilePath);
|
|
|
- if (folder.exists()){
|
|
|
+ if (folder.exists()) {
|
|
|
return EasyExcelUtils.downExcel(uploadFilePath, InvAccountIncoice.class, invAccountIncoices);
|
|
|
- }else {
|
|
|
- if (folder.mkdirs()){
|
|
|
+ } else {
|
|
|
+ if (folder.mkdirs()) {
|
|
|
return EasyExcelUtils.downExcel(uploadFilePath, InvAccountIncoice.class, invAccountIncoices);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new SystemException("文件导出失败");
|
|
|
}
|
|
|
|