licailing 4 лет назад
Родитель
Сommit
fc406aae37

+ 2 - 0
src/main/java/com/izouma/wenlvju/domain/ArtType.java

@@ -32,6 +32,8 @@ public class ArtType extends BaseEntity {
 
     private Long parent1;
 
+    private boolean extra;
+
     @Transient
     private List<ArtType> children = new ArrayList<>();
 }

+ 4 - 0
src/main/java/com/izouma/wenlvju/repo/ArtTypeRepo.java

@@ -15,8 +15,12 @@ public interface ArtTypeRepo extends JpaRepository<ArtType, Long>, JpaSpecificat
     @Transactional
     void softDelete(Long id);
 
+    List<ArtType> findAllByExtraFalse();
+
     List<ArtType> findAllByParentIsNull();
 
+    List<ArtType> findAllByParentIsNullAndExtraFalse();
+
     List<ArtType> findAllByParentIn(Iterable<Long> parent);
 
     ArtType findByCode(String code);

+ 1 - 5
src/main/java/com/izouma/wenlvju/service/regulation/ReportService.java

@@ -64,7 +64,6 @@ public class ReportService {
     private RecordSpecialtyRepo     recordSpecialtyRepo;
     private StorageService          storageService;
     private ReportStatisticRepo     reportStatisticRepo;
-    private RateRepo                rateRepo;
     private PerformanceRepo         performanceRepo;
     private ProgrammeRepo           programmeRepo;
     private ParticipantRepo         participantRepo;
@@ -919,9 +918,6 @@ public class ReportService {
         return url;
     }
 
-    public void rate(int year) {
-        rateRepo.countAllByYearAndRejectedAtIsNull(String.valueOf(year));
-    }
 
     /*
     展演
@@ -934,7 +930,7 @@ public class ReportService {
         Map<Long, Long> participantMap = participantRepo.findAll()
                 .stream()
                 .collect(Collectors.groupingBy(Participant::getProgrammeId, Collectors.counting()));
-        Map<Long, String> artMap = artTypeRepo.findAllByParentIsNull()
+        Map<Long, String> artMap = artTypeRepo.findAllByParentIsNullAndExtraFalse()
                 .stream()
                 .collect(Collectors.toMap(ArtType::getId, ArtType::getName));
 

+ 10 - 0
src/main/java/com/izouma/wenlvju/web/ArtTypeController.java

@@ -46,6 +46,11 @@ public class ArtTypeController extends BaseController {
         return artTypeService.getTree(artTypeRepo.findAll());
     }
 
+    @PostMapping("/allNotExtra")
+    public List<ArtType> allNotExtra() {
+        return artTypeService.getTree(artTypeRepo.findAllByExtraFalse());
+    }
+
     @GetMapping("/get/{id}")
     public ArtType get(@PathVariable Long id) {
         return artTypeRepo.findById(id).orElseThrow(new BusinessException("无记录"));
@@ -68,5 +73,10 @@ public class ArtTypeController extends BaseController {
     public List<ArtType> parent() {
         return artTypeRepo.findAllByParentIsNull();
     }
+
+    @PostMapping("/parentNotExtra")
+    public List<ArtType> parentNotExtra() {
+        return artTypeRepo.findAllByParentIsNullAndExtraFalse();
+    }
 }
 

+ 7 - 0
src/main/java/com/izouma/wenlvju/web/regulation/ReportController.java

@@ -1,6 +1,7 @@
 package com.izouma.wenlvju.web.regulation;
 
 import com.izouma.wenlvju.dto.PerformanceStatistic;
+import com.izouma.wenlvju.repo.RateRepo;
 import com.izouma.wenlvju.web.BaseController;
 import com.izouma.wenlvju.domain.regulation.Report;
 import com.izouma.wenlvju.service.regulation.ReportService;
@@ -27,6 +28,7 @@ import java.util.List;
 public class ReportController extends BaseController {
     private ReportService reportService;
     private ReportRepo    reportRepo;
+    private RateRepo      rateRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -88,5 +90,10 @@ public class ReportController extends BaseController {
     public List<PerformanceStatistic> performanceStatistics() {
         return reportService.performanceStatistics();
     }
+
+    @PostMapping("/attendRate")
+    public long  attendRate(@RequestParam String year) {
+        return rateRepo.countAllByYearAndRejectedAtIsNull(year);
+    }
 }
 

+ 53 - 0
src/main/vue/src/components/select/SpecialtySelect.vue

@@ -0,0 +1,53 @@
+<template>
+    <el-select :value="value" :placeholder="请选择专业" clearable filterable @change="changeSelect" class="filter-item">
+        <el-option v-for="item in options" :key="item.value" :label="item.label" :value="item.value"> </el-option>
+    </el-select>
+</template>
+
+<script>
+export default {
+    props: {
+        value: {
+            type: [Number, String],
+            default: ''
+        },
+        flag: {
+            type: Number,
+            default: 1
+        }
+    },
+    data() {
+        return {
+            options: []
+        };
+    },
+    mounted() {
+        this.$nextTick(() => {
+            this.getList();
+        });
+    },
+    methods: {
+        getList() {
+            this.$http
+                .post('/artType/allNotExtend')
+                .then(res => {
+                    this.options = res.map(item => {
+                        return {
+                            label: item.name,
+                            value: item.id
+                        };
+                    });
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        },
+        changeSelect(val) {
+            this.$emit('input', val);
+        }
+    }
+};
+</script>
+
+<style lang="less" scoped></style>

+ 1 - 1
src/main/vue/src/views/performance/ProgrammeEdit.vue

@@ -447,7 +447,7 @@ export default {
                 this.$message.error(e.error);
             });
         this.$http
-            .post('/artType/allList')
+            .post('/artType/allNotExtra')
             .then(res => {
                 this.artTypes = this.delChild(res);
             })

+ 1 - 1
src/main/vue/src/views/performance/ProgrammeOrgList.vue

@@ -491,7 +491,7 @@ export default {
                 this.$message.error(e.error);
             });
         this.$http
-            .post('/artType/allList')
+            .post('/artType/allNotExtra')
             .then(res => {
                 this.artTypes = this.delChild(res);
             })

+ 16 - 23
src/main/vue/src/views/showStatistic/RatePieWidget.vue → src/main/vue/src/views/showStatistic/AttendRateWidget.vue

@@ -2,7 +2,7 @@
     <widget-card :bodyStyle="bodyStyle" ref="container">
         <template #header>
             <span>等级评定</span>
-            <el-select @change="setChart" style="float:right" v-model="chooseYear" size="mini" placeholder="请选择">
+            <el-select @change="getData" style="float:right" v-model="chooseYear" size="mini" placeholder="请选择">
                 <el-option v-for="item in years" :key="item" :label="item" :value="item"> </el-option>
             </el-select>
         </template>
@@ -12,7 +12,6 @@
 <script>
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
-import widget from '@/mixins/widget';
 
 export default {
     data() {
@@ -21,21 +20,23 @@ export default {
             bodyStyle: {
                 display: 'flex'
             },
-            chooseYear: '2021'
+            chooseYear: '2021',
+            years: ['2021', '2022', '2023', '2024'],
+            attend: 0
         };
     },
-    computed: {
-        years() {
-            return Object.keys({ ...this.allData });
-        }
-    },
+    computed: {},
     mounted() {
-        setTimeout(() => {
-            this.myChart = echarts.init(this.$refs.chart);
-            this.setChart();
-        });
+        this.getData();
     },
     methods: {
+        getData() {
+            this.$http.post('/report/attendRate', { year: this.chooseYear }).then(res => {
+                this.attend = res;
+                this.myChart = echarts.init(this.$refs.chart);
+                this.setChart();
+            });
+        },
         setChart() {
             let option = {
                 tooltip: {
@@ -55,13 +56,6 @@ export default {
                             show: false,
                             position: 'center'
                         },
-                        // emphasis: {
-                        //     label: {
-                        //         show: true,
-                        //         fontSize: '40',
-                        //         fontWeight: 'bold'
-                        //     }
-                        // },
                         labelLine: {
                             length: 10
                         },
@@ -98,8 +92,8 @@ export default {
                             }
                         },
                         data: [
-                            { value: 89, name: '参加' },
-                            { value: 112, name: '未参加' }
+                            { value: this.attend, name: '参加' },
+                            { value: 201 - this.attend, name: '未参加' }
                         ],
                         center: ['50%', '50%']
                     }
@@ -111,8 +105,7 @@ export default {
     },
     components: {
         WidgetCard
-    },
-    mixins: [widget]
+    }
 };
 </script>
 <style lang="less" scoped></style>

+ 3 - 3
src/main/vue/src/views/showStatistic/Dashboard.vue

@@ -38,7 +38,7 @@ import ExamWidegt from './ExamWidegt';
 import PassWidget from './PassWidget';
 import RateWidget from './RateWidget';
 import RateYearWidget from './RateYearWidget';
-import RatePieWidget from './RatePieWidget';
+import AttendRateWidget from './AttendRateWidget';
 import PerformanceWidget from './PerformanceWidget';
 
 export default {
@@ -49,7 +49,7 @@ export default {
                 { x: 0, y: 0, w: 12, h: 5, i: '0', name: 'DatasWidget' },
                 { x: 0, y: 6, w: 6, h: 12, i: '2', name: 'PassWidget' },
                 { x: 6, y: 6, w: 6, h: 12, i: '3', name: 'ExamWidegt' },
-                { x: 0, y: 12, w: 6, h: 12, i: '5', name: 'RatePieWidget' },
+                { x: 0, y: 12, w: 6, h: 12, i: '5', name: 'AttendRateWidget' },
                 { x: 6, y: 12, w: 6, h: 12, i: '6', name: 'RateYearWidget' },
                 { x: 0, y: 18, w: 12, h: 12, i: '7', name: 'PerformanceWidget' }
             ],
@@ -70,7 +70,7 @@ export default {
         ExamWidegt,
         PassWidget,
         RateYearWidget,
-        RatePieWidget,
+        AttendRateWidget,
         RateWidget,
         PerformanceWidget
     }

+ 31 - 13
src/main/vue/src/views/showStatistic/PerformanceWidget.vue

@@ -1,6 +1,6 @@
 <template>
     <widget-card :bodyStyle="bodyStyle" ref="container">
-        <template #header>年度报考考级人数</template>
+        <template #header>年度展演报名数</template>
         <div ref="chart" class="chart" style="flex-grow:1"></div>
     </widget-card>
 </template>
@@ -8,7 +8,6 @@
 import WidgetCard from '@/widgets/WidgetCard';
 import * as echarts from 'echarts';
 import widget from '@/mixins/widget';
-import { th } from 'date-fns/locale';
 
 export default {
     data() {
@@ -18,7 +17,7 @@ export default {
                 display: 'flex'
             },
             list: [],
-            seriesPar: [],
+            seriesPar: new Map(),
             last2020: {
                 year: 2020,
                 programmeNum: [
@@ -57,7 +56,6 @@ export default {
         };
 
         this.$http.get('/report/performanceStatistics').then(res => {
-            // this.list = res;
             this.list.push(this.last2020);
             res.forEach(item => {
                 this.list.push(item);
@@ -94,15 +92,35 @@ export default {
                         folkArt1.push(participantNum[j].num);
                     }
                 }
-                // participantNum.forEach(item => {
-                //     this.seriesPar.push({
-                //         name: item.name,
-                //         type: 'bar',
-                //         stack: 'two',
-                //         emphasis: emphasisStyle,
-                //         data: [item.num]
-                //     });
-                // });
+                programmeNum.forEach(item => {
+                    let key = 'pro' + item.name;
+                    if (this.seriesPar.has(key)) {
+                        this.seriesPar.get(key).data.push(item.num);
+                    } else {
+                        this.seriesPar.set(key, {
+                            name: item.name,
+                            type: 'bar',
+                            stack: 'one',
+                            emphasis: emphasisStyle,
+                            data: [item.num]
+                        });
+                    }
+                });
+                participantNum.forEach(item => {
+                    let key = 'par' + item.name;
+                    if (this.seriesPar.has(key)) {
+                        this.seriesPar.get(key).data.push(item.num);
+                    } else {
+                        this.seriesPar.set(key, {
+                            name: item.name,
+                            type: 'bar',
+                            stack: 'two',
+                            emphasis: emphasisStyle,
+                            data: [item.num]
+                        });
+                    }
+                });
+                console.log(this.seriesPar);
             }
         });
 

+ 0 - 64
src/main/vue/src/views/showStatistic/RateYearWidget.vue

@@ -53,70 +53,6 @@ export default {
                 });
             });
 
-            // let option = {
-            //     tooltip: {
-            //         trigger: 'item',
-            //         alwaysShowContent: true,
-            //         formatter: '{a} <br/>{b}: {c} ({d}%)'
-            //     },
-            //     legend: {
-            //         data: [...data].map(item => {
-            //             return item.name;
-            //         })
-            //     },
-            //     series: [
-            //         {
-            //             name: '投诉数量',
-            //             type: 'pie',
-            //             selectedMode: 'single',
-            //             radius: [0, '60%'],
-            //             label: {
-            //                 formatter: ' {b|{b}:}{c}场 {per|{d}%}  ',
-            //                 backgroundColor: '#F6F8FC',
-            //                 borderColor: '#8C8D8E',
-            //                 borderWidth: 1,
-            //                 borderRadius: 4,
-            //                 rich: {
-            //                     a: {
-            //                         color: '#6E7079',
-            //                         lineHeight: 22,
-            //                         align: 'center'
-            //                     },
-            //                     hr: {
-            //                         borderColor: '#8C8D8E',
-            //                         width: '100%',
-            //                         borderWidth: 1,
-            //                         height: 0
-            //                     },
-            //                     b: {
-            //                         color: '#4C5058',
-            //                         fontSize: 14,
-            //                         fontWeight: 'bold',
-            //                         lineHeight: 33
-            //                     },
-            //                     per: {
-            //                         color: '#fff',
-            //                         backgroundColor: '#4C5058',
-            //                         padding: [3, 4],
-            //                         borderRadius: 4
-            //                     }
-            //                 },
-            //                 position: 'inner',
-            //                 fontSize: 14
-            //             },
-            //             labelLine: {
-            //                 show: false
-            //             },
-            //             data: data,
-            //             select: {
-            //                 label: {
-            //                     show: true
-            //                 }
-            //             }
-            //         }
-            //     ]
-            // };
-
             let option = {
                 title: {
                     left: 'center'