diff --git a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java index f03791a..27de3e2 100644 --- a/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java +++ b/src/main/java/com/yipin/liuwanr/controller/AssesmentController.java @@ -385,5 +385,25 @@ public class AssesmentController { return resp; } + + /** + * 发布考核 + * @param courseId + * @return + */ + @GetMapping("/releaseAssesment") + Response releaseAssesment(@RequestParam Integer courseId){ + Response resp = new Response(); + HashMap ret = service.releaseAssesment(courseId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } + return resp; + } } diff --git a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java index 6adb4fc..0935df0 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java @@ -257,23 +257,7 @@ public class ExperimentalClassController { } return resp; } - - - //新增学生 - @PostMapping("/addStudent") - Response addStudent(@RequestBody ExperimentalClassVo vo) { - Response resp = new Response(); - HashMap ret=classService.addStudent(vo); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } - return resp; - } + /** * 查询学生行政班级 diff --git a/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java b/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java index 34f3b37..e48fa5b 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java @@ -317,7 +317,11 @@ public interface AssesmentMapper { + "", " and re.score is not null", ""}) - List> queryScore3(@Param("assesmentId")Integer assesmentId,@Param("experimentalClassId")Integer experimentalClassId, + List> queryScore3(@Param("assesmentId")Integer assesmentId,@Param("experimentalClassId")Integer experimentalClassId, @Param("classId") List classId); - + + + //开始考核 + @Select("select id,assesmentName from assessment where courseId=#{courseId} and releaseType=0 and assesmentState=0") + List releaseAssesment(Integer courseId); } diff --git a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java index 5b511a6..f3f69d9 100644 --- a/src/main/java/com/yipin/liuwanr/service/AssesmentService.java +++ b/src/main/java/com/yipin/liuwanr/service/AssesmentService.java @@ -595,4 +595,25 @@ public class AssesmentService { return resp; } + + /** + * 开启考核 + * @param courseId + * @return + */ + public HashMap releaseAssesment(Integer courseId) { + HashMap resp = new HashMap(); + try { + resp.put("retvalue", mapper.releaseAssesment(courseId)); + resp.put("retcode", 200); + } catch (Exception e) { + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "Inquiry Failed"); + return resp; + } + return resp; + + } + } diff --git a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java index 313bcc3..faabf17 100644 --- a/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java +++ b/src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java @@ -47,7 +47,7 @@ public class ExperimentalClassService { return resp; } - //实验班级删除学生 + //实验班级删除学生 public HashMap experimentClassDeleteStudent(List student){ HashMap resp = new HashMap(); try { @@ -155,63 +155,7 @@ public class ExperimentalClassService { } return resp; } - - //新增学生 - public HashMap addStudent(ExperimentalClassVo vo){ - HashMap resp = new HashMap(); - ExperimentalClass experimentalClass=vo.getExperimentalClass(); - List studeList=vo.getStudentList(); - //存储班级原有的学生 - List oldstudeId=new ArrayList(); - //新增的学生 - List newstudeId=new ArrayList(); - try { - Integer experimentalClassId=experimentalClass.getExperimentalClassId(); - List students=experimentalClassMapper.querystudent(experimentalClassId); - - //取出学生id - for (Student student : students) { - oldstudeId.add(student.getStudentId()); - } - //得到要添加的学生和要删除的学生 - for (int i = 0; i < studeList.size(); i++) { - Integer id=studeList.get(i).getStudentId(); - if(oldstudeId.contains(id)) {//新增的学生如果在数据库中,则删除oldstudeId中的学生 - studeList.remove(i); - oldstudeId.remove(id); - i--; - }else {//新增的学生没有在数据库中,存储起来,在关系表中绑定 - newstudeId.add(id); - } - } - //在实验班级绑定新学生 - if(!newstudeId.isEmpty()&&newstudeId.size()>0) { - for (int i=0;i0) { - for (int i=0;i queryexperimentalClass(Integer experimentalClassId){