优化
This commit is contained in:
+13
@@ -103,6 +103,19 @@ class CustomerDimensionConfigSqlContractTest {
|
||||
.contains("客户尺寸计算配置权限码、固定ID或父节点不正确");
|
||||
}
|
||||
|
||||
@Test
|
||||
void measurementRuleVersionFitsAllBoxTypeNamesAndUpgradesExistingTables() throws Exception {
|
||||
String schema = resource("db/phase2-inbound-schema.sql");
|
||||
String unified = Files.readString(
|
||||
Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql"),
|
||||
StandardCharsets.UTF_8);
|
||||
|
||||
assertThat(schema).contains("calculation_rule_version VARCHAR(64) NOT NULL");
|
||||
assertThat(unified)
|
||||
.contains("calculation_rule_version VARCHAR(64) NOT NULL")
|
||||
.contains("MODIFY COLUMN calculation_rule_version VARCHAR(64) NOT NULL");
|
||||
}
|
||||
|
||||
@Test
|
||||
void unifiedMigrationUpgradesOnlyRecognizedLegacyTableAndBackfillsIdempotently() throws Exception {
|
||||
String sql = Files.readString(Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql"),
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.baiyue.firstleg.repository;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baiyue.firstleg.entity.LoadingPickTaskEntity;
|
||||
import com.baiyue.firstleg.loading.entity.InboundLoadingPickTaskEntity;
|
||||
import com.baiyue.firstleg.loading.mapper.InboundLoadingPickTaskMapper;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
class LoadingPickTaskMappingContractTest {
|
||||
@Test
|
||||
void detailedAndInboundPickEntitiesUseDistinctTables() {
|
||||
assertThat(LoadingPickTaskEntity.class.getAnnotation(TableName.class).value())
|
||||
.isEqualTo("fl_loading_pick_task");
|
||||
assertThat(InboundLoadingPickTaskEntity.class.getAnnotation(TableName.class).value())
|
||||
.isEqualTo("fl_inbound_loading_pick_task")
|
||||
.isNotEqualTo(LoadingPickTaskEntity.class.getAnnotation(TableName.class).value());
|
||||
}
|
||||
|
||||
@Test
|
||||
void inboundMapperUsesInboundTaskTableAndFields() throws Exception {
|
||||
Method method = InboundLoadingPickTaskMapper.class.getDeclaredMethod(
|
||||
"changeStatus", long.class, long.class, String.class, String.class,
|
||||
long.class, String.class, String.class, Integer.class, Integer.class, int.class);
|
||||
String sql = method.getAnnotation(Update.class).value()[0];
|
||||
|
||||
assertThat(sql)
|
||||
.contains("UPDATE fl_inbound_loading_pick_task")
|
||||
.contains("tenant_id=#{tenantId}")
|
||||
.contains("inbound_id=#{inboundId}")
|
||||
.doesNotContain("fl_loading_pick_task");
|
||||
}
|
||||
}
|
||||
@@ -112,6 +112,30 @@ class CartonMeasurementServiceTest {
|
||||
verify(images).delete("internal-token", 90001L, 10001L, 70001L, 88001L);
|
||||
}
|
||||
|
||||
@Test
|
||||
void oversizeScanKeepsImageAndActualDimensionsForManualReview() {
|
||||
InboundMeasurementEntity measurement = measurement(30001L, "RECEIVED", 0);
|
||||
when(repository.findItemByBoxCode(10001L, "RK-001#5-1")).thenReturn(null);
|
||||
when(repository.findLatestEditableMeasurement(10001L, 70001L)).thenReturn(measurement);
|
||||
when(repository.listItems(10001L, 30001L)).thenAnswer(invocation -> List.of(insertedItem.get()));
|
||||
when(repository.updateMeasurement(measurement)).thenReturn(true);
|
||||
CartonMeasurementCommand oversize = new CartonMeasurementCommand(
|
||||
"RK-001#5-1", new BigDecimal("60.100"), new BigDecimal("50.100"),
|
||||
new BigDecimal("50.100"), new BigDecimal("12.500"), "MJ-01",
|
||||
LocalDateTime.parse("2026-08-07T10:30:00"),
|
||||
new MockMultipartFile("image", "measure.jpg", "image/jpeg", "image".getBytes()));
|
||||
|
||||
CartonMeasurementResult result = service.upsert(10001L, 90001L, oversize);
|
||||
|
||||
assertThat(result.created()).isTrue();
|
||||
assertThat(insertedItem.get().getSourceImageFileId()).isEqualTo(99001L);
|
||||
assertThat(insertedItem.get().getLengthCm()).isEqualByComparingTo("60.100");
|
||||
assertThat(insertedItem.get().getCalculationRuleVersion())
|
||||
.isEqualTo("ACTUAL_DIMENSION_OVERSIZE_V1");
|
||||
assertThat(insertedItem.get().getOverLimitWarning()).contains("人工复核");
|
||||
verify(images, never()).delete(any(), any(Long.TYPE), any(Long.TYPE), any(Long.TYPE), any(Long.TYPE));
|
||||
}
|
||||
|
||||
@Test
|
||||
void submittedInboundRejectsDeviceBeforeUploadingImage() {
|
||||
when(repository.findInbound(10001L, 70001L)).thenReturn(inbound("MEASURE_PENDING"));
|
||||
|
||||
Reference in New Issue
Block a user