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

+ 15 - 0
src/main/java/com/izouma/wenlvju/dto/PerformanceStatistic.java

@@ -0,0 +1,15 @@
+package com.izouma.wenlvju.dto;
+
+import com.izouma.wenlvju.domain.regulation.NumOfReport;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class PerformanceStatistic {
+    private int year;
+
+    private List<NumOfReport> programmeNum;
+
+    private List<NumOfReport> participantNum;
+}

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

@@ -19,6 +19,8 @@ public interface ProgrammeRepo extends JpaRepository<Programme, Long>, JpaSpecif
 
     List<Programme> findAllByPerformanceIdAndProgrammeStatus(Long performanceId, ProgrammeStatus status);
 
+    List<Programme> findAllByProgrammeStatusIsNot(ProgrammeStatus status);
+
     long countAllByPerformanceId(Long performanceId);
 
     long countAllByArrangeIdAndSignedInIsNull(Long arrangeId);

+ 58 - 9
src/main/java/com/izouma/wenlvju/service/regulation/ReportService.java

@@ -4,18 +4,23 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.core.util.StrUtil;
-import com.izouma.wenlvju.domain.GradingOrganization;
-import com.izouma.wenlvju.domain.Organization;
-import com.izouma.wenlvju.domain.Record;
-import com.izouma.wenlvju.domain.RecordSpecialty;
+import com.izouma.wenlvju.domain.*;
+import com.izouma.wenlvju.domain.performance.Participant;
+import com.izouma.wenlvju.domain.performance.Performance;
+import com.izouma.wenlvju.domain.performance.Programme;
 import com.izouma.wenlvju.domain.regulation.*;
 import com.izouma.wenlvju.dto.ChartItem;
 import com.izouma.wenlvju.dto.PageQuery;
+import com.izouma.wenlvju.dto.PerformanceStatistic;
 import com.izouma.wenlvju.dto.ReportDTO;
+import com.izouma.wenlvju.enums.ProgrammeStatus;
 import com.izouma.wenlvju.enums.ReportType;
 import com.izouma.wenlvju.enums.UnitType;
 import com.izouma.wenlvju.exception.BusinessException;
 import com.izouma.wenlvju.repo.*;
+import com.izouma.wenlvju.repo.performance.ParticipantRepo;
+import com.izouma.wenlvju.repo.performance.PerformanceRepo;
+import com.izouma.wenlvju.repo.performance.ProgrammeRepo;
 import com.izouma.wenlvju.repo.regulation.ComplainRepo;
 import com.izouma.wenlvju.repo.regulation.RecordExpertAuditRepo;
 import com.izouma.wenlvju.repo.regulation.ReportRepo;
@@ -25,6 +30,7 @@ import com.izouma.wenlvju.service.storage.StorageService;
 import com.izouma.wenlvju.utils.ChartUtils;
 import com.izouma.wenlvju.utils.JpaUtils;
 import com.izouma.wenlvju.utils.ObjUtils;
+import com.sun.tools.doclint.Entity;
 import freemarker.template.Configuration;
 import freemarker.template.Template;
 import freemarker.template.TemplateException;
@@ -47,6 +53,8 @@ import java.time.LocalTime;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import static com.sun.tools.doclint.Entity.sum;
+
 @Slf4j
 @Service
 @AllArgsConstructor
