|
|
@@ -3,12 +3,10 @@ package cn.iocoder.byzs.module.web.service.blockly;
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
import cn.iocoder.byzs.framework.common.enums.CommonStatusEnum;
|
|
|
import cn.iocoder.byzs.framework.common.util.object.BeanUtils;
|
|
|
-import cn.iocoder.byzs.framework.web.core.util.WebFrameworkUtils;
|
|
|
import cn.iocoder.byzs.module.blockly.controller.admin.blockly.vo.BlocklyPageReqVO;
|
|
|
import cn.iocoder.byzs.module.blockly.controller.admin.blocklyConfig.vo.BlocklyConfigRespVO;
|
|
|
import cn.iocoder.byzs.module.blockly.service.blockly.BlocklyService;
|
|
|
import cn.iocoder.byzs.module.blockly.service.blocklyConfig.BlocklyConfigService;
|
|
|
-import cn.iocoder.byzs.module.blockly.service.blocklyType.BlocklyTypeService;
|
|
|
import cn.iocoder.byzs.module.web.controller.admin.blockly.vo.WebBlocklyTypeVO;
|
|
|
import cn.iocoder.byzs.module.web.controller.admin.blockly.vo.WebBlocklyVO;
|
|
|
import cn.iocoder.byzs.module.web.controller.admin.blocklyprogress.vo.WebBlocklyProgressDO;
|
|
|
@@ -33,8 +31,6 @@ import java.util.stream.Collectors;
|
|
|
@Validated
|
|
|
public class WebBlocklyServiceImpl {
|
|
|
|
|
|
- @Resource
|
|
|
- private BlocklyTypeService blocklyTypeService;
|
|
|
@Resource
|
|
|
private BlocklyService blocklyService;
|
|
|
@Resource
|
|
|
@@ -63,7 +59,7 @@ public class WebBlocklyServiceImpl {
|
|
|
|
|
|
//课程小节进度
|
|
|
List<WebBlocklyProgressDO> progressList = webBlocklyProgressService.getBlocklyProgressByTypeId(typeId);
|
|
|
- Map<Long, WebBlocklyProgressDO> progressMap = progressList.stream().collect(Collectors.toMap(WebBlocklyProgressDO::getBrpUserId, a -> a));
|
|
|
+ Map<Long, WebBlocklyProgressDO> progressMap = progressList.stream().collect(Collectors.toMap(WebBlocklyProgressDO::getBrpCourseId, a -> a));
|
|
|
|
|
|
|
|
|
|
|
|
@@ -101,8 +97,27 @@ public class WebBlocklyServiceImpl {
|
|
|
* @param themeId
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<WebBlocklyTypeVO> getTypeByThemeId(Integer themeId) {
|
|
|
- WebBlocklyTypeVO blocklyTypeVO = new WebBlocklyTypeVO().setCtParentId(themeId).setUserId(WebFrameworkUtils.getLoginUserId());
|
|
|
- return webBlocklyMapper.getTypeByThemeId(blocklyTypeVO);
|
|
|
+ public List<WebBlocklyTypeVO> getTypeByThemeId(Long themeId) {
|
|
|
+
|
|
|
+ //查询课程类型列表
|
|
|
+ List<WebBlocklyTypeVO> list = webBlocklyMapper.getTypeByThemeId(new WebBlocklyTypeVO().setCtParentId(themeId));
|
|
|
+ List<WebBlocklyTypeVO> blocklyTypeVoList = BeanUtils.toBean(list, WebBlocklyTypeVO.class);
|
|
|
+
|
|
|
+ //课程小节进度
|
|
|
+ List<WebBlocklyProgressDO> progressList = webBlocklyProgressService.getBlocklyProgressByThemeId(themeId);
|
|
|
+ Map<Long, WebBlocklyProgressDO> progressMap = progressList.stream().collect(Collectors.toMap(WebBlocklyProgressDO::getBrpCtId, a -> a));
|
|
|
+
|
|
|
+ blocklyTypeVoList.forEach(blocklyType -> {
|
|
|
+ if (progressMap.containsKey(blocklyType.getId())) {
|
|
|
+ WebBlocklyProgressDO progress = progressMap.get(blocklyType.getId());
|
|
|
+ Double brpProgress = progress.getBrpProgress();
|
|
|
+ long progressL = Math.round(brpProgress / blocklyType.getSectionCount() * 5);
|
|
|
+ blocklyType.setProgress((int) progressL);
|
|
|
+ }else{
|
|
|
+ blocklyType.setProgress(0);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return blocklyTypeVoList;
|
|
|
}
|
|
|
}
|