From f1092d53966cf3b3b93be7fc59d913cd13d2ec37 Mon Sep 17 00:00:00 2001
From: Administrator <admin>
Date: Mon, 16 Aug 2021 16:17:47 +0800
Subject: [PATCH] 1.用户新增角色关联持证字段 2.新增接口,考试开始,修改考试的状态为考试中 3.考试查询接口修改
---
src/main/java/org/springblade/modules/apply/controller/ApplyController.java | 87 +++++++++++++++++++++++++++++++++----------
1 files changed, 67 insertions(+), 20 deletions(-)
diff --git a/src/main/java/org/springblade/modules/apply/controller/ApplyController.java b/src/main/java/org/springblade/modules/apply/controller/ApplyController.java
index 0adada7..83945ce 100644
--- a/src/main/java/org/springblade/modules/apply/controller/ApplyController.java
+++ b/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,"报名成功");
}
@@ -538,4 +573,16 @@
return applyService.getSecurityApplyDetail(apply);
}
+
+ /**
+ * 修改考试状态
+ * @param apply 报名信息,包含userId,applyid
+ * @return
+ */
+ @PostMapping("/updateApplyStatus")
+ public void updateApplyStatus(@RequestBody ApplyVO apply){
+ applyService.updateApplyStatus(apply);
+ }
+
+
}
--
Gitblit v1.9.3