Administrator
2021-08-02 c9f44e0ef916dd8d84639fe86d001a440ca76474
1.新增保安个人照片,准考证信息接口修改
2.新增导出清册接口
14 files modified
1 files added
366 ■■■■■ changed files
src/main/java/org/springblade/modules/apply/controller/ApplyController.java 15 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/excel/ApplyInfoExcel.java 75 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java 18 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml 78 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/ApplyService.java 7 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java 39 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/vo/ApplyPaPerVO.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/entity/User.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 1 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/controller/TrainingRegistrationController.java 17 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.java 8 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml 56 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/TrainingRegistrationService.java 10 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java 11 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/vo/TrainingRegistrationVo.java 16 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -14,10 +14,12 @@
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.DateUtil;
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.excel.ApplyInfoExcel;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.vo.ApplyPaPerVO;
import org.springblade.modules.apply.vo.ApplyVO;
@@ -134,6 +136,19 @@
        ExcelUtil.export(response, "考试报名数据模板", "考试报名数据表", list, ApplyExcel.class);
    }
    /**
     * 导出报名数数据
     * @param response
     * @param apply 报名对象
     */
    @GetMapping("export-apply")
    @ApiOperation(value = "导出报名清册")
    public void exportApply(HttpServletResponse response,Apply apply) {
        List<ApplyInfoExcel> list = applyService.getApplyExcelList(apply);
        ExcelUtil.export(response, "考试报名清册数据"+ DateUtil.time(), "考试报名清册数据表", list, ApplyInfoExcel.class);
    }
    /**
     * 生成准考证号码
     * @param apply 考试报名信息对象
src/main/java/org/springblade/modules/apply/excel/ApplyInfoExcel.java
New file
@@ -0,0 +1,75 @@
/*
 *      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.ExcelIgnore;
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;
import java.util.Date;
/**
 * ExamPaymentExcel
 * @author zhongrj
 * @since 2021-08-02
 */
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@ContentRowHeight(18)
public class ApplyInfoExcel implements Serializable {
    private static final long serialVersionUID = 1L;
    @ColumnWidth(15)
    @ExcelProperty("姓名")
    private String realName;
    @ColumnWidth(25)
    @ExcelProperty("考试名称")
    private String examName;
    @ColumnWidth(25)
    @ExcelProperty("所属单位名称")
    private String deptName;
    @ColumnWidth(15)
    @ExcelProperty("准考证号")
    private String candidateNo;
    @ColumnWidth(20)
    @ExcelProperty("身份证号")
    private String idCardNo;
    @ColumnWidth(15)
    @ExcelProperty("考试证件")
    private String applyCard;
    @ColumnWidth(20)
    @ExcelProperty("报名时间")
    private Date applyTime;
    @ColumnWidth(20)
    @ExcelProperty("考试时间")
    private Date examTime;
}
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.java
@@ -4,6 +4,8 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyExcel;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.apply.vo.ApplyPaPerVO;
import org.springblade.modules.apply.vo.ApplyVO;
@@ -47,9 +49,23 @@
    Integer getApplyNum(@Param("applyCode") String applyCode);
    /**
     * 获取准考证信息
     * 获取准考证信息(正式考试)
     * @param apply
     * @return
     */
    ApplyPaPerVO getApplyInfo(@Param("apply")Apply apply);
    /**
     * 导出报名数数据
     * @param apply 报名对象
     * @return
     */
    List<ApplyInfoExcel> getApplyExcelList(@Param("apply")Apply apply);
    /**
     * 获取准考证信息(模拟考试)
     * @param apply
     * @return
     */
    ApplyPaPerVO getTrainApplyInfo(@Param("apply")Apply apply);
}
src/main/java/org/springblade/modules/apply/mapper/ApplyMapper.xml
@@ -28,6 +28,9 @@
        <if test="apply.name!=null and  apply.name!=''">
            and sa.name like concat('%', #{apply.name},'%')
        </if>
        <if test="apply.userId!=null and  apply.userId!=''">
            and sa.user_id like concat('%', #{apply.userId},'%')
        </if>
        <if test="apply.applyStatus!=null">
            and apply_status = #{apply.applyStatus}
        </if>
@@ -81,12 +84,12 @@
        select count(*) from sys_apply where apply_code = #{applyCode}
    </select>
    <!--获取准考证信息-->
    <!--获取准考证信息(正式考试)-->
    <select id="getApplyInfo" resultType="org.springblade.modules.apply.vo.ApplyPaPerVO">
        SELECT
            sa.id,sa.candidate_no candidateNo,
            ke.exam_type examType,ke.start_time startTime,ke.end_time endTime,ke.exam_name examName,
            bu.real_name realName,bu.cardid idCardNo,ifnull(bu.sex,0) sex,
            bu.real_name realName,bu.cardid idCardNo,ifnull(bu.sex,0) sex,bu.my_picture myPicture,
            bd.dept_name deptName,"保安证" applyCard
        FROM
            sys_apply sa
@@ -105,4 +108,75 @@
        WHERE
            sa.id = #{apply.id}
    </select>
    <!--获取准考证信息(模拟考试)-->
    <select id="getTrainApplyInfo" resultType="org.springblade.modules.apply.vo.ApplyPaPerVO">
        select
            sr.candidate_no candidateNo,
            bt.dept_name AS deptName,"保安证" applyCard,
            bu.real_name realName,bu.cardid idCardNo,ifnull(bu.sex,0) sex,bu.my_picture myPicture,
            ke.exam_type examType,ke.start_time startTime,ke.end_time endTime,ke.exam_name examName
        FROM
        sys_training_registration sr
        LEFT JOIN
        blade_dept bt
        ON
        sr.dept_id = bt.id
        LEFT JOIN
        blade_dept bt0
        ON
        sr.training_unit_id = bt0.id
        left join
        blade_user bu
        on
        sr.user_id = bu.id
        left join
        ksxt_exam ke
        on
        ke.id = sr.train_exam_id
        WHERE
        1=1
          and sr.id = #{apply.id}
    </select>
    <!--导出报名清册数据-->
    <select id="getApplyExcelList" resultType="org.springblade.modules.apply.excel.ApplyInfoExcel">
        SELECT
        sa.candidate_no candidateNo,sa.apply_time applyTime,
        ke.start_time examTime,ke.exam_name examName,
        bu.real_name realName,bu.cardid idCardNo,
        bd.dept_name deptName,"保安证" applyCard
        FROM
        sys_apply sa
        left join
        ksxt_exam ke
        on
        sa.exam_id = ke.id
        left join
        blade_user bu
        on
        sa.user_id = bu.id
        left join
        blade_dept bd
        on
        bd.id = bu.dept_id
        WHERE
        1=1
        <if test="apply.name!=null and  apply.name!=''">
            and sa.name like concat('%', #{apply.name},'%')
        </if>
        <if test="apply.userId!=null and  apply.userId!=''">
            and sa.user_id like concat('%', #{apply.userId},'%')
        </if>
        <if test="apply.applyStatus!=null">
            and apply_status = #{apply.applyStatus}
        </if>
        <if test="apply.applyExamType!=null">
            and apply_exam_type = #{apply.applyExamType}
        </if>
        <if test="apply.examId!=null">
            and sa.exam_id = #{apply.examId}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/apply/service/ApplyService.java
@@ -4,6 +4,7 @@
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.excel.ApplyInfoExcel;
import org.springblade.modules.apply.vo.ApplyPaPerVO;
import org.springblade.modules.apply.vo.ApplyVO;
@@ -59,4 +60,10 @@
     * @return
     */
    ApplyPaPerVO getApplyInfo(Apply apply);
    /**
     * 导出报名数数据
     * @param apply 报名对象
     */
    List<ApplyInfoExcel> getApplyExcelList(Apply apply);
}
src/main/java/org/springblade/modules/apply/service/impl/ApplyServiceImpl.java
@@ -12,6 +12,7 @@
import org.springblade.common.utils.arg;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyExcel;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.apply.mapper.ApplyMapper;
import org.springblade.modules.apply.service.ApplyService;
import org.springblade.modules.apply.vo.ApplyPaPerVO;
@@ -246,12 +247,38 @@
     */
    @Override
    public ApplyPaPerVO getApplyInfo(Apply apply) {
        ApplyPaPerVO applyPaPerVO = baseMapper.getApplyInfo(apply);
        //正式考试
        if (apply.getApplyExamType()==1){
            ApplyPaPerVO applyPaPerVO = baseMapper.getApplyInfo(apply);
            String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[0];
            String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[1];
            String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getEndTime()).split(" ")[1];
            applyPaPerVO.setStringTime(time+" "+startTime.substring(0,startTime.length()-3) +"-"+ endTime.substring(0,endTime.length()-3));
            return applyPaPerVO;
        }
        String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[0];
        String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[1];
        String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getEndTime()).split(" ")[1];
        applyPaPerVO.setStringTime(time+" "+startTime.substring(0,startTime.length()-3) +"-"+ endTime.substring(0,endTime.length()-3));
        return applyPaPerVO;
        //模拟考试
        if (apply.getApplyExamType()==2){
            ApplyPaPerVO applyPaPerVO = baseMapper.getTrainApplyInfo(apply);
            String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[0];
            String startTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getStartTime()).split(" ")[1];
            String endTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(applyPaPerVO.getEndTime()).split(" ")[1];
            applyPaPerVO.setStringTime(time+" "+startTime.substring(0,startTime.length()-3) +"-"+ endTime.substring(0,endTime.length()-3));
            return applyPaPerVO;
        }
        return null;
    }
    /**
     * 导出报名数数据
     * @param apply 报名对象
     * @return
     */
    @Override
    public List<ApplyInfoExcel> getApplyExcelList(Apply apply) {
        return baseMapper.getApplyExcelList(apply);
    }
}
src/main/java/org/springblade/modules/apply/vo/ApplyPaPerVO.java
@@ -91,4 +91,9 @@
    private String stringTime;
    /**
     * 个人照片
     */
    private String myPicture;
}
src/main/java/org/springblade/modules/system/entity/User.java
@@ -189,6 +189,16 @@
     * 是否采集照片
     */
    private String photo;
    /**
     * 是否派遣
     */
    private String dispatch;
    /**
     * 个人照片,电子照,用于展示保安证,准考证用
     */
    @TableField("my_picture")
    private String myPicture;
}
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -40,6 +40,7 @@
        <result column="jurisdiction" property="jurisdiction"/>
        <result column="securitynumber" property="securitynumber"/>
        <result column="dispatch" property="dispatch"/>
        <result column="my_picture" property="myPicture"/>
        <result column="deptname" property="deptname"/>
    </resultMap>
