Преглед на файлове

feat: 车辆报废增加字段valid,调整定时任务时间

weijianghai преди 9 месеца
родител
ревизия
c6f396d745

+ 6 - 6
src/main/java/com/nokia/finance/tasks/dao/car/CarProcedureDao.java

@@ -372,13 +372,13 @@ set
         when che_liang_lei_xing in ('特种车', '中型面包车(8-20座的面包车)', '大巴车') then 0
         when che_liang_shi_yong_xing_zhi in ('特种车', '负责人用车') then 0
         when (select exists(select 1 from car_theme.wz_f_spc_car b where a.che_pai_hao = b.card_num and b.is_spec = '1')) then 0
-        when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= #{endYearMonth})) then 0
+        when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= #{endYearMonth} and b.valid = 1)) then 0
         when bao_fei = 1 then 0
         when chu_qin_lv < 0.5 and ri_jun_li_cheng < 20 then 1
         else 0
     end,
     di_xiao_exclude_reason = case
-        when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= #{endYearMonth})) then (select max(b.year_month) from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= #{endYearMonth}) || '报废'
+        when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= #{endYearMonth} and b.valid = 1)) then (select max(b.year_month) from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= #{endYearMonth}) || '报废'
         when first_unit = '省公司本部' then '省公司本部'
         when position('建设部' in che_liang_suo_shu_dan_wei) > 0 then '建设部'
         when che_liang_lei_xing = '特种车' then '特种车'
@@ -538,7 +538,7 @@ select
         else 0
     end as di_xiao_sum,
     case
-        when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month)) then (select max(b.year_month) from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month) || '报废'
+        when (select exists(select 1 from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month and b.valid = 1)) then (select max(b.year_month) from car.car_bao_fei b where b.che_pai_hao = a.che_pai_hao and b.year_month <= a.stat_year_month) || '报废'
         when first_unit = '省公司本部' then '省公司本部'
         when position('建设部' in che_liang_suo_shu_dan_wei) > 0 then '建设部'
         when che_liang_lei_xing = '特种车' then '特种车'
@@ -1961,7 +1961,7 @@ where
         car.car_bao_fei b
     where
         b.che_pai_hao = a.che_pai_hao
