|
@@ -5,29 +5,23 @@ import cn.hutool.core.lang.Validator;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
import com.zhongzheng.common.annotation.DataScope;
|
|
|
import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.common.utils.ServletUtils;
|
|
|
-import com.zhongzheng.modules.course.bo.CourseChapterSectionListAddBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseMenuListAddBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
|
|
|
import com.zhongzheng.modules.course.bo.CourseQueryBo;
|
|
|
-import com.zhongzheng.modules.course.domain.CourseChapterSection;
|
|
|
-import com.zhongzheng.modules.course.mapper.CourseChapterMapper;
|
|
|
import com.zhongzheng.modules.course.mapper.CourseMapper;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
|
|
|
import com.zhongzheng.modules.course.service.ICourseMenuService;
|
|
|
-import com.zhongzheng.modules.course.service.ICourseService;
|
|
|
-import com.zhongzheng.modules.course.vo.CourseMenuVo;
|
|
|
-import com.zhongzheng.modules.course.vo.CourseModuleFreeExamVo;
|
|
|
-import com.zhongzheng.modules.course.vo.CourseVo;
|
|
|
+import com.zhongzheng.modules.course.service.ICourseModuleChapterService;
|
|
|
+import com.zhongzheng.modules.course.vo.*;
|
|
|
import com.zhongzheng.modules.exam.bo.ExamNumberGoodsQueryBo;
|
|
|
import com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo;
|
|
|
import com.zhongzheng.modules.goods.bo.*;
|
|
|
import com.zhongzheng.modules.goods.domain.Goods;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsAttached;
|
|
|
-import com.zhongzheng.modules.goods.domain.GoodsAuditionConfig;
|
|
|
import com.zhongzheng.modules.goods.domain.GoodsCourse;
|
|
|
import com.zhongzheng.modules.goods.mapper.GoodsMapper;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsAttachedService;
|
|
@@ -36,11 +30,8 @@ import com.zhongzheng.modules.goods.service.IGoodsCourseService;
|
|
|
import com.zhongzheng.modules.goods.service.IGoodsService;
|
|
|
import com.zhongzheng.modules.goods.vo.*;
|
|
|
import com.zhongzheng.modules.grade.vo.ClassGradeVo;
|
|
|
-import com.zhongzheng.modules.order.bo.OrderGoodsQueryBo;
|
|
|
import com.zhongzheng.modules.order.domain.OrderGoods;
|
|
|
import com.zhongzheng.modules.order.service.IOrderGoodsService;
|
|
|
-import com.zhongzheng.modules.order.vo.OrderGoodsVo;
|
|
|
-import com.zhongzheng.modules.user.domain.UserBankRecord;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
@@ -49,9 +40,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.github.pagehelper.Page;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicReference;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static java.math.RoundingMode.HALF_UP;
|
|
|
+
|
|
|
/**
|
|
|
* 商品Service业务层处理
|
|
|
*
|
|
@@ -82,6 +77,12 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
@Autowired
|
|
|
private ICourseMenuService iCourseMenuService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ICourseChapterSectionService iCourseChapterSectionService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ICourseModuleChapterService iCourseModuleChapterService;
|
|
|
+
|
|
|
@Override
|
|
|
public GoodsVo queryById(Long goodsId){
|
|
|
Goods db = this.baseMapper.selectById(goodsId);
|
|
@@ -118,6 +119,43 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
|
|
vo.setTotalExamNum(totalNum);
|
|
|
}
|
|
|
}
|
|
|
+ //继教二建统计学时
|
|
|
+ if (Validator.isNotEmpty(bo.getChapterNum())) {
|
|
|
+ list.forEach(goodsVo -> {
|
|
|
+ AtomicReference<Double> classHours = new AtomicReference<>(0.0);
|
|
|
+ //查询课程列表
|
|
|
+ List<CourseVo> courseVoList = iGoodsCourseService.selectList(goodsVo.getGoodsId());
|
|
|
+ if (courseVoList != null && courseVoList.size() > 0) {
|
|
|
+ courseVoList.forEach(courseVo -> {
|
|
|
+ //获取模块信息
|
|
|
+ CourseMenuQueryBo bo1 = new CourseMenuQueryBo();
|
|
|
+ bo1.setCourseId(courseVo.getCourseId());
|
|
|
+ List<CourseMenuVo> courseMenuVoList = iCourseMenuService.selectList(bo1);
|
|
|
+ if (courseMenuVoList != null && courseMenuVoList.size() > 0) {
|
|
|
+ courseMenuVoList.forEach(courseMenuVo -> {
|
|
|
+ classHours.updateAndGet(v -> v + Math.round(courseMenuVo.getClassHours()));
|
|
|
+ //获取章信息
|
|
|
+ List<CourseModuleChapterVo> courseModuleChapterVoList = iCourseModuleChapterService.getListById(courseMenuVo.getMenuId());
|
|
|
+ AtomicReference<Double> chapterHours = new AtomicReference<>(0.0);
|
|
|
+ if (courseModuleChapterVoList != null && courseModuleChapterVoList.size() > 0) {
|
|
|
+ courseModuleChapterVoList.forEach(courseModuleChapterVo -> {
|
|
|
+ //获取节信息
|
|
|
+ List<CourseChapterSectionVo> courseChapterSectionVoList = iCourseChapterSectionService.getListById(courseModuleChapterVo.getChapterId());
|
|
|
+ if (courseChapterSectionVoList != null && courseChapterSectionVoList.size() > 0) {
|
|
|
+ courseChapterSectionVoList.forEach(courseChapterSectionVo -> {
|
|
|
+ chapterHours.updateAndGet(v -> v + courseChapterSectionVo.getClassHours());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ classHours.updateAndGet(v -> v + Math.round(chapterHours.get()));
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ goodsVo.setClassHours((new BigDecimal(String.valueOf(classHours))).setScale(0,HALF_UP));
|
|
|
+ });
|
|
|
+ }
|
|
|
return list;
|
|
|
}
|
|
|
|