Browse Source

可视化-粮油储备接口添加市州过滤

Signed-off-by: tangsong <86121657@qq.com>
tangsong 4 months ago
parent
commit
392145dde3

+ 9 - 8
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/controller/GrainOilReserveController.java

@@ -23,6 +23,7 @@ import com.unis.visualization.modular.grainOilReserve.entity.VO.GradeCapacityCha
23
 import com.unis.visualization.modular.grainOilReserve.entity.VO.RotationPlanChart;
23
 import com.unis.visualization.modular.grainOilReserve.entity.VO.RotationPlanChart;
24
 import com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart;
24
 import com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart;
25
 import com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart;
25
 import com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart;
26
+import com.unis.visualization.modular.grainOilReserve.param.CityParam;
26
 import com.unis.visualization.modular.grainOilReserve.param.DepotStockParam;
27
 import com.unis.visualization.modular.grainOilReserve.param.DepotStockParam;
27
 import com.unis.visualization.modular.grainOilReserve.param.GrainOilReserveParam;
28
 import com.unis.visualization.modular.grainOilReserve.param.GrainOilReserveParam;
28
 import com.unis.visualization.modular.grainOilReserve.service.GrainOilReserveService;
29
 import com.unis.visualization.modular.grainOilReserve.service.GrainOilReserveService;