-        and b.year_month <= a.year_month)
+        and b.year_month <= a.year_month and b.valid = 1)
     and year_month = #{endYearMonth}
 ),
 t102 as (
@@ -2153,7 +2153,7 @@ where
         car.car_bao_fei b
     where
         b.che_pai_hao = a.che_pai_hao
-        and b.year_month <= a.year_month)
+        and b.year_month <= a.year_month and b.valid = 1)
     and year_month = #{endYearMonth}
 ),
 t102 as (
@@ -2284,7 +2284,7 @@ where
         car.car_bao_fei b
     where
         b.che_pai_hao = a.che_pai_hao
-        and b.year_month <= a.year_month)
+        and b.year_month <= a.year_month and b.valid = 1)
     and year_month = #{endYearMonth}
 ),
 t102 as (

+ 18 - 2
src/main/java/com/nokia/finance/tasks/dao/car/CarReportDao.java

@@ -127,10 +127,18 @@ t101 as (
 select
     *
 from
-    car.car_base_data_month
+    car.car_base_data_month a
 where
     che_liang_lai_yuan = '自有车辆'
     and year_month = #{endYearMonth}
+    and not exists(
+    select
+        1
+    from
+        car.car_bao_fei b
+    where
+        b.che_pai_hao = a.che_pai_hao
+        and b.year_month <= a.year_month and b.valid = 1)
 ),
 t102 as (
 select
@@ -222,10 +230,18 @@ t101 as (
 select
     *
 from
-    car.car_base_data_month
+    car.car_base_data_month a
 where
     che_liang_lai_yuan = '自有车辆'
     and year_month = #{endYearMonth}
+    and not exists(
+    select
+        1
+    from
+        car.car_bao_fei b
+    where
+        b.che_pai_hao = a.che_pai_hao
+        and b.year_month <= a.year_month and b.valid = 1)
 ),
 t102 as (
 select

+ 2 - 2
src/main/java/com/nokia/finance/tasks/jobs/car/CarReportJob.java

@@ -88,7 +88,7 @@ public class CarReportJob {
     public void runJob() {
         try {
             log.info("执行车辆报告定时任务");
-            CarReportVo vo = getCarReportVo();
+            CarReportVo vo = getReportVo();
             // 生成docx
             generateDocx(vo);
             // 生成pdf
@@ -103,7 +103,7 @@ public class CarReportJob {
         }
     }
 
-    public CarReportVo getCarReportVo() throws IOException {
+    public CarReportVo getReportVo() throws IOException {
         LocalDate localDateNow = LocalDate.now();
         LocalDate localDateEnd = localDateNow.minusMonths(1);
         LocalDate localDateStart = localDateEnd.withDayOfYear(1);

+ 1 - 1
src/main/java/com/nokia/finance/tasks/jobs/car/procedure/CarBaseDataMonthProcJob.java

@@ -28,7 +28,7 @@ public class CarBaseDataMonthProcJob {
     /**
      * 执行任务
      */
-    @Scheduled(cron = "0 0 0 3 * ?")
+    @Scheduled(cron = "0 0 0 7 * ?")
     @Transactional(timeout = 60, rollbackFor = Exception.class)
     public void runJob() {
         try {

+ 1 - 1
src/main/java/com/nokia/finance/tasks/jobs/car/procedure/CarLiChengMonthProcJob.java

@@ -25,7 +25,7 @@ public class CarLiChengMonthProcJob {
     /**
      * 执行任务
      */
-    @Scheduled(cron = "0 2 0 3 * ?")
+    @Scheduled(cron = "0 2 0 7 * ?")
     @Transactional(timeout = 60, rollbackFor = Exception.class)
     public void runJob() {
         try {

+ 1 - 1
src/main/java/com/nokia/finance/tasks/jobs/car/procedure/CarPaiDanProcJob.java

@@ -28,7 +28,7 @@ public class CarPaiDanProcJob {
     /**
      * 执行任务
      */
-    @Scheduled(cron = "0 4 0 3 * ?")
+    @Scheduled(cron = "0 4 0 7 * ?")
     @Transactional(timeout = 60, rollbackFor = Exception.class)
     public void runJob() {
         try {

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

@@ -149,6 +149,7 @@ public class CarBaoFeiJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
@@ -251,6 +252,8 @@ public class CarBaoFeiJob {
             map.put("district_id", districtId);
             String district = carService.getAreaName(areaMap, districtId);
             map.put("district", district);
+            map.put("manual", "0");
+            map.put("valid", "1");
             map.put("source", path.getFileName().toString());
         }
         // 去重
@@ -298,7 +301,7 @@ public class CarBaoFeiJob {
     public void copyCsv(Path path) {
         String dbTable = "car.car_bao_fei";
         String csv = path.toString();
-        String columns = "(che_pai_hao,che_liang_suo_shu_dan_wei,bai_fei_lei_xing,bao_fei_biao_zhun,bao_fei_ri_qi,xing_shi_gong_li_shu,bei_zhu,zi_chan_bian_hao,zi_chan_ming_cheng,gui_ge_xing_hao,shi_ji_shi_yong_nian_xian,zi_chan_yuan_zhi_wan_yuan,lei_ji_zhe_jiu_zhi_wan_yuan,year_month,year_no,month_no,raw_che_pai_hao,che_pai_fail,first_unit,second_unit,third_unit,area_no,area_name,city_no,city_name,area_no2,area_name2,city_id,city,district_id,district,source)";
+        String columns = "(che_pai_hao,che_liang_suo_shu_dan_wei,bai_fei_lei_xing,bao_fei_biao_zhun,bao_fei_ri_qi,xing_shi_gong_li_shu,bei_zhu,zi_chan_bian_hao,zi_chan_ming_cheng,gui_ge_xing_hao,shi_ji_shi_yong_nian_xian,zi_chan_yuan_zhi_wan_yuan,lei_ji_zhe_jiu_zhi_wan_yuan,year_month,year_no,month_no,raw_che_pai_hao,che_pai_fail,first_unit,second_unit,third_unit,area_no,area_name,city_no,city_name,area_no2,area_name2,city_id,city,district_id,district,manual,valid,source)";
         Long timeout = 60000L;
         PsqlUtil.copyCsv(jobConfig.getCopyScriptPath(), jobConfig.getDbHost(), jobConfig.getDbPort(),
                 jobConfig.getDbUsername(), jobConfig.getDbPassword(), jobConfig.getDbName(), dbTable, csv, columns,

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

@@ -157,6 +157,7 @@ public class CarBaseDataDayJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行

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

@@ -147,6 +147,7 @@ public class CarLiChengDayJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行

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

@@ -159,6 +159,7 @@ public class CarLiChengMonthJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行

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

@@ -146,6 +146,7 @@ public class CarWuDanYongCheJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行

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

@@ -158,6 +158,7 @@ public class CarYongCheJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行

+ 3 - 2
src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarYueJieJob.java

@@ -106,8 +106,8 @@ public class CarYueJieJob {
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
-//        copyCsv(csvPath);
-//        move(path);
+        copyCsv(csvPath);
+        move(path);
     }
 
     /**
@@ -147,6 +147,7 @@ public class CarYueJieJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
+                move(path);
                 throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行

+ 0 - 4
src/main/java/com/nokia/finance/tasks/pojo/vo/car_report/CarReportVo.java

@@ -26,10 +26,6 @@ public class CarReportVo {
      * 当前月
      */
     private String currentMonth;
-    /**
-     * logo图片
-     */
-    private String logoImg;
     /**
      * 车辆概况
      */