| | |
| | | if (1==user.getIsApply()){ |
| | | return R.data(201,"已报名,不能重复报名"); |
| | | } |
| | | if (2==user.getIsApply()){ |
| | | if (2==user.getIsApply() || -1==user.getIsApply()){ |
| | | //默认通过 |
| | | apply.setApplyStatus(2); |
| | | //默认为未考试状态 |
| | |
| | | |
| | | |
| | | /** |
| | | * 公司报名列表取消报名,无applyId |
| | | * @param apply 考试报名信息对象 |
| | | */ |
| | | @PostMapping("/cancelApplyNotApplyId") |
| | | public R cancelApplyNotApplyId(@RequestBody Apply apply){ |
| | | //查询人员是否已报名 |
| | | User user = userService.getById(apply.getUserId()); |
| | | //查询报名信息,取最新的一条(即当前userId,)applyId最大的一条记录 |
| | | Apply apply1 = applyService.getMaxApplyIdByUserIdInfo(apply.getUserId()); |
| | | if(null==user.getIsApply()){ |
| | | apply1.setApplyStatus(4); |
| | | boolean status = applyService.updateById(apply1); |
| | | //修改保安报名状态 |
| | | user.setIsApply(2); |
| | | userService.updateById(user); |
| | | if (status){ |
| | | return R.data(200,"取消报名成功"); |
| | | } |
| | | }else { |
| | | if (user.getIsApply()==2) { |
| | | return R.data(201,"尚未报名"); |
| | | } |
| | | if(user.getIsApply()==1){ |
| | | apply1.setApplyStatus(4); |
| | | boolean status = applyService.updateById(apply1); |
| | | //修改保安报名状态 |
| | | user.setIsApply(2); |
| | | userService.updateById(user); |
| | | if (status){ |
| | | return R.data(200,"取消报名成功"); |
| | | } |
| | | } |
| | | } |
| | | return R.data(202,"取消报名失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 批量报名 |
| | | * @param ids userIds 人员 |
| | | */ |
| | |
| | | user.setIsApply(1); |
| | | userService.updateById(user); |
| | | } else { |
| | | if (user.getIsApply() == 2) { |
| | | if (user.getIsApply() == 2 || -1==user.getIsApply()) { |
| | | Apply apply1 = new Apply(); |
| | | apply1.setApplyStatus(2); |
| | | //默认为未考试状态 |
| | |
| | | }else { |
| | | //查询所有未报名的人员 |
| | | List<User> users = userService.getNotApplyIdList(deptId); |
| | | System.out.println("users = " + users.size()); |
| | | if (users.size()>0){ |
| | | users.forEach(user ->{ |
| | | //未报名的新增,已报名的不做处理 |
| | |
| | | user.setIsApply(1); |
| | | userService.updateById(user); |
| | | } else { |
| | | if (user.getIsApply() == 2) { |
| | | if (user.getIsApply() == 2 || -1==user.getIsApply()) { |
| | | Apply apply1 = new Apply(); |
| | | apply1.setApplyStatus(2); |
| | | //默认为未考试状态 |