@@ -62,8 +63,8 @@ public class GrainOilReserveController {
62
     @ApiOperationSupport(order = 1)
63
     @ApiOperationSupport(order = 1)
63
     @ApiOperation("获取仓容统计图表信息")
64
     @ApiOperation("获取仓容统计图表信息")
64
     @GetMapping("/visualization/grainOilReserve/getStorehouseChartDatas")
65
     @GetMapping("/visualization/grainOilReserve/getStorehouseChartDatas")
65
-    public CommonResult<StorehouseCapacityChart> getStorehouseChartDatas() {
66
-        return CommonResult.data(grainOilReserveService.getStorehouseChartDatas());
66
+    public CommonResult<StorehouseCapacityChart> getStorehouseChartDatas(@Valid CityParam param) {
67
+        return CommonResult.data(grainOilReserveService.getStorehouseChartDatas(param));
67
     }
68
     }
68
 
69
 
69
     /**
70
     /**
@@ -75,8 +76,8 @@ public class GrainOilReserveController {
75
     @ApiOperationSupport(order = 2)
76
     @ApiOperationSupport(order = 2)
76
     @ApiOperation("获取品种统计图表信息")
77
     @ApiOperation("获取品种统计图表信息")
77
     @GetMapping("/visualization/grainOilReserve/getVarietyChartDatas")
78
     @GetMapping("/visualization/grainOilReserve/getVarietyChartDatas")
78
-    public CommonResult<List<VarietyCapacityChart>> getVarietyChartDatas() {
79
-        return CommonResult.data(grainOilReserveService.getVarietyChartDatas());
79
+    public CommonResult<List<VarietyCapacityChart>> getVarietyChartDatas(@Valid CityParam param) {
80
+        return CommonResult.data(grainOilReserveService.getVarietyChartDatas(param));
80
     }
81
     }
81
 
82
 
82
     /**
83
     /**
@@ -88,8 +89,8 @@ public class GrainOilReserveController {
88
     @ApiOperationSupport(order = 3)
89
     @ApiOperationSupport(order = 3)
89
     @ApiOperation("获取等级统计图表信息")
90
     @ApiOperation("获取等级统计图表信息")
90
     @GetMapping("/visualization/grainOilReserve/getGradeChartDatas")
91
     @GetMapping("/visualization/grainOilReserve/getGradeChartDatas")
91
-    public CommonResult<List<GradeCapacityChart>> getGradeChartDatas() {
92
-        return CommonResult.data(grainOilReserveService.getGradeChartDatas());
92
+    public CommonResult<List<GradeCapacityChart>> getGradeChartDatas(@Valid CityParam param) {
93
+        return CommonResult.data(grainOilReserveService.getGradeChartDatas(param));
93
     }
94
     }
94
 
95
 
95
     /**
96
     /**
@@ -101,8 +102,8 @@ public class GrainOilReserveController {
101
     @ApiOperationSupport(order = 4)
102
     @ApiOperationSupport(order = 4)
102
     @ApiOperation("获取各市州品种统计图表信息")
103
     @ApiOperation("获取各市州品种统计图表信息")
103
     @GetMapping("/visualization/grainOilReserve/getCityVarietyChartDatas")
104
     @GetMapping("/visualization/grainOilReserve/getCityVarietyChartDatas")
104
-    public CommonResult<List<CityVarietyCapacityChart>> getCityVarietyChartDatas() {
105
-        return CommonResult.data(grainOilReserveService.getCityVarietyChartDatas());
105
+    public CommonResult<List<CityVarietyCapacityChart>> getCityVarietyChartDatas(@Valid CityParam param) {
106
+        return CommonResult.data(grainOilReserveService.getCityVarietyChartDatas(param));
106
     }
107
     }
107
 
108
 
108
     /**
109
     /**

+ 14 - 11
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/mapper/GrainOilReserveMapper.java

@@ -35,38 +35,41 @@ public interface GrainOilReserveMapper  {
35
     /**
35
     /**
36
      * 仓房和油罐总容量
36
      * 仓房和油罐总容量
37
      * @return
37
      * @return
38
+     * @param cityId
38
      */
39
      */
39
-    StorehouseCapacityChart getStorehouseCapacity();
40
+    StorehouseCapacityChart getStorehouseCapacity(@Param("cityId") String cityId);
40
 
41
 
41
     /**
42
     /**
42
      * 得到原粮油总库存
43
      * 得到原粮油总库存
43
      * @return
44
      * @return
45
+     * @param cityId
44
      */
46
      */
45
-    StorehouseCapacityChart getStorehouseStock();
47
+    StorehouseCapacityChart getStorehouseStock(@Param("cityId") String cityId);
46
 
48
 
47
-    List<VarietyCapacityChart> getVarietyChartDatas();
49
+    List<VarietyCapacityChart> getVarietyChartDatas(@Param("cityId") String cityId);
48
 
50
 
49
-    List<GradeCapacityChart> getGradeChartDatas();
51
+    List<GradeCapacityChart> getGradeChartDatas(@Param("cityId") String cityId);
50
 
52
 
51
-    List<CityVarietyCapacityChart> getCityVarietyChartDatas();
53
+    List<CityVarietyCapacityChart> getCityVarietyChartDatas(@Param("cityId") String cityId);
52
 
54
 
53
-    List<CurrentCrkCapacityChart> getCurrentCrkChartDatas(@Param("crkType") Integer crkType);
55
+    List<CurrentCrkCapacityChart> getCurrentCrkChartDatas(@Param("crkType") Integer crkType, @Param("cityId") String cityId);
54
 
56
 
55
     RotationPlanChart getRotationPalnChartDatas();
57
     RotationPlanChart getRotationPalnChartDatas();
56
 
58
 
57
-    List<DeportStockChart> getDepotStockChartDatas(@Param("queryType")Integer queryType);
59
+    List<DeportStockChart> getDepotStockChartDatas(@Param("queryType") Integer queryType);
58
 
60
 
59
     DeportStockDetail getDepotStockDetail(@Param("orgId") Integer orgId);
61
     DeportStockDetail getDepotStockDetail(@Param("orgId") Integer orgId);
60
 
62
 
61
-    DeportStockDetail getStorehouseDetail(@Param("orgId")Integer orgId);
63
+    DeportStockDetail getStorehouseDetail(@Param("orgId") Integer orgId);
62
 
64
 
63
-    DeportStockDetail getTankDetail(@Param("orgId")Integer orgId);
65
+    DeportStockDetail getTankDetail(@Param("orgId") Integer orgId);
64
 
66
 
65
-    List<StockDetail> getStockDetailList(@Param("orgId")Integer orgId);
67
+    List<StockDetail> getStockDetailList(@Param("orgId") Integer orgId);
66
 
68
 
67
     /**
69
     /**
68
      * 得到去年今日库存
70
      * 得到去年今日库存
69
      * @return
71
      * @return
72
+     * @param cityId
70
      */
73
      */
71
-    StorehouseCapacityChart getYesteryearStorehouseStock();
74
+    StorehouseCapacityChart getYesteryearStorehouseStock(@Param("cityId") String cityId);
72
 }
