projectAndCourseService test end

master
river 4 years ago
parent ff77ad9750
commit b86bf250e5
  1. 15
      src/main/java/com/yipin/liuwanr/entity/Project_Management.java
  2. 165
      src/test/java/com/yipin/liuwanr/service/MakeuplistServiceTest.java
  3. 120
      src/test/java/com/yipin/liuwanr/service/ProjectAndCourseServiceTest.java
  4. 93
      src/test/java/com/yipin/liuwanr/service/StaffGradServiceTest.java

@ -30,6 +30,21 @@ public class Project_Management {
private Integer isAttendance;
private Integer signin;//是否签到
public Project_Management(){
}
public Project_Management(Integer isOpenProject,Integer projectId){
this.isOpenProject = isOpenProject;
this.projectId = projectId;
}
public Project_Management(Integer projectId,Integer isAttendance,Integer founder){
this.projectId = projectId;
this.isAttendance = isAttendance;
this.founder = founder;
}
private List<CourseLink> courseLinks;
public List<CourseLink> getCourseLinks() {

@ -0,0 +1,165 @@
package com.yipin.liuwanr.service;
import org.apache.commons.io.IOUtils;
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.lang.Nullable;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.HashMap;
/**
* @auther River
* @date 2020/8/19 9:39
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class MakeuplistServiceTest {
@Autowired
private MakeuplistService makeuplistService;
/**
* 查询数据
*/
@Test
@Transactional
public void queryAllMakeuplistTest(){
Integer staffId = 1;
long uploadTime = 0L;
Integer uploadType = 1;
Integer schoolId = 5;
String time = "2020-07-24 18:51";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
uploadTime = sdf.parse(time).getTime() / 1000;
} catch (ParseException e) {
e.printStackTrace();
}
HashMap<String, Object> queryAllMakeuplist = makeuplistService.queryAllMakeuplist(staffId, uploadTime, uploadType, schoolId);
for (String s : queryAllMakeuplist.keySet()) {
System.out.println("key:" + s + "," + "value:" + queryAllMakeuplist.get(s));
}
}
/**
* 获取学生信息
*/
@Test
@Transactional
public void getStudentTest(){
Integer staffId = 1;
long uploadTime = 0L;
Integer uploadType = 1;
Integer schoolId = 5;
String time = "2020-07-24 18:51";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
uploadTime = sdf.parse(time).getTime() / 1000;
} catch (ParseException e) {
e.printStackTrace();
}
HashMap<String, Object> student = makeuplistService.getStudent(staffId, uploadTime, uploadType, schoolId);
for (String s : student.keySet()) {
System.out.println("key:" + s + "," + "value:" + student.get(s));
}
}
/**
* 获取补考信息
*/
@Test
@Transactional
public void getByMakeuplistTest(){
Integer staffId = 1;
long uploadTime = 0L;
Integer uploadType = 1;
Integer schoolId = 5;
String time = "2020-07-24 18:51";
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
uploadTime = sdf.parse(time).getTime() / 1000;
} catch (ParseException e) {
e.printStackTrace();
}
HashMap<String, Object> makeuplist = makeuplistService.getByMakeuplist(staffId, uploadTime, uploadType, schoolId);
for (String s : makeuplist.keySet()) {
System.out.println("key:" + s + "," + "value:" + makeuplist.get(s));
}
}
/**
* 导入数据
*/
@Test
@Transactional
public void addMakeuplistTest(){
MultipartFile file = new MultipartFile() {
@Override
public String getName() {
return null;
}
@Nullable
@Override
public String getOriginalFilename() {
return null;
}
@Nullable
@Override
public String getContentType() {
return null;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public long getSize() {
return 0;
}
@Override
public byte[] getBytes() throws IOException {
return new byte[0];
}
@Override
public InputStream getInputStream() throws IOException {
return null;
}
@Override
public void transferTo(File dest) throws IOException, IllegalStateException {
}
};
Integer schoolId = 5;
Integer staffId = 1;
long uploadTime = 0L;
String time = "2020-07-24 18:51";
File file1 = new File("C:\\Users\\Hello\\Desktop\\aaaa.xlsx");
try {
//将file类型文件转换为MultipartFile类型文件
FileInputStream input = new FileInputStream(file1);
file = new MockMultipartFile("file", file1.getName(), "text/plain", IOUtils.toByteArray(input));
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
try {
uploadTime = sdf.parse(time).getTime() / 1000;
} catch (ParseException e) {
e.printStackTrace();
}
HashMap<String, Object> makeuplist = makeuplistService.addMakeuplist(file, schoolId, staffId, uploadTime);
for (String s : makeuplist.keySet()) {
System.out.println("key:" + s + "," + "value:" + makeuplist.get(s));
}
}
}

@ -0,0 +1,120 @@
package com.yipin.liuwanr.service;
import com.yipin.liuwanr.entity.CourseSchedule;
import com.yipin.liuwanr.entity.Project_Management;
import com.yipin.liuwanr.vo.CourseAndProjectVo;
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.HashMap;
/**
* @auther River
* @date 2020/8/21 11:38
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class ProjectAndCourseServiceTest {
@Autowired
private ProjectAndCourseService projectAndCourseService;
/**
* 根据课程查询实验项目信息
*/
@Test
@Transactional
public void queryProjectTest(){
Integer courseId = 77;
Integer experimentalClassId = 87;
Integer pageNo = 1;
Integer pageSize = 10;
HashMap<String, Object> project = projectAndCourseService.queryProject(courseId, experimentalClassId, pageNo, pageSize);
for (String s : project.keySet()) {
System.out.println("key:" + s + "," + "value:" + project.get(s));
}
}
/**
* 修改项目状态
*/
@Test
@Transactional
public void updateIsExperimentTest(){
CourseAndProjectVo vo = new CourseAndProjectVo();
vo.setCourseId(77);
vo.setExperimentalClassId(87);
vo.setProject(new Project_Management(1,289));
HashMap<String, Object> experiment = projectAndCourseService.updateIsExperiment(vo);
for (String s : experiment.keySet()) {
System.out.println("key:" + s + "," + "value:" + experiment.get(s));
}
}
/**
* 修改考勤状态
*/
@Test
@Transactional
public void updateIsAttendanceTest(){
CourseAndProjectVo vo = new CourseAndProjectVo();
vo.setCourseId(77);
vo.setExperimentalClassId(87);
vo.setProject(new Project_Management(1,289,null));
HashMap<String, Object> attendance = projectAndCourseService.updateIsAttendance(vo);
for (String s : attendance.keySet()) {
System.out.println("key:" + s + "," + "value:" + attendance.get(s));
}
}
/**
* 获取课程进度
*/
@Test
@Transactional
public void getCourseScheduleTest(){
Integer courseId = 77;
Integer experimentalClassId = 87;
Integer studentId = null;
HashMap<String, Object> courseSchedule = projectAndCourseService.getCourseSchedule(courseId, experimentalClassId, studentId);
for (String s : courseSchedule.keySet()) {
System.out.println("key:" + s + "," + "value:" + courseSchedule.get(s));
}
}
/**
* 添加课程进度
*/
@Test
@Transactional
public void addCourseScheduleTest(){
CourseSchedule courseSchedule = new CourseSchedule();
courseSchedule.setScheduleId(1);
courseSchedule.setProjectId(5);
courseSchedule.setCourseId(5);
courseSchedule.setExperimentalClassId(0);
HashMap<String, Object> courseSchedule1 = projectAndCourseService.addCourseSchedule(courseSchedule);
for (String s : courseSchedule1.keySet()) {
System.out.println("key:" + s + "," + "value:" + courseSchedule1.get(s));
}
}
/**
* 课程视频
*/
@Test
@Transactional
public void getCoursevideoTest(){
Integer courseId = 77;
Integer experimentalClassId = 87;
Integer studentId = null;
HashMap<String, Object> coursevideo = projectAndCourseService.getCoursevideo(courseId, experimentalClassId, studentId);
for (String s : coursevideo.keySet()) {
System.out.println("key:" + s + "," + "value:" + coursevideo.get(s));
}
}
}

