|
|
|
@ -7,6 +7,7 @@ import java.text.SimpleDateFormat;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.math.BigDecimal;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.util.NumberUtil;
|
|
|
|
|
import cn.jlw.util.ToolUtils;
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
@ -15,7 +16,9 @@ import com.ibeetl.admin.core.util.TimeTool;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonResult;
|
|
|
|
|
import com.ibeetl.admin.core.web.JsonReturnCode;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseScoreDashboardDao;
|
|
|
|
|
import com.ibeetl.jlw.dao.TeacherOpenCourseScoreWeightDao;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreDashboard;
|
|
|
|
|
import com.ibeetl.jlw.entity.TeacherOpenCourseScoreWeight;
|
|
|
|
|
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
|
|
|
|
|
import com.ibeetl.jlw.entity.FileEntity;
|
|
|
|
|
|
|
|
|
@ -47,6 +50,9 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
|
|
|
|
|
@Resource private TeacherOpenCourseScoreDashboardDao teacherOpenCourseScoreDashboardDao;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private TeacherOpenCourseScoreWeightDao weightDao;
|
|
|
|
|
|
|
|
|
|
public PageQuery<TeacherOpenCourseScoreDashboard>queryByCondition(PageQuery query){
|
|
|
|
|
PageQuery ret = teacherOpenCourseScoreDashboardDao.queryByCondition(query);
|
|
|
|
|
queryListAfter(ret.getList());
|
|
|
|
@ -379,5 +385,63 @@ public class TeacherOpenCourseScoreDashboardService extends CoreBaseService<Teac
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新成绩
|
|
|
|
|
* @param teacherOpenCourseId 课程id
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public boolean updateGrades(Long teacherOpenCourseId) {
|
|
|
|
|
//查询权重
|
|
|
|
|
TeacherOpenCourseScoreWeight weight = weightDao.single(teacherOpenCourseId);
|
|
|
|
|
|
|
|
|
|
//todo 查询签到成绩,章节练习成绩,课程实操成绩,作业成绩,考试成绩,互动成绩
|
|
|
|
|
List<TeacherOpenCourseScoreDashboard> studentScores = new ArrayList<>();
|
|
|
|
|
for (int i = 0; i < 10; i++) {
|
|
|
|
|
TeacherOpenCourseScoreDashboard scoreDashboard = new TeacherOpenCourseScoreDashboard();
|
|
|
|
|
scoreDashboard.setStudentId(i+1L);
|
|
|
|
|
BigDecimal signinScore = BigDecimal.valueOf(new Random().nextInt(100));
|
|
|
|
|
scoreDashboard.setSigninScore(signinScore);
|
|
|
|
|
BigDecimal courseScore = BigDecimal.valueOf(new Random().nextInt(100));
|
|
|
|
|
scoreDashboard.setCourseScore(courseScore);
|
|
|
|
|
BigDecimal realOperationScore = BigDecimal.valueOf(new Random().nextInt(100));
|
|
|
|
|
scoreDashboard.setRealOperationScore(realOperationScore);
|
|
|
|
|
BigDecimal questionHomeworkScore = BigDecimal.valueOf(new Random().nextInt(100));
|
|
|
|
|
scoreDashboard.setQuestionHomeworkScore(questionHomeworkScore);
|
|
|
|
|
BigDecimal examScore = BigDecimal.valueOf(new Random().nextInt(100));
|
|
|
|
|
scoreDashboard.setExamScore(examScore);
|
|
|
|
|
BigDecimal chatScore = BigDecimal.valueOf(new Random().nextInt(100));
|
|
|
|
|
scoreDashboard.setChatScore(chatScore);
|
|
|
|
|
BigDecimal totalScore= signinScore.add(courseScore)
|
|
|
|
|
.add(realOperationScore)
|
|
|
|
|
.add(questionHomeworkScore)
|
|
|
|
|
.add(examScore)
|
|
|
|
|
.add(chatScore);
|
|
|
|
|
scoreDashboard.setTotalScore(totalScore);
|
|
|
|
|
if (weight != null) {
|
|
|
|
|
String resultStatusSetting = weight.getResultStatusSetting();
|
|
|
|
|
if ("1".equals(resultStatusSetting)) {
|
|
|
|
|
if (NumberUtil.compare(totalScore.longValue(), Long.parseLong(weight.getDichotomyScore())) > 0) {
|
|
|
|
|
scoreDashboard.setLastStatus("及格");
|
|
|
|
|
}else {
|
|
|
|
|
scoreDashboard.setLastStatus("不及格");
|
|
|
|
|
}
|
|
|
|
|
}else {
|
|
|
|
|
if (NumberUtil.compare(totalScore.longValue(), 60) > 0) {
|
|
|
|
|
scoreDashboard.setLastStatus("及格");
|
|
|
|
|
}else {
|
|
|
|
|
scoreDashboard.setLastStatus("不及格");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
scoreDashboard.setTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
studentScores.add(scoreDashboard);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//通过课程id删除存量数据
|
|
|
|
|
teacherOpenCourseScoreDashboardDao.deleteByTeacherOpenCourseId(teacherOpenCourseId);
|
|
|
|
|
teacherOpenCourseScoreDashboardDao.insertBatch(studentScores);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|