parent
6e8e98e27a
commit
511cff2db2
9 changed files with 835 additions and 306 deletions
@ -0,0 +1,290 @@ |
||||
package com.yipin.liuwanr.service; |
||||
|
||||
import com.yipin.liuwanr.entity.Assesment; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @auther River |
||||
* @date 2020/8/11 15:44 |
||||
*/ |
||||
@SpringBootTest |
||||
@RunWith(SpringRunner.class) |
||||
public class AssesmentServiceTest { |
||||
|
||||
@Autowired |
||||
private AssesmentService assesmentService; |
||||
|
||||
/** |
||||
* 考核管理列表 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryAssesmentConditionTest(){ |
||||
Assesment assesment = new Assesment(); |
||||
assesment.setStaffId(123); |
||||
assesment.setCourseId(77); |
||||
Integer pageNO = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> condition = assesmentService.queryAssesmentCondition(assesment, pageNO, pageSize); |
||||
for (String s : condition.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + condition.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 新建考核管理 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void addAssesmentTest(){ |
||||
Assesment assesment = new Assesment(); |
||||
assesment.setAssesmentName("新建考核测试"); |
||||
assesment.setClassId("14"); |
||||
assesment.setCourseId(77); |
||||
assesment.setExperimentId(334); |
||||
assesment.setReleaseType(0); |
||||
assesment.setStaffId(123); |
||||
assesment.setTimesum("3600000"); |
||||
List<Integer> studentIds = new ArrayList<>(); |
||||
studentIds.add(67); |
||||
HashMap<String, Object> assesment1 = assesmentService.addAssesment(assesment, studentIds); |
||||
for (String s : assesment1.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assesment1.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询选中的学生有哪些正在参与考核 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryStudentisAssessTest(){ |
||||
List<Integer> studentIds = new ArrayList<>(); |
||||
studentIds.add(67); |
||||
studentIds.add(65); |
||||
HashMap<String, Object> student = assesmentService.queryStudentisAssess(studentIds); |
||||
for (String s : student.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + student.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 根据id查询考核的信息 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryGetByIdTest(){ |
||||
Integer id = 78; |
||||
HashMap<String, Object> assesment = assesmentService.queryGetById(id); |
||||
for (String s : assesment.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assesment.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 修改考核管理 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void updateAssesmentTest(){ |
||||
Assesment assesment = new Assesment(); |
||||
List<Integer> studentIds = new ArrayList<>(); |
||||
assesment.setAssesmentName("新建考核测试"); |
||||
assesment.setClassId("14"); |
||||
assesment.setCourseId(77); |
||||
assesment.setExperimentId(334); |
||||
assesment.setReleaseType(0); |
||||
assesment.setStaffId(123); |
||||
assesment.setTimesum("3600000"); |
||||
studentIds.add(67); |
||||
HashMap<String, Object> assesment1 = assesmentService.updateAssesment(assesment, studentIds); |
||||
for (String s : assesment1.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assesment1.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 启动考核前的判断 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void assessmentJudgmentTest(){ |
||||
Integer assesmentId = 78; |
||||
HashMap<String, Object> assessmentJudgment = assesmentService.assessmentJudgment(assesmentId); |
||||
for (String s : assessmentJudgment.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assessmentJudgment.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 修改考核状态 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void updateStateTest(){ |
||||
Assesment assesment = new Assesment(); |
||||
assesment.setId(79); |
||||
assesment.setAssesmentState(2); |
||||
assesment.setReleaseType(0); |
||||
assesment.setEndTime("1597214647000"); |
||||
assesment.setTimesum("17167000"); |
||||
HashMap<String, Object> state = assesmentService.updateState(assesment); |
||||
for (String s : state.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + state.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询实验班级一级栏目 |
||||
* 查询实验班级名称,以及班级一下的学生 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryCretionTimeTest(){ |
||||
Integer staffId = 2043; |
||||
Integer schoolId = 123; |
||||
String cretionTime = null; |
||||
HashMap<String, Object> cretionTime1 = assesmentService.queryCretionTime(staffId, schoolId); |
||||
for (String s : cretionTime1.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + cretionTime1.get(s)); |
||||
} |
||||
HashMap<String, Object> cretionTime2 = assesmentService.queryCretionTime(cretionTime, staffId, schoolId); |
||||
for (String s : cretionTime1.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + cretionTime2.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 考核信息展示 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryAssesmentTest(){ |
||||
Integer assesmentId = 79; |
||||
HashMap<String, Object> assesment = assesmentService.queryAssesment(assesmentId); |
||||
for (String s : assesment.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assesment.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 班级筛选 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void getByclassTest(){ |
||||
Integer assesmentId = 78; |
||||
HashMap<String, Object> byclass = assesmentService.getByclass(assesmentId); |
||||
for (String s : byclass.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + byclass.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 成绩概况 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryScoreTest(){ |
||||
Integer assesmentId = 78; |
||||
Integer experimentalClassId = 0; |
||||
Integer classId = 14; |
||||
HashMap<String, Object> score = assesmentService.queryScore(assesmentId, experimentalClassId, classId); |
||||
for (String s : score.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + score.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 成绩柱状图 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryHistogramTest(){ |
||||
Integer assesmentId = 78; |
||||
Integer experimentalClassId = 0; |
||||
Integer classId = 14; |
||||
HashMap<String, Object> histogram = assesmentService.queryHistogram(assesmentId, experimentalClassId, classId); |
||||
for (String s : histogram.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + histogram.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 错误分布折线图 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void getLinechartTest(){ |
||||
Integer assesmentId = 78; |
||||
Integer experimentalClassId = 0; |
||||
Integer classId = 14; |
||||
HashMap<String, Object> linechart = assesmentService.getLinechart(assesmentId, experimentalClassId, classId); |
||||
for (String s : linechart.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + linechart.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 成绩明细 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryAssesmentScoreTest(){ |
||||
Integer assesmentId = 78; |
||||
Integer experimentalClassId = 0; |
||||
Integer classId = 14; |
||||
HashMap<String, Object> assesmentScore = assesmentService.queryAssesmentScore(assesmentId, experimentalClassId, classId); |
||||
for (String s : assesmentScore.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assesmentScore.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 开启考核 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void releaseAssesmentTest(){ |
||||
Integer courseId = 14; |
||||
HashMap<String, Object> releaseAssesment = assesmentService.releaseAssesment(courseId); |
||||
for (String s : releaseAssesment.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + releaseAssesment.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除考核项目 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void deleteAssesmentTest(){ |
||||
Integer assesmentId = 78; |
||||
HashMap<String, Object> assesment = assesmentService.deleteAssesment(assesmentId); |
||||
for (String s : assesment.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + assesment.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断名称是否存在 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void isNameExistisTest(){ |
||||
String assesmentName = "随意"; |
||||
HashMap<String, Object> existis = assesmentService.isNameExistis(assesmentName); |
||||
for (String s : existis.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + existis.get(s)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,70 @@ |
||||
package com.yipin.liuwanr.service; |
||||
|
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.mock.web.MockHttpServletResponse; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.HashMap; |
||||
|
||||
/** |
||||
* @auther River |
||||
* @date 2020/8/13 9:59 |
||||
*/ |
||||
@SpringBootTest |
||||
@RunWith(SpringRunner.class) |
||||
public class AttendanceServiceTest { |
||||
|
||||
@Autowired |
||||
private AttendanceService attendanceService; |
||||
|
||||
|
||||
/** |
||||
* 查询考勤记录 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryAttendanceDetailedTest(){ |
||||
Integer studentId = 77; |
||||
Integer courseId = 64; |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 5; |
||||
HashMap<String, Object> detailed = attendanceService.queryAttendanceDetailed(studentId, courseId, pageNo, pageSize); |
||||
for (String s : detailed.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + detailed.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 导出考勤记录 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void exportPracticeTest(){ |
||||
MockHttpServletResponse response = new MockHttpServletResponse(); |
||||
Integer studentId = 64; |
||||
Integer courseId = 77; |
||||
String[] title = {"序号","项目名称","实验项目","考勤记录","签到时间"}; |
||||
HashMap<String, Object> exportPractice = attendanceService.exportPractice(response, studentId, courseId, title); |
||||
if (exportPractice == null){ |
||||
System.out.println("--------------------------Unit tests pass--------------------------"); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 考勤个人信息展示 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryAttendanceTest(){ |
||||
Integer studentId = 67; |
||||
Integer courseId = 77; |
||||
HashMap<String, Object> attendance = attendanceService.queryAttendance(studentId, courseId); |
||||
for (String s : attendance.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + attendance.get(s)); |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,229 @@ |
||||
package com.yipin.liuwanr.service; |
||||
|
||||
import com.yipin.liuwanr.entity.Course; |
||||
import com.yipin.liuwanr.entity.CourseLink; |
||||
import com.yipin.liuwanr.entity.ServiceConfig; |
||||
import org.junit.Test; |
||||
import org.junit.runner.RunWith; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.boot.test.context.SpringBootTest; |
||||
import org.springframework.test.context.junit4.SpringRunner; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
|
||||
import java.util.ArrayList; |
||||
import java.util.HashMap; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @auther River |
||||
* @date 2020/8/14 9:26 |
||||
*/ |
||||
@SpringBootTest |
||||
@RunWith(SpringRunner.class) |
||||
public class CourseServiceTest { |
||||
|
||||
@Autowired |
||||
private CourseService courseService; |
||||
|
||||
/** |
||||
* 添加课程 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void addCourseTest(){ |
||||
Course course = new Course(); |
||||
course.setCourseHours(1); |
||||
course.setCourseIntroduction("这是一个课程简介"); |
||||
course.setCourseName("测试课程"); |
||||
course.setCourseType(2); |
||||
course.setDisciplineId(2); |
||||
course.setMarketPrice(1); |
||||
course.setProfessionalClassId(5); |
||||
course.setProfessionalId(24); |
||||
course.setSystemId("1"); |
||||
course.setTeachingGoal("这是一个教学目标"); |
||||
HashMap<String, Object> addCourse = courseService.addCourse(course); |
||||
for (String s : addCourse.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + addCourse.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 添加实训配置 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void addCoursePCTest(){ |
||||
List<ServiceConfig> serviceConfigList = new ArrayList<>(); |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setCourseId(85); |
||||
serviceConfig.setProjectId(289); |
||||
serviceConfig.setProjectName("练习项目二:基础语法训练——初阶(数据转换与拼接)"); |
||||
serviceConfig.setSystemId(1); |
||||
serviceConfig.setSystemName("Python程序设计实训系统"); |
||||
serviceConfig.setIsShow(0); |
||||
serviceConfigList.add(serviceConfig); |
||||
HashMap<String, Object> coursePC = courseService.addCoursePC(serviceConfigList); |
||||
for (String s : coursePC.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + coursePC.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 添加项目环节 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void addCourseLinkTest(){ |
||||
List<CourseLink> courseLinkList = new ArrayList<>(); |
||||
CourseLink courseLink = new CourseLink(); |
||||
courseLink.setCourseId(85); |
||||
courseLink.setLinkId(87); |
||||
courseLink.setFileLink("http://liuwanr.oss-cn-shenzhen.aliyuncs.com/py/20200814/1597370762315.py"); |
||||
courseLink.setLinkName("测试环节"); |
||||
courseLink.setProjectId(292); |
||||
courseLinkList.add(courseLink); |
||||
HashMap<String, Object> addCourseLink = courseService.addCourseLink(courseLinkList); |
||||
for (String s : addCourseLink.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + addCourseLink.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询课程 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryCourseTest(){ |
||||
Course course = new Course(); |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> queryCourse = courseService.queryCourse(course, pageNo, pageSize); |
||||
for (String s : queryCourse.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + queryCourse.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询课程详情 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryCourseDetailsTest(){ |
||||
Integer courseId = 85; |
||||
HashMap<String, Object> courseDetails = courseService.queryCourseDetails(courseId); |
||||
for (String s : courseDetails.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + courseDetails.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询课程名称是否存在 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryCourseNameIsExists(){ |
||||
String courseName = "测试课程"; |
||||
HashMap<String, Object> isExists = courseService.queryCourseNameIsExists(courseName); |
||||
for (String s : isExists.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + isExists.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查询课程详情课程权限 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryCourseDetailsTCTest(){ |
||||
Integer courseId = 85; |
||||
Integer pageNo = 1; |
||||
Integer pageSize = 10; |
||||
HashMap<String, Object> detailsTC = courseService.queryCourseDetailsTC(courseId, pageNo, pageSize); |
||||
for (String s : detailsTC.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + detailsTC.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除课程 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void deleteCourseTest(){ |
||||
List<Integer> courseIds = new ArrayList<>(); |
||||
courseIds.add(85); |
||||
HashMap<String, Object> deleteCourse = courseService.deleteCourse(courseIds); |
||||
for (String s : deleteCourse.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + deleteCourse.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新课程 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void updateCourseTest(){ |
||||
Course course = new Course(); |
||||
course.setCourseId(87); |
||||
course.setCourseHours(1); |
||||
course.setCourseIntroduction("简介"); |
||||
course.setCourseName("呵呵"); |
||||
course.setCourseType(1); |
||||
course.setDisciplineId(1); |
||||
course.setMarketPrice(2); |
||||
course.setProfessionalClassId(1); |
||||
course.setProfessionalId(1); |
||||
course.setSystemId("1"); |
||||
course.setTeachingGoal("目标"); |
||||
HashMap<String, Object> updateCourse = courseService.updateCourse(course); |
||||
for (String s : updateCourse.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + updateCourse.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 修改课程实训配置 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void updateCoursePCTest(){ |
||||
ServiceConfig serviceConfig = new ServiceConfig(); |
||||
serviceConfig.setCourseId(85); |
||||
serviceConfig.setProjectId(289); |
||||
serviceConfig.setProjectName("练习项目二:基础语法训练——初阶(数据转换与拼接)"); |
||||
serviceConfig.setSystemId(1); |
||||
serviceConfig.setSystemName("Python程序设计实训系统"); |
||||
serviceConfig.setIsShow(0); |
||||
HashMap<String, Object> coursePC = courseService.updateCoursePC(serviceConfig); |
||||
for (String s : coursePC.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + coursePC.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 删除课程实训配置 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void deleteCoursePCTest(){ |
||||
Integer courseId = 85; |
||||
HashMap<String, Object> coursePC = courseService.deleteCoursePC(courseId); |
||||
for (String s : coursePC.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + coursePC.get(s)); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 查看学科类别 |
||||
*/ |
||||
@Test |
||||
@Transactional |
||||
public void queryCourseDisciplineTest(){ |
||||
HashMap<String, Object> discipline = courseService.queryCourseDiscipline(); |
||||
for (String s : discipline.keySet()) { |
||||
System.out.println("key:" + s + "," + "value:" + discipline.get(s)); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue