修改bug

newBigdata
xiaoCJ 11 months ago
parent f2ea4cefe8
commit de46df8e38

@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
/**
@ -45,7 +46,7 @@ public class StuIndexController {
@Autowired
private TeaExamManageMapper teaExamManageMapper;
@Autowired
private SysResourceDataMapper sysResourceDataMapper;
private TeaResourceCenterMapper teaResourceCenterMapper;
@Autowired
private StuIndexService stuIndexService;
@Autowired
@ -112,23 +113,12 @@ public class StuIndexController {
@PostMapping("getIndexResourceCenter")
public ResultEntity<Map<String, Integer>> getIndexResourceCenter(@RequestParam String schoolId) {
Map<String, Integer> map = new HashMap<>();
SysResourceDataExample example = new SysResourceDataExample();
List<String> idlist = new ArrayList<>();
idlist.add(schoolId);
idlist.add(Constant.BUILT_IN_SCHOOL_ID);
example.createCriteria().andSchoolIdIn(idlist);
List<SysResourceData> sysResourceData = sysResourceDataMapper.selectByExample(example);
int size = sysResourceData.size();
map.put("资源总量", size);
int videoNum = 0;
for (SysResourceData sysResourceDatum : sysResourceData) {
String resourceName = sysResourceDatum.getResourceName();
if (resourceName.toUpperCase().contains(".MP4") || resourceName.toUpperCase().contains(".AVI") || resourceName.toUpperCase().contains(".WMV")) {
videoNum++;
}
}
map.put("视频数量", videoNum);
map.put("课件数量", size - videoNum);
List<Integer> list = teaResourceCenterMapper.getSizeByType(schoolId);
Integer key = list.get(0);
Integer value = list.get(1);
map.put("视频数量", key);
map.put("课件数量", value);
map.put("资源总量", key + value);
return new ResultEntity<>(map);
}
@ -244,11 +234,11 @@ public class StuIndexController {
public ResultEntity<AllModuleProgressDto> getAllModuleProgress(@RequestParam String userId, @RequestParam String schoolId) {
AllModuleProgressDto allModuleProgressDto = new AllModuleProgressDto();
//实训演练完成进度 = 已完成模块数量/总模块数量
int progressFinishNum = stuTrainingMapper.selectProgressFinish(userId); //已学任务数量
BigDecimal progressFinishNum = stuTrainingMapper.selectProgressFinish(userId); //已学任务数量
int totalChapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId); //总章节数量
if (progressFinishNum != 0 && totalChapterNum != 0) {
double finalProgress = (double) progressFinishNum / totalChapterNum; //任务进度 = 已学数量/总章节数量
BigDecimal totalChapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId); //总章节数量
if ((progressFinishNum != null && progressFinishNum.intValue() != 0) && (totalChapterNum != null && totalChapterNum.intValue() != 0)) {
BigDecimal finalProgress = progressFinishNum.divide(totalChapterNum, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); //任务进度 = 已学数量/总章节数量
allModuleProgressDto.setTrainingProgress(finalProgress);
}

@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
/**
@ -121,7 +122,10 @@ public class TeaGradeManageController {
} else {
copyexamManageWithBLOBs.setExamStatus("进行中");
}
String concatenatedTimeString = startTime + " -- " + endTime;
SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
String format1 = format.format(startTime);
String format2 = format.format(endTime);
String concatenatedTimeString = format1 + " -- " + format2;
copyexamManageWithBLOBs.setExamTime(concatenatedTimeString); //考试时间
String userId = teaExamManage.getUserId();

@ -4,6 +4,8 @@ import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @Author xcj
* @Date 2024/4/23
@ -12,7 +14,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public class AllModuleProgressDto {
@ApiModelProperty("实训演练完成进度")
private double trainingProgress;
private BigDecimal trainingProgress;
@ApiModelProperty("实战考核完成进度")
private double examProgress;
@ApiModelProperty("理论考试完成进度")

@ -15,7 +15,7 @@ import java.math.BigDecimal;
public class StuTheoryIndexInfoDto {
@ApiModelProperty("实训演练--已学任务数量")
private Integer learnedModuleTaskNum;
private BigDecimal learnedModuleTaskNum;
@ApiModelProperty("实训演练--已学案例数量")
private Integer learnedTaskNumCase;
@ -24,7 +24,7 @@ public class StuTheoryIndexInfoDto {
private String learnedDuration;
@ApiModelProperty("实训演练--任务进度")
private Integer progress;
private BigDecimal progress;
@ApiModelProperty("实战考核--参与考核次数")
private Integer taskNum;

@ -43,7 +43,7 @@ public interface StuTrainingMapper {
int updateByPrimaryKey(StuTraining record);
@Select("select count(progress) FROM stu_training WHERE progress = 6 and user_id = #{userId}")
int selectProgressFinish(@Param("userId") String userId);
BigDecimal selectProgressFinish(@Param("userId") String userId);
@Select("SELECT COUNT(progress) FROM stu_training WHERE user_id = #{userId} AND (exp_training_score <> 0 AND exp_training_score IS NOT NULL)")
int selectTrainingProgressFinish(@Param("userId") String userId);

@ -2,6 +2,8 @@ package com.sztzjy.financial_bigdata.mapper;
import com.sztzjy.financial_bigdata.entity.SysCourseChapter;
import com.sztzjy.financial_bigdata.entity.SysCourseChapterExample;
import java.math.BigDecimal;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@ -33,5 +35,5 @@ public interface SysCourseChapterMapper {
int updateByPrimaryKey(SysCourseChapter record);
@Select("SELECT COUNT(chapter_id) FROM sys_course JOIN sys_course_chapter WHERE sys_course.course_id = sys_course_chapter.course_id AND school_Id in(999999999,#{schoolId})")
int selectChapterBySchoolId(@Param("schoolId")String schoolId);
BigDecimal selectChapterBySchoolId(@Param("schoolId")String schoolId);
}

@ -40,4 +40,7 @@ public interface TeaResourceCenterMapper {
@Select("SELECT resource_name FROM tea_resource_center ORDER BY count DESC LIMIT 1 ")
String getMostPopularName();
@Select("SELECT count(*) FROM `tea_resource_center` WHERE school_id in (#{schoolId},1) GROUP BY type")
List<Integer> getSizeByType(@Param("schoolId") String schoolId);
}

@ -42,7 +42,7 @@ public class StuIndexServiceImpl implements StuIndexService {
StuTheoryIndexInfoDto stuTheoryIndexInfoDto = new StuTheoryIndexInfoDto();
//实训演练学习数据
int progressFinishNum = stuTrainingMapper.selectProgressFinish(userId); //已学任务数量
BigDecimal progressFinishNum = stuTrainingMapper.selectProgressFinish(userId); //已学任务数量
stuTheoryIndexInfoDto.setLearnedModuleTaskNum(progressFinishNum);
int trainingNum = stuTrainingMapper.selectTrainingProgressFinish(userId); //已学案例数量
@ -56,9 +56,10 @@ public class StuIndexServiceImpl implements StuIndexService {
stuTheoryIndexInfoDto.setLearnedDuration(learningTime); //学习时长
}
int totalChapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId); //总章节数量
if (progressFinishNum != 0 && totalChapterNum != 0) {
int finalProgress = progressFinishNum / totalChapterNum; //任务进度 = 已学数量/总章节数量
BigDecimal totalChapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId); //总章节数量
if ((progressFinishNum != null && progressFinishNum.intValue() != 0) && (totalChapterNum != null && totalChapterNum.intValue() != 0)) {
//任务进度 = 已学数量/总章节数量 * 100
BigDecimal finalProgress = progressFinishNum.divide(totalChapterNum, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
stuTheoryIndexInfoDto.setProgress(finalProgress);
}
@ -74,7 +75,7 @@ public class StuIndexServiceImpl implements StuIndexService {
if (receiveDto != null) {
BigDecimal totalScore = receiveDto.getTotalScore();
BigDecimal stuScore = receiveDto.getStuScore();
if (totalScore.intValue() != 0 && stuScore.intValue() != 0) {
if ((totalScore != null && totalScore.intValue() != 0) && (stuScore != null && stuScore.intValue() != 0)) {
BigDecimal bigDecimal = totalScore.divide(stuScore, 2, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100)); //学生得分 / 总分 * 100
stuTheoryIndexInfoDto.setLastTaskAccuracy(bigDecimal); //最近一次考核正确率
}

@ -360,10 +360,10 @@ public class TeaGradeManageServiceImpl implements ITeaGradeManageService {
}
//封装参数
int chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId);
BigDecimal chapterNum = sysCourseChapterMapper.selectChapterBySchoolId(schoolId);
if (totalScore.intValue() != 0) {
int score = totalScore.intValue() / chapterNum; //已完成的模块分数/总模块数量
teaTrainingInfoDTO.setTotalScore(BigDecimal.valueOf(score));
BigDecimal score = totalScore.divide(chapterNum,2,RoundingMode.HALF_UP);//已完成的模块分数/总模块数量
teaTrainingInfoDTO.setTotalScore(score);
}
if (allProgress.intValue() != 0 && stuTrainings.size() != 0) {
BigDecimal divide = allProgress.divide(BigDecimal.valueOf(stuTrainings.size()), 2, RoundingMode.HALF_UP);

Loading…
Cancel
Save