瀏覽代碼

修复车辆单位null异常

weijianghai 1 周之前
父節點
當前提交
21a485a1a5

+ 3 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/rx/CarBaoFeiMonthTask.java

@@ -203,9 +203,9 @@ public class CarBaoFeiMonthTask {
             String cheLiangSuoShuDanWei = map.get("che_liang_suo_shu_dan_wei");
             CarUnitBo carUnitBo = carService.getCarUnitBo(cheLiangSuoShuDanWei);
             String firstUnit = carService.getFirstUnit(carUnitBo);
-            if (!StringUtils.hasText(firstUnit)) {
-                throw new MyRuntimeException("车辆单位错误:" + rawChePaiHao + " " + cheLiangSuoShuDanWei);
-            }
+//            if (!StringUtils.hasText(firstUnit)) {
+//                throw new MyRuntimeException("车辆单位错误:" + rawChePaiHao + " " + cheLiangSuoShuDanWei);
+//            }
             map.put("first_unit", firstUnit);
             String secondUnit = carService.getSecondUnit(carUnitBo, firstUnit);
             map.put("second_unit", secondUnit);

+ 3 - 0
src/main/java/com/nokia/finance/tasks/service/car/CarService.java

@@ -173,6 +173,9 @@ public class CarService {
      * @param carUnitBo 单位
      */
     public String getFirstUnit(CarUnitBo carUnitBo) {
+        if (carUnitBo == null) {
+            return null;
+        }
         return FIRST_UNIT_MAP.get(carUnitBo.getFirstUnit());
     }