Fix Nomenclature matching by adding suffix comparison and optimize declarableCode check.

This commit is contained in:
Jan 2025-11-10 13:13:09 +01:00
parent 87cf07fb88
commit 8afdefe8d4

View file

@ -43,7 +43,7 @@ public class NomenclatureDeConverter implements ExcelTableConverter<Nomenclature
String hsCode = goodsCode.substring(0, 10);
String suffix = goodsCode.substring(11, 13);
Nomenclature nomenclature = nomenclatures.stream().filter(n -> n.getHscode().equals(hsCode)).findAny().orElse(null);
Nomenclature nomenclature = nomenclatures.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).findAny().orElse(null);
NomenclatureFootnoteWrapper footnoteWrapper = nomenclatureFootnoteWrappers.stream().filter(n -> n.getHsCode().equals(hsCode) && n.getSuffix().equals(suffix)).findFirst().orElse(null);
NomenclatureDesc descEn = nomenclatureDescEn.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).map(NomenclatureDescEnWrapper::getDesc).findFirst().orElse(null);
NomenclatureDesc descFr = nomenclatureDescFr.stream().filter(n -> n.getHscode().equals(hsCode) && n.getSuffix().equals(suffix)).map(NomenclatureDescFrWrapper::getDesc).findFirst().orElse(null);
@ -59,7 +59,7 @@ public class NomenclatureDeConverter implements ExcelTableConverter<Nomenclature
nomenclature = new Nomenclature(hsCode, suffix, row.getAs("Hier. Pos.", Integer.class), indent,
row.getAs("Start date", LocalDate.class), row.getAs("End date", LocalDate.class),
declarableCode == null ? false : declarableCode.getIsLeaf(),
declarableCode != null && declarableCode.getIsLeaf(),
declarableCode == null ? null : declarableCode.getDeclStartDate(),
null, null == footnoteWrapper ? null : footnoteWrapper.getNomenclatureFootnote());