he2802 3 anni fa
parent
commit
f00226e431

+ 13 - 0
zhongzheng-admin/src/main/java/com/zhongzheng/controller/course/CourseMenuController.java

@@ -78,6 +78,19 @@ public class CourseMenuController extends BaseController {
         return AjaxResult.success(iCourseMenuService.queryById(id));
     }
 
+
+
+    /**
+     * 新增商品-模块章目录结构
+     */
+    @ApiOperation("新增商品-模块章目录结构")
+    @PreAuthorize("@ss.hasPermi('system:menu:add')")
+    @Log(title = "课程目录结构", businessType = BusinessType.INSERT)
+    @PostMapping("/bindGoods")
+    public AjaxResult<Void> bindGoods(@RequestBody CourseMenuListAddBo bo) {
+        return toAjax(iCourseMenuService.insertByGoodsAddBo(bo) ? 1 : 0);
+    }
+
     /**
      * 新增课程目录结构
      */

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/bo/CourseMenuListAddBo.java

@@ -17,6 +17,10 @@ import java.util.List;
 @ApiModel("课程目录结构添加对象")
 public class CourseMenuListAddBo {
 
+    /** 商品ID */
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+
     /** 课程ID */
     @ApiModelProperty("课程ID")
     private Long courseId;

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/ICourseMenuService.java

@@ -39,6 +39,8 @@ public interface ICourseMenuService extends IService<CourseMenu> {
 	 */
 	Boolean insertByAddBo(CourseMenuListAddBo bo);
 
+	Boolean insertByGoodsAddBo(CourseMenuListAddBo bo);
+
 	/**
 	 * 根据编辑业务对象修改课程目录结构
 	 * @param bo 课程目录结构编辑业务对象

+ 16 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseMenuServiceImpl.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.course.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
@@ -16,6 +17,8 @@ import com.zhongzheng.modules.course.service.ICourseMenuService;
 import com.zhongzheng.modules.course.vo.CourseMenuVo;
 import com.zhongzheng.modules.course.vo.CourseUserChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseUserMenuVo;
+import com.zhongzheng.modules.goods.service.IGoodsService;
+import com.zhongzheng.modules.goods.vo.GoodsVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -46,6 +49,9 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
     @Autowired
     private ICourseMenuExamService iCourseMenuExamService;
 
+    @Autowired
+    private IGoodsService iGoodsService;
+
     @Override
     public CourseMenuVo queryById(Long id){
         CourseMenu db = this.baseMapper.selectById(id);
@@ -118,6 +124,16 @@ public class CourseMenuServiceImpl extends ServiceImpl<CourseMenuMapper, CourseM
         return result;
     }
 
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean insertByGoodsAddBo(CourseMenuListAddBo bo) {
+        if(Validator.isEmpty(bo.getGoodsId())){
+            throw new CustomException("缺少商品ID");
+        }
+        GoodsVo goodsVo =  iGoodsService.queryById(bo.getGoodsId());
+        return null;
+    }
+
     @Override
     @Transactional(rollbackFor = Exception.class)
     public Boolean updateByEditBo(CourseMenuListAddBo bo) {

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/service/impl/CourseServiceImpl.java

@@ -249,6 +249,8 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
         List<GoodsPeriodVo> goodsPeriodVos = baseMapper.listGoodsPeriodVo(bo);
         //查询学习记录,学时审核状态
         for (GoodsPeriodVo goodsPeriodVo : goodsPeriodVos) {
+            List<ExamApplyGoodsVo> applyList = iExamApplyGoodsService.listByGoodsId(goodsPeriodVo.getGoodsId());
+            goodsPeriodVo.setApplyList(applyList);
             Long secLong = 0L;
             Long studyLong = 0L;
             SubjectStudyRecordQueryBo subjectStudyRecordQueryBo = new SubjectStudyRecordQueryBo();

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

@@ -27,4 +27,7 @@ public class GoodsCourseAddBo {
     /** 排序 */
     @ApiModelProperty("排序")
     private Integer sort;
+    /** 1显示 0隐藏 */
+    @ApiModelProperty("1显示 0隐藏")
+    private Integer show;
 }

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

@@ -33,4 +33,7 @@ public class GoodsCourseEditBo {
     @ApiModelProperty("排序")
     private Integer sort;
 
+    /** 1显示 0隐藏 */
+    @ApiModelProperty("1显示 0隐藏")
+    private Integer show;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsCourseQueryBo.java

@@ -46,4 +46,8 @@ public class GoodsCourseQueryBo extends BaseEntity {
 
 	@ApiModelProperty("商品id数组")
 	private List<Long> goodsIds;
+
+	/** 1显示 0隐藏 */
+	@ApiModelProperty("1显示 0隐藏")
+	private Integer show;
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/domain/GoodsCourse.java

@@ -33,4 +33,6 @@ private static final long serialVersionUID=1L;
     private Long courseId;
     /** 排序 */
     private Integer sort;
+    /** 1显示 0隐藏 */
+    private Integer show;
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsCourseVo.java

@@ -37,4 +37,8 @@ public class GoodsCourseVo {
 	private Integer sort;
 	@ApiModelProperty("商品类型")
 	private Integer goodsType;
+	/** 1显示 0隐藏 */
+	@Excel(name = "1显示 0隐藏")
+	@ApiModelProperty("1显示 0隐藏")
+	private Integer show;
 }

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

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.goods.vo;
 
 import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -151,4 +152,6 @@ public class GoodsPeriodVo {
 	private String projectName;
 	@ApiModelProperty("业务层次名称")
 	private String businessName;
+	@ApiModelProperty("商品关联的考试安排")
+	private List<ExamApplyGoodsVo> applyList;
 }

+ 0 - 1
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMapper.xml

@@ -420,7 +420,6 @@
             cgu.grade_id,
             (case WHEN (SELECT COUNT(1) FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) >0 then 1 ELSE 0 end) as apply_status,
             (case WHEN (SELECT COUNT(1) FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) >0 then 1 ELSE 0 end) as before_status,
-            (SELECT ea.apply_name FROM exam_apply_goods eag LEFT JOIN exam_apply ea on eag.apply_id = ea.apply_id where eag.goods_id = cgg.goods_id and ea.`status` = 1 and unix_timestamp(now()) BETWEEN ea.apply_start_time and ea.apply_end_time) as apply_name,
             (SELECT eb.before_name FROM exam_before_goods ebg LEFT JOIN exam_before eb on ebg.before_id = eb.before_id where ebg.goods_id = cgg.goods_id and eb.`status` = 1 and unix_timestamp(now()) BETWEEN eb.before_start_time and eb.before_end_time) as before_name,
             cgu.order_goods_id,
             og.service_start_time,