修改时间3

This commit is contained in:
xuelijun
2026-01-28 15:06:41 +08:00
parent ed4e2b1a58
commit 49e75c5b67

View File

@@ -262,20 +262,35 @@ public class CompletedTodayCrawler implements PageProcessor {
if (resultStr == null) {
return "未知";
}
if (resultStr.contains("") || resultStr.contains("+")) {
// 1. 首先解析数字金额
Double amount = parseNumeric(resultStr);
// 方法2通过数字正负判断
if (amount > 0) {
return "";
} else if (resultStr.contains("") || resultStr.contains("-")) {
} else if (amount < 0) {
return "";
} else if (resultStr.contains("") || resultStr.contains("0")) {
return "";
} else if (resultStr.contains("取消")) {
return "取消";
} else {
return "未知";
}
}
/**
* 解析数值
*/
private Double parseNumeric(String numericStr) {
try {
if (numericStr == null || numericStr.isEmpty()) {
return 0.0;
}
// 移除非数字字符(保留小数点和负号)
String cleaned = numericStr.replaceAll("[^\\d.-]", "");
return cleaned.isEmpty() ? 0.0 : Double.parseDouble(cleaned);
} catch (Exception e) {
return 0.0;
}
}
/**
* 解析结果金额
*/