学生端、教师端实验学习

master
pd 4 years ago
parent cae1d1917b
commit 5ad0c6479e
  1. 1
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 39
      src/main/java/com/yipin/liuwanr/controller/ExperimentallearningController.java
  3. 33
      src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java
  4. 17
      src/main/java/com/yipin/liuwanr/entity/Project_Management.java
  5. 38
      src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java
  6. 41
      src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java
  7. 16
      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
*/
@GetMapping("/queryExperimentalClass")

@ -72,9 +72,13 @@ public class ExperimentallearningController {
* 获取教师信息
*/
@GetMapping("/queryTeacherName")
Response queryTeacherName(@RequestParam Integer courseId) {
Response queryTeacherName(@RequestParam Integer courseId,@RequestParam Integer studentId) {
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");
if (status == 200) {
resp.setStatus(status);
@ -83,6 +87,7 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
@ -92,9 +97,13 @@ public class ExperimentallearningController {
* 获取学生信息
*/
@GetMapping("/queryStudentName")
Response queryStudentName(@RequestParam Integer courseId) {
Response queryStudentName(@RequestParam Integer courseId,@RequestParam Integer studentId) {
Response resp = new Response();
HashMap<String, Object> ret = service.queryStudentName(courseId);
if(StringUtils.isEmpty(studentId)){
resp.setStatus(300);
resp.setErrmessage("学生信息为空");
}else{
HashMap<String, Object> ret = service.queryStudentName(courseId,studentId);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
@ -103,6 +112,7 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
@ -129,4 +139,25 @@ public class ExperimentallearningController {
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 com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
@ -28,9 +29,13 @@ public class ProjectAndCourseController {
* @return
*/
@GetMapping("/queryProject")
Response queryProject(Integer courseId) {
Response queryProject(Integer courseId,Integer experimentalClassId) {
Response resp = new Response();
HashMap<String, Object> ret = service.queryProject(courseId);
if(StringUtils.isEmpty(experimentalClassId)){
resp.setStatus(300);
resp.setErrmessage("实验班级信息为空");
}else {
HashMap<String, Object> ret = service.queryProject(courseId,experimentalClassId);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
@ -39,23 +44,23 @@ public class ProjectAndCourseController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
/**
* 修改项目状态
* @param management
* @return
*/
@PostMapping("/updateIsExperiment")
Response updateIsExperiment(@RequestBody Project_Management management) {
Response updateIsExperiment(@RequestBody CourseAndProjectVo vo) {
Response resp = new Response();
if(null==management) {
if(null==vo) {
resp.setStatus(300);
resp.setErrmessage("management Is null");
return resp;
}else {
HashMap<String, Object> ret = service.updateIsExperiment(management);
HashMap<String, Object> ret = service.updateIsExperiment(vo);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
@ -70,18 +75,17 @@ public class ProjectAndCourseController {
/**
* 修改考勤状态
* @param management
* @return
*/
@PostMapping("/updateIsAttendance")
Response updateIsAttendance(@RequestBody Project_Management management) {
Response updateIsAttendance(@RequestBody CourseAndProjectVo vo) {
Response resp = new Response();
if(null==management) {
if(null==vo) {
resp.setStatus(300);
resp.setErrmessage("management Is null");
return resp;
}else {
HashMap<String, Object> ret = service.updateIsAttendance(management);
HashMap<String, Object> ret = service.updateIsAttendance(vo);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
@ -96,9 +100,13 @@ public class ProjectAndCourseController {
//课程进度
@GetMapping("/getCourseSchedule")
Response getCourseSchedule(Integer courseId) {
Response getCourseSchedule(Integer courseId,Integer experimentalClassId) {
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");
if (status == 200) {
resp.setStatus(status);
@ -107,6 +115,7 @@ public class ProjectAndCourseController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
}

@ -24,7 +24,7 @@ public class Project_Management {
private Integer isShow;
private Integer isstartexperimental;
private Integer isstartexperimentSuggests;
private Integer isExperiment;
private Integer isOpenProject;
private Integer isAttendance;
private Integer signin;//是否签到
@ -167,14 +167,6 @@ public class Project_Management {
this.systemId = systemId;
}
public Integer getIsExperiment() {
return isExperiment;
}
public void setIsExperiment(Integer isExperiment) {
this.isExperiment = isExperiment;
}
public Integer getIsAttendance() {
return isAttendance;
}
@ -183,4 +175,11 @@ public class Project_Management {
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 com.yipin.liuwanr.entity.*;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
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
@ -64,21 +62,30 @@ public interface ExperimentallearningMapper {
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
*/
@Select("select staffName from staff where staffId =(select staffId from course where courseId=#{courseid})")
String queryTeacherName(Integer courseid);
@Select("select name,userAvatars from experimental_class_ning ecs left join user u on ecs.userId=u.userId where ecs.experimentalClassId=#{experimentalClassId}")
UserM queryTeacherName(Integer experimentalClassId);
/**
* 多名学生信息展示
* @param courseId
* @return
*/
@Select("select studentName from student where FIND_IN_SET(#{courseId},courseId) > 0 ")
List<Student> queryStudentName(Integer courseId);
@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 " +
" 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}")
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 com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
@ -18,29 +20,42 @@ public interface TeacherProjectAndCourseMapper {
/**
* 查询实验项目信息
*/
@Select({"<script>",
"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)",
"<if test='isExperiment!=null'> and isExperiment=0</if>",
"<if test='isAttendance!=null'> and isAttendance=0</if>",
"</script>"})
List<Project_Management> getBySystemId(@Param("courseId") Integer courseId,@Param("isExperiment")Integer isExperiment,@Param("isAttendance")Integer isAttendance);
// @Select({"<script>",
// "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)",
// "<if test='isExperiment!=null'> and isExperiment=0</if>",
// "<if test='isAttendance!=null'> and isAttendance=0</if>",
// "</script>"})
@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}")
void updateIsExperiment(Project_Management management);
@Update("update teacher_project set isOpenProject=#{project.isOpenProject} where courseId=#{courseId} and experimentalClassId=#{experimentalClassId} and projectId=#{project.projectId}")
void updateIsExperiment(CourseAndProjectVo vo);
/**
* 修改是否开启考勤
* @param management
*/
@Update("update hr_project_management set isAttendance=#{isAttendance} where projectId=#{projectId}")
void updateIsAttendance(Project_Management management);
@Update("update teacher_project set isAttendance=#{project.isAttendance} where courseId=#{courseId} and experimentalClassId=#{experimentalClassId} and projectId=#{project.projectId}")
void updateIsAttendance(CourseAndProjectVo vo);
@Select("select count(*) from hr_course_schedule where courseId=#{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);
}

@ -80,6 +80,13 @@ public class ExperimentalClassService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.addExperimentalClass(experimentalClass);
//给实验班级绑定项目
Integer experimentalClassId = experimentalClass.getExperimentalClassId();
Integer courseId = experimentalClass.getCourseId();
List<Integer> projectIds = projectAndCourseMapper.queryProject(courseId);
projectAndCourseMapper.addBatchTeachProject(experimentalClassId,courseId,projectIds);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -94,7 +101,7 @@ public class ExperimentalClassService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retvalue", experimentalClassMapper.queryExperimentalClass(schoolId));
// List<ExperimentalClass> a = experimentalClassMapper.queryExperimentalClass(schoolId);
List<ExperimentalClass> a = experimentalClassMapper.queryExperimentalClass(schoolId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -137,6 +144,7 @@ public class ExperimentalClassService {
/**
* 班级详情
*
* @param student
* @param courseId
* @return
@ -144,10 +152,11 @@ public class ExperimentalClassService {
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,0,0);
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);
@ -189,7 +198,6 @@ public class ExperimentalClassService {
}
//专业下拉框
public HashMap<String, Object> getProfessionals(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -224,7 +232,6 @@ public class ExperimentalClassService {
}
public HashMap<String, Object> deleteExperimentalClass(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
@ -267,6 +274,7 @@ public class ExperimentalClassService {
}
return resp;
}
//——————————————————————————————全承珠
public HashMap<String, Object> queryGetByExperimentalClassName(String experimentalClassName) {
HashMap<String, Object> resp = new HashMap<String, Object>();

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.entity.UserM;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -43,11 +44,11 @@ public class ExperimentallearningService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
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++) {
Project_Management project = projects.get(i);
if (project.getIsExperiment() == 0) {
// 教师那边开启了考勤,学生这边才可以有是否已经签到
if (project.getIsAttendance() == 0) {
// 判断该学生签到的项目,是否在开启的项目中
@ -58,10 +59,6 @@ public class ExperimentallearningService {
}
projects.set(i, project);
}
} else {
project.setIsAttendance(null);
projects.set(i, project);
}
}
resp.put("retvalue", projects);
}
@ -69,7 +66,7 @@ public class ExperimentallearningService {
}catch(Exception e){
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "实验项目查询失败");
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>();
try {
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);
} 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>();
try {
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);
} catch (Exception e) {
@ -177,4 +182,18 @@ public class ExperimentallearningService {
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.List;
import com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,10 +31,10 @@ public class ProjectAndCourseService {
* @param courseId
* @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>();
try {
List<Project_Management> project=mapper.getBySystemId(courseId,null, null);
List<Project_Management> project=mapper.getBySystemId(courseId,experimentalClassId);
resp.put("retcode", 200);
resp.put("retvalue", project);
} 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>();
try {
mapper.updateIsExperiment(management);
mapper.updateIsExperiment(vo);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Update Failed");
resp.put("retvalue", "修改项目实验失败");
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>();
try {
mapper.updateIsAttendance(management);
mapper.updateIsAttendance(vo);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -79,15 +80,15 @@ public class ProjectAndCourseService {
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, Integer> obj = new HashMap<String, Integer>();
try {
if(StringUtils.isEmpty(courseId)){
if(!StringUtils.isEmpty(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());
if(number!=null){
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