|
|
|
|
@ -294,48 +294,54 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void filterDataForModel26(List<Map<String, Object>> allData) { |
|
|
|
|
List<Map<String, Object>> filteredData = allData.stream().filter(map -> map.get("ajbh") != null).toList(); |
|
|
|
|
Map<String, List<Map<String, Object>>> groupedData = filteredData.stream().collect(Collectors.groupingBy(map -> (String) map.get("ajbh"))); |
|
|
|
|
List<Map<String, Object>> filteredData = allData.stream().filter(map -> map.get("ajbh") != null && map.get("zjhm") != null).toList(); |
|
|
|
|
Map<String, Map<String, List<Map<String, Object>>>> groupedData = filteredData.stream() |
|
|
|
|
.collect(Collectors.groupingBy( |
|
|
|
|
map -> (String) map.get("ajbh"), |
|
|
|
|
Collectors.groupingBy(map -> (String) map.get("zjhm")) |
|
|
|
|
)); |
|
|
|
|
allData.clear(); |
|
|
|
|
for (Map.Entry<String, List<Map<String, Object>>> entry : groupedData.entrySet()) { |
|
|
|
|
String ajbh = entry.getKey(); |
|
|
|
|
List<Map<String, Object>> records = entry.getValue(); |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
|
|
|
|
String earliestJRSJ = null; |
|
|
|
|
LocalDateTime earliestDateTime = LocalDateTime.MIN; |
|
|
|
|
for (Map<String, Object> record : records) { |
|
|
|
|
String jrsj = (String) record.get("jrsj"); |
|
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(jrsj, formatter); |
|
|
|
|
if (earliestJRSJ == null || !dateTime.isAfter(earliestDateTime)) { |
|
|
|
|
earliestJRSJ = jrsj; |
|
|
|
|
earliestDateTime = dateTime; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
String latestLKSJ = null; |
|
|
|
|
LocalDateTime latestDateTime = LocalDateTime.MIN; |
|
|
|
|
for (Map<String, Object> record : records) { |
|
|
|
|
String lksj = (String) record.get("lksj"); |
|
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(lksj, formatter); |
|
|
|
|
if (latestLKSJ == null || dateTime.isAfter(latestDateTime)) { |
|
|
|
|
latestLKSJ = lksj; |
|
|
|
|
latestDateTime = dateTime; |
|
|
|
|
for (Map.Entry<String, Map<String, List<Map<String, Object>>>> entry : groupedData.entrySet()) { |
|
|
|
|
for (Map.Entry<String, List<Map<String, Object>>> entry2 : entry.getValue().entrySet()) { |
|
|
|
|
String ajbh = entry2.getKey(); |
|
|
|
|
List<Map<String, Object>> records = entry2.getValue(); |
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss"); |
|
|
|
|
String earliestJRSJ = null; |
|
|
|
|
LocalDateTime earliestDateTime = LocalDateTime.MIN; |
|
|
|
|
for (Map<String, Object> record : records) { |
|
|
|
|
String jrsj = (String) record.get("jrsj"); |
|
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(jrsj, formatter); |
|
|
|
|
if (earliestJRSJ == null || !dateTime.isAfter(earliestDateTime)) { |
|
|
|
|
earliestJRSJ = jrsj; |
|
|
|
|
earliestDateTime = dateTime; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (earliestJRSJ != null && latestLKSJ != null) { |
|
|
|
|
Duration duration = Duration.between(earliestDateTime, latestDateTime); |
|
|
|
|
if (duration.toHours() >= 3) { |
|
|
|
|
continue; |
|
|
|
|
String latestLKSJ = null; |
|
|
|
|
LocalDateTime latestDateTime = LocalDateTime.MIN; |
|
|
|
|
for (Map<String, Object> record : records) { |
|
|
|
|
String lksj = (String) record.get("lksj"); |
|
|
|
|
LocalDateTime dateTime = LocalDateTime.parse(lksj, formatter); |
|
|
|
|
if (latestLKSJ == null || dateTime.isAfter(latestDateTime)) { |
|
|
|
|
latestLKSJ = lksj; |
|
|
|
|
latestDateTime = dateTime; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
Map<String, Object> newRecord = new HashMap<>(); |
|
|
|
|
newRecord.put("ajbh", ajbh); |
|
|
|
|
newRecord.put("jrsj", earliestJRSJ); |
|
|
|
|
newRecord.put("lksj", latestLKSJ); |
|
|
|
|
for (String key : records.get(0).keySet()) { |
|
|
|
|
if (!key.equals("jrsj") && !key.equals("lksj")) { |
|
|
|
|
newRecord.put(key, records.get(0).get(key)); |
|
|
|
|
if (earliestJRSJ != null && latestLKSJ != null) { |
|
|
|
|
Duration duration = Duration.between(earliestDateTime, latestDateTime); |
|
|
|
|
if (duration.toHours() >= 3) { |
|
|
|
|
continue; |
|
|
|
|
} |
|
|
|
|
Map<String, Object> newRecord = new HashMap<>(); |
|
|
|
|
newRecord.put("ajbh", ajbh); |
|
|
|
|
newRecord.put("jrsj", earliestJRSJ); |
|
|
|
|
newRecord.put("lksj", latestLKSJ); |
|
|
|
|
for (String key : records.get(0).keySet()) { |
|
|
|
|
if (!key.equals("jrsj") && !key.equals("lksj")) { |
|
|
|
|
newRecord.put(key, records.get(0).get(key)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
allData.add(newRecord); |
|
|
|
|
} |
|
|
|
|
allData.add(newRecord); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
System.out.println("模型26筛选后的alldata数量:" + allData.size()); |
|
|
|
|
|