智慧保安后台管理-外网项目备份
Administrator
2022-01-19 29e064a60b78ae87d0479159089ffeb27f43833c
新增考试查询统计
7 files modified
1 files added
144 ■■■■■ changed files
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java 9 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml 28 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/ExamPaperService.java 12 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java 17 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamStatisticsVO.java 55 ●●●●● patch | view | raw | blame | history
src/main/resources/log/logback-dev.xml 6 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java
@@ -33,6 +33,7 @@
import org.springblade.modules.exam.service.ExamPaperService;
import org.springblade.modules.exam.vo.ExamPaperSubjectVO;
import org.springblade.modules.exam.vo.ExamPaperVO;
import org.springblade.modules.exam.vo.ExamStatisticsVO;
import org.springblade.modules.exam.vo.ExamSubjectChoicesVO;
import org.springblade.modules.exam.wrapper.ExamPaperWrapper;
import org.springblade.modules.system.entity.User;
@@ -418,6 +419,17 @@
        return R.data(examPaperService.getExamRefreshInfo(examPaperVO));
    }
    /**
     * 查询考试统计信息
     * @param examPaperVO
     * @return
     */
    @GetMapping("/getExamStatistics")
    public R getExamStatistics(ExamPaperVO examPaperVO, Query query){
        IPage<ExamStatisticsVO> pages = examPaperService.getExamStatistics(Condition.getPage(query), examPaperVO);
        return R.data(pages);
    }
}
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java
@@ -25,6 +25,7 @@
import org.springblade.modules.exam.entity.ExamSubjectChoices;
import org.springblade.modules.exam.vo.ExamPaperSubjectVO;
import org.springblade.modules.exam.vo.ExamPaperVO;
import org.springblade.modules.exam.vo.ExamStatisticsVO;
import org.springblade.modules.exam.vo.ExamSubjectChoicesVO;
import org.springblade.modules.training.entity.TrainingRegistration;
@@ -132,4 +133,12 @@
     * @return
     */
    Integer getExamNumber(@Param("examPaper") ExamPaperVO examPaperVO1);
    /**
     * 查询考试统计信息
     * @param examPaper
     * @param page
     * @return
     */
    List<ExamStatisticsVO> getExamStatistics(@Param("page") IPage<ExamStatisticsVO> page,@Param("examPaper") ExamPaperVO examPaper);
}
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.xml
@@ -384,4 +384,32 @@
        and cancel = 1
    </select>
    <!--考试查询统计-->
    <select id="getExamStatistics" resultType="org.springblade.modules.exam.vo.ExamStatisticsVO">
        SELECt
        ke.id,ke.start_time startTime,ke.end_time endTime,bd.dept_name schoolName,
        ifnull(a.c,0) znum,
        ifnull(b.c,0) yknum,
        ifnull(c.c,0) qknum,
        ifnull(d.c,0) ycnum,
        ifnull(e.c,0) qxnum
        from ksxt_exam ke
        left join (select count(*) c,train_exam_id from sys_training_registration GROUP BY train_exam_id) a on a.train_exam_id = ke.id
        left join (select count(*) c,train_exam_id from sys_training_registration where 1=1 and (is_exam = 2 or is_exam = 3)  GROUP BY train_exam_id) b on b.train_exam_id = ke.id
        left join (select count(*) c,train_exam_id from sys_training_registration str left join blade_user bu on bu.id = str.user_id where 1=1 and is_exam = 4 and cancel =2 or (is_exam=1 and cancel =1) and bu.examination_type!=1 GROUP BY train_exam_id) c on c.train_exam_id = ke.id
        left join (select count(*) c,train_exam_id from sys_training_registration str left join blade_user bu on bu.id = str.user_id where 1=1 and cancel =1 and is_exam = 1 and bu.examination_type = 1 GROUP BY train_exam_id) d on d.train_exam_id = ke.id
        left join (select count(*) c,train_exam_id from sys_training_registration where 1=1 and is_exam = 1 and cancel =2 GROUP BY train_exam_id) e on e.train_exam_id = ke.id
        left join blade_user bu2 on bu2.id = ke.creator
        left join blade_dept bd on bd.id = bu2.dept_id
        where 1=1
        and ke.audit_status = 1
        <if test="examPaper.schoolName!=null and examPaper.schoolName!=''">
            and bd.dept_name like concat('%',#{examPaper.schoolName},'%')
        </if>
        <if test="examPaper.examTime!=null and examPaper.examTime!=''">
            and date_format(ke.start_time,'%Y-%m-%d') = #{examPaper.examTime}
        </if>
        order by ke.id desc
    </select>
</mapper>
src/main/java/org/springblade/modules/exam/service/ExamPaperService.java
@@ -21,10 +21,7 @@
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.exam.entity.ExamPaper;
import org.springblade.modules.exam.entity.ExamSubjectChoices;
import org.springblade.modules.exam.vo.ExamPaperSubjectVO;
import org.springblade.modules.exam.vo.ExamPaperVO;
import org.springblade.modules.exam.vo.ExamScoreVO;
import org.springblade.modules.exam.vo.ExamSubjectChoicesVO;
import org.springblade.modules.exam.vo.*;
import org.springblade.modules.training.entity.TrainingRegistration;
import java.util.List;
@@ -112,4 +109,11 @@
     * @return
     */
    Map<String,Object> getExamRefreshInfo(ExamPaperVO examPaperVO);
    /**
     * 查询考试统计信息
     * @param examPaperVO
     * @return
     */
    IPage<ExamStatisticsVO> getExamStatistics(IPage<ExamStatisticsVO> page, ExamPaperVO examPaperVO);
}
src/main/java/org/springblade/modules/exam/service/impl/ExamPaperServiceImpl.java
@@ -24,10 +24,7 @@
import org.springblade.modules.exam.entity.*;
import org.springblade.modules.exam.mapper.ExamPaperMapper;
import org.springblade.modules.exam.service.*;
import org.springblade.modules.exam.vo.ExamPaperSubjectVO;
import org.springblade.modules.exam.vo.ExamPaperVO;
import org.springblade.modules.exam.vo.ExamScoreVO;
import org.springblade.modules.exam.vo.ExamSubjectChoicesVO;
import org.springblade.modules.exam.vo.*;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.service.TrainingRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -259,4 +256,16 @@
        }
        return null;
    }
    /**
     * 查询考试统计信息
     * @param examPaperVO
     * @param page
     * @return
     */
    @Override
    public IPage<ExamStatisticsVO> getExamStatistics(IPage<ExamStatisticsVO> page, ExamPaperVO examPaperVO) {
        return page.setRecords(baseMapper.getExamStatistics(page,examPaperVO));
    }
}
src/main/java/org/springblade/modules/exam/vo/ExamPaperVO.java
@@ -94,4 +94,9 @@
     * 考试时间
     */
    private String examTime;
    /**
     * 学校名称
     */
    private String schoolName;
}
src/main/java/org/springblade/modules/exam/vo/ExamStatisticsVO.java
New file
@@ -0,0 +1,55 @@
package org.springblade.modules.exam.vo;
import lombok.Data;
/**
 * 考试查询统计返回VO
 * @author zhongrj
 * @since 2022-01-18
 */
@Data
public class ExamStatisticsVO {
    private Long id;
    /**
     * 培训学校名称
     */
    private String schoolName;
    /**
     * 考试开始时间
     */
    private String startTime;
    /**
     * 考试结束时间
     */
    private String endTime;
    /**
     * 报名总人数
     */
    private Integer znum;
    /**
     * 已考试人数
     */
    private Integer yknum;
    /**
     * 缺考/未考试/笔试人数
     */
    private Integer qknum;
    /**
     * 审查异常人数
     */
    private Integer ycnum;
    /**
     * 已取消考试人数
     */
    private Integer qxnum;
}
src/main/resources/log/logback-dev.xml
@@ -27,8 +27,8 @@
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件输出的文件名 -->
            <!-- 日志文件输出的文件名 -->
            <FileNamePattern>/home/zhongsong/log/info/info-%d{yyyy-MM-dd}.log</FileNamePattern>
            <maxHistory>10</maxHistory>
            <FileNamePattern>/home/zhongsong/log/warn/warn-%d{yyyy-MM-dd}.log</FileNamePattern>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] [%logger{50}] %n%-5level: %msg%n</pattern>
@@ -46,7 +46,7 @@
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 日志文件输出的文件名 -->
            <FileNamePattern>/home/zhongsong/log/error/error-%d{yyyy-MM-dd}.log</FileNamePattern>
            <maxHistory>10</maxHistory>
            <maxHistory>30</maxHistory>
        </rollingPolicy>
        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
            <pattern>%n%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{traceId}] [%logger{50}] %n%-5level: %msg%n</pattern>