src/main/java/org/springblade/modules/training/controller/TrainingRegistrationController.java
@@ -5,16 +5,22 @@
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.common.utils.arg;
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.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.apply.entity.Apply;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.service.TrainingRegistrationService;
import org.springblade.modules.training.vo.TrainingRegistrationVo;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
 * @author zhongrj
@@ -96,4 +102,15 @@
        return R.data(detail);
    }
    /**
     * 导出报名数数据
     * @param response
     * @param trainingRegistration 培训报名对象
     */
    @GetMapping("export-apply")
    @ApiOperation(value = "导出报名清册")
    public void exportApply(HttpServletResponse response,TrainingRegistrationVo trainingRegistration) {
        List<ApplyInfoExcel> list = trainingRegistrationService.getTrainingRegistrationExcelList(trainingRegistration);
        ExcelUtil.export(response, "考试报名清册数据"+ DateUtil.time(), "考试报名清册数据表", list, ApplyInfoExcel.class);
    }
}
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.java
@@ -3,6 +3,7 @@
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.excel.ApplyInfoExcel;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.vo.TrainingRegistrationVo;
@@ -30,4 +31,11 @@
     * @param trainingRegistration 报名培训信息对象
     */
    TrainingRegistrationVo selectTrainingRegistrationInfo(@Param("trainingRegistration") TrainingRegistration trainingRegistration);
    /**
     * 导出报名数数据
     * @param trainingRegistration 培训报名对象
     * @return
     */
    List<ApplyInfoExcel> getTrainingRegistrationExcelList(@Param("trainingRegistration")TrainingRegistrationVo trainingRegistration);
}
src/main/java/org/springblade/modules/training/mapper/TrainingRegistrationMapper.xml
@@ -9,7 +9,8 @@
            bt.dept_name AS deptName,
            bt0.dept_name AS trainUnitName,
            bu.real_name realName,bu.phone,bu.cardid idCardNo,
            ke.start_time trainExamTime,ke.exam_name trainExamName
            ke.start_time trainExamTime,ke.exam_name trainExamName,ke.exam_type examType,
            "保安证" applyCard
        FROM
            sys_training_registration sr
        LEFT JOIN
