فهرست منبع

fix 二建继教

tanzh 3 سال پیش
والد
کامیت
7e3dbc3e8d

+ 10 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseChapterSectionServiceImpl.java

@@ -49,7 +49,16 @@ public class CourseChapterSectionServiceImpl extends ServiceImpl<CourseChapterSe
 
     @Override
     public List<CourseChapterSectionVo> getListById(Long id) {
-        return courseChapterSectionMapper.getListById(id);
+        List<CourseChapterSectionVo> list = courseChapterSectionMapper.getListById(id);
+        list.forEach(courseChapterSectionVo -> {
+            if (Validator.isNotNull(courseChapterSectionVo.getDurationTime())) {
+                //设置节时长(分钟)
+                courseChapterSectionVo.setDurationMinTime(Math.ceil(courseChapterSectionVo.getDurationTime()/60.0));
+                //设置学时
+                courseChapterSectionVo.setClassHours(Double.valueOf(String.format("%.2f", courseChapterSectionVo.getDurationMinTime()/45.0)));
+            }
+        });
+        return list;
     }
 
     @Override

+ 10 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java

@@ -69,7 +69,16 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
 
     @Override
     public List<CourseMenuVo> selectList(CourseMenuQueryBo bo) {
-        return courseMenuMapper.getList(bo);
+        List<CourseMenuVo> list = courseMenuMapper.getList(bo);
+        list.forEach(courseMenuVo -> {
+            if (Validator.isNotNull(courseMenuVo.getDurationTime())) {
+                //设置节时长(分钟)
+                courseMenuVo.setDurationMinTime(Math.ceil(courseMenuVo.getDurationTime()/60.0));
+                //设置学时
+                courseMenuVo.setClassHours(Double.valueOf(String.format("%.2f", courseMenuVo.getDurationMinTime()/45.0)));
+            }
+        });
+        return list;
     }
 
     @Override

+ 9 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseChapterSectionVo.java

@@ -61,10 +61,18 @@ public class CourseChapterSectionVo {
 	@Excel(name = "排序")
 	@ApiModelProperty("$column.columnComment")
 	private Long sort;
+	/** 节时长(秒) */
+	@Excel(name = "节时长(秒)")
+	@ApiModelProperty("节时长(秒)")
+	private Long durationTime;
 	/** 节时长(分钟) */
 	@Excel(name = "节时长(分钟)")
 	@ApiModelProperty("节时长(分钟)")
-	private Long durationTime;
+	private Double durationMinTime;
+	/** 学时 */
+	@Excel(name = "学时")
+	@ApiModelProperty("学时")
+	private Double classHours;
 
 	/** 1模块卷 2章卷 3试卷 */
 	@Excel(name = "1模块卷 2章卷 3试卷")

+ 11 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/vo/CourseMenuVo.java

@@ -5,6 +5,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
+
+import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
 
@@ -46,10 +48,18 @@ public class CourseMenuVo {
 	private Integer status;
 	@ApiModelProperty("目录名称")
 	private String menuName;
+	/** 节时长(秒) */
+	@Excel(name = "节时长(秒)")
+	@ApiModelProperty("节时长(秒)")
+	private Long durationTime;
 	/** 节时长(分钟) */
 	@Excel(name = "节时长(分钟)")
 	@ApiModelProperty("节时长(分钟)")
-	private Long durationTime;
+	private Double durationMinTime;
+	/** 学时 */
+	@Excel(name = "学时")
+	@ApiModelProperty("学时")
+	private Double classHours;
 	private Integer sort;
 
 	@ApiModelProperty("录播和回放的url地址")

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsQueryBo.java

@@ -146,6 +146,9 @@ GoodsQueryBo extends BaseEntity {
 	@ApiModelProperty("被补考的商品")
 	private Long makeGoodsId;
 
+	@ApiModelProperty("获取章数量 1")
+	private Long chapterNum;
+
 	@ApiModelProperty("获取节数量 1")
 	private Long sectionNum;
 

+ 50 - 12
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/service/impl/GoodsServiceImpl.java

@@ -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;
     }
 

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsVo.java

@@ -239,6 +239,9 @@ public class GoodsVo {
 	@ApiModelProperty("课程数量")
 	private Long courseNum;
 
+	@ApiModelProperty("章数量")
+	private Long chapterNum;
+
 	@ApiModelProperty("节数量")
 	private Long sectionNum;
 

+ 16 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeUserServiceImpl.java

@@ -109,6 +109,9 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
     @Autowired
     private IUserStudyRecordPhotoService userStudyRecordPhotoService;
 
+    @Autowired
+    private IUserStudyRecordPhotoService iUserStudyRecordPhotoService;
+
     @Autowired
     private OssService ossService;
 
@@ -957,6 +960,19 @@ public class ClassGradeUserServiceImpl extends ServiceImpl<ClassGradeUserMapper,
                     }
                 }
             }
