优化
This commit is contained in:
@@ -29,6 +29,7 @@ import java.util.stream.Collectors;
|
||||
public class UnifiedInboundQueryService {
|
||||
private static final Set<String> MAIN_STATUSES = Set.of(
|
||||
"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;
|
||||
@Resource private UnifiedInboundReadRepository operations;
|
||||
@@ -171,5 +172,14 @@ public class UnifiedInboundQueryService {
|
||||
throw new com.baiyue.common.core.exception.BizException(
|
||||
com.baiyue.common.core.api.ResultCode.BAD_REQUEST, "创建时间起点不能晚于终点");
|
||||
}
|
||||
if (StringUtils.hasText(query.feeReviewStatus()) && !REVIEW_STATUSES.contains(query.feeReviewStatus())) {
|
||||
throw new com.baiyue.common.core.exception.BizException(
|
||||
com.baiyue.common.core.api.ResultCode.BAD_REQUEST, "费用审核状态不合法");
|
||||
}
|
||||
if (StringUtils.hasText(query.measurementReviewStatus())
|
||||
&& !REVIEW_STATUSES.contains(query.measurementReviewStatus())) {
|
||||
throw new com.baiyue.common.core.exception.BizException(
|
||||
com.baiyue.common.core.api.ResultCode.BAD_REQUEST, "测量审核状态不合法");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -1,8 +1,11 @@
|
||||
package com.baiyue.firstleg.service;
|
||||
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.firstleg.dto.UnifiedInboundQuery;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
class UnifiedInboundQueryServiceTest {
|
||||
@Test
|
||||
@@ -37,4 +40,15 @@ class UnifiedInboundQueryServiceTest {
|
||||
.isEqualTo("COMPLETE_DELIVERY");
|
||||
assertThat(UnifiedInboundQueryService.nextAction("DELIVERED", "DELIVERED", null)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
void rejectsUnknownReviewStatusBeforeRepositoryQuery() {
|
||||
UnifiedInboundQuery query = new UnifiedInboundQuery(
|
||||
null, null, null, null, null, null, null, null,
|
||||
null, null, "UNKNOWN", null, null, null, null, null, null, "INVALID",
|
||||
null, null, null, 1, 20);
|
||||
|
||||
assertThatThrownBy(() -> new UnifiedInboundQueryService().page(query))
|
||||
.isInstanceOf(BizException.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ components:
|
||||
in: query
|
||||
required: false
|
||||
description: 当前最高版本入库费用审核状态;UNRECORDED 表示尚无费用记录
|
||||
schema: {type: string, maxLength: 32}
|
||||
schema: {type: string, enum: [UNRECORDED, PENDING, APPROVED, REJECTED]}
|
||||
UnifiedChannelName:
|
||||
{name: channelName, in: query, required: false, schema: {type: string, maxLength: 128}}
|
||||
UnifiedContainerNo:
|
||||
@@ -265,7 +265,7 @@ components:
|
||||
in: query
|
||||
required: false
|
||||
description: 测量审核状态;UNRECORDED 表示字段为空
|
||||
schema: {type: string, maxLength: 32}
|
||||
schema: {type: string, enum: [UNRECORDED, PENDING, APPROVED, REJECTED]}
|
||||
UnifiedFbaCode:
|
||||
name: fbaCode
|
||||
in: query
|
||||
|
||||
Reference in New Issue
Block a user