Parcourir la source

调整车辆管理导入模板格式

zx il y a 3 mois
Parent
commit
25929763c5

+ 4 - 3
ruoyi-powerdistribution/src/main/java/com/ruoyi/powerdistribution/controller/PdmVehicleDrivingRecordController.java

@@ -16,6 +16,7 @@ import com.alibaba.fastjson.JSON;
 import com.opencsv.CSVReader;
 import com.opencsv.exceptions.CsvValidationException;
 import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.common.utils.StringUtils;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -139,9 +140,9 @@ public class PdmVehicleDrivingRecordController extends BaseController
                        vehicleDrivingRecord.setEquipNm(nextLine[1]);
                        vehicleDrivingRecord.setEquipNo(nextLine[2]);
                        vehicleDrivingRecord.setVehicleNo(nextLine[3]);
-                       vehicleDrivingRecord.setStartTm(DateUtils.covertStrToLocalTime(nextLine[4]));
-                       vehicleDrivingRecord.setEndTm(DateUtils.covertStrToLocalTime(nextLine[5]));
-                       vehicleDrivingRecord.setMileage(new BigDecimal(nextLine[6]));
+                       vehicleDrivingRecord.setStartTm(nextLine[4]);
+                       vehicleDrivingRecord.setEndTm(nextLine[5]);
+                       vehicleDrivingRecord.setMileage(StringUtils.isNotEmpty(nextLine[6])?new BigDecimal(nextLine[6]):new BigDecimal(0));
                        dataList.add(vehicleDrivingRecord);
                    }
                    i++;