fix(firstleg): keep published billing visible after loading

This commit is contained in:
2026-08-29 11:00:19 +08:00
parent 3339ec91f9
commit 775dd71227
5 changed files with 51 additions and 9 deletions
@@ -29,7 +29,9 @@ public class MerchantInboundBillingController {
@GetMapping("/{orderId}/inbound-billing")
@PreAuthorize("hasAuthority('merchant:order:view')")
@Operation(summary = "查询订单入库结果和最新费用",
description = "客户只读查看已达到 WAIT_SPLIT + APPROVED + CONFIRMED 的二期费用,不需要确认费用。")
description = "客户按登录态客户范围只读查看;入库流程达到 WAIT_SPLIT 后,"
+ "在 LOADING、LOADED、DELIVERED 仍持续可见,且始终要求 APPROVED + CONFIRMED "
+ "并存在已发布入库运费明细,不需要客户确认费用。")
public ApiResponse<MerchantInboundBillingResponse> find(
@AuthenticationPrincipal AuthenticatedUser user, @PathVariable long orderId) {
return ApiResponse.success(service.find(FirstlegScopeGuard.merchant(user), orderId));
@@ -17,9 +17,16 @@ import com.baiyue.firstleg.repository.InboundOrderRepository;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Set;
@Service
public class MerchantInboundBillingService {
private static final Set<String> PUBLISHED_BILLING_PROCESS_STATUSES = Set.of(
InboundProcessStatus.WAIT_SPLIT,
InboundProcessStatus.LOADING,
InboundProcessStatus.LOADED,
InboundProcessStatus.DELIVERED);
@Resource
private InboundOrderRepository orders;
@Resource
@@ -41,6 +48,7 @@ public class MerchantInboundBillingService {
if (!isPublished(inbound)) {
throw new BizException(ResultCode.NOT_FOUND, "入库费用尚未由客服审核并发布");
}
InboundFeeDetailEntity publishedFee = feeDetails.publishedFreight(tenantId, inbound.getId());
InboundOrderDetail platformDetail = orders.detail(tenantId, inbound);
InboundOrderDetail merchantDetail = new InboundOrderDetail(
platformDetail.summary(), platformDetail.publicRemark(), platformDetail.palletLocations(),
@@ -49,7 +57,6 @@ public class MerchantInboundBillingService {
.toList(), List.of(), List.of());
InboundMeasurementResponses.Detail measurement = measurements.detail(tenantId, inbound.getId());
FeeSnapshotResponse fee = pricing.latest(tenantId, inbound.getId());
InboundFeeDetailEntity publishedFee = feeDetails.publishedFreight(tenantId, inbound.getId());
var summary = new MerchantInboundBillingResponse.MeasurementSummary(
measurement.measurementId(), measurement.sourceType(), measurement.measurementStatus(),
measurement.actualPackageCount(), measurement.actualGrossWeightKg(),
@@ -117,8 +124,7 @@ public class MerchantInboundBillingService {
}
private static boolean isPublished(InboundOrderEntity inbound) {
return (InboundProcessStatus.WAIT_SPLIT.equals(inbound.getProcessStatus())
|| "WAIT_SPLIT".equals(inbound.getProcessStatus()))
return PUBLISHED_BILLING_PROCESS_STATUSES.contains(inbound.getProcessStatus())
&& "APPROVED".equals(inbound.getMeasureReviewStatus())
&& "CONFIRMED".equals(inbound.getFeeStatus());
}