修改课程与项目有关的接口

master
pd 4 years ago
parent 5d15dde821
commit 6a805bd30a
  1. 6
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 11
      src/main/java/com/yipin/liuwanr/controller/ExperimentallearningController.java
  3. 31
      src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java
  4. 30
      src/main/java/com/yipin/liuwanr/mapper/AssesmentMapper.java
  5. 7
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  6. 21
      src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java
  7. 1129
      src/main/java/com/yipin/liuwanr/service/AssesmentService.java
  8. 10
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java
  9. 20
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  10. 40
      src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java

@ -205,6 +205,7 @@ public class ExperimentalClassController {
* @param experimentalClassId
* @return
*/
@GetMapping("/getProfessionals")
Response getProfessionals(@RequestParam Integer experimentalClassId) {
Response resp = new Response();
HashMap<String, Object> ret=classService.getProfessionals(experimentalClassId);
@ -225,6 +226,7 @@ public class ExperimentalClassController {
* @param experimentalClassId
* @return
*/
@GetMapping("/getStudentClass")
Response getStudentClass(@RequestParam Integer experimentalClassId) {
Response resp = new Response();
HashMap<String, Object> ret=classService.getStudentClass(experimentalClassId);
@ -241,6 +243,7 @@ public class ExperimentalClassController {
//新增学生显示数据
@GetMapping("/queryexperimentalClass")
Response queryexperimentalClass(@RequestParam Integer experimentalClassId) {
Response resp = new Response();
HashMap<String, Object> ret=classService.queryexperimentalClass(experimentalClassId);
@ -257,7 +260,8 @@ public class ExperimentalClassController {
//新增学生
Response addStudent(@RequestParam ExperimentalClassVo vo) {
@PostMapping("/addStudent")
Response addStudent(@RequestBody ExperimentalClassVo vo) {
Response resp = new Response();
HashMap<String, Object> ret=classService.addStudent(vo);
int status = (int) ret.get("retcode");

@ -44,10 +44,6 @@ public class ExperimentallearningController {
/**
* 添加签到记录
* @param courseId
* @param studentId
* @param experimentName
* @return
*/
@PostMapping("/insertAttendance")
Response insertAttendance(@RequestBody Attendance attendance) {
@ -72,8 +68,6 @@ public class ExperimentallearningController {
/**
* 获取教师信息
* @param courseId
* @return
*/
@GetMapping("/queryTeacherName")
Response queryTeacherName(Integer courseId) {
@ -94,8 +88,6 @@ public class ExperimentallearningController {
/**
* 获取学生信息
* @param courseId
* @return
*/
@GetMapping("/queryStudentName")
Response queryStudentName(Integer courseId) {
@ -114,9 +106,6 @@ public class ExperimentallearningController {
/**
* 进入考核
* @param courseId
* @param studentId
* @return
*/
@GetMapping("/queryAssesment")
Response queryAssesment(Integer courseId,Integer studentId) {

@ -3,6 +3,7 @@ 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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -40,11 +41,10 @@ public class ProjectAndCourseController {
}
return resp;
}
/**
* 修改项目状态
* @param projectId
* @param isExperiment
* @param management
* @return
*/
@PostMapping("/updateIsExperiment")
@ -67,11 +67,10 @@ public class ProjectAndCourseController {
}
return resp;
}
/**
* 修改考勤状态
* @param projectId
* @param isAttendance
* @param management
* @return
*/
@PostMapping("/updateIsAttendance")
@ -95,4 +94,24 @@ 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) {
resp.setStatus(status);
resp.setMessage(ret.get("retvalue"));
} else {
resp.setStatus(status);
resp.setErrmessage(ret.get("retvalue").toString());
}
}
return resp;
}
}

@ -33,7 +33,7 @@ public interface AssesmentMapper {
* @return
*/
@Select("select projectId,projectName,projectPermissions,founder,creationTime from hr_project_management " +
" where isdel=0 and projectPermissions=1 AND systemId in (SELECT systemId FROM course WHERE courseId=#{courseId})")
" where isdel=0 and projectPermissions=1 AND systemId in (select systemId FROM hr_course_tc where courseId=#{courseId} GROUP BY systemId)")
List<Project_Management> queryGetByAssesmentProject(Integer courseId);
@ -78,8 +78,8 @@ public interface AssesmentMapper {
* 创建考核
* @param assesment
*/
@Insert("insert into assessment (assesmentName,releaseType,creationTime,endTime,timesum,experimentId,classId,assesmentState,assessmentSize,experimentalClassId,staffId,courseId)"
+ " values (#{assesmentName},#{releaseType},#{creationTime},#{endTime},#{timesum},#{experimentId},#{classId},#{assesmentState},#{assessmentSize},#{experimentalClassId},#{staffId},#{courseId})")
@Insert("insert into assessment (assesmentName,releaseType,creationTime,endTime,timesum,experimentId,classId,assesmentState,assessmentSize,experimentalClassId,staffId,courseId,assessmentNumber)"
+ " values (#{assesmentName},#{releaseType},#{creationTime},#{endTime},#{timesum},#{experimentId},#{classId},#{assesmentState},#{assessmentSize},#{experimentalClassId},#{staffId},#{courseId},#{assessmentNumber})")
@Options(useGeneratedKeys = true,keyColumn ="id",keyProperty = "id")
void insertAssesment(Assesment assesment);
@ -88,14 +88,13 @@ public interface AssesmentMapper {
* 修改考核
* @param assesment
*/
@Update("update assessment set assesmentName=#{assesmentName},releaseType=#{releaseType},creationTime=#{creationTime},endTime=#{endTime},timesum=#{timesum},assessmentSize=#{assessmentSize},"
@Update("update assessment set assesmentName=#{assesmentName},releaseType=#{releaseType},creationTime=#{creationTime},endTime=#{endTime},timesum=#{timesum},assessmentSize=#{assessmentSize},assessmentNumber=#{assessmentNumber}"
+ "experimentId=#{experimentId},assesmentState=#{assesmentState},classId=#{classId},experimentalClassId=#{experimentalClassId} where id=#{id}")
void updateAssesment(Assesment assesment);
/**
* 添加考核记录
* @param record
*/
@Insert({ "<script>",
"insert into record (projectId,courseId,studentId,assesmentId) values"
@ -112,8 +111,10 @@ public interface AssesmentMapper {
*/
@Select("select id,experimentId,creationTime,endTime,assesmentName,releaseType,timesum,experimentalClassId,classId from assessment where id=#{id}")
Assesment queryGetById(Integer id);
@Select("select assessmentNumber from assessment where id=#{assesmentId}")
Integer getAssesmentNumber(Integer assesmentId);
/**
* 查询行政班级id
* @param studentIds
@ -158,8 +159,6 @@ public interface AssesmentMapper {
/**
* 修改考核状态
* @param assesmentId考核id
* @param assesmentState考核状态
*/
@Update({"<script>",
"update assessment set assesmentState=#{assesmentState} "+
@ -203,8 +202,7 @@ public interface AssesmentMapper {
@Select("SELECT ass.assesmentName as assesmentName ,ass.creationTime as creationTime,ass.endTime as endTime,ass.assessmentSize as assessmentSize,count(re.score) as actualNumber,st.staffName as staffName "
+ " FROM (assessment ass left join staff st on ass.staffId=st.staffId) left join record re on ass.id=re.assesmentId WHERE ass.id=#{assesmentId} and re.score is not null")
Assesment queryAssesmentId(Integer assesmentId);
/**
* 实验班级
@ -242,8 +240,8 @@ public interface AssesmentMapper {
" and re.score is not null ORDER BY re.score",
"</script>"})
List<Integer> queryScore(Integer assesmentId,@Param("experimentalClassId")Integer experimentalClassId,@Param("classId") List<Integer> classId);
/**
* 分组查询分数和对应人数
* @param assesmentId
@ -284,11 +282,11 @@ public interface AssesmentMapper {
/**
* 统计该项目的判分点数量
* @param projectId
* (select experimentId from assessment where id=#{assesmentId})
* @return
*/
@Select("select count(judgmentPointsId) from hr_judgment_points where FIND_IN_SET((select experimentId from assessment where id=#{assesmentId}),projectId)")
Integer queryPointNumber(Integer assesmentId);
@Select("select count(judgmentPointsId) from hr_judgment_points where FIND_IN_SET(#{projectId},projectId)")
Integer queryPointNumber(Integer projectId);
/**

@ -20,7 +20,7 @@ public interface ExperimentalClassMapper {
+ "VALUES(#{studentId},#{intExperimentalClassId})")
void experimentClassAddStudent(Student student);
@Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{experimentalClassId}")
@Delete("DELETE from experimental_class_student where studentId = #{studentId} and experimentalClassId = #{intExperimentalClassId}")
void experimentClassDeleteStudent(Student student);
//创建实验班级
@ -84,7 +84,7 @@ public interface ExperimentalClassMapper {
* @return
*/
@Select({"<script>",
"select s.studentId,studentName,studentNumber,gradeName,className from experimental_class_student st,student s,class c,grade g,professional p"
"select s.studentId,studentName,studentNumber,gradeName,className,professionalName from experimental_class_student st,student s,class c,grade g,professional p"
+ " where st.studentId=s.studentId and s.classId=c.classId and c.gradeId=g.gradeId and s.professionalId=p.professionalId and st.experimentalClassId=#{experimentalClassId} ",
" <if test='professionalId!=null'>and stu.professionalId = #{professionalId} </if>",
" <if test='classId !=null'>and stu.classId = #{classId} </if>",
@ -94,7 +94,8 @@ public interface ExperimentalClassMapper {
List<Student> getExperimentalClassDetails(Student student);
@Select("select s.studentId,studentName from student s left join experimental_class_student exs on s.studentId=exs.studentId where exs.experimentalClassId=#{experimentalClassId}")
@Select("select s.studentId,studentName from student s left join experimental_class_student exs on s.studentId=exs.studentId " +
" where exs.experimentalClassId=#{experimentalClassId} GROUP BY s.studentId")
List<Student> querystudent(Integer experimentalClassId);

@ -14,29 +14,17 @@ import com.yipin.liuwanr.entity.Project_Management;
*
*/
public interface TeacherProjectAndCourseMapper {
/**
* 获取服务配置id
* @param courseId
* @return
*/
@Select("select systemId from course where courseId=#{courseId}")
String getBycourseId(Integer courseId);
/**
* 查询实验项目信息
* @param systemIds
* @return
*/
@Select({"<script>",
"select projectId,projectName,isExperiment,isAttendance from hr_project_management WHERE isdel=0 and projectPermissions=0 and state=1",
"select projectId,projectName,isExperiment,isAttendance from hr_project_management WHERE isdel=0 and projectPermissions=0 and state=1 " +
" and systemId in (select systemId FROM hr_course_tc where courseId=#{courseId} GROUP BY systemId)",
"<if test='isExperiment!=null'> and isExperiment=0</if>",
"<if test='isAttendance!=null'> and isAttendance=0</if>",
"<foreach collection='systemIds' item='systemId' open='and systemId in(' separator=',' close=')'>" + "#{systemId} " + "</foreach> ",
"</script>"})
List<Project_Management> getBySystemId(@Param("systemIds") String[] systemIds,@Param("isExperiment")Integer isExperiment,@Param("isAttendance")Integer isAttendance);
List<Project_Management> getBySystemId(@Param("courseId") Integer courseId,@Param("isExperiment")Integer isExperiment,@Param("isAttendance")Integer isAttendance);
/**
* 修改是否开启项目
@ -51,5 +39,8 @@ public interface TeacherProjectAndCourseMapper {
*/
@Update("update hr_project_management set isAttendance=#{isAttendance} where projectId=#{projectId}")
void updateIsAttendance(Project_Management management);
@Select("select count(*) from hr_course_schedule where courseId=#{courseId}")
Integer getCourseSchedule(Integer courseId);
}

@ -137,9 +137,7 @@ public class ExperimentalClassService {
//学生信息
List<Student> students=experimentalClassMapper.getExperimentalClassDetails(student);
//考勤数量
String systemId=projectAndCourseMapper.getBycourseId(courseId);
String[] systemIds=systemId.split(",");
List<Project_Management> project=projectAndCourseMapper.getBySystemId(systemIds,0,0);
List<Project_Management> project=projectAndCourseMapper.getBySystemId(courseId,0,0);
int denominator=project.size();
for (int i = 0; i < students.size(); i++) {
Student stu=students.get(i);
@ -170,8 +168,6 @@ public class ExperimentalClassService {
try {
Integer experimentalClassId=experimentalClass.getExperimentalClassId();
Student stu=new Student();
stu.setExperimentalClassId(experimentalClassId.toString());
List<Student> students=experimentalClassMapper.querystudent(experimentalClassId);
//取出学生id
@ -194,7 +190,7 @@ public class ExperimentalClassService {
for (int i=0;i<newstudeId.size();i++) {
Student student=new Student();
student.setStudentId(newstudeId.get(i));
student.setExperimentalClassId(experimentalClassId.toString());
student.setIntExperimentalClassId(experimentalClassId);
experimentalClassMapper.experimentClassAddStudent(student);
}
}
@ -203,7 +199,7 @@ public class ExperimentalClassService {
for (int i=0;i<oldstudeId.size();i++) {
Student student=new Student();
student.setStudentId(oldstudeId.get(i));
student.setExperimentalClassId(experimentalClassId.toString());
student.setIntExperimentalClassId(experimentalClassId);
experimentalClassMapper.experimentClassDeleteStudent(student);
}
}

@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
import com.yipin.liuwanr.entity.Assesment;
import com.yipin.liuwanr.entity.Attendance;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.mapper.ExperimentallearningMapper;
import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper;
@ -43,10 +42,7 @@ public class ExperimentallearningService {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
String systemId = mapper2.getBycourseId(courseId);
String[] systemIds = systemId.split(",");
List<Project_Management> projects = mapper2.getBySystemId(systemIds, 0, null);
List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null);
for (int i = 0; i < projects.size(); i++) {
Project_Management project = projects.get(i);
if (project.getIsExperiment() == 0) {
@ -77,11 +73,6 @@ public class ExperimentallearningService {
/**
* 学生签到
*
* @param courseId
* @param studentId
* @param experimentName
* @return
*/
public HashMap<String, Object> insertAttendance(Attendance attendance) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -107,9 +98,6 @@ public class ExperimentallearningService {
/**
* 学生信息展示
*
* @param courseId
* @return
*/
public HashMap<String, Object> queryStudentName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -127,9 +115,6 @@ public class ExperimentallearningService {
/**
* 授课老师
*
* @param courseId
* @return
*/
public HashMap<String, Object> queryTeacherName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -147,9 +132,6 @@ public class ExperimentallearningService {
/**
* 进入考核
*
* @param courseId
* @return
*/
public HashMap<String, Object> queryAssesment(Integer courseId, Integer studentId) {
HashMap<String, Object> resp = new HashMap<String, Object>();

@ -32,10 +32,7 @@ public class ProjectAndCourseService {
public HashMap<String, Object> queryProject(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
String systemId=mapper.getBycourseId(courseId);
String[] systemIds=systemId.split(",");
List<Project_Management> project=mapper.getBySystemId(systemIds,null, null);
List<Project_Management> project=mapper.getBySystemId(courseId,null, null);
resp.put("retcode", 200);
resp.put("retvalue", project);
} catch (RuntimeException e) {
@ -49,9 +46,6 @@ public class ProjectAndCourseService {
/**
* 修改项目状态
* @param projectId
* @param isExperiment
* @return
*/
public HashMap<String, Object> updateIsExperiment(Project_Management management) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -69,9 +63,6 @@ public class ProjectAndCourseService {
/**
* 修改考勤状态
* @param projectId
* @param isAttendance
* @return
*/
public HashMap<String, Object> updateIsAttendance(Project_Management management) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -86,5 +77,32 @@ public class ProjectAndCourseService {
}
return resp;
}
public HashMap<String, Object> getCourseSchedule(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
HashMap<String, Integer> obj = new HashMap<String, Integer>();
try {
//完成的课程项目
Integer number=mapper.getCourseSchedule(courseId);
//总项目数量
List<Project_Management> project=mapper.getBySystemId(courseId,null, null);
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);
} catch (RuntimeException e) {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "查询失败");
return resp;
}
return resp;
}
}

Loading…
Cancel
Save