feat(fleet): enforce reviewed trips and original fee coverage for dispatch
This commit is contained in:
-24
@@ -1,24 +0,0 @@
|
||||
package com.baiyue.lastleg.delivery.model;
|
||||
|
||||
import com.baiyue.lastleg.delivery.dto.DeliveryDocumentDtos.*;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import java.util.*;
|
||||
|
||||
/** Saved metadata only; listing never calls File and never counts pending uploads. */
|
||||
public final class DeliveryDocumentSnapshot {
|
||||
private static final ObjectMapper JSON = new ObjectMapper().findAndRegisterModules();
|
||||
private DeliveryDocumentSnapshot() { }
|
||||
public static List<Category> categories(String json) {
|
||||
if (json == null || json.isBlank()) return Arrays.stream(DeliveryDocumentCategory.values())
|
||||
.map(category -> new Category(category, "MISSING", 0, List.of())).toList();
|
||||
try { return JSON.readValue(json, new TypeReference<List<Category>>() { }); }
|
||||
catch (JsonProcessingException e) { throw new IllegalStateException("派送资料快照损坏", e); }
|
||||
}
|
||||
public static Summary summary(String json) {
|
||||
List<Category> categories = categories(json);
|
||||
return new Summary((int) categories.stream().filter(c -> !c.files().isEmpty()).count(), 3,
|
||||
categories.stream().map(c -> new CategorySummary(c.category(), c.status(), c.fileCount())).toList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user