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

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. 27
      src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java
  4. 20
      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. 39
      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. 38
      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;
@ -43,8 +44,7 @@ public class ProjectAndCourseController {
/**
* 修改项目状态
* @param projectId
* @param isExperiment
* @param management
* @return
*/
@PostMapping("/updateIsExperiment")
@ -70,8 +70,7 @@ public class ProjectAndCourseController {
/**
* 修改考勤状态
* @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"
@ -113,6 +112,8 @@ 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
@ -158,8 +159,6 @@ public interface AssesmentMapper {
/**
* 修改考核状态
* @param assesmentId考核id
* @param assesmentState考核状态
*/
@Update({"<script>",
"update assessment set assesmentState=#{assesmentState} "+
@ -205,7 +204,6 @@ public interface AssesmentMapper {
Assesment queryAssesmentId(Integer assesmentId);
/**
* 实验班级
* @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);

@ -15,28 +15,16 @@ 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);
/**
* 修改是否开启项目
@ -52,4 +40,7 @@ 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);
}

@ -34,6 +34,7 @@ public class AssesmentService {
/**
* 考核管理列表查询
*
* @param assesment
* @param pageNo
* @param pageSize
@ -66,6 +67,7 @@ public class AssesmentService {
/**
* 创建考核
*
* @param vo
* @return
*/
@ -85,6 +87,9 @@ public class AssesmentService {
}
//考核人数
assesment.setAssessmentSize(studentIds.size());
//判分点数量
Integer pointNumber = mapper.queryPointNumber(assesment.getExperimentId());
assesment.setAssessmentNumber(pointNumber);
//添加考核
mapper.insertAssesment(assesment);
//得到考核id
@ -97,7 +102,7 @@ public class AssesmentService {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Add Failed");
return resp;
throw new RuntimeException();
}
return resp;
}
@ -105,6 +110,7 @@ public class AssesmentService {
/**
* 查询选中的学生有哪些正在参与考核
*
* @param studentIds
* @return
*/
@ -127,6 +133,7 @@ public class AssesmentService {
/**
* 根据id查询考核的信息
*
* @param id
* @return
*/
@ -155,7 +162,6 @@ public class AssesmentService {
/**
* 修改考核管理
* @param vo
* @return
*/
@Transactional
@ -201,6 +207,9 @@ public class AssesmentService {
}
//更新考核
assesment.setAssessmentSize(studentIds.size());//考核人数
//判分点数量
Integer pointNumber = mapper.queryPointNumber(assesment.getExperimentId());
assesment.setAssessmentNumber(pointNumber);
mapper.updateAssesment(assesment);
resp.put("retcode", 200);
@ -208,13 +217,14 @@ public class AssesmentService {
logger.error(e.getMessage());
resp.put("retcode", 500);
resp.put("retvalue", "Update Failed");
return resp;
throw new RuntimeException();
}
return resp;
}
/**
* 启动考核前的判断
*
* @param assesmentId
* @return
*/
@ -243,12 +253,8 @@ public class AssesmentService {
}
/**
* 修改考核状态
* @param id
* @param state
* @return
*/
public HashMap<String, Object> updateState(Assesment assesment) {
@ -271,7 +277,8 @@ public class AssesmentService {
if (endTime != null && !endTime.equals("")) {
endtime = Long.parseLong(assesment.getEndTime());
assesment.setEndTime(AssesmentHelper.longPointDate(endtime));
}if(timeSum!=null&&!timeSum.equals("")) {
}
if (timeSum != null && !timeSum.equals("")) {
datas = timeSum.split("h");
if (datas != null && datas.length > 0) {
hour = Integer.parseInt(datas[0]);
@ -297,6 +304,7 @@ public class AssesmentService {
/**
* 查询实验班级一级栏目
*
* @param staffId教师id
* @return
*/
@ -317,6 +325,7 @@ public class AssesmentService {
/**
* 查询实验班级名称以及班级一下的学生
*
* @param cretionTime
* @return
*/
@ -337,6 +346,7 @@ public class AssesmentService {
/**
* 考核信息展示
*
* @param assesmentId
* @return
*/
@ -357,6 +367,7 @@ public class AssesmentService {
/**
* 班级筛选
*
* @param assesmentId
* @return
*/
@ -383,11 +394,6 @@ public class AssesmentService {
/**
* 成绩概况
* @param assesmentId
* @param projectId
* @param experimentalClassId
* @param classId
* @return
*/
public HashMap<String, Object> queryScore(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
@ -429,8 +435,7 @@ public class AssesmentService {
//平均分
score.setAvg(0);
}
//判分点数量
Integer pointNumber=mapper.queryPointNumber(assesmentId);
Integer pointNumber=mapper.getAssesmentNumber(assesmentId);
if(StringUtils.isEmpty(pointNumber)) {
score.setPointNumber(0);
}else {
@ -444,6 +449,7 @@ public class AssesmentService {
score.setError(error);
}
}
resp.put("retvalue", score);
resp.put("retcode", 200);
} catch (Exception e) {
@ -458,6 +464,7 @@ public class AssesmentService {
/**
* 成绩柱状图
*
* @param assesmentId
* @param experimentalClassId
* @param classId
@ -532,6 +539,7 @@ public class AssesmentService {
/**
* 错误分布折线图
*
* @param assesmentId
* @param experimentalClassId
* @param classId
@ -567,6 +575,7 @@ public class AssesmentService {
/**
* 成绩明细
*
* @param assesmentId
* @param experimentalClassId
* @param classId

@ -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>();
@ -87,4 +78,31 @@ 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