新增知识概要和学习资源根据时间算分接口

master
xiaoCJ 4 months ago
parent 346bd8cabc
commit 575e6fdffd

@ -5,13 +5,14 @@ import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.StuTrainingExample;
import com.sztzjy.financial_bigdata.entity.StuTrainingWithBLOBs;
import com.sztzjy.financial_bigdata.entity.SysKnowledgeSummary;
import com.sztzjy.financial_bigdata.entity.SysObjectiveQuestionExample;
import com.sztzjy.financial_bigdata.entity.SysWeight;
import com.sztzjy.financial_bigdata.entity.resource_entity.TestSysKnowledgeSummary;
import com.sztzjy.financial_bigdata.entity.stu_dto.ReceivingObject;
import com.sztzjy.financial_bigdata.mapper.StuTrainingMapper;
import com.sztzjy.financial_bigdata.mapper.SysKnowledgeSummaryMapper;
import com.sztzjy.financial_bigdata.mapper.SysObjectiveQuestionMapper;
import com.sztzjy.financial_bigdata.mapper.SysWeightMapper;
import com.sztzjy.financial_bigdata.resourceCenterAPI.KnowledgeSummaryApi;
import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService;
import com.sztzjy.financial_bigdata.util.PdfUtil;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import com.sztzjy.financial_bigdata.util.file.IFileUtil;
@ -32,6 +33,7 @@ import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.List;
/**
@ -50,6 +52,10 @@ public class StuKnowledgeNote {
private String filePath;
@Autowired
private SysKnowledgeSummaryMapper sysKnowledgeSummaryMapper;
@Autowired
private SysWeightMapper sysWeightMapper;
@Autowired
private ITeaGradeManageService iTeaGradeManageService;
@AnonymousAccess
@ApiOperation("知识笔记-保存")
@ -112,10 +118,10 @@ public class StuKnowledgeNote {
@AnonymousAccess
@ApiOperation("***知识概要-获取页面")
@PostMapping("getSysKnowledgeSummaryByChapterId")
public ResultEntity<TestSysKnowledgeSummary> getSysKnowledgeSummaryByChapterId(@RequestParam String chapterId,@RequestParam String courseId, @RequestParam String schoolId, @RequestParam String systemOwner) {
public ResultEntity<TestSysKnowledgeSummary> getSysKnowledgeSummaryByChapterId(@RequestParam String chapterId, @RequestParam String courseId, @RequestParam String schoolId, @RequestParam String systemOwner) {
TestSysKnowledgeSummary sysKnowledgeSummary = null;
try {
sysKnowledgeSummary = KnowledgeSummaryApi.getSysKnowledgeSummary(courseId,chapterId, schoolId, systemOwner);
sysKnowledgeSummary = KnowledgeSummaryApi.getSysKnowledgeSummary(courseId, chapterId, schoolId, systemOwner);
} catch (IOException e) {
return new ResultEntity<>(HttpStatus.BAD_REQUEST, "资源中心接口异常");
}
@ -161,7 +167,39 @@ public class StuKnowledgeNote {
} else {
return new ResultEntity<>(list.get(0).getTrainingId());
}
}
@AnonymousAccess
@ApiOperation("知识概要-算分")
@PostMapping("getScore") //阅读1分钟得60分,1分钟以下不得分多1分钟加10分。 60分为默认值老师可修改
public ResultEntity<BigDecimal> getScore(@ApiParam("数字 单位分钟") @RequestParam Integer minutes,
@RequestParam String courseId,
@RequestParam String schoolId,
@RequestParam String systemOwner,
@RequestParam String trainingId) {
StuTrainingWithBLOBs stuTrainingWithBLOBs = stuTrainingMapper.selectByPrimaryKey(trainingId);
if (stuTrainingWithBLOBs.getKnowledgeSummaryCompleteStatus() != null) {
//不为空直接返回
return new ResultEntity<>(stuTrainingWithBLOBs.getKnowledgeSummaryScore());
}
//为空设置
SysWeight sysWeight = iTeaGradeManageService.getSysWeightResultEntity(courseId, schoolId, systemOwner);
BigDecimal knowledgeSummaryDefaultRule = sysWeight.getKnowledgeSummaryDefaultRule();
if (minutes < 1) {
stuTrainingWithBLOBs.setKnowledgeSummaryScore(BigDecimal.ZERO);
} else if (minutes == 1) {
stuTrainingWithBLOBs.setKnowledgeSummaryScore(knowledgeSummaryDefaultRule); //老师只能修改这个分值
} else {
int extraMinutes = minutes - 1;
int totalScore = 60 + extraMinutes * 10;
knowledgeSummaryDefaultRule = BigDecimal.valueOf(totalScore);
stuTrainingWithBLOBs.setKnowledgeSummaryScore(knowledgeSummaryDefaultRule);
}
stuTrainingWithBLOBs.setResourceLearningCompleteStatus(minutes);
stuTrainingMapper.updateByPrimaryKey(stuTrainingWithBLOBs);
return new ResultEntity<>(knowledgeSummaryDefaultRule);
}

@ -57,7 +57,7 @@ public class StuScoreController {
StuTrainingDto stuTrainingDto = new StuTrainingDto();
//根据章节ID拿到课程ID 再去拿权重
SysThreeCatalog sysCourseChapter = null;
SysThreeCatalog sysCourseChapter = null;
try {
sysCourseChapter = CourseAPI.selectChapterByChapterId(chapterId);
} catch (IOException e) {

@ -574,7 +574,7 @@ public class TeaGradeManageController {
@ApiOperation("练习模式--成绩详情页面设置权重")
public void updateWeightByModule(@ApiParam("所有框必须传") @RequestBody SysWeight sysWeight) {
SysWeightExample sysWeightExample = new SysWeightExample();
sysWeightExample.createCriteria().andCourseIdEqualTo(sysWeight.getCourseId()).andSystemOwnerEqualTo(sysWeight.getSystemOwner());
sysWeightExample.createCriteria().andCourseIdEqualTo(sysWeight.getCourseId()).andSystemOwnerEqualTo(sysWeight.getSystemOwner()).andSchoolIdEqualTo(sysWeight.getSchoolId());
List<SysWeight> sysWeights = sysWeightMapper.selectByExample(sysWeightExample);
if (!sysWeights.isEmpty()) {//有 update
sysWeightMapper.updateByPrimaryKey(sysWeight);
@ -610,17 +610,11 @@ public class TeaGradeManageController {
public ResultEntity<SysWeight> getModuleByCourseId(@RequestParam String courseId,
@RequestParam String schoolId,
@RequestParam String systemOwner) {
SysWeightExample sysWeightExample = new SysWeightExample();
sysWeightExample.createCriteria().andSchoolIdEqualTo(schoolId).andCourseIdEqualTo(courseId).andSystemOwnerEqualTo(systemOwner);
List<SysWeight> sysWeights = sysWeightMapper.selectByExample(sysWeightExample);
if (sysWeights.isEmpty()) {
//todo 是否需要设置默认权重
return new ResultEntity<>(new SysWeight());
}
return new ResultEntity<>(sysWeights.get(0));
return new ResultEntity<SysWeight>(iTeaGradeManageService.getSysWeightResultEntity(courseId, schoolId, systemOwner));
}
@AnonymousAccess
@PostMapping("/getTheoryInfo")
@ApiOperation("理论考试--页面展示")

@ -1,9 +1,13 @@
package com.sztzjy.financial_bigdata.controller.tea;
import com.sztzjy.financial_bigdata.annotation.AnonymousAccess;
import com.sztzjy.financial_bigdata.entity.StuTrainingWithBLOBs;
import com.sztzjy.financial_bigdata.entity.SysWeight;
import com.sztzjy.financial_bigdata.entity.TeaResourceCenter;
import com.sztzjy.financial_bigdata.entity.resource_entity.SysResource;
import com.sztzjy.financial_bigdata.mapper.StuTrainingMapper;
import com.sztzjy.financial_bigdata.resourceCenterAPI.ResourceCenterApi;
import com.sztzjy.financial_bigdata.service.tea.ITeaGradeManageService;
import com.sztzjy.financial_bigdata.service.tea.ITeaResourceCenterService;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import com.sztzjy.financial_bigdata.util.file.IFileUtil;
@ -14,12 +18,10 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
@ -34,6 +36,10 @@ public class TeaResourceCenterController {
ITeaResourceCenterService resourceCenterService;
@Value("${file.path}")
private String filePath;
@Autowired
private StuTrainingMapper stuTrainingMapper;
@Autowired
ITeaGradeManageService iTeaGradeManageService;
//根据课程id查看资源文件列表
@ -70,4 +76,35 @@ public class TeaResourceCenterController {
}
}
@AnonymousAccess
@ApiOperation("学习资源-算分")
@PostMapping("getResourceScore") //观看资源1分钟得60分,1分钟以下不得分多1分钟加10分。
public ResultEntity<BigDecimal> getScore(@ApiParam("数字 单位分钟") @RequestParam Integer minutes,
@RequestParam String courseId,
@RequestParam String schoolId,
@RequestParam String systemOwner,
@RequestParam String trainingId) {
StuTrainingWithBLOBs stuTrainingWithBLOBs = stuTrainingMapper.selectByPrimaryKey(trainingId);
if (stuTrainingWithBLOBs.getKnowledgeSummaryCompleteStatus() != null) {
//不为空直接返回
return new ResultEntity<>(stuTrainingWithBLOBs.getResourceLearningScore());
}
//为空设置
SysWeight sysWeight = iTeaGradeManageService.getSysWeightResultEntity(courseId, schoolId, systemOwner);
BigDecimal resourceLearningDefaultRule = sysWeight.getResourceLearningDefaultRule();
if (minutes < 1) {
stuTrainingWithBLOBs.setResourceLearningScore(BigDecimal.ZERO);
} else if (minutes == 1) {
stuTrainingWithBLOBs.setResourceLearningScore(resourceLearningDefaultRule); //老师只能修改这个分值
} else {
int extraMinutes = minutes - 1;
int totalScore = 60 + extraMinutes * 10;
resourceLearningDefaultRule = BigDecimal.valueOf(totalScore);
stuTrainingWithBLOBs.setResourceLearningScore(resourceLearningDefaultRule);
}
stuTrainingWithBLOBs.setResourceLearningCompleteStatus(minutes);
stuTrainingMapper.updateByPrimaryKey(stuTrainingWithBLOBs);
return new ResultEntity<>(resourceLearningDefaultRule);
}
}

@ -56,7 +56,7 @@ public class ExerciseServiceImpl implements IExerciseService {
return dtos;
}else {
StuTrainingWithBLOBs bloBs = stuTrainingWithBLOBs.get(0);
if (bloBs==null) {
if (bloBs==null) { //todo 这里为什么要调查询全部的接口
List<SysObjectiveQuestions> objectiveQuestionList = ObjectiveApi.selectObjectQuestionListByChapterId(chapterId);
for (int i = 0; i < objectiveQuestionList.size(); i++) {
SysObjectiveQuestions objectiveQuestion = objectiveQuestionList.get(i);

@ -2,10 +2,12 @@ package com.sztzjy.financial_bigdata.service.tea;
import com.github.pagehelper.PageInfo;
import com.sztzjy.financial_bigdata.entity.StuTheoryRecord;
import com.sztzjy.financial_bigdata.entity.SysWeight;
import com.sztzjy.financial_bigdata.entity.stu_dto.StuUserDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaExaminationDetailsDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingDto;
import com.sztzjy.financial_bigdata.entity.tea_dto.TeaTrainingInfoDTO;
import com.sztzjy.financial_bigdata.util.ResultEntity;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@ -31,4 +33,6 @@ public interface ITeaGradeManageService {
PageInfo<StuTheoryRecord> getTheoryInfo(Integer index, Integer size, String schoolId, String classId, String keyWord,String systemOwner);
void exportTheoryExamInfo(HttpServletResponse response,String classId, String schoolId);
SysWeight getSysWeightResultEntity(String courseId, String schoolId, String systemOwner);
}

@ -287,9 +287,36 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
}
}
@Override
public SysWeight getSysWeightResultEntity(String courseId, String schoolId, String systemOwner) {
SysWeightExample sysWeightExample = new SysWeightExample();
sysWeightExample.createCriteria().andSchoolIdEqualTo(schoolId).andCourseIdEqualTo(courseId).andSystemOwnerEqualTo(systemOwner);
List<SysWeight> sysWeights = sysWeightMapper.selectByExample(sysWeightExample);
if (sysWeights.isEmpty()) {
//设置默认权重
SysWeight sysWeight = new SysWeight();
sysWeight.setCourseId(courseId);
sysWeight.setWeightId(IdUtil.randomUUID());
sysWeight.setSchoolId(schoolId);
sysWeight.setSystemOwner(systemOwner);
sysWeight.setKnowledgeSummaryDefaultRule(BigDecimal.valueOf(60)); //知识概要默认计分规则 阅读1分钟得60分,1分钟以下不得分多1分钟加10分。
sysWeight.setResourceLearningDefaultRule(BigDecimal.valueOf(60)); //资源学习默认计分规则 观看资源1分钟得60分,1分钟以下不得分多1分钟加10分。
sysWeight.setLearningEvalDefaultRule(BigDecimal.valueOf(10)); //学习测评默认计分规则 客观题10分每道
sysWeight.setExpTrainingDefautRule(BigDecimal.valueOf(2));//实训题,输错/选错次数扣2分最低0分
sysWeight.setKnowledgeSummaryWeight(BigDecimal.valueOf(5));
sysWeight.setResourceLearningWeight(BigDecimal.valueOf(5));
sysWeight.setLearningEvalWeight(BigDecimal.valueOf(20));
sysWeight.setExpTrainingWeight(BigDecimal.valueOf(60));
sysWeight.setReportWeight(BigDecimal.valueOf(10));
sysWeightMapper.insert(sysWeight);
return sysWeight;
}
return sysWeights.get(0);
}
private List<TeaTrainingInfoDTO> getTeaTrainingInfoDTOS(String schoolId, String keyWord, String classId, String systemOwner) {
List<StuUser> stuUsers =userMapper.getByNameAndStudentID(schoolId,keyWord,classId,systemOwner);
List<StuUser> stuUsers = userMapper.getByNameAndStudentID(schoolId, keyWord, classId, systemOwner);
// 查询学生用户列表
if (stuUsers.isEmpty()) {
@ -299,7 +326,7 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
// 批量获取班级信息
Set<String> classIds = stuUsers.stream().map(StuUser::getClassId).collect(Collectors.toSet());
StuClassExample example =new StuClassExample();
StuClassExample example = new StuClassExample();
List<String> IDlist = new ArrayList<>(classIds);
example.createCriteria().andClassIdIn(IDlist).andSystemOwnerEqualTo(systemOwner);

Loading…
Cancel
Save