75
 }

+ 52 - 12
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/mapper/mapping/GrainOilReserveMapper.xml

@@ -3,34 +3,56 @@
3
 <mapper namespace="com.unis.visualization.modular.grainOilReserve.mapper.GrainOilReserveMapper">
3
 <mapper namespace="com.unis.visualization.modular.grainOilReserve.mapper.GrainOilReserveMapper">
4
 
4
 
5
     <select id="getStorehouseCapacity" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
5
     <select id="getStorehouseCapacity" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
6
-       SELECT ROUND(SUM(designCapacity)/10000,3) as designCapacity FROM (
7
-        SELECT  SUM(IFNULL(a.design_capacity,0.0)) as  designCapacity  FROM depot_qh.basic_storehouse a where a.del_flag =1
6
+      SELECT ROUND(SUM(designCapacity)/10000,3) as designCapacity FROM (
7
+        SELECT  IFNULL(a.design_capacity,0.0) as  designCapacity,org_id as orgId  FROM depot_qh.basic_storehouse a where a.del_flag =1
8
         UNION ALL
8
         UNION ALL
9
-        SELECT  SUM(IFNULL(a.tank_capacity,0.0)) as  designCapacity  FROM depot_qh.basic_tank a where a.del_flag =1
9
+        SELECT  IFNULL(a.tank_capacity,0.0) as  designCapacity,org_id as orgId  FROM depot_qh.basic_tank a where a.del_flag =1
10
         ) x
10
         ) x
11
+    LEFT JOIN depot_qh.org_info b on x.orgId = b.org_id
12
+    LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
13
+        <if test="cityId != null and cityId != ''">
14
+            where c.zcdz_city = #{cityId}
15
+        </if>
11
     </select>
16
     </select>
12
     <select id="getStorehouseStock" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
17
     <select id="getStorehouseStock" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
13
       SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl  FROM depot_qh.data_kcgl_kcsw_default a
18
       SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl  FROM depot_qh.data_kcgl_kcsw_default a
19
+        LEFT JOIN depot_qh.org_info b on a.UnitID = b.org_id
20
+        LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
21
+        <if test="cityId != null and cityId != ''">
22
+            where c.zcdz_city = #{cityId}
23
+        </if>
14
     </select>
24
     </select>
15
     <select id="getYesteryearStorehouseStock" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
25
     <select id="getYesteryearStorehouseStock" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart">
16
-        SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) yesterYearKcsl
26
+         SELECT ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) yesterYearKcsl
17
         FROM (
27
         FROM (
18
-        SELECT *,
19
-        ROW_NUMBER() OVER (PARTITION BY hwh ORDER BY rq DESC) AS rn
20
-        FROM depot_qh.data_kcgl_fcbgz_default  where   DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 YEAR),'%Y-%m-%d') >=  DATE_FORMAT(rq,'%Y-%m-%d')
28
+        SELECT a.kcsl,
29
+        ROW_NUMBER() OVER (PARTITION BY a.hwh ORDER BY a.rq DESC) AS rn
30
+        FROM depot_qh.data_kcgl_fcbgz_default a
31
+				LEFT JOIN depot_qh.org_info b on a.UnitID = b.org_id
32
+				LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
33
+				where   DATE_FORMAT(DATE_ADD(NOW(),INTERVAL -1 YEAR),'%Y-%m-%d') >=  DATE_FORMAT(a.rq,'%Y-%m-%d')
34
+                <if test="cityId != null and cityId != ''">
35
+                   and c.zcdz_city = #{cityId}
36
+                </if>
21
         ) t
