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