学生端、教师端实验学习

master
pd 4 years ago
parent cae1d1917b
commit 5ad0c6479e
  1. 1
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 49
      src/main/java/com/yipin/liuwanr/controller/ExperimentallearningController.java
  3. 47
      src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java
  4. 17
      src/main/java/com/yipin/liuwanr/entity/Project_Management.java
  5. 40
      src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java
  6. 45
      src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java
  7. 526
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java
  8. 41
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  9. 21
      src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java
  10. 34
      src/main/java/com/yipin/liuwanr/vo/CourseAndProjectVo.java

@ -48,7 +48,6 @@ public class ExperimentalClassController {
/** /**
* 查询实验班级 * 查询实验班级
* @param experimentalClassId
* @return * @return
*/ */
@GetMapping("/queryExperimentalClass") @GetMapping("/queryExperimentalClass")

@ -72,9 +72,13 @@ public class ExperimentallearningController {
* 获取教师信息 * 获取教师信息
*/ */
@GetMapping("/queryTeacherName") @GetMapping("/queryTeacherName")
Response queryTeacherName(@RequestParam Integer courseId) { Response queryTeacherName(@RequestParam Integer courseId,@RequestParam Integer studentId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryTeacherName(courseId); if(StringUtils.isEmpty(studentId)){
resp.setStatus(300);
resp.setErrmessage("学生信息为空");
}else{
HashMap<String, Object> ret = service.queryTeacherName(courseId,studentId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
resp.setStatus(status); resp.setStatus(status);
@ -83,6 +87,7 @@ public class ExperimentallearningController {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
}
return resp; return resp;
} }
@ -92,16 +97,21 @@ public class ExperimentallearningController {
* 获取学生信息 * 获取学生信息
*/ */
@GetMapping("/queryStudentName") @GetMapping("/queryStudentName")
Response queryStudentName(@RequestParam Integer courseId) { Response queryStudentName(@RequestParam Integer courseId,@RequestParam Integer studentId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryStudentName(courseId); if(StringUtils.isEmpty(studentId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (status == 200) { resp.setErrmessage("学生信息为空");
resp.setStatus(status); }else{
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.queryStudentName(courseId,studentId);
} else { int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
}
} }
return resp; return resp;
} }
@ -128,5 +138,26 @@ public class ExperimentallearningController {
} }
return resp; return resp;
} }
@GetMapping("/queryStudentCourse")
Response queryStudentCourse(@RequestParam Integer studentId) {
Response resp = new Response();
if(StringUtils.isEmpty(studentId)){
resp.setStatus(300);
resp.setMessage("学生信息为空");
}else {
HashMap<String, Object> ret = service.queryStudentCourse(studentId);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
} }

@ -2,6 +2,7 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap; import java.util.HashMap;
import com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -28,34 +29,38 @@ public class ProjectAndCourseController {
* @return * @return
*/ */
@GetMapping("/queryProject") @GetMapping("/queryProject")
Response queryProject(Integer courseId) { Response queryProject(Integer courseId,Integer experimentalClassId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.queryProject(courseId); if(StringUtils.isEmpty(experimentalClassId)){
int status = (int) ret.get("retcode"); resp.setStatus(300);
if (status == 200) { resp.setErrmessage("实验班级信息为空");
resp.setStatus(status); }else {
resp.setMessage(ret.get("retvalue")); HashMap<String, Object> ret = service.queryProject(courseId,experimentalClassId);
} else { int status = (int) ret.get("retcode");
resp.setStatus(status); if (status == 200) {
resp.setErrmessage(ret.get("retvalue").toString()); resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
} }
return resp; return resp;
} }
/** /**
* 修改项目状态 * 修改项目状态
* @param management
* @return * @return
*/ */
@PostMapping("/updateIsExperiment") @PostMapping("/updateIsExperiment")
Response updateIsExperiment(@RequestBody Project_Management management) { Response updateIsExperiment(@RequestBody CourseAndProjectVo vo) {
Response resp = new Response(); Response resp = new Response();
if(null==management) { if(null==vo) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("management Is null"); resp.setErrmessage("management Is null");
return resp; return resp;
}else { }else {
HashMap<String, Object> ret = service.updateIsExperiment(management); HashMap<String, Object> ret = service.updateIsExperiment(vo);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
resp.setStatus(status); resp.setStatus(status);
@ -70,18 +75,17 @@ public class ProjectAndCourseController {
/** /**
* 修改考勤状态 * 修改考勤状态
* @param management
* @return * @return
*/ */
@PostMapping("/updateIsAttendance") @PostMapping("/updateIsAttendance")
Response updateIsAttendance(@RequestBody Project_Management management) { Response updateIsAttendance(@RequestBody CourseAndProjectVo vo) {
Response resp = new Response(); Response resp = new Response();
if(null==management) { if(null==vo) {
resp.setStatus(300); resp.setStatus(300);
resp.setErrmessage("management Is null"); resp.setErrmessage("management Is null");
return resp; return resp;
}else { }else {
HashMap<String, Object> ret = service.updateIsAttendance(management); HashMap<String, Object> ret = service.updateIsAttendance(vo);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
resp.setStatus(status); resp.setStatus(status);
@ -96,9 +100,13 @@ public class ProjectAndCourseController {
//课程进度 //课程进度
@GetMapping("/getCourseSchedule") @GetMapping("/getCourseSchedule")
Response getCourseSchedule(Integer courseId) { Response getCourseSchedule(Integer courseId,Integer experimentalClassId) {
Response resp = new Response(); Response resp = new Response();
HashMap<String, Object> ret = service.getCourseSchedule(courseId); if(StringUtils.isEmpty(experimentalClassId)){
resp.setStatus(300);
resp.setErrmessage("实验班级为空");
}else{
HashMap<String, Object> ret = service.getCourseSchedule(courseId,experimentalClassId);
int status = (int) ret.get("retcode"); int status = (int) ret.get("retcode");
if (status == 200) { if (status == 200) {
resp.setStatus(status); resp.setStatus(status);
@ -107,6 +115,7 @@ public class ProjectAndCourseController {
resp.setStatus(status); resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString()); resp.setErrmessage(ret.get("retvalue").toString());
} }
}
return resp; return resp;
} }
} }

@ -24,7 +24,7 @@ public class Project_Management {
private Integer isShow; private Integer isShow;
private Integer isstartexperimental; private Integer isstartexperimental;
private Integer isstartexperimentSuggests; private Integer isstartexperimentSuggests;
private Integer isExperiment; private Integer isOpenProject;
private Integer isAttendance; private Integer isAttendance;
private Integer signin;//是否签到 private Integer signin;//是否签到
@ -167,14 +167,6 @@ public class Project_Management {
this.systemId = systemId; this.systemId = systemId;
} }
public Integer getIsExperiment() {
return isExperiment;
}
public void setIsExperiment(Integer isExperiment) {
this.isExperiment = isExperiment;
}
public Integer getIsAttendance() { public Integer getIsAttendance() {
return isAttendance; return isAttendance;
} }
@ -183,4 +175,11 @@ public class Project_Management {
this.isAttendance = isAttendance; this.isAttendance = isAttendance;
} }
public Integer getIsOpenProject() {
return isOpenProject;
}
public void setIsOpenProject(Integer isOpenProject) {
this.isOpenProject = isOpenProject;
}
} }

@ -2,14 +2,12 @@ package com.yipin.liuwanr.mapper;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.entity.*;
import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
import com.yipin.liuwanr.entity.Assesment;
import com.yipin.liuwanr.entity.Attendance;
import com.yipin.liuwanr.entity.Student;
/** /**
* 学生_实验学习 * 学生_实验学习
* @author 86151 * @author 86151
@ -63,22 +61,31 @@ public interface ExperimentallearningMapper {
+ "values (#{courseId},#{experimentId},now(),#{signIn},#{studentId})") + "values (#{courseId},#{experimentId},now(),#{signIn},#{studentId})")
void insertAttendance(Attendance attendance); void insertAttendance(Attendance attendance);
/**
* 获取实验班级信息
* @param courseId
* @param studentId
* @return
*/
@Select("select ecn.experimentalClassId from experimental_class_ning ecn left join experimental_class_student ecs on ecn.experimentalClassId=ecs.experimentalClassId where\n" +
"ecn.courseId=#{courseId} and ecs.studentId=#{studentId} GROUP BY ecn.experimentalClassId")
Integer queryExperimentalClassId(@Param("courseId") Integer courseId,@Param("studentId")Integer studentId);
/** /**
* 授课老师信息 * 授课老师信息
* @param courseid
* @return * @return
*/ */
@Select("select staffName from staff where staffId =(select staffId from course where courseId=#{courseid})") @Select("select name,userAvatars from experimental_class_ning ecs left join user u on ecs.userId=u.userId where ecs.experimentalClassId=#{experimentalClassId}")
String queryTeacherName(Integer courseid); UserM queryTeacherName(Integer experimentalClassId);
/** /**
* 多名学生信息展示 * 多名学生信息展示
* @param courseId
* @return * @return
*/ */
@Select("select studentName from student where FIND_IN_SET(#{courseId},courseId) > 0 ") @Select("select name,userAvatars from user u left join student s on (u.phone=s.phone and u.uniqueIdentificationAccount=s.uniqueIdentificationAccount) left join experimental_class_student ecs " +
List<Student> queryStudentName(Integer courseId); " on s.studentId=ecs.studentId where ecs.experimentalClassId=#{experimentalClassId} GROUP BY u.userId")
List<UserM> queryStudentName(Integer experimentalClassId);
/** /**
@ -107,4 +114,15 @@ public interface ExperimentallearningMapper {
*/ */
@Select("select studentId from record where assesmentId=#{assesmentId}") @Select("select studentId from record where assesmentId=#{assesmentId}")
List<Integer> queryStudentId(Integer assesmentId); List<Integer> queryStudentId(Integer assesmentId);
@Select("select c.courseId,c.courseName from course c left join experimental_class_ning ecn on c.courseId=ecn.courseId left join experimental_class_student ecs " +
" on ecn.experimentalClassId=ecs.experimentalClassId where ecn.isdel=0 and c.isdel=0 and ecs.studentId=#{StudentId} GROUP BY c.courseId")
List<Course> queryStudentCourse(Integer StudentId);
@Select("select DISTINCT hpm.projectId,projectName,isAttendance from hr_project_management hpm left join teacher_project tp on hpm.projectId=tp.projectId " +
" where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId} and tp.isOpenProject=0")
List<Project_Management> getBycourseId(@Param("experimentalClassId")Integer experimentalClassId,@Param("courseId") Integer courseId);
} }

@ -2,6 +2,8 @@ package com.yipin.liuwanr.mapper;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update; import org.apache.ibatis.annotations.Update;
@ -18,29 +20,42 @@ public interface TeacherProjectAndCourseMapper {
/** /**
* 查询实验项目信息 * 查询实验项目信息
*/ */
@Select({"<script>", // @Select({"<script>",
"select projectId,projectName,isExperiment,isAttendance from hr_project_management WHERE isdel=0 and projectPermissions=0 and state=1 " + // "select projectId,projectName,isExperiment,isAttendance from hr_project_management WHERE isdel=0 and projectPermissions=0 and state=1 " +
" and systemId in (select systemId FROM hr_course_tc where courseId=#{courseId} GROUP BY systemId)", // " and systemId in (select systemId FROM hr_course_tc where courseId=#{courseId} GROUP BY systemId)",
"<if test='isExperiment!=null'> and isExperiment=0</if>", // "<if test='isExperiment!=null'> and isExperiment=0</if>",
"<if test='isAttendance!=null'> and isAttendance=0</if>", // "<if test='isAttendance!=null'> and isAttendance=0</if>",
"</script>"}) // "</script>"})
List<Project_Management> getBySystemId(@Param("courseId") Integer courseId,@Param("isExperiment")Integer isExperiment,@Param("isAttendance")Integer isAttendance);
@Select("select DISTINCT hpm.projectId,projectName,isOpenProject,isAttendance from hr_project_management hpm left join teacher_project tp on hpm.projectId=tp.projectId " +
" where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId}")
List<Project_Management> getBySystemId(@Param("courseId") Integer courseId,@Param("experimentalClassId")Integer experimentalClassId);
/** /**
* 修改是否开启项目 * 修改是否开启项目
* @param management
*/ */
@Update("update hr_project_management set isExperiment=#{isExperiment} where projectId=#{projectId}") @Update("update teacher_project set isOpenProject=#{project.isOpenProject} where courseId=#{courseId} and experimentalClassId=#{experimentalClassId} and projectId=#{project.projectId}")
void updateIsExperiment(Project_Management management); void updateIsExperiment(CourseAndProjectVo vo);
/** /**
* 修改是否开启考勤 * 修改是否开启考勤
* @param management
*/ */
@Update("update hr_project_management set isAttendance=#{isAttendance} where projectId=#{projectId}") @Update("update teacher_project set isAttendance=#{project.isAttendance} where courseId=#{courseId} and experimentalClassId=#{experimentalClassId} and projectId=#{project.projectId}")
void updateIsAttendance(Project_Management management); void updateIsAttendance(CourseAndProjectVo vo);
@Select("select count(*) from hr_course_schedule where courseId=#{courseId}") @Select("select count(*) from hr_course_schedule where courseId=#{courseId}")
Integer getCourseSchedule(Integer courseId); Integer getCourseSchedule(Integer courseId);
@Select("select DISTINCT tc.projectId from hr_course_tc tc left join hr_project_management pm on tc.projectId=pm.projectId where tc.courseId=#{courseId} and pm.projectPermissions=0 ")
List<Integer> queryProject(Integer courseId);
@Insert({"<script>",
"insert into teacher_project(courseId,experimentalClassId,projectId) values ",
"<foreach collection='projectIds' item='projectId' index='index' separator=','>",
"(#{experimentalClassId}, #{courseId}, #{projectId})",
"</foreach>",
"</script>"})
void addBatchTeachProject(@Param("experimentalClassId") Integer experimentalClassId,@Param("courseId") Integer courseId,@Param("projectIds") List<Integer> projectIds);
} }

@ -19,267 +19,275 @@ import com.yipin.liuwanr.vo.ExperimentalClassVo;
@Service @Service
public class ExperimentalClassService { public class ExperimentalClassService {
private static Logger logger = Logger.getLogger(ExperimentalClassService.class);
@Autowired
private ExperimentalClassMapper experimentalClassMapper;
@Autowired private static Logger logger = Logger.getLogger(ExperimentalClassService.class);
private TeacherProjectAndCourseMapper projectAndCourseMapper;
//实验班级添加学生 @Autowired
public HashMap<String, Object> experimentClassAddStudent(List<Student> studentList){ private ExperimentalClassMapper experimentalClassMapper;
HashMap<String, Object> resp = new HashMap<String, Object>();
Integer size = studentList.size();
try {
for (int i = 0; i < size; i++) {
Student student = studentList.get(i);
Integer studentId = student.getStudentId();
String experimentalClassId = student.getExperimentalClassId();
if (studentId == null){
resp.put("retcode", 300);
resp.put("retvalue", "学生为空!");
}else if (experimentalClassId==null||experimentalClassId==""){
resp.put("retcode", 300);
resp.put("retvalue", "实验班级为空!");
}else{
experimentalClassMapper.experimentClassAddStudent(student);
resp.put("retcode", 200);
}
}
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "添加学生失败!");
return resp;
}
return resp;
}
//实验班级删除学生
public HashMap<String, Object> experimentClassDeleteStudent(List<Student> student){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
for (int i = 0; i < student.size(); i++) {
Student stu = student.get(i);
experimentalClassMapper.experimentClassDeleteStudent(stu);
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "删除学生失败");
return resp;
}
return resp;
}
//创建实验班级
public HashMap<String, Object> addExperimentalClass(ExperimentalClass experimentalClass){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.addExperimentalClass(experimentalClass);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "创建实验班级失败!");
throw e;
}
return resp;
}
public HashMap<String, Object> queryExperimentalClass(Integer schoolId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId));
// List<ExperimentalClass> a = experimentalClassMapper.queryExperimentalClass(schoolId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询实验班级失败!");
return resp;
}
return resp;
}
//查询实验班级专业
public HashMap<String, Object> queryExperimentalClassSP(Integer experimentalClassId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", experimentalClassMapper.queryExperimentalClassSP(experimentalClassId));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询实验班级专业失败!");
return resp;
}
return resp;
}
//查询学生行政班级
public HashMap<String, Object> queryStudentClass(Integer experimentalClassId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", experimentalClassMapper.queryStudentClass(experimentalClassId));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询学生行政班级失败!");
return resp;
}
return resp;
}
/**
* 班级详情
* @param student
* @param courseId
* @return
*/
public HashMap<String, Object> queryExperimentalClassDetails(Student student,Integer courseId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
//学生信息
List<Student> students=experimentalClassMapper.getExperimentalClassDetails(student);
//考勤数量
List<Project_Management> project=projectAndCourseMapper.getBySystemId(courseId,0,0);
int denominator=project.size();
for (int i = 0; i < students.size(); i++) {
Student stu=students.get(i);
Integer studentId=stu.getStudentId();
int molecule=experimentalClassMapper.getAttendance(studentId, courseId);
stu.setAttendance(molecule+"/"+denominator);
}
resp.put("retvalue", students);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询班级详情失败!");
return resp;
}
return resp;
}
@Autowired
//新增学生显示数据 private TeacherProjectAndCourseMapper projectAndCourseMapper;
public HashMap<String, Object> queryexperimentalClass(Integer experimentalClassId){
HashMap<String, Object> resp = new HashMap<String, Object>(); //实验班级添加学生
HashMap<String, Object> obj=new HashMap<String, Object>(); public HashMap<String, Object> experimentClassAddStudent(List<Student> studentList) {
try { HashMap<String, Object> resp = new HashMap<String, Object>();
List<ExperimentalClass> classes=experimentalClassMapper.queryExperimentalClassDetails1(experimentalClassId); Integer size = studentList.size();
List<Student> students=experimentalClassMapper.querystudent(experimentalClassId); try {
obj.put("experimentalClass", classes); for (int i = 0; i < size; i++) {
obj.put("students", students); Student student = studentList.get(i);
Integer studentId = student.getStudentId();
resp.put("retvalue", obj); String experimentalClassId = student.getExperimentalClassId();
resp.put("retcode", 200); if (studentId == null) {
} catch (RuntimeException e) { resp.put("retcode", 300);
logger.error(e.getMessage()); resp.put("retvalue", "学生为空!");
resp.put("retcode", 500); } else if (experimentalClassId == null || experimentalClassId == "") {
resp.put("retvalue", "查询失败!"); resp.put("retcode", 300);
return resp; resp.put("retvalue", "实验班级为空!");
} } else {
return resp; experimentalClassMapper.experimentClassAddStudent(student);
} resp.put("retcode", 200);
}
}
} catch (RuntimeException e) {
//专业下拉框 logger.error(e.getMessage());
public HashMap<String, Object> getProfessionals(Integer experimentalClassId){ resp.put("retcode", 500);
HashMap<String, Object> resp = new HashMap<String, Object>(); resp.put("retvalue", "添加学生失败!");
try { return resp;
List<Professional> professionals=experimentalClassMapper.getProfessionals(experimentalClassId); }
resp.put("retvalue", professionals); return resp;
resp.put("retcode", 200); }
} catch (RuntimeException e) {
logger.error(e.getMessage()); //实验班级删除学生
resp.put("retcode", 500); public HashMap<String, Object> experimentClassDeleteStudent(List<Student> student) {
resp.put("retvalue", "查询专业失败!"); HashMap<String, Object> resp = new HashMap<String, Object>();
return resp; try {
} for (int i = 0; i < student.size(); i++) {
return resp; Student stu = student.get(i);
} experimentalClassMapper.experimentClassDeleteStudent(stu);
}
resp.put("retcode", 200);
//班级下拉框 } catch (RuntimeException e) {
public HashMap<String, Object> getStudentClass(Integer experimentalClassId){ logger.error(e.getMessage());
HashMap<String, Object> resp = new HashMap<String, Object>(); resp.put("retcode", 500);
try { resp.put("retvalue", "删除学生失败");
List<StuProfessionalArchitecture> professionals=experimentalClassMapper.getStudentClass(experimentalClassId); return resp;
resp.put("retvalue", professionals); }
resp.put("retcode", 200); return resp;
} catch (RuntimeException e) { }
logger.error(e.getMessage());
resp.put("retcode", 500); //创建实验班级
resp.put("retvalue", "查询班级失败!"); public HashMap<String, Object> addExperimentalClass(ExperimentalClass experimentalClass) {
return resp; HashMap<String, Object> resp = new HashMap<String, Object>();
} try {
return resp; experimentalClassMapper.addExperimentalClass(experimentalClass);
}
//给实验班级绑定项目
Integer experimentalClassId = experimentalClass.getExperimentalClassId();
Integer courseId = experimentalClass.getCourseId();
public HashMap<String, Object> deleteExperimentalClass(Integer experimentalClassId){ List<Integer> projectIds = projectAndCourseMapper.queryProject(courseId);
HashMap<String, Object> resp = new HashMap<String, Object>(); projectAndCourseMapper.addBatchTeachProject(experimentalClassId,courseId,projectIds);
try {
experimentalClassMapper.deleteExperimentalClass(experimentalClassId); resp.put("retcode", 200);
resp.put("retcode", 200); } catch (RuntimeException e) {
} catch (RuntimeException e) { logger.error(e.getMessage());
logger.error(e.getMessage()); resp.put("retcode", 500);
resp.put("retcode", 500); resp.put("retvalue", "创建实验班级失败!");
resp.put("retvalue", "删除实验班级失败!"); throw e;
return resp; }
} return resp;
return resp; }
}
public HashMap<String, Object> queryExperimentalClass(Integer schoolId) {
public HashMap<String, Object> updateExperimentalClass(ExperimentalClass experimentalClass){ HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> resp = new HashMap<String, Object>(); try {
try { resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId));
experimentalClassMapper.updateExperimentalClass(experimentalClass); List<ExperimentalClass> a = experimentalClassMapper.queryExperimentalClass(schoolId);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "更新实验班级失败!"); resp.put("retvalue", "查询实验班级失败!");
return resp; return resp;
} }
return resp; return resp;
} }
//修改实验班级名称 //查询实验班级专业
public HashMap<String, Object> updateExperimentClassName(ExperimentalClass experimentalClass){ public HashMap<String, Object> queryExperimentalClassSP(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
experimentalClassMapper.updateExperimentClassName(experimentalClass); resp.put("retvalue", experimentalClassMapper.queryExperimentalClassSP(experimentalClassId));
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "修改实验班级名称失败!"); resp.put("retvalue", "查询实验班级专业失败!");
return resp; return resp;
} }
return resp; return resp;
} }
//——————————————————————————————全承珠
public HashMap<String, Object> queryGetByExperimentalClassName(String experimentalClassName){ //查询学生行政班级
HashMap<String, Object> resp = new HashMap<String, Object>(); public HashMap<String, Object> queryStudentClass(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", experimentalClassMapper.queryStudentClass(experimentalClassId));
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询学生行政班级失败!");
return resp;
}
return resp;
}
/**
* 班级详情
*
* @param student
* @param courseId
* @return
*/
public HashMap<String, Object> queryExperimentalClassDetails(Student student, Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
Integer experimentalClassId = Integer.parseInt(student.getExperimentalClassId());
//学生信息
List<Student> students = experimentalClassMapper.getExperimentalClassDetails(student);
//考勤数量
List<Project_Management> project = projectAndCourseMapper.getBySystemId(courseId, experimentalClassId);
int denominator = project.size();
for (int i = 0; i < students.size(); i++) {
Student stu = students.get(i);
Integer studentId = stu.getStudentId();
int molecule = experimentalClassMapper.getAttendance(studentId, courseId);
stu.setAttendance(molecule + "/" + denominator);
}
resp.put("retvalue", students);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询班级详情失败!");
return resp;
}
return resp;
}
//新增学生显示数据
public HashMap<String, Object> queryexperimentalClass(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> obj = new HashMap<String, Object>();
try {
List<ExperimentalClass> classes = experimentalClassMapper.queryExperimentalClassDetails1(experimentalClassId);
List<Student> students = experimentalClassMapper.querystudent(experimentalClassId);
obj.put("experimentalClass", classes);
obj.put("students", students);
resp.put("retvalue", obj);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询失败!");
return resp;
}
return resp;
}
//专业下拉框
public HashMap<String, Object> getProfessionals(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
List<Professional> professionals = experimentalClassMapper.getProfessionals(experimentalClassId);
resp.put("retvalue", professionals);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询专业失败!");
return resp;
}
return resp;
}
//班级下拉框
public HashMap<String, Object> getStudentClass(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
List<StuProfessionalArchitecture> professionals = experimentalClassMapper.getStudentClass(experimentalClassId);
resp.put("retvalue", professionals);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询班级失败!");
return resp;
}
return resp;
}
public HashMap<String, Object> deleteExperimentalClass(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.deleteExperimentalClass(experimentalClassId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "删除实验班级失败!");
return resp;
}
return resp;
}
public HashMap<String, Object> updateExperimentalClass(ExperimentalClass experimentalClass) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.updateExperimentalClass(experimentalClass);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "更新实验班级失败!");
return resp;
}
return resp;
}
//修改实验班级名称
public HashMap<String, Object> updateExperimentClassName(ExperimentalClass experimentalClass) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.updateExperimentClassName(experimentalClass);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "修改实验班级名称失败!");
return resp;
}
return resp;
}
//——————————————————————————————全承珠
public HashMap<String, Object> queryGetByExperimentalClassName(String experimentalClassName) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", experimentalClassMapper.queryGetByExperimentalClassName(experimentalClassName)); resp.put("retvalue", experimentalClassMapper.queryGetByExperimentalClassName(experimentalClassName));
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed"); resp.put("retvalue", "Inquiry Failed");
return resp; return resp;
} }
return resp; return resp;
} }
} }

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.entity.UserM;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -43,11 +44,11 @@ public class ExperimentallearningService {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){ if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId); List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null); List<Project_Management> projects = mapper.getBycourseId(experimentalClassId,courseId);
for (int i = 0; i < projects.size(); i++) { for (int i = 0; i < projects.size(); i++) {
Project_Management project = projects.get(i); Project_Management project = projects.get(i);
if (project.getIsExperiment() == 0) {
// 教师那边开启了考勤,学生这边才可以有是否已经签到 // 教师那边开启了考勤,学生这边才可以有是否已经签到
if (project.getIsAttendance() == 0) { if (project.getIsAttendance() == 0) {
// 判断该学生签到的项目,是否在开启的项目中 // 判断该学生签到的项目,是否在开启的项目中
@ -58,10 +59,6 @@ public class ExperimentallearningService {
} }
projects.set(i, project); projects.set(i, project);
} }
} else {
project.setIsAttendance(null);
projects.set(i, project);
}
} }
resp.put("retvalue", projects); resp.put("retvalue", projects);
} }
@ -69,7 +66,7 @@ public class ExperimentallearningService {
}catch(Exception e){ }catch(Exception e){
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed"); resp.put("retvalue", "实验项目查询失败");
return resp; return resp;
}return resp; }return resp;
} }
@ -101,11 +98,15 @@ public class ExperimentallearningService {
/** /**
* 学生信息展示 * 学生信息展示
*/ */
public HashMap<String, Object> queryStudentName(Integer courseId) { public HashMap<String, Object> queryStudentName(Integer courseId,Integer studentId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if(!StringUtils.isEmpty(courseId)){ if(!StringUtils.isEmpty(courseId)){
resp.put("retvalue", mapper.queryStudentName(courseId)); //实验班级
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
//学生信息
List<UserM> users =mapper.queryStudentName(experimentalClassId);
resp.put("retvalue", users);
} }
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
@ -120,11 +121,15 @@ public class ExperimentallearningService {
/** /**
* 授课老师 * 授课老师
*/ */
public HashMap<String, Object> queryTeacherName(Integer courseId) { public HashMap<String, Object> queryTeacherName(Integer courseId,Integer studentId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if(!StringUtils.isEmpty(courseId)){ if(!StringUtils.isEmpty(courseId)){
resp.put("retvalue", mapper.queryTeacherName(courseId)); //实验班级
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
//教师信息
UserM user =mapper.queryTeacherName(experimentalClassId);
resp.put("retvalue",user);
} }
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
@ -177,4 +182,18 @@ public class ExperimentallearningService {
return resp; return resp;
} }
public HashMap<String, Object> queryStudentCourse(Integer studentId){
HashMap<String, Object> resp = new HashMap<String, Object>();
try{
resp.put("retvalue",mapper.queryStudentCourse(studentId));
resp.put("retcode",200);
}catch(Exception e){
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询课程信息失败");
}
return resp;
}
} }

@ -3,6 +3,7 @@ package com.yipin.liuwanr.service;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.jboss.logging.Logger; import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -30,10 +31,10 @@ public class ProjectAndCourseService {
* @param courseId * @param courseId
* @return * @return
*/ */
public HashMap<String, Object> queryProject(Integer courseId) { public HashMap<String, Object> queryProject(Integer courseId,Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
List<Project_Management> project=mapper.getBySystemId(courseId,null, null); List<Project_Management> project=mapper.getBySystemId(courseId,experimentalClassId);
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", project); resp.put("retvalue", project);
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -48,15 +49,15 @@ public class ProjectAndCourseService {
/** /**
* 修改项目状态 * 修改项目状态
*/ */
public HashMap<String, Object> updateIsExperiment(Project_Management management) { public HashMap<String, Object> updateIsExperiment(CourseAndProjectVo vo) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
mapper.updateIsExperiment(management); mapper.updateIsExperiment(vo);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "Update Failed"); resp.put("retvalue", "修改项目实验失败");
return resp; return resp;
} }
return resp; return resp;
@ -65,10 +66,10 @@ public class ProjectAndCourseService {
/** /**
* 修改考勤状态 * 修改考勤状态
*/ */
public HashMap<String, Object> updateIsAttendance(Project_Management management) { public HashMap<String, Object> updateIsAttendance(CourseAndProjectVo vo) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
mapper.updateIsAttendance(management); mapper.updateIsAttendance(vo);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -79,15 +80,15 @@ public class ProjectAndCourseService {
return resp; return resp;
} }
public HashMap<String, Object> getCourseSchedule(Integer courseId) { public HashMap<String, Object> getCourseSchedule(Integer courseId,Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Integer> obj = new HashMap<String, Integer>(); HashMap<String, Integer> obj = new HashMap<String, Integer>();
try { try {
if(StringUtils.isEmpty(courseId)){ if(!StringUtils.isEmpty(courseId)){
//完成的课程项目 //完成的课程项目
Integer number=mapper.getCourseSchedule(courseId); Integer number=mapper.getCourseSchedule(courseId);
//总项目数量 //总项目数量
List<Project_Management> project=mapper.getBySystemId(courseId,null, null); List<Project_Management> project=mapper.getBySystemId(courseId,experimentalClassId);
obj.put("total",project.size()); obj.put("total",project.size());
if(number!=null){ if(number!=null){
obj.put("number",number); obj.put("number",number);

@ -0,0 +1,34 @@
package com.yipin.liuwanr.vo;
import com.yipin.liuwanr.entity.Project_Management;
public class CourseAndProjectVo {
private Integer courseId;
private Integer experimentalClassId;
private Project_Management project;
public Integer getCourseId() {
return courseId;
}
public void setCourseId(Integer courseId) {
this.courseId = courseId;
}
public Integer getExperimentalClassId() {
return experimentalClassId;
}
public void setExperimentalClassId(Integer experimentalClassId) {
this.experimentalClassId = experimentalClassId;
}
public Project_Management getProject() {
return project;
}
public void setProject(Project_Management project) {
this.project = project;
}
}
Loading…
Cancel
Save