Ver código fonte

fix: 修复不动产资源地图接口维修费统计异常

weijianghai 10 meses atrás
pai
commit
898ab3bdc8

+ 3 - 1
src/main/java/com/nokia/financeapi/config/ApiDocConfig.java

@@ -1,5 +1,6 @@
 package com.nokia.financeapi.config;
 
+import com.nokia.financeapi.utils.AESUtil;
 import io.swagger.v3.oas.models.OpenAPI;
 import io.swagger.v3.oas.models.info.Info;
 import io.swagger.v3.oas.models.parameters.Parameter;
@@ -20,13 +21,14 @@ public class ApiDocConfig {
 
     @Bean
     public OpenApiCustomiser openApiCustomiser() {
+        String token = AESUtil.getTestToken();
         return openApi -> openApi.getPaths().values().forEach(pathItem -> pathItem.readOperations().forEach(operation -> {
             Parameter headerParam = new Parameter()
                     .required(true)
                     .in("header")
                     .name("token")
                     .description("访问令牌")
-                    .example("zoQtYlmhk/add/mBUBZD5mFJB1IXEwaLRS97Uf9z9Hlqdh/UHio66b35GOo/eEziALCI90sLNBn3WM7k1/FVGgGiDUO84mJ2JUgw5zHx8fvcO/OxqUB83JYaeV6eJIWkvJpp");
+                    .example(token);
             operation.addParametersItem(headerParam);
         }));
     }

+ 25 - 25
src/main/java/com/nokia/financeapi/dao/house/HouseResourceMapMapper.java

@@ -179,17 +179,17 @@ limit 10
 ),
 t102 as (
 select
-    building_id,
-    sum(amount) as maintenance_cost
+    jz_jzid as building_id,
+    sum(final_cost) as maintenance_cost
 from
-    house.building_repair_main_month
+    house.building_repair_month
 where
     repair_type != '财务预提冲销'
-    and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
+    and exists (select 1 from t101 where t101.building_id = house.building_repair_month.jz_jzid)
     and year_month >= #{dto.startDate}
     and year_month <= #{dto.endDate}
 group by
-    building_id
+    jz_jzid
 ),
 t103 as (
 select
@@ -249,17 +249,17 @@ order by
 ),
 t103 as (
 select
-    building_id,
-    sum(amount) as maintenance_cost
+    jz_jzid as building_id,
+    sum(final_cost) as maintenance_cost
 from
-    house.building_repair_main_month
+    house.building_repair_month
 where
     repair_type != '财务预提冲销'
-    and exists (select 1 from t102 where t102.building_id = house.building_repair_main_month.building_id)
+    and exists (select 1 from t102 where t102.building_id = house.building_repair_month.jz_jzid)
     and year_month >= #{dto.startDate}
     and year_month <= #{dto.endDate}
 group by
-    building_id
+    jz_jzid
 ),
 t104 as (
 select
@@ -512,17 +512,17 @@ order by
 ),
 t102 as (
 select
-    building_id,
-    sum(amount) as maintenance_cost
+    jz_jzid as building_id,
+    sum(final_cost) as maintenance_cost
 from
-    house.building_repair_main_month
+    house.building_repair_month
 where
     repair_type != '财务预提冲销'
-    and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
+    and exists (select 1 from t101 where t101.building_id = house.building_repair_month.jz_jzid)
     and year_month >= #{dto.startDate}
     and year_month <= #{dto.endDate}
 group by
-    building_id
+    jz_jzid
 ),
 t103 as (
 select
@@ -575,17 +575,17 @@ order by
 ),
 t102 as (
 select
-    building_id,
-    sum(amount) as maintenance_cost
+    jz_jzid as building_id,
+    sum(final_cost) as maintenance_cost
 from
-    house.building_repair_main_month
+    house.building_repair_month
 where
     repair_type != '财务预提冲销'
-    and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
+    and exists (select 1 from t101 where t101.building_id = house.building_repair_month.jz_jzid)
     and year_month >= #{dto.startDate}
     and year_month <= #{dto.endDate}
 group by
-    building_id
+    jz_jzid
 ),
 t103 as (
 select
@@ -638,17 +638,17 @@ order by
 ),
 t102 as (
 select
-    building_id,
-    sum(amount) as maintenance_cost
+    jz_jzid as building_id,
+    sum(final_cost) as maintenance_cost
 from
-    house.building_repair_main_month
+    house.building_repair_month
 where
     repair_type != '财务预提冲销'
-    and exists (select 1 from t101 where t101.building_id = house.building_repair_main_month.building_id)
+    and exists (select 1 from t101 where t101.building_id = house.building_repair_month.jz_jzid)
     and year_month >= #{dto.startDate}
     and year_month <= #{dto.endDate}
 group by
-    building_id
+    jz_jzid
 ),
 t103 as (
 select

+ 22 - 1
src/main/java/com/nokia/financeapi/utils/AESUtil.java

@@ -69,6 +69,27 @@ public class AESUtil {
         return decrypt(str, KEY);
     }
 
+    public static String getTestToken() {
+        // 参数
+        HashMap<String, String> map = new HashMap<>();
+        // 财务系统id, 固定值
+        map.put("APP_ID", "FINANCE");
+        // 时间戳
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        map.put("TIME_STAMP", sdf.format(new Date()));
+        // 当前登录账号
+        map.put("LOGIN_ID", "test");
+        //请求的地址
+        map.put("REQUEST_URL","");
+        map.put("EXPIRE_TIME","604800");
+        // 加密串
+        try {
+            return AESUtil.encrypt(new Gson().toJson(map), KEY);
+        } catch (Exception e) {
+            return "";
+        }
+    }
+
     public static void main(String[] args) throws Exception {
 // 参数
         HashMap<String, String> map = new HashMap<>();
@@ -82,7 +103,7 @@ public class AESUtil {
         map.put("LOGIN_ID", "test");
         //请求的地址
         map.put("REQUEST_URL","");
-        map.put("EXPIRE_TIME","10");
+        map.put("EXPIRE_TIME","3600");
 
         // 加密串
         String encrypt = AESUtil.encrypt(new Gson().toJson(map), "2na$$PdV9AW8b#CS");