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