@@ -62,6 +70,10 @@ public class ReportService {
     private StorageService          storageService;
     private ReportStatisticRepo     reportStatisticRepo;
     private RateRepo                rateRepo;
+    private PerformanceRepo         performanceRepo;
+    private ProgrammeRepo           programmeRepo;
+    private ParticipantRepo         participantRepo;
+    private ArtTypeRepo             artTypeRepo;
 
     public Page<Report> all(PageQuery pageQuery) {
         return reportRepo.findAll(JpaUtils.toSpecification(pageQuery, Report.class), JpaUtils.toPageRequest(pageQuery));
@@ -255,11 +267,6 @@ public class ReportService {
             // 备案
             int examCenterQuantity = value.stream().mapToInt(Record::getExamCenterQuantity).sum();
             int examQuantity = value.stream().mapToInt(Record::getExamQuantity).sum();
-//            // 备案检查
-//            List<Long> rids = recordList.stream().map(Record::getId).collect(Collectors.toList());
-//            Map<String, Long> type = recordAudits.stream()
-//                    .filter(ra -> ids.contains(ra.getRecordId()) && !ra.isValue())
-//                    .collect(Collectors.groupingBy(RecordExpertAudit::getType, Collectors.counting()));
 
             reportDTOS.add(ReportStatistic.builder()
                     .unitType(UnitType.GRADING_ORGANIZATION)
@@ -921,4 +928,46 @@ public class ReportService {
         rateRepo.countAllByYearAndRejectedAtIsNull(String.valueOf(year));
     }
 
+    /*
+    展演
+     */
+    public List<PerformanceStatistic> performanceStatistics() {
+        List<Programme> programmes = programmeRepo.findAllByProgrammeStatusIsNot(ProgrammeStatus.INITIAL);
+        List<Performance> performances = performanceRepo.findAll();
+        Map<Long, List<Programme>> programmeMap = programmes.stream()
+                .collect(Collectors.groupingBy(Programme::getPerformanceId));
+        Map<Long, Long> participantMap = participantRepo.findAll()
+                .stream()
+                .collect(Collectors.groupingBy(Participant::getProgrammeId, Collectors.counting()));
+        Map<Long, String> artMap = artTypeRepo.findAllByParentIsNull()
+                .stream()
+                .collect(Collectors.toMap(ArtType::getId, ArtType::getName));
+
+        List<PerformanceStatistic> statistics = new ArrayList<>();
+        List<NumOfReport> programmeNum = new ArrayList<>();
+        List<NumOfReport> participantNum = new ArrayList<>();
+        performances.forEach(performance -> {
+            PerformanceStatistic performanceStatistic = new PerformanceStatistic();
+            performanceStatistic.setYear(Integer.parseInt(performance.getYear()));
+
+            List<Programme> programmeList = programmeMap.get(performance.getId());
+            Map<Long, List<Programme>> specialty = programmeList.stream()
+                    .collect(Collectors.groupingBy(Programme::getParentSpecialtyId));
+            specialty.forEach((key, value) -> {
+                String name = artMap.get(key);
+                programmeNum.add(new NumOfReport(name, value.size()));
+                long sum = value.stream()
+                        .mapToLong(programme -> ObjectUtil.isNull(participantMap.get(programme.getId())) ? 0L : participantMap.get(programme.getId()))
+                        .sum();
+                participantNum.add(new NumOfReport(name, (int) sum));
+            });
+            performanceStatistic.setParticipantNum(participantNum);
+            performanceStatistic.setProgrammeNum(programmeNum);
+
+            statistics.add(performanceStatistic);
+        });
+
+        return statistics;
+    }
+
 }

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

@@ -1,5 +1,6 @@
 package com.izouma.wenlvju.web.regulation;
 
+import com.izouma.wenlvju.dto.PerformanceStatistic;
 import com.izouma.wenlvju.web.BaseController;
 import com.izouma.wenlvju.domain.regulation.Report;
 import com.izouma.wenlvju.service.regulation.ReportService;
@@ -82,5 +83,10 @@ public class ReportController extends BaseController {
         Report report = reportRepo.findById(id).orElseThrow(new BusinessException("无记录"));
         return reportService.generateWord(report);
     }
+
+    @GetMapping("/performanceStatistics")
+    public List<PerformanceStatistic> performanceStatistics() {
+        return reportService.performanceStatistics();
+    }
 }
 

+ 10 - 10
src/main/vue/src/router.js

@@ -881,7 +881,7 @@ const router = new Router({
             meta: {
                 title: '登录'
             }
-        }
+        },
         /**初审 */
         // {
         //     path: '/programmeGOList',
@@ -892,15 +892,15 @@ const router = new Router({
         //     }
         // },
         /**节目评审 */
-        // {
-        //     path: '/programmeScoreList',
-        //     name: 'ProgrammeScoreList',
-        //     component: () =>
-        //         import(/* webpackChunkName: "programmeScoreList" */ '@/views/performance/ProgrammeScoreList.vue'),
-        //     meta: {
-        //         title: '节目评审'
-        //     }
-        // }
+        {
+            path: '/programmeScoreList',
+            name: 'ProgrammeScoreList',
+            component: () =>
+                import(/* webpackChunkName: "programmeScoreList" */ '@/views/performance/ProgrammeScoreList.vue'),
+            meta: {
+                title: '节目评审'
+            }
+        }
     ]
 });
 router.beforeEach((to, from, next) => {

+ 10 - 10
src/main/vue/src/views/performance/ProgrammeScoreList.vue

@@ -105,9 +105,9 @@
             <!-- <el-table-column prop="score" label="成绩"> </el-table-column> -->
             <el-table-column prop="myScore" label="评分" align="center" min-width="80">
                 <template slot-scope="{ row }">
-                    <span v-if="!row.myScore">暂无</span>
-                    <span v-else>{{ row.myScore }}</span>
-                    <!-- <el-input-number
+                    <span v-if="row.myScore">{{ row.myScore }}</span>
+                    <!-- <span v-else>{{ row.myScore }}</span> -->
+                    <el-input-number
                         v-else
                         v-model="row.myScore"
                         size="mini"
@@ -119,28 +119,28 @@
                         controls-position="both"
                         @change="saveScore(row)"
                     >
-                    </el-input-number> -->
+                    </el-input-number>
                 </template>
             </el-table-column>
             <el-table-column prop="remark" label="备注" align="center" min-width="80">
                 <template slot-scope="{ row }">
-                    <span v-if="!row.remark">暂无</span>
-                    <span v-else>{{ row.remark }}</span>
-                    <!-- <el-input
+                    <span v-if="row.remark">{{ row.remark }}</span>
+                    <!-- <span v-else>{{ row.remark }}</span> -->
+                    <el-input
                         v-else
                         size="mini"
                         @change="saveScore(row)"
                         v-model="row.remark"
                         placeholder="请输入备注"
                         clearable
-                    ></el-input> -->
+                    ></el-input>
                 </template>
             </el-table-column>
-            <el-table-column label="操作" align="left" fixed="right" min-width="100">
+            <!-- <el-table-column label="操作" align="left" fixed="right" min-width="100">
                 <template slot-scope="{ row, $index }">
                     <el-button @click="playVideo(row, $index)" size="mini" plain type="primary">查看作品</el-button>
                 </template>
-            </el-table-column>
+            </el-table-column> -->
         </el-table>
         <div class="pagination-wrapper">
             <!-- <div class="multiple-mode-wrapper">

+ 2 - 5
src/main/vue/src/views/rate/RateListPending.vue

@@ -138,8 +138,8 @@
         >
             <el-table-column v-if="multipleMode" align="center" type="selection" width="50"> </el-table-column>
             <!-- <el-table-column prop="id" label="ID" width="100"> </el-table-column> -->
-            <el-table-column prop="name" label="承办单位" min-width="120"> </el-table-column>
-            <el-table-column prop="createdAt" label="申请时间" min-width="100"></el-table-column>
+            <el-table-column prop="name" label="承办单位" min-width="140"> </el-table-column>
+            <!-- <el-table-column prop="createdAt" label="申请时间" min-width="100"></el-table-column> -->
             <el-table-column prop="year" label="年度" min-width="60"> </el-table-column>
             <el-table-column prop="gradingOrganization" label="考级机构" min-width="120"> </el-table-column>
             <el-table-column prop="district" label="地址" min-width="100">
@@ -147,9 +147,6 @@
             </el-table-column>
             <el-table-column prop="status1" label="状态" min-width="100"> </el-table-column>
             <el-table-column prop="expertScore" label="参考分">
-                <!-- <template slot="header" slot-scope="{ column }">
-                    <sortable-header :column="column" :current-sort="sort" @changeSort="changeSort"> </sortable-header>
-                </template> -->
                 <template slot-scope="{ row }">
                     <span v-if="row.expertScore">{{ row.expertScore }}</span>
                     <span v-else>暂无</span>

+ 5 - 2
src/main/vue/src/views/showStatistic/Dashboard.vue

@@ -39,6 +39,7 @@ import PassWidget from './PassWidget';
 import RateWidget from './RateWidget';
 import RateYearWidget from './RateYearWidget';
 import RatePieWidget from './RatePieWidget';
+import PerformanceWidget from './PerformanceWidget';
 
 export default {
     created() {},
@@ -50,7 +51,8 @@ export default {
                 { x: 6, y: 6, w: 6, h: 12, i: '3', name: 'ExamWidegt' },
                 // { x: 6, y: 6, w: 6, h: 12, i: '4', name: 'ArtTypeWidget' },
                 { x: 0, y: 18, w: 6, h: 12, i: '5', name: 'RatePieWidget' },
-                { x: 6, y: 18, w: 6, h: 12, i: '5', name: 'RateYearWidget' }
+                { x: 6, y: 18, w: 6, h: 12, i: '6', name: 'RateYearWidget' },
+                { x: 0, y: 18, w: 12, h: 12, i: '7', name: 'PerformanceWidget' }
                 // { x: 0, y: 24, w: 12, h: 12, i: '6', name: 'RateWidget' }
             ],
             editable: false
@@ -71,7 +73,8 @@ export default {
         PassWidget,
         RateYearWidget,
         RatePieWidget,
-        RateWidget
+        RateWidget,
+        PerformanceWidget
     }
 };
 </script>

+ 230 - 0
src/main/vue/src/views/showStatistic/PerformanceWidget.vue

@@ -0,0 +1,230 @@
+<template>
+    <widget-card :bodyStyle="bodyStyle" ref="container">
+        <template #header>年度报考考级人数</template>
+        <div ref="chart" class="chart" style="flex-grow:1"></div>
+    </widget-card>
+</template>
+<script>
+import WidgetCard from '@/widgets/WidgetCard';
+import * as echarts from 'echarts';
+import widget from '@/mixins/widget';
+import { th } from 'date-fns/locale';
+
+export default {
+    data() {
+        return {
+            myChart: null,
+            bodyStyle: {
+                display: 'flex'
+            },
+            list: [],
+            seriesPar: [],
+            last2020: {
+                year: 2020,
+                programmeNum: [
+                    { name: '戏曲戏剧', num: 100 },
+                    { name: '音乐', num: 967 },
+                    { name: '美术', num: 875 },
+                    { name: '舞蹈', num: 124 }
+                ],
+                participantNum: [
+                    { name: '戏曲戏剧', num: 435 },
+                    { name: '音乐', num: 1198 },
+                    { name: '美术', num: 875 },
+                    { name: '舞蹈', num: 345 }
+                ]
+            }
+        };
+    },
+    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 = res;
+            this.list.push(this.last2020);
+            res.forEach(item => {
+                this.list.push(item);
+            });
+
+            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++) {
+                    names.push(participantNum[j].name);
+                    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);
+                    }
+                }
+                // participantNum.forEach(item => {
+                //     this.seriesPar.push({
+                //         name: item.name,
+                //         type: 'bar',
+                //         stack: 'two',
+                //         emphasis: emphasisStyle,
+                //         data: [item.num]
+                //     });
+                // });
+            }
+        });
+
+        setTimeout(() => {
+            this.$nextTick(() => {
+                var chartDom = this.$refs.chart;
+                var myChart = echarts.init(chartDom);
+                var option;
+                console.log(this.seriesPar);
+                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: {},
+                    xAxis: {
+                        data: xAxisData,
+                        name: '年份',
+                        axisLine: { onZero: true },
+                        splitLine: { show: false },
+                        splitArea: { show: false }
+                    },
+                    yAxis: {},
+                    grid: {
+                        bottom: 20
+                    },
+                    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
+                        }
+                    ]
+                };
+
+                option && myChart.setOption(option);
+            });
+        }, 500);
+    },
+    components: {
+        WidgetCard
+    },
+    mixins: [widget]
+};
+</script>
+<style lang="less" scoped></style>

+ 5 - 0
src/test/java/com/izouma/wenlvju/service/regulation/ReportServiceTest.java

@@ -159,4 +159,9 @@ public class ReportServiceTest extends ApplicationTests {
                 .build();
         reportService.poiWord(report);
     }
+
+    @Test
+    public void test7(){
+        System.out.println(reportService.performanceStatistics());
+    }
 }