|
@@ -259,57 +259,59 @@ public class MySQLSecondService {
|
|
/**
|
|
/**
|
|
* 银行账户对账
|
|
* 银行账户对账
|
|
*/
|
|
*/
|
|
- public void bankAccountChecing() {
|
|
|
|
|
|
+ public void bankAccountCheck() {
|
|
List<Account> list = mySqlMapper.selectTgAccountInfo();
|
|
List<Account> list = mySqlMapper.selectTgAccountInfo();
|
|
- List<Account> wdzJc = oracleMapper.getWdzJc();
|
|
|
|
- List<Account> wdzBf = oracleMapper.getWdzBf();
|
|
|
|
- List<String> strs = new ArrayList<>();
|
|
|
|
- strs.add("银行名称;银行编号;已计算余额;系统未对账的交存;系统未对账的拨付;其他金额;账户余额;差值");
|
|
|
|
- //处理特殊的对账
|
|
|
|
- //1、寿光农商银行 缺失的 定金626475.6 (银行流水号 = 041002202216625184199811) 手续费0.44(银行流水号= 041002202216655621675571) (总的楼栋户的合计 比 账户余额少 这两笔 需要加上这两笔 )
|
|
|
|
- //2、中国建设银行股份有限公司寿光支行 bankCode:02 手续费 -200(银行流水号= 021002202216625378315471) (总的楼栋户的合计 比对完账的账户余额 多200 总的楼栋户合计需要加上这个-200)
|
|
|
|
- //3、中国邮政储蓄银行股份有限公司寿光市支行 利息186893.99 (银行流水号=161002202316730870521161) (总的楼栋户的合计 比账户余额少这一笔 总的楼栋户合计需要加上这个 186893.99)
|
|
|
|
- List<String> serialNumbers = new ArrayList<>();
|
|
|
|
- serialNumbers.add("041002202216625184199811");
|
|
|
|
- serialNumbers.add("041002202216655621675571");
|
|
|
|
- serialNumbers.add("021002202216625378315471");
|
|
|
|
- serialNumbers.add("161002202316730870521161");
|
|
|
|
- List<Account> tsList = mySqlMapper.selectTsDzByserial(serialNumbers);
|
|
|
|
|
|
+ List<Account> payments = oracleMapper.getWdzJc();
|
|
|
|
+ List<Account> appropriations = oracleMapper.getWdzBf();
|
|
|
|
+
|
|
|
|
+ List<String> systemOut = new ArrayList<>();
|
|
|
|
+ systemOut.add("银行名称;银行编号;交存;支出;未对账交存;未对账支出;计算;账户余额;差值");
|
|
for (Account account : list) {
|
|
for (Account account : list) {
|
|
|
|
|
|
- //未对账的交存
|
|
|
|
- BigDecimal jc = BigDecimal.ZERO;
|
|
|
|
- if (wdzJc != null && !wdzJc.isEmpty()) {
|
|
|
|
- Account jcAccount = wdzJc.stream().filter(t -> !StringUtils.isEmpty(t.getBankCode()) && t.getBankCode().equals(account.getBankCode())).findFirst().orElse(null);
|
|
|
|
- jc = null != jcAccount ? jcAccount.getBalance() : BigDecimal.ZERO;
|
|
|
|
|
|
+ BigDecimal payment = BigDecimal.ZERO;
|
|
|
|
+ BigDecimal appropriation = BigDecimal.ZERO;
|
|
|
|
+
|
|
|
|
+ List<BankBill> bills = mySqlMapper.selectAccountBill(account.getAccount());
|
|
|
|
+
|
|
|
|
+ for (BankBill item : bills) {
|
|
|
|
+ if (item.getType().equals(1)) {
|
|
|
|
+ payment = payment.add(item.getAmount());
|
|
|
|
+ }
|
|
|
|
+ if (item.getType().equals(2)) {
|
|
|
|
+ appropriation = appropriation.add(item.getAmount());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //未对账的拨付
|
|
|
|
- BigDecimal bf = BigDecimal.ZERO;
|
|
|
|
- if (wdzBf != null && !wdzBf.isEmpty()) {
|
|
|
|
- Account bfAccount = wdzBf.stream().filter(t -> !StringUtils.isEmpty(t.getBankCode()) && t.getBankCode().equals(account.getBankCode())).findFirst().orElse(null);
|
|
|
|
- bf = null != bfAccount ? bfAccount.getBalance() : BigDecimal.ZERO;
|
|
|
|
|
|
+
|
|
|
|
+ // 未对账的交存
|
|
|
|
+ BigDecimal notPayment = BigDecimal.ZERO;
|
|
|
|
+ for (Account item : payments) {
|
|
|
|
+ if (item.getBankCode().equals(account.getBankCode())) {
|
|
|
|
+ notPayment = notPayment.add(item.getBalance());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- //当前托管户 的其他类型的 对账金额
|
|
|
|
- BigDecimal otherTypeAmount = BigDecimal.ZERO;
|
|
|
|
- Account otherTypeAccount = tsList.stream().filter(t -> !StringUtils.isEmpty(t.getBankCode()) && t.getBankCode().equals(account.getBankCode())).findFirst().orElse(null);
|
|
|
|
- if (otherTypeAccount != null) {
|
|
|
|
- otherTypeAmount = otherTypeAccount.getBalance();
|
|
|
|
- otherTypeAmount = null != otherTypeAmount ? otherTypeAccount.getBalance() : BigDecimal.ZERO;
|
|
|
|
|
|
+
|
|
|
|
+ //未对账的拨付
|
|
|
|
+ BigDecimal notAppropriation = BigDecimal.ZERO;
|
|
|
|
+ for (Account item : appropriations) {
|
|
|
|
+ if (item.getBankCode().equals(account.getBankCode())) {
|
|
|
|
+ notAppropriation = notAppropriation.add(item.getBalance());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
StringBuilder str = new StringBuilder();
|
|
StringBuilder str = new StringBuilder();
|
|
str.append(account.getBankName())
|
|
str.append(account.getBankName())
|
|
.append(";" + account.getBankCode())
|
|
.append(";" + account.getBankCode())
|
|
- .append(";" + account.getBalance())
|
|
|
|
- .append(";" + jc)
|
|
|
|
- .append(";" + bf)
|
|
|
|
- .append(";" + otherTypeAmount)
|
|
|
|
|
|
+ .append(";" + payment)
|
|
|
|
+ .append(";" + appropriation)
|
|
|
|
+ .append(";" + notPayment)
|
|
|
|
+ .append(";" + notAppropriation)
|
|
|
|
+ .append(";" + payment.subtract(appropriation))
|
|
.append(";" + account.getAccountBalance())
|
|
.append(";" + account.getAccountBalance())
|
|
- .append(";" + ((account.getBalance().subtract(jc)).add(bf).add(otherTypeAmount)).subtract(account.getAccountBalance()));
|
|
|
|
- strs.add(str.toString());
|
|
|
|
|
|
+ .append(";" + (payment.subtract(appropriation)).subtract(account.getAccountBalance()));
|
|
|
|
+ systemOut.add(str.toString());
|
|
}
|
|
}
|
|
|
|
|
|
- for (String str : strs) {
|
|
|
|
|
|
+ for (String str : systemOut) {
|
|
System.out.println(str);
|
|
System.out.println(str);
|
|
}
|
|
}
|
|
}
|
|
}
|