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

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

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

@ -3,6 +3,7 @@ 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.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@ -43,8 +44,7 @@ public class ProjectAndCourseController {
/** /**
* 修改项目状态 * 修改项目状态
* @param projectId * @param management
* @param isExperiment
* @return * @return
*/ */
@PostMapping("/updateIsExperiment") @PostMapping("/updateIsExperiment")
@ -70,8 +70,7 @@ public class ProjectAndCourseController {
/** /**
* 修改考勤状态 * 修改考勤状态
* @param projectId * @param management
* @param isAttendance
* @return * @return
*/ */
@PostMapping("/updateIsAttendance") @PostMapping("/updateIsAttendance")
@ -95,4 +94,24 @@ public class ProjectAndCourseController {
return resp; 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 * @return
*/ */
@Select("select projectId,projectName,projectPermissions,founder,creationTime from hr_project_management " + @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); List<Project_Management> queryGetByAssesmentProject(Integer courseId);
@ -78,8 +78,8 @@ public interface AssesmentMapper {
* 创建考核 * 创建考核
* @param assesment * @param assesment
*/ */
@Insert("insert into assessment (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})") + " values (#{assesmentName},#{releaseType},#{creationTime},#{endTime},#{timesum},#{experimentId},#{classId},#{assesmentState},#{assessmentSize},#{experimentalClassId},#{staffId},#{courseId},#{assessmentNumber})")
@Options(useGeneratedKeys = true,keyColumn ="id",keyProperty = "id") @Options(useGeneratedKeys = true,keyColumn ="id",keyProperty = "id")
void insertAssesment(Assesment assesment); void insertAssesment(Assesment assesment);
@ -88,14 +88,13 @@ public interface AssesmentMapper {
* 修改考核 * 修改考核
* @param assesment * @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}") + "experimentId=#{experimentId},assesmentState=#{assesmentState},classId=#{classId},experimentalClassId=#{experimentalClassId} where id=#{id}")
void updateAssesment(Assesment assesment); void updateAssesment(Assesment assesment);
/** /**
* 添加考核记录 * 添加考核记录
* @param record
*/ */
@Insert({ "<script>", @Insert({ "<script>",
"insert into record (projectId,courseId,studentId,assesmentId) values" "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}") @Select("select id,experimentId,creationTime,endTime,assesmentName,releaseType,timesum,experimentalClassId,classId from assessment where id=#{id}")
Assesment queryGetById(Integer id); Assesment queryGetById(Integer id);
@Select("select assessmentNumber from assessment where id=#{assesmentId}")
Integer getAssesmentNumber(Integer assesmentId);
/** /**
* 查询行政班级id * 查询行政班级id
@ -158,8 +159,6 @@ public interface AssesmentMapper {
/** /**
* 修改考核状态 * 修改考核状态
* @param assesmentId考核id
* @param assesmentState考核状态
*/ */
@Update({"<script>", @Update({"<script>",
"update assessment set assesmentState=#{assesmentState} "+ "update assessment set assesmentState=#{assesmentState} "+
@ -205,7 +204,6 @@ public interface AssesmentMapper {
Assesment queryAssesmentId(Integer assesmentId); Assesment queryAssesmentId(Integer assesmentId);
/** /**
* 实验班级 * 实验班级
* @param assesmentId * @param assesmentId
@ -284,11 +282,11 @@ public interface AssesmentMapper {
/** /**
* 统计该项目的判分点数量 * 统计该项目的判分点数量
* @param projectId * (select experimentId from assessment where id=#{assesmentId})
* @return * @return
*/ */
@Select("select count(judgmentPointsId) from hr_judgment_points where FIND_IN_SET((select experimentId from assessment where id=#{assesmentId}),projectId)") @Select("select count(judgmentPointsId) from hr_judgment_points where FIND_IN_SET(#{projectId},projectId)")
Integer queryPointNumber(Integer assesmentId); Integer queryPointNumber(Integer projectId);
/** /**

@ -20,7 +20,7 @@ public interface ExperimentalClassMapper {
+ "VALUES(#{studentId},#{intExperimentalClassId})") + "VALUES(#{studentId},#{intExperimentalClassId})")
void experimentClassAddStudent(Student student); 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); void experimentClassDeleteStudent(Student student);
//创建实验班级 //创建实验班级
@ -84,7 +84,7 @@ public interface ExperimentalClassMapper {
* @return * @return
*/ */
@Select({"<script>", @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} ", + " 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='professionalId!=null'>and stu.professionalId = #{professionalId} </if>",
" <if test='classId !=null'>and stu.classId = #{classId} </if>", " <if test='classId !=null'>and stu.classId = #{classId} </if>",
@ -94,7 +94,8 @@ public interface ExperimentalClassMapper {
List<Student> getExperimentalClassDetails(Student student); 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); List<Student> querystudent(Integer experimentalClassId);

@ -15,28 +15,16 @@ import com.yipin.liuwanr.entity.Project_Management;
*/ */
public interface TeacherProjectAndCourseMapper { 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({"<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='isExperiment!=null'> and isExperiment=0</if>",
"<if test='isAttendance!=null'> and isAttendance=0</if>", "<if test='isAttendance!=null'> and isAttendance=0</if>",
"<foreach collection='systemIds' item='systemId' open='and systemId in(' separator=',' close=')'>" + "#{systemId} " + "</foreach> ",
"</script>"}) "</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}") @Update("update hr_project_management set isAttendance=#{isAttendance} where projectId=#{projectId}")
void updateIsAttendance(Project_Management management); void updateIsAttendance(Project_Management management);
@Select("select count(*) from hr_course_schedule where courseId=#{courseId}")
Integer getCourseSchedule(Integer courseId);
} }

@ -27,32 +27,33 @@ import com.yipin.liuwanr.vo.AssesmentStudentVo;
@Service @Service
public class AssesmentService { public class AssesmentService {
private static Logger logger=Logger.getLogger(AssesmentService.class); private static Logger logger = Logger.getLogger(AssesmentService.class);
@Autowired @Autowired
private AssesmentMapper mapper; private AssesmentMapper mapper;
/** /**
* 考核管理列表查询 * 考核管理列表查询
*
* @param assesment * @param assesment
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @return * @return
*/ */
public HashMap<String, Object> queryAssesmentCondition(Assesment assesment,Integer pageNo,Integer pageSize){ public HashMap<String, Object> queryAssesmentCondition(Assesment assesment, 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); PageHelper.startPage(pageNo, pageSize);
List<Assesment> assesments = mapper.getByCondition(assesment); List<Assesment> assesments = mapper.getByCondition(assesment);
PageInfo<Assesment> info=new PageInfo<Assesment>(assesments); PageInfo<Assesment> info = new PageInfo<Assesment>(assesments);
int total1 = (int) info.getTotal(); int total1 = (int) info.getTotal();
int totalPages; int totalPages;
totalPages = total1 / pageSize; totalPages = total1 / pageSize;
if (total1 % pageSize != 0){ if (total1 % pageSize != 0) {
totalPages ++; totalPages++;
} }
long total = total1; long total = total1;
resp.put("retvalue", new PageResult(total, assesments,totalPages)); resp.put("retvalue", new PageResult(total, assesments, totalPages));
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (RuntimeException e) { } catch (RuntimeException e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -66,29 +67,33 @@ public class AssesmentService {
/** /**
* 创建考核 * 创建考核
*
* @param vo * @param vo
* @return * @return
*/ */
@Transactional @Transactional
public HashMap<String, Object> addAssesment(AssesmentStudentVo vo) { public HashMap<String, Object> addAssesment(AssesmentStudentVo vo) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
Assesment assesment=vo.getAssesment(); Assesment assesment = vo.getAssesment();
List<Integer> studentIds=vo.getStudentIds(); List<Integer> studentIds = vo.getStudentIds();
try { try {
//转换时间格式 //转换时间格式
assesment = AssesmentHelper.helpAssesment(assesment); assesment = AssesmentHelper.helpAssesment(assesment);
if(assesment.getExperimentalClassId()!=null) { if (assesment.getExperimentalClassId() != null) {
//行政班级id //行政班级id
List<String> classid=mapper.queryClassId(studentIds); List<String> classid = mapper.queryClassId(studentIds);
String classId = String.join(",", classid); String classId = String.join(",", classid);
assesment.setClassId(classId); assesment.setClassId(classId);
} }
//考核人数 //考核人数
assesment.setAssessmentSize(studentIds.size()); assesment.setAssessmentSize(studentIds.size());
//判分点数量
Integer pointNumber = mapper.queryPointNumber(assesment.getExperimentId());
assesment.setAssessmentNumber(pointNumber);
//添加考核 //添加考核
mapper.insertAssesment(assesment); mapper.insertAssesment(assesment);
//得到考核id //得到考核id
Integer assesmentId=assesment.getId(); Integer assesmentId = assesment.getId();
//往记录表中添加选中的学生信息,哪名学生要参与某一课程的什么考核,该考核下的 哪一项目 //往记录表中添加选中的学生信息,哪名学生要参与某一课程的什么考核,该考核下的 哪一项目
mapper.insertRecore(studentIds, assesment.getExperimentId(), assesment.getCourseId(), assesmentId); mapper.insertRecore(studentIds, assesment.getExperimentId(), assesment.getCourseId(), assesmentId);
@ -97,7 +102,7 @@ public class AssesmentService {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "Add Failed"); resp.put("retvalue", "Add Failed");
return resp; throw new RuntimeException();
} }
return resp; return resp;
} }
@ -105,6 +110,7 @@ public class AssesmentService {
/** /**
* 查询选中的学生有哪些正在参与考核 * 查询选中的学生有哪些正在参与考核
*
* @param studentIds * @param studentIds
* @return * @return
*/ */
@ -112,7 +118,7 @@ public class AssesmentService {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
//查询出来的学生信息 //查询出来的学生信息
List<Student> stu=mapper.queryStudentisAssess(studentIds); List<Student> stu = mapper.queryStudentisAssess(studentIds);
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", stu); resp.put("retvalue", stu);
} catch (Exception e) { } catch (Exception e) {
@ -127,21 +133,22 @@ public class AssesmentService {
/** /**
* 根据id查询考核的信息 * 根据id查询考核的信息
*
* @param id * @param id
* @return * @return
*/ */
public HashMap<String, Object> queryGetById(Integer id) { public HashMap<String, Object> queryGetById(Integer id) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
List<Object> obj=new ArrayList<Object>(); List<Object> obj = new ArrayList<Object>();
try { try {
//考核信息 //考核信息
Assesment assesment=mapper.queryGetById(id); Assesment assesment = mapper.queryGetById(id);
//之前选中的学生 //之前选中的学生
List<Student> students=mapper.queryStudent(id); List<Student> students = mapper.queryStudent(id);
obj.add(assesment); obj.add(assesment);
obj.add(students); obj.add(students);
resp.put("retvalue",obj); resp.put("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -155,29 +162,28 @@ public class AssesmentService {
/** /**
* 修改考核管理 * 修改考核管理
* @param vo
* @return * @return
*/ */
@Transactional @Transactional
public HashMap<String, Object> updateAssesment(Assesment assesment,List<Integer> studentIds) { public HashMap<String, Object> updateAssesment(Assesment assesment, List<Integer> studentIds) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
assesment = AssesmentHelper.helpAssesment(assesment); assesment = AssesmentHelper.helpAssesment(assesment);
try { try {
//数据库存储的考核信息 //数据库存储的考核信息
Assesment before= mapper.queryGetById(assesment.getId()); Assesment before = mapper.queryGetById(assesment.getId());
//数据库存储的学生 //数据库存储的学生
List<Student> students=mapper.queryStudent(assesment.getId()); List<Student> students = mapper.queryStudent(assesment.getId());
if(assesment.getExperimentalClassId()!=null) { if (assesment.getExperimentalClassId() != null) {
//新的行政班级id //新的行政班级id
List<String> classid=mapper.queryClassId(studentIds); List<String> classid = mapper.queryClassId(studentIds);
String classId = String.join(",", classid); String classId = String.join(",", classid);
if(!classId.equals(before.getClassId())) { if (!classId.equals(before.getClassId())) {
assesment.setClassId(classId); assesment.setClassId(classId);
}else { } else {
assesment.setClassId(before.getClassId()); assesment.setClassId(before.getClassId());
} }
}else if(assesment.getClassId()!=null) { } else if (assesment.getClassId() != null) {
assesment.setExperimentalClassId(null); assesment.setExperimentalClassId(null);
} }
// 比较两批学生的信息 // 比较两批学生的信息
@ -192,15 +198,18 @@ public class AssesmentService {
} }
} }
//前端传来的添加 //前端传来的添加
if(studentIds.size()>0) { if (studentIds.size() > 0) {
mapper.insertRecore(studentIds, assesment.getExperimentId(), assesment.getCourseId(), assesment.getId()); mapper.insertRecore(studentIds, assesment.getExperimentId(), assesment.getCourseId(), assesment.getId());
} }
//后端剩余的删除 //后端剩余的删除
if(students.size()>0) { if (students.size() > 0) {
mapper.deleteRecord(assesment.getId(), students); mapper.deleteRecord(assesment.getId(), students);
} }
//更新考核 //更新考核
assesment.setAssessmentSize(studentIds.size());//考核人数 assesment.setAssessmentSize(studentIds.size());//考核人数
//判分点数量
Integer pointNumber = mapper.queryPointNumber(assesment.getExperimentId());
assesment.setAssessmentNumber(pointNumber);
mapper.updateAssesment(assesment); mapper.updateAssesment(assesment);
resp.put("retcode", 200); resp.put("retcode", 200);
@ -208,30 +217,31 @@ public class AssesmentService {
logger.error(e.getMessage()); logger.error(e.getMessage());
resp.put("retcode", 500); resp.put("retcode", 500);
resp.put("retvalue", "Update Failed"); resp.put("retvalue", "Update Failed");
return resp; throw new RuntimeException();
} }
return resp; return resp;
} }
/** /**
* 启动考核前的判断 * 启动考核前的判断
*
* @param assesmentId * @param assesmentId
* @return * @return
*/ */
public HashMap<String, Object> assessmentJudgment(Integer assesmentId) { public HashMap<String, Object> assessmentJudgment(Integer assesmentId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
List<Student> obj=new ArrayList<Student>(); List<Student> obj = new ArrayList<Student>();
try { try {
List<Integer> datas=mapper.getStudentisAssess(); List<Integer> datas = mapper.getStudentisAssess();
List<Student> students=mapper.queryStudent(assesmentId); List<Student> students = mapper.queryStudent(assesmentId);
for (int i = 0; i < students.size(); i++) { for (int i = 0; i < students.size(); i++) {
Student stu=students.get(i); Student stu = students.get(i);
if(datas.contains(stu.getStudentId())) { if (datas.contains(stu.getStudentId())) {
obj.add(stu); obj.add(stu);
} }
} }
resp.put("retvalue",obj); resp.put("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -243,12 +253,8 @@ public class AssesmentService {
} }
/** /**
* 修改考核状态 * 修改考核状态
* @param id
* @param state
* @return * @return
*/ */
public HashMap<String, Object> updateState(Assesment assesment) { public HashMap<String, Object> updateState(Assesment assesment) {
@ -261,26 +267,27 @@ public class AssesmentService {
try { try {
String createTime = assesment.getCreationTime(); String createTime = assesment.getCreationTime();
String endTime = assesment.getEndTime(); String endTime = assesment.getEndTime();
String timeSum=assesment.getTimesum(); String timeSum = assesment.getTimesum();
if(createTime!=null&&!createTime.equals("")) { if (createTime != null && !createTime.equals("")) {
starttime = Long.parseLong(assesment.getCreationTime()); starttime = Long.parseLong(assesment.getCreationTime());
assesment.setCreationTime(AssesmentHelper.longPointDate(starttime)); assesment.setCreationTime(AssesmentHelper.longPointDate(starttime));
} }
if(endTime!=null&&!endTime.equals("")) { if (endTime != null && !endTime.equals("")) {
endtime = Long.parseLong(assesment.getEndTime()); endtime = Long.parseLong(assesment.getEndTime());
assesment.setEndTime(AssesmentHelper.longPointDate(endtime)); assesment.setEndTime(AssesmentHelper.longPointDate(endtime));
}if(timeSum!=null&&!timeSum.equals("")) {
datas=timeSum.split("h");
if(datas!=null&&datas.length>0) {
hour=Integer.parseInt(datas[0]);
if(datas.length>2) {
minute=Integer.parseInt(datas[1]);
} }
if (timeSum != null && !timeSum.equals("")) {
datas = timeSum.split("h");
if (datas != null && datas.length > 0) {
hour = Integer.parseInt(datas[0]);
if (datas.length > 2) {
minute = Integer.parseInt(datas[1]);
} }
long time=((hour*60)+minute)*60*1000; }
endTime=AssesmentHelper.longPointDate(starttime+time); long time = ((hour * 60) + minute) * 60 * 1000;
endTime = AssesmentHelper.longPointDate(starttime + time);
assesment.setEndTime(endTime); assesment.setEndTime(endTime);
} }
mapper.updateAssesmentState(assesment); mapper.updateAssesmentState(assesment);
@ -297,6 +304,7 @@ public class AssesmentService {
/** /**
* 查询实验班级一级栏目 * 查询实验班级一级栏目
*
* @param staffId教师id * @param staffId教师id
* @return * @return
*/ */
@ -317,13 +325,14 @@ public class AssesmentService {
/** /**
* 查询实验班级名称以及班级一下的学生 * 查询实验班级名称以及班级一下的学生
*
* @param cretionTime * @param cretionTime
* @return * @return
*/ */
public HashMap<String, Object> queryCretionTime(String cretionTime,Integer staffId) { public HashMap<String, Object> queryCretionTime(String cretionTime, Integer staffId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", mapper.queryExperimentalClass(cretionTime,staffId)); resp.put("retvalue", mapper.queryExperimentalClass(cretionTime, staffId));
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -337,6 +346,7 @@ public class AssesmentService {
/** /**
* 考核信息展示 * 考核信息展示
*
* @param assesmentId * @param assesmentId
* @return * @return
*/ */
@ -357,19 +367,20 @@ public class AssesmentService {
/** /**
* 班级筛选 * 班级筛选
*
* @param assesmentId * @param assesmentId
* @return * @return
*/ */
public HashMap<String, Object> getByclass(Integer assesmentId) { public HashMap<String, Object> getByclass(Integer assesmentId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
List<Object> obj=new ArrayList<Object>(); List<Object> obj = new ArrayList<Object>();
try { try {
ExperimentalClass experimentalClasses=mapper.queryExperimental(assesmentId); ExperimentalClass experimentalClasses = mapper.queryExperimental(assesmentId);
List<SutdentClass> classes=mapper.queryClass(assesmentId); List<SutdentClass> classes = mapper.queryClass(assesmentId);
obj.add(experimentalClasses); obj.add(experimentalClasses);
obj.add(classes); obj.add(classes);
resp.put("retvalue",obj); resp.put("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -383,41 +394,36 @@ public class AssesmentService {
/** /**
* 成绩概况 * 成绩概况
* @param assesmentId
* @param projectId
* @param experimentalClassId
* @param classId
* @return
*/ */
public HashMap<String, Object> queryScore(Integer assesmentId,Integer experimentalClassId,List<Integer> classId) { public HashMap<String, Object> queryScore(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
Score score=new Score(); Score score = new Score();
int size = 0; int size = 0;
try { try {
List<Integer> scores=mapper.queryScore(assesmentId, experimentalClassId, classId); List<Integer> scores = mapper.queryScore(assesmentId, experimentalClassId, classId);
if(scores.size()>0) { if (scores.size() > 0) {
size=scores.size(); size = scores.size();
//最低分 //最低分
score.setMin(scores.get(0)); score.setMin(scores.get(0));
//最高分 //最高分
score.setMax(scores.get(size-1)); score.setMax(scores.get(size - 1));
//考核人数 //考核人数
score.setPeopleSize(size); score.setPeopleSize(size);
//中位数 //中位数
double median=0.0; double median = 0.0;
if(size%2==1) { if (size % 2 == 1) {
median=scores.get((size-1)/2); median = scores.get((size - 1) / 2);
}else { } else {
median=(scores.get((size/2-1))+scores.get(size/2)+0.0)/2; median = (scores.get((size / 2 - 1)) + scores.get(size / 2) + 0.0) / 2;
} }
score.setMedian(median); score.setMedian(median);
//平均分 //平均分
int avg=0; int avg = 0;
for (int i = 0; i < scores.size(); i++) { for (int i = 0; i < scores.size(); i++) {
avg+=scores.get(i); avg += scores.get(i);
} }
score.setAvg(avg*1.0/size); score.setAvg(avg * 1.0 / size);
}else { } else {
//最低分 //最低分
score.setMin(0); score.setMin(0);
//最高分 //最高分
@ -429,8 +435,7 @@ public class AssesmentService {
//平均分 //平均分
score.setAvg(0); score.setAvg(0);
} }
//判分点数量 Integer pointNumber=mapper.getAssesmentNumber(assesmentId);
Integer pointNumber=mapper.queryPointNumber(assesmentId);
if(StringUtils.isEmpty(pointNumber)) { if(StringUtils.isEmpty(pointNumber)) {
score.setPointNumber(0); score.setPointNumber(0);
}else { }else {
@ -444,6 +449,7 @@ public class AssesmentService {
score.setError(error); score.setError(error);
} }
} }
resp.put("retvalue", score); resp.put("retvalue", score);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
@ -458,50 +464,51 @@ public class AssesmentService {
/** /**
* 成绩柱状图 * 成绩柱状图
*
* @param assesmentId * @param assesmentId
* @param experimentalClassId * @param experimentalClassId
* @param classId * @param classId
* @return * @return
*/ */
public HashMap<String, Object> queryHistogram(Integer assesmentId,Integer experimentalClassId,List<Integer> classId) { public HashMap<String, Object> queryHistogram(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
List<Integer> obj=new ArrayList<Integer>(); List<Integer> obj = new ArrayList<Integer>();
try { try {
Integer one=0; Integer one = 0;
Integer two=0; Integer two = 0;
Integer three=0; Integer three = 0;
Integer four=0; Integer four = 0;
Integer five=0; Integer five = 0;
Integer six=0; Integer six = 0;
Integer seven=0; Integer seven = 0;
Integer eight=0; Integer eight = 0;
Integer nine=0; Integer nine = 0;
Integer ten=0; Integer ten = 0;
List<Record> scores=mapper.queryScore2(assesmentId, experimentalClassId, classId); List<Record> scores = mapper.queryScore2(assesmentId, experimentalClassId, classId);
for (int i = 0; i < scores.size(); i++) { for (int i = 0; i < scores.size(); i++) {
Integer score=scores.get(i).getScore(); Integer score = scores.get(i).getScore();
Integer number=scores.get(i).getNumber(); Integer number = scores.get(i).getNumber();
if(score>=0&&score<=10) { if (score >= 0 && score <= 10) {
one+=number; one += number;
}else if(score>10&&score<=20) { } else if (score > 10 && score <= 20) {
two+=number; two += number;
}else if(score>20&&score<=30) { } else if (score > 20 && score <= 30) {
three+=number; three += number;
}else if(score>30&&score<=40) { } else if (score > 30 && score <= 40) {
four+=number; four += number;
}else if(score>40&&score<=50) { } else if (score > 40 && score <= 50) {
five+=number; five += number;
}else if(score>50&&score<=60) { } else if (score > 50 && score <= 60) {
six+=number; six += number;
}else if(score>60&&score<=70) { } else if (score > 60 && score <= 70) {
seven+=number; seven += number;
}else if(score>70&&score<=80) { } else if (score > 70 && score <= 80) {
eight+=number; eight += number;
}else if(score>80&&score<=90) { } else if (score > 80 && score <= 90) {
nine+=number; nine += number;
}else if(score>90&&score<=100) { } else if (score > 90 && score <= 100) {
ten+=number; ten += number;
} }
} }
@ -532,28 +539,29 @@ public class AssesmentService {
/** /**
* 错误分布折线图 * 错误分布折线图
*
* @param assesmentId * @param assesmentId
* @param experimentalClassId * @param experimentalClassId
* @param classId * @param classId
* @return * @return
*/ */
public HashMap<String, Object> getLinechart(Integer assesmentId,Integer experimentalClassId,List<Integer> classId) { public HashMap<String, Object> getLinechart(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
List<Object> obj=new ArrayList<Object>(); List<Object> obj = new ArrayList<Object>();
try { try {
List<PointRecord> errors=mapper.queryError(assesmentId, experimentalClassId, classId); List<PointRecord> errors = mapper.queryError(assesmentId, experimentalClassId, classId);
List<String> names=new ArrayList<String>(); List<String> names = new ArrayList<String>();
List<Integer> datas=new ArrayList<Integer>(); List<Integer> datas = new ArrayList<Integer>();
for (int i = 0; i < errors.size(); i++) { for (int i = 0; i < errors.size(); i++) {
PointRecord pointRecord=errors.get(i); PointRecord pointRecord = errors.get(i);
names.add(pointRecord.getJudgmentPointsName()); names.add(pointRecord.getJudgmentPointsName());
datas.add(pointRecord.getNumber()); datas.add(pointRecord.getNumber());
} }
obj.add(names); obj.add(names);
obj.add(datas); obj.add(datas);
resp.put("retvalue",obj); resp.put("retvalue", obj);
resp.put("retcode", 200); resp.put("retcode", 200);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage()); logger.error(e.getMessage());
@ -567,12 +575,13 @@ public class AssesmentService {
/** /**
* 成绩明细 * 成绩明细
*
* @param assesmentId * @param assesmentId
* @param experimentalClassId * @param experimentalClassId
* @param classId * @param classId
* @return * @return
*/ */
public HashMap<String, Object> queryAssesmentScore(Integer assesmentId,Integer experimentalClassId,List<Integer> classId) { public HashMap<String, Object> queryAssesmentScore(Integer assesmentId, Integer experimentalClassId, List<Integer> classId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
resp.put("retvalue", mapper.queryScore3(assesmentId, experimentalClassId, classId)); resp.put("retvalue", mapper.queryScore3(assesmentId, experimentalClassId, classId));

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

@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
import com.yipin.liuwanr.entity.Assesment; import com.yipin.liuwanr.entity.Assesment;
import com.yipin.liuwanr.entity.Attendance; import com.yipin.liuwanr.entity.Attendance;
import com.yipin.liuwanr.entity.Project_Management; import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.entity.Student;
import com.yipin.liuwanr.mapper.ExperimentallearningMapper; import com.yipin.liuwanr.mapper.ExperimentallearningMapper;
import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper; import com.yipin.liuwanr.mapper.TeacherProjectAndCourseMapper;
@ -43,10 +42,7 @@ public class ExperimentallearningService {
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); List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
List<Project_Management> projects = mapper2.getBySystemId(courseId, 0, null);
String systemId = mapper2.getBycourseId(courseId);
String[] systemIds = systemId.split(",");
List<Project_Management> projects = mapper2.getBySystemId(systemIds, 0, null);
for (int i = 0; i < projects.size(); i++) { for (int i = 0; i < projects.size(); i++) {
Project_Management project = projects.get(i); Project_Management project = projects.get(i);
if (project.getIsExperiment() == 0) { 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) { public HashMap<String, Object> insertAttendance(Attendance attendance) {
HashMap<String, Object> resp = new HashMap<String, Object>(); 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) { public HashMap<String, Object> queryStudentName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); 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) { public HashMap<String, Object> queryTeacherName(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); 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) { public HashMap<String, Object> queryAssesment(Integer courseId, Integer studentId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();

@ -32,10 +32,7 @@ public class ProjectAndCourseService {
public HashMap<String, Object> queryProject(Integer courseId) { public HashMap<String, Object> queryProject(Integer courseId) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
try { try {
String systemId=mapper.getBycourseId(courseId); List<Project_Management> project=mapper.getBySystemId(courseId,null, null);
String[] systemIds=systemId.split(",");
List<Project_Management> project=mapper.getBySystemId(systemIds,null, null);
resp.put("retcode", 200); resp.put("retcode", 200);
resp.put("retvalue", project); resp.put("retvalue", project);
} catch (RuntimeException e) { } catch (RuntimeException e) {
@ -49,9 +46,6 @@ public class ProjectAndCourseService {
/** /**
* 修改项目状态 * 修改项目状态
* @param projectId
* @param isExperiment
* @return
*/ */
public HashMap<String, Object> updateIsExperiment(Project_Management management) { public HashMap<String, Object> updateIsExperiment(Project_Management management) {
HashMap<String, Object> resp = new HashMap<String, Object>(); 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) { public HashMap<String, Object> updateIsAttendance(Project_Management management) {
HashMap<String, Object> resp = new HashMap<String, Object>(); HashMap<String, Object> resp = new HashMap<String, Object>();
@ -87,4 +78,31 @@ public class ProjectAndCourseService {
return resp; 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