@ -27,32 +27,33 @@ import com.yipin.liuwanr.vo.AssesmentStudentVo;
@Service
@Service
public class AssesmentService {
public class AssesmentService {
private static Logger logger = Logger . getLogger ( AssesmentService . class ) ;
private static Logger logger = Logger . getLogger ( AssesmentService . class ) ;
@Autowired
@Autowired
private AssesmentMapper mapper ;
private AssesmentMapper mapper ;
/ * *
/ * *
* 考核管理列表查询
* 考核管理列表查询
*
* @param assesment
* @param assesment
* @param pageNo
* @param pageNo
* @param pageSize
* @param pageSize
* @return
* @return
* /
* /
public HashMap < String , Object > queryAssesmentCondition ( Assesment assesment , Integer pageNo , Integer pageSize ) {
public HashMap < String , Object > queryAssesmentCondition ( Assesment assesment , Integer pageNo , Integer pageSize ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
PageHelper . startPage ( pageNo , pageSize ) ;
PageHelper . startPage ( pageNo , pageSize ) ;
List < Assesment > assesments = mapper . getByCondition ( assesment ) ;
List < Assesment > assesments = mapper . getByCondition ( assesment ) ;
PageInfo < Assesment > info = new PageInfo < Assesment > ( assesments ) ;
PageInfo < Assesment > info = new PageInfo < Assesment > ( assesments ) ;
int total1 = ( int ) info . getTotal ( ) ;
int total1 = ( int ) info . getTotal ( ) ;
int totalPages ;
int totalPages ;
totalPages = total1 / pageSize ;
totalPages = total1 / pageSize ;
if ( total1 % pageSize ! = 0 ) {
if ( total1 % pageSize ! = 0 ) {
totalPages + + ;
totalPages + + ;
}
}
long total = total1 ;
long total = total1 ;
resp . put ( "retvalue" , new PageResult ( total , assesments , totalPages ) ) ;
resp . put ( "retvalue" , new PageResult ( total , assesments , totalPages ) ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( RuntimeException e ) {
} catch ( RuntimeException e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
@ -66,29 +67,33 @@ public class AssesmentService {
/ * *
/ * *
* 创建考核
* 创建考核
*
* @param vo
* @param vo
* @return
* @return
* /
* /
@Transactional
@Transactional
public HashMap < String , Object > addAssesment ( AssesmentStudentVo vo ) {
public HashMap < String , Object > addAssesment ( AssesmentStudentVo vo ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
Assesment assesment = vo . getAssesment ( ) ;
Assesment assesment = vo . getAssesment ( ) ;
List < Integer > studentIds = vo . getStudentIds ( ) ;
List < Integer > studentIds = vo . getStudentIds ( ) ;
try {
try {
//转换时间格式
//转换时间格式
assesment = AssesmentHelper . helpAssesment ( assesment ) ;
assesment = AssesmentHelper . helpAssesment ( assesment ) ;
if ( assesment . getExperimentalClassId ( ) ! = null ) {
if ( assesment . getExperimentalClassId ( ) ! = null ) {
//行政班级id
//行政班级id
List < String > classid = mapper . queryClassId ( studentIds ) ;
List < String > classid = mapper . queryClassId ( studentIds ) ;
String classId = String . join ( "," , classid ) ;
String classId = String . join ( "," , classid ) ;
assesment . setClassId ( classId ) ;
assesment . setClassId ( classId ) ;
}
}
//考核人数
//考核人数
assesment . setAssessmentSize ( studentIds . size ( ) ) ;
assesment . setAssessmentSize ( studentIds . size ( ) ) ;
//判分点数量
Integer pointNumber = mapper . queryPointNumber ( assesment . getExperimentId ( ) ) ;
assesment . setAssessmentNumber ( pointNumber ) ;
//添加考核
//添加考核
mapper . insertAssesment ( assesment ) ;
mapper . insertAssesment ( assesment ) ;
//得到考核id
//得到考核id
Integer assesmentId = assesment . getId ( ) ;
Integer assesmentId = assesment . getId ( ) ;
//往记录表中添加选中的学生信息,哪名学生要参与某一课程的什么考核,该考核下的 哪一项目
//往记录表中添加选中的学生信息,哪名学生要参与某一课程的什么考核,该考核下的 哪一项目
mapper . insertRecore ( studentIds , assesment . getExperimentId ( ) , assesment . getCourseId ( ) , assesmentId ) ;
mapper . insertRecore ( studentIds , assesment . getExperimentId ( ) , assesment . getCourseId ( ) , assesmentId ) ;
@ -97,7 +102,7 @@ public class AssesmentService {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "Add Failed" ) ;
resp . put ( "retvalue" , "Add Failed" ) ;
return resp ;
throw new RuntimeException ( ) ;
}
}
return resp ;
return resp ;
}
}
@ -105,6 +110,7 @@ public class AssesmentService {
/ * *
/ * *
* 查询选中的学生有哪些正在参与考核
* 查询选中的学生有哪些正在参与考核
*
* @param studentIds
* @param studentIds
* @return
* @return
* /
* /
@ -112,7 +118,7 @@ public class AssesmentService {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
//查询出来的学生信息
//查询出来的学生信息
List < Student > stu = mapper . queryStudentisAssess ( studentIds ) ;
List < Student > stu = mapper . queryStudentisAssess ( studentIds ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retvalue" , stu ) ;
resp . put ( "retvalue" , stu ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
@ -127,21 +133,22 @@ public class AssesmentService {
/ * *
/ * *
* 根据id查询考核的信息
* 根据id查询考核的信息
*
* @param id
* @param id
* @return
* @return
* /
* /
public HashMap < String , Object > queryGetById ( Integer id ) {
public HashMap < String , Object > queryGetById ( Integer id ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
List < Object > obj = new ArrayList < Object > ( ) ;
List < Object > obj = new ArrayList < Object > ( ) ;
try {
try {
//考核信息
//考核信息
Assesment assesment = mapper . queryGetById ( id ) ;
Assesment assesment = mapper . queryGetById ( id ) ;
//之前选中的学生
//之前选中的学生
List < Student > students = mapper . queryStudent ( id ) ;
List < Student > students = mapper . queryStudent ( id ) ;
obj . add ( assesment ) ;
obj . add ( assesment ) ;
obj . add ( students ) ;
obj . add ( students ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
@ -155,29 +162,28 @@ public class AssesmentService {
/ * *
/ * *
* 修改考核管理
* 修改考核管理
* @param vo
* @return
* @return
* /
* /
@Transactional
@Transactional
public HashMap < String , Object > updateAssesment ( Assesment assesment , List < Integer > studentIds ) {
public HashMap < String , Object > updateAssesment ( Assesment assesment , List < Integer > studentIds ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
assesment = AssesmentHelper . helpAssesment ( assesment ) ;
assesment = AssesmentHelper . helpAssesment ( assesment ) ;
try {
try {
//数据库存储的考核信息
//数据库存储的考核信息
Assesment before = mapper . queryGetById ( assesment . getId ( ) ) ;
Assesment before = mapper . queryGetById ( assesment . getId ( ) ) ;
//数据库存储的学生
//数据库存储的学生
List < Student > students = mapper . queryStudent ( assesment . getId ( ) ) ;
List < Student > students = mapper . queryStudent ( assesment . getId ( ) ) ;
if ( assesment . getExperimentalClassId ( ) ! = null ) {
if ( assesment . getExperimentalClassId ( ) ! = null ) {
//新的行政班级id
//新的行政班级id
List < String > classid = mapper . queryClassId ( studentIds ) ;
List < String > classid = mapper . queryClassId ( studentIds ) ;
String classId = String . join ( "," , classid ) ;
String classId = String . join ( "," , classid ) ;
if ( ! classId . equals ( before . getClassId ( ) ) ) {
if ( ! classId . equals ( before . getClassId ( ) ) ) {
assesment . setClassId ( classId ) ;
assesment . setClassId ( classId ) ;
} else {
} else {
assesment . setClassId ( before . getClassId ( ) ) ;
assesment . setClassId ( before . getClassId ( ) ) ;
}
}
} else if ( assesment . getClassId ( ) ! = null ) {
} else if ( assesment . getClassId ( ) ! = null ) {
assesment . setExperimentalClassId ( null ) ;
assesment . setExperimentalClassId ( null ) ;
}
}
// 比较两批学生的信息
// 比较两批学生的信息
@ -192,15 +198,18 @@ public class AssesmentService {
}
}
}
}
//前端传来的添加
//前端传来的添加
if ( studentIds . size ( ) > 0 ) {
if ( studentIds . size ( ) > 0 ) {
mapper . insertRecore ( studentIds , assesment . getExperimentId ( ) , assesment . getCourseId ( ) , assesment . getId ( ) ) ;
mapper . insertRecore ( studentIds , assesment . getExperimentId ( ) , assesment . getCourseId ( ) , assesment . getId ( ) ) ;
}
}
//后端剩余的删除
//后端剩余的删除
if ( students . size ( ) > 0 ) {
if ( students . size ( ) > 0 ) {
mapper . deleteRecord ( assesment . getId ( ) , students ) ;
mapper . deleteRecord ( assesment . getId ( ) , students ) ;
}
}
//更新考核
//更新考核
assesment . setAssessmentSize ( studentIds . size ( ) ) ; //考核人数
assesment . setAssessmentSize ( studentIds . size ( ) ) ; //考核人数
//判分点数量
Integer pointNumber = mapper . queryPointNumber ( assesment . getExperimentId ( ) ) ;
assesment . setAssessmentNumber ( pointNumber ) ;
mapper . updateAssesment ( assesment ) ;
mapper . updateAssesment ( assesment ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
@ -208,30 +217,31 @@ public class AssesmentService {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retcode" , 500 ) ;
resp . put ( "retvalue" , "Update Failed" ) ;
resp . put ( "retvalue" , "Update Failed" ) ;
return resp ;
throw new RuntimeException ( ) ;
}
}
return resp ;
return resp ;
}
}
/ * *
/ * *
* 启动考核前的判断
* 启动考核前的判断
*
* @param assesmentId
* @param assesmentId
* @return
* @return
* /
* /
public HashMap < String , Object > assessmentJudgment ( Integer assesmentId ) {
public HashMap < String , Object > assessmentJudgment ( Integer assesmentId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
List < Student > obj = new ArrayList < Student > ( ) ;
List < Student > obj = new ArrayList < Student > ( ) ;
try {
try {
List < Integer > datas = mapper . getStudentisAssess ( ) ;
List < Integer > datas = mapper . getStudentisAssess ( ) ;
List < Student > students = mapper . queryStudent ( assesmentId ) ;
List < Student > students = mapper . queryStudent ( assesmentId ) ;
for ( int i = 0 ; i < students . size ( ) ; i + + ) {
for ( int i = 0 ; i < students . size ( ) ; i + + ) {
Student stu = students . get ( i ) ;
Student stu = students . get ( i ) ;
if ( datas . contains ( stu . getStudentId ( ) ) ) {
if ( datas . contains ( stu . getStudentId ( ) ) ) {
obj . add ( stu ) ;
obj . add ( stu ) ;
}
}
}
}
resp . put ( "retvalue" , obj ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
@ -243,12 +253,8 @@ public class AssesmentService {
}
}
/ * *
/ * *
* 修改考核状态
* 修改考核状态
* @param id
* @param state
* @return
* @return
* /
* /
public HashMap < String , Object > updateState ( Assesment assesment ) {
public HashMap < String , Object > updateState ( Assesment assesment ) {
@ -261,26 +267,27 @@ public class AssesmentService {
try {
try {
String createTime = assesment . getCreationTime ( ) ;
String createTime = assesment . getCreationTime ( ) ;
String endTime = assesment . getEndTime ( ) ;
String endTime = assesment . getEndTime ( ) ;
String timeSum = assesment . getTimesum ( ) ;
String timeSum = assesment . getTimesum ( ) ;
if ( createTime ! = null & & ! createTime . equals ( "" ) ) {
if ( createTime ! = null & & ! createTime . equals ( "" ) ) {
starttime = Long . parseLong ( assesment . getCreationTime ( ) ) ;
starttime = Long . parseLong ( assesment . getCreationTime ( ) ) ;
assesment . setCreationTime ( AssesmentHelper . longPointDate ( starttime ) ) ;
assesment . setCreationTime ( AssesmentHelper . longPointDate ( starttime ) ) ;
}
}
if ( endTime ! = null & & ! endTime . equals ( "" ) ) {
if ( endTime ! = null & & ! endTime . equals ( "" ) ) {
endtime = Long . parseLong ( assesment . getEndTime ( ) ) ;
endtime = Long . parseLong ( assesment . getEndTime ( ) ) ;
assesment . setEndTime ( AssesmentHelper . longPointDate ( endtime ) ) ;
assesment . setEndTime ( AssesmentHelper . longPointDate ( endtime ) ) ;
} if ( timeSum ! = null & & ! timeSum . equals ( "" ) ) {
datas = timeSum . split ( "h" ) ;
if ( datas ! = null & & datas . length > 0 ) {
hour = Integer . parseInt ( datas [ 0 ] ) ;
if ( datas . length > 2 ) {
minute = Integer . parseInt ( datas [ 1 ] ) ;
}
}
if ( timeSum ! = null & & ! timeSum . equals ( "" ) ) {
datas = timeSum . split ( "h" ) ;
if ( datas ! = null & & datas . length > 0 ) {
hour = Integer . parseInt ( datas [ 0 ] ) ;
if ( datas . length > 2 ) {
minute = Integer . parseInt ( datas [ 1 ] ) ;
}
}
long time = ( ( hour * 60 ) + minute ) * 60 * 1000 ;
}
endTime = AssesmentHelper . longPointDate ( starttime + time ) ;
long time = ( ( hour * 60 ) + minute ) * 60 * 1000 ;
endTime = AssesmentHelper . longPointDate ( starttime + time ) ;
assesment . setEndTime ( endTime ) ;
assesment . setEndTime ( endTime ) ;
}
}
mapper . updateAssesmentState ( assesment ) ;
mapper . updateAssesmentState ( assesment ) ;
@ -297,6 +304,7 @@ public class AssesmentService {
/ * *
/ * *
* 查询实验班级一级栏目
* 查询实验班级一级栏目
*
* @param staffId : 教师id
* @param staffId : 教师id
* @return
* @return
* /
* /
@ -317,13 +325,14 @@ public class AssesmentService {
/ * *
/ * *
* 查询实验班级名称 , 以及班级一下的学生
* 查询实验班级名称 , 以及班级一下的学生
*
* @param cretionTime
* @param cretionTime
* @return
* @return
* /
* /
public HashMap < String , Object > queryCretionTime ( String cretionTime , Integer staffId ) {
public HashMap < String , Object > queryCretionTime ( String cretionTime , Integer staffId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
resp . put ( "retvalue" , mapper . queryExperimentalClass ( cretionTime , staffId ) ) ;
resp . put ( "retvalue" , mapper . queryExperimentalClass ( cretionTime , staffId ) ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
@ -337,6 +346,7 @@ public class AssesmentService {
/ * *
/ * *
* 考核信息展示
* 考核信息展示
*
* @param assesmentId
* @param assesmentId
* @return
* @return
* /
* /
@ -357,19 +367,20 @@ public class AssesmentService {
/ * *
/ * *
* 班级筛选
* 班级筛选
*
* @param assesmentId
* @param assesmentId
* @return
* @return
* /
* /
public HashMap < String , Object > getByclass ( Integer assesmentId ) {
public HashMap < String , Object > getByclass ( Integer assesmentId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
List < Object > obj = new ArrayList < Object > ( ) ;
List < Object > obj = new ArrayList < Object > ( ) ;
try {
try {
ExperimentalClass experimentalClasses = mapper . queryExperimental ( assesmentId ) ;
ExperimentalClass experimentalClasses = mapper . queryExperimental ( assesmentId ) ;
List < SutdentClass > classes = mapper . queryClass ( assesmentId ) ;
List < SutdentClass > classes = mapper . queryClass ( assesmentId ) ;
obj . add ( experimentalClasses ) ;
obj . add ( experimentalClasses ) ;
obj . add ( classes ) ;
obj . add ( classes ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
@ -383,41 +394,36 @@ public class AssesmentService {
/ * *
/ * *
* 成绩概况
* 成绩概况
* @param assesmentId
* @param projectId
* @param experimentalClassId
* @param classId
* @return
* /
* /
public HashMap < String , Object > queryScore ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
public HashMap < String , Object > queryScore ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
Score score = new Score ( ) ;
Score score = new Score ( ) ;
int size = 0 ;
int size = 0 ;
try {
try {
List < Integer > scores = mapper . queryScore ( assesmentId , experimentalClassId , classId ) ;
List < Integer > scores = mapper . queryScore ( assesmentId , experimentalClassId , classId ) ;
if ( scores . size ( ) > 0 ) {
if ( scores . size ( ) > 0 ) {
size = scores . size ( ) ;
size = scores . size ( ) ;
//最低分
//最低分
score . setMin ( scores . get ( 0 ) ) ;
score . setMin ( scores . get ( 0 ) ) ;
//最高分
//最高分
score . setMax ( scores . get ( size - 1 ) ) ;
score . setMax ( scores . get ( size - 1 ) ) ;
//考核人数
//考核人数
score . setPeopleSize ( size ) ;
score . setPeopleSize ( size ) ;
//中位数
//中位数
double median = 0 . 0 ;
double median = 0 . 0 ;
if ( size % 2 = = 1 ) {
if ( size % 2 = = 1 ) {
median = scores . get ( ( size - 1 ) / 2 ) ;
median = scores . get ( ( size - 1 ) / 2 ) ;
} else {
} else {
median = ( scores . get ( ( size / 2 - 1 ) ) + scores . get ( size / 2 ) + 0 . 0 ) / 2 ;
median = ( scores . get ( ( size / 2 - 1 ) ) + scores . get ( size / 2 ) + 0 . 0 ) / 2 ;
}
}
score . setMedian ( median ) ;
score . setMedian ( median ) ;
//平均分
//平均分
int avg = 0 ;
int avg = 0 ;
for ( int i = 0 ; i < scores . size ( ) ; i + + ) {
for ( int i = 0 ; i < scores . size ( ) ; i + + ) {
avg + = scores . get ( i ) ;
avg + = scores . get ( i ) ;
}
}
score . setAvg ( avg * 1 . 0 / size ) ;
score . setAvg ( avg * 1 . 0 / size ) ;
} else {
} else {
//最低分
//最低分
score . setMin ( 0 ) ;
score . setMin ( 0 ) ;
//最高分
//最高分
@ -429,8 +435,7 @@ public class AssesmentService {
//平均分
//平均分
score . setAvg ( 0 ) ;
score . setAvg ( 0 ) ;
}
}
//判分点数量
Integer pointNumber = mapper . getAssesmentNumber ( assesmentId ) ;
Integer pointNumber = mapper . queryPointNumber ( assesmentId ) ;
if ( StringUtils . isEmpty ( pointNumber ) ) {
if ( StringUtils . isEmpty ( pointNumber ) ) {
score . setPointNumber ( 0 ) ;
score . setPointNumber ( 0 ) ;
} else {
} else {
@ -444,6 +449,7 @@ public class AssesmentService {
score . setError ( error ) ;
score . setError ( error ) ;
}
}
}
}
resp . put ( "retvalue" , score ) ;
resp . put ( "retvalue" , score ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
@ -458,50 +464,51 @@ public class AssesmentService {
/ * *
/ * *
* 成绩柱状图
* 成绩柱状图
*
* @param assesmentId
* @param assesmentId
* @param experimentalClassId
* @param experimentalClassId
* @param classId
* @param classId
* @return
* @return
* /
* /
public HashMap < String , Object > queryHistogram ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
public HashMap < String , Object > queryHistogram ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
List < Integer > obj = new ArrayList < Integer > ( ) ;
List < Integer > obj = new ArrayList < Integer > ( ) ;
try {
try {
Integer one = 0 ;
Integer one = 0 ;
Integer two = 0 ;
Integer two = 0 ;
Integer three = 0 ;
Integer three = 0 ;
Integer four = 0 ;
Integer four = 0 ;
Integer five = 0 ;
Integer five = 0 ;
Integer six = 0 ;
Integer six = 0 ;
Integer seven = 0 ;
Integer seven = 0 ;
Integer eight = 0 ;
Integer eight = 0 ;
Integer nine = 0 ;
Integer nine = 0 ;
Integer ten = 0 ;
Integer ten = 0 ;
List < Record > scores = mapper . queryScore2 ( assesmentId , experimentalClassId , classId ) ;
List < Record > scores = mapper . queryScore2 ( assesmentId , experimentalClassId , classId ) ;
for ( int i = 0 ; i < scores . size ( ) ; i + + ) {
for ( int i = 0 ; i < scores . size ( ) ; i + + ) {
Integer score = scores . get ( i ) . getScore ( ) ;
Integer score = scores . get ( i ) . getScore ( ) ;
Integer number = scores . get ( i ) . getNumber ( ) ;
Integer number = scores . get ( i ) . getNumber ( ) ;
if ( score > = 0 & & score < = 10 ) {
if ( score > = 0 & & score < = 10 ) {
one + = number ;
one + = number ;
} else if ( score > 10 & & score < = 20 ) {
} else if ( score > 10 & & score < = 20 ) {
two + = number ;
two + = number ;
} else if ( score > 20 & & score < = 30 ) {
} else if ( score > 20 & & score < = 30 ) {
three + = number ;
three + = number ;
} else if ( score > 30 & & score < = 40 ) {
} else if ( score > 30 & & score < = 40 ) {
four + = number ;
four + = number ;
} else if ( score > 40 & & score < = 50 ) {
} else if ( score > 40 & & score < = 50 ) {
five + = number ;
five + = number ;
} else if ( score > 50 & & score < = 60 ) {
} else if ( score > 50 & & score < = 60 ) {
six + = number ;
six + = number ;
} else if ( score > 60 & & score < = 70 ) {
} else if ( score > 60 & & score < = 70 ) {
seven + = number ;
seven + = number ;
} else if ( score > 70 & & score < = 80 ) {
} else if ( score > 70 & & score < = 80 ) {
eight + = number ;
eight + = number ;
} else if ( score > 80 & & score < = 90 ) {
} else if ( score > 80 & & score < = 90 ) {
nine + = number ;
nine + = number ;
} else if ( score > 90 & & score < = 100 ) {
} else if ( score > 90 & & score < = 100 ) {
ten + = number ;
ten + = number ;
}
}
}
}
@ -532,28 +539,29 @@ public class AssesmentService {
/ * *
/ * *
* 错误分布折线图
* 错误分布折线图
*
* @param assesmentId
* @param assesmentId
* @param experimentalClassId
* @param experimentalClassId
* @param classId
* @param classId
* @return
* @return
* /
* /
public HashMap < String , Object > getLinechart ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
public HashMap < String , Object > getLinechart ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
List < Object > obj = new ArrayList < Object > ( ) ;
List < Object > obj = new ArrayList < Object > ( ) ;
try {
try {
List < PointRecord > errors = mapper . queryError ( assesmentId , experimentalClassId , classId ) ;
List < PointRecord > errors = mapper . queryError ( assesmentId , experimentalClassId , classId ) ;
List < String > names = new ArrayList < String > ( ) ;
List < String > names = new ArrayList < String > ( ) ;
List < Integer > datas = new ArrayList < Integer > ( ) ;
List < Integer > datas = new ArrayList < Integer > ( ) ;
for ( int i = 0 ; i < errors . size ( ) ; i + + ) {
for ( int i = 0 ; i < errors . size ( ) ; i + + ) {
PointRecord pointRecord = errors . get ( i ) ;
PointRecord pointRecord = errors . get ( i ) ;
names . add ( pointRecord . getJudgmentPointsName ( ) ) ;
names . add ( pointRecord . getJudgmentPointsName ( ) ) ;
datas . add ( pointRecord . getNumber ( ) ) ;
datas . add ( pointRecord . getNumber ( ) ) ;
}
}
obj . add ( names ) ;
obj . add ( names ) ;
obj . add ( datas ) ;
obj . add ( datas ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retvalue" , obj ) ;
resp . put ( "retcode" , 200 ) ;
resp . put ( "retcode" , 200 ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
logger . error ( e . getMessage ( ) ) ;
logger . error ( e . getMessage ( ) ) ;
@ -567,12 +575,13 @@ public class AssesmentService {
/ * *
/ * *
* 成绩明细
* 成绩明细
*
* @param assesmentId
* @param assesmentId
* @param experimentalClassId
* @param experimentalClassId
* @param classId
* @param classId
* @return
* @return
* /
* /
public HashMap < String , Object > queryAssesmentScore ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
public HashMap < String , Object > queryAssesmentScore ( Integer assesmentId , Integer experimentalClassId , List < Integer > classId ) {
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
HashMap < String , Object > resp = new HashMap < String , Object > ( ) ;
try {
try {
resp . put ( "retvalue" , mapper . queryScore3 ( assesmentId , experimentalClassId , classId ) ) ;
resp . put ( "retvalue" , mapper . queryScore3 ( assesmentId , experimentalClassId , classId ) ) ;