@ -0,0 +1,93 @@
package com.yipin.liuwanr.service;
import com.yipin.liuwanr.entity.StaffGrade;
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.HashMap;
/**
* @auther River
* @date 2020/8/20 10:57
*/
@SpringBootTest
@RunWith(SpringRunner.class)
public class StaffGradServiceTest {
@Autowired
private StaffGradeService staffGradeService;
/**
* 添加员工年级
*/
@Test
@Transactional
public void addStaffGradeTest(){
StaffGrade staffGrade = new StaffGrade();
staffGrade.setStaffGradeName("教导处");
staffGrade.setStaffProfessionalArchitectureId(1);
HashMap<String, Object> addStaffGrade = staffGradeService.addStaffGrade(staffGrade);
for (String s : addStaffGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + addStaffGrade.get(s));
}
}
/**
* 查询员工年级
*/
@Test
@Transactional
public void queryStaffGradeTest(){
Integer staffProfessionalArchitectureId = 1;
HashMap<String, Object> staffGrade = staffGradeService.queryStaffGrade(staffProfessionalArchitectureId);
for (String s : staffGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffGrade.get(s));
}
}
/**
* 删除员工年级
*/
@Test
@Transactional
public void deleteStaffGradeTest(){
Integer staffGradeId = 1;
HashMap<String, Object> staffGrade = staffGradeService.deleteStaffGrade(staffGradeId);
for (String s : staffGrade.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffGrade.get(s));
}
}
/**
* 查询员工年级详情
*/
@Test
@Transactional
public void queryStaffGradeDetailsTest(){
Integer staffGradeId = 1;
HashMap<String, Object> staffGradeDetails = staffGradeService.queryStaffGradeDetails(staffGradeId);
for (String s : staffGradeDetails.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffGradeDetails.get(s));
}
}
/**
* 更新员工年级
*/
@Test
@Transactional
public void updateStaffGradeTest(){
StaffGrade staffGrade = new StaffGrade();
staffGrade.setStaffProfessionalArchitectureId(1);
staffGrade.setStaffGradeName("教务处");
staffGrade.setStaffGradeId(1);
HashMap<String, Object> staffGrade1 = staffGradeService.updateStaffGrade(staffGrade);
for (String s : staffGrade1.keySet()) {
System.out.println("key:" + s + "," + "value:" + staffGrade1.get(s));
}
}
}
Loading…
Cancel
Save