+
+            //查询学员最近人脸照
+            LambdaQueryWrapper<UserStudyRecordPhoto> lqw = Wrappers.lambdaQuery();
+            lqw.eq(UserStudyRecordPhoto::getUserId, classPeriodStudentVo.getUserId());
+            lqw.orderByDesc(UserStudyRecordPhoto::getCreateTime);
+            List<UserStudyRecordPhoto> userStudyRecordPhotoList = iUserStudyRecordPhotoService.list(lqw);
+            List<String> recenPhotosList = new ArrayList<>();
+            userStudyRecordPhotoList.forEach(userStudyRecordPhoto -> {
+                if (Validator.isNotNull(userStudyRecordPhoto.getPhoto())) {
+                    recenPhotosList.add(userStudyRecordPhoto.getPhoto());
+                }
+            });
+            classPeriodStudentVo.setRecenPhotosList(recenPhotosList);
         }
         return classPeriodStudentVos;
     }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodStudentVo.java

@@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.util.List;
 
 
 /**
@@ -198,4 +199,6 @@ public class ClassPeriodStudentVo {
 
 	private String oneInchPhotosOss;
 
+	private List<String> recenPhotosList;
+
 }

+ 4 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsMapper.xml

@@ -123,6 +123,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="certificateId" column="certificate_id"/>
         <result property="certificateTpId" column="certificate_tp_id"/>
         <result property="subjectNames" column="subject_names"/>
+        <result property="chapterNum" column="chapter_num"/>
     </resultMap>
 
     <resultMap type="com.zhongzheng.modules.exam.vo.ExamNumberGoodsVo" id="ExamNumberGoodsVoResult">
@@ -156,6 +157,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="sectionNum ==1">
         ,(SELECT COUNT(m.id)+(SELECT COUNT(n.id) FROM course_chapter_section n LEFT JOIN course_module_chapter p on n.chapter_id = p.chapter_id LEFT JOIN course_menu m on m.menu_id = p.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id  where gc.goods_id =  g.goods_id and m.type in(1))+(SELECT COUNT(n.id) FROM course_chapter_section n  LEFT JOIN course_menu m on m.menu_id = n.chapter_id LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id =  g.goods_id and m.type in(2)) FROM course_menu m LEFT JOIN goods_course gc on gc.course_id = m.course_id  where gc.goods_id =  g.goods_id  and m.type in(3)) as section_num
         </if>
+        <if test="chapterNum ==1">
+        ,(SELECT COUNT(m.id)+(SELECT COUNT(p.id) FROM course_module_chapter p LEFT JOIN course_menu m on m.menu_id = p.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id  where gc.goods_id =  g.goods_id and m.type in(1))+(SELECT COUNT(cmc.id) FROM course_module_chapter cmc  LEFT JOIN course_menu m on m.menu_id = cmc.module_id LEFT JOIN goods_course gc on gc.course_id = m.course_id where gc.goods_id =  g.goods_id and m.type in(2)) FROM course_menu m LEFT JOIN goods_course gc on gc.course_id = m.course_id  where gc.goods_id =  g.goods_id  and m.type in(3)) as chapter_num
+        </if>
         <if test="goodsType ==1">
         , (SELECT count(*) FROM goods_course where goods_id =g.goods_id ) as course_num
         , (SELECT count(*) FROM class_grade cg  LEFT JOIN class_grade_goods cgg on cg.grade_id = cgg.grade_id where  cgg.goods_id = g.goods_id and cg.`status` = 1 ) as grade_num