37
         ) t
22
         WHERE rn = 1;
38
         WHERE rn = 1;
23
 
39
 
24
     </select>
40
     </select>
25
     <select id="getVarietyChartDatas" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart">
41
     <select id="getVarietyChartDatas" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart">
26
         SELECT
42
         SELECT
27
-        a.pz ,
28
-        b.enumname pzName,
29
-        ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl  FROM depot_qh.data_kcgl_kcsw_default a
30
-        LEFT JOIN depot_qh.basic_enum b on a.pz =  b.enumId
43
+            a.pz ,
44
+            e.enumname pzName,
45
+            ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as kcsl
46
+        FROM depot_qh.data_kcgl_kcsw_default a
47
+        LEFT JOIN depot_qh.basic_enum e on a.pz =  e.enumId
48
+        LEFT JOIN depot_qh.org_info b on a.UnitID = b.org_id
49
+        LEFT JOIN province_all.biz_unit_info c on b.unit_info_id = c.id
50
+        <if test="cityId != null and cityId != ''">
51
+            where  c.zcdz_city = #{cityId}
52
+        </if>
31
         GROUP BY
53
         GROUP BY
32
         a.pz,
54
         a.pz,
33
-        b.enumname
55
+        e.enumname
34
         ORDER BY a.pz
56
         ORDER BY a.pz
35
     </select>
57
     </select>
36
     <select id="getGradeChartDatas" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.GradeCapacityChart">
58
     <select id="getGradeChartDatas" resultType="com.unis.visualization.modular.grainOilReserve.entity.VO.GradeCapacityChart">
@@ -47,7 +69,12 @@
47
         ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as sumZl  FROM depot_qh.data_kcgl_kcsw_default a
69
         ROUND(IFNULL(SUM(kcsl),0.0)/1000/10000,3) as sumZl  FROM depot_qh.data_kcgl_kcsw_default a
48
         LEFT JOIN depot_qh.basic_enum b on a.pz =  b.enumId
70
         LEFT JOIN depot_qh.basic_enum b on a.pz =  b.enumId
49
         LEFT JOIN depot_qh.basic_enum c on a.dj =  c.enumId
71
         LEFT JOIN depot_qh.basic_enum c on a.dj =  c.enumId
72
+				LEFT JOIN depot_qh.org_info d on a.UnitID = d.org_id
73
+				LEFT JOIN province_all.biz_unit_info e on d.unit_info_id = e.id
50
         where a.dj in  (3271,3272,3273)
74
         where a.dj in  (3271,3272,3273)
75
+        <if test="cityId != null and cityId != ''">
76
+            and  e.zcdz_city = #{cityId}
77
+        </if>
51
         GROUP by
78
         GROUP by
52
         a.dj,a.pz
79
         a.dj,a.pz
53
         ) x
80
         ) x
@@ -79,6 +106,9 @@ ORDER  by pz
79
 		LEFT JOIN depot_qh.basic_enum e on e.enumId = a.pz
106
 		LEFT JOIN depot_qh.basic_enum e on e.enumId = a.pz
80
     where
107
     where
81
 		d.PARENT_ID =  '1781535965870915586'
108
 		d.PARENT_ID =  '1781535965870915586'
109
+        <if test="cityId != null and cityId != ''">
110
+            and  c.zcdz_city = #{cityId}
111
+        </if>
82
     GROUP BY
112
     GROUP BY
83
         d.ID,d.DICT_LABEL,a.pz,e.enumname
113
         d.ID,d.DICT_LABEL,a.pz,e.enumname
84
 ) x
114
 ) x
@@ -100,7 +130,12 @@ ORDER  by pz
100
                 left JOIN  depot_qh.data_crkyw_ckcmz_default b ON a.BizNo = b.BizNo
