修改学生端关于课程的接口

master
pd 5 years ago
parent 074f769cbb
commit a29537ee05
  1. 10
      src/main/java/com/yipin/liuwanr/controller/AssesmentRecordController.java
  2. 22
      src/main/java/com/yipin/liuwanr/controller/AttendanceController.java
  3. 36
      src/main/java/com/yipin/liuwanr/controller/ExperimentallearningController.java
  4. 17
      src/main/java/com/yipin/liuwanr/controller/PracticeController.java
  5. 2
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  6. 2
      src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java
  7. 2
      src/main/java/com/yipin/liuwanr/mapper/RecordMapper.java
  8. 14
      src/main/java/com/yipin/liuwanr/service/AssesmentRecordService.java
  9. 8
      src/main/java/com/yipin/liuwanr/service/AttendanceService.java
  10. 13
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  11. 8
      src/main/java/com/yipin/liuwanr/service/PracticeService.java

@ -3,8 +3,10 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yipin.liuwanr.entity.Response;
@ -26,13 +28,12 @@ public class AssesmentRecordController {
* 考核管理查询成绩明细
*/
@GetMapping("/queryStudentAssessment")
Response queryStudentAssessment(Integer studentId,Integer courseId) {
Response queryStudentAssessment(@RequestParam Integer studentId,@RequestParam Integer courseId) {
Response resp = new Response();
if (studentId==null) {
resp.setStatus(300);
resp.setErrmessage("studentId Empty");
return resp;
}
resp.setErrmessage("学生信息为空");
}else{
HashMap<String, Object> ret = assesmentRecordService.queryStudentAssessment(studentId,courseId);
int status = (int) ret.get("retcode");
if (200 == status) {
@ -42,6 +43,7 @@ public class AssesmentRecordController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}

@ -5,8 +5,10 @@ import java.util.HashMap;
import javax.servlet.http.HttpServletResponse;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yipin.liuwanr.entity.Response;
@ -33,16 +35,11 @@ public class AttendanceController {
* @return
*/
@GetMapping("/queryAttendanceDetailed")
Response queryAttendanceDetailed(Integer studentId,Integer courseId,Integer pageNo,Integer pageSize) {
Response queryAttendanceDetailed(@RequestParam Integer studentId, @RequestParam Integer courseId,@RequestParam Integer pageNo,@RequestParam Integer pageSize) {
Response resp = new Response();
if (null==studentId) {
resp.setStatus(300);
resp.setErrmessage("studentId is empty");
return resp;
}else if(null==courseId) {
resp.setStatus(300);
resp.setErrmessage("courseId is empty");
return resp;
resp.setErrmessage("学生信息为空");
}else {
HashMap<String, Object> ret = attendanceService.queryAttendanceDetailed(studentId,courseId,pageNo, pageSize);
int status = (int) ret.get("retcode");
@ -67,7 +64,7 @@ public class AttendanceController {
* @return
*/
@GetMapping("/exportPractice")
Response exportPractice(HttpServletResponse response,Integer studentId,Integer courseId,String[] titles) {
Response exportPractice(HttpServletResponse response,@RequestParam Integer studentId,@RequestParam Integer courseId,@RequestParam String[] titles) {
try {
attendanceService.exportPractice(response,studentId,courseId,titles);
} catch (Exception e) {
@ -84,16 +81,11 @@ public class AttendanceController {
* @return
*/
@GetMapping("/queryAttendanceSignIn")
Response queryAttendanceSignIn(Integer studentId,Integer courseId) {
Response queryAttendanceSignIn(@RequestParam Integer studentId,@RequestParam Integer courseId) {
Response resp = new Response();
if (null==studentId) {
resp.setStatus(300);
resp.setErrmessage("studentId is empty");
return resp;
}else if(null==courseId) {
resp.setStatus(300);
resp.setErrmessage("courseId is empty");
return resp;
resp.setErrmessage("学生信息为空");
}else {
HashMap<String, Object> ret = attendanceService.queryAttendance(studentId,courseId);
int status = (int) ret.get("retcode");

@ -3,11 +3,8 @@ package com.yipin.liuwanr.controller;
import java.util.HashMap;
import org.springframework.beans.factory.annotation.Autowired;
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.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import com.yipin.liuwanr.entity.Attendance;
import com.yipin.liuwanr.entity.Response;
@ -26,8 +23,12 @@ public class ExperimentallearningController {
* @return
*/
@GetMapping("/queryExperimentallearning")
Response queryExperimentallearning(Integer studentId,Integer courseId) {
Response queryExperimentallearning(@RequestParam Integer studentId,@RequestParam Integer courseId) {
Response resp = new Response();
if(StringUtils.isEmpty(studentId)){
resp.setStatus(300);
resp.setMessage("学生信息为空");
}else {
HashMap<String, Object> ret = service.queryProject(studentId,courseId);
int status = (int) ret.get("retcode");
if (status == 200) {
@ -37,6 +38,7 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
@ -51,8 +53,7 @@ public class ExperimentallearningController {
if(null==attendance) {
resp.setStatus(300);
resp.setMessage("attendance is null");
return resp;
}
}else {
HashMap<String, Object> ret = service.insertAttendance(attendance);
int status = (int) ret.get("retcode");
if (status == 200) {
@ -62,6 +63,7 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
@ -70,7 +72,7 @@ public class ExperimentallearningController {
* 获取教师信息
*/
@GetMapping("/queryTeacherName")
Response queryTeacherName(Integer courseId) {
Response queryTeacherName(@RequestParam Integer courseId) {
Response resp = new Response();
HashMap<String, Object> ret = service.queryTeacherName(courseId);
int status = (int) ret.get("retcode");
@ -90,8 +92,12 @@ public class ExperimentallearningController {
* 获取学生信息
*/
@GetMapping("/queryStudentName")
Response queryStudentName(Integer courseId) {
Response queryStudentName(@RequestParam Integer courseId) {
Response resp = new Response();
if(StringUtils.isEmpty(courseId)){
resp.setStatus(300);
resp.setMessage("课程信息为空");
}else {
HashMap<String, Object> ret = service.queryStudentName(courseId);
int status = (int) ret.get("retcode");
if (status == 200) {
@ -101,6 +107,7 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
@ -108,9 +115,13 @@ public class ExperimentallearningController {
* 进入考核
*/
@GetMapping("/queryAssesment")
Response queryAssesment(Integer courseId,Integer studentId) {
Response queryAssesment(@RequestParam Integer studentId,@RequestParam Integer courseId) {
Response resp = new Response();
HashMap<String, Object> ret = service.queryAssesment(courseId,studentId);
if(StringUtils.isEmpty(studentId)){
resp.setStatus(300);
resp.setMessage("学生信息为空");
}else {
HashMap<String, Object> ret = service.queryAssesment(courseId, studentId);
int status = (int) ret.get("retcode");
if (status == 200) {
resp.setStatus(status);
@ -119,6 +130,7 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}

@ -5,8 +5,10 @@ import java.util.HashMap;
import javax.servlet.http.HttpServletResponse;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yipin.liuwanr.entity.Response;
@ -33,14 +35,12 @@ public class PracticeController {
* @return
*/
@GetMapping("/queryStudentByPage")
Response queryStudentByPage(Integer studentId,Integer projectPermissions,Integer courseId,Integer pageNum,Integer pageSize) {
Response queryStudentByPage(@RequestParam Integer studentId,@RequestParam Integer projectPermissions,
@RequestParam Integer courseId,@RequestParam Integer pageNum,@RequestParam Integer pageSize) {
Response resp = new Response();
if( null==studentId) {
resp.setStatus(500);
resp.setErrmessage("student is null");
}else if(null==projectPermissions) {
resp.setStatus(500);
resp.setErrmessage("projectPermissions is null");
if(StringUtils.isEmpty(studentId)) {
resp.setStatus(300);
resp.setErrmessage("学生信息为空");
}else {
HashMap<String, Object> ret = service.queryStudentByPage(studentId,projectPermissions,courseId,pageNum,pageSize);
int status = (int) ret.get("retcode");
@ -64,7 +64,7 @@ public class PracticeController {
* @return
*/
@GetMapping("/exportPractice")
Response exportPractice(HttpServletResponse response, Integer studentId,Integer projectPermissions,Integer courseId,String[] titles) {
Response exportPractice(HttpServletResponse response,@RequestParam Integer studentId,@RequestParam Integer projectPermissions,@RequestParam Integer courseId,@RequestParam String[] titles) {
try {
service.exportPractice(response,studentId,projectPermissions,courseId,titles);
} catch (Exception e) {
@ -76,7 +76,6 @@ public class PracticeController {
/**
* 练习信息
* @param vo
* @return
*/
@GetMapping("/queryPracticeVo")

@ -57,7 +57,7 @@ public interface AssesmentMapper {
" <if test='releaseType!=null'>and a.releaseType=#{releaseType} </if>",
" <if test='assesmentState!=null'>and a.assesmentState=#{assesmentState} </if>",
" <if test='className!=null and className!=\"\"'>and c.className like concat('%',#{className},'%') </if>",
" GROUP BY a.id ORDER BY a.creationTime",
" GROUP BY a.id ORDER BY a.creationTime ORDER BY a.id desc ",
"</script> "})
List<Assesment> getByCondition(Assesment assesment);

@ -86,7 +86,7 @@ public interface ExperimentallearningMapper {
* @param courseId
* @return
*/
@Select("select id,experimentId,experimentalClassId,classId from assessment a left join hr_project_management pm on a.experimentId=pm.projectId left join hr_course_tc tc on pm.systemId=tc.systemId\n" +
@Select("select id,experimentId,experimentalClassId,classId from assessment a left join hr_project_management pm on a.experimentId=pm.projectId left join hr_course_tc tc on pm.systemId=tc.systemId" +
"where a.assesmentState=1 AND pm.state=1 and pm.isdel=0 AND pm.projectPermissions=1 and a.courseId=tc.courseId and tc.courseId=#{courseId} GROUP BY tc.systemId")
List<Assesment> queryAssesment(Integer courseId);

@ -55,7 +55,7 @@ public interface RecordMapper {
* @return
*/
@Select("SELECT stu.studentName as studentName,SUM(re.timeSum) as totaltime,avg(re.score) as avg,SUM(integral) as integral" +
" FROM record re,student stu,hr_project_management pm WHERE re.studentId=stu.studentId and re.projectId=pm.projectId and pm.projectPermissions=0 and re.studentId=1 and re.courseId=2")
" FROM record re,student stu,hr_project_management pm WHERE re.studentId=stu.studentId and re.projectId=pm.projectId and pm.projectPermissions=0 and re.studentId=#{studentId} and re.courseId=#{courseId}")
PracticeRecordVo getByPracticeVO(@Param("studentId")Integer studentId,@Param("courseId")Integer courseId);

@ -27,17 +27,15 @@ public class AssesmentRecordService {
HashMap<String, Object> resp = new HashMap<String, Object>();
AssesmentRecordVo vo=null;
try {
//学生信息
vo=mapper.getByStudentId(studentId,courseId);
//学校最高平均分
Integer schoolHeight=mapper.getBySchool(courseId,studentId);
if(studentId!=null&&courseId!=null){
vo=mapper.getByStudentId(studentId,courseId);//学生信息
Integer schoolHeight=mapper.getBySchool(courseId,studentId);//学校最高平均分
if(schoolHeight!=null) {
vo.setSchoolheightscore(schoolHeight);
}else {
vo.setSchoolheightscore(0);
}
//全国信息
AssesmentRecordVo vo1=mapper.getByCountry(courseId);
AssesmentRecordVo vo1=mapper.getByCountry(courseId);//全国信息
if(vo1!=null) {
vo.setCountryavgscore(vo1.getCountryavgscore());
vo.setCountryheightscore(vo1.getCountryheightscore());
@ -45,13 +43,13 @@ public class AssesmentRecordService {
vo.setCountryavgscore(0.0);
vo.setCountryheightscore(0.0);
}
}
resp.put("retvalue", vo);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "考核记录信息查询失败");
return resp;
}
return resp;

@ -43,6 +43,7 @@ public class AttendanceService {
public HashMap<String, Object> queryAttendanceDetailed(Integer studentId,Integer courseId,Integer pageNo,Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(courseId!=null&&studentId!=null){
PageHelper.startPage(pageNo, pageSize);
List<Attendance> list = mapper.getByCourseId(studentId,courseId);
PageInfo<Attendance> info=new PageInfo<Attendance>(list);
@ -54,6 +55,7 @@ public class AttendanceService {
}
long total = total1;
resp.put("retvalue", new PageResult(total, list,totalPages));
}
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -73,6 +75,7 @@ public class AttendanceService {
*/
public HashMap<String, Object> exportPractice(HttpServletResponse response,Integer studentId,Integer courseId,String[] titles) {
try {
if(studentId!=null&&courseId!=null&&titles.length>0){
String fileName="考勤记录.xls";
String sheetName="考勤记录";
List<Attendance> list = mapper.getByCourseId(studentId,courseId);
@ -82,6 +85,7 @@ public class AttendanceService {
response.flushBuffer();
bos.write(response.getOutputStream());
bos.close();
}
} catch (Exception e) {
logger.error(e.getMessage());
return null;
@ -100,6 +104,7 @@ public class AttendanceService {
HashMap<String, Object> resp = new HashMap<String, Object>();
Attendance attendance=new Attendance();
try {
if(studentId!=null&&courseId!=null){
attendance.setStudentName(mapper.getByStudentName(studentId));
List<Integer> projectIds=mapper.queryProjectIds(courseId);
attendance.setCount(projectIds.size());
@ -117,8 +122,9 @@ public class AttendanceService {
attendance.setAbsence(absence);
//设置考勤次数
attendance.setSignInNumber(signInNumber);
resp.put("retcode", 200);
resp.put("retvalue", attendance);
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);

@ -41,6 +41,7 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryProject(Integer studentId, Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(studentId!=null&&courseId!=null){
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null);
for (int i = 0; i < projects.size(); i++) {
@ -62,6 +63,7 @@ public class ExperimentallearningService {
}
}
resp.put("retvalue", projects);
}
resp.put("retcode", 200);
}catch(Exception e){
logger.error(e.getMessage());
@ -85,12 +87,11 @@ public class ExperimentallearningService {
} else {
mapper.insertAttendance(attendance);
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Add Failed");
resp.put("retvalue", "考勤签到失败");
return resp;
}
return resp;
@ -102,7 +103,9 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryStudentName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(courseId!=null){
resp.put("retvalue", mapper.queryStudentName(courseId));
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
@ -119,7 +122,9 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryTeacherName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(courseId!=null){
resp.put("retvalue", mapper.queryTeacherName(courseId));
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
@ -139,13 +144,12 @@ public class ExperimentallearningService {
try {
List<Assesment> assesments = mapper.queryAssesment(courseId);
// 查询出来该课程有多个考核开启,则不符合逻辑(一门课程一次只能开启一个考核,不能有多个)
if(!assesments.isEmpty()&&assesments.size()>0){
if (assesments.size() > 1) {
resp.put("retcode", 300);
resp.put("retvalue", "同一课程只能开启一个考核");
return resp;
} else {
if (assesments.size() != 0) {
Assesment assesment = assesments.get(0);
Integer assesmentId = assesment.getId();
// 查询该考核的学生
@ -157,7 +161,6 @@ public class ExperimentallearningService {
val.put("assesmentId", assesmentId);
}
}
}
resp.put("retcode", 200);
resp.put("retvalue", val);

@ -49,7 +49,7 @@ public class PracticeService {
public HashMap<String, Object> queryStudentByPage(Integer studentId,Integer projectPermissions,Integer courseId,Integer pageNum,Integer pageSize) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(pageNum!=null&&pageSize!=null) {
if(studentId!=null&&courseId!=null&&projectPermissions!=null) {
PageHelper.startPage(pageNum, pageSize);
List<Record> records=mapper.getByStudentId(projectPermissions,courseId,studentId);
PageInfo<Record> info=new PageInfo<Record>(records);
@ -117,6 +117,7 @@ public class PracticeService {
public HashMap<String, Object> queryPracticeVo(Integer studentId,Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(studentId!=null&&courseId!=null){
// 学生个人的练习信息
PracticeRecordVo practiceVo = mapper.getByPracticeVO(studentId,courseId);
// 练习项目数量
@ -153,6 +154,7 @@ public class PracticeService {
practiceVo.setHeightintegral(0);
}
resp.put("retvalue", practiceVo);
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
@ -167,8 +169,10 @@ public class PracticeService {
public HashMap<String, Object> queryAllExperiment(Integer coureseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
resp.put("retcode", 200);
if(coureseId!=null){
resp.put("retvalue", assesment.queryGetByAssesmentProject(coureseId));
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);

Loading…
Cancel
Save