学生端、教师端课程进度

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 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.*;
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 com.yipin.liuwanr.entity.Project_Management; import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.entity.Response; import com.yipin.liuwanr.entity.Response;
@ -29,7 +25,7 @@ public class ProjectAndCourseController {
* @return * @return
*/ */
@GetMapping("/queryProject") @GetMapping("/queryProject")
Response queryProject(Integer courseId,Integer experimentalClassId) { Response queryProject(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId) {
Response resp = new Response(); Response resp = new Response();
if(StringUtils.isEmpty(experimentalClassId)){ if(StringUtils.isEmpty(experimentalClassId)){
resp.setStatus(300); resp.setStatus(300);
@ -100,22 +96,19 @@ public class ProjectAndCourseController {
//课程进度 //课程进度
@GetMapping("/getCourseSchedule") @GetMapping("/getCourseSchedule")
Response getCourseSchedule(Integer courseId,Integer experimentalClassId) { Response getCourseSchedule(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId,@RequestParam Integer studentId) {
Response resp = new Response(); Response resp = new Response();
if(StringUtils.isEmpty(experimentalClassId)){
resp.setStatus(300); HashMap<String, Object> ret = service.getCourseSchedule(courseId,experimentalClassId,studentId);
resp.setErrmessage("实验班级为空"); int status = (int) ret.get("retcode");
}else{ if (status == 200) {
HashMap<String, Object> ret = service.getCourseSchedule(courseId,experimentalClassId); resp.setStatus(status);
int status = (int) ret.get("retcode"); resp.setMessage(ret.get("retvalue"));
if (status == 200) { } else {
resp.setStatus(status); resp.setStatus(status);
resp.setMessage(ret.get("retvalue")); resp.setErrmessage(ret.get("retvalue").toString());
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
} }
return resp; 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.mapper.ExperimentallearningMapper;
import com.yipin.liuwanr.vo.CourseAndProjectVo; 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;
@ -24,7 +25,8 @@ public class ProjectAndCourseService {
@Autowired @Autowired
private TeacherProjectAndCourseMapper mapper; private TeacherProjectAndCourseMapper mapper;
@Autowired
private ExperimentallearningMapper experimentallearningMapper;
/** /**
* 根据课程查询实验项目信息 * 根据课程查询实验项目信息
@ -80,21 +82,29 @@ public class ProjectAndCourseService {
return resp; 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, 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)){
//完成的课程项目 if(StringUtils.isEmpty(experimentalClassId)){
Integer number=mapper.getCourseSchedule(courseId); if(!StringUtils.isEmpty(studentId)){
//总项目数量 experimentalClassId=experimentallearningMapper.queryExperimentalClassId(courseId,studentId);
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)){
//完成的课程项目
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("retcode", 200);
resp.put("retvalue",obj); resp.put("retvalue",obj);

Loading…
Cancel
Save