Procházet zdrojové kódy

feat: 移动前判断md5文件是否存在

weijianghai před 1 rokem
rodič
revize
dbd4a29fb8

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarBaoXianJob.java

@@ -247,9 +247,11 @@ public class CarBaoXianJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarBaoXianHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarBaoXianHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarBaoXianHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarDaWeiXiuJob.java

@@ -244,9 +244,11 @@ public class CarDaWeiXiuJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarDaWeiXiuHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarDaWeiXiuHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarDaWeiXiuHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarLuQiaoJob.java

@@ -243,9 +243,11 @@ public class CarLuQiaoJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarLuQiaoHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarLuQiaoHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarLuQiaoHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarNianJianFeiJob.java

@@ -243,9 +243,11 @@ public class CarNianJianFeiJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarNianJianFeiHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarNianJianFeiHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarNianJianFeiHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarQiTaJob.java

@@ -243,9 +243,11 @@ public class CarQiTaJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarQiTaHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarQiTaHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarQiTaHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarRanYouJob.java

@@ -245,9 +245,11 @@ public class CarRanYouJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarRanYouHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarRanYouHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarRanYouHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarWeiXiuJob.java

@@ -244,9 +244,11 @@ public class CarWeiXiuJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarWeiXiuHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarWeiXiuHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarWeiXiuHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 1 - 1
src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarWuDanYongCheJob.java

@@ -103,7 +103,7 @@ public class CarWuDanYongCheJob {
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
         copyCsv(csvPath);
-//        move(path);
+        move(path);
     }
 
     /**

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/shujucangku/CarFeeBsJob.java

@@ -173,9 +173,11 @@ public class CarFeeBsJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarFeeBsHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarFeeBsHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarFeeBsHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 5 - 3
src/main/java/com/nokia/finance/tasks/jobs/car/shujucangku/CarFeeHbJob.java

@@ -173,9 +173,11 @@ public class CarFeeHbJob {
      * @param path 源文件路径
      */
     public void move(Path path) throws Exception {
-        Files.move(Paths.get(path + ".MD5"),
-                Paths.get(jobConfig.getCarFeeHbHistoryPath(), path.getFileName().toString() + ".MD5"),
-                StandardCopyOption.REPLACE_EXISTING);
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarFeeHbHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
         Files.move(path, Paths.get(jobConfig.getCarFeeHbHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }

+ 7 - 1
src/main/java/com/nokia/finance/tasks/service/JobService.java

@@ -14,6 +14,7 @@ import com.nokia.finance.tasks.jobs.car.ruixing.CarLiChengMonthJob;
 import com.nokia.finance.tasks.jobs.car.ruixing.CarWuDanYongCheJob;
 import com.nokia.finance.tasks.jobs.car.ruixing.CarYongCheJob;
 import com.nokia.finance.tasks.jobs.car.ruixing.CarYueJieJob;
+import com.nokia.finance.tasks.jobs.car.shujucangku.CarFeeBsJob;
 import com.nokia.finance.tasks.jobs.car.shujucangku.CarFeeHbJob;
 import com.nokia.finance.tasks.jobs.house.chengben.HouseBuildingRepairMonthJob;
 import com.nokia.finance.tasks.pojo.RunJobDto;
@@ -35,6 +36,7 @@ public class JobService {
     private final CarNianJianFeiJob carNianJianFeiJob;
     private final CarQiTaJob carQiTaJob;
     private final CarFeeHbJob carFeeHbJob;
+    private final CarFeeBsJob carFeeBsJob;
     private final HouseBuildingRepairMonthJob houseBuildingRepairMonthJob;
 
     public JobService(CarBaseDataDayJob carBaseDataDayJob, CarYueJieJob carYueJieJob, CarBaoFeiJob carBaoFeiJob,
@@ -42,7 +44,7 @@ public class JobService {
                       CarYongCheJob carYongCheJob, CarRanYouJob carRanYouJob, CarDaWeiXiuJob carDaWeiXiuJob,
                       CarWeiXiuJob carWeiXiuJob, CarLuQiaoJob carLuQiaoJob, CarBaoXianJob carBaoXianJob,
                       CarNianJianFeiJob carNianJianFeiJob, CarQiTaJob carQiTaJob, CarFeeHbJob carFeeHbJob,
-                      HouseBuildingRepairMonthJob houseBuildingRepairMonthJob) {
+                      CarFeeBsJob carFeeBsJob, HouseBuildingRepairMonthJob houseBuildingRepairMonthJob) {
         this.carBaseDataDayJob = carBaseDataDayJob;
         this.carYueJieJob = carYueJieJob;
         this.carBaoFeiJob = carBaoFeiJob;
@@ -57,6 +59,7 @@ public class JobService {
         this.carNianJianFeiJob = carNianJianFeiJob;
         this.carQiTaJob = carQiTaJob;
         this.carFeeHbJob = carFeeHbJob;
+        this.carFeeBsJob = carFeeBsJob;
         this.houseBuildingRepairMonthJob = houseBuildingRepairMonthJob;
     }
 
@@ -104,6 +107,9 @@ public class JobService {
             case CAR_FEE_HB_JOB:
                 carFeeHbJob.runJob();
                 break;
+            case CAR_FEE_BS_JOB:
+                carFeeBsJob.runJob();
+                break;
             case HOUSE_BUILDING_REPAIR_MONTH_JOB:
                 houseBuildingRepairMonthJob.runJob();
                 break;

+ 3 - 0
src/main/resources/application.yml

@@ -0,0 +1,3 @@
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl