智慧保安后台管理-外网项目备份
Administrator
2021-07-22 fd72a9045a8fc437b8c28bac0bdc98e0d29aa441
考试接口合并
23 files modified
9 files added
855 ■■■■■ changed files
src/main/java/org/springblade/modules/apply/controller/ApplyController.java 87 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/controller/ExamPaymentController.java 100 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/entity/Apply.java 15 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/entity/ExamPayment.java 84 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/excel/ApplyExcel.java 50 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/excel/ApplyImporter.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ExamPaymentMapper.java 33 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ExamPaymentMapper.xml 38 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/ApplyService.java 19 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/ExamPaymentService.java 30 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java 185 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/impl/ExamPaymentServiceImpl.java 53 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/vo/ApplyVO.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/vo/ExamPaymentVO.java 48 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamSubjectChoicesController.java 13 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamSubjectOptionController.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/entity/ExamExaminationSubject.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/entity/ExamPaper.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/entity/ExamScore.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/entity/ExamSubjectChoices.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java 3 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamPaperSubjectVO.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamScoreVO.java 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamSubjectChoicesVO.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/vo/ExamSubjectOptionVO.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/wrapper/ExamPaperWrapper.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -9,18 +9,28 @@
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyExcel;
import org.springblade.modules.apply.excel.ApplyImporter;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.vo.ApplyVO;
import org.springblade.modules.exam.entity.ExamPaper;
import org.springblade.modules.exam.service.ExamPaperService;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * @author zhongrj
@@ -85,10 +95,35 @@
        if (null==apply.getId()){
            //去生成准考证号码
            apply.setCandidateNo(getCandidateNo(apply));
            //去生成考试编号
            apply.setApplyCode(getApplyCode(apply));
            //默认通过
            apply.setApplyStatus(2);
            apply.setApplyTime(new Date());
        }
        return R.status(applyService.saveOrUpdate(apply));
    }
    /**
     * 导入报名考试数据
     */
    @PostMapping("import-apply")
    @ApiOperation(value = "导入报名考试数据", notes = "传入excel")
    public R importUser(MultipartFile file, Integer isCovered) {
        ApplyImporter applyImporter = new ApplyImporter(applyService, isCovered == 1);
        ExcelUtil.save(file, applyImporter, ApplyExcel.class);
        return R.success("操作成功");
    }
    /**
     * 导出模板
     */
    @GetMapping("export-template")
    @ApiOperation(value = "导出模板")
    public void exportUser(HttpServletResponse response) {
        List<ApplyExcel> list = new ArrayList<>();
        ExcelUtil.export(response, "考试报名数据模板", "考试报名数据表", list, ApplyExcel.class);
    }
    /**
@@ -147,6 +182,58 @@
        return null;
    }
    /**
     * 生成准考证号码
     * @param apply 考试报名信息对象
     */
    private String getApplyCode(Apply apply) {
        //获取考试信息
        ExamPaper examPaper = examPaperService.getById(apply.getExamId());
        if (null!=examPaper.getStartTime()){
            String format = new SimpleDateFormat("yyyy-MM-dd").format(examPaper.getStartTime());
            String year = format.substring(2,4);
            String quarter  = null;
            String months = null;
            String days = null;
            int month = Integer.parseInt(format.substring(5,7));
            int day = Integer.parseInt(format.substring(8,10));
            if (month>0 && month<=3){
                quarter = "C";
            }
            if (month>3 && month<=6){
                quarter = "X";
            }
            if (month>6 && month<=9){
                quarter = "Q";
            }
            if (month>9 && month<=12){
                quarter = "D";
            }
            if (month<=9){
                months = "0" + month;
            }
            if (day<=9){
                days = "0" + day;
            }
            //获取考试名称前缀,去除数字,字母
            String examName
                = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1);
            //前缀 = 年的最后两位  + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C)
            String result = year
                            + months
                            + toFirstChar(examName).toUpperCase()
                            + examPaper.getExamType()
                            + quarter;
            //生成随机数
            UUID uuid = UUID.randomUUID();
            //返回
            return result + uuid.toString().replaceAll("\\-","");
        }
        return null;
    }
    /**
     * 获取字符串拼音的第一个字母
     * @param chinese
src/main/java/org/springblade/modules/apply/controller/ExamPaymentController.java
New file
@@ -0,0 +1,100 @@
package org.springblade.modules.apply.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.apply.entity.ExamPayment;
import org.springblade.modules.apply.service.ExamPaymentService;
import org.springblade.modules.apply.vo.ExamPaymentVO;
import org.springframework.web.bind.annotation.*;
/**
 * @author zhongrj
 * @time 2021-07-22
 * @desc 考试缴费管理控制层
 */
@RestController
@AllArgsConstructor
@RequestMapping("/examPayment")
public class ExamPaymentController {
    private final ExamPaymentService examPaymentService;
    /**
     * 自定义分页
     * @param query page,size
     * @param examPayment 考试缴费信息对象
     */
    @GetMapping("/page")
    public R<IPage<ExamPaymentVO>> page(ExamPaymentVO examPayment, Query query) {
        IPage<ExamPaymentVO> pages = examPaymentService.selectExamPaymentPage(Condition.getPage(query), examPayment);
        return R.data(pages);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    public R<IPage<ExamPayment>> list(ExamPayment examPayment, Query query) {
        IPage<ExamPayment> pages = examPaymentService.page(Condition.getPage(query), Condition.getQueryWrapper(examPayment));
        return R.data(pages);
    }
    /**
     * 新增
     * @param examPayment 考试缴费信息对象
     */
    @PostMapping("/save")
    @ApiOperation(value = "新增", notes = "传入examPayment")
    public R save(@RequestBody ExamPayment examPayment) {
        return R.status(examPaymentService.save(examPayment));
    }
    /**
     * 修改
     * @param examPayment 考试缴费信息对象
     */
    @PostMapping("/update")
    public R update(@RequestBody ExamPayment examPayment) {
        return R.status(examPaymentService.updateById(examPayment));
    }
    /**
     * 新增或修改
     * @param examPayment 考试缴费信息对象
     */
    @PostMapping("/submit")
    public R submit(@RequestBody ExamPayment examPayment) {
        return R.status(examPaymentService.saveOrUpdate(examPayment));
    }
    /**
     * 删除
     * @param ids 考试缴费信息ids 数组
     */
    @PostMapping("/remove")
    public R remove(@ApiParam(value = "主键集合") @RequestParam String ids) {
        return R.status(examPaymentService.removeByIds(Func.toLongList(ids)));
    }
    /**
     * 详情
     * @param examPayment 考试缴费信息对象
     */
    @GetMapping("/detail")
    @ApiOperation(value = "详情", notes = "传入examPayment")
    public R<ExamPaymentVO> details(ExamPayment examPayment) {
        //查询考试缴费详情
        ExamPaymentVO detail = examPaymentService.selectExamPaymentInfo(examPayment);
        //返回
        return R.data(detail);
    }
}
src/main/java/org/springblade/modules/apply/entity/Apply.java
@@ -21,10 +21,7 @@
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
@@ -158,7 +155,19 @@
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date examTime;
    /**
     * 审核状态
     */
    private String examinationType;
    /**
     * 审核明细
     */
    private String examinationMx;
    /**
     * 报名编号
     */
    @TableField("apply_code")
    private String applyCode;
}
src/main/java/org/springblade/modules/apply/entity/ExamPayment.java
New file
@@ -0,0 +1,84 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.apply.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 考试缴费实体类
 *
 * @author zhongrj
 * @since 2021-07-22
 */
@Data
@TableName("sys_exam_payment")
public class ExamPayment implements Serializable {
    private static final long serialVersionUID = 1L;
    @TableId(value = "id",type = IdType.AUTO)
    private Long id;
    /**
     * 缴费类型  1:公司缴费  2:个人缴费
     */
    private Long type;
    /**
     * 缴费时间
     */
    @TableField("payment_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date paymentTime;
    /**
     * 缴费人/公司deptId
     */
    @TableField("worker_id")
    private String workerId;
    /**
     * 缴费状态   1:已缴费  2:未缴费  3:部分缴费
     */
    @TableField("payment_status")
    private Integer paymentStatus;
    /**
     * 考试id
     */
    @TableField("exam_id")
    private Long examId;
    /**
     * 报名编号
     */
    @TableField("apply_code")
    private String applyCode;
}
src/main/java/org/springblade/modules/apply/excel/ApplyExcel.java
New file
@@ -0,0 +1,50 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.apply.excel;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
/**
 * ExamPaymentExcel
 * @author zhongrj
 * @since 2021-07-22
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class ApplyExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    @ColumnWidth(15)
    @ExcelProperty("保安ID")
    private Long userId;
    @ColumnWidth(15)
    @ExcelProperty("考试ID")
    private Long examId;
}
src/main/java/org/springblade/modules/apply/excel/ApplyImporter.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.apply.excel;
import lombok.RequiredArgsConstructor;
import org.springblade.core.excel.support.ExcelImporter;
import org.springblade.modules.apply.service.ApplyService;
import java.util.List;
/**
 * 报名考试数据导入类
 *
 * @author zhongrj
 * @since 2021-07-22
 */
@RequiredArgsConstructor
public class ApplyImporter implements ExcelImporter<ApplyExcel> {
    private final ApplyService service;
    private final Boolean isCovered;
    @Override
    public void save(List<ApplyExcel> data) {
        service.importApply(data, isCovered);
    }
}
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java
@@ -37,4 +37,11 @@
     * @return
     */
    int getCandidateNoCount(@Param("result")String result);
    /**
     * 获取公司集体报名的人数
     * @param applyCode
     * @return
     */
    Integer getApplyNum(@Param("applyCode") String applyCode);
}
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml
@@ -75,4 +75,9 @@
            and candidate_no like concat('%', #{result},'%')
        </if>
    </select>
    <!--获取公司集体报名的人数-->
    <select id="getApplyNum" resultType="java.lang.Integer">
        select count(*) from sys_apply where apply_code = #{applyCode}
    </select>
</mapper>
src/main/java/org/springblade/modules/apply/mapper/ExamPaymentMapper.java
New file
@@ -0,0 +1,33 @@
package org.springblade.modules.apply.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.apply.entity.ExamPayment;
import org.springblade.modules.apply.vo.ExamPaymentVO;
import java.util.List;
/**
 * 考试缴费Mapper 接口
 * @author zhongrj
 */
public interface ExamPaymentMapper extends BaseMapper<ExamPayment> {
    /**
     * 自定义分页
     *
     * @param page  分页
     * @param examPayment 实体
     * @return
     */
    List<ExamPaymentVO> selectExamPaymentPage(IPage page, @Param("examPayment") ExamPaymentVO examPayment);
    /**
     * 详情
     *
     * @param examPayment 考试缴费信息对象
     */
    ExamPaymentVO selectExamPaymentInfo(@Param("examPayment") ExamPayment examPayment);
}
src/main/java/org/springblade/modules/apply/mapper/ExamPaymentMapper.xml
New file
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.springblade.modules.apply.mapper.ExamPaymentMapper">
    <!--考试报名分页信息-->
    <select id="selectExamPaymentPage" resultType="org.springblade.modules.apply.vo.ExamPaymentVO">
        SELECT
            se.*,
            bd.dept_name deptName
        FROM
            sys_exam_payment se
        left join
            blade_dept bd
        on
            bd.id = se.worker_id
        WHERE
            type = 1
        <if test="examPayment.workerId!=null and  examPayment.workerId!=''">
            and se.worker_id like concat('%', #{examPayment.workerId},'%')
        </if>
        <if test="examPayment.deptName!=null and  examPayment.deptName!=''">
            and bd.dept_name like concat('%', #{examPayment.deptName},'%')
        </if>
    </select>
    <!--考试报名详情信息-->
    <select id="selectExamPaymentInfo" resultType="org.springblade.modules.apply.vo.ExamPaymentVO">
        SELECT
            *
        FROM
            sys_examPayment
        where 1=1
        <if test="examPayment.id!=null and examPayment.id!=''">
            and id = #{examPayment.id}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/apply/service/ApplyService.java
@@ -3,7 +3,10 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyExcel;
import org.springblade.modules.apply.vo.ApplyVO;
import java.util.List;
/**
 * 考试报名服务类
@@ -32,4 +35,20 @@
     * @return
     */
    int getCandidateNoCount(String result);
    /**
     * 获取公司集体报名的人数
     * @param applyCode
     * @return
     */
    Integer getApplyNum(String applyCode);
    /**
     * 导入考试数据
     *
     * @param data
     * @param isCovered
     * @return
     */
    void importApply(List<ApplyExcel> data, Boolean isCovered);
}
src/main/java/org/springblade/modules/apply/service/ExamPaymentService.java
New file
@@ -0,0 +1,30 @@
package org.springblade.modules.apply.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.apply.entity.ExamPayment;
import org.springblade.modules.apply.vo.ExamPaymentVO;
/**
 * 考试缴费服务类
 * @author zhongrj
 */
public interface ExamPaymentService extends IService<ExamPayment> {
    /**
     * 自定义分页
     * @param page
     * @param examPayment
     * @return
     */
    IPage<ExamPaymentVO> selectExamPaymentPage(IPage<ExamPaymentVO> page, ExamPaymentVO examPayment);
    /**
     * 详情
     * @param examPayment 考试缴费信息对象
     * @return
     */
    ExamPaymentVO selectExamPaymentInfo(ExamPayment examPayment);
}
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
@@ -3,18 +3,38 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import net.sourceforge.pinyin4j.PinyinHelper;
import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
import net.sourceforge.pinyin4j.format.HanyuPinyinToneType;
import net.sourceforge.pinyin4j.format.exception.BadHanyuPinyinOutputFormatCombination;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyExcel;
import org.springblade.modules.apply.mapper.ApplyMapper;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.vo.ApplyVO;
import org.springblade.modules.exam.entity.ExamPaper;
import org.springblade.modules.exam.service.ExamPaperService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.DecimalFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * 考试报名服务实现类
 * @author zhongrj
 */
@Service
@AllArgsConstructor
public class ApplyServiceImpl extends ServiceImpl<ApplyMapper, Apply> implements ApplyService {
    private final ExamPaperService examPaperService;
    /**
     * 自定义分页数据
@@ -45,4 +65,169 @@
    public int getCandidateNoCount(String result) {
        return baseMapper.getCandidateNoCount(result);
    }
    /**
     * 获取公司集体报名的人数
     * @param applyCode
     * @return
     */
    @Override
    public Integer getApplyNum(String applyCode) {
        return baseMapper.getApplyNum(applyCode);
    }
    @Override
    @Transactional(rollbackFor = Exception.class)
    public void importApply(List<ApplyExcel> data, Boolean isCovered) {
        data.forEach(applyExcel -> {
            Apply apply = new Apply();
            //设置数据
            apply.setExamId(applyExcel.getExamId());
            apply.setUserId(applyExcel.getUserId());
            apply.setApplyTime(new Date());
            apply.setApplyStatus(2);
            //去生成准考证号码
            apply.setCandidateNo(getCandidateNo(apply));
            //去生成考试编号
            apply.setApplyCode(getApplyCode(apply));
            //插入数据
            this.save(apply);
        });
    }
    /**
     * 生成准考证号码
     * @param apply 考试报名信息对象
     */
    private String getCandidateNo(Apply apply) {
        //获取考试信息
        ExamPaper examPaper = examPaperService.getById(apply.getExamId());
        if (null!=examPaper.getStartTime()){
            String format = new SimpleDateFormat("yyyy-MM-dd").format(examPaper.getStartTime());
            String year = format.substring(2,4);
            String quarter  = null;
            String months = null;
            String days = null;
            int month = Integer.parseInt(format.substring(5,7));
            int day = Integer.parseInt(format.substring(8,10));
            if (month>0 && month<=3){
                quarter = "C";
            }
            if (month>3 && month<=6){
                quarter = "X";
            }
            if (month>6 && month<=9){
                quarter = "Q";
            }
            if (month>9 && month<=12){
                quarter = "D";
            }
            if (month<=9){
                months = "0" + month;
            }
            if (day<=9){
                days = "0" + day;
            }
            //获取考试名称前缀,去除数字,字母
            String examName
                = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1);
            //前缀 = 年的最后两位  + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C)
            String result = year
                + months
                + toFirstChar(examName).toUpperCase()
                + examPaper.getExamType()
                + quarter;
            //查询是当前前缀已生成的数量
            int count = getCandidateNoCount(result);
            if (count==0){
                return result + "0000";
            }
            //格式化
            DecimalFormat decimalFormat = new DecimalFormat("0000");
            //返回
            return result + (decimalFormat.format(count++));
        }
        return null;
    }
    /**
     * 生成准考证号码
     * @param apply 考试报名信息对象
     */
    private String getApplyCode(Apply apply) {
        //获取考试信息
        ExamPaper examPaper = examPaperService.getById(apply.getExamId());
        if (null!=examPaper.getStartTime()){
            String format = new SimpleDateFormat("yyyy-MM-dd").format(examPaper.getStartTime());
            String year = format.substring(2,4);
            String quarter  = null;
            String months = null;
            String days = null;
            int month = Integer.parseInt(format.substring(5,7));
            int day = Integer.parseInt(format.substring(8,10));
            if (month>0 && month<=3){
                quarter = "C";
            }
            if (month>3 && month<=6){
                quarter = "X";
            }
            if (month>6 && month<=9){
                quarter = "Q";
            }
            if (month>9 && month<=12){
                quarter = "D";
            }
            if (month<=9){
                months = "0" + month;
            }
            if (day<=9){
                days = "0" + day;
            }
            //获取考试名称前缀,去除数字,字母
            String examName
                = examPaper.getExamName().replaceAll("\\s*", "").replaceAll("[^(\\u4e00-\\u9fa5)]", "").substring(0,1);
            //前缀 = 年的最后两位  + 月份(两位) + 考试名称(中文拼音)首字母(去除数字,字母) + 考试类型 + 季度拼音首字母大写(春季就是 C)
            String result = year
                + months
                + toFirstChar(examName).toUpperCase()
                + examPaper.getExamType()
                + quarter;
            //生成随机数
            UUID uuid = UUID.randomUUID();
            //返回
            return result + uuid.toString().replaceAll("\\-","");
        }
        return null;
    }
    /**
     * 获取字符串拼音的第一个字母
     * @param chinese
     * @return
     */
    private String toFirstChar(String chinese){
        String pinyinStr = "";
        char[] newChar = chinese.toCharArray();
        //转为单个字符
        HanyuPinyinOutputFormat defaultFormat = new HanyuPinyinOutputFormat();
        defaultFormat.setCaseType(HanyuPinyinCaseType.LOWERCASE);
        defaultFormat.setToneType(HanyuPinyinToneType.WITHOUT_TONE);
        for (int i = 0; i < newChar.length; i++) {
            if (newChar[i] > 128) {
                try {
                    pinyinStr += PinyinHelper.toHanyuPinyinStringArray(newChar[i], defaultFormat)[0].charAt(0);
                } catch (BadHanyuPinyinOutputFormatCombination e) {
                    e.printStackTrace();
                }
            }else{
                pinyinStr += newChar[i];
            }
        }
        return pinyinStr;
    }
}
src/main/java/org/springblade/modules/apply/service/impl/ExamPaymentServiceImpl.java
New file
@@ -0,0 +1,53 @@
package org.springblade.modules.apply.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springblade.modules.apply.entity.ExamPayment;
import org.springblade.modules.apply.mapper.ExamPaymentMapper;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.service.ExamPaymentService;
import org.springblade.modules.apply.vo.ExamPaymentVO;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * 考试缴费服务实现类
 * @author zhongrj
 */
@Service
@AllArgsConstructor
public class ExamPaymentServiceImpl extends ServiceImpl<ExamPaymentMapper, ExamPayment> implements ExamPaymentService {
    private final ApplyService applyService;
    /**
     * 自定义分页数据
     * @param page 分页条件
     * @param examPayment 考试缴费对象
     * @return
     */
    @Override
    public IPage<ExamPaymentVO> selectExamPaymentPage(IPage<ExamPaymentVO> page, ExamPaymentVO examPayment) {
        List<ExamPaymentVO> examPaymentVOS = baseMapper.selectExamPaymentPage(page, examPayment);
        for (ExamPaymentVO examPaymentVO : examPaymentVOS) {
            //查询人数
            examPaymentVO.setNum(applyService.getApplyNum(examPaymentVO.getApplyCode()));
        }
        return page.setRecords(examPaymentVOS);
    }
    /**
     * 详情
     * @param examPayment 考试缴费信息对象
     */
    @Override
    public ExamPaymentVO selectExamPaymentInfo(ExamPayment examPayment) {
        return baseMapper.selectExamPaymentInfo(examPayment);
    }
}
src/main/java/org/springblade/modules/apply/vo/ApplyVO.java
@@ -16,15 +16,11 @@
 */
package org.springblade.modules.apply.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springblade.modules.apply.entity.Apply;
import java.io.Serializable;
import java.util.Date;
/**
 * 考试报名实体类
src/main/java/org/springblade/modules/apply/vo/ExamPaymentVO.java
New file
@@ -0,0 +1,48 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.apply.vo;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import org.springblade.modules.apply.entity.ExamPayment;
import java.io.Serializable;
/**
 * 考试缴费实体类
 *
 * @author zhongrj
 * @since 2021-07-22
 */
@Data
@TableName("sys_apply")
public class ExamPaymentVO extends ExamPayment implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 保安单位名称
     */
    private String deptName;
    /**
     * 人数
     */
    private Integer num;
}
src/main/java/org/springblade/modules/exam/controller/ExamPaperController.java
@@ -30,7 +30,6 @@
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.ExamScoreVO;
import org.springblade.modules.exam.wrapper.ExamPaperWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
@@ -125,5 +125,4 @@
        //返回
        return R.data(detail);
    }
}
src/main/java/org/springblade/modules/exam/controller/ExamSubjectChoicesController.java
@@ -1,32 +1,19 @@
package org.springblade.modules.exam.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.dispatcher.entity.Dispatcher;
import org.springblade.modules.exam.entity.ExamSubjectChoices;
import org.springblade.modules.exam.service.ExamSubjectChoicesService;
import org.springblade.modules.exam.vo.ExamSubjectChoicesVO;
import org.springblade.modules.jurisdiction.entity.Jurisdiction;
import org.springblade.modules.jurisdiction.vo.JurisdictionVO;
import org.springblade.modules.jurisdiction.wrapper.JurisdictionWrapper;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author zhongrj
src/main/java/org/springblade/modules/exam/controller/ExamSubjectOptionController.java
@@ -8,7 +8,6 @@
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.exam.entity.ExamSubjectChoices;
import org.springblade.modules.exam.entity.ExamSubjectOption;
import org.springblade.modules.exam.service.ExamSubjectOptionService;
import org.springblade.modules.exam.vo.ExamSubjectOptionVO;
src/main/java/org/springblade/modules/exam/entity/ExamExaminationSubject.java
@@ -24,8 +24,6 @@
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 *  试卷分类实体类
src/main/java/org/springblade/modules/exam/entity/ExamPaper.java
@@ -17,13 +17,10 @@
package org.springblade.modules.exam.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import java.io.Serializable;
import java.util.Date;
src/main/java/org/springblade/modules/exam/entity/ExamScore.java
@@ -108,9 +108,8 @@
    private Integer qualified;
    /**
     * 用户id
     */
    @TableField("user_id")
    private String userId;
}
src/main/java/org/springblade/modules/exam/entity/ExamSubjectChoices.java
@@ -10,7 +10,6 @@
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * 选择题实体类
src/main/java/org/springblade/modules/exam/mapper/ExamPaperMapper.java
@@ -19,8 +19,6 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.desk.entity.Notice;
import org.springblade.modules.desk.vo.NoticeVO;
import org.springblade.modules.exam.entity.ExamPaper;
import org.springblade.modules.exam.vo.ExamPaperSubjectVO;
import org.springblade.modules.exam.vo.ExamPaperVO;
src/main/java/org/springblade/modules/exam/mapper/ExamScoreMapper.xml
@@ -21,6 +21,12 @@
        <if test="examScore.securityName!=null and  examScore.securityName!=''">
            and security_name like concat('%', #{examScore.securityName},'%')
        </if>
        <if test="examScore.userId!=null and  examScore.userId!=''">
            and user_id = #{examScore.userId}
        </if>
        <if test="examScore.candidateNo!=null and  examScore.candidateNo!=''">
            and candidate_no = #{examScore.candidateNo}
        </if>
<!--        <if test="examScore.examType!=null">-->
<!--            and exam_type = #{examScore.examType}-->
<!--        </if>-->
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -10,14 +10,11 @@
import org.springblade.modules.exam.mapper.ExamScoreMapper;
import org.springblade.modules.exam.service.ExamPaperService;
import org.springblade.modules.exam.service.ExamScoreService;
import org.springblade.modules.exam.vo.ExamPaperSubjectVO;
import org.springblade.modules.exam.vo.ExamResultVO;
import org.springblade.modules.exam.vo.ExamScoreVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
src/main/java/org/springblade/modules/exam/vo/ExamPaperSubjectVO.java
@@ -4,7 +4,6 @@
import lombok.EqualsAndHashCode;
import org.springblade.modules.exam.entity.ExamExaminationSubject;
import org.springblade.modules.exam.entity.ExamPaper;
import org.springblade.modules.exam.entity.ExamSubjectChoices;
import java.util.List;
src/main/java/org/springblade/modules/exam/vo/ExamScoreVO.java
@@ -2,7 +2,6 @@
import lombok.Data;
import org.springblade.modules.exam.entity.ExamScore;
import org.springblade.modules.exam.entity.ExamSubjectOption;
import java.io.Serializable;
import java.util.List;
src/main/java/org/springblade/modules/exam/vo/ExamSubjectChoicesVO.java
@@ -1,17 +1,10 @@
package org.springblade.modules.exam.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.modules.exam.entity.ExamSubjectChoices;
import org.springblade.modules.exam.entity.ExamSubjectOption;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
src/main/java/org/springblade/modules/exam/vo/ExamSubjectOptionVO.java
@@ -1,16 +1,9 @@
package org.springblade.modules.exam.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.springblade.modules.exam.entity.ExamSubjectOption;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
 * 选择题选项实体类vo
src/main/java/org/springblade/modules/exam/wrapper/ExamPaperWrapper.java
@@ -16,8 +16,6 @@
 */
package org.springblade.modules.exam.wrapper;
import org.springblade.common.cache.DictCache;
import org.springblade.common.enums.DictEnum;
import org.springblade.core.mp.support.BaseEntityWrapper;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.modules.exam.entity.ExamPaper;