|
@@ -14,9 +14,11 @@ import com.gyee.boot.base.api.utils.BeanMapper;
|
|
|
import com.gyee.boot.base.api.utils.DecimalUtils;
|
|
|
import com.gyee.exam.enums.OpenType;
|
|
|
import com.gyee.exam.modules.course.dto.CourseDTO;
|
|
|
+import com.gyee.exam.modules.course.dto.CourseLearnDTO;
|
|
|
import com.gyee.exam.modules.course.dto.ext.CourseDetailExtDTO;
|
|
|
import com.gyee.exam.modules.course.dto.ext.CourseRefDirExtDTO;
|
|
|
import com.gyee.exam.modules.course.dto.ext.CourseRefFileExtDTO;
|
|
|
+import com.gyee.exam.modules.course.dto.request.CourseOpenDepartReqDTO;
|
|
|
import com.gyee.exam.modules.course.dto.request.UserCourseReqDTO;
|
|
|
import com.gyee.exam.modules.course.dto.response.*;
|
|
|
import com.gyee.exam.modules.course.entity.Course;
|
|
@@ -75,6 +77,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
@Autowired
|
|
|
private CourseFileLearnService courseFileLearnService;
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
public IPage<CourseDTO> paging(PagingReqDTO<CourseDTO> reqDTO) {
|
|
|
|
|
@@ -228,7 +231,7 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
page.getRecords().stream().forEach(i->{
|
|
|
i.setNeedLearnCount(map.get(i.getId()).getNeedLearn());
|
|
|
i.setLearnMinCount(map.get(i.getId()).getLearnMin());
|
|
|
- i.setProportion(DecimalUtils.round(map.get(i.getId()).getLearnMin() / map.get(i.getId()).getNeedLearn(), 2));
|
|
|
+ i.setProportion(DecimalUtils.round(null == map.get(i.getId()).getLearnMin() ? 0 : map.get(i.getId()).getLearnMin() / map.get(i.getId()).getNeedLearn(), 2));
|
|
|
});
|
|
|
return page;
|
|
|
}
|
|
@@ -355,15 +358,31 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
|
|
|
|
|
|
List<CourseUserIdTotalDTO> dtoList = baseMapper.selectCourseUserIdTotal(reqDTO);
|
|
|
List<CourseUserIdTotalDTO> mindtos = courseFileLearnService.getCourseUserIdTotalMin(reqDTO);
|
|
|
+ List<CourseLearnDTO> learndtos = courseLearnService.getCourseLearnFinishTime(reqDTO);
|
|
|
if(null != mindtos && mindtos.size()>0){
|
|
|
Map<String,Integer> map = mindtos.stream().collect(Collectors.toMap(CourseUserIdTotalDTO::getId, CourseUserIdTotalDTO::getLearnMin));
|
|
|
dtoList.stream().forEach(d->{
|
|
|
d.setLearnMin(map.get(d.getId()));
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
+ if(null != learndtos && learndtos.size()>0){
|
|
|
+ Map<String,List<CourseLearnDTO> > groupmap = learndtos.stream().collect(Collectors.groupingBy(CourseLearnDTO::getCourseId));
|
|
|
+ dtoList.stream().forEach(d->{
|
|
|
+ d.setUpdateTime(groupmap.get(d.getId()).get(0).getUpdateTime());
|
|
|
+ d.setFinishTime(groupmap.get(d.getId()).get(0).getFinishTime());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
return dtoList;
|
|
|
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public List<CourseOpenDepartDTO> getCourseOpenDepart(CourseOpenDepartReqDTO reqDTO) {
|
|
|
+ List<CourseOpenDepartDTO> dtos = baseMapper.selectCourseOpenDepart(reqDTO);
|
|
|
+ return dtos;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|