Selaa lähdekoodia

导出储运中心车次信息根据字典转换牌号信息

lingpeng.li 3 kuukautta sitten
vanhempi
sitoutus
c507dd6edf

+ 25 - 1
zgztBus/jeecg-module-sbm/src/main/java/org/jeecg/modules/carUnit/service/impl/CarUnitServiceImpl.java

@@ -106,6 +106,30 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
         return "其他";
     }
 
+    public static String getBrandNum(String value) {
+        if (StringUtils.isBlank(value)) return "";
+
+        ISysDictItemService sysDictItemService = SpringContextUtils.getBean(ISysDictItemService.class);
+
+        // 查询 car_unit_type 下所有字典项(item_text + item_value)
+        String dictId = getDictId("billet_spec");
+        if (StringUtils.isBlank(dictId)) return "未知";
+
+        List<SysDictItem> sysDictItems = sysDictItemService.list(
+                new LambdaQueryWrapper<SysDictItem>()
+                        .eq(SysDictItem::getDictId, dictId)
+        );
+
+        // 遍历匹配 unitCode 是否在 item_value 中
+        for (SysDictItem item : sysDictItems) {
+            if (value.equals(item.getItemValue())) {
+                return item.getItemText();
+            }
+        }
+
+        return "未知";
+    }
+
 
     private static StorageCenterExportRow convert(StorageCenterHeatNoInvoicingVO.RollChargeDetail detail, Integer ccmNo, String endpoint) {
         StorageCenterExportRow row = new StorageCenterExportRow();
@@ -121,7 +145,7 @@ public class CarUnitServiceImpl extends ServiceImpl<CarUnitMapper, CarUnit> impl
         row.setTransportUnit(getTransportUnitNameByCarNumber(detail.getLicensePlate()));
         row.setWeightPerPiece(calcWeightPerPiece(detail.getWeight(), detail.getAmount()));
         row.setSpec(detail.getSpec());
-        row.setBrand(detail.getBrandNum());
+        row.setBrand(getBrandNum(detail.getBrandNum()));
 
         return row;
     }