瀏覽代碼

feat: 中层干部年龄分布统计

zhangying 1 月之前
父節點
當前提交
ef8385da32

+ 5 - 0
src/main/java/com/ghsc/partybuild/controller/BigDataController.java

@@ -564,5 +564,10 @@ public class BigDataController {
         return bigDataService.getZtdrTotalList(year);
     }
 
+    @ResponseBody
+    @GetMapping("/getLeaderTeamNlCount")
+    public List<HashMap<String, Object>> getLeaderTeamNlCount() {
+        return bigDataService.selectLeaderTeamNlCount();
+    }
 
 }

+ 3 - 0
src/main/java/com/ghsc/partybuild/mapper/BigDataCQuery.java

@@ -251,4 +251,7 @@ public interface BigDataCQuery {
 
     List<HashMap<String, Object>> selectZtdrTotalList(Integer year);
 
+    // 中层干部年龄分段统计
+    List<HashMap<String, Object>> selectLeaderTeamNlCount();
+
 }

+ 2 - 0
src/main/java/com/ghsc/partybuild/service/BigDataService.java

@@ -370,4 +370,6 @@ public interface BigDataService {
 
     List<HashMap<String, Object>> getZtdrTotalList(Integer year);
 
+    // 中层干部年龄分段统计
+    List<HashMap<String, Object>> selectLeaderTeamNlCount();
 }

+ 5 - 0
src/main/java/com/ghsc/partybuild/service/impl/BigDataServiceImpl.java

@@ -602,4 +602,9 @@ public class BigDataServiceImpl implements BigDataService {
         return result;
     }
 
+    // 中层干部年龄分段统计
+    @Override
+    public List<HashMap<String, Object>> selectLeaderTeamNlCount() {
+        return bigDataCquery.selectLeaderTeamNlCount();
+    }
 }

+ 17 - 0
src/main/resources/mapping/BigDataCQuery.xml

@@ -777,4 +777,21 @@
         select month(ACTIVITYTIME) as month,count(1) as count from dj_ztdrxx where year(ACTIVITYTIME) = #{year} group by month(ACTIVITYTIME)
     </select>
 
+    <select id="selectLeaderTeamNlCount" resultType="java.util.HashMap">
+        SELECT
+            CASE
+                WHEN TIMESTAMPDIFF(YEAR, birthDate, CURDATE()) BETWEEN 21 AND 30 THEN '21-30岁'
+                WHEN TIMESTAMPDIFF(YEAR, birthDate, CURDATE()) BETWEEN 31 AND 40 THEN '31-40岁'
+                WHEN TIMESTAMPDIFF(YEAR, birthDate, CURDATE()) BETWEEN 41 AND 50 THEN '41-50岁'
+                ELSE '51岁以上'
+                END AS AGENAME,
+            COUNT(1) AS NUM
+        FROM
+            lw_leaderteam
+        WHERE
+            leaderTeamType = 1 -- 副处以上中层干部
+        GROUP BY
+            AGENAME
+    </select>
+
 </mapper>

+ 2 - 2
src/main/resources/static/app/main/bigdata/showDjdsj/home.html

@@ -288,9 +288,9 @@
             </div>
         </div>
         <div class="box b-3" style="height: calc(100% - 510px);">
-            <h1>性别情况</h1>
+            <h1>中层干部年龄分布</h1>
             <!-- 图表容器 -->
-            <div e-chart ec-data="dyxb_pieOption" class="charts2"></div>
+            <div e-chart ec-data="ltgbnl_pieOption" class="charts2"></div>
         </div>
     </div>
 </div>

+ 79 - 0
src/main/resources/static/app/main/bigdata/showDjdsj/home.js

@@ -427,6 +427,85 @@
             };
             $scope.load_dyxb();
 
+            //中层干部年龄
+            $scope.ltgbnl_dataList = [];
+            $scope.ltgbnl_pieOption = {
+                tooltip: {
+                    trigger: 'item',
+                    formatter: function (data) {
+                        return data.seriesName + "<br/>" + data.name + " : " + data.value + " (" + data.percent.toFixed(0) + "%)";
+                    }
+                },
+                legend: {
+                    type: 'scroll',
+                    orient: 'vertical',
+                    right: 0,
+                    bottom: 5,
+                    data: $scope.ltgbnl_dataList,
+                    top: '10%',
+                    icon: "circle",
+                    textStyle: {
+                        color: '#fff'
+                    },
+                    formatter: function (name) {
+                        var target = 0;
+                        angular.forEach($scope.ltgbnl_dataList, function (item, index) {
+                            if (item.name == name) {
+                                target = item.value;
+                            }
+                        });
+                        return name + ':' + target;
+                    }
+                },
+                series: [
+
+                    {
+                        name: '中层干部年龄',
+                        type: 'pie',
+                        radius: ['50%', '80%'],
+                        avoidLabelOverlap: false,
+                        label: {
+                            normal: {
+                                show: false,
+                                position: 'center'
+                            },
+                            emphasis: {
+                                show: true,
+                                textStyle: {
+                                    fontSize: '20',
+                                    fontWeight: 'bold'
+                                }
+                            }
+                        },
+                        labelLine: {
+                            normal: {
+                                show: false
+                            }
+                        },
+                        data: $scope.ltgbnl_dataList,
+                        center: ['30%', '50%']
+                    }
+                ]
+            };
+            $scope.load_ltgbnl = function () {
+                $scope.ltgbnl_dataList.length = 0;
+                $http
+                ({
+                    method: 'get',
+                    url: '../../api/bigdata/getLeaderTeamNlCount',
+                    params: {}
+                }).then(function (result) {
+                    $scope.ltgbnl_dataList.length = 0;
+                    if (result.data != null && result.data.length > 0) {
+                        let colors = ['#F8B551', '#918879', '#EFF0C7', '#91C7AE', '#DCDCDC', '#F0FFFF', '#005983'];
+                        angular.forEach(result.data, function (val, index) {
+                            $scope.ltgbnl_dataList.push($scope.getPieData(val.NUM, val.AGENAME, colors[index]));
+                        });
+                    }
+                });
+            };
+            $scope.load_ltgbnl();
+
             //三会一课
             $scope.shyk_dataList = [];
             $scope.shyk_pieOption = {