优化
This commit is contained in:
@@ -22,6 +22,13 @@ public interface MeasurementImageClient {
|
||||
@PathVariable long inboundId,
|
||||
@RequestPart("file") MultipartFile file);
|
||||
|
||||
@PostMapping(value = "/receipts/{tenantId}/{receiptId}", consumes = "multipart/form-data")
|
||||
ApiResponse<UploadResult> uploadReceipt(@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@RequestHeader("X-Operator-Id") long operatorId,
|
||||
@PathVariable long tenantId,
|
||||
@PathVariable long receiptId,
|
||||
@RequestPart("file") MultipartFile file);
|
||||
|
||||
@DeleteMapping("/{tenantId}/{inboundId}/{fileId}")
|
||||
ApiResponse<Void> delete(@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@RequestHeader("X-Operator-Id") long operatorId,
|
||||
@@ -29,6 +36,13 @@ public interface MeasurementImageClient {
|
||||
@PathVariable long inboundId,
|
||||
@PathVariable long fileId);
|
||||
|
||||
@DeleteMapping("/receipts/{tenantId}/{receiptId}/{fileId}")
|
||||
ApiResponse<Void> deleteReceipt(@RequestHeader("X-Internal-Service-Token") String token,
|
||||
@RequestHeader("X-Operator-Id") long operatorId,
|
||||
@PathVariable long tenantId,
|
||||
@PathVariable long receiptId,
|
||||
@PathVariable long fileId);
|
||||
|
||||
@GetMapping("/{tenantId}/{inboundId}/{fileId}")
|
||||
org.springframework.http.ResponseEntity<byte[]> download(
|
||||
@RequestHeader("X-Internal-Service-Token") String token,
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import jakarta.annotation.Resource;
|
||||
|
||||
import com.baiyue.common.core.api.ApiResponse;
|
||||
import com.baiyue.firstleg.dto.OpenApiMeasurementDtos.EventResponse;
|
||||
import com.baiyue.firstleg.dto.CartonMeasurementResult;
|
||||
import com.baiyue.firstleg.dto.MojiaMeasurementDtos.UploadResponse;
|
||||
import com.baiyue.firstleg.security.MeasurementRequestHeaders;
|
||||
import com.baiyue.firstleg.service.InboundMeasurementOpenApiService;
|
||||
import com.baiyue.firstleg.service.MojiaMeasurementOpenApiService;
|
||||
@@ -45,7 +45,7 @@ public class OpenApiInboundMeasurementController {
|
||||
@Operation(summary = "墨家设备按箱码上传单箱测量结果",
|
||||
description = "首轮联调使用固定 X-App-Key;JSON 中 picture 为 JPEG Data URL,boxCode 原样取自柏悦箱唛二维码")
|
||||
@PostMapping(consumes = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ApiResponse<CartonMeasurementResult> receiveMojia(
|
||||
public ApiResponse<UploadResponse> receiveMojia(
|
||||
@RequestHeader("X-App-Key") String appKey,
|
||||
@RequestHeader(value = "X-Timestamp", required = false) String timestamp,
|
||||
@RequestHeader(value = "X-Nonce", required = false) String nonce,
|
||||
|
||||
@@ -25,4 +25,16 @@ public final class MojiaMeasurementDtos {
|
||||
@NotBlank @Size(max = 7_100_000) String picture
|
||||
) {
|
||||
}
|
||||
|
||||
public record UploadResponse(
|
||||
boolean accepted,
|
||||
boolean matched,
|
||||
Long receiptId,
|
||||
Long measurementId,
|
||||
Long itemId,
|
||||
String boxCode,
|
||||
Long imageFileId,
|
||||
boolean created
|
||||
) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.baiyue.firstleg.dto;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
@@ -13,6 +14,8 @@ public record UnifiedInboundQuery(
|
||||
Long tenantId,
|
||||
@Size(max = 64) String keyword,
|
||||
@Size(max = 64) String orderNo,
|
||||
@Schema(allowableValues = {"PENDING_REVIEW", "WAIT_MEASURE", "INBOUNDED", "WAIT_SPLIT",
|
||||
"LOADING", "LOADED", "DELIVERED"})
|
||||
@Size(max = 32) String mainStatus,
|
||||
Long customerId,
|
||||
Long receivingWarehouseId,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.baiyue.firstleg.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/** 墨家回传未匹配正式入库单时的联调收件记录。 */
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("fl_mojia_measurement_receipt")
|
||||
public class MojiaMeasurementReceiptEntity {
|
||||
@TableId(type = IdType.INPUT)
|
||||
private Long id;
|
||||
private Long tenantId;
|
||||
private Long subjectId;
|
||||
private String boxCode;
|
||||
private BigDecimal lengthCm;
|
||||
private BigDecimal widthCm;
|
||||
private BigDecimal heightCm;
|
||||
private BigDecimal weightKg;
|
||||
private String machineNo;
|
||||
private LocalDateTime measuredAt;
|
||||
private Long imageFileId;
|
||||
private String status;
|
||||
private String matchFailureCode;
|
||||
private String matchFailureReason;
|
||||
private String requestId;
|
||||
private String traceId;
|
||||
private LocalDateTime createdAt;
|
||||
private LocalDateTime updatedAt;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.baiyue.firstleg.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baiyue.firstleg.entity.MojiaMeasurementReceiptEntity;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface MojiaMeasurementReceiptMapper extends BaseMapper<MojiaMeasurementReceiptEntity> {
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.baiyue.firstleg.repository;
|
||||
|
||||
import com.baiyue.firstleg.entity.MojiaMeasurementReceiptEntity;
|
||||
import com.baiyue.firstleg.mapper.MojiaMeasurementReceiptMapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
@Repository
|
||||
public class MojiaMeasurementReceiptRepository {
|
||||
private final MojiaMeasurementReceiptMapper mapper;
|
||||
|
||||
public MojiaMeasurementReceiptRepository(MojiaMeasurementReceiptMapper mapper) {
|
||||
this.mapper = mapper;
|
||||
}
|
||||
|
||||
public void insert(MojiaMeasurementReceiptEntity receipt) {
|
||||
if (mapper.insert(receipt) != 1) {
|
||||
throw new IllegalStateException("墨家联调收件记录保存失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
+6
-9
@@ -18,8 +18,6 @@ import java.util.List;
|
||||
public class CustomerDimensionWeightingService {
|
||||
private static final BigDecimal TWO = new BigDecimal("2");
|
||||
private static final BigDecimal CUBIC_CENTIMETERS_PER_CBM = new BigDecimal("1000000");
|
||||
private static final String OVERSIZE_WARNING =
|
||||
"实测尺寸超出客户最大箱规,已按实测尺寸记录,需人工复核";
|
||||
|
||||
private final CustomerDimensionConfigRepository repository;
|
||||
|
||||
@@ -64,16 +62,16 @@ public class CustomerDimensionWeightingService {
|
||||
.filter(rule -> rule.contains(measured))
|
||||
.findFirst()
|
||||
.map(Rule::weighted)
|
||||
.orElseGet(() -> actualOversize(lengthCm, widthCm, heightCm));
|
||||
.orElseGet(() -> actualDimensions(lengthCm, widthCm, heightCm));
|
||||
}
|
||||
|
||||
private WeightedDimensions actualOversize(BigDecimal lengthCm, BigDecimal widthCm,
|
||||
BigDecimal heightCm) {
|
||||
private WeightedDimensions actualDimensions(BigDecimal lengthCm, BigDecimal widthCm,
|
||||
BigDecimal heightCm) {
|
||||
BigDecimal rawVolume = lengthCm.multiply(widthCm).multiply(heightCm)
|
||||
.divide(CUBIC_CENTIMETERS_PER_CBM, 6, RoundingMode.HALF_UP);
|
||||
return new WeightedDimensions(null, null, lengthCm, widthCm, heightCm,
|
||||
rawVolume, rawVolume.setScale(3, RoundingMode.HALF_UP),
|
||||
"ACTUAL_DIMENSION_OVERSIZE_V1", OVERSIZE_WARNING);
|
||||
"ACTUAL_DIMENSION_V1");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,8 +83,7 @@ public class CustomerDimensionWeightingService {
|
||||
BigDecimal outerHeightCm,
|
||||
BigDecimal rawVolumeCbm,
|
||||
BigDecimal unitVolumeCbm,
|
||||
String calculationRuleVersion,
|
||||
String warning
|
||||
String calculationRuleVersion
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -123,7 +120,7 @@ public class CustomerDimensionWeightingService {
|
||||
.divide(CUBIC_CENTIMETERS_PER_CBM, 6, RoundingMode.HALF_UP);
|
||||
BigDecimal unitVolume = rawVolume.setScale(3, RoundingMode.HALF_UP);
|
||||
return new WeightedDimensions(boxType, version, outerLength, outerWidth, outerHeight,
|
||||
rawVolume, unitVolume, "CUSTOMER_DIMENSION_" + boxType.name() + "_V" + version, null);
|
||||
rawVolume, unitVolume, "CUSTOMER_DIMENSION_" + boxType.name() + "_V" + version);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -163,8 +163,7 @@ public class MeasurementBatchService {
|
||||
item.setVolumeWeightKg(totalVolume.multiply(VOLUME_WEIGHT_FACTOR).setScale(3, RoundingMode.CEILING));
|
||||
item.setCalculationRuleVersion(weighted.calculationRuleVersion());
|
||||
item.setSourceImageFileId(source.intelligentImageFileId());
|
||||
item.setOverLimitWarning(weighted.warning() == null
|
||||
? source.overLimitWarning() : weighted.warning());
|
||||
item.setOverLimitWarning(source.overLimitWarning());
|
||||
item.setOuterLengthCm(weighted.outerLengthCm());
|
||||
item.setOuterWidthCm(weighted.outerWidthCm());
|
||||
item.setOuterHeightCm(weighted.outerHeightCm());
|
||||
|
||||
+96
-8
@@ -1,10 +1,16 @@
|
||||
package com.baiyue.firstleg.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
||||
import com.baiyue.common.core.api.ApiResponse;
|
||||
import com.baiyue.common.core.api.ResultCode;
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.firstleg.client.MeasurementImageClient;
|
||||
import com.baiyue.firstleg.dto.CartonMeasurementCommand;
|
||||
import com.baiyue.firstleg.dto.CartonMeasurementResult;
|
||||
import com.baiyue.firstleg.dto.MojiaMeasurementDtos.UploadRequest;
|
||||
import com.baiyue.firstleg.dto.MojiaMeasurementDtos.UploadResponse;
|
||||
import com.baiyue.firstleg.entity.MojiaMeasurementReceiptEntity;
|
||||
import com.baiyue.firstleg.repository.MojiaMeasurementReceiptRepository;
|
||||
import com.baiyue.firstleg.security.AuthenticatedMeasurementApp;
|
||||
import com.baiyue.firstleg.security.MeasurementRequestAuthenticator;
|
||||
import com.baiyue.firstleg.security.MeasurementRequestHeaders;
|
||||
@@ -16,6 +22,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.slf4j.MDC;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -39,36 +46,54 @@ public class MojiaMeasurementOpenApiService {
|
||||
private final CartonMeasurementService cartonMeasurements;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final Validator validator;
|
||||
private final MeasurementImageClient imageClient;
|
||||
private final MojiaMeasurementReceiptRepository receipts;
|
||||
|
||||
@Value("${baiyue.security.internal-service-token}")
|
||||
private String internalToken;
|
||||
|
||||
public MojiaMeasurementOpenApiService(MeasurementRequestAuthenticator authenticator,
|
||||
CartonMeasurementService cartonMeasurements,
|
||||
ObjectMapper objectMapper,
|
||||
Validator validator) {
|
||||
Validator validator,
|
||||
MeasurementImageClient imageClient,
|
||||
MojiaMeasurementReceiptRepository receipts) {
|
||||
this.authenticator = authenticator;
|
||||
this.cartonMeasurements = cartonMeasurements;
|
||||
this.objectMapper = objectMapper;
|
||||
this.validator = validator;
|
||||
this.imageClient = imageClient;
|
||||
this.receipts = receipts;
|
||||
}
|
||||
|
||||
public CartonMeasurementResult receive(MeasurementRequestHeaders headers, String rawJson) {
|
||||
public UploadResponse receive(MeasurementRequestHeaders headers, String rawJson) {
|
||||
UploadRequest request = null;
|
||||
try {
|
||||
AuthenticatedMeasurementApp app = authenticator.authenticate(
|
||||
"POST", CALLBACK_PATH, headers, rawJson, false);
|
||||
request = parseAndValidate(rawJson);
|
||||
MultipartFile image = decodeJpeg(request.picture());
|
||||
CartonMeasurementResult result = cartonMeasurements.upsert(
|
||||
app.tenantId(), app.subjectId(), new CartonMeasurementCommand(
|
||||
request.boxCode(), request.length(), request.width(), request.height(), request.weight(),
|
||||
request.machineNo(), request.measuredAt() == null ? LocalDateTime.now() : request.measuredAt(),
|
||||
image));
|
||||
CartonMeasurementResult result;
|
||||
try {
|
||||
result = cartonMeasurements.upsert(
|
||||
app.tenantId(), app.subjectId(), new CartonMeasurementCommand(
|
||||
request.boxCode(), request.length(), request.width(), request.height(), request.weight(),
|
||||
request.machineNo(), request.measuredAt() == null ? LocalDateTime.now() : request.measuredAt(),
|
||||
image));
|
||||
} catch (BizException exception) {
|
||||
if (exception.getResultCode() == ResultCode.NOT_FOUND) {
|
||||
return saveUnmatched(app, request, image, exception);
|
||||
}
|
||||
throw exception;
|
||||
}
|
||||
log.info("MOJIA_MEASUREMENT accepted requestId={} traceId={} boxCode={} machineNo={} "
|
||||
+ "lengthCm={} widthCm={} heightCm={} weightKg={} imageBytes={} measurementId={} "
|
||||
+ "itemId={} created={}",
|
||||
correlation("requestId"), correlation("traceId"), safe(request.boxCode()),
|
||||
safe(request.machineNo()), request.length(), request.width(), request.height(), request.weight(),
|
||||
image.getSize(), result.measurementId(), result.itemId(), result.created());
|
||||
return result;
|
||||
return new UploadResponse(true, true, null, result.measurementId(), result.itemId(),
|
||||
result.boxCode(), result.imageFileId(), result.created());
|
||||
} catch (RuntimeException exception) {
|
||||
String code = exception instanceof BizException biz ? biz.getResultCode().code() : "S0500";
|
||||
log.warn("MOJIA_MEASUREMENT rejected requestId={} traceId={} boxCode={} machineNo={} "
|
||||
@@ -81,6 +106,69 @@ public class MojiaMeasurementOpenApiService {
|
||||
}
|
||||
}
|
||||
|
||||
private UploadResponse saveUnmatched(AuthenticatedMeasurementApp app, UploadRequest request,
|
||||
MultipartFile image, BizException matchFailure) {
|
||||
long receiptId = IdWorker.getId();
|
||||
MeasurementImageClient.UploadResult uploaded = uploadReceiptImage(
|
||||
app.tenantId(), app.subjectId(), receiptId, image);
|
||||
try {
|
||||
MojiaMeasurementReceiptEntity receipt = new MojiaMeasurementReceiptEntity();
|
||||
receipt.setId(receiptId);
|
||||
receipt.setTenantId(app.tenantId());
|
||||
receipt.setSubjectId(app.subjectId());
|
||||
receipt.setBoxCode(request.boxCode().trim());
|
||||
receipt.setLengthCm(request.length());
|
||||
receipt.setWidthCm(request.width());
|
||||
receipt.setHeightCm(request.height());
|
||||
receipt.setWeightKg(request.weight());
|
||||
receipt.setMachineNo(request.machineNo().trim());
|
||||
receipt.setMeasuredAt(request.measuredAt() == null ? LocalDateTime.now() : request.measuredAt());
|
||||
receipt.setImageFileId(uploaded.fileId());
|
||||
receipt.setStatus("UNMATCHED");
|
||||
receipt.setMatchFailureCode(matchFailure.getResultCode().code());
|
||||
receipt.setMatchFailureReason(safe(matchFailure.getMessage()));
|
||||
receipt.setRequestId(correlation("requestId"));
|
||||
receipt.setTraceId(correlation("traceId"));
|
||||
receipt.setCreatedAt(LocalDateTime.now());
|
||||
receipt.setUpdatedAt(LocalDateTime.now());
|
||||
receipts.insert(receipt);
|
||||
} catch (RuntimeException exception) {
|
||||
cleanupReceiptImage(app.tenantId(), app.subjectId(), receiptId, uploaded.fileId());
|
||||
throw exception;
|
||||
}
|
||||
log.info("MOJIA_MEASUREMENT accepted requestId={} traceId={} boxCode={} machineNo={} "
|
||||
+ "matched=false receiptId={} imageBytes={} imageFileId={} matchCode={}",
|
||||
correlation("requestId"), correlation("traceId"), safe(request.boxCode()),
|
||||
safe(request.machineNo()), receiptId, image.getSize(), uploaded.fileId(),
|
||||
matchFailure.getResultCode().code());
|
||||
return new UploadResponse(true, false, receiptId, null, null, request.boxCode(),
|
||||
uploaded.fileId(), true);
|
||||
}
|
||||
|
||||
private MeasurementImageClient.UploadResult uploadReceiptImage(long tenantId, long operatorId,
|
||||
long receiptId, MultipartFile image) {
|
||||
try {
|
||||
ApiResponse<MeasurementImageClient.UploadResult> response = imageClient.uploadReceipt(
|
||||
internalToken, operatorId, tenantId, receiptId, image);
|
||||
if (response == null || !response.successful() || response.data() == null
|
||||
|| response.data().fileId() == null) {
|
||||
throw new BizException(ResultCode.SERVICE_UNAVAILABLE, "墨家联调图片保存失败");
|
||||
}
|
||||
return response.data();
|
||||
} catch (feign.FeignException exception) {
|
||||
throw new BizException(ResultCode.SERVICE_UNAVAILABLE, "文件服务暂不可用,墨家回传未保存");
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanupReceiptImage(long tenantId, long operatorId, long receiptId, long fileId) {
|
||||
try {
|
||||
imageClient.deleteReceipt(internalToken, operatorId, tenantId, receiptId, fileId);
|
||||
} catch (RuntimeException exception) {
|
||||
log.warn("墨家联调收件图片补偿删除失败 tenantId={} receiptId={} fileId={}",
|
||||
tenantId, receiptId, fileId, exception);
|
||||
}
|
||||
}
|
||||
|
||||
private UploadRequest parseAndValidate(String rawJson) {
|
||||
if (rawJson == null || rawJson.isBlank()) {
|
||||
throw new BizException(ResultCode.VALIDATION_FAILED, "请求 JSON 不能为空");
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class UnifiedInboundQueryService {
|
||||
private static final Set<String> MAIN_STATUSES = Set.of(
|
||||
"PENDING_REVIEW", "WAIT_MEASURE", "INBOUNDED", "LOADING", "LOADED", "DELIVERED");
|
||||
"PENDING_REVIEW", "WAIT_MEASURE", "INBOUNDED", "WAIT_SPLIT", "LOADING", "LOADED", "DELIVERED");
|
||||
private static final Set<String> REVIEW_STATUSES = Set.of("UNRECORDED", "PENDING", "APPROVED", "REJECTED");
|
||||
|
||||
@Resource private InboundOrderRepository inbounds;
|
||||
@@ -71,10 +71,14 @@ public class UnifiedInboundQueryService {
|
||||
private List<UnifiedInboundSummary> summaries(List<InboundOrderEntity> records) {
|
||||
Map<Long, Long> owners = records.stream().collect(Collectors.toMap(
|
||||
InboundOrderEntity::getId, InboundOrderEntity::getTenantId, (left, right) -> left));
|
||||
var preloads = operations.findPreloads(owners);
|
||||
var picks = operations.findPicks(owners);
|
||||
var evidences = operations.findEvidence(owners);
|
||||
var deliveries = operations.findDeliveryHistory(owners);
|
||||
Map<Long, Long> phaseThreeOwners = records.stream()
|
||||
.filter(inbound -> requiresPhaseThreeSummary(mainStatus(inbound.getProcessStatus())))
|
||||
.collect(Collectors.toMap(
|
||||
InboundOrderEntity::getId, InboundOrderEntity::getTenantId, (left, right) -> left));
|
||||
var preloads = operations.findPreloads(phaseThreeOwners);
|
||||
var picks = operations.findPicks(phaseThreeOwners);
|
||||
var evidences = operations.findEvidence(phaseThreeOwners);
|
||||
var deliveries = operations.findDeliveryHistory(phaseThreeOwners);
|
||||
var transports = operations.findTransports(owners);
|
||||
return records.stream().map(inbound -> summary(inbound, null, preloads.get(inbound.getId()),
|
||||
picks.get(inbound.getId()), evidences.getOrDefault(inbound.getId(), List.of()),
|
||||
@@ -120,8 +124,8 @@ public class UnifiedInboundQueryService {
|
||||
if (status == null) return null;
|
||||
return switch (status) {
|
||||
case "WAIT_MEASURE", "MEASURING", "MEASURE_PENDING", "MEASURE_REJECTED" -> "WAIT_MEASURE";
|
||||
// WAIT_SPLIT is retained only to normalize records created before status unification.
|
||||
case "WAIT_PRICING", "FEE_CONFIRMING", "INBOUNDING", "WAIT_SPLIT", "INBOUNDED" -> "INBOUNDED";
|
||||
case "WAIT_PRICING", "FEE_CONFIRMING", "INBOUNDING", "INBOUNDED" -> "INBOUNDED";
|
||||
case "WAIT_SPLIT" -> "WAIT_SPLIT";
|
||||
case "LOADING", "LOADED", "DELIVERED" -> status;
|
||||
default -> null;
|
||||
};
|
||||
@@ -132,9 +136,10 @@ public class UnifiedInboundQueryService {
|
||||
return switch (mainStatus) {
|
||||
case "PENDING_REVIEW" -> "APPROVE_ORDER";
|
||||
case "WAIT_MEASURE" -> "MEASURE_PENDING".equals(processStatus) ? "CONFIRM_MEASUREMENT" : null;
|
||||
case "INBOUNDED" -> !List.of("INBOUNDED", "WAIT_SPLIT").contains(processStatus) ? null
|
||||
case "INBOUNDED" -> !"INBOUNDED".equals(processStatus) ? null
|
||||
: "CONFIRMED".equals(preloadStatus) ? null
|
||||
: preloadStatus == null ? "SMART_SPLIT" : "CONFIRM_PRELOAD";
|
||||
case "WAIT_SPLIT" -> null;
|
||||
case "LOADING" -> "COMPLETE_LOADING";
|
||||
case "LOADED" -> "COMPLETE_DELIVERY";
|
||||
case "DELIVERED" -> null;
|
||||
@@ -142,11 +147,16 @@ public class UnifiedInboundQueryService {
|
||||
};
|
||||
}
|
||||
|
||||
static boolean requiresPhaseThreeSummary(String mainStatus) {
|
||||
return mainStatus != null && Set.of("LOADING", "LOADED", "DELIVERED").contains(mainStatus);
|
||||
}
|
||||
|
||||
private List<String> internalStatuses(String mainStatus) {
|
||||
if (!StringUtils.hasText(mainStatus)) return List.of();
|
||||
return switch (mainStatus) {
|
||||
case "WAIT_MEASURE" -> List.of("WAIT_MEASURE", "MEASURING", "MEASURE_PENDING", "MEASURE_REJECTED");
|
||||
case "INBOUNDED" -> List.of("WAIT_PRICING", "FEE_CONFIRMING", "INBOUNDING", "WAIT_SPLIT", "INBOUNDED");
|
||||
case "INBOUNDED" -> List.of("WAIT_PRICING", "FEE_CONFIRMING", "INBOUNDING", "INBOUNDED");
|
||||
case "WAIT_SPLIT" -> List.of("WAIT_SPLIT");
|
||||
case "LOADING", "LOADED", "DELIVERED" -> List.of(mainStatus);
|
||||
default -> List.of("__NO_MATCH__");
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user