Merge branch 'master' of D:\liuwanr with conflicts.

master
zhiyong.ning 4 years ago
parent e4401c2916
commit dc632fe369
  1. 4
      src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java
  2. 9
      src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java
  3. 6
      src/main/java/com/yipin/liuwanr/mapper/ExperimentallearningMapper.java
  4. 17
      src/main/java/com/yipin/liuwanr/service/ExperimentalClassService.java
  5. 28
      src/main/java/com/yipin/liuwanr/service/ExperimentallearningService.java
  6. 28
      src/test/java/com/yipin/liuwanr/AliyunOssServiceTest.java

@ -297,7 +297,7 @@ public class ExperimentalClassController {
Integer schoolId = experimentalClass.getSchoolId();
if (schoolId==null) {
resp.setStatus(300);
resp.setErrmessage("Parameter Invalid");
resp.setErrmessage("学校为空,新增失败!");
}else {
HashMap<String, Object> ret = classService.addExperimentalClass(experimentalClass);
Integer experimentalClassId = experimentalClass.getExperimentalClassId();
@ -336,7 +336,7 @@ public class ExperimentalClassController {
Integer experimentalClassId = experimentalClass.getExperimentalClassId();
if (experimentalClassId==null) {
resp.setStatus(300);
resp.setErrmessage("Parameter cannot be empty");
resp.setErrmessage("实验班级为空,删除失败!");
}else {
HashMap<String, Object> ret = classService.deleteExperimentalClass(experimentalClassId);
int status = (int) ret.get("retcode");

@ -14,8 +14,8 @@ import com.yipin.liuwanr.entity.Professional;
import com.yipin.liuwanr.entity.StuProfessionalArchitecture;
import com.yipin.liuwanr.entity.Student;
public interface ExperimentalClassMapper {
public interface ExperimentalClassMapper {
@Insert("INSERT INTO experimental_class_student(studentId,experimentalClassId)"
+ "VALUES(#{studentId},#{experimentalClassId})")
void experimentClassAddStudent(Student student);
@ -28,7 +28,7 @@ public interface ExperimentalClassMapper {
+ "VALUES(#{experimentalClassName},#{classSize},now(),#{founder},#{courseId},0,#{userId},#{schoolId})")
@Options(useGeneratedKeys=true, keyProperty="experimentalClassId", keyColumn="experimentalClassId")
void addExperimentalClass(ExperimentalClass experimentalClass);
@Select({"<script>",
"SELECT experimentalClassId,experimentalClassName,classSize,creationTime,founder,courseId,userId,schoolId "
+ "from experimental_class_ning where isdel = 0 and schoolId = #{schoolId} and courseId=#{courseId}",
@ -63,7 +63,10 @@ public interface ExperimentalClassMapper {
@Update("UPDATE experimental_class_ning SET isdel = 1 where experimentalClassId = #{experimentalClassId}")
void deleteExperimentalClass(Integer experimentalClassId);
@Delete("Delete from experimental_class_student where experimentalClassId = #{experimentalClassId}")
void deleteExperimentalClassStu(Integer experimentalClassId);
@Update("UPDATE experimental_class_ning SET experimentalClassName = #{experimentalClassName},classSize = #{classSize},practiceNumber = #{practiceNumber},inspectionNumber = #{inspectionNumber},courseSchedule = #{courseSchedule},founder = #{founder},courseId = #{courseId} where experimentalClassId = #{experimentalClassId}")
void updateExperimentalClass(ExperimentalClass experimentalClass);

@ -68,8 +68,8 @@ public interface ExperimentallearningMapper {
* @param studentId
* @return
*/
@Select("select ecn.experimentalClassId from experimental_class_ning ecn left join experimental_class_student ecs on ecn.experimentalClassId=ecs.experimentalClassId where\n" +
"ecn.courseId=#{courseId} and ecs.studentId=#{studentId} GROUP BY ecn.experimentalClassId")
@Select("select ecn.experimentalClassId from experimental_class_ning ecn left join experimental_class_student ecs on ecn.experimentalClassId=ecs.experimentalClassId where " +
"ecn.courseId=#{courseId} and ecs.studentId=#{studentId} and ecn.isdel=0 GROUP BY ecn.experimentalClassId")
Integer queryExperimentalClassId(@Param("courseId") Integer courseId,@Param("studentId")Integer studentId);
/**
@ -123,6 +123,6 @@ public interface ExperimentallearningMapper {
@Select("select DISTINCT hpm.projectId,projectName,isAttendance from hr_project_management hpm left join teacher_project tp on hpm.projectId=tp.projectId " +
" where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId} and tp.isOpenProject=0 and hpm.isShow=0")
" where tp.courseId=#{courseId} and tp.experimentalClassId=#{experimentalClassId} and tp.isOpenProject=0")
List<Project_Management> getBycourseId(@Param("experimentalClassId")Integer experimentalClassId,@Param("courseId") Integer courseId);
}

@ -233,11 +233,12 @@ public class ExperimentalClassService {
return resp;
}
//删除实验班级和删除实验班级下所有学生
public HashMap<String, Object> deleteExperimentalClass(Integer experimentalClassId) {
HashMap<String, Object> resp = new HashMap<String, Object>();
try {
experimentalClassMapper.deleteExperimentalClass(experimentalClassId);
experimentalClassMapper.deleteExperimentalClassStu(experimentalClassId);
resp.put("retcode", 200);
} catch (RuntimeException e) {
logger.error(e.getMessage());
@ -247,6 +248,20 @@ public class ExperimentalClassService {
}
return resp;
}
//删除实验班级下的所有学生
// public HashMap<String, Object> deleteExperimentalClassStu(Integer experimentalClassId) {
// HashMap<String, Object> resp = new HashMap<String, Object>();
// try {
// experimentalClassMapper.deleteExperimentalClassStu(experimentalClassId);
// resp.put("retcode", 200);
// } catch (RuntimeException e) {
// logger.error(e.getMessage());
// resp.put("retcode", 500);
// resp.put("retvalue", "删除实验班级失败!");
// return resp;
// }
// return resp;
// }
public HashMap<String, Object> updateExperimentalClass(ExperimentalClass experimentalClass) {
HashMap<String, Object> resp = new HashMap<String, Object>();

@ -44,10 +44,11 @@ public class ExperimentallearningService {
try {
if(!StringUtils.isEmpty(courseId)&&!StringUtils.isEmpty(studentId)){
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
List<Project_Management> projects = mapper.getBycourseId(experimentalClassId,courseId);
for (int i = 0; i < projects.size(); i++) {
Project_Management project = projects.get(i);
if(!StringUtils.isEmpty(experimentalClassId)){
List<Integer> projectIds = mapper.queryIsAttendance(studentId, courseId);
List<Project_Management> projects = mapper.getBycourseId(experimentalClassId,courseId);
for (int i = 0; i < projects.size(); i++) {
Project_Management project = projects.get(i);
// 教师那边开启了考勤,学生这边才可以有是否已经签到
if (project.getIsAttendance() == 1) {
// 判断该学生签到的项目,是否在开启的项目中
@ -58,8 +59,9 @@ public class ExperimentallearningService {
}
projects.set(i, project);
}
}
resp.put("retvalue", projects);
}
resp.put("retvalue", projects);
}
resp.put("retcode", 200);
}catch(Exception e){
@ -107,9 +109,11 @@ public class ExperimentallearningService {
if(!StringUtils.isEmpty(courseId)){
//实验班级
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
//学生信息
List<UserM> users =mapper.queryStudentName(experimentalClassId);
resp.put("retvalue", users);
if(!StringUtils.isEmpty(experimentalClassId)){
//学生信息
List<UserM> users =mapper.queryStudentName(experimentalClassId);
resp.put("retvalue", users);
}
}
resp.put("retcode", 200);
} catch (Exception e) {
@ -130,9 +134,11 @@ public class ExperimentallearningService {
if(!StringUtils.isEmpty(courseId)){
//实验班级
Integer experimentalClassId=mapper.queryExperimentalClassId(courseId,studentId);
//教师信息
UserM user =mapper.queryTeacherName(experimentalClassId);
resp.put("retvalue",user);
if(!StringUtils.isEmpty(experimentalClassId)){
//教师信息
UserM user =mapper.queryTeacherName(experimentalClassId);
resp.put("retvalue",user);
}
}
resp.put("retcode", 200);
} catch (Exception e) {

@ -34,20 +34,20 @@ public class AliyunOssServiceTest {
/**
* 测试上传文件
*/
@Test
public void testUploadFiles() throws IOException {
File file = new File("D:\\pic\\1.jpg");
FileItem fileItem = new DiskFileItem("file",
Files.probeContentType(file.toPath()),
false,
file.getName(),
(int) file.length(),
file.getParentFile());
IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream());
MultipartFile multipartFile = new CommonsMultipartFile(fileItem);
HashMap<String, Object> map = aliyunOssService.uploadFiles(multipartFile);
map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
}
// @Test
// public void testUploadFiles() throws IOException {
// File file = new File("D:\\pic\\1.jpg");
// FileItem fileItem = new DiskFileItem("file",
// Files.probeContentType(file.toPath()),
// false,
// file.getName(),
// (int) file.length(),
// file.getParentFile());
// IOUtils.copy(new FileInputStream(file), fileItem.getOutputStream());
// MultipartFile multipartFile = new CommonsMultipartFile(fileItem);
// HashMap<String, Object> map = aliyunOssService.uploadFiles(multipartFile);
// map.forEach((key, value) -> System.out.println("key = " + key + " ===> value = " + value.toString()));
// }
/**
* 测试下载文件

Loading…
Cancel
Save