@ -67,10 +67,11 @@ public class AssesmentService {
/ * *
* 创建考核
*
* @return
* /
@Transactional
public HashMap < String , Object > addAssesment ( Assesment assesment , List < Integer > studentIds ) {
public HashMap < String , Object > addAssesment ( Assesment assesment , List < Integer > studentIds ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
//转换时间格式
@ -91,10 +92,10 @@ public class AssesmentService {
//得到考核id
Integer assesmentId = assesment . getId ( ) ;
String name = assesment . getAssesmentName ( ) ;
Integer number = mapper . getByAssesmentName ( name ) ;
if ( number ! = null & & number > 0 ) {
name + = ( number + 1 ) ;
String name = assesment . getAssesmentName ( ) ;
Integer number = mapper . getByAssesmentName ( name ) ;
if ( number ! = null & & number > 0 ) {
name + = ( number + 1 ) ;
assesment . setAssesmentName ( name ) ;
}
@ -143,14 +144,14 @@ public class AssesmentService {
* /
public HashMap < String , Object > queryGetById ( Integer id ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > obj = new HashMap < > ( ) ;
HashMap < String , Object > obj = new HashMap < > ( ) ;
try {
//考核信息
Assesment assesment = mapper . queryGetById ( id ) ;
//之前选中的学生
List < Student > students = mapper . queryStudent ( id ) ;
obj . put ( "assesment" , assesment ) ;
obj . put ( "students" , students ) ;
obj . put ( "assesment" , assesment ) ;
obj . put ( "students" , students ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retcode" , 200 ) ;
@ -166,6 +167,7 @@ public class AssesmentService {
/ * *
* 修改考核管理
*
* @return
* /
@Transactional
@ -215,10 +217,10 @@ public class AssesmentService {
Integer pointNumber = mapper . queryPointNumber ( assesment . getExperimentId ( ) ) ;
assesment . setAssessmentNumber ( pointNumber ) ;
String name = assesment . getAssesmentName ( ) ;
Integer number = mapper . getByAssesmentName ( name ) ;
if ( number ! = null & & number > 0 ) {
name + = ( number + 1 ) ;
String name = assesment . getAssesmentName ( ) ;
Integer number = mapper . getByAssesmentName ( name ) ;
if ( number ! = null & & number > 0 ) {
name + = ( number + 1 ) ;
assesment . setAssesmentName ( name ) ;
}
@ -267,6 +269,7 @@ public class AssesmentService {
/ * *
* 修改考核状态
*
* @return
* /
public HashMap < String , Object > updateState ( Assesment assesment ) {
@ -315,13 +318,14 @@ public class AssesmentService {
/ * *
* 查询实验班级一级栏目
*
* @param staffId : 教师id
* @return
* /
public HashMap < String , Object > queryCretionTime ( Integer staffId , Integer schoolId ) {
public HashMap < String , Object > queryCretionTime ( Integer staffId , Integer schoolId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
resp . put ( "retvalue" , mapper . queryCreationTime ( staffId , schoolId ) ) ;
resp . put ( "retvalue" , mapper . queryCreationTime ( staffId , schoolId ) ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
@ -339,10 +343,10 @@ public class AssesmentService {
* @param cretionTime
* @return
* /
public HashMap < String , Object > queryCretionTime ( String cretionTime , Integer staffId , Integer schoolId ) {
public HashMap < String , Object > queryCretionTime ( String cretionTime , Integer staffId , Integer schoolId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
resp . put ( "retvalue" , mapper . queryExperimentalClass ( cretionTime , staffId , schoolId ) ) ;
resp . put ( "retvalue" , mapper . queryExperimentalClass ( cretionTime , staffId , schoolId ) ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
@ -356,6 +360,7 @@ public class AssesmentService {
/ * *
* 考核信息展示
*
* @param assesmentId
* @return
* /
@ -386,8 +391,8 @@ public class AssesmentService {
try {
List < ExperimentalClass > experimentalClasses = mapper . queryExperimental ( assesmentId ) ;
List < SutdentClass > classes = mapper . queryClass ( assesmentId ) ;
obj . put ( "xperimentalClass" , experimentalClasses ) ;
obj . put ( "class" , classes ) ;
obj . put ( "xperimentalClass" , experimentalClasses ) ;
obj . put ( "class" , classes ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retcode" , 200 ) ;
@ -404,59 +409,63 @@ public class AssesmentService {
/ * *
* 成绩概况
* /
public HashMap < String , Object > queryScore ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
public HashMap < String , Object > queryScore ( Integer assesmentId , Integer experimentalClassId , Integer classId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
Score score = new Score ( ) ;
Score score ;
List < Student > students = null ;
int size = 0 ;
try {
List < Integer > scores = mapper . queryScore ( assesmentId , experimentalClassId , classId ) ;
if ( scores . size ( ) > 0 ) {
if ( experimentalClassId ! = null ) {
students = mapper . getByExperimentalClassId ( experimentalClassId ) ;
} else if ( classId ! = null ) {
students = mapper . getByclassId ( classId ) ;
}
//判分点数量
Integer pointNumber = mapper . getAssesmentNumber ( assesmentId ) ;
if ( StringUtils . isEmpty ( pointNumber ) ) {
pointNumber = 0 ;
}
if ( ! students . isEmpty ( ) & & students . size ( ) > 0 ) {
List < Integer > scores = mapper . queryScore ( assesmentId , students ) ;
score = new Score ( ) ;
if ( ! scores . isEmpty ( ) & & scores . size ( ) > 0 ) {
size = scores . size ( ) ;
//最低分
score . setMin ( scores . get ( 0 ) ) ;
//最高分
score . setMax ( scores . get ( size - 1 ) ) ;
//考核人数
score . setPeopleSize ( size ) ;
//中位数
double median = 0 . 0 ;
score . setMin ( scores . get ( 0 ) ) ; //最低分
score . setMax ( scores . get ( size - 1 ) ) ; //最高分
score . setPeopleSize ( size ) ; //考核人数
double median = 0 . 0 ; //中位数
if ( size % 2 = = 1 ) {
median = scores . get ( ( size - 1 ) / 2 ) ;
} else {
median = ( scores . get ( ( size / 2 - 1 ) ) + scores . get ( size / 2 ) + 0 . 0 ) / 2 ;
}
score . setMedian ( median ) ;
//平均分
int avg = 0 ;
int avg = 0 ; //平均分
for ( int i = 0 ; i < scores . size ( ) ; i + + ) {
avg + = scores . get ( i ) ;
}
score . setAvg ( avg * 1 . 0 / size ) ;
} else {
//最低分
score . setMin ( 0 ) ;
//最高分
score . setMax ( 0 ) ;
//考核人数
score . setPeopleSize ( size ) ;
//中位数
score . setMedian ( 0 ) ;
//平均分
score . setAvg ( 0 ) ;
}
Integer pointNumber = mapper . getAssesmentNumber ( assesmentId ) ;
if ( StringUtils . isEmpty ( pointNumber ) ) {
score . setPointNumber ( 0 ) ;
} else {
score . setMin ( 0 ) ; //最低分
score . setMax ( 0 ) ; //最高分
score . setPeopleSize ( size ) ; //考核人数
score . setMedian ( 0 ) ; //中位数
score . setAvg ( 0 ) ; //平均分
}
score . setPointNumber ( pointNumber ) ;
//错误率
Integer classError = mapper . queryRight ( assesmentId , experimentalClassId , classId ) ;
if ( StringUtils . isEmpty ( classError ) | | size = = 0 ) {
Integer classError = mapper . queryRight ( assesmentId , experimentalClassId , classId ) ;
if ( StringUtils . isEmpty ( classError ) | | size = = 0 ) {
score . setError ( 0 ) ;
} else {
double error = ( classError * 1 . 0 / ( size * pointNumber ) ) * 100 ;
} else {
double error = ( classError * 1 . 0 / ( size * pointNumber ) ) * 100 ;
score . setError ( error ) ;
}
} else {
score = new Score ( 0 . 0 , 0 . 0 , 0 , 0 , 0 , pointNumber , 0 . 0 ) ;
}
resp . put ( "retvalue" , score ) ;
@ -607,6 +616,7 @@ public class AssesmentService {
/ * *
* 开启考核
*
* @param courseId
* @return
* /