优化
This commit is contained in:
+24
-2
@@ -7,6 +7,7 @@ import com.baiyue.lastleg.delivery.model.DeliveryCargoGroups;
|
||||
import com.baiyue.lastleg.delivery.repository.DispatchDeliveryRepository;
|
||||
import com.baiyue.lastleg.delivery.service.DispatchDeliveryFees;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchContracts.CargoLine;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchContracts.SourceOrigin;
|
||||
import com.baiyue.lastleg.dispatch.port.DispatchDeliveryModels.*;
|
||||
import com.baiyue.lastleg.financefee.dto.OverseasFeeSourceDtos;
|
||||
import com.baiyue.lastleg.financefee.service.OverseasFeeSourceService;
|
||||
@@ -80,7 +81,7 @@ class DispatchDeliveryFeesTest {
|
||||
var first=firstleg(cargo(1,"101","ONT8",51,2));var raw=firstleg(cargo(2,"101","ONT8",51,3));
|
||||
var second=new CargoLine(raw.dispatchItemId(),raw.customerId(),raw.customerName(),raw.orderId(),raw.orderNo(),raw.sourceKey(),raw.sourceStage(),
|
||||
raw.sourceRegion(),"502",raw.inboundCode(),raw.planPalletId(),raw.warehousePalletId(),raw.palletNo(),raw.pickId(),raw.attributionId(),raw.inventoryPositionId(),
|
||||
raw.receiptId(),raw.returnReceiptId(),raw.returnCartonId(),raw.cartonMark(),raw.relabelNo(),raw.destination(),raw.packages(),raw.productQuantity(),raw.grossWeightKg(),raw.volumeCbm(),raw.batchAllocations());
|
||||
raw.receiptId(),raw.returnReceiptId(),raw.returnCartonId(),raw.cartonMark(),raw.relabelNo(),raw.destination(),raw.packages(),raw.productQuantity(),raw.grossWeightKg(),raw.volumeCbm(),raw.batchAllocations(),raw.sourceOrigin());
|
||||
var group=grouping.groups(context(List.of(first,second),false)).get(0);
|
||||
when(finance.sources(anyString(),any())).thenReturn(ApiResponse.success(List.of(original(101))));
|
||||
var input=input(group,List.of(new CoverageSelection(71L,1,"FEE-HASH",List.of("DELIVERY_FEE"))),List.of());
|
||||
@@ -92,6 +93,27 @@ class DispatchDeliveryFeesTest {
|
||||
input(group,List.of(input.feeCoverage().get(0),input.feeCoverage().get(0)),List.of()),"OP",ordinary()));
|
||||
}
|
||||
|
||||
/** 多个换标原货源共组费用只归真实派送,不借第一票原货源或履约单伪造单一归属。 */
|
||||
@Test void relabelFeeRetainsDeliveryReferenceWithoutInventingOneOrigin() {
|
||||
var first=new SourceOrigin(10001L,201L,301L,401L,701L,"IN-701","CODE-701",null);
|
||||
var second=new SourceOrigin(10002L,202L,302L,402L,702L,"IN-702","CODE-702",null);
|
||||
var context=context(List.of(relabelCargo(1,"101","ONT8",51,2,first),
|
||||
relabelCargo(3,"101","ONT8",51,3,second)),false);
|
||||
var group=grouping.groups(context).get(0);
|
||||
var delivery=new DeliveryOrder();delivery.setId(81L);delivery.setDeliveryNo("DL-101");
|
||||
delivery.setCustomerId("101");delivery.setOverseasWarehouseId("1001");
|
||||
service.publish(context,group,input(group,List.of(),List.of(fee("RECEIVABLE"))),delivery,null,ordinary(),"OP","ARR-RELABEL");
|
||||
var saved=ArgumentCaptor.forClass(OverseasFeeSourceDtos.SaveRequest.class);
|
||||
verify(sources).publishApproved(eq("OP"),anyString(),saved.capture());
|
||||
assertEquals("DELIVERY_ORDER",saved.getValue().businessType());
|
||||
assertEquals(81L,saved.getValue().businessId());assertEquals("DL-101",saved.getValue().businessNo());
|
||||
assertEquals("101",saved.getValue().customerId());
|
||||
assertNull(saved.getValue().orderId());assertNull(saved.getValue().inboundId());assertNull(saved.getValue().inboundCode());
|
||||
assertEquals(List.of(first,second),group.cargo().stream().map(CargoLine::sourceOrigin).toList());
|
||||
assertTrue(group.cargo().stream().allMatch(c->c.sourceOrigin().productQuantity()==null&&c.grossWeightKg()==null&&c.volumeCbm()==null));
|
||||
assertEquals(5,group.packages());assertEquals(1,group.palletCount());
|
||||
}
|
||||
|
||||
/** 只读平台候选接口仍拒绝客户身份,不能借组结果跨客户访问。 */
|
||||
@Test void readOnlyCoverageControllerRejectsMerchantBeforeQuery() throws Exception {
|
||||
var delivery=mock(com.baiyue.lastleg.delivery.service.DispatchDeliveryService.class);
|
||||
@@ -109,7 +131,7 @@ class DispatchDeliveryFeesTest {
|
||||
/** 真实头程关联只在来源行声明,不从展示编号推断。 */
|
||||
private CargoLine firstleg(CargoLine c) { return new CargoLine(c.dispatchItemId(),c.customerId(),c.customerName(),c.orderId(),c.orderNo(),c.sourceKey(),c.sourceStage(),
|
||||
"FIRSTLEG","501",c.inboundCode(),c.planPalletId(),c.warehousePalletId(),c.palletNo(),c.pickId(),c.attributionId(),c.inventoryPositionId(),c.receiptId(),
|
||||
c.returnReceiptId(),c.returnCartonId(),c.cartonMark(),c.relabelNo(),c.destination(),c.packages(),c.productQuantity(),c.grossWeightKg(),c.volumeCbm(),c.batchAllocations()); }
|
||||
c.returnReceiptId(),c.returnCartonId(),c.cartonMark(),c.relabelNo(),c.destination(),c.packages(),c.productQuantity(),c.grossWeightKg(),c.volumeCbm(),c.batchAllocations(),c.sourceOrigin()); }
|
||||
/** 输入仅使用共同ArrangeGroup,不保留旧单客户协议别名。 */
|
||||
private ArrangeGroup input(DeliveryCargoGroups.Group group,List<CoverageSelection> coverage,List<FeeItem> fees) {
|
||||
return new ArrangeGroup(group.key(),group.cargoHash(),DEPARTED,"TRUCK",null,null,"WAREHOUSE_PICKUP","PALLET",null,null,null,null,null,"freight",group.cargoHash(),coverage,fees);
|
||||
|
||||
Reference in New Issue
Block a user