Przeglądaj źródła

feat: 空文件检查

weijianghai 11 miesięcy temu
rodzic
commit
2639b90dab
33 zmienionych plików z 998 dodań i 150 usunięć
  1. 6 6
      pom.xml
  2. 22 2
      readme.md
  3. 5 0
      src/main/java/com/nokia/finance/tasks/common/exception/MyRuntimeException.java
  4. 29 0
      src/main/java/com/nokia/finance/tasks/config/JobConfig.java
  5. 6 0
      src/main/java/com/nokia/finance/tasks/config/web/RequestLogHandlerInterceptor.java
  6. 451 13
      src/main/java/com/nokia/finance/tasks/dao/house/HouseProcedureDao.java
  7. 8 0
      src/main/java/com/nokia/finance/tasks/enums/JobEnum.java
  8. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarBaoXianJob.java
  9. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarDaWeiXiuJob.java
  10. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarLuQiaoJob.java
  11. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarNianJianFeiJob.java
  12. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarQiTaJob.java
  13. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarRanYouJob.java
  14. 89 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarSiCheGongYongJob.java
  15. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarWeiXiuJob.java
  16. 5 1
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarBaoFeiJob.java
  17. 5 1
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarBaseDataDayJob.java
  18. 5 1
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarLiChengDayJob.java
  19. 20 15
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarLiChengMonthJob.java
  20. 8 3
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarWuDanYongCheJob.java
  21. 20 15
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarYongCheJob.java
  22. 5 1
      src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarYueJieJob.java
  23. 8 0
      src/main/java/com/nokia/finance/tasks/jobs/car/shujucangku/CarFeeBsJob.java
  24. 42 2
      src/main/java/com/nokia/finance/tasks/jobs/car/shujucangku/CarFeeHbJob.java
  25. 1 1
      src/main/java/com/nokia/finance/tasks/jobs/gdc/car/CarPhpRequestLogJob.java
  26. 23 15
      src/main/java/com/nokia/finance/tasks/jobs/house/chengben/HouseBuildingRepairMonthJob.java
  27. 89 0
      src/main/java/com/nokia/finance/tasks/jobs/house/chengben/HouseRentInRepairMonthJob.java
  28. 28 54
      src/main/java/com/nokia/finance/tasks/service/JobService.java
  29. 1 1
      src/main/java/com/nokia/finance/tasks/service/car/CarService.java
  30. 25 1
      src/main/resources/application-dev.yml
  31. 24 0
      src/main/resources/application-prod.yml
  32. 15 16
      src/test/java/com/nokia/finance/tasks/FinanceTasksApplicationTests.java
  33. 2 2
      src/test/java/com/nokia/finance/tasks/gdc/car/CarPhpRequestLogJobTests.java

+ 6 - 6
pom.xml

@@ -93,12 +93,12 @@
             <artifactId>spring-boot-starter-freemarker</artifactId>
             <version>3.2.3</version>
         </dependency>
-        <!-- https://mvnrepository.com/artifact/com.belerweb/pinyin4j -->
-        <dependency>
-            <groupId>com.belerweb</groupId>
-            <artifactId>pinyin4j</artifactId>
-            <version>2.5.1</version>
-        </dependency>
+<!--        &lt;!&ndash; https://mvnrepository.com/artifact/com.belerweb/pinyin4j &ndash;&gt;-->
+<!--        <dependency>-->
+<!--            <groupId>com.belerweb</groupId>-->
+<!--            <artifactId>pinyin4j</artifactId>-->
+<!--            <version>2.5.1</version>-->
+<!--        </dependency>-->
         <!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
         <dependency>
             <groupId>org.apache.commons</groupId>

+ 22 - 2
readme.md

@@ -172,12 +172,32 @@ curl --location 'http://localhost:39110/jobs/runJob' \
 }'
 ```
 
-##### 睿行车辆行驶里程日数据入库定时任务
+##### 河北成本管理系统车辆私车公用数据入库定时任务
 
 ```shell
 curl --location 'http://localhost:39110/jobs/runJob' \
 --header 'Content-Type: application/json' \
 --data '{
