fix phase3 phase4 development acceptance blockers

This commit is contained in:
2026-08-24 10:33:05 +08:00
parent 81899015cf
commit ccfd024aef
13 changed files with 112 additions and 28 deletions
@@ -1,5 +1,5 @@
package com.baiyue.firstleg.dto;
import com.baiyue.firstleg.entity.LoadingPlanItemEntity; import jakarta.validation.constraints.*; import java.math.BigDecimal; import java.util.List;
import com.baiyue.firstleg.entity.LoadingPlanItemEntity; import jakarta.validation.constraints.*; import org.apache.ibatis.annotations.AutomapConstructor; import java.math.BigDecimal; import java.util.List;
public final class SmartLoadingDtos { private SmartLoadingDtos(){}
public record InboundCandidate(Long accountId, Long inboundId, Long orderId, String orderNo, String inboundCode,
Long warehouseId, String channelCode, String channelName, Long destinationWarehouseId,
@@ -7,8 +7,10 @@ public final class SmartLoadingDtos { private SmartLoadingDtos(){}
Integer availablePackageCount, BigDecimal unitGrossWeightKg, BigDecimal unitNetWeightKg,
BigDecimal averageUnitVolumeCbm, BigDecimal availableVolumeCbm) {}
public record Candidate(Long accountId, Long inboundId, Long inboundDetailId, Long orderId, String orderNo, String inboundCode,
Long warehouseId, String channelCode, String channelName, Long destinationWarehouseId, String destinationWarehouseCode, String destinationWarehouseName, String customerName, String goodsName, Integer availablePackageCount,
Long warehouseId, String channelCode, String channelName, Long destinationWarehouseId, String destinationWarehouseCode, String destinationWarehouseName, String customerName, String goodsName, Integer availablePackageCount,
BigDecimal unitGrossWeightKg, BigDecimal unitNetWeightKg, BigDecimal unitVolumeCbm) {
@AutomapConstructor
public Candidate { }
public Candidate(Long accountId, Long inboundId, Long inboundDetailId, Long orderId, String orderNo, String inboundCode,
Long warehouseId, String destinationWarehouseCode, String customerName, String goodsName, Integer availablePackageCount,
BigDecimal unitGrossWeightKg, BigDecimal unitNetWeightKg, BigDecimal unitVolumeCbm) {
@@ -74,6 +74,15 @@ class CarrierScheduleQuerySqlContractTest {
.contains("ADD COLUMN attempt_count INT UNSIGNED NOT NULL DEFAULT 0")
.contains("ADD COLUMN next_allowed_at DATETIME(3) NULL")
.contains("ADD KEY idx_carrier_schedule_query_due (status,next_allowed_at,id)")
.contains("DROP CHECK chk_carrier_schedule_query_access")
.contains("DROP CHECK chk_carrier_schedule_query_status")
.contains("DROP INDEX uk_carrier_schedule_query_scope")
.contains("ADD UNIQUE KEY uk_carrier_schedule_query_scope")
.contains("(customer_id,ocean_booking_id,container_scope_id)")
.contains("'PUBLIC_FORM','PUBLIC_WEB_PROXY','PUBLIC_HTML','HCAPTCHA','OFFICIAL_API'")
.contains("status IN ('READY','MANUAL_REQUIRED','STOPPED')")
.contains("ARRIVED_DESTINATION_PORT")
.contains("EMPTY_RETURNED")
.contains("SET @carrier_schedule_now = CONVERT_TZ(UTC_TIMESTAMP(3),'+00:00','+08:00')")
.contains("SET @carrier_schedule_next = CASE")
.contains("CREATE PROCEDURE ensure_carrier_schedule_retry_check()")
@@ -1,6 +1,8 @@
package com.baiyue.firstleg.repository;
import com.baiyue.firstleg.mapper.SmartLoadingCandidateMapper;
import com.baiyue.firstleg.dto.SmartLoadingDtos.Candidate;
import org.apache.ibatis.annotations.AutomapConstructor;
import org.apache.ibatis.annotations.Select;
import org.junit.jupiter.api.Test;
@@ -9,6 +11,18 @@ import java.lang.reflect.Method;
import static org.assertj.core.api.Assertions.assertThat;
class SmartLoadingCandidateMapperContractTest {
@Test
void canonicalCandidateConstructorIsTheUniqueMybatisAutomapTarget() {
long annotated = java.util.Arrays.stream(Candidate.class.getDeclaredConstructors())
.filter(constructor -> constructor.isAnnotationPresent(AutomapConstructor.class))
.count();
assertThat(annotated).isEqualTo(1);
assertThat(java.util.Arrays.stream(Candidate.class.getDeclaredConstructors())
.filter(constructor -> constructor.isAnnotationPresent(AutomapConstructor.class))
.findFirst().orElseThrow().getParameterCount()).isEqualTo(18);
}
@Test
void selectsLatestApprovedBatch() throws Exception {
Method list = SmartLoadingCandidateMapper.class.getDeclaredMethod("candidates", long.class);