@ -20,266 +20,274 @@ import com.yipin.liuwanr.vo.ExperimentalClassVo;
@Service
@Service
public class ExperimentalClassService {
public class ExperimentalClassService {
private static Logger logger = Logger . getLogger ( ExperimentalClassService . class ) ;
private static Logger logger = Logger . getLogger ( ExperimentalClassService . class ) ;
@Autowired
@Autowired
private ExperimentalClassMapper experimentalClassMapper ;
private ExperimentalClassMapper experimentalClassMapper ;
@Autowired
@Autowired
private TeacherProjectAndCourseMapper projectAndCourseMapper ;
private TeacherProjectAndCourseMapper projectAndCourseMapper ;
//实验班级添加学生
//实验班级添加学生
public HashMap < String , Object > experimentClassAddStudent ( List < Student > studentList ) {
public HashMap < String , Object > experimentClassAddStudent ( List < Student > studentList ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
Integer size = studentList . size ( ) ;
Integer size = studentList . size ( ) ;
try {
try {
for ( int i = 0 ; i < size ; i + + ) {
for ( int i = 0 ; i < size ; i + + ) {
Student student = studentList . get ( i ) ;
Student student = studentList . get ( i ) ;
Integer studentId = student . getStudentId ( ) ;
Integer studentId = student . getStudentId ( ) ;
String experimentalClassId = student . getExperimentalClassId ( ) ;
String experimentalClassId = student . getExperimentalClassId ( ) ;
if ( studentId = = null ) {
if ( studentId = = null ) {
resp . put ( "retcode" , 300 ) ;
resp . put ( "retcode" , 300 ) ;
resp . put ( "retvalue" , "学生为空!" ) ;
resp . put ( "retvalue" , "学生为空!" ) ;
} else if ( experimentalClassId = = null | | experimentalClassId = = "" ) {
} else if ( experimentalClassId = = null | | experimentalClassId = = "" ) {
resp . put ( "retcode" , 300 ) ;
resp . put ( "retcode" , 300 ) ;
resp . put ( "retvalue" , "实验班级为空!" ) ;
resp . put ( "retvalue" , "实验班级为空!" ) ;
} else {
} else {
experimentalClassMapper . experimentClassAddStudent ( student ) ;
experimentalClassMapper . experimentClassAddStudent ( student ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
}
}
}
}
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "添加学生失败!" ) ;
resp . put ( "retvalue" , "添加学生失败!" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
//实验班级删除学生
//实验班级删除学生
public HashMap < String , Object > experimentClassDeleteStudent ( List < Student > student ) {
public HashMap < String , Object > experimentClassDeleteStudent ( List < Student > student ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
for ( int i = 0 ; i < student . size ( ) ; i + + ) {
for ( int i = 0 ; i < student . size ( ) ; i + + ) {
Student stu = student . get ( i ) ;
Student stu = student . get ( i ) ;
experimentalClassMapper . experimentClassDeleteStudent ( stu ) ;
experimentalClassMapper . experimentClassDeleteStudent ( stu ) ;
}
}
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "删除学生失败" ) ;
resp . put ( "retvalue" , "删除学生失败" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
//创建实验班级
//创建实验班级
public HashMap < String , Object > addExperimentalClass ( ExperimentalClass experimentalClass ) {
public HashMap < String , Object > addExperimentalClass ( ExperimentalClass experimentalClass ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
experimentalClassMapper . addExperimentalClass ( experimentalClass ) ;
experimentalClassMapper . addExperimentalClass ( experimentalClass ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "创建实验班级失败!" ) ;
throw e ;
}
return resp ;
}
public HashMap < String , Object > queryExperimentalClass ( Integer schoolId ) {
//给实验班级绑定项目
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
Integer experimentalClassId = experimentalClass . getExperimentalClassId ( ) ;
try {
Integer courseId = experimentalClass . getCourseId ( ) ;
resp . put ( "retvalue" , experimentalClassMapper . queryExperimentalClass ( schoolId ) ) ;
List < Integer > projectIds = projectAndCourseMapper . queryProject ( courseId ) ;
// List<ExperimentalClass> a = experimentalClassMapper.queryExperimentalClass(schoolId);
projectAndCourseMapper . addBatchTeachProject ( experimentalClassId , courseId , projectIds ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "查询实验班级失败!" ) ;
return resp ;
}
return resp ;
}
//查询实验班级专业
resp . put ( "retcode" , 200 ) ;
public HashMap < String , Object > queryExperimentalClassSP ( Integer experimentalClassId ) {
} catch ( RuntimeException e ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
logger . error ( e . getMessage ( ) ) ;
try {
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , experimentalClassMapper . queryExperimentalClassSP ( experimentalClassId ) ) ;
resp . put ( "retvalue" , "创建实验班级失败!" ) ;
resp . put ( "retcode" , 200 ) ;
throw e ;
} catch ( RuntimeException e ) {
}
logger . error ( e . getMessage ( ) ) ;
return resp ;
resp . put ( "retcode" , 500 ) ;
}
resp . put ( "retvalue" , "查询实验班级专业失败!" ) ;
return resp ;
}
return resp ;
}
//查询学生行政班级
public HashMap < String , Object > queryExperimentalClass ( Integer schoolId ) {
public HashMap < String , Object > queryStudentClass ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
resp . put ( "retvalue" , experimentalClassMapper . queryExperimentalClass ( schoolId ) ) ;
resp . put ( "retvalue" , experimentalClassMapper . queryStudentClass ( experimentalClassId ) ) ;
List < ExperimentalClass > a = experimentalClassMapper . queryExperimentalClass ( schoolId ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "查询学生行政 班级失败!" ) ;
resp . put ( "retvalue" , "查询实验 班级失败!" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
/ * *
//查询实验班级专业
* 班级详情
public HashMap < String , Object > queryExperimentalClassSP ( Integer experimentalClassId ) {
* @param student
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
* @param courseId
try {
* @return
resp . put ( "retvalue" , experimentalClassMapper . queryExperimentalClassSP ( experimentalClassId ) ) ;
* /
resp . put ( "retcode" , 200 ) ;
public HashMap < String , Object > queryExperimentalClassDetails ( Student student , Integer courseId ) {
} catch ( RuntimeException e ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
logger . error ( e . getMessage ( ) ) ;
try {
resp . put ( "retcode" , 500 ) ;
//学生信息
resp . put ( "retvalue" , "查询实验班级专业失败!" ) ;
List < Student > students = experimentalClassMapper . getExperimentalClassDetails ( student ) ;
return resp ;
//考勤数量
}
List < Project_Management > project = projectAndCourseMapper . getBySystemId ( courseId , 0 , 0 ) ;
return resp ;
int denominator = project . size ( ) ;
}
for ( int i = 0 ; i < students . size ( ) ; i + + ) {
Student stu = students . get ( i ) ;
Integer studentId = stu . getStudentId ( ) ;
int molecule = experimentalClassMapper . getAttendance ( studentId , courseId ) ;
stu . setAttendance ( molecule + "/" + denominator ) ;
}
resp . put ( "retvalue" , students ) ;
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 > queryStudentClass ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
resp . put ( "retvalue" , experimentalClassMapper . queryStudentClass ( 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 > queryexperimentalClass ( Integer experimentalClassId ) {
* 班级详情
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
*
HashMap < String , Object > obj = new HashMap < String , Object > ( ) ;
* @param student
try {
* @param courseId
List < ExperimentalClass > classes = experimentalClassMapper . queryExperimentalClassDetails1 ( experimentalClassId ) ;
* @return
List < Student > students = experimentalClassMapper . querystudent ( experimentalClassId ) ;
* /
obj . put ( "experimentalClass" , classes ) ;
public HashMap < String , Object > queryExperimentalClassDetails ( Student student , Integer courseId ) {
obj . put ( "students" , students ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
Integer experimentalClassId = Integer . parseInt ( student . getExperimentalClassId ( ) ) ;
//学生信息
List < Student > students = experimentalClassMapper . getExperimentalClassDetails ( student ) ;
//考勤数量
List < Project_Management > project = projectAndCourseMapper . getBySystemId ( courseId , experimentalClassId ) ;
int denominator = project . size ( ) ;
for ( int i = 0 ; i < students . size ( ) ; i + + ) {
Student stu = students . get ( i ) ;
Integer studentId = stu . getStudentId ( ) ;
int molecule = experimentalClassMapper . getAttendance ( studentId , courseId ) ;
stu . setAttendance ( molecule + "/" + denominator ) ;
}
resp . put ( "retvalue" , students ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "查询班级详情失败!" ) ;
return resp ;
}
return resp ;
}
resp . put ( "retvalue" , obj ) ;
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 > queryexperimentalClass ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > obj = new HashMap < String , Object > ( ) ;
try {
List < ExperimentalClass > classes = experimentalClassMapper . queryExperimentalClassDetails1 ( experimentalClassId ) ;
List < Student > students = experimentalClassMapper . querystudent ( experimentalClassId ) ;
obj . put ( "experimentalClass" , classes ) ;
obj . put ( "students" , students ) ;
resp . put ( "retvalue" , obj ) ;
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 > getProfessionals ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
List < Professional > professionals = experimentalClassMapper . getProfessionals ( experimentalClassId ) ;
resp . put ( "retvalue" , professionals ) ;
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 > getProfessionals ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
List < Professional > professionals = experimentalClassMapper . getProfessionals ( experimentalClassId ) ;
resp . put ( "retvalue" , professionals ) ;
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 > getStudentClass ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
List < StuProfessionalArchitecture > professionals = experimentalClassMapper . getStudentClass ( experimentalClassId ) ;
resp . put ( "retvalue" , professionals ) ;
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 > getStudentClass ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
List < StuProfessionalArchitecture > professionals = experimentalClassMapper . getStudentClass ( experimentalClassId ) ;
resp . put ( "retvalue" , professionals ) ;
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 > deleteExperimentalClass ( Integer experimentalClassId ) {
public HashMap < String , Object > deleteExperimentalClass ( Integer experimentalClassId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
experimentalClassMapper . deleteExperimentalClass ( experimentalClassId ) ;
experimentalClassMapper . deleteExperimentalClass ( experimentalClassId ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "删除实验班级失败!" ) ;
resp . put ( "retvalue" , "删除实验班级失败!" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
public HashMap < String , Object > updateExperimentalClass ( ExperimentalClass experimentalClass ) {
public HashMap < String , Object > updateExperimentalClass ( ExperimentalClass experimentalClass ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
experimentalClassMapper . updateExperimentalClass ( experimentalClass ) ;
experimentalClassMapper . updateExperimentalClass ( experimentalClass ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "更新实验班级失败!" ) ;
resp . put ( "retvalue" , "更新实验班级失败!" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
//修改实验班级名称
//修改实验班级名称
public HashMap < String , Object > updateExperimentClassName ( ExperimentalClass experimentalClass ) {
public HashMap < String , Object > updateExperimentClassName ( ExperimentalClass experimentalClass ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
experimentalClassMapper . updateExperimentClassName ( experimentalClass ) ;
experimentalClassMapper . updateExperimentClassName ( experimentalClass ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "修改实验班级名称失败!" ) ;
resp . put ( "retvalue" , "修改实验班级名称失败!" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
//——————————————————————————————全承珠
public HashMap < String , Object > queryGetByExperimentalClassName ( String experimentalClassName ) {
//——————————————————————————————全承珠
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
public HashMap < String , Object > queryGetByExperimentalClassName ( String experimentalClassName ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
resp . put ( "retvalue" , experimentalClassMapper . queryGetByExperimentalClassName ( experimentalClassName ) ) ;
resp . put ( "retvalue" , experimentalClassMapper . queryGetByExperimentalClassName ( experimentalClassName ) ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "Inquiry Failed" ) ;
resp . put ( "retvalue" , "Inquiry Failed" ) ;
return resp ;
return resp ;
}
}
return resp ;
return resp ;
}
}
}
}