licailing 4 년 전
부모
커밋
8185a4fff8

+ 2 - 0
src/main/java/com/izouma/wenlvju/repo/RateRepo.java

@@ -33,6 +33,8 @@ public interface RateRepo extends JpaRepository<Rate, Long>, JpaSpecificationExe
 
     List<Rate> findAllByStatusAndYearOrderByScoreDesc(RateStatus status, String year);
 
+    List<Rate> findAllByYear(String year);
+
     Long countAllByYearAndRejectedAtIsNull(String year);
 
 }

+ 25 - 1
src/main/java/com/izouma/wenlvju/web/regulation/ReportController.java

@@ -1,6 +1,10 @@
 package com.izouma.wenlvju.web.regulation;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.izouma.wenlvju.domain.Rate;
 import com.izouma.wenlvju.dto.PerformanceStatistic;
+import com.izouma.wenlvju.enums.OrganizationGrade;
+import com.izouma.wenlvju.enums.RateStatus;
 import com.izouma.wenlvju.repo.RateRepo;
 import com.izouma.wenlvju.web.BaseController;
 import com.izouma.wenlvju.domain.regulation.Report;
@@ -20,7 +24,10 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 @RestController
 @RequestMapping("/report")
@@ -92,8 +99,25 @@ public class ReportController extends BaseController {
     }
 
     @PostMapping("/attendRate")
-    public long  attendRate(@RequestParam String year) {
+    public long attendRate(@RequestParam String year) {
         return rateRepo.countAllByYearAndRejectedAtIsNull(year);
     }
+
+    @PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/rateResult")
+    public Map<String, Long> rateResult(@RequestParam String year) {
+        List<Rate> rates = rateRepo.findAllByYear(year);
+        Map<OrganizationGrade, Long> gradeMap = rates.stream()
+                .filter(rate -> ObjectUtil.isNotNull(rate.getGrade()))
+                .collect(Collectors.groupingBy(Rate::getGrade, Collectors.counting()));
+
+        long count = rates.stream()
+                .filter(rate -> ObjectUtil.isNull(rate.getGrade()) && !rate.isRejected()).count();
+
+        Map<String, Long> map = new HashMap<>();
+        gradeMap.forEach((key, value) -> map.put(key.name(),value));
+        map.put("CANCEL",count);
+        return map;
+    }
 }
 

+ 1 - 1
src/main/vue/src/views/Admin.vue

