update:建行龙支付账单获取动态提取第一行数据
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
package com.saye.hospitalgd.scheduler.jobMethod;
|
package com.saye.hospitalgd.scheduler.jobMethod;
|
||||||
|
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
|
||||||
import com.saye.hospitalgd.commons.date.DateDUtil;
|
import com.saye.hospitalgd.commons.date.DateDUtil;
|
||||||
import com.saye.hospitalgd.commons.getBean.GetBeanUtil;
|
import com.saye.hospitalgd.commons.getBean.GetBeanUtil;
|
||||||
import com.saye.hospitalgd.commons.log.LogUtil;
|
import com.saye.hospitalgd.commons.log.LogUtil;
|
||||||
@@ -24,14 +23,13 @@ import org.apache.http.entity.StringEntity;
|
|||||||
import org.apache.http.impl.client.CloseableHttpClient;
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
import org.apache.http.impl.client.HttpClients;
|
import org.apache.http.impl.client.HttpClients;
|
||||||
import org.apache.http.util.EntityUtils;
|
import org.apache.http.util.EntityUtils;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.DocumentHelper;
|
import org.dom4j.DocumentHelper;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.nio.charset.Charset;
|
import java.nio.charset.Charset;
|
||||||
@@ -512,25 +510,53 @@ public class BankGetDataMethodByJHLZF {
|
|||||||
log.info("继续执行程序3");
|
log.info("继续执行程序3");
|
||||||
List<BankbillHistory> bankbillHistoryList = new ArrayList<>();
|
List<BankbillHistory> bankbillHistoryList = new ArrayList<>();
|
||||||
|
|
||||||
// 跳过前24行(Excel的前24行是标题和说明,第24行是表头,从第25行开始是数据)
|
int startIndex = -1;
|
||||||
for (int i = 24; i < txtList.size(); i++) {
|
for (int i = 0; i < txtList.size(); i++) {
|
||||||
|
String line = txtList.get(i);
|
||||||
|
if (line == null || line.trim().isEmpty()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] cols = line.split("\t");
|
||||||
|
if (cols.length < 10) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
dateStr = cols.length > 13 ? cols[13].trim() : "";
|
||||||
|
if (dateStr == null || dateStr.isEmpty() || !dateStr.contains("-")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String firstAmountStr = cols.length > 20 ? cols[20].trim() : "";
|
||||||
|
if (firstAmountStr.isEmpty() || firstAmountStr.equals("null") || firstAmountStr.equals("0") || firstAmountStr.equals("0.00")) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
String d = txtList.get(i);
|
double firstAmount = Double.parseDouble(firstAmountStr);
|
||||||
|
if (Math.abs(firstAmount) < 0.01) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
startIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (startIndex == -1) {
|
||||||
|
startIndex = 24;
|
||||||
|
}
|
||||||
|
for (int i = startIndex; i < txtList.size(); i++) {
|
||||||
|
try {
|
||||||
|
String d = txtList.get(i);
|
||||||
|
|
||||||
// 跳过空行
|
|
||||||
if (d == null || d.trim().isEmpty()) {
|
if (d == null || d.trim().isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] s1 = d.split("\t");
|
String[] s1 = d.split("\t");
|
||||||
|
|
||||||
// 跳过列数不足的行(至少需要10列才能有交易金额)
|
|
||||||
if (s1.length < 10) {
|
if (s1.length < 10) {
|
||||||
log.debug("第 " + (i + 1) + " 行列数不足,跳过");
|
log.debug("第 " + (i + 1) + " 行列数不足,跳过");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否是汇总行(包含"小计"、"合计"、"终端小计"等关键字)
|
|
||||||
String rowText = d.toLowerCase();
|
String rowText = d.toLowerCase();
|
||||||
if (rowText.contains("小计") || rowText.contains("合计") ||
|
if (rowText.contains("小计") || rowText.contains("合计") ||
|
||||||
rowText.contains("终端小计") || rowText.contains("pos编号") ||
|
rowText.contains("终端小计") || rowText.contains("pos编号") ||
|
||||||
@@ -540,7 +566,6 @@ public class BankGetDataMethodByJHLZF {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查第13列(交易日期,Excel的N列)是否为空
|
|
||||||
if (s1.length <= 13 || s1[13] == null || s1[13].trim().isEmpty()) {
|
if (s1.length <= 13 || s1[13] == null || s1[13].trim().isEmpty()) {
|
||||||
log.debug("第 " + (i + 1) + " 行交易日期为空,跳过");
|
log.debug("第 " + (i + 1) + " 行交易日期为空,跳过");
|
||||||
continue;
|
continue;
|
||||||
@@ -548,20 +573,17 @@ public class BankGetDataMethodByJHLZF {
|
|||||||
|
|
||||||
String jyrq = s1[13].trim();
|
String jyrq = s1[13].trim();
|
||||||
|
|
||||||
// 检查第13列是否包含日期(简单检查是否包含"-")
|
|
||||||
if (!jyrq.contains("-")) {
|
if (!jyrq.contains("-")) {
|
||||||
log.debug("第 " + (i + 1) + " 行交易日期不包含日期分隔符,跳过");
|
log.debug("第 " + (i + 1) + " 行交易日期不包含日期分隔符,跳过");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查交易金额列(第20列,对应Excel的U列)是否有效
|
|
||||||
String amountStr = s1.length > 20 ? s1[20].trim() : "";
|
String amountStr = s1.length > 20 ? s1[20].trim() : "";
|
||||||
if (amountStr.isEmpty() || amountStr.equals("null") || amountStr.equals("0") || amountStr.equals("0.00")) {
|
if (amountStr.isEmpty() || amountStr.equals("null") || amountStr.equals("0") || amountStr.equals("0.00")) {
|
||||||
log.debug("第 " + (i + 1) + " 行交易金额无效: [" + amountStr + "],跳过");
|
log.debug("第 " + (i + 1) + " 行交易金额无效: [" + amountStr + "],跳过");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 尝试解析金额,确保是有效数字
|
|
||||||
try {
|
try {
|
||||||
double amount = Double.parseDouble(amountStr);
|
double amount = Double.parseDouble(amountStr);
|
||||||
if (Math.abs(amount) < 0.01) {
|
if (Math.abs(amount) < 0.01) {
|
||||||
@@ -575,7 +597,7 @@ public class BankGetDataMethodByJHLZF {
|
|||||||
|
|
||||||
log.info("正在处理第 " + (i + 1) + " 行数据");
|
log.info("正在处理第 " + (i + 1) + " 行数据");
|
||||||
|
|
||||||
BankbillHistory bankbillHistory = new BankbillHistory();
|
BankbillHistory bankbillHistory = new BankbillHistory();
|
||||||
|
|
||||||
// 根据实际Excel列位置映射(从日志分析得出):
|
// 根据实际Excel列位置映射(从日志分析得出):
|
||||||
// 终端号: C列(索引2), 发卡行: E列(索引4), 卡种: I列(索引8),
|
// 终端号: C列(索引2), 发卡行: E列(索引4), 卡种: I列(索引8),
|
||||||
|
|||||||
@@ -279,7 +279,7 @@
|
|||||||
|
|
||||||
<!-- 医保对账:按险种和清算类别分组统计(去重规则:HisTransId + ZFAmount 都相同才视为同一记录)
|
<!-- 医保对账:按险种和清算类别分组统计(去重规则:HisTransId + ZFAmount 都相同才视为同一记录)
|
||||||
1. 医疗总金额(MEDFEE_SUMAMT):统计同一收据号(HisTransId)且同一自费金额(ZFAmount)下的金额,累计统筹 + 非退款账户 + 自费
|
1. 医疗总金额(MEDFEE_SUMAMT):统计同一收据号(HisTransId)且同一自费金额(ZFAmount)下的金额,累计统筹 + 非退款账户 + 自费
|
||||||
2. 统筹金额(FUND_PAY_SUMAMT):累计统筹金额(不受退款影响)
|
2. 统筹金额(FUND_PAY_SUMAMT):累计统筹金额应该受退款影响,如果与退款统筹金额也要退款所以统计的时候统筹金额也要减去(不受退款影响)
|
||||||
3. 账户金额(ACCT_PAY):累计账户金额(包含退款) -->
|
3. 账户金额(ACCT_PAY):累计账户金额(包含退款) -->
|
||||||
<select id="findMedicalInsuranceGroupData" parameterType="HashMap" resultType="HashMap">
|
<select id="findMedicalInsuranceGroupData" parameterType="HashMap" resultType="HashMap">
|
||||||
select
|
select
|
||||||
|
|||||||
Reference in New Issue
Block a user