学习任务中,时长未统计bug修改
This commit is contained in:
parent
c09e3e312b
commit
72b53ce476
|
|
@ -108,6 +108,22 @@ public class LearningTaskServiceImpl implements LearningTaskService {
|
||||||
return bigDecimal.floatValue();
|
return bigDecimal.floatValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Float getStudyTimeById(List<Map<String, Object>> list) {
|
||||||
|
if (CollectionUtils.isEmpty(list)) {
|
||||||
|
return 0F;
|
||||||
|
}
|
||||||
|
BigDecimal bigDecimal = new BigDecimal("0");
|
||||||
|
for (Map<String, Object> map : list) {
|
||||||
|
Object studyTimeObj = map.get("time");
|
||||||
|
if (studyTimeObj != null) {
|
||||||
|
BigDecimal studyTime = BigDecimal.valueOf(Float.parseFloat(String.valueOf(studyTimeObj)));
|
||||||
|
// 继续处理 studyTime
|
||||||
|
bigDecimal = bigDecimal.add(studyTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bigDecimal.floatValue();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public AjaxResult addStudyTask(MultipartFile file, String params) {
|
public AjaxResult addStudyTask(MultipartFile file, String params) {
|
||||||
|
|
@ -494,7 +510,9 @@ public class LearningTaskServiceImpl implements LearningTaskService {
|
||||||
Float time = getStudyTaskById(studyTaskCoursewareTimeList);
|
Float time = getStudyTaskById(studyTaskCoursewareTimeList);
|
||||||
// 培训人员学习时长
|
// 培训人员学习时长
|
||||||
List<Map<String, Object>> studyTimes = mapper.getTaskCoursewareTime(dto.getStudyTaskId());
|
List<Map<String, Object>> studyTimes = mapper.getTaskCoursewareTime(dto.getStudyTaskId());
|
||||||
|
Float studyTimeById = getStudyTimeById(studyTimes);
|
||||||
for (StudyTaskPersonVo vo : list) {
|
for (StudyTaskPersonVo vo : list) {
|
||||||
|
vo.setStudyTime(studyTimeById);
|
||||||
if (CollectionUtils.isNotEmpty(hasExam)) {
|
if (CollectionUtils.isNotEmpty(hasExam)) {
|
||||||
int num = mapper.getExamRecord(hasExam.get(0), 1, String.valueOf(vo.getUserId()));
|
int num = mapper.getExamRecord(hasExam.get(0), 1, String.valueOf(vo.getUserId()));
|
||||||
if (num > 0) {
|
if (num > 0) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue