fix: expose phase2 terminal inbound billing

This commit is contained in:
2026-08-08 11:46:20 +08:00
parent ef4e1d6015
commit 0113d19274
8 changed files with 52 additions and 11 deletions
@@ -29,7 +29,7 @@ public class MerchantInboundBillingController {
@GetMapping("/{orderId}/inbound-billing")
@PreAuthorize("hasAuthority('merchant:order:view')")
@Operation(summary = "查询订单入库结果和最新费用",
description = "客户只读查看客服审核通过后发布的费用,不需要确认费用。")
description = "客户只读查看已达到 WAIT_SPLIT + APPROVED + CONFIRMED 的二期费用,不需要确认费用。")
public ApiResponse<MerchantInboundBillingResponse> find(
@AuthenticationPrincipal AuthenticatedUser user, @PathVariable long orderId) {
return ApiResponse.success(service.find(FirstlegScopeGuard.merchant(user), orderId));
@@ -20,6 +20,8 @@ public final class InboundProcessStatus {
public static final String INBOUNDING = "INBOUNDING";
/** 已入库完成,费用已发送给客户。 */
public static final String INBOUNDED = "INBOUNDED";
/** 二期处理完成,等待三期分柜。 */
public static final String WAIT_SPLIT = "WAIT_SPLIT";
/** 已进入装柜作业,PDA 可执行拣货。 */
public static final String LOADING = "LOADING";
/** 装柜完成,等待派送完成。 */
@@ -31,7 +33,7 @@ public final class InboundProcessStatus {
public static final Set<String> VALUES = Set.of(
WAIT_MEASURE, MEASURING, MEASURE_PENDING, MEASURE_REJECTED,
WAIT_PRICING, FEE_CONFIRMING, INBOUNDING, INBOUNDED,
WAIT_PRICING, FEE_CONFIRMING, INBOUNDING, INBOUNDED, WAIT_SPLIT,
LOADING, LOADED, DELIVERED, VOIDED
);
@@ -10,6 +10,7 @@ import com.baiyue.firstleg.dto.InboundMeasurementResponses;
import com.baiyue.firstleg.dto.InboundOrderDetail;
import com.baiyue.firstleg.dto.FbaPricingDtos.FeeSnapshotResponse;
import com.baiyue.firstleg.client.MeasurementImageClient;
import com.baiyue.firstleg.domain.InboundProcessStatus;
import com.baiyue.firstleg.entity.InboundOrderEntity;
import com.baiyue.firstleg.entity.InboundFeeDetailEntity;
import com.baiyue.firstleg.repository.InboundOrderRepository;
@@ -37,7 +38,7 @@ public class MerchantInboundBillingService {
if (inbound == null) {
throw new BizException(ResultCode.NOT_FOUND, "订单尚未生成入库单");
}
if (!"INBOUNDED".equals(inbound.getProcessStatus()) || !"SENT".equals(inbound.getFeeStatus())) {
if (!isPublished(inbound)) {
throw new BizException(ResultCode.NOT_FOUND, "入库费用尚未由客服审核并发布");
}
InboundOrderDetail platformDetail = orders.detail(tenantId, inbound);
@@ -106,12 +107,18 @@ public class MerchantInboundBillingService {
private InboundOrderEntity requirePublished(long tenantId, long orderId) {
InboundOrderEntity inbound = orders.findByOrderId(tenantId, orderId);
if (inbound == null) throw new BizException(ResultCode.NOT_FOUND, "订单尚未生成入库单");
if (!"INBOUNDED".equals(inbound.getProcessStatus()) || !"SENT".equals(inbound.getFeeStatus())) {
if (!isPublished(inbound)) {
throw new BizException(ResultCode.NOT_FOUND, "入库费用尚未由客服审核并发布");
}
return inbound;
}
private static boolean isPublished(InboundOrderEntity inbound) {
return InboundProcessStatus.WAIT_SPLIT.equals(inbound.getProcessStatus())
&& "APPROVED".equals(inbound.getMeasureReviewStatus())
&& "CONFIRMED".equals(inbound.getFeeStatus());
}
private String previewUrl(long orderId, long fileId) {
return "/api/merchant/v1/first-leg/orders/" + orderId
+ "/inbound-billing/images/" + fileId;