-    "jobName": "CAR_LI_CHENG_DAY_JOB"
+    "jobName": "CAR_SI_CHE_GONG_YONG_JOB"
+}'
+```
+
+##### 河北成本管理系统车辆私车公用数据入库定时任务
+
+```shell
+curl --location 'http://localhost:39110/jobs/runJob' \
+--header 'Content-Type: application/json' \
+--data '{
+    "jobName": "CAR_SI_CHE_GONG_YONG_JOB"
+}'
+```
+
+##### 河北成本管理系统不动产租赁房产维修数据入库定时任务
+
+```shell
+curl --location 'http://localhost:39110/jobs/runJob' \
+--header 'Content-Type: application/json' \
+--data '{
+    "jobName": "HOUSE_RENT_IN_REPAIR_MONTH_JOB"
 }'
 ```

+ 5 - 0
src/main/java/com/nokia/finance/tasks/common/exception/MyRuntimeException.java

@@ -19,4 +19,9 @@ public class MyRuntimeException extends RuntimeException{
     public MyRuntimeException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) {
         super(message, cause, enableSuppression, writableStackTrace);
     }
+
+    @Override
+    public synchronized Throwable fillInStackTrace() {
+        return this;
+    }
 }

+ 29 - 0
src/main/java/com/nokia/finance/tasks/config/JobConfig.java

@@ -144,6 +144,14 @@ public class JobConfig {
      * 河北成本管理系统车辆其他费用数据归档路径
      */
     private String carQiTaHistoryPath;
+    /**
+     * 河北成本管理系统私车公用数据路径
+     */
+    private String carSiCheGongYongSourcePath;
+    /**
+     * 河北成本管理系统私车公用数据归档路径
+     */
+    private String carSiCheGongYongHistoryPath;
     /**
      * 河北价值管理平台省内车辆费用月数据路径
      */
@@ -168,6 +176,14 @@ public class JobConfig {
      * 河北成本管理系统自有类房产维修数据归档路径
      */
     private String houseBuildingRepairMonthHistoryPath;
+    /**
+     * 河北成本管理系统不动产租赁房产维修数据路径
+     */
+    private String houseRentInRepairMonthSourcePath;
+    /**
+     * 河北成本管理系统不动产租赁房产维修数据归档路径
+     */
+    private String houseRentInRepairMonthHistoryPath;
     /**
      * 违规车辆策略输出路径
      */
@@ -200,7 +216,20 @@ public class JobConfig {
      * 车效大屏建设数据输出路径
      */
     private String carCxdpOutputPath;
+    /**
+     * 房产大屏建筑面积统计输出路径
+     */
     private String houseBuildingAreaStatOutputPath;
+    /**
+     * 房产大屏建筑和土地数量统计输出路径
+     */
     private String houseBuildingLandCountOutputPath;
+    /**
+     * 房产大屏出租收入统计输出路径
+     */
     private String houseRentalIncomeOutputPath;
+    /**
+     * 闲置建筑面积超过1000平米策略输出路径
+     */
+    private String houseBuildingIdleStrategyOutputPath;
 }

+ 6 - 0
src/main/java/com/nokia/finance/tasks/config/web/RequestLogHandlerInterceptor.java

@@ -57,6 +57,12 @@ public class RequestLogHandlerInterceptor implements HandlerInterceptor {
         // 请求体参数
         String body = StreamUtils.copyToString(request.getInputStream(), Charset.forName(request.getCharacterEncoding()));
         log.info("请求体参数: {}", StringUtils.trimAllWhitespace(body));
+        String remoteAddr = request.getRemoteAddr();
+        // 判断请求是否来自本地
+        if (!("localhost".equals(remoteAddr) || "127.0.0.1".equals(remoteAddr))) {
+            log.warn("非本地请求: {}", remoteAddr);
+            return false;
+        }
         return true;
     }
 

+ 451 - 13
src/main/java/com/nokia/finance/tasks/dao/house/HouseProcedureDao.java

@@ -1,28 +1,466 @@
 package com.nokia.finance.tasks.dao.house;
 
 import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Update;
 
 @Mapper
 public interface HouseProcedureDao {
     /**
-     * 更新自有房产维修
+     * 更新自有房产维修基本信息
+     */
+    @Update("""
+update
+    house.building_repair_month a
+set
+    site_id = b.site_id,
+    site_name = b.site_name,
+    site_num = b.site_num,
+    second_unit = b.second_unit,
+    third_unit = b.third_unit,
+    city = b.city,
+    district = b.district,
+    area_no = b.area_no,
+    area_name = b.area_name,
+    city_no = b.city_no,
+    city_name = b.city_name
+from
+    house.building_month b
+where
+    a.jz_jzid = b.building_id
+    and a.year_month = b.year_month
+    and a.year_month = #{endYearMonth}
+""")
+    int updateBuildingRepairMonthBaseInfo(@Param("endYearMonth") Integer endYearMonth);
+
+    /**
+     * 插入不动产自有房产相同维修频次统计
+     * @param startYearMonth 开始年月
+     * @param endYearMonth 结束年月
      */
     @Update("""
 with
 t101 as (
-select * from house.building_month where year_month = (select max(year_month) from house.building_month)
+select
+    year_month,
+    jz_jzid,
+    repair_type,
+    content_category,
+    form_no,
+    sum(final_cost) as final_cost_sum
+from
+    house.building_repair_month
+where repair_type != '财务预提冲销'
+and year_month >= #{startYearMonth}
+and year_month <= #{endYearMonth}
+group by
+    year_month,
+    jz_jzid,
+    repair_type,
+    content_category,
+    form_no
+),
+t102 as (
+select
+    jz_jzid,
+    repair_type,
+    content_category,
+    count(1) as ty_total,
+    sum(final_cost_sum) as final_cost_sum
+from
+    t101
+group by
+    jz_jzid,
+    repair_type,
+    content_category
+),
+t103 as (
+select distinct on (building_id) * from house.building_month
+where year_month >= #{startYearMonth} and year_month <= #{endYearMonth}
+order by building_id, year_month desc
+),
+t104 as (
+select
+    t103.area_no,
+    t103.area_name,
+    t103.city_no,
+    t103.city_name,
+    t103.building_name,
+    t103.site_id,
+    t103.site_num,
+    t103.site_name,
+    t102.jz_jzid,
+    t102.repair_type,
+    t102.content_category,
+    t102.ty_total,
+    t102.final_cost_sum
+from
+    t102
+join t103 on
+    t102.jz_jzid = t103.building_id
+),
+t105 as (
+select
+        *,
+        row_number() over (
+order by
+    ty_total desc, final_cost_sum desc
+        ) as ty_total_rank
+from
+    t104
+limit 20
+),
+t201 as (
+select * from house.building_repair_month a
+where year_month <= #{endYearMonth}
+and repair_type != '财务预提冲销'
+and exists (select 1 from t105 b where a.jz_jzid = b.jz_jzid)
+),
+t202 as (
+select
+    year_month,
+    jz_jzid,
+    repair_type,
+    content_category,
+    form_no
+from
+    t201
+group by
+    year_month,
+    jz_jzid,
+    repair_type,
+    content_category,
+    form_no
+),
+t203 as (
+select
+    jz_jzid,
+    repair_type,
+    content_category,
+    count(1) as history_total
+from
+    t202
+group by
+    jz_jzid,
+    repair_type,
+    content_category
+),
+t301 as (
+select
+t105.*,
+t203.history_total
+from t105 left join t203
+on t105.jz_jzid = t203.jz_jzid
+and t105.repair_type = t203.repair_type
+and t105.content_category = t203.content_category
+)
+insert into house.building_same_repair_frequency
+(
+year_month,
+building_id,
+area_no,
+area_name,
+city_no,
+city_name,
+building_name,
+repair_type,
+content_category,
+ty_total,
+ty_total_rank,
+history_total,
+final_cost_sum,
+site_id,
+site_num,
+site_name
+)
+select
+    #{endYearMonth} as year_month,
+    jz_jzid as building_id,
+    area_no,
+    area_name,
+    city_no,
+    city_name,
+    building_name,
+    repair_type,
+    content_category,
+    ty_total,
+    ty_total_rank,
+    history_total,
+    final_cost_sum,
+    site_id,
+    site_num,
+    site_name
+from
+    t301
+order by
+    ty_total_rank
+""")
+    int insertBuildingSameRepairFrequency(@Param("startYearMonth") Integer startYearMonth,
+                                          @Param("endYearMonth") Integer endYearMonth);
+
+    /**
+     * 插入不动产自有房产高总价维修统计
+     * @param startYearMonth 开始年月
+     * @param endYearMonth 结束年月
+     */
+    @Update("""
+with
+t101 as (
+select
+*
+from
+    house.building_repair_month
+where
+    repair_type != '财务预提冲销'
+    and final_cost > 0
+    and year_month >= #{startYearMonth}
+    and year_month <= #{endYearMonth}
+),
+t102 as (
+select distinct on (jz_jzid, repair_type, content_category) * from t101
+order by jz_jzid, repair_type, content_category, year_month desc
+),
+t103 as (
+select distinct on (building_id) * from house.building_month
+where year_month >= #{startYearMonth} and year_month <= #{endYearMonth}
+order by building_id, year_month desc
+),
+t104 as (
+select
+t102.year_month,
+t102.jz_jzid,
+t102.repair_type,
+t102.content_category,
+t103.site_id,
+t103.site_num,
+t103.site_name,
+t103.area_no,
+t103.area_name,
+t103.city_no,
+t103.city_name,
+t103.building_name,
+t103.address,
+t103.building_use,
+t103.building_area,
+t103.building_area_self_use,
+t103.building_area_rent,
+t103.building_area_idle,
+t103.building_area_unusable
+from t102 join t103 on t102 .jz_jzid = t103.building_id
+),
+t105 as (
+select
+    jz_jzid,
+    repair_type,
+    content_category,
+    sum(final_cost) as final_cost_sum
+from
+    t101
+group by
+    jz_jzid,
+    repair_type,
+    content_category
+),
+t106 as (
+select
+t105.final_cost_sum,
+t104.*
+from t105 join t104
+on t105.jz_jzid = t104.jz_jzid
+and t105.repair_type = t104.repair_type
+and t105.content_category = t104.content_category
+)
+insert into house.building_high_repair
+(
+year_month,
+building_id,
+latest_repair_month,
+area_no,
+area_name,
+city_no,
+city_name,
+building_name,
+repair_type,
+content_category,
+final_cost_sum,
+address,
+building_use,
+building_area,
+building_area_self_use,
+building_area_rent,
+building_area_idle,
+building_area_unusable,
+site_id,
+site_num,
+site_name
+)
+select
+#{endYearMonth} as year_month,
+jz_jzid as building_id,
+year_month as latest_repair_month,
+area_no,
+area_name,
+city_no,
+city_name,
+building_name,
+repair_type,
+content_category,
+final_cost_sum,
+address,
+building_use,
+building_area,
+building_area_self_use,
+building_area_rent,
+building_area_idle,
+building_area_unusable,
+site_id,
+site_num,
+site_name
+from t106
+order by final_cost_sum desc
+limit 20
+""")
+    int insertBuildingHighRepair(@Param("startYearMonth") Integer startYearMonth,
+                                 @Param("endYearMonth") Integer endYearMonth);
+
+    /**
+     * 插入不动产自有房产高额零星维修统计
+     * @param startYearMonth 开始年月
+     * @param endYearMonth 结束年月
+     */
+    @Update("""
+with
+t1 as (
+select
+    house.building_month.*,
+    house.building_repair_month.year_month as repair_year_month,
+    house.building_repair_month.repair_type,
+    house.building_repair_month.content_category as repair_content,
+    house.building_repair_month.final_cost as amount
+from
+    house.building_repair_month
+join house.building_month on
+    house.building_repair_month.jz_jzid = house.building_month.building_id
+    and house.building_repair_month.year_month = house.building_month.year_month
+where
+    house.building_repair_month.repair_type = '零星维修'
+    and house.building_repair_month.final_cost > 10000
+    and house.building_repair_month.year_month >= #{startYearMonth}
+    and house.building_repair_month.year_month <= #{endYearMonth}
+),
+t2 as (
+select
+building_id,
+count(1) as total
+from t1
+group by building_id
+),
+t3 as (
+select
+t1.*,
+t2.total
+from t1 join t2 on t1.building_id = t2.building_id
+)
+insert into house.building_high_sporadic_repair
+(
+year_month,
+building_id,
+building_name,
+repair_year_month,
+repair_type,
+repair_content,
+amount,
+total,
+area_no,
+area_name,
+city_no,
+city_name,
+site_id,
+site_num,
+site_name
+)
+select
+#{endYearMonth} as year_month,
+building_id,
+building_name,
+repair_year_month,
+repair_type,
+repair_content,
+amount,
+total,
+area_no,
+area_name,
+city_no,
+city_name,
+site_id,
+site_num,
+site_name
+from t3
+order by amount desc
+""")
+    int insertBuildingHighSporadicRepair(@Param("startYearMonth") Integer startYearMonth,
+                                         @Param("endYearMonth") Integer endYearMonth);
+
+    /**
+     * 插入不动产自有房产闲置不可用发生维修
+     * @param endYearMonth 账期
+     */
+    @Update("""
+insert into house.building_idle_repair
+(
+year_month,
+building_id,
+building_name,
+repair_type,
+repair_content,
+amount,
+site_id,
+site_name,
+site_num,
+area_no,
+area_name,
+city_no,
+city_name,
+address,
+usage_status,
+building_area,
+building_area_self_use,
+building_area_rent,
+building_area_idle,
+building_area_unusable
 )
-update house.building_repair_month a set
-second_unit = b.second_unit,
-third_unit = b.third_unit,
-city = b.city,
-district = b.district,
-area_no = b.area_no,
-area_name = b.area_name,
-city_no = b.city_no,
-city_name = b.city_name
-from t101 b where a.jz_jzid = b.building_id and a.year_month = (select max(year_month) from house.building_repair_month)
+select
+    house.building_repair_month.year_month,
+    house.building_repair_month.jz_jzid as building_id,
+    house.building_month.building_name,
+    house.building_repair_month.repair_type,
+    house.building_repair_month.content_category as repair_content,
+    house.building_repair_month.final_cost as amount,
+    house.building_month.site_id,
+    house.building_month.site_name,
+    house.building_month.site_num,
+    house.building_month.area_no,
+    house.building_month.area_name,
+    house.building_month.city_no,
+    house.building_month.city_name,
+    house.building_month.address,
+    house.building_month.usage_status,
+    house.building_month.building_area,
+    house.building_month.building_area_self_use,
+    house.building_month.building_area_rent,
+    house.building_month.building_area_idle,
+    house.building_month.building_area_unusable
+from
+    house.building_repair_month
+join house.building_month on
+    house.building_repair_month.jz_jzid = house.building_month.building_id
+    and house.building_repair_month.year_month = house.building_month.year_month
+where
+    house.building_repair_month.repair_type != '财务预提冲销'
+    and house.building_repair_month.year_month = #{endYearMonth}
+    and house.building_repair_month.final_cost > 0
+    and house.building_month.building_area = (house.building_month.building_area_idle + house.building_month.building_area_unusable)
+order by house.building_repair_month.final_cost desc
 """)
-    int updateBuildingRepairMonth();
+    int insertBuildingIdleRepair(@Param("endYearMonth") Integer endYearMonth);
 }

+ 8 - 0
src/main/java/com/nokia/finance/tasks/enums/JobEnum.java

@@ -65,6 +65,14 @@ public enum JobEnum {
      * 河北成本管理系统自有类房产维修数据入库定时任务
      */
     HOUSE_BUILDING_REPAIR_MONTH_JOB,
+    /**
+     * 河北成本管理系统车辆私车公用数据入库定时任务
+     */
+    CAR_SI_CHE_GONG_YONG_JOB,
+    /**
+     * 河北成本管理系统不动产租赁房产维修数据入库定时任务
+     */
+    HOUSE_RENT_IN_REPAIR_MONTH_JOB,
     /**
      * 睿行车辆行驶里程日数据入库定时任务
      */

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarBaoXianJob.java

@@ -89,6 +89,10 @@ public class CarBaoXianJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -131,6 +135,10 @@ public class CarBaoXianJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarDaWeiXiuJob.java

@@ -89,6 +89,10 @@ public class CarDaWeiXiuJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -128,6 +132,10 @@ public class CarDaWeiXiuJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarLuQiaoJob.java

@@ -89,6 +89,10 @@ public class CarLuQiaoJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -127,6 +131,10 @@ public class CarLuQiaoJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarNianJianFeiJob.java

@@ -89,6 +89,10 @@ public class CarNianJianFeiJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -127,6 +131,10 @@ public class CarNianJianFeiJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarQiTaJob.java

@@ -89,6 +89,10 @@ public class CarQiTaJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -127,6 +131,10 @@ public class CarQiTaJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarRanYouJob.java

@@ -89,6 +89,10 @@ public class CarRanYouJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -129,6 +133,10 @@ public class CarRanYouJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 89 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarSiCheGongYongJob.java

@@ -0,0 +1,89 @@
+package com.nokia.finance.tasks.jobs.car.chengben;
+
+import com.nokia.finance.tasks.common.exception.MyRuntimeException;
+import com.nokia.finance.tasks.config.JobConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+/**
+ * 河北成本管理系统车辆私车公用数据入库定时任务
+ */
+@Slf4j
+@Service
+public class CarSiCheGongYongJob {
+    private final JobConfig jobConfig;
+
+    public CarSiCheGongYongJob(JobConfig jobConfig) {
+        this.jobConfig = jobConfig;
+    }
+
+    /**
+     * 执行任务
+     */
+    @Scheduled(cron = "0 30 6 9 * ?")
+    public void runJob() {
+        // 数据目录
+        Path dir = Paths.get(jobConfig.getCarSiCheGongYongSourcePath());
+        try (Stream<Path> stream = Files.list(dir)) {
+            // 获取数据目录下的文件列表
+            List<Path> pathList = stream.filter(t -> !t.toString().endsWith(".MD5")).sorted().toList();
+            log.info("河北成本管理系统车辆私车公用数据文件列表: {}", pathList);
+            if (CollectionUtils.isEmpty(pathList)) {
+                throw new MyRuntimeException("河北成本管理系统车辆私车公用数据没有文件");
+            }
+            for (Path path : pathList) {
+                CompletableFuture.runAsync(() -> {
+                    try {
+                        singleJob(path);
+                    } catch (Exception e) {
+                        throw new MyRuntimeException(e);
+                    }
+                }).get(1, TimeUnit.MINUTES);
+            }
+        } catch (InterruptedException e) {
+            log.error("线程中断: {}", e.getMessage(), e);
+            Thread.currentThread().interrupt();
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 处理单个文件
+     *
+     * @param path 文件路径
+     */
+    public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
+        move(path);
+    }
+
+    /**
+     * 移动源文件到历史文件夹
+     *
+     * @param path 源文件路径
+     */
+    public void move(Path path) throws Exception {
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getCarSiCheGongYongHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
+        Files.move(path, Paths.get(jobConfig.getCarSiCheGongYongHistoryPath(), path.getFileName().toString()),
+                StandardCopyOption.REPLACE_EXISTING);
+    }
+}

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/chengben/CarWeiXiuJob.java

@@ -89,6 +89,10 @@ public class CarWeiXiuJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -128,6 +132,10 @@ public class CarWeiXiuJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

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

@@ -99,6 +99,10 @@ public class CarBaoFeiJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -145,7 +149,7 @@ public class CarBaoFeiJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {

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

@@ -104,6 +104,10 @@ public class CarBaseDataDayJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -153,7 +157,7 @@ public class CarBaseDataDayJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {

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

@@ -99,6 +99,10 @@ public class CarLiChengDayJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -143,7 +147,7 @@ public class CarLiChengDayJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {

+ 20 - 15
src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarLiChengMonthJob.java

@@ -101,8 +101,22 @@ public class CarLiChengMonthJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        // 从文件名提取日期
+        String regex = "\\d{6}";
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(path.getFileName().toString());
+        String dateString;
+        if (matcher.find()) {
+            dateString = matcher.group() + "01";
+        } else {
+            throw new MyRuntimeException(path.getFileName() + " 提取日期失败");
+        }
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
-        List<Map<String, String>> distinctList = dataProcessing(path, list);
+        List<Map<String, String>> distinctList = dataProcessing(path, list, dateString);
         Path csvPath = toCsv(path, distinctList);
         copyCsv(csvPath);
         move(path);
@@ -145,7 +159,7 @@ public class CarLiChengMonthJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {
@@ -192,20 +206,11 @@ public class CarLiChengMonthJob {
     /**
      * 数据加工
      *
-     * @param path 文件路径
-     * @param list 数据
+     * @param path       文件路径
+     * @param list       数据
+     * @param dateString 日期字符串
      */
-    public List<Map<String, String>> dataProcessing(Path path, List<Map<String, String>> list) {
-        // 从文件名提取日期
-        String regex = "\\d{6}";
-        Pattern pattern = Pattern.compile(regex);
-        Matcher matcher = pattern.matcher(path.getFileName().toString());
-        String dateString;
-        if (matcher.find()) {
-            dateString = matcher.group() + "01";
-        } else {
-            throw new MyRuntimeException(path.getFileName() + " 提取日期失败");
-        }
+    public List<Map<String, String>> dataProcessing(Path path, List<Map<String, String>> list, String dateString) {
         List<OrganizationPo> secondOrgs = organizationService.getSecondOrgs();
         List<OrganizationPo> thirdOrgs = organizationService.getThirdOrgs();
         Map<String, OrganizationPo> orgMap = organizationService.getOrgMap(secondOrgs, thirdOrgs);

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

@@ -99,6 +99,10 @@ public class CarWuDanYongCheJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -142,7 +146,7 @@ public class CarWuDanYongCheJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {
@@ -197,6 +201,7 @@ public class CarWuDanYongCheJob {
      * @param list 数据
      */
     public List<Map<String, String>> dataProcessing(Path path, List<Map<String, String>> list) {
+        String lastMonth = LocalDateTime.now().minusMonths(1).format(DateTimeFormatter.ofPattern("yyyyMM"));
         List<OrganizationPo> secondOrgs = organizationService.getSecondOrgs();
         List<OrganizationPo> thirdOrgs = organizationService.getThirdOrgs();
         Map<String, OrganizationPo> orgMap = organizationService.getOrgMap(secondOrgs, thirdOrgs);
@@ -254,8 +259,8 @@ public class CarWuDanYongCheJob {
             map.put("source", path.getFileName().toString());
         }
         // 去重
-        return list.stream().filter(distinctByKey(map -> map.get("che_pai_hao")
-                + map.get("wei_gui_kai_shi_shi_jian"))).toList();
+        return list.stream().filter(distinctByKey(map -> map.get("che_pai_hao") + map.get("wei_gui_kai_shi_shi_jian")))
+                .filter(t -> lastMonth.equals(t.get("year_month"))).toList();
     }
 
     /**

+ 20 - 15
src/main/java/com/nokia/finance/tasks/jobs/car/ruixing/CarYongCheJob.java

@@ -98,8 +98,22 @@ public class CarYongCheJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        // 从文件名提取日期
+        String regex = "\\d{6}";
+        Pattern pattern = Pattern.compile(regex);
+        Matcher matcher = pattern.matcher(path.getFileName().toString());
+        String dateString;
+        if (matcher.find()) {
+            dateString = matcher.group() + "01";
+        } else {
+            throw new MyRuntimeException(path.getFileName() + " 提取日期失败");
+        }
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
-        List<Map<String, String>> distinctList = dataProcessing(path, list);
+        List<Map<String, String>> distinctList = dataProcessing(path, list, dateString);
         Path csvPath = toCsv(path, distinctList);
         copyCsv(csvPath);
         move(path);
@@ -144,7 +158,7 @@ public class CarYongCheJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {
@@ -213,20 +227,11 @@ public class CarYongCheJob {
     /**
      * 数据加工
      *
-     * @param path 文件路径
-     * @param list 数据
+     * @param path       文件路径
+     * @param list       数据
+     * @param dateString 日期字符串
      */
-    public List<Map<String, String>> dataProcessing(Path path, List<Map<String, String>> list) {
-        // 从文件名提取日期
-        String regex = "\\d{6}";
-        Pattern pattern = Pattern.compile(regex);
-        Matcher matcher = pattern.matcher(path.getFileName().toString());
-        String dateString;
-        if (matcher.find()) {
-            dateString = matcher.group() + "01";
-        } else {
-            throw new MyRuntimeException(path.getFileName() + " 提取日期失败");
-        }
+    public List<Map<String, String>> dataProcessing(Path path, List<Map<String, String>> list, String dateString) {
         LocalDate localDate = LocalDate.parse(dateString, DateTimeFormatter.ofPattern("yyyyMMdd"));
         String yearMonth = localDate.format(DateTimeFormatter.ofPattern("yyyyMM"));
         String year = String.valueOf(localDate.getYear());

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

@@ -99,6 +99,10 @@ public class CarYueJieJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -143,7 +147,7 @@ public class CarYueJieJob {
             int lastRowNum = sheet.getLastRowNum();
             log.info("lastRowNum: {}", lastRowNum);
             if (lastRowNum == 0) {
-                throw new MyRuntimeException(path.getFileName() + " 为空");
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
             }
             // 遍历行
             for (int i = 1; i <= lastRowNum; i++) {

+ 8 - 0
src/main/java/com/nokia/finance/tasks/jobs/car/shujucangku/CarFeeBsJob.java

@@ -77,6 +77,10 @@ public class CarFeeBsJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -110,6 +114,10 @@ public class CarFeeBsJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }

+ 42 - 2
src/main/java/com/nokia/finance/tasks/jobs/car/shujucangku/CarFeeHbJob.java

@@ -3,6 +3,9 @@ package com.nokia.finance.tasks.jobs.car.shujucangku;
 import com.nokia.finance.tasks.common.exception.MyRuntimeException;
 import com.nokia.finance.tasks.common.utils.psql.PsqlUtil;
 import com.nokia.finance.tasks.config.JobConfig;
+import com.nokia.finance.tasks.pojo.po.common.OrganizationPo;
+import com.nokia.finance.tasks.service.car.CarService;
+import com.nokia.finance.tasks.service.common.OrganizationService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.csv.CSVFormat;
 import org.apache.commons.csv.CSVParser;
@@ -35,9 +38,13 @@ import java.util.stream.Stream;
 @Service
 public class CarFeeHbJob {
     private final JobConfig jobConfig;
+    private final CarService carService;
+    private final OrganizationService organizationService;
 
-    public CarFeeHbJob(JobConfig jobConfig) {
+    public CarFeeHbJob(JobConfig jobConfig, CarService carService, OrganizationService organizationService) {
         this.jobConfig = jobConfig;
+        this.carService = carService;
+        this.organizationService = organizationService;
     }
 
     /**
@@ -77,6 +84,10 @@ public class CarFeeHbJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
@@ -110,6 +121,10 @@ public class CarFeeHbJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }
@@ -121,7 +136,32 @@ public class CarFeeHbJob {
      * @param list 数据
      */
     public List<Map<String, String>> dataProcessing(Path path, List<Map<String, String>> list) {
+        List<OrganizationPo> secondOrgs = organizationService.getSecondOrgs();
+        List<OrganizationPo> thirdOrgs = organizationService.getThirdOrgs();
+        Map<String, OrganizationPo> orgMap = organizationService.getOrgMap(secondOrgs, thirdOrgs);
         for (Map<String, String> map : list) {
+            String monthId = map.get("month_id");
+            String year = monthId.substring(0, 4);
+            String month = monthId.substring(4, 6);
+            map.put("year_no", year);
+            map.put("month_no", month);
+            String areaName = map.get("area_name");
+            String secondOrgNo = "";
+            for (OrganizationPo secondOrg : secondOrgs) {
+                if (areaName.equals(secondOrg.getName())) {
+                    secondOrgNo = secondOrg.getId();
+                    break;
+                }
+            }
+            if ("传输局".equals(areaName)) {
+                secondOrgNo = "-11";
+            }
+            if ("本部".equals(areaName)) {
+                secondOrgNo = "-12";
+            }
+            map.put("second_org_no", secondOrgNo);
+            String secondOrgName = carService.getOrgName(orgMap, secondOrgNo);
+            map.put("second_org_name", secondOrgName);
             map.put("source", path.getFileName().toString());
         }
         return list;
@@ -160,7 +200,7 @@ public class CarFeeHbJob {
     public void copyCsv(Path path) {
         String dbTable = "car.car_fee_hb";
         String csv = path.toString();
-        String columns = "(month_id,area_no,area_name,kpi_id,kpi_name,tm_value,lm_value,ty_value,ly_value,source)";
+        String columns = "(month_id,area_no,area_name,kpi_id,kpi_name,tm_value,lm_value,ty_value,ly_value,year_no,month_no,second_org_no,second_org_name,source)";
         Long timeout = 60000L;
         PsqlUtil.copyCsv(jobConfig.getCopyScriptPath(), jobConfig.getDbHost(), jobConfig.getDbPort(),
                 jobConfig.getDbUsername(), jobConfig.getDbPassword(), jobConfig.getDbName(), dbTable, csv, columns,

+ 1 - 1
src/main/java/com/nokia/finance/tasks/jobs/car/procedure/CarPhpRequestLogJob.java → src/main/java/com/nokia/finance/tasks/jobs/gdc/car/CarPhpRequestLogJob.java

@@ -1,4 +1,4 @@
-package com.nokia.finance.tasks.jobs.car.procedure;
+package com.nokia.finance.tasks.jobs.gdc.car;
 
 import com.google.gson.Gson;
 import com.google.gson.reflect.TypeToken;

+ 23 - 15
src/main/java/com/nokia/finance/tasks/jobs/house/chengben/HouseBuildingRepairMonthJob.java

@@ -3,7 +3,6 @@ package com.nokia.finance.tasks.jobs.house.chengben;
 import com.nokia.finance.tasks.common.exception.MyRuntimeException;
 import com.nokia.finance.tasks.common.utils.psql.PsqlUtil;
 import com.nokia.finance.tasks.config.JobConfig;
-import com.nokia.finance.tasks.dao.gdc.house.HouseGdcProcedureDao;
 import com.nokia.finance.tasks.dao.house.HouseProcedureDao;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.csv.CSVFormat;
@@ -38,13 +37,10 @@ import java.util.stream.Stream;
 public class HouseBuildingRepairMonthJob {
     private final JobConfig jobConfig;
     private final HouseProcedureDao houseProcedureDao;
-    private final HouseGdcProcedureDao houseGdcProcedureDao;
 
-    public HouseBuildingRepairMonthJob(JobConfig jobConfig, HouseProcedureDao houseProcedureDao,
-                                       HouseGdcProcedureDao houseGdcProcedureDao) {
+    public HouseBuildingRepairMonthJob(JobConfig jobConfig, HouseProcedureDao houseProcedureDao) {
         this.jobConfig = jobConfig;
         this.houseProcedureDao = houseProcedureDao;
-        this.houseGdcProcedureDao = houseGdcProcedureDao;
     }
 
     /**
@@ -84,12 +80,20 @@ public class HouseBuildingRepairMonthJob {
      * @param path 文件路径
      */
     public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
         List<Map<String, String>> list = readFile(path);
         List<Map<String, String>> distinctList = dataProcessing(path, list);
         Path csvPath = toCsv(path, distinctList);
         copyCsv(csvPath);
         move(path);
-        procedure();
+        Integer yearMonth = Integer.valueOf(distinctList.get(0).get("year_month"));
+        int update1 = houseProcedureDao.updateBuildingRepairMonthBaseInfo(yearMonth);
+        if (update1 == 0) {
+            throw new MyRuntimeException("更新自有房产维修基本信息失败");
+        }
     }
 
     /**
@@ -123,6 +127,10 @@ public class HouseBuildingRepairMonthJob {
                 }
                 resultList.add(rowMap);
             }
+            if (CollectionUtils.isEmpty(resultList)) {
+                move(path);
+                throw new MyRuntimeException(path.getFileName() + " 数据0条");
+            }
             return resultList;
         }
     }
@@ -151,6 +159,14 @@ public class HouseBuildingRepairMonthJob {
                 repairType = "项目制维修";
             }
             map.put("repair_type", repairType);
+            String investor = map.get("investor");
+            String investorName = "";
+            if ("1".equals(investor) || "2".equals(investor)) {
+                investorName = "上市";
+            } else if ("3".equals(investor)) {
+                investorName = "存续";
+            }
+            map.put("investor_name", investorName);
             map.put("source", path.getFileName().toString());
         }
         return list;
@@ -189,7 +205,7 @@ public class HouseBuildingRepairMonthJob {
     public void copyCsv(Path path) {
         String dbTable = "house.building_repair_month";
         String csv = path.toString();
-        String columns = "(data_time_nlsd,data_time,form_type,submitter,submitter_dept_id,form_no,reimbursement_no,start_time,form_id,investor,fwxs_big_type,jz_jzbh,zrqk_jzmc,location_info,content_category,estimate_cost,describe,del_flag,final_cost,description,jz_jzid,year_month,year_no,month_no,repair_type,source)";
+        String columns = "(data_time_nlsd,data_time,form_type,submitter,submitter_dept_id,form_no,reimbursement_no,start_time,form_id,investor,fwxs_big_type,jz_jzbh,zrqk_jzmc,location_info,content_category,estimate_cost,describe,del_flag,final_cost,description,jz_jzid,year_month,year_no,month_no,repair_type,investor_name,source)";
         Long timeout = 60000L;
         PsqlUtil.copyCsv(jobConfig.getCopyScriptPath(), jobConfig.getDbHost(), jobConfig.getDbPort(),
                 jobConfig.getDbUsername(), jobConfig.getDbPassword(), jobConfig.getDbName(), dbTable, csv, columns,
@@ -210,12 +226,4 @@ public class HouseBuildingRepairMonthJob {
         Files.move(path, Paths.get(jobConfig.getHouseBuildingRepairMonthHistoryPath(), path.getFileName().toString()),
                 StandardCopyOption.REPLACE_EXISTING);
     }
-
-    /**
-     * 更新表
-     */
-    public void procedure() {
-        log.info("update house.building_month");
-        houseProcedureDao.updateBuildingRepairMonth();
-    }
 }

+ 89 - 0
src/main/java/com/nokia/finance/tasks/jobs/house/chengben/HouseRentInRepairMonthJob.java

@@ -0,0 +1,89 @@
+package com.nokia.finance.tasks.jobs.house.chengben;
+
+import com.nokia.finance.tasks.common.exception.MyRuntimeException;
+import com.nokia.finance.tasks.config.JobConfig;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Service;
+import org.springframework.util.CollectionUtils;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.List;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.TimeUnit;
+import java.util.stream.Stream;
+
+/**
+ * 河北成本管理系统不动产租赁房产维修数据入库定时任务
+ */
+@Slf4j
+@Service
+public class HouseRentInRepairMonthJob {
+    private final JobConfig jobConfig;
+
+    public HouseRentInRepairMonthJob(JobConfig jobConfig) {
+        this.jobConfig = jobConfig;
+    }
+
+    /**
+     * 执行任务
+     */
+    @Scheduled(cron = "0 32 6 9 * ?")
+    public void runJob() {
+        // 数据目录
+        Path dir = Paths.get(jobConfig.getHouseRentInRepairMonthSourcePath());
+        try (Stream<Path> stream = Files.list(dir)) {
+            // 获取数据目录下的文件列表
+            List<Path> pathList = stream.filter(t -> !t.toString().endsWith(".MD5")).sorted().toList();
+            log.info("河北成本管理系统不动产租赁房产维修数据文件列表: {}", pathList);
+            if (CollectionUtils.isEmpty(pathList)) {
+                throw new MyRuntimeException("河北成本管理系统不动产租赁房产维修数据没有文件");
+            }
+            for (Path path : pathList) {
+                CompletableFuture.runAsync(() -> {
+                    try {
+                        singleJob(path);
+                    } catch (Exception e) {
+                        throw new MyRuntimeException(e);
+                    }
+                }).get(1, TimeUnit.MINUTES);
+            }
+        } catch (InterruptedException e) {
+            log.error("线程中断: {}", e.getMessage(), e);
+            Thread.currentThread().interrupt();
+        } catch (Exception e) {
+            log.error(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 处理单个文件
+     *
+     * @param path 文件路径
+     */
+    public void singleJob(Path path) throws Exception {
+        if (Files.size(path) == 0) {
+            move(path);
+            throw new MyRuntimeException(path.getFileName() + " 空文件");
+        }
+        move(path);
+    }
+
+    /**
+     * 移动源文件到历史文件夹
+     *
+     * @param path 源文件路径
+     */
+    public void move(Path path) throws Exception {
+        if (Files.exists(Paths.get(path + ".MD5"))) {
+            Files.move(Paths.get(path + ".MD5"),
+                    Paths.get(jobConfig.getHouseRentInRepairMonthHistoryPath(), path.getFileName().toString() + ".MD5"),
+                    StandardCopyOption.REPLACE_EXISTING);
+        }
+        Files.move(path, Paths.get(jobConfig.getHouseRentInRepairMonthHistoryPath(), path.getFileName().toString()),
+                StandardCopyOption.REPLACE_EXISTING);
+    }
+}

+ 28 - 54
src/main/java/com/nokia/finance/tasks/service/JobService.java

@@ -7,6 +7,7 @@ import com.nokia.finance.tasks.jobs.car.chengben.CarLuQiaoJob;
 import com.nokia.finance.tasks.jobs.car.chengben.CarNianJianFeiJob;
 import com.nokia.finance.tasks.jobs.car.chengben.CarQiTaJob;
 import com.nokia.finance.tasks.jobs.car.chengben.CarRanYouJob;
+import com.nokia.finance.tasks.jobs.car.chengben.CarSiCheGongYongJob;
 import com.nokia.finance.tasks.jobs.car.chengben.CarWeiXiuJob;
 import com.nokia.finance.tasks.jobs.car.ruixing.CarBaoFeiJob;
 import com.nokia.finance.tasks.jobs.car.ruixing.CarBaseDataDayJob;
@@ -18,6 +19,7 @@ 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.jobs.house.chengben.HouseRentInRepairMonthJob;
 import com.nokia.finance.tasks.pojo.dto.RunJobDto;
 import org.springframework.stereotype.Service;
 
@@ -40,6 +42,8 @@ public class JobService {
     private final CarFeeBsJob carFeeBsJob;
     private final HouseBuildingRepairMonthJob houseBuildingRepairMonthJob;
     private final CarLiChengDayJob carLiChengDayJob;
+    private final CarSiCheGongYongJob carSiCheGongYongJob;
+    private final HouseRentInRepairMonthJob houseRentInRepairMonthJob;
 
     public JobService(CarBaseDataDayJob carBaseDataDayJob, CarYueJieJob carYueJieJob, CarBaoFeiJob carBaoFeiJob,
                       CarLiChengMonthJob carLiChengMonthJob, CarWuDanYongCheJob carWuDanYongCheJob,
@@ -47,7 +51,8 @@ public class JobService {
                       CarWeiXiuJob carWeiXiuJob, CarLuQiaoJob carLuQiaoJob, CarBaoXianJob carBaoXianJob,
                       CarNianJianFeiJob carNianJianFeiJob, CarQiTaJob carQiTaJob, CarFeeHbJob carFeeHbJob,
                       CarFeeBsJob carFeeBsJob, HouseBuildingRepairMonthJob houseBuildingRepairMonthJob,
-                      CarLiChengDayJob carLiChengDayJob) {
+                      CarLiChengDayJob carLiChengDayJob, CarSiCheGongYongJob carSiCheGongYongJob,
+                      HouseRentInRepairMonthJob houseRentInRepairMonthJob) {
         this.carBaseDataDayJob = carBaseDataDayJob;
         this.carYueJieJob = carYueJieJob;
         this.carBaoFeiJob = carBaoFeiJob;
@@ -65,63 +70,32 @@ public class JobService {
         this.carFeeBsJob = carFeeBsJob;
         this.houseBuildingRepairMonthJob = houseBuildingRepairMonthJob;
         this.carLiChengDayJob = carLiChengDayJob;
+        this.carSiCheGongYongJob = carSiCheGongYongJob;
+        this.houseRentInRepairMonthJob = houseRentInRepairMonthJob;
     }
 
     public R<Object> runJob(RunJobDto dto) {
         switch (dto.getJobName()) {
-            case CAR_BASE_DATA_DAY_JOB:
-                carBaseDataDayJob.runJob();
-                break;
-            case CAR_YUE_JIE_JOB:
-                carYueJieJob.runJob();
-                break;
-            case CAR_BAO_FEI_JOB:
-                carBaoFeiJob.runJob();
-                break;
-            case CAR_LI_CHENG_MONTH_JOB:
-                carLiChengMonthJob.runJob();
-                break;
-            case CAR_WU_DAN_YONG_CHE_JOB:
-                carWuDanYongCheJob.runJob();
-                break;
-            case CAR_YONG_CHE_JOB:
-                carYongCheJob.runJob();
-                break;
-            case CAR_RAN_YOU_JOB:
-                carRanYouJob.runJob();
-                break;
-            case CAR_DA_WEI_XIU_JOB:
-                carDaWeiXiuJob.runJob();
-                break;
-            case CAR_WEI_XIU_JOB:
-                carWeiXiuJob.runJob();
-                break;
-            case CAR_LU_QIAO_JOB:
-                carLuQiaoJob.runJob();
-                break;
-            case CAR_BAO_XIAN_JOB:
-                carBaoXianJob.runJob();
-                break;
-            case CAR_NIAN_JIAN_FEI_JOB:
-                carNianJianFeiJob.runJob();
-                break;
-            case CAR_QI_TA_JOB:
-                carQiTaJob.runJob();
-                break;
-            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;
-            case CAR_LI_CHENG_DAY_JOB:
-                carLiChengDayJob.runJob();
-                break;
-            default:
-                break;
+            case CAR_BASE_DATA_DAY_JOB -> carBaseDataDayJob.runJob();
+            case CAR_YUE_JIE_JOB -> carYueJieJob.runJob();
+            case CAR_BAO_FEI_JOB -> carBaoFeiJob.runJob();
+            case CAR_LI_CHENG_MONTH_JOB -> carLiChengMonthJob.runJob();
+            case CAR_WU_DAN_YONG_CHE_JOB -> carWuDanYongCheJob.runJob();
+            case CAR_YONG_CHE_JOB -> carYongCheJob.runJob();
+            case CAR_RAN_YOU_JOB -> carRanYouJob.runJob();
+            case CAR_DA_WEI_XIU_JOB -> carDaWeiXiuJob.runJob();
+            case CAR_WEI_XIU_JOB -> carWeiXiuJob.runJob();
+            case CAR_LU_QIAO_JOB -> carLuQiaoJob.runJob();
+            case CAR_BAO_XIAN_JOB -> carBaoXianJob.runJob();
+            case CAR_NIAN_JIAN_FEI_JOB -> carNianJianFeiJob.runJob();
+            case CAR_QI_TA_JOB -> carQiTaJob.runJob();
+            case CAR_FEE_HB_JOB -> carFeeHbJob.runJob();
+            case CAR_FEE_BS_JOB -> carFeeBsJob.runJob();
+            case HOUSE_BUILDING_REPAIR_MONTH_JOB -> houseBuildingRepairMonthJob.runJob();
+            case CAR_LI_CHENG_DAY_JOB -> carLiChengDayJob.runJob();
+            case CAR_SI_CHE_GONG_YONG_JOB -> carSiCheGongYongJob.runJob();
+            case HOUSE_RENT_IN_REPAIR_MONTH_JOB -> houseRentInRepairMonthJob.runJob();
+            default -> {}
         }
         return R.ok();
     }

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

@@ -212,7 +212,7 @@ public class CarService {
         if (!StringUtils.hasText(unit)) {
             return "";
         }
-        if (unit.contains("机动通信局") || unit.contains("机动局")) {
+        if (unit.contains("机动通信局") || unit.contains("机动局") || unit.contains("传输局")) {
             return "-11";
         }
         if (unit.contains("省公司本部") || unit.contains("雄安基地建设部") || unit.contains("华北基地建设部")) {

+ 25 - 1
src/main/resources/application-dev.yml

@@ -11,9 +11,12 @@ spring:
 #    password: Test!234
 #    url: jdbc:postgresql://127.0.0.1:5432/financialdb
 #    url: jdbc:postgresql://192.168.65.128:5432/financialdb
+    url: jdbc:postgresql://172.16.107.5:5432/financialdb
     username: finance
     password: Finance@unicom23
-    url: jdbc:postgresql://172.16.107.5:5432/financialdb
+#    url: jdbc:postgresql://192.168.50.3:15432/financialdb
+#    username: postgres
+#    password: NFQCgBA6YhNvgAqG6THw
 job:
   config:
     # copy脚本路径
@@ -91,14 +94,35 @@ job:
     car-li-cheng-day-source-path: data/rxftp/xslcrtj/
     # 睿行车辆行驶里程日数据归档路径
     car-li-cheng-day-history-path: data/history/rxftp/xslcrtj/
+    # 违规车辆策略输出路径
     car-wdyj-output-path: data/dsjftp/car_strategy/car_wdyj/
+    # 高油耗车辆策略输出路径
     car-high-fuel-consumption-output-path: data/dsjftp/car_strategy/car_high_fuel_consumption/
+    # 高修车辆策略输出路径
     car-high-repair-output-path: data/dsjftp/car_strategy/car_high_repair/
+    # 车辆低效占比策略输出路径
     car-inefficiency-percent-output-path: data/dsjftp/car_strategy/car_inefficiency_percent/
+    # 车辆低效区县策略输出路径
     car-inefficiency-qx-output-path: data/dsjftp/car_strategy/car_inefficiency_qx/
+    # 租赁车辆产生维修费策略输出路径
     car-rental-repair-output-path: data/dsjftp/car_strategy/car_rental_repair/
+    # 车辆违章未处理策略输出路径
     car-violation-unprocessed-output-path: data/dsjftp/car_strategy/car_violation_unprocessed/
+    # 车效大屏建设数据输出路径
     car-cxdp-output-path: data/dsjftp/car_cxdp/
+    # 房产大屏建筑面积统计输出路径
     house-building-area-stat-output-path: data/dsjftp/fcdp/building_area_stat/
+    # 房产大屏建筑和土地数量统计输出路径
     house-building-land-count-output-path: data/dsjftp/fcdp/building_land_count/
+    # 房产大屏出租收入统计输出路径
     house-rental-income-output-path: data/dsjftp/fcdp/rental_income/
+    # 闲置建筑面积超过1000平米策略输出路径
+    house-building-idle-strategy-output-path: data/dsjftp/house_strategy/building_idle_strategy/
+    # 河北成本管理系统私车公用数据路径
+    car-si-che-gong-yong-source-path: data/jzftp/HE_M_MTC_VEHICLE_SCGY/
+    # 河北成本管理系统私车公用数据归档路径
+    car-si-che-gong-yong-history-path: data/history/jzftp/HE_M_MTC_VEHICLE_SCGY/
+    # 河北成本管理系统不动产租赁房产维修数据路径
+    house-rent-in-repair-month-source-path: data/jzftp/E_M_MTC_HOUSELISTED/
+    # 河北成本管理系统不动产租赁房产维修数据归档路径
+    house-rent-in-repair-month-history-path: data/history/jzftp/E_M_MTC_HOUSELISTED/

+ 24 - 0
src/main/resources/application-prod.yml

@@ -87,11 +87,35 @@ job:
     car-li-cheng-day-source-path: /data/rxftp/xslcrtj/
     # 睿行车辆行驶里程日数据归档路径
     car-li-cheng-day-history-path: /data/history/rxftp/xslcrtj/
+    # 违规车辆策略输出路径
     car-wdyj-output-path: /data/dsjftp/car_strategy/car_wdyj/
+    # 高油耗车辆策略输出路径
     car-high-fuel-consumption-output-path: /data/dsjftp/car_strategy/car_high_fuel_consumption/
+    # 高修车辆策略输出路径
     car-high-repair-output-path: /data/dsjftp/car_strategy/car_high_repair/
+    # 车辆低效占比策略输出路径
     car-inefficiency-percent-output-path: /data/dsjftp/car_strategy/car_inefficiency_percent/
+    # 车辆低效区县策略输出路径
     car-inefficiency-qx-output-path: /data/dsjftp/car_strategy/car_inefficiency_qx/
+    # 租赁车辆产生维修费策略输出路径
     car-rental-repair-output-path: /data/dsjftp/car_strategy/car_rental_repair/
+    # 车辆违章未处理策略输出路径
     car-violation-unprocessed-output-path: /data/dsjftp/car_strategy/car_violation_unprocessed/
+    # 车效大屏建设数据输出路径
     car-cxdp-output-path: /data/dsjftp/car_cxdp/
+    # 房产大屏建筑面积统计输出路径
+    house-building-area-stat-output-path: /data/dsjftp/fcdp/building_area_stat/
+    # 房产大屏建筑和土地数量统计输出路径
+    house-building-land-count-output-path: /data/dsjftp/fcdp/building_land_count/
+    # 房产大屏出租收入统计输出路径
+    house-rental-income-output-path: /data/dsjftp/fcdp/rental_income/
+    # 闲置建筑面积超过1000平米策略输出路径
+    house-building-idle-strategy-output-path: /data/dsjftp/house_strategy/building_idle_strategy/
+    # 河北成本管理系统私车公用数据路径
+    car-si-che-gong-yong-source-path: /data/jzftp/HE_M_MTC_VEHICLE_SCGY/
+    # 河北成本管理系统私车公用数据归档路径
+    car-si-che-gong-yong-history-path: /data/history/jzftp/HE_M_MTC_VEHICLE_SCGY/
+    # 河北成本管理系统不动产租赁房产维修数据路径
+    house-rent-in-repair-month-source-path: /data/jzftp/E_M_MTC_HOUSELISTED/
+    # 河北成本管理系统不动产租赁房产维修数据归档路径
+    house-rent-in-repair-month-history-path: /data/history/jzftp/E_M_MTC_HOUSELISTED/

+ 15 - 16
src/test/java/com/nokia/finance/tasks/FinanceTasksApplicationTests.java

@@ -1,11 +1,10 @@
 package com.nokia.finance.tasks;
 
+import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
 import org.springframework.boot.test.context.SpringBootTest;
 
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
+@Slf4j
 @SpringBootTest
 class FinanceTasksApplicationTests {
 
@@ -14,18 +13,18 @@ class FinanceTasksApplicationTests {
     }
 
     public static void main(String[] args) {
-        String input = "出车事由:开会,乘车人:张三、李四、王五";
-        String patternStr = "出车事由(.*?)乘车人(.*?)$";
-        Pattern pattern = Pattern.compile(patternStr);
-        Matcher matcher = pattern.matcher(input);
-
-        if (matcher.find()) {
-            String reason = matcher.group(1);
-            String passengers = matcher.group(2);
-            System.out.println("出车事由:" + reason);
-            System.out.println("乘车人:" + passengers);
-        } else {
-            System.out.println("未找到匹配项");
-        }
+//        String input = "出车事由:开会,乘车人:张三、李四、王五";
+//        String patternStr = "出车事由(.*?)乘车人(.*?)$";
+//        Pattern pattern = Pattern.compile(patternStr);
+//        Matcher matcher = pattern.matcher(input);
+//
+//        if (matcher.find()) {
+//            String reason = matcher.group(1);
+//            String passengers = matcher.group(2);
+//            System.out.println("出车事由:" + reason);
+//            System.out.println("乘车人:" + passengers);
+//        } else {
+//            System.out.println("未找到匹配项");
+//        }
     }
 }

+ 2 - 2
src/test/java/com/nokia/finance/tasks/car/procedure/CarPhpRequestLogJobTests.java → src/test/java/com/nokia/finance/tasks/gdc/car/CarPhpRequestLogJobTests.java

@@ -1,6 +1,6 @@
-package com.nokia.finance.tasks.car.procedure;
+package com.nokia.finance.tasks.gdc.car;
 
-import com.nokia.finance.tasks.jobs.car.procedure.CarPhpRequestLogJob;
+import com.nokia.finance.tasks.jobs.gdc.car.CarPhpRequestLogJob;
 import lombok.extern.slf4j.Slf4j;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;