| | |
| | | } |
| | | |
| | | /** |
| | | * 新增 |
| | | * 新增报名 |
| | | * @param apply 考试报名信息对象 |
| | | */ |
| | | @PostMapping("/save") |
| | | @ApiOperation(value = "新增", notes = "传入apply") |
| | | public R save(@RequestBody Apply apply) { |
| | | return R.status(applyService.save(apply)); |
| | | //查询人员是否已报名 |
| | | User user = userService.getById(apply.getUserId()); |
| | | if (null==user.getIsApply()){ |
| | | //默认通过 |
| | | apply.setApplyStatus(2); |
| | | //默认为未考试状态 |
| | | apply.setIsExam(1); |
| | | apply.setApplyTime(new Date()); |
| | | //报名 |
| | | applyService.save(apply); |
| | | //修改保安报名状态 |
| | | User user1 = new User(); |
| | | user1.setId(apply.getUserId()); |
| | | user1.setIsApply(1); |
| | | userService.updateById(user1); |
| | | return R.data(200,"报名成功"); |
| | | }else { |
| | | if (1==user.getIsApply()){ |
| | | return R.data(201,"已报名,不能重复报名"); |
| | | } |
| | | if (2==user.getIsApply() || -1==user.getIsApply()){ |
| | | //默认通过 |
| | | apply.setApplyStatus(2); |
| | | //默认为未考试状态 |
| | | apply.setIsExam(1); |
| | | apply.setApplyTime(new Date()); |
| | | applyService.save(apply); |
| | | //修改保安报名状态 |
| | | User user1 = new User(); |
| | | user1.setId(apply.getUserId()); |
| | | user1.setIsApply(1); |
| | | userService.updateById(user1); |
| | | return R.data(200,"报名成功"); |
| | | } |
| | | } |
| | | return R.data(202,"报名失败"); |
| | | } |
| | | |
| | | |
| | |
| | | * @param apply 考试报名信息对象 |
| | | */ |
| | | @PostMapping("/submit") |
| | | public R submit(@RequestBody Apply apply) throws Exception { |
| | | if (null==apply.getId()){ |
| | | //查询人员是否已报名 |
| | | User user = userService.getById(apply.getUserId()); |
| | | if (null==user.getIsApply()){ |
| | | //默认通过 |
| | | apply.setApplyStatus(2); |
| | | //默认为未考试状态 |
| | | apply.setIsExam(1); |
| | | apply.setApplyTime(new Date()); |
| | | //修改保安报名状态 |
| | | User user1 = new User(); |
| | | user1.setId(apply.getUserId()); |
| | | user1.setIsApply(1); |
| | | userService.updateById(user1); |
| | | return R.data(200,"报名成功"); |
| | | }else { |
| | | if (1==user.getIsApply()){ |
| | | return R.data(201,"已报名,不能重复报名"); |
| | | } |
| | | if (2==user.getIsApply()){ |
| | | //默认通过 |
| | | apply.setApplyStatus(2); |
| | | //默认为未考试状态 |
| | | apply.setIsExam(1); |
| | | apply.setApplyTime(new Date()); |
| | | //修改保安报名状态 |
| | | User user1 = new User(); |
| | | user1.setId(apply.getUserId()); |
| | | user1.setIsApply(1); |
| | | userService.updateById(user1); |
| | | return R.data(200,"报名成功"); |
| | | } |
| | | } |
| | | |
| | | //去生成准考证号码 |
| | | // apply.setCandidateNo(getCandidateNo(apply)); |
| | | //去生成考试编号 |
| | | // apply.setApplyCode(getApplyCode(apply)); |
| | | |
| | | }else { |
| | | //修改保安报名状态 |
| | | User user = new User(); |
| | | user.setId(apply.getUserId()); |
| | | user.setIsApply(2); |
| | | userService.updateById(user); |
| | | } |
| | | apply.setApplyStatus(4); |
| | | boolean status = applyService.saveOrUpdate(apply); |
| | | if (status){ |
| | | //内网新增 |
| | | // arg.test01(arg.url+"/apply/save",apply); |
| | | return R.data(200,"取消报名成功"); |
| | | } |
| | | // //内网修改 |
| | | // if(null!=apply.getId()){ |
| | | // //修改 |
| | | // arg.test01(arg.url+"/apply/update",apply); |
| | | // } |
| | | return R.data(202,"报名失败"); |
| | | public R submit(@RequestBody Apply apply){ |
| | | return R.data(applyService.saveOrUpdate(apply)); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * 查询用户详情 |
| | | * @param user |
| | | */ |
| | | @GetMapping("/userDetail") |
| | | @ApiOperation(value = "详情", notes = "传入apply") |
| | | public R<User> details(User user) { |
| | | //用户详情 |
| | | User user1 = userService.getById(user.getId()); |
| | | //返回 |
| | | return R.data(user1); |
| | | } |
| | | |
| | | /** |
| | | * 详情 |
| | | * @param apply 考试报名信息对象 |
| | | */ |
| | |
| | | return R.data(200,"取消报名成功"); |
| | | } |
| | | } |
| | | } |
| | | return R.data(202,"取消报名失败"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 公司报名列表取消报名,无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 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); |
| | | //默认为未考试状态 |
| | |
| | | //修改保安报名状态 |
| | | user.setIsApply(1); |
| | | userService.updateById(user); |
| | | } else { |
| | | if (user.getIsApply() == 2 || -1==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 { |
| | | //查询所有未报名的人员 |
| | | List<User> users = userService.getNotApplyIdList(deptId); |
| | | System.out.println("users = " + users.size()); |
| | | 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 || -1==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); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | }); |
| | | } |
| | | return R.data(200,"报名成功"); |
| | | } |
| | | |
| | |
| | | */ |
| | | @PostMapping("/batchExam") |
| | | public R batchExam(@RequestParam String ids, |
| | | @RequestParam String examTime, |
| | | String examTime, |
| | | @RequestParam Date startTime, |
| | | @RequestParam Date endTime){ |
| | | Date endTime){ |
| | | if (!ids.equals("")){ |
| | | List<String> list = Arrays.asList(ids.split(",")); |
| | | if (list.size()>0){ |
| | | ExamPaper examPaper = new ExamPaper(); |
| | | examPaper.setExamTime(examTime); |
| | | // examPaper.setExamTime(examTime); |
| | | examPaper.setExamType(1); |
| | | examPaper.setStartTime(startTime); |
| | | examPaper.setEndTime(endTime); |
| | | // examPaper.setEndTime(endTime); |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.setTime(startTime); |
| | | int year = instance.get(Calendar.YEAR); |
| | |
| | | if (applyIds.size()>0){ |
| | | //生成考试 |
| | | ExamPaper examPaper = new ExamPaper(); |
| | | examPaper.setExamTime(examTime); |
| | | // examPaper.setExamTime(examTime); |
| | | examPaper.setExamType(1); |
| | | examPaper.setStartTime(startTime); |
| | | examPaper.setEndTime(endTime); |
| | | // examPaper.setEndTime(endTime); |
| | | Calendar instance = Calendar.getInstance(); |
| | | instance.setTime(startTime); |
| | | int year = instance.get(Calendar.YEAR); |
| | |
| | | return applyService.getApplyDetailList(apply); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询保安员个人报名信息 |
| | | * @param apply 报名信息,包含userId |
| | | * @return |
| | | */ |
| | | @GetMapping("/getSecurityApplyDetail") |
| | | public ApplyVO getSecurityApplyDetail(ApplyVO apply){ |
| | | return applyService.getSecurityApplyDetail(apply); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 修改考试状态 |
| | | * @param apply 报名信息,包含userId,applyid |
| | | * @return |
| | | */ |
| | | @PostMapping("/updateApplyStatus") |
| | | public void updateApplyStatus(@RequestBody ApplyVO apply){ |
| | | applyService.updateApplyStatus(apply); |
| | | } |
| | | |
| | | |
| | | } |