| | |
| | | |
| | | /** |
| | | * 批量报名 |
| | | * @param apply 考试报名信息对象 |
| | | * @param ids userIds 人员 |
| | | */ |
| | | @PostMapping("/batchApply") |
| | | public R batchApply(@RequestBody ApplyVO apply){ |
| | | List<String> list = Arrays.asList(apply.getUserIds().split(",")); |
| | | 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); |
| | | //未报名的新增,已报名的不做处理 |
| | |
| | | } |
| | | } |
| | | }); |
| | | }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,"报名成功"); |
| | | } |
| | | |