成绩权重

beetlsql3-dev
xuliangtong 2 years ago
parent 20fc0c0f9b
commit 9f21bd5bd4

@ -6,6 +6,7 @@ import java.util.Map;
import com.ibeetl.jlw.entity.*;
import com.ibeetl.jlw.web.query.TeacherOpenCourseScoreDashboardQuery;
import org.beetl.sql.mapper.annotation.BatchUpdate;
import org.beetl.sql.mapper.annotation.SqlResource;
import org.beetl.sql.mapper.BaseMapper;
import org.beetl.sql.core.engine.PageQuery;
@ -25,4 +26,6 @@ public interface TeacherOpenCourseScoreDashboardDao extends BaseMapper<TeacherOp
List<TeacherOpenCourseScoreDashboard> getByIds(String ids);
List<TeacherOpenCourseScoreDashboard> getValuesByQuery(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery);
List<Map<String,Object>>getExcelValues(TeacherOpenCourseScoreDashboardQuery teacherOpenCourseScoreDashboardQuery);
@Update
int deleteByTeacherOpenCourseId(Long teacherOpenCourseId);
}

@ -81,7 +81,7 @@ public class TeacherOpenCourseScoreDashboard extends BaseEntity{
private Date createTime ;
//课程开课ID
private Date teacherOpenCourseId;
private Long teacherOpenCourseId;
public TeacherOpenCourseScoreDashboard(){
}
@ -281,11 +281,11 @@ public class TeacherOpenCourseScoreDashboard extends BaseEntity{
this.createTime = createTime;
}
public Date getTeacherOpenCourseId() {
public Long getTeacherOpenCourseId() {
return teacherOpenCourseId;
}
public void setTeacherOpenCourseId(Date teacherOpenCourseId) {
public void setTeacherOpenCourseId(Long teacherOpenCourseId) {
this.teacherOpenCourseId = teacherOpenCourseId;
}
}

@ -216,6 +216,7 @@ public class ResourcesQuestionSnapshotService extends CoreBaseService<ResourcesQ
*/
public Object questionTestDetail(@NotNull(message = "请上传来源ID[开课作业ID、开课考试ID、开课章节测试ID]") Long snapshotFromId,
@NotNull(message = "来源类型不能为空!") ResourcesQuestionSnapshotFromTypeEnum snapshotFromType) {
return null;
}
/**

@ -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;
}
}

@ -432,13 +432,14 @@ public class TeacherOpenCourseScoreDashboardController {
* @param map teacherOpenCourseId ID
* @return
*/
@PostMapping("/updateGrades")
@PostMapping(MODEL + "/updateGrades.json")
public JsonResult<Object> updateGrades(@RequestBody Map<String, Object> map) {
String teacherOpenCourseId = MapUtils.getString(map, "teacherOpenCourseId");
if (StringUtils.isEmpty(teacherOpenCourseId)) {
Long teacherOpenCourseId = MapUtils.getLong(map, "teacherOpenCourseId");
if (teacherOpenCourseId == null) {
return JsonResult.failMessage("课程开课ID不能为空");
}
return JsonResult.success();
boolean b = teacherOpenCourseScoreDashboardService.updateGrades(teacherOpenCourseId);
return JsonResult.success(b);
}

@ -48,7 +48,7 @@ public class TeacherOpenCourseScoreDashboardQuery extends PageParam {
@Query(name = "创建时间", display = false)
private Date createTime;
@Query(name = "课程开课ID", display = false)
private Date teacherOpenCourseId;
private Long teacherOpenCourseId;
private String teacherOpenCourseScoreDashboardIdPlural;
@ -151,11 +151,11 @@ public class TeacherOpenCourseScoreDashboardQuery extends PageParam {
this.createTime = createTime;
}
public Date getTeacherOpenCourseId() {
public Long getTeacherOpenCourseId() {
return teacherOpenCourseId;
}
public void setTeacherOpenCourseId(Date teacherOpenCourseId) {
public void setTeacherOpenCourseId(Long teacherOpenCourseId) {
this.teacherOpenCourseId = teacherOpenCourseId;
}

@ -570,3 +570,9 @@ getExcelValues
)
)t
deleteByTeacherOpenCourseId
===
* 根据课程id删除存量数据
delete from teacher_open_course_score_dashboard where teacher_open_course_id = #teacherOpenCourseId#

Loading…
Cancel
Save