@@ -104,7 +104,7 @@ import { mapState } from 'vuex';
 export default {
     name: 'admin',
     created() {
-        console.log(this.paths);
+        // console.log(this.paths);
         this.getMenus();
         let fn = () => {
             this.isFullscreen = document.fullScreen || document.mozFullScreen || document.webkitIsFullScreen;

+ 3 - 1
src/main/vue/src/views/showStatistic/PassWidget.vue

@@ -22,13 +22,15 @@ export default {
     mounted() {
         setTimeout(() => {
             this.$nextTick(() => {
-                let info = { ...this.allData };
+                // let info = { ...this.allData };
+                // console.log(info);
                 // let data = Object.keys(info).map(item => {
                 //     return {
                 //         year: item,
                 //         ...info[item]
                 //     };
                 // });
+                // console.log(data);
                 let data = [
                     { year: 2019, baokao: 20.8 },
                     { year: 2020, baokao: 18.5 },

+ 125 - 223
src/main/vue/src/views/showStatistic/PerformanceWidget.vue

@@ -7,7 +7,6 @@
 <script>
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
-import widget from '@/mixins/widget';
 
 export default {
     data() {
@@ -17,87 +16,64 @@ export default {
                 display: 'flex'
             },
             list: [],
-            seriesPar: new Map(),
             last2020: {
                 year: 2020,
                 programmeNum: [
-                    { name: '戏曲戏剧', num: 100 },
                     { name: '音乐', num: 967 },
+                    { name: '舞蹈', num: 124 },
                     { name: '美术', num: 875 },
-                    { name: '舞蹈', num: 124 }
+                    { name: '戏曲戏剧', num: 100 },
+                    { name: '曲艺', num: 0 }
                 ],
                 participantNum: [
-                    { name: '戏曲戏剧', num: 435 },
                     { name: '音乐', num: 1198 },
+                    { name: '舞蹈', num: 345 },
                     { name: '美术', num: 875 },
-                    { name: '舞蹈', num: 345 }
+                    { name: '戏曲戏剧', num: 435 },
+                    { name: '曲艺', num: 0 }
                 ]
-            }
+            },
+            values: []
         };
     },
     mounted() {
-        let names = [];
-        let xAxisData = [];
-        let music = [];
-        let dance = [];
-        let art = [];
-        let operaDrama = [];
-        let folkArt = [];
-        let music1 = [];
-        let dance1 = [];
-        let art1 = [];
-        let operaDrama1 = [];
-        let folkArt1 = [];
-        var emphasisStyle = {
-            itemStyle: {
-                shadowBlur: 10,
-                shadowColor: 'rgba(0,0,0,0.3)'
-            }
-        };
-
-        this.$http.get('/report/performanceStatistics').then(res => {
-            this.list.push(this.last2020);
-            res.forEach(item => {
-                this.list.push(item);
-            });
+        setTimeout(() => {
+            this.$http
+                .get('/report/performanceStatistics')
+                .then(res => {
+                    this.list.push(this.last2020);
+                    res.forEach(item => {
+                        this.list.push(item);
+                    });
+                })
+                .then(() => {
+                    this.$nextTick(() => {
+                        this.setChart();
+                    });
+                });
+        }, 500);
+    },
+    methods: {
+        setChart() {
+            let seriesMap = new Map();
+            let names = [];
+            let xAxisData = [];
+            var emphasisStyle = {
+                itemStyle: {
+                    shadowBlur: 10,
+                    shadowColor: 'rgba(0,0,0,0.3)'
+                }
+            };
 
             for (let i = 0; i < this.list.length; i++) {
                 xAxisData.push(this.list[i].year);
                 let programmeNum = this.list[i].programmeNum;
-                for (let j = 0; j < programmeNum.length; j++) {
-                    names.push(programmeNum[j].name);
-                    if (programmeNum[j].name == '音乐') {
-                        music.push(programmeNum[j].num);
-                    } else if (programmeNum[j].name == '舞蹈') {
-                        dance.push(programmeNum[j].num);
-                    } else if (programmeNum[j].name == '美术') {
-                        art.push(programmeNum[j].num);
-                    } else if (programmeNum[j].name == '戏曲戏剧') {
-                        operaDrama.push(programmeNum[j].num);
-                    } else {
-                        folkArt.push(programmeNum[j].num);
-                    }
-                }
-                let participantNum = this.list[i].participantNum;
-                for (let j = 0; j < participantNum.length; j++) {
-                    if (participantNum[j].name == '音乐') {
-                        music1.push(participantNum[j].num);
-                    } else if (participantNum[j].name == '舞蹈') {
-                        dance1.push(participantNum[j].num);
-                    } else if (participantNum[j].name == '美术') {
-                        art1.push(participantNum[j].num);
-                    } else if (participantNum[j].name == '戏曲戏剧') {
-                        operaDrama1.push(participantNum[j].num);
-                    } else {
-                        folkArt1.push(participantNum[j].num);
-                    }
-                }
                 programmeNum.forEach(item => {
                     let key = 'pro' + item.name;
-                    if (this.seriesPar.has(key)) {
-                        this.seriesPar.get(key).data.push(item.num);
+                    if (seriesMap.has(key)) {
+                        seriesMap.get(key).data.push(item.num);
                     } else {
-                        this.seriesPar.set(key, {
+                        seriesMap.set(key, {
                             name: item.name,
                             type: 'bar',
                             stack: 'one',
@@ -106,12 +82,13 @@ export default {
                         });
                     }
                 });
+                let participantNum = this.list[i].participantNum;
                 participantNum.forEach(item => {
                     let key = 'par' + item.name;
-                    if (this.seriesPar.has(key)) {
-                        this.seriesPar.get(key).data.push(item.num);
+                    if (seriesMap.has(key)) {
+                        seriesMap.get(key).data.push(item.num);
                     } else {
-                        this.seriesPar.set(key, {
+                        seriesMap.set(key, {
                             name: item.name,
                             type: 'bar',
                             stack: 'two',
@@ -120,173 +97,98 @@ export default {
                         });
                     }
                 });
-                console.log(this.seriesPar);
             }
-        });
 
-        setTimeout(() => {
-            this.$nextTick(() => {
-                var chartDom = this.$refs.chart;
-                var myChart = echarts.init(chartDom);
-                var option;
-                option = {
-                    legend: {
-                        data: names,
-                        left: '10%'
-                    },
-                    brush: {
-                        // toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
-                        // xAxisIndex: 0
-                    },
-                    toolbox: {
-                        feature: {
-                            magicType: {
-                                type: ['stack']
-                            },
-                            dataView: {}
-                        }
-                    },
-                    tooltip: {
-                        trigger: 'axis',
-                        axisPointer: {
-                            type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
+            let info = Object.fromEntries(seriesMap.entries());
+            this.values = Object.keys(info).map(item => {
+                return {
+                    ...info[item]
+                };
+            });
+
+            var chartDom = this.$refs.chart;
+            var myChart = echarts.init(chartDom);
+            var option;
+            option = {
+                legend: {
+                    data: names,
+                    left: '10%'
+                },
+                brush: {
+                    // toolbox: ['rect', 'polygon', 'lineX', 'lineY', 'keep', 'clear'],
+                    // xAxisIndex: 0
+                },
+                toolbox: {
+                    feature: {
+                        magicType: {
+                            type: ['stack']
                         },
-                        formatter: function(params) {
-                            //自定义划过显示样式
-                            // console.log(params); //params为滑过显示的数据信息
-                            var str = '';
-                            for (var i = 0; i < params.length; i++) {
-                                // console.log(params);
-                                if (i == 0) {
-                                    str += '<br/>' + '节目数量';
-                                    str +=
-                                        '<div style="width:140px;border-top:1px solid #ccc;margin-top:4px;">' +
-                                        params[i].marker +
-                                        params[i].seriesName +
-                                        ':' +
-                                        params[i].value +
-                                        '</div >';
-                                } else if (i == 5) {
-                                    str += '报名人数';
-                                    str +=
-                                        '<div style="width:140px;border-top:1px solid #ccc;margin-top:4px;">' +
-                                        params[i].marker +
-                                        params[i].seriesName +
-                                        ':' +
-                                        params[i].value +
-                                        '</div >';
-                                } else {
-                                    str +=
-                                        '<div style="width:140px;">' +
-                                        params[i].marker +
-                                        params[i].seriesName +
-                                        ':' +
-                                        params[i].value +
-                                        '</div >';
-                                }
-                            }
-                            var tooltipHtml =
-                                '<div style="width:140px;overflow-y:auto;">' +
-                                params[0].axisValue +
-                                '年' +
-                                str +
-                                '</div>';
-                            return tooltipHtml;
-                        }
-                    },
-                    xAxis: {
-                        data: xAxisData,
-                        name: '年份',
-                        axisLine: { onZero: true },
-                        splitLine: { show: false },
-                        splitArea: { show: false }
-                    },
-                    yAxis: {},
-                    grid: {
-                        bottom: 20
+                        dataView: {}
+                    }
+                },
+                tooltip: {
+                    trigger: 'axis',
+                    axisPointer: {
+                        type: 'shadow' // 'shadow' as default; can also be 'line' or 'shadow'
                     },
-                    series: [
-                        {
-                            name: '音乐',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: music
-                        },
-                        {
-                            name: '舞蹈',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: dance
-                        },
-                        {
-                            name: '美术',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: art
-                        },
-                        {
-                            name: '戏曲戏剧',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: operaDrama
-                        },
-                        {
-                            name: '曲艺',
-                            type: 'bar',
-                            stack: 'one',
-                            emphasis: emphasisStyle,
-                            data: folkArt
-                        },
-                        {
-                            name: '音乐',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: music1
-                        },
-                        {
-                            name: '舞蹈',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: dance1
-                        },
-                        {
-                            name: '美术',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: art1
-                        },
-                        {
-                            name: '戏曲戏剧',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: operaDrama1
-                        },
-                        {
-                            name: '曲艺',
-                            type: 'bar',
-                            stack: 'two',
-                            emphasis: emphasisStyle,
-                            data: folkArt1
+                    formatter: function(params) {
+                        //自定义划过显示样式
+                        var str = '';
+                        for (var i = 0; i < params.length; i++) {
+                            // console.log(params);
+                            if (i == 0) {
+                                str += '<br/>' + '节目数量';
+                                str +=
+                                    '<div style="width:140px;border-top:1px solid #ccc;margin-top:4px;">' +
+                                    params[i].marker +
+                                    params[i].seriesName +
+                                    ':' +
+                                    params[i].value +
+                                    '</div >';
+                            } else if (i == 5) {
+                                str += '报名人数';
+                                str +=
+                                    '<div style="width:140px;border-top:1px solid #ccc;margin-top:4px;">' +
+                                    params[i].marker +
+                                    params[i].seriesName +
+                                    ':' +
+                                    params[i].value +
+                                    '</div >';
+                            } else {
+                                str +=
+                                    '<div style="width:140px;">' +
+                                    params[i].marker +
+                                    params[i].seriesName +
+                                    ':' +
+                                    params[i].value +
+                                    '</div >';
+                            }
                         }
-                    ]
-                };
+                        var tooltipHtml =
+                            '<div style="width:140px;overflow-y:auto;">' + params[0].axisValue + '年' + str + '</div>';
+                        return tooltipHtml;
+                    }
+                },
+                xAxis: {
+                    data: xAxisData,
+                    name: '年份',
+                    axisLine: { onZero: true },
+                    splitLine: { show: false },
+                    splitArea: { show: false }
+                },
+                yAxis: {},
+                grid: {
+                    bottom: 20
+                },
+                series: this.values
+            };
 
-                option && myChart.setOption(option);
-            });
-        }, 500);
+            option && myChart.setOption(option);
+        }
     },
     components: {
         WidgetCard
-    },
-    mixins: [widget]
+    }
 };
 </script>
 <style lang="less" scoped></style>

+ 30 - 31
src/main/vue/src/views/showStatistic/RateYearWidget.vue

@@ -12,7 +12,6 @@
 <script>
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
-import widget from '@/mixins/widget';
 
 export default {
     data() {
@@ -21,36 +20,42 @@ export default {
             bodyStyle: {
                 display: 'flex'
             },
-            types: [
-                { name: '优秀', complain: 15, unitType: 'GRADING_ORGANIZATION' },
-                { name: '合格', complain: 60, unitType: 'GRADING_ORGANIZATION' },
-                { name: '不合格', complain: 0, unitType: 'GRADING_ORGANIZATION' },
-                { name: '取消参评', complain: 14, unitType: 'GRADING_ORGANIZATION' }
-            ],
-            chooseYear: '2021'
+            types: [],
+            chooseYear: '2021',
+            years: ['2021', '2022', '2023', '2024']
         };
     },
-    computed: {
-        years() {
-            return Object.keys({ ...this.allData });
-        }
-    },
+    computed: {},
     mounted() {
         setTimeout(() => {
-            this.myChart = echarts.init(this.$refs.chart);
-            this.setChart();
+            this.getData();
+            // this.myChart = echarts.init(this.$refs.chart);
+            // this.setChart();
         });
     },
     methods: {
+        getData() {
+            this.$http.post('/report/rateResult', { year: this.chooseYear }).then(res => {
+                this.types = res;
+                this.myChart = echarts.init(this.$refs.chart);
+                this.setChart();
+            });
+        },
         setChart() {
-            let res = [...this.types];
-            let data = [];
-
-            res.forEach(item => {
-                data.push({
-                    name: item.name,
-                    value: item.complain
-                });
+            console.log(this.types);
+            let data = Object.keys(this.types).map(item => {
+                let name = '取消';
+                if (item == 'EXCELLENT') {
+                    name = '优秀';
+                } else if (item == 'ELIGIBLE') {
+                    name = '合格';
+                } else if (item == 'NOT_ELIGIBLE') {
+                    name = '不合格';
+                }
+                return {
+                    name: name,
+                    value: this.types[item]
+                };
             });
 
             let option = {
@@ -69,12 +74,7 @@ export default {
                         name: '2021年等级评定',
                         type: 'pie',
                         radius: '60%',
-                        data: [
-                            { value: 15, name: '优秀' },
-                            { value: 60, name: '合格' },
-                            { value: 0, name: '不合格' },
-                            { value: 14, name: '取消参评' }
-                        ],
+                        data: data,
                         emphasis: {
                             itemStyle: {
                                 shadowBlur: 10,
@@ -126,8 +126,7 @@ export default {
     },
     components: {
         WidgetCard
-    },
-    mixins: [widget]
+    }
 };
 </script>
 <style lang="less" scoped></style>