修改学生端关于课程的service

master
pd 4 years ago
parent a29537ee05
commit 12c4f755ea
  1. 7
      src/main/java/com/yipin/liuwanr/controller/AssesmentController.java
  2. 5
      src/main/java/com/yipin/liuwanr/controller/ExperimentallearningController.java
  3. 7
      src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java
  4. 2
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  5. 2
      src/main/java/com/yipin/liuwanr/service/AssesmentService.java
  6. 7
      src/main/java/com/yipin/liuwanr/service/AttendanceService.java
  7. 16
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  8. 21
      src/main/java/com/yipin/liuwanr/service/PracticeService.java
  9. 3
      src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java

@ -469,10 +469,7 @@ public class AssesmentController {
@GetMapping("/releaseAssesment")
Response releaseAssesment(@RequestParam Integer courseId){
Response resp = new Response();
if(StringUtils.isEmpty(courseId)){
resp.setStatus(300);
resp.setErrmessage("课程信息为空");
}else{
HashMap<String, Object> ret = service.releaseAssesment(courseId);
int status = (int) ret.get("retcode");
if (200 == status) {
@ -482,7 +479,7 @@ public class AssesmentController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}

@ -94,10 +94,6 @@ public class ExperimentallearningController {
@GetMapping("/queryStudentName")
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) {
@ -107,7 +103,6 @@ public class ExperimentallearningController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}

@ -94,14 +94,10 @@ public class ProjectAndCourseController {
return resp;
}
//课程进度
@GetMapping("/getCourseSchedule")
Response getCourseSchedule(Integer courseId) {
Response resp = new Response();
if(StringUtils.isEmpty(courseId)) {
resp.setStatus(300);
resp.setErrmessage("课程id为空");
return resp;
}else {
HashMap<String, Object> ret = service.getCourseSchedule(courseId);
int status = (int) ret.get("retcode");
if (status == 200) {
@ -111,7 +107,6 @@ public class ProjectAndCourseController {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
}

@ -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 ORDER BY a.id desc ",
" GROUP BY a.id ORDER BY a.id desc ",
"</script> "})
List<Assesment> getByCondition(Assesment assesment);

@ -615,7 +615,9 @@ public class AssesmentService {
public HashMap<String, Object> releaseAssesment(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(courseId!=null){
resp.put("retvalue", mapper.releaseAssesment(courseId));
}
resp.put("retcode", 200);
} catch (Exception e) {
logger.error(e.getMessage());

@ -17,6 +17,7 @@ import com.yipin.liuwanr.entity.Attendance;
import com.yipin.liuwanr.entity.PageResult;
import com.yipin.liuwanr.helper.ExcelExportHelper;
import com.yipin.liuwanr.mapper.AttendanceMapper;
import org.springframework.util.StringUtils;
/**
* 考勤记录
@ -43,7 +44,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){
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){
PageHelper.startPage(pageNo, pageSize);
List<Attendance> list = mapper.getByCourseId(studentId,courseId);
PageInfo<Attendance> info=new PageInfo<Attendance>(list);
@ -75,7 +76,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){
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)&&titles.length>0){
String fileName="考勤记录.xls";
String sheetName="考勤记录";
List<Attendance> list = mapper.getByCourseId(studentId,courseId);
@ -104,7 +105,7 @@ public class AttendanceService {
HashMap<String, Object> resp = new HashMap<String, Object>();
Attendance attendance=new Attendance();
try {
if(studentId!=null&&courseId!=null){
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){
attendance.setStudentName(mapper.getByStudentName(studentId));
List<Integer> projectIds=mapper.queryProjectIds(courseId);
attendance.setCount(projectIds.size());

@ -14,6 +14,7 @@ import com.yipin.liuwanr.entity.Attendance;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.mapper.ExperimentallearningMapper;
import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper;
import org.springframework.util.StringUtils;
/**
* 学生端_实验学习
@ -41,7 +42,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){
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null);
for (int i = 0; i < projects.size(); i++) {
@ -103,7 +104,7 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryStudentName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(courseId!=null){
if(!StringUtils.isEmpty(courseId)){
resp.put("retvalue", mapper.queryStudentName(courseId));
}
resp.put("retcode", 200);
@ -122,7 +123,7 @@ public class ExperimentallearningService {
public HashMap<String, Object> queryTeacherName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(courseId!=null){
if(!StringUtils.isEmpty(courseId)){
resp.put("retvalue", mapper.queryTeacherName(courseId));
}
resp.put("retcode", 200);
@ -142,7 +143,10 @@ public class ExperimentallearningService {
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Object> val = new HashMap<String, Object>();
try {
List<Assesment> assesments = mapper.queryAssesment(courseId);
List<Assesment> assesments=null;
if(!StringUtils.isEmpty(courseId)) {
assesments = mapper.queryAssesment(courseId);
}
// 查询出来该课程有多个考核开启,则不符合逻辑(一门课程一次只能开启一个考核,不能有多个)
if(!assesments.isEmpty()&&assesments.size()>0){
if (assesments.size() > 1) {
@ -161,13 +165,13 @@ public class ExperimentallearningService {
val.put("assesmentId", assesmentId);
}
}
resp.put("retvalue", val);
}
resp.put("retcode", 200);
resp.put("retvalue", val);
} catch (Exception e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Inquiry Failed");
resp.put("retvalue", "查询考核信息失败");
return resp;
}
return resp;

@ -19,11 +19,12 @@ import com.yipin.liuwanr.helper.ExcelExportHelper;
import com.yipin.liuwanr.mapper.AssesmentMapper;
import com.yipin.liuwanr.mapper.RecordMapper;
import com.yipin.liuwanr.vo.PracticeRecordVo;
import org.springframework.util.StringUtils;
/**
* 练习记录
* @author 或然
*
* @author 或然
*/
@Service
public class PracticeService {
@ -40,6 +41,7 @@ public class PracticeService {
/**
* 练习记录 And 考核记录
*
* @param studentId
* @param projectPermissions
* @param pageNum
@ -49,7 +51,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(studentId!=null&&courseId!=null&&projectPermissions!=null) {
if (!StringUtils.isEmpty(courseId) && !StringUtils.isEmpty(studentId) && projectPermissions != null) {
PageHelper.startPage(pageNum, pageSize);
List<Record> records = mapper.getByStudentId(projectPermissions, courseId, studentId);
PageInfo<Record> info = new PageInfo<Record>(records);
@ -74,6 +76,7 @@ public class PracticeService {
/**
* 练习记录 and 考核记录导出
*
* @param response
* @param studentId学生id
* @param projectPermissions权限(练习考核)
@ -83,8 +86,11 @@ public class PracticeService {
public HashMap<String, Object> exportPractice(HttpServletResponse response, Integer studentId, Integer projectPermissions, Integer courseId, String[] titles) {
String fileName = null;
String sheetName = null;
List<Record> records = null;
try {
List<Record> records=mapper.getByStudentId(projectPermissions,courseId,studentId);
if (!StringUtils.isEmpty(courseId) && !StringUtils.isEmpty(studentId)) {
records = mapper.getByStudentId(projectPermissions, courseId, studentId);
}
if (records.size() > 0 && !records.isEmpty()) {
if (projectPermissions == 0) {
fileName = "练习记录.xls";
@ -111,13 +117,14 @@ public class PracticeService {
/**
* 练习信息
*
* @param studentId
* @return
*/
public HashMap<String, Object> queryPracticeVo(Integer studentId, Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(studentId!=null&&courseId!=null){
if (!StringUtils.isEmpty(courseId) && !StringUtils.isEmpty(studentId)) {
// 学生个人的练习信息
PracticeRecordVo practiceVo = mapper.getByPracticeVO(studentId, courseId);
// 练习项目数量
@ -166,11 +173,11 @@ public class PracticeService {
}
public HashMap<String, Object> queryAllExperiment(Integer coureseId) {
public HashMap<String, Object> queryAllExperiment(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
if(coureseId!=null){
resp.put("retvalue", assesment.queryGetByAssesmentProject(coureseId));
if (!StringUtils.isEmpty(courseId)) {
resp.put("retvalue", assesment.queryGetByAssesmentProject(courseId));
}
resp.put("retcode", 200);
} catch (Exception e) {

@ -9,6 +9,7 @@ import org.springframework.stereotype.Service;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper;
import org.springframework.util.StringUtils;
/**
*
@ -82,6 +83,7 @@ public class ProjectAndCourseService {
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);
//总项目数量
@ -92,6 +94,7 @@ public class ProjectAndCourseService {
}else{
obj.put("number",0);
}
}
resp.put("retcode", 200);
resp.put("retvalue",obj);
} catch (RuntimeException e) {

Loading…
Cancel
Save