智慧保安后台管理-外网项目备份
zhongrj
2023-11-06 07794736f879adb9cf02a69e5c6ada6a94b7bbde
考试报名查询修改,分新报名和考试未通过
14 files modified
192 ■■■■■ changed files
src/main/java/org/springblade/modules/apply/controller/ApplyController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/attendance/controller/AttendanceController.java 6 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/auth/endpoint/BladeTokenEndPoint.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/controller/ScoreAuditRecordsController.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/entity/ExamScore.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java 8 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java 4 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/entity/User.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.java 3 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml 104 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/node/TreeNode.java 5 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java 43 ●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java 2 ●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -740,7 +740,7 @@
        //新增考试成绩,没有成绩数据,待提交答题后更新数据
        ExamScore examScore = new ExamScore();
        examScore.setExamId(apply.getExamId().toString());
        examScore.setUserId(apply.getUserId().toString());
        examScore.setUserId(apply.getUserId());
        examScore.setApplyId(apply.getId());
        examScore.setCandidateNo(apply.getCandidateNo());
        examScore.setExamTime(new Date());
src/main/java/org/springblade/modules/attendance/controller/AttendanceController.java
@@ -33,10 +33,8 @@
import java.util.List;
/**
 * 控制器
 *
 * @author BladeX
 * @since 2021-03-03
 * 考勤控制器
 * @since 2023-03-03
 */
@RestController
@AllArgsConstructor
src/main/java/org/springblade/modules/auth/endpoint/BladeTokenEndPoint.java
@@ -136,6 +136,10 @@
                return authInfo.set("error_description", "审核不通过");
            }
        }
        if (userInfo != null && userInfo.getUser().getIsFreeze().equals(1)) {
            return authInfo.set("error_code", HttpServletResponse.SC_BAD_REQUEST).set("error_description", "该用户超半年未使用系统,已被冻结,请联系管理员!");
        }
        if (userInfo == null || userInfo.getUser() == null) {
            return authInfo.set("error_code", HttpServletResponse.SC_BAD_REQUEST).set("error_description", "用户名或密码不正确");
        }
src/main/java/org/springblade/modules/exam/controller/ExamScoreController.java
@@ -172,7 +172,7 @@
        if (null != examScore.getLearnGrade() && null != examScore.getTheoryGrade()) {
            ExamScore examScore1 = examScoreService.getById(examScore.getId());
            //查询当前保安信息
            UserVO user = userService.getUserAgeById(Long.parseLong(examScore1.getUserId()));
            UserVO user = userService.getUserAgeById(examScore1.getUserId());
            //再根据身份证号查询用户,方式用户考了试,被删除,又新建的情况,修改最新用户的状态信息
            User user1 = userService.getUserInfoByIdCardNo(user.getCardid());
            //考试合格
src/main/java/org/springblade/modules/exam/controller/ScoreAuditRecordsController.java
@@ -72,7 +72,7 @@
        scoreAuditRecords.setStatus(1);
        //查询成绩
        ExamScore examScore = examScoreService.getById(scoreAuditRecords.getExamScoreId());
        scoreAuditRecords.setUserId(Long.parseLong(examScore.getUserId()));
        scoreAuditRecords.setUserId(examScore.getUserId());
        //申请并返回数据
        return R.data(scoreAuditRecordsService.save(scoreAuditRecords));
    }