@@ -32,6 +33,12 @@
            1=1
        <if test="trainingRegistration.trainingUnitId!=null and  trainingRegistration.trainingUnitId!=''">
            and sr.training_unit_id = #{trainingRegistration.trainingUnitId}
        </if>
        <if test="trainingRegistration.examId!=null and  trainingRegistration.examId!=''">
            and ke.id = #{trainingRegistration.examId}
        </if>
        <if test="trainingRegistration.userId!=null and  trainingRegistration.userId!=''">
            and sr.user_id = #{trainingRegistration.userId}
        </if>
        <if test="trainingRegistration.deptName!=null and  trainingRegistration.deptName!=''">
            and bt.dept_name like concat('%', #{trainingRegistration.deptName},'%')
@@ -60,4 +67,51 @@
            and sr.id = #{trainingRegistration.id}
        </if>
    </select>
    <!--导出报名数数据-->
    <select id="getTrainingRegistrationExcelList" resultType="org.springblade.modules.apply.excel.ApplyInfoExcel">
        select
            sr.training_time applyTime,sr.candidate_no candidateNo,
            bt.dept_name AS deptName,"保安证" applyCard,
            bu.real_name realName,bu.cardid idCardNo,
            ke.start_time examTime,ke.exam_name examName
        FROM
        sys_training_registration sr
        LEFT JOIN
        blade_dept bt
        ON
        sr.dept_id = bt.id
        LEFT JOIN
        blade_dept bt0
        ON
        sr.training_unit_id = bt0.id
        left join
        blade_user bu
        on
        sr.user_id = bu.id
        left join
        ksxt_exam ke
        on
        ke.id = sr.train_exam_id
        WHERE
        1=1
        <if test="trainingRegistration.trainingUnitId!=null and  trainingRegistration.trainingUnitId!=''">
            and sr.training_unit_id = #{trainingRegistration.trainingUnitId}
        </if>
        <if test="trainingRegistration.examId!=null and  trainingRegistration.examId!=''">
            and ke.id = #{trainingRegistration.examId}
        </if>
        <if test="trainingRegistration.userId!=null and  trainingRegistration.userId!=''">
            and sr.user_id = #{trainingRegistration.userId}
        </if>
        <if test="trainingRegistration.deptName!=null and  trainingRegistration.deptName!=''">
            and bt.dept_name like concat('%', #{trainingRegistration.deptName},'%')
        </if>
        <if test="trainingRegistration.realName!=null and  trainingRegistration.realName!=''">
            and bu.real_name like concat('%', #{trainingRegistration.realName},'%')
        </if>
        <if test="trainingRegistration.cancel!=null">
            and sr.cancel = #{trainingRegistration.cancel}
        </if>
    </select>
</mapper>
src/main/java/org/springblade/modules/training/service/TrainingRegistrationService.java
@@ -2,8 +2,11 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.IService;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.vo.TrainingRegistrationVo;
import java.util.List;
/**
 * 报名培训服务类
@@ -24,4 +27,11 @@
     * @param trainingRegistration 报名培训信息对象
     */
    TrainingRegistrationVo selectTrainingRegistrationInfo(TrainingRegistration trainingRegistration);
    /**
     * 导出报名数数据
     * @param trainingRegistration 培训报名对象
     * @return
     */
    List<ApplyInfoExcel> getTrainingRegistrationExcelList(TrainingRegistrationVo trainingRegistration);
}
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.modules.apply.excel.ApplyInfoExcel;
import org.springblade.modules.training.entity.TrainingRegistration;
import org.springblade.modules.training.mapper.TrainingRegistrationMapper;
import org.springblade.modules.training.service.TrainingRegistrationService;
@@ -36,4 +37,14 @@
    public TrainingRegistrationVo selectTrainingRegistrationInfo(TrainingRegistration trainingRegistration) {
        return baseMapper.selectTrainingRegistrationInfo(trainingRegistration);
    }
    /**
     * 导出报名数数据
     * @param trainingRegistration 培训报名对象
     * @return
     */
    @Override
    public List<ApplyInfoExcel> getTrainingRegistrationExcelList(TrainingRegistrationVo trainingRegistration) {
        return baseMapper.getTrainingRegistrationExcelList(trainingRegistration);
    }
}
src/main/java/org/springblade/modules/training/vo/TrainingRegistrationVo.java
@@ -56,4 +56,20 @@
     * 考试名称
     */
    private String trainExamName;
    /**
     * 考试id
     */
    private String examId;
    /**
     * 考的证
     */
    private String applyCard;
    /**
     * 考试类型
     */
    private Integer examType;
}