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

master
pd 5 years ago
parent 074f769cbb
commit a29537ee05
  1. 26
      src/main/java/com/yipin/liuwanr/controller/AssesmentRecordController.java
  2. 22
      src/main/java/com/yipin/liuwanr/controller/AttendanceController.java
  3. 114
      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/AttendanceMapper.java
  7. 2
      src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java
  8. 2
      src/main/java/com/yipin/liuwanr/mapper/RecordMapper.java
  9. 36
      src/main/java/com/yipin/liuwanr/service/AssesmentRecordService.java
  10. 84
      src/main/java/com/yipin/liuwanr/service/AttendanceService.java
  11. 79
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  12. 76
      src/main/java/com/yipin/liuwanr/service/PracticeService.java

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

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

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

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

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

@ -16,7 +16,7 @@ public interface AttendanceMapper {
* @return * @return
*/ */
@Select("SELECT pm.projectName as experimentName,att.signIn as signIn,att.creationTime as creationTime FROM hr_project_management pm,attendance att" @Select("SELECT pm.projectName as experimentName,att.signIn as signIn,att.creationTime as creationTime FROM hr_project_management pm,attendance att"
+ " WHERE pm.projectId=att.experimentId AND att.studentId=#{studentId} AND FIND_IN_SET(pm.systemId,(SELECT systemId FROM course WHERE courseId=#{courseId})) > 0") + " WHERE pm.projectId=att.experimentId AND att.studentId=#{studentId} AND FIND_IN_SET(pm.systemId,(SELECT systemId FROM course WHERE courseId=#{courseId})) > 0")
List<Attendance> getByCourseId(@Param("studentId") Integer studentId,@Param("courseId") Integer courseId); List<Attendance> getByCourseId(@Param("studentId") Integer studentId,@Param("courseId") Integer courseId);

@ -86,7 +86,7 @@ public interface ExperimentallearningMapper {
* @param courseId * @param courseId
* @return * @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") "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); List<Assesment> queryAssesment(Integer courseId);

@ -55,7 +55,7 @@ public interface RecordMapper {
* @return * @return
*/ */
@Select("SELECT stu.studentName as studentName,SUM(re.timeSum) as totaltime,avg(re.score) as avg,SUM(integral) as integral" + @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); PracticeRecordVo getByPracticeVO(@Param("studentId")Integer studentId,@Param("courseId")Integer courseId);

@ -27,31 +27,29 @@ public class AssesmentRecordService {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
AssesmentRecordVo vo=null; AssesmentRecordVo vo=null;
try { try {
//学生信息 if(studentId!=null&&courseId!=null){
vo=mapper.getByStudentId(studentId,courseId); vo=mapper.getByStudentId(studentId,courseId);//学生信息
//学校最高平均分 Integer schoolHeight=mapper.getBySchool(courseId,studentId);//学校最高平均分
Integer schoolHeight=mapper.getBySchool(courseId,studentId); if(schoolHeight!=null) {
if(schoolHeight!=null) { vo.setSchoolheightscore(schoolHeight);
vo.setSchoolheightscore(schoolHeight); }else {
}else { vo.setSchoolheightscore(0);
vo.setSchoolheightscore(0); }
AssesmentRecordVo vo1=mapper.getByCountry(courseId);//全国信息
if(vo1!=null) {
vo.setCountryavgscore(vo1.getCountryavgscore());
vo.setCountryheightscore(vo1.getCountryheightscore());
}else {
vo.setCountryavgscore(0.0);
vo.setCountryheightscore(0.0);
}
} }
//全国信息
AssesmentRecordVo vo1=mapper.getByCountry(courseId);
if(vo1!=null) {
vo.setCountryavgscore(vo1.getCountryavgscore());
vo.setCountryheightscore(vo1.getCountryheightscore());
}else {
vo.setCountryavgscore(0.0);
vo.setCountryheightscore(0.0);
}
resp.put("retvalue", vo); resp.put("retvalue", 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", "Inquiry Failed"); resp.put("retvalue", "考核记录信息查询失败");
return resp; return resp;
} }
return resp; return resp;

@ -43,18 +43,20 @@ public class AttendanceService {
public HashMap<String, Object> queryAttendanceDetailed(Integer studentId,Integer courseId,Integer pageNo,Integer pageSize){ public HashMap<String, Object> queryAttendanceDetailed(Integer studentId,Integer courseId,Integer pageNo,Integer pageSize){
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
PageHelper.startPage(pageNo, pageSize); if(courseId!=null&&studentId!=null){
List<Attendance> list = mapper.getByCourseId(studentId,courseId); PageHelper.startPage(pageNo, pageSize);
PageInfo<Attendance> info=new PageInfo<Attendance>(list); List<Attendance> list = mapper.getByCourseId(studentId,courseId);
int total1 = (int) info.getTotal(); PageInfo<Attendance> info=new PageInfo<Attendance>(list);
int totalPages; int total1 = (int) info.getTotal();
totalPages = total1 / pageSize; int totalPages;
if (total1 % pageSize != 0){ totalPages = total1 / pageSize;
totalPages ++; if (total1 % pageSize != 0){
} totalPages ++;
long total = total1; }
resp.put("retvalue", new PageResult(total, list,totalPages)); long total = total1;
resp.put("retcode", 200); resp.put("retvalue", new PageResult(total, list,totalPages));
}
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);
@ -73,15 +75,17 @@ public class AttendanceService {
*/ */
public HashMap<String, Object> exportPractice(HttpServletResponse response,Integer studentId,Integer courseId,String[] titles) { public HashMap<String, Object> exportPractice(HttpServletResponse response,Integer studentId,Integer courseId,String[] titles) {
try { try {
String fileName="考勤记录.xls"; if(studentId!=null&&courseId!=null&&titles.length>0){
String sheetName="考勤记录"; String fileName="考勤记录.xls";
List<Attendance> list = mapper.getByCourseId(studentId,courseId); String sheetName="考勤记录";
HSSFWorkbook bos=ExcelExportHelper.exportAttendance(list, sheetName, titles); List<Attendance> list = mapper.getByCourseId(studentId,courseId);
response.setHeader("content-Type","application/vnd.ms-excel"); HSSFWorkbook bos=ExcelExportHelper.exportAttendance(list, sheetName, titles);
response.setHeader("Content-disposition","attachment;filename="+URLEncoder.encode(fileName,"UTF-8")); response.setHeader("content-Type","application/vnd.ms-excel");
response.flushBuffer(); response.setHeader("Content-disposition","attachment;filename="+URLEncoder.encode(fileName,"UTF-8"));
bos.write(response.getOutputStream()); response.flushBuffer();
bos.close(); bos.write(response.getOutputStream());
bos.close();
}
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
return null; return null;
@ -100,25 +104,27 @@ public class AttendanceService {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
Attendance attendance=new Attendance(); Attendance attendance=new Attendance();
try { try {
attendance.setStudentName(mapper.getByStudentName(studentId)); if(studentId!=null&&courseId!=null){
List<Integer> projectIds=mapper.queryProjectIds(courseId); attendance.setStudentName(mapper.getByStudentName(studentId));
attendance.setCount(projectIds.size()); List<Integer> projectIds=mapper.queryProjectIds(courseId);
List<Attendance> att=mapper.querySigIn(studentId,projectIds); attendance.setCount(projectIds.size());
int absence=0;//缺勤次数 List<Attendance> att=mapper.querySigIn(studentId,projectIds);
int signInNumber=0;//签到次数 int absence=0;//缺勤次数
for (Attendance attendance2 : att) { int signInNumber=0;//签到次数
if(attendance2.getSignIn()==0) { for (Attendance attendance2 : att) {
signInNumber++; if(attendance2.getSignIn()==0) {
}else if(attendance2.getSignIn()==1) { signInNumber++;
absence++; }else if(attendance2.getSignIn()==1) {
absence++;
}
} }
} //设置缺勤次数
//设置缺勤次数 attendance.setAbsence(absence);
attendance.setAbsence(absence); //设置考勤次数
//设置考勤次数 attendance.setSignInNumber(signInNumber);
attendance.setSignInNumber(signInNumber); resp.put("retvalue", attendance);
resp.put("retcode", 200); }
resp.put("retvalue", attendance); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);

@ -41,27 +41,29 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryProject(Integer studentId, Integer courseId) { public HashMap<String, Object> queryProject(Integer studentId, Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId); if(studentId!=null&&courseId!=null){
List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null); List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
for (int i = 0; i < projects.size(); i++) { List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null);
Project_Management project = projects.get(i); for (int i = 0; i < projects.size(); i++) {
if (project.getIsExperiment() == 0) { Project_Management project = projects.get(i);
// 教师那边开启了考勤,学生这边才可以有是否已经签到 if (project.getIsExperiment() == 0) {
if (project.getIsAttendance() == 0) { // 教师那边开启了考勤,学生这边才可以有是否已经签到
// 判断该学生签到的项目,是否在开启的项目中 if (project.getIsAttendance() == 0) {
if (projectIds.contains(project.getProjectId())) { // 判断该学生签到的项目,是否在开启的项目中
project.setSignin(0); if (projectIds.contains(project.getProjectId())) {
} else { project.setSignin(0);
project.setSignin(1); } else {
project.setSignin(1);
}
projects.set(i, project);
} }
} else {
project.setIsAttendance(null);
projects.set(i, project); projects.set(i, project);
} }
} else {
project.setIsAttendance(null);
projects.set(i, project);
} }
resp.put("retvalue", projects);
} }
resp.put("retvalue", projects);
resp.put("retcode", 200); resp.put("retcode", 200);
}catch(Exception e){ }catch(Exception e){
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -85,12 +87,11 @@ public class ExperimentallearningService {
} else { } else {
mapper.insertAttendance(attendance); mapper.insertAttendance(attendance);
} }
resp.put("retcode", 200); resp.put("retcode", 200);
} 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", "Add Failed"); resp.put("retvalue", "考勤签到失败");
return resp; return resp;
} }
return resp; return resp;
@ -102,7 +103,9 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryStudentName(Integer courseId) { public HashMap<String, Object> queryStudentName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", mapper.queryStudentName(courseId)); if(courseId!=null){
resp.put("retvalue", mapper.queryStudentName(courseId));
}
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -119,7 +122,9 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryTeacherName(Integer courseId) { public HashMap<String, Object> queryTeacherName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", mapper.queryTeacherName(courseId)); if(courseId!=null){
resp.put("retvalue", mapper.queryTeacherName(courseId));
}
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -139,25 +144,23 @@ public class ExperimentallearningService {
try { try {
List<Assesment> assesments = mapper.queryAssesment(courseId); List<Assesment> assesments = mapper.queryAssesment(courseId);
// 查询出来该课程有多个考核开启,则不符合逻辑(一门课程一次只能开启一个考核,不能有多个) // 查询出来该课程有多个考核开启,则不符合逻辑(一门课程一次只能开启一个考核,不能有多个)
if (assesments.size() > 1) { if(!assesments.isEmpty()&&assesments.size()>0){
resp.put("retcode", 300); if (assesments.size() > 1) {
resp.put("retvalue", "同一课程只能开启一个考核"); resp.put("retcode", 300);
return resp; resp.put("retvalue", "同一课程只能开启一个考核");
} else { return resp;
if (assesments.size() != 0) { } else {
Assesment assesment = assesments.get(0);
Assesment assesment = assesments.get(0); Integer assesmentId = assesment.getId();
Integer assesmentId = assesment.getId(); // 查询该考核的学生
// 查询该考核的学生 List<Integer> studentIds = mapper.queryStudentId(assesmentId);
List<Integer> studentIds = mapper.queryStudentId(assesmentId); if (studentIds.contains(studentId)) {
if (studentIds.contains(studentId)) { val.put("courseId", courseId);
val.put("courseId", courseId); val.put("studentId", studentId);
val.put("studentId", studentId); val.put("projectId", assesment.getExperimentId());
val.put("projectId", assesment.getExperimentId()); val.put("assesmentId", assesmentId);
val.put("assesmentId", assesmentId); }
}
} }
} }
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", val); 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) { public HashMap<String, Object> queryStudentByPage(Integer studentId,Integer projectPermissions,Integer courseId,Integer pageNum,Integer pageSize) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if(pageNum!=null&&pageSize!=null) { if(studentId!=null&&courseId!=null&&projectPermissions!=null) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
List<Record> records=mapper.getByStudentId(projectPermissions,courseId,studentId); List<Record> records=mapper.getByStudentId(projectPermissions,courseId,studentId);
PageInfo<Record> info=new PageInfo<Record>(records); PageInfo<Record> info=new PageInfo<Record>(records);
@ -117,42 +117,44 @@ public class PracticeService {
public HashMap<String, Object> queryPracticeVo(Integer studentId,Integer courseId) { public HashMap<String, Object> queryPracticeVo(Integer studentId,Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
// 学生个人的练习信息 if(studentId!=null&&courseId!=null){
PracticeRecordVo practiceVo = mapper.getByPracticeVO(studentId,courseId); // 学生个人的练习信息
// 练习项目数量 PracticeRecordVo practiceVo = mapper.getByPracticeVO(studentId,courseId);
Integer practiceNumber=mapper.queryPracticeNumber(courseId); // 练习项目数量
if(practiceNumber!=null) { Integer practiceNumber=mapper.queryPracticeNumber(courseId);
practiceVo.setPracticeNumber(practiceNumber); if(practiceNumber!=null) {
practiceVo.setPracticeNumber(practiceNumber);
// 求完成项目数量
Integer accomplishNumber=mapper.queryAccomplishNumber(studentId,courseId); // 求完成项目数量
if(accomplishNumber!=null) { Integer accomplishNumber=mapper.queryAccomplishNumber(studentId,courseId);
practiceVo.setAccomplishNumber(accomplishNumber); if(accomplishNumber!=null) {
practiceVo.setAccomplishNumber(accomplishNumber);
}
}else {
practiceVo.setPracticeNumber(0);
practiceVo.setAccomplishNumber(0);
} }
}else { // 练习总次数
practiceVo.setPracticeNumber(0); Integer sumNumber=mapper.querySumNumber(studentId,courseId);
practiceVo.setAccomplishNumber(0); if(sumNumber!=null) {
} practiceVo.setSumNumber(sumNumber);
// 练习总次数 }else {
Integer sumNumber=mapper.querySumNumber(studentId,courseId); practiceVo.setSumNumber(0);
if(sumNumber!=null) { }
practiceVo.setSumNumber(sumNumber); PracticeRecordVo vo=mapper.queryCountry(courseId);
}else { if(vo!=null) {
practiceVo.setSumNumber(0); //全国实训积分平均分
} practiceVo.setAvgintegral(vo.getAvgintegral());
PracticeRecordVo vo=mapper.queryCountry(courseId); //全国最高实训积分
if(vo!=null) { practiceVo.setHeightintegral(vo.getHeightintegral());
//全国实训积分平均分 }else {
practiceVo.setAvgintegral(vo.getAvgintegral()); //全国实训积分平均分
//全国最高实训积分 practiceVo.setAvgintegral(0);
practiceVo.setHeightintegral(vo.getHeightintegral()); //全国最高实训积分
}else { practiceVo.setHeightintegral(0);
//全国实训积分平均分 }
practiceVo.setAvgintegral(0); resp.put("retvalue", practiceVo);
//全国最高实训积分
practiceVo.setHeightintegral(0);
} }
resp.put("retvalue", practiceVo);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -167,8 +169,10 @@ public class PracticeService {
public HashMap<String, Object> queryAllExperiment(Integer coureseId) { public HashMap<String, Object> queryAllExperiment(Integer coureseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
if(coureseId!=null){
resp.put("retvalue", assesment.queryGetByAssesmentProject(coureseId));
}
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", assesment.queryGetByAssesmentProject(coureseId));
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);

Loading…
Cancel
Save