学生端、教师端课程进度

master
pd 4 years ago
parent 5ad0c6479e
commit 3492011da8
  1. 33
      src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java
  2. 32
      src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java

@ -5,11 +5,7 @@ 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;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.entity.Response;
@ -29,7 +25,7 @@ public class ProjectAndCourseController {
* @return
*/
@GetMapping("/queryProject")
Response queryProject(Integer courseId,Integer experimentalClassId) {
Response queryProject(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId) {
Response resp = new Response();
if(StringUtils.isEmpty(experimentalClassId)){
resp.setStatus(300);
@ -100,22 +96,19 @@ public class ProjectAndCourseController {
//课程进度
@GetMapping("/getCourseSchedule")
Response getCourseSchedule(Integer courseId,Integer experimentalClassId) {
Response getCourseSchedule(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId,@RequestParam Integer studentId) {
Response resp = new Response();
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);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
HashMap<String, Object> ret = service.getCourseSchedule(courseId,experimentalClassId,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;
}
}

@ -3,6 +3,7 @@ package com.yipin.liuwanr.service;
import java.util.HashMap;
import java.util.List;
import com.yipin.liuwanr.mapper.ExperimentallearningMapper;
import com.yipin.liuwanr.vo.CourseAndProjectVo;
import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -24,7 +25,8 @@ public class ProjectAndCourseService {
@Autowired
private TeacherProjectAndCourseMapper mapper;
@Autowired
private ExperimentallearningMapper experimentallearningMapper;
/**
* 根据课程查询实验项目信息
@ -80,21 +82,29 @@ public class ProjectAndCourseService {
return resp;
}
public HashMap<String, Object> getCourseSchedule(Integer courseId,Integer experimentalClassId) {
public HashMap<String, Object> getCourseSchedule(Integer courseId,Integer experimentalClassId,Integer studentId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Integer> obj = new HashMap<String, Integer>();
try {
if(!StringUtils.isEmpty(courseId)){
//完成的课程项目
Integer number=mapper.getCourseSchedule(courseId);
//总项目数量
List<Project_Management> project=mapper.getBySystemId(courseId,experimentalClassId);
obj.put("total",project.size());
if(number!=null){
obj.put("number",number);
}else{
obj.put("number",0);
if(StringUtils.isEmpty(experimentalClassId)){
if(!StringUtils.isEmpty(studentId)){
experimentalClassId=experimentallearningMapper.queryExperimentalClassId(courseId,studentId);
}
}
if(!StringUtils.isEmpty(experimentalClassId)){
//完成的课程项目
Integer number=mapper.getCourseSchedule(courseId);
//总项目数量
List<Project_Management> project=mapper.getBySystemId(courseId,experimentalClassId);
obj.put("total",project.size());
if(number!=null){
obj.put("number",number);
}else{
obj.put("number",0);
}
}
}
resp.put("retcode", 200);
resp.put("retvalue",obj);

Loading…
Cancel
Save