src/main/java/org/springblade/modules/exam/entity/ExamScore.java
@@ -105,7 +105,7 @@
    @TableField("user_id")
    private String userId;
    private Long userId;
    /**
src/main/java/org/springblade/modules/exam/service/impl/ExamScoreServiceImpl.java
@@ -290,7 +290,7 @@
//                            ExamScore examScore = this.getOne(Condition.getQueryWrapper(examScore1));
                            if (null != examScore) {
                                //查询当前保安信息
                                UserVO user = userService.getUserAgeById(Long.parseLong(examScore.getUserId()));
                                UserVO user = userService.getUserAgeById(examScore.getUserId());
                                //设置实操成绩
                                if (examScoreExcel.getLearnGrade().equals("合格")) {
                                    examScore.setLearnGrade(0);
@@ -615,7 +615,7 @@
                    //2.修改用户考试状态
                    User user = new User();
                    user.setIsTrain(1);
                    user.setId(Long.parseLong(examScore.getUserId()));
                    user.setId(examScore.getUserId());
                    //修改
                    userService.updateById(user);
@@ -646,7 +646,7 @@
                    //2.修改用户考试状态
                    User user = new User();
                    user.setIsTrain(1);
                    user.setId(Long.parseLong(examScore.getUserId()));
                    user.setId(examScore.getUserId());
                    //修改
                    userService.updateById(user);
@@ -733,7 +733,7 @@
                    //修改培训考试状态
                    User user = new User();
                    user.setId(Long.parseLong(examScore.getUserId()));
                    user.setId(examScore.getUserId());
                    user.setIsTrain(3);
                    userService.updateById(user);
                    //修改人员考试状态
src/main/java/org/springblade/modules/exam/service/impl/ScoreAuditRecordsServiceImpl.java
@@ -115,7 +115,7 @@
            //3.修改考试理论成绩
            examScore.setTheoryGrade(auditRecords.getNewScore());
            //查询用户年龄
            UserVO userVO = userService.getUserAgeById(Long.parseLong(examScore.getUserId()));
            UserVO userVO = userService.getUserAgeById(examScore.getUserId());
            //判断实操成绩是否为空
            if (null == examScore.getLearnGrade()) {
                //如果为空,之间修改理论成绩和总成绩
@@ -261,7 +261,7 @@
                //3.修改考试理论成绩
                examScore.setTheoryGrade(records.getNewScore());
                //查询用户年龄
                UserVO userVO = userService.getUserAgeById(Long.parseLong(examScore.getUserId()));
                UserVO userVO = userService.getUserAgeById(examScore.getUserId());
                //判断实操成绩是否为空
                if (null == examScore.getLearnGrade()) {
                    //如果为空,之间修改理论成绩和总成绩
src/main/java/org/springblade/modules/system/entity/User.java
@@ -272,4 +272,9 @@
     */
    @TableField("unit_name")
    private String unitName;
    /**
     * 是否冻结 0:否  1:是
     */
    private Integer isFreeze;
}
src/main/java/org/springblade/modules/system/mapper/UserMapper.java
@@ -114,9 +114,8 @@
     * @param user 用户信息
     * @return
     */
    @MapKey(value = "id")
    @SqlParser(filter=true)
    Map<Long, TreeNode> getSecurityApplyTree(@Param("user") UserVO user);
    List<TreeNode> getSecurityApplyTree(@Param("user") UserVO user);
    /**
src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -127,8 +127,11 @@
        <if test="user.roleAlias!=null and user.roleAlias != ''">
            and br.role_alias = '保安'
        </if>
        <if test="user.status!=null and user.status != '' and user.status != 6">
        <if test="user.status!=null and user.status != 6">
            and bu.status = #{user.status}
        </if>
        <if test="user.isFreeze!=null">
            and bu.is_freeze = #{user.isFreeze}
        </if>
        <if test="user.education!=null  and user.education != ''">
            and bu.education = #{user.education}
@@ -244,6 +247,9 @@
            <if test="user.account!=null and user.account != ''">
                and bu.account like concat('%', #{user.account},'%')
            </if>
            <if test="user.isFreeze!=null">
                and bu.is_freeze = #{user.isFreeze}
            </if>
            <if test="user.hold!=null and user.hold != ''">
                and bu.hold = #{user.hold}
            </if>
@@ -356,6 +362,9 @@
        </if>
        <if test="user.account!=null and user.account != ''">
            and account like concat('%', #{user.account},'%')
        </if>
        <if test="user.isFreeze!=null">
            and bu.is_freeze = #{user.isFreeze}
        </if>
        <if test="user.roleId!=null and user.roleId != ''">
            and (br.role_alias = '公安管理员' or br.role_alias = '民警')
@@ -483,6 +492,9 @@
        <if test="user.sex!=null and user.sex != ''">
            and bu.sex = #{user.sex}
        </if>
        <if test="user.isFreeze!=null">
            and bu.is_freeze = #{user.isFreeze}
        </if>
        <if test="user.dispatch!=null and user.dispatch != ''">
            <if test="user.dispatch==1">
                and (bu.dispatch = #{user.dispatch} or bu.dispatch is null)
@@ -537,6 +549,9 @@
        <if test="user.roleId!=null and user.roleId != ''">
            and bu.role_id = #{user.roleId}
        </if>
        <if test="user.isFreeze!=null">
            and bu.is_freeze = #{user.isFreeze}
        </if>
        <if test="user.status!=null and user.status != ''">
            and bu.status = #{user.status}
        </if>
@@ -558,55 +573,40 @@
    <!--保安员列表树 安员列表树,帅选无保安证,下拉tree-->
    <select id="getSecurityApplyTree" resultType="org.springblade.modules.system.node.TreeNode">
        (
            select #{user.deptId} as id,
                '全部' as name,
                0 as parentId
                from blade_user
        )
        union all
        (
        select
        a.id,
        a.name,
        a.type,
        a.parentId
        from (
            select
            a.id,
            a.name,
            a.parentId
            from (
                select
                    distinct
                    bu.id,
                    ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
                    bu.is_apply isApply,
                    bu.is_train isTrain,
                    bu.real_name as name,
                    #{user.deptId} parentId
                from
                    blade_user bu
                left join
                blade_dept bd
                on
                bu.dept_id = bd.id
                left join
                blade_role br
                on
                br.id = bu.role_id
                where
                bu.is_deleted = 0
                and bu.status = 1
                and (bu.examination_type != 1 or bu.examination_type is null)
                and (hold = 2 or hold = 3)
                and bd.id = #{user.deptId}
                and br.role_alias = '保安'
            ) a
            where 1 = 1
            <if test="user.examType==1">
                and a.isApply != 1
            </if>
            <if test="user.examType==2">
                and a.isTrain != 1
            </if>
        )
                distinct
                bu.id,
                ifnull(TIMESTAMPDIFF(YEAR, SUBSTRING(bu.cardid, 7, 8), CURDATE()),0) AS age,
                bu.is_apply isApply,
                bu.is_train isTrain,
                bu.real_name as name,
                if(es.user_id is not null,1,2) as type,
                #{user.deptId} parentId
            from blade_user bu
            left join blade_dept bd on bu.dept_id = bd.id
            left join blade_role br on br.id = bu.role_id
            left join (select user_id,max(id) from exam_score where (qualified =1 or qualified =3) GROUP BY user_id) es
            on es.user_id = bu.id
            where
            bu.is_deleted = 0 and bu.status = 1 and bu.is_freeze = 0
            and (bu.examination_type != 1 or bu.examination_type is null)
            and (hold = 2 or hold = 3)
            and bd.id = #{user.deptId}
            and br.role_alias = '保安'
        ) a
        where 1 = 1
        <if test="user.examType==1">
            and a.isApply != 1
        </if>
        <if test="user.examType==2">
            and a.isTrain != 1
        </if>
    </select>
@@ -673,6 +673,7 @@
        </if>
        and bu.status = 1
        and bu.is_deleted = 0
        and bu.is_freeze = 0
    </select>
@@ -918,6 +919,9 @@
        <if test="user.isAvatar==2">
            and (bu.avatar is null or bu.avatar="")
        </if>
        <if test="user.isFreeze!=null">
            and bu.is_freeze = #{user.isFreeze}
        </if>
        <if test="user.unitName!=null and user.unitName != ''">
            and bu.unit_name like concat('%', #{user.unitName},'%')
        </if>
@@ -1149,7 +1153,7 @@
    <!--用户冻结操作-->
    <update id="updateFreeze">
        update blade_user set is_deleted = 1
        update blade_user set is_freeze = 1
        <choose>
            <when test="list!=null and list.size()>0">
                where id in
src/main/java/org/springblade/modules/system/node/TreeNode.java
@@ -27,6 +27,11 @@
    private String name;
    /**
     * 类型
     */
    private Integer type;
    /**
     * 子节点
     */
    private List<TreeNode> children = new ArrayList<>();
src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -752,18 +752,41 @@
     */
    @Override
    public List<TreeNode> getSecurityApplyTree(UserVO user) {
        Map<Long, TreeNode> map = baseMapper.getSecurityApplyTree(user);
        List<TreeNode> tree = new ArrayList<>();
        if (map.size() > 1) {
            map.forEach((id, treeNode) -> {
                if (map.containsKey(treeNode.getParentId())) {
                    map.get(treeNode.getParentId()).getChildren().add(treeNode);
                } else {
                    tree.add(treeNode);
        // 总的
        List<TreeNode> allList = new ArrayList<>();
        // 考试未通过
        List<TreeNode> notList = new ArrayList<>();
        // 新申报报名的
        List<TreeNode> newList = new ArrayList<>();
        // 查询
        List<TreeNode> treeNodeList = baseMapper.getSecurityApplyTree(user);
        // 遍历
        if (treeNodeList.size()>0){
            for (TreeNode treeNode : treeNodeList) {
                if (treeNode.getType()==1){
                    notList.add(treeNode);
                }
            });
                if (treeNode.getType()==2){
                    newList.add(treeNode);
                }
            }
        }
        return tree;
        if (newList.size()>0){
            // 新申报报名的
            TreeNode treeNode = new TreeNode();
            treeNode.setName("新申报名单");
            treeNode.setChildren(newList);
            allList.add(treeNode);
        }
        if (notList.size()>0){
            // 考试未通过
            TreeNode treeNode = new TreeNode();
            treeNode.setName("未通过考试名单");
            treeNode.setChildren(notList);
            allList.add(treeNode);
        }
        // 返回
        return allList;
    }
    /**
src/main/java/org/springblade/modules/training/service/impl/TrainingRegistrationServiceImpl.java
@@ -381,7 +381,7 @@
                            examScore.setTheoryGrade(0);
                            examScore.setAllGrade(0);
                            examScore.setQualified(3);
                            examScore.setUserId(user.getId().toString());
                            examScore.setUserId(user.getId());
                            examScore.setApplyId(trainingRegistration1.getId());
                            examScore.setExamId(trainingRegistration1.getTrainExamId());
                            //新增