src/main/java/org/springblade/modules/apply/controller/ApplyController.java
@@ -409,27 +409,16 @@ /** * 批量报名 * @param apply 考试报名信息对象 * @param ids userIds 人员 */ @PostMapping("/batchApply") public R batchApply(@RequestBody ApplyVO apply){ List<String> list = Arrays.asList(apply.getUserIds().split(",")); list.forEach(userId ->{ User user = userService.getById(userId); //未报名的新增,已报名的不做处理 if (null==user.getIsApply()) { Apply apply1 = new Apply(); apply1.setApplyStatus(2); //默认为未考试状态 apply1.setIsExam(1); apply1.setApplyTime(new Date()); apply1.setUserId(Long.parseLong(userId)); applyService.save(apply1); //修改保安报名状态 user.setIsApply(1); userService.updateById(user); }else { if (user.getIsApply()==2) { public R batchApply(@RequestParam String ids,@RequestParam String deptId){ if (!ids.equals("")) { List<String> list = Arrays.asList(ids.split(",")); list.forEach(userId -> { User user = userService.getById(userId); //未报名的新增,已报名的不做处理 if (null == user.getIsApply()) { Apply apply1 = new Apply(); apply1.setApplyStatus(2); //默认为未考试状态 @@ -440,9 +429,55 @@ //修改保安报名状态 user.setIsApply(1); userService.updateById(user); } else { if (user.getIsApply() == 2) { Apply apply1 = new Apply(); apply1.setApplyStatus(2); //默认为未考试状态 apply1.setIsExam(1); apply1.setApplyTime(new Date()); apply1.setUserId(Long.parseLong(userId)); applyService.save(apply1); //修改保安报名状态 user.setIsApply(1); userService.updateById(user); } } }); }else { //查询所有未报名的人员 List<User> users = userService.getNotApplyIdList(deptId); if (users.size()>0){ users.forEach(user ->{ //未报名的新增,已报名的不做处理 if (null == user.getIsApply()) { Apply apply1 = new Apply(); apply1.setApplyStatus(2); //默认为未考试状态 apply1.setIsExam(1); apply1.setApplyTime(new Date()); apply1.setUserId(user.getId()); applyService.save(apply1); //修改保安报名状态 user.setIsApply(1); userService.updateById(user); } else { if (user.getIsApply() == 2) { Apply apply1 = new Apply(); apply1.setApplyStatus(2); //默认为未考试状态 apply1.setIsExam(1); apply1.setApplyTime(new Date()); apply1.setUserId(user.getId()); applyService.save(apply1); //修改保安报名状态 user.setIsApply(1); userService.updateById(user); } } }); } }); } return R.data(200,"报名成功"); } src/main/java/org/springblade/modules/system/mapper/DeptMapper.xml
@@ -183,6 +183,7 @@ bu.dept_id = dept.id WHERE dept.is_deleted = 0 and bu.is_deleted = 0 <if test="type==1"> and dept_category=1 AND dept.parent_id = "1413470343230877697" @@ -214,6 +215,7 @@ on bd.id = bu.dept_id where 1=1 and bu.is_deleted = 0 <if test="type==1"> and dept_category=1 </if> @@ -270,6 +272,7 @@ on bd.id = bu.dept_id where 1=1 and bu.is_deleted = 0 <if test="parentId!=null and parentId!=''"> and dept_category=1 AND bu.dept_id = #{parentId} src/main/java/org/springblade/modules/system/mapper/UserMapper.java
@@ -102,4 +102,11 @@ * @return */ int getSecurityPaperCount(@Param("pre") String pre); /** * 查询当前公司未持证保安没有报名的人员 * @param deptId * @return */ List<User> getNotApplyIdList(@Param("deptId")String deptId); } src/main/java/org/springblade/modules/system/mapper/UserMapper.xml
@@ -310,4 +310,22 @@ select count(*) from blade_user where securitynumber like concat('%', #{pre},'%') </select> <!--查询当前公司未持证保安没有报名的人员--> <select id="getNotApplyIdList" resultType="org.springblade.modules.system.entity.User"> select DISTINCT bu.id,is_apply isApply from blade_user bu left join sys_apply sa on sa.user_id = bu.id where 1=1 and (hold=2 or hold = 3) and (sa.is_exam != 1 or sa.is_exam is null) and (bu.is_apply != 1 or bu.is_apply is null) and (sa.apply_status !=2 or sa.apply_status is null) and bu.dept_id = #{deptId} </select> </mapper> src/main/java/org/springblade/modules/system/service/IUserService.java
@@ -252,4 +252,11 @@ * @return */ int getSecurityPaperCount(String pre); /** * 查询当前公司未持证保安没有报名的人员 * @param deptId * @return */ List<User> getNotApplyIdList(String deptId); } src/main/java/org/springblade/modules/system/service/impl/UserServiceImpl.java
@@ -497,4 +497,14 @@ public int getSecurityPaperCount(String pre) { return baseMapper.getSecurityPaperCount(pre); } /** * 查询当前公司未持证保安没有报名的人员 * @param deptId * @return */ @Override public List<User> getNotApplyIdList(String deptId) { return baseMapper.getNotApplyIdList(deptId); } }