130
                 left JOIN  depot_qh.data_crkyw_ckcmz_default b ON a.BizNo = b.BizNo
101
                 LEFT JOIN depot_qh.data_crkyw_ckcm_default  c  on a.BizNo = c.BizNo
131
                 LEFT JOIN depot_qh.data_crkyw_ckcm_default  c  on a.BizNo = c.BizNo
102
                 LEFT JOIN depot_qh.basic_enum d on a.lspz = d.enumId
132
                 LEFT JOIN depot_qh.basic_enum d on a.lspz = d.enumId
133
+                LEFT JOIN depot_qh.org_info m1 on a.UnitID = m1.org_id
134
+                LEFT JOIN province_all.biz_unit_info m2 on m1.unit_info_id = m2.id
103
                 where DATE_FORMAT(a.rmsj,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
135
                 where DATE_FORMAT(a.rmsj,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
136
+                <if test="cityId != null and cityId != ''">
137
+                    and  m2.zcdz_city = #{cityId}
138
+                </if>
104
                 GROUP BY a.lspz,d.enumname
139
                 GROUP BY a.lspz,d.enumname
105
             </when >
140
             </when >
106
             <otherwise >
141
             <otherwise >
@@ -115,7 +150,12 @@ ORDER  by pz
115
                 left JOIN  depot_qh.data_crkyw_cpz_default b ON a.BizNo = b.BizNo
150
                 left JOIN  depot_qh.data_crkyw_cpz_default b ON a.BizNo = b.BizNo
116
                 LEFT JOIN depot_qh.data_crkyw_rkcm_default  c  on a.BizNo = c.BizNo
151
                 LEFT JOIN depot_qh.data_crkyw_rkcm_default  c  on a.BizNo = c.BizNo
117
                 LEFT JOIN depot_qh.basic_enum d on a.lspz = d.enumId
152
                 LEFT JOIN depot_qh.basic_enum d on a.lspz = d.enumId
153
+                LEFT JOIN depot_qh.org_info m1 on a.UnitID = m1.org_id
154
+                LEFT JOIN province_all.biz_unit_info m2 on m1.unit_info_id = m2.id
118
                 where DATE_FORMAT(a.ywdjsj,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
155
                 where DATE_FORMAT(a.ywdjsj,'%Y-%m-%d') = DATE_FORMAT(NOW(),'%Y-%m-%d')
156
+                <if test="cityId != null and cityId != ''">
157
+                    and  m2.zcdz_city = #{cityId}
158
+                </if>
119
                 GROUP BY a.lspz,d.enumname
159
                 GROUP BY a.lspz,d.enumname
120
             </otherwise>
160
             </otherwise>
121
         </choose>
161
         </choose>

+ 33 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/param/CityParam.java

@@ -0,0 +1,33 @@
1
+/*
2
+ * Copyright [2022] [https://www.xiaonuo.vip]
3
+ *
4
+ * Snowy采用APACHE LICENSE 2.0开源协议,您在使用过程中,需要注意以下几点:
5
+ *
6
+ * 1.请不要删除和修改根目录下的LICENSE文件。
7
+ * 2.请不要删除和修改Snowy源码头部的版权声明。
8
+ * 3.本项目代码可免费商业使用,商业使用请保留源码和相关描述文件的项目出处,作者声明等。
9
+ * 4.分发源码时候,请注明软件出处 https://www.xiaonuo.vip
10
+ * 5.不可二次分发开源参与同类竞品,如有想法可联系团队xiaonuobase@qq.com商议合作。
11
+ * 6.若您的项目无法满足以上几点,需要更多功能代码,获取Snowy商业授权许可,请在官网购买授权,地址为 https://www.xiaonuo.vip
12
+ */
13
+package com.unis.visualization.modular.grainOilReserve.param;
14
+
15
+import io.swagger.annotations.ApiModelProperty;
16
+import lombok.Getter;
17
+import lombok.Setter;
18
+
19
+/**
20
+ * 可视化-粮油储备市州过滤参数
21
+ *
22
+ * @author TS
23
+ * @date  2024/07/25 11:08
24
+ **/
25
+@Getter
26
+@Setter
27
+public class CityParam {
28
+
29
+
30
+    @ApiModelProperty(value = "市州Id", position = 1)
31
+    private String cityId;
32
+
33
+}

+ 3 - 0
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/param/GrainOilReserveParam.java

@@ -32,4 +32,7 @@ public class GrainOilReserveParam {
32
     @ApiModelProperty(value = "出入库类型 3:入库,1:出库")
32
     @ApiModelProperty(value = "出入库类型 3:入库,1:出库")
33
     private Integer crkType;
33
     private Integer crkType;
34
 
34
 
35
+    @ApiModelProperty(value = "市州Id", position = 2)
36
+    private String cityId;
37
+
35
 }
38
 }

+ 9 - 4
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/service/GrainOilReserveService.java

@@ -22,6 +22,7 @@ import com.unis.visualization.modular.grainOilReserve.entity.VO.GradeCapacityCha
22
 import com.unis.visualization.modular.grainOilReserve.entity.VO.RotationPlanChart;
22
 import com.unis.visualization.modular.grainOilReserve.entity.VO.RotationPlanChart;
23
 import com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart;
23
 import com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart;
24
 import com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart;
24
 import com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart;
25
+import com.unis.visualization.modular.grainOilReserve.param.CityParam;
25
 import com.unis.visualization.modular.grainOilReserve.param.DepotStockParam;
26
 import com.unis.visualization.modular.grainOilReserve.param.DepotStockParam;
26
 import com.unis.visualization.modular.grainOilReserve.param.GrainOilReserveParam;
27
 import com.unis.visualization.modular.grainOilReserve.param.GrainOilReserveParam;
27
 
28
 
@@ -39,26 +40,30 @@ public interface GrainOilReserveService  {
39
     /**
40
     /**
40
      * 获取仓容统计图表信息
41
      * 获取仓容统计图表信息
41
      * @return
42
      * @return
43
+     * @param param
42
      */
44
      */
43
-    StorehouseCapacityChart getStorehouseChartDatas();
45
+    StorehouseCapacityChart getStorehouseChartDatas(CityParam param);
44
 
46
 
45
     /**
47
     /**
46
      * 获取品种统计图表信息
48
      * 获取品种统计图表信息
47
      * @return
49
      * @return
50
+     * @param param
48
      */
51
      */
49
-    List<VarietyCapacityChart> getVarietyChartDatas();
52
+    List<VarietyCapacityChart> getVarietyChartDatas(CityParam param);
50
 
53
 
51
     /**
54
     /**
52
      *获取等级统计图表信息
55
      *获取等级统计图表信息
53
      * @return
56
      * @return
57
+     * @param param
54
      */
58
      */
55
-    List<GradeCapacityChart> getGradeChartDatas();
59
+    List<GradeCapacityChart> getGradeChartDatas(CityParam param);
56
 
60
 
57
     /**
61
     /**
58
      *获取各市州品种统计图表信息
62
      *获取各市州品种统计图表信息
59
      * @return
63
      * @return
64
+     * @param param
60
      */
65
      */
61
-    List<CityVarietyCapacityChart> getCityVarietyChartDatas();
66
+    List<CityVarietyCapacityChart> getCityVarietyChartDatas(CityParam param);
62
 
67
 
63
     /**
68
     /**
64
      * 获取当日出入库统计图表信息
69
      * 获取当日出入库统计图表信息

+ 29 - 12
unis-plugin/unis-plugin-biz/src/main/java/com/unis/visualization/modular/grainOilReserve/service/impl/GrainOilReserveServiceImpl.java

@@ -23,6 +23,7 @@ import com.unis.visualization.modular.grainOilReserve.entity.VO.StockDetail;
23
 import com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart;
23
 import com.unis.visualization.modular.grainOilReserve.entity.VO.StorehouseCapacityChart;
24
 import com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart;
24
 import com.unis.visualization.modular.grainOilReserve.entity.VO.VarietyCapacityChart;
25
 import com.unis.visualization.modular.grainOilReserve.mapper.GrainOilReserveMapper;
25
 import com.unis.visualization.modular.grainOilReserve.mapper.GrainOilReserveMapper;
26
+import com.unis.visualization.modular.grainOilReserve.param.CityParam;
26
 import com.unis.visualization.modular.grainOilReserve.param.DepotStockParam;
27
 import com.unis.visualization.modular.grainOilReserve.param.DepotStockParam;
27
 import com.unis.visualization.modular.grainOilReserve.param.GrainOilReserveParam;
28
 import com.unis.visualization.modular.grainOilReserve.param.GrainOilReserveParam;
28
 import com.unis.visualization.modular.grainOilReserve.service.GrainOilReserveService;
29
 import com.unis.visualization.modular.grainOilReserve.service.GrainOilReserveService;
@@ -47,13 +48,22 @@ public class GrainOilReserveServiceImpl  implements GrainOilReserveService {
47
      * 获取仓容统计图表信息
48
      * 获取仓容统计图表信息
48
      *
49
      *
49
      * @return
50
      * @return
51
+     * @param param
50
      */
52
      */
51
     @Override
53
     @Override
52
-    public StorehouseCapacityChart getStorehouseChartDatas() {
54
+    public StorehouseCapacityChart getStorehouseChartDatas(CityParam param) {
53
         //得到总库容 单位:万吨
55
         //得到总库容 单位:万吨
54
-        StorehouseCapacityChart chart =grainOilReserveMapper.getStorehouseCapacity();
56
+        StorehouseCapacityChart chart =grainOilReserveMapper.getStorehouseCapacity(param.getCityId());
57
+        if (chart == null){
58
+            chart = new StorehouseCapacityChart();
59
+            chart.setDesignCapacity(BigDecimal.ZERO);
60
+        }
55
         //总库存 单位:万吨
61
         //总库存 单位:万吨
56
-        StorehouseCapacityChart kcslChart =grainOilReserveMapper.getStorehouseStock();
62
+        StorehouseCapacityChart kcslChart =grainOilReserveMapper.getStorehouseStock(param.getCityId());
63
+        if (kcslChart == null){
64
+            kcslChart = new StorehouseCapacityChart();
65
+            kcslChart.setKcsl(0.0);
66
+        }
57
         BigDecimal  designCapacity = chart.getDesignCapacity();
67
         BigDecimal  designCapacity = chart.getDesignCapacity();
58
         Double kcsl = kcslChart.getKcsl();
68
         Double kcsl = kcslChart.getKcsl();
59
         chart.setKcsl(kcsl);
69
         chart.setKcsl(kcsl);
@@ -61,10 +71,14 @@ public class GrainOilReserveServiceImpl  implements GrainOilReserveService {
61
         BigDecimal actualNoneCapacity =NumberUtil.sub(designCapacity,kcsl);
71
         BigDecimal actualNoneCapacity =NumberUtil.sub(designCapacity,kcsl);
62
         chart.setActualNoneCapacity(actualNoneCapacity);
72
         chart.setActualNoneCapacity(actualNoneCapacity);
63
         //得到仓容比例
73
         //得到仓容比例
64
-        BigDecimal capacityRate = NumberUtil.mul(NumberUtil.div(kcsl,designCapacity),100);
74
+        BigDecimal capacityRate = designCapacity.doubleValue()==0.0?BigDecimal.ZERO:NumberUtil.mul(NumberUtil.div(kcsl,designCapacity),100);
65
         chart.setCapacityRate(capacityRate);
75
         chart.setCapacityRate(capacityRate);
66
         //得到去年今日库存
76
         //得到去年今日库存
67
-        StorehouseCapacityChart yesterYearKcslChart =grainOilReserveMapper.getYesteryearStorehouseStock();
77
+        StorehouseCapacityChart yesterYearKcslChart =grainOilReserveMapper.getYesteryearStorehouseStock(param.getCityId());
78
+        if (yesterYearKcslChart !=null){
79
+            yesterYearKcslChart = new StorehouseCapacityChart();
80
+            yesterYearKcslChart.setYesterYearKcsl(0.0);
81
+        }
68
         Double yesterYearKcsl = yesterYearKcslChart.getYesterYearKcsl();
82
         Double yesterYearKcsl = yesterYearKcslChart.getYesterYearKcsl();
69
         //在计算同比增长率时,如果分母为0,会产生无穷大的结果。为避免这种情况,可以将上期数据设定一个极小值,例如0.001,以确保计算结果的可靠性
83
         //在计算同比增长率时,如果分母为0,会产生无穷大的结果。为避免这种情况,可以将上期数据设定一个极小值,例如0.001,以确保计算结果的可靠性
70
         if (yesterYearKcsl == 0.0){
84
         if (yesterYearKcsl == 0.0){
@@ -82,30 +96,33 @@ public class GrainOilReserveServiceImpl  implements GrainOilReserveService {
82
      * 获取品种统计图表信息
96
      * 获取品种统计图表信息
83
      *
97
      *
84
      * @return
98
      * @return
99
+     * @param param
85
      */
100
      */
86
     @Override
101
     @Override
87
-    public List<VarietyCapacityChart> getVarietyChartDatas() {
88
-        return grainOilReserveMapper.getVarietyChartDatas();
102
+    public List<VarietyCapacityChart> getVarietyChartDatas(CityParam param) {
103
+        return grainOilReserveMapper.getVarietyChartDatas(param.getCityId());
89
     }
104
     }
90
 
105
 
91
     /**
106
     /**
92
      * 获取等级统计图表信息
107
      * 获取等级统计图表信息
93
      *
108
      *
94
      * @return
109
      * @return
110
+     * @param param
95
      */
111
      */
96
     @Override
112
     @Override
97
-    public List<GradeCapacityChart> getGradeChartDatas() {
98
-        return grainOilReserveMapper.getGradeChartDatas();
113
+    public List<GradeCapacityChart> getGradeChartDatas(CityParam param) {
114
+        return grainOilReserveMapper.getGradeChartDatas(param.getCityId());
99
     }
115
     }
100
 
116
 
101
     /**
117
     /**
102
      * 获取各市州品种统计图表信息
118
      * 获取各市州品种统计图表信息
103
      *
119
      *
104
      * @return
120
      * @return
121
+     * @param param
105
      */
122
      */
106
     @Override
123
     @Override
107
-    public List<CityVarietyCapacityChart> getCityVarietyChartDatas() {
108
-        return grainOilReserveMapper.getCityVarietyChartDatas();
124
+    public List<CityVarietyCapacityChart> getCityVarietyChartDatas(CityParam param) {
125
+        return grainOilReserveMapper.getCityVarietyChartDatas(param.getCityId());
109
     }
126
     }
110
 
127
 
111
     /**
128
     /**
@@ -116,7 +133,7 @@ public class GrainOilReserveServiceImpl  implements GrainOilReserveService {
116
      */
133
      */
117
     @Override
134
     @Override
118
     public List<CurrentCrkCapacityChart> getCurrentCrkChartDatas(GrainOilReserveParam param) {
135
     public List<CurrentCrkCapacityChart> getCurrentCrkChartDatas(GrainOilReserveParam param) {
119
-        return grainOilReserveMapper.getCurrentCrkChartDatas(param.getCrkType());
136
+        return grainOilReserveMapper.getCurrentCrkChartDatas(param.getCrkType(),param.getCityId());
120
     }
137
     }
121
 
138
 
122
     /**
139
     /**