diff --git a/src/main/java/com/yipin/liuwanr/entity/Action.java b/src/main/java/com/yipin/liuwanr/entity/Action.java index f2cb014..d244793 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Action.java +++ b/src/main/java/com/yipin/liuwanr/entity/Action.java @@ -52,5 +52,4 @@ public class Action { this.move = move; } - } diff --git a/src/main/java/com/yipin/liuwanr/entity/Attendance.java b/src/main/java/com/yipin/liuwanr/entity/Attendance.java index 91722ec..b9923a5 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Attendance.java +++ b/src/main/java/com/yipin/liuwanr/entity/Attendance.java @@ -87,4 +87,22 @@ public class Attendance { public void setExperimentalClassId(Integer experimentalClassId) { this.experimentalClassId = experimentalClassId; } + + @Override + public String toString() { + return "Attendance{" + + "id=" + id + + ", courseId=" + courseId + + ", experimentId=" + experimentId + + ", creationTime='" + creationTime + '\'' + + ", signIn=" + signIn + + ", studentId=" + studentId + + ", experimentalClassId=" + experimentalClassId + + ", count=" + count + + ", studentName='" + studentName + '\'' + + ", experimentName='" + experimentName + '\'' + + ", absence=" + absence + + ", signInNumber=" + signInNumber + + '}'; + } } diff --git a/src/main/java/com/yipin/liuwanr/entity/PageResult.java b/src/main/java/com/yipin/liuwanr/entity/PageResult.java index 2fd4adf..605ca29 100644 --- a/src/main/java/com/yipin/liuwanr/entity/PageResult.java +++ b/src/main/java/com/yipin/liuwanr/entity/PageResult.java @@ -42,4 +42,13 @@ public class PageResult implements Serializable { public void setRows(List rows) { this.rows = rows; } + + @Override + public String toString() { + return "PageResult{" + + "total=" + total + + ", rows=" + rows + + ", totalPages=" + totalPages + + '}'; + } } diff --git a/src/main/java/com/yipin/liuwanr/entity/Student.java b/src/main/java/com/yipin/liuwanr/entity/Student.java index 4b1d068..849fa02 100644 --- a/src/main/java/com/yipin/liuwanr/entity/Student.java +++ b/src/main/java/com/yipin/liuwanr/entity/Student.java @@ -2,307 +2,221 @@ package com.yipin.liuwanr.entity; public class Student { - //学生主键ID - private Integer studentId; - //学生名称 - private String studentName; - //学生学号 - private String studentNumber; - //电话 - private String phone; - //邮箱 - private String email; - //学生绑定角色ID - private Integer roleId; - //绑定学校ID - private Integer schoolId; - //绑定专业ID - private Integer professionalId; - //绑定年级ID - private Integer gradeId; - //绑定班级ID - private Integer classId; - //外部实体实验班级名称 - private String experimentalClassName; - //外部实体实验班级ID - private String experimentalClassId; - //是否考勤 - private Integer isAssess; - //唯一标示性账号 - private String uniqueIdentificationAccount; - //搜索内容 - private String searchContent; - //多个专业ID - private String professionalIds; - //多个年级ID - private String gradeIds; - //多个班级ID - private String classIds; - //专业名称 - private String professionalName; - //年级名称 - private String gradeName; - //学生姓名和学号 - private String studentNameNumber; - //int类型实验班级ID - private Integer intExperimentalClassId; - //绑定班级名称 - private String className; - //登陆次数 - private Integer loginNumber; - //最后一次登陆时间 - private String lastLoginTime; - //考勤统计 - private String attendance; - //学生专业组织架构名称 - private String stuProfessionalArchitectureName; - - public String getStuProfessionalArchitectureName() { - return stuProfessionalArchitectureName; - } - - public void setStuProfessionalArchitectureName(String stuProfessionalArchitectureName) { - this.stuProfessionalArchitectureName = stuProfessionalArchitectureName; - } - - public String getAttendance() { - return attendance; - } - - public void setAttendance(String attendance) { - this.attendance = attendance; - } - - public Integer getLoginNumber() { - return loginNumber; - } - - public void setLoginNumber(Integer loginNumber) { - this.loginNumber = loginNumber; - } - - public String getLastLoginTime() { - return lastLoginTime; - } - - public void setLastLoginTime(String lastLoginTime) { - this.lastLoginTime = lastLoginTime; - } - - public String getClassName() { - return className; - } - - public void setClassName(String className) { - this.className = className; - } - - public Integer getIntExperimentalClassId() { - return intExperimentalClassId; - } - - public void setIntExperimentalClassId(Integer intExperimentalClassId) { - this.intExperimentalClassId = intExperimentalClassId; - } - - public String getStudentNameNumber() { - return studentNameNumber; - } - - public void setStudentNameNumber(String studentNameNumber) { - this.studentNameNumber = studentNameNumber; - } - - public String getProfessionalName() { - return professionalName; - } - - public void setProfessionalName(String professionalName) { - this.professionalName = professionalName; - } - - public String getGradeName() { - return gradeName; - } - - public void setGradeName(String gradeName) { - this.gradeName = gradeName; - } - - public String getProfessionalIds() { - return professionalIds; - } - - public void setProfessionalIds(String professionalIds) { - this.professionalIds = professionalIds; - } - - public String getGradeIds() { - return gradeIds; - } - - public void setGradeIds(String gradeIds) { - this.gradeIds = gradeIds; - } - - public String getClassIds() { - return classIds; - } - - public void setClassIds(String classIds) { - this.classIds = classIds; - } - - public String getSearchContent() { - return searchContent; - } - - public void setSearchContent(String searchContent) { - this.searchContent = searchContent; - } - - public String getUniqueIdentificationAccount() { - return uniqueIdentificationAccount; - } - - public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { - this.uniqueIdentificationAccount = uniqueIdentificationAccount; - } - - public Integer getStudentId() { - return studentId; - } - - public void setStudentId(Integer studentId) { - this.studentId = studentId; - } - - public String getStudentName() { - return studentName; - } - - public void setStudentName(String studentName) { - this.studentName = studentName; - } - - public String getStudentNumber() { - return studentNumber; - } - - public void setStudentNumber(String studentNumber) { - this.studentNumber = studentNumber; - } - - public String getPhone() { - return phone; - } - - public void setPhone(String phone) { - this.phone = phone; - } - - public String getEmail() { - return email; - } - - public void setEmail(String email) { - this.email = email; - } - - public Integer getRoleId() { - return roleId; - } - - public void setRoleId(Integer roleId) { - this.roleId = roleId; - } - - public Integer getSchoolId() { - return schoolId; - } - - public void setSchoolId(Integer schoolId) { - this.schoolId = schoolId; - } - - public Integer getProfessionalId() { - return professionalId; - } - - public void setProfessionalId(Integer professionalId) { - this.professionalId = professionalId; - } - - public Integer getGradeId() { - return gradeId; - } - - public void setGradeId(Integer gradeId) { - this.gradeId = gradeId; - } - - public Integer getClassId() { - return classId; - } - - public void setClassId(Integer classId) { - this.classId = classId; - } - - public String getExperimentalClassName() { - return experimentalClassName; - } - - public void setExperimentalClassName(String experimentalClassName) { - this.experimentalClassName = experimentalClassName; - } - - public String getExperimentalClassId() { - return experimentalClassId; - } - - public void setExperimentalClassId(String experimentalClassId) { - this.experimentalClassId = experimentalClassId; - } - - public Integer getIsAssess() { - return isAssess; - } - - public void setIsAssess(Integer isAssess) { - this.isAssess = isAssess; - } - - @Override - public String toString() { - return "Student{" + - "studentId=" + studentId + - ", studentName='" + studentName + '\'' + - ", studentNumber='" + studentNumber + '\'' + - ", phone='" + phone + '\'' + - ", email='" + email + '\'' + - ", roleId=" + roleId + - ", schoolId=" + schoolId + - ", professionalId=" + professionalId + - ", gradeId=" + gradeId + - ", classId=" + classId + - ", experimentalClassName='" + experimentalClassName + '\'' + - ", experimentalClassId='" + experimentalClassId + '\'' + - ", isAssess=" + isAssess + - ", uniqueIdentificationAccount='" + uniqueIdentificationAccount + '\'' + - ", searchContent='" + searchContent + '\'' + - ", professionalIds='" + professionalIds + '\'' + - ", gradeIds='" + gradeIds + '\'' + - ", classIds='" + classIds + '\'' + - ", professionalName='" + professionalName + '\'' + - ", gradeName='" + gradeName + '\'' + - ", studentNameNumber='" + studentNameNumber + '\'' + - ", intExperimentalClassId=" + intExperimentalClassId + - ", className='" + className + '\'' + - ", loginNumber=" + loginNumber + - ", lastLoginTime='" + lastLoginTime + '\'' + - ", attendance='" + attendance + '\'' + - ", stuProfessionalArchitectureName='" + stuProfessionalArchitectureName + '\'' + - '}'; - } + //学生主键ID + private Integer studentId; + //学生名称 + private String studentName; + //学生学号 + private String studentNumber; + //电话 + private String phone; + //邮箱 + private String email; + //学生绑定角色ID + private Integer roleId; + //绑定学校ID + private Integer schoolId; + //绑定专业ID + private Integer professionalId; + //绑定年级ID + private Integer gradeId; + //绑定班级ID + private Integer classId; + //外部实体实验班级名称 + private String experimentalClassName; + //外部实体实验班级ID + private String experimentalClassId; + //是否考勤 + private Integer isAssess; + //唯一标示性账号 + private String uniqueIdentificationAccount; + //搜索内容 + private String searchContent; + //多个专业ID + private String professionalIds; + //多个年级ID + private String gradeIds; + //多个班级ID + private String classIds; + //专业名称 + private String professionalName; + //年级名称 + private String gradeName; + //学生姓名和学号 + private String studentNameNumber; + //int类型实验班级ID + private Integer intExperimentalClassId; + //绑定班级名称 + private String className; + //登陆次数 + private Integer loginNumber; + //最后一次登陆时间 + private String lastLoginTime; + //考勤统计 + private String attendance; + //学生专业组织架构名称 + private String stuProfessionalArchitectureName; + + public String getStuProfessionalArchitectureName() { + return stuProfessionalArchitectureName; + } + public void setStuProfessionalArchitectureName(String stuProfessionalArchitectureName) { + this.stuProfessionalArchitectureName = stuProfessionalArchitectureName; + } + public String getAttendance() { + return attendance; + } + public void setAttendance(String attendance) { + this.attendance = attendance; + } + public Integer getLoginNumber() { + return loginNumber; + } + public void setLoginNumber(Integer loginNumber) { + this.loginNumber = loginNumber; + } + public String getLastLoginTime() { + return lastLoginTime; + } + public void setLastLoginTime(String lastLoginTime) { + this.lastLoginTime = lastLoginTime; + } + public String getClassName() { + return className; + } + public void setClassName(String className) { + this.className = className; + } + public Integer getIntExperimentalClassId() { + return intExperimentalClassId; + } + public void setIntExperimentalClassId(Integer intExperimentalClassId) { + this.intExperimentalClassId = intExperimentalClassId; + } + public String getStudentNameNumber() { + return studentNameNumber; + } + public void setStudentNameNumber(String studentNameNumber) { + this.studentNameNumber = studentNameNumber; + } + public String getProfessionalName() { + return professionalName; + } + public void setProfessionalName(String professionalName) { + this.professionalName = professionalName; + } + public String getGradeName() { + return gradeName; + } + public void setGradeName(String gradeName) { + this.gradeName = gradeName; + } + public String getProfessionalIds() { + return professionalIds; + } + public void setProfessionalIds(String professionalIds) { + this.professionalIds = professionalIds; + } + public String getGradeIds() { + return gradeIds; + } + public void setGradeIds(String gradeIds) { + this.gradeIds = gradeIds; + } + public String getClassIds() { + return classIds; + } + public void setClassIds(String classIds) { + this.classIds = classIds; + } + public String getSearchContent() { + return searchContent; + } + public void setSearchContent(String searchContent) { + this.searchContent = searchContent; + } + public String getUniqueIdentificationAccount() { + return uniqueIdentificationAccount; + } + public void setUniqueIdentificationAccount(String uniqueIdentificationAccount) { + this.uniqueIdentificationAccount = uniqueIdentificationAccount; + } + public Integer getStudentId() { + return studentId; + } + public void setStudentId(Integer studentId) { + this.studentId = studentId; + } + public String getStudentName() { + return studentName; + } + public void setStudentName(String studentName) { + this.studentName = studentName; + } + public String getStudentNumber() { + return studentNumber; + } + public void setStudentNumber(String studentNumber) { + this.studentNumber = studentNumber; + } + public String getPhone() { + return phone; + } + public void setPhone(String phone) { + this.phone = phone; + } + public String getEmail() { + return email; + } + public void setEmail(String email) { + this.email = email; + } + public Integer getRoleId() { + return roleId; + } + public void setRoleId(Integer roleId) { + this.roleId = roleId; + } + public Integer getSchoolId() { + return schoolId; + } + public void setSchoolId(Integer schoolId) { + this.schoolId = schoolId; + } + public Integer getProfessionalId() { + return professionalId; + } + public void setProfessionalId(Integer professionalId) { + this.professionalId = professionalId; + } + public Integer getGradeId() { + return gradeId; + } + public void setGradeId(Integer gradeId) { + this.gradeId = gradeId; + } + public Integer getClassId() { + return classId; + } + public void setClassId(Integer classId) { + this.classId = classId; + } + public String getExperimentalClassName() { + return experimentalClassName; + } + public void setExperimentalClassName(String experimentalClassName) { + this.experimentalClassName = experimentalClassName; + } + public String getExperimentalClassId() { + return experimentalClassId; + } + public void setExperimentalClassId(String experimentalClassId) { + this.experimentalClassId = experimentalClassId; + } + public Integer getIsAssess() { + return isAssess; + } + public void setIsAssess(Integer isAssess) { + this.isAssess = isAssess; + } } diff --git a/src/main/java/com/yipin/liuwanr/service/StaffService.java b/src/main/java/com/yipin/liuwanr/service/StaffService.java index 9992bc5..277e59f 100644 --- a/src/main/java/com/yipin/liuwanr/service/StaffService.java +++ b/src/main/java/com/yipin/liuwanr/service/StaffService.java @@ -44,8 +44,8 @@ public class StaffService { try { //读取excel文件中的员工信息 - List staffs=ExcelImportHelper.readStaff(file); - List users=new ArrayList(); + List staffs = ExcelImportHelper.readStaff(file); + List users = new ArrayList(); //循环员工信息,将员工信息与用户信息进行对比 for (int i = 0; i < staffs.size(); i++) { Staff staff=staffs.get(i); diff --git a/src/test/java/com/yipin/liuwanr/service/AssesmentServiceTest.java b/src/test/java/com/yipin/liuwanr/service/AssesmentServiceTest.java new file mode 100644 index 0000000..b5bd537 --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/service/AssesmentServiceTest.java @@ -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 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 studentIds = new ArrayList<>(); + studentIds.add(67); + HashMap 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 studentIds = new ArrayList<>(); + studentIds.add(67); + studentIds.add(65); + HashMap 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 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 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 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 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 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 cretionTime1 = assesmentService.queryCretionTime(staffId, schoolId); + for (String s : cretionTime1.keySet()) { + System.out.println("key:" + s + "," + "value:" + cretionTime1.get(s)); + } + HashMap 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 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 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 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 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 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 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 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 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 existis = assesmentService.isNameExistis(assesmentName); + for (String s : existis.keySet()) { + System.out.println("key:" + s + "," + "value:" + existis.get(s)); + } + } +} diff --git a/src/test/java/com/yipin/liuwanr/service/AttendanceServiceTest.java b/src/test/java/com/yipin/liuwanr/service/AttendanceServiceTest.java new file mode 100644 index 0000000..260f0fc --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/service/AttendanceServiceTest.java @@ -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 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 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 attendance = attendanceService.queryAttendance(studentId, courseId); + for (String s : attendance.keySet()) { + System.out.println("key:" + s + "," + "value:" + attendance.get(s)); + } + } +} diff --git a/src/test/java/com/yipin/liuwanr/service/CourseServiceTest.java b/src/test/java/com/yipin/liuwanr/service/CourseServiceTest.java new file mode 100644 index 0000000..3aeac85 --- /dev/null +++ b/src/test/java/com/yipin/liuwanr/service/CourseServiceTest.java @@ -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 addCourse = courseService.addCourse(course); + for (String s : addCourse.keySet()) { + System.out.println("key:" + s + "," + "value:" + addCourse.get(s)); + } + } + + /** + * 添加实训配置 + */ + @Test + @Transactional + public void addCoursePCTest(){ + List 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 coursePC = courseService.addCoursePC(serviceConfigList); + for (String s : coursePC.keySet()) { + System.out.println("key:" + s + "," + "value:" + coursePC.get(s)); + } + } + + /** + * 添加项目环节 + */ + @Test + @Transactional + public void addCourseLinkTest(){ + List 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 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 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 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 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 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 courseIds = new ArrayList<>(); + courseIds.add(85); + HashMap 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 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 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 coursePC = courseService.deleteCoursePC(courseId); + for (String s : coursePC.keySet()) { + System.out.println("key:" + s + "," + "value:" + coursePC.get(s)); + } + } + + /** + * 查看学科类别 + */ + @Test + @Transactional + public void queryCourseDisciplineTest(){ + HashMap discipline = courseService.queryCourseDiscipline(); + for (String s : discipline.keySet()) { + System.out.println("key:" + s + "," + "value:" + discipline.get(s)); + } + } +} diff --git a/src/test/resources/.gitkeep b/src/test/resources/.gitkeep deleted file mode 100644 index e69de29..0000000