浏览代码

submit:BUG处理

yangdamao 2 年之前
父节点
当前提交
28a7835165

+ 5 - 3
zhongzheng-api/src/main/java/com/zhongzheng/controller/goods/GoodsController.java

@@ -312,9 +312,11 @@ public class GoodsController extends BaseController {
      * 获取商品所有节列表
      */
     @ApiOperation("获取商品所有节列表")
-    @GetMapping("/section/list/{goodsId}")
-    public AjaxResult<List<GoodsSectionListVo>>  getGoodsSectionList(@PathVariable("goodsId") Long goodsId) {
-        return AjaxResult.success(iOrderGoodsService.getGoodsSectionList(goodsId));
+    @GetMapping("/section/list")
+    public AjaxResult<List<GoodsSectionListVo>> getGoodsSectionList(GoodsSectionListBo bo) {
+        ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
+        bo.setUserId(loginUser.getUser().getUserId());
+        return AjaxResult.success(iOrderGoodsService.getGoodsSectionList(bo));
     }
 
 }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/course/mapper/CourseMenuMapper.java

@@ -22,6 +22,8 @@ public interface CourseMenuMapper extends BaseMapper<CourseMenu> {
 
     Integer rebuildCheck(@Param("sectionId") Long id,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
 
+    Integer rebuildSectionCheck(@Param("sectionId") Long id,@Param("moduleId") Long moduleId,@Param("chapterId") Long chapterId,@Param("gradeId") Long gradeId,@Param("userId")Long userId,@Param("courseId")Long courseId);
+
     Integer rebuildChapterCheck(@Param("chapterId")Long id,@Param("gradeId") Long gradeId,@Param("userId") Long userId,@Param("courseId")Long courseId);
 
     Integer rebuildModuleCheck(@Param("moduleId")Long id,@Param("gradeId") Long gradeId,@Param("userId") Long userId,@Param("courseId")Long courseId);

+ 26 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/bo/GoodsSectionListBo.java

@@ -0,0 +1,26 @@
+package com.zhongzheng.modules.goods.bo;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author yangdamao
+ * @date 2022年12月20日 14:20
+ */
+@Data
+public class GoodsSectionListBo implements Serializable {
+
+    @ApiModelProperty("商品ID")
+    private Long goodsId;
+
+    @ApiModelProperty("班级ID")
+    private Long gradeId;
+
+    @ApiModelProperty("班级ID")
+    private Long userId;
+
+    @ApiModelProperty("是否重修目录:1是 0否")
+    private Integer rebuild;
+}

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

@@ -855,15 +855,20 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
                 .list(new LambdaQueryWrapper<GoodsSpecAttributeRelation>()
                 .eq(GoodsSpecAttributeRelation::getGoodsId, goodsId)
                 .eq(GoodsSpecAttributeRelation::getStatus, 1));
+        List<GoodsSpecTemplate> templates = new ArrayList<>();
         if (CollectionUtils.isEmpty(relationList)){
-            return new ArrayList<>();
+            //没有关联获取商品业务层次下所有模板
+            Goods goods = getById(goodsId);
+            templates = goodsSpecTemplateService.list(new LambdaQueryWrapper<GoodsSpecTemplate>()
+            .eq(GoodsSpecTemplate::getEducationTypeId,goods.getEducationTypeId())
+            .eq(GoodsSpecTemplate::getBusinessId,goods.getBusinessId()));
+        }else {
+            Set<Long> specTemplateIds = relationList.stream().filter(x -> ObjectUtils.isNotNull(x.getSpecTemplateId()))
+                    .map(GoodsSpecAttributeRelation::getSpecTemplateId).collect(Collectors.toSet());
+            templates = goodsSpecTemplateService
+                    .list(new LambdaQueryWrapper<GoodsSpecTemplate>()
+                            .in(GoodsSpecTemplate::getSpecTemplateId, specTemplateIds));
         }
-        Set<Long> specTemplateIds = relationList.stream().filter(x -> ObjectUtils.isNotNull(x.getSpecTemplateId()))
-                .map(GoodsSpecAttributeRelation::getSpecTemplateId).collect(Collectors.toSet());
-
-        List<GoodsSpecTemplate> templates = goodsSpecTemplateService
-                .list(new LambdaQueryWrapper<GoodsSpecTemplate>()
-                .in(GoodsSpecTemplate::getSpecTemplateId, specTemplateIds));
         if (CollectionUtils.isEmpty(templates)){
             return new ArrayList<>();
         }

+ 2 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsSectionListVo.java

@@ -34,5 +34,7 @@ public class GoodsSectionListVo implements Serializable {
     @ApiModelProperty("模塊ID")
     private Long moduleId;
 
+    @ApiModelProperty("1要重修")
+    private Integer rebuild;
 
 }

+ 1 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/bo/GradeChangeEjjjPeopleBo.java

@@ -16,5 +16,5 @@ public class GradeChangeEjjjPeopleBo implements Serializable {
     private String officialName;
 
     @ApiModelProperty("官方班级人数")
-    private Integer peopleNum;
+    private Integer num;
 }

+ 2 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/service/impl/ClassGradeServiceImpl.java

@@ -803,11 +803,11 @@ public class ClassGradeServiceImpl extends ServiceImpl<ClassGradeMapper, ClassGr
             if(Validator.isNotEmpty(gradeVo)&&Validator.isNotEmpty(gradeVo.getOfficialName())){
                 ClassGradeQueryBo queryBo = new ClassGradeQueryBo();
                 queryBo.setOfficialName(gradeVo.getOfficialName());
-                Integer peopleNum = queryOfficialGradeCount(queryBo);
+                Integer num = queryOfficialGradeCount(queryBo);
                 List<GradeChangeEjjjPeopleBo> boList = new ArrayList<>();
                 GradeChangeEjjjPeopleBo bo = new GradeChangeEjjjPeopleBo();
                 bo.setOfficialName(gradeVo.getOfficialName());
-                bo.setPeopleNum(peopleNum);
+                bo.setNum(num);
                 boList.add(bo);
                 //通知旧系统
                 Map<String, String> params = new HashMap<>();

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/IOrderGoodsService.java

@@ -6,6 +6,7 @@ import com.zhongzheng.common.core.page.TableDataInfo;
 import com.zhongzheng.modules.course.vo.CourseLiveVo;
 import com.zhongzheng.modules.goods.bo.CheckGoodsStatusBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
+import com.zhongzheng.modules.goods.bo.GoodsSectionListBo;
 import com.zhongzheng.modules.goods.vo.GoodsSectionListVo;
 import com.zhongzheng.modules.order.bo.*;
 import com.zhongzheng.modules.order.domain.OrderGoods;
@@ -109,5 +110,5 @@ public interface IOrderGoodsService extends IService<OrderGoods> {
 
     Boolean checkGoodsStatus(CheckGoodsStatusBo bo);
 
-    List<GoodsSectionListVo> getGoodsSectionList(Long goodsId);
+    List<GoodsSectionListVo> getGoodsSectionList(GoodsSectionListBo bo);
 }

+ 21 - 2
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderGoodsServiceImpl.java

@@ -18,6 +18,7 @@ import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
 import com.zhongzheng.modules.base.domain.ShoppingCart;
 import com.zhongzheng.modules.base.service.IShoppingCartService;
 import com.zhongzheng.modules.course.mapper.CourseMapper;
+import com.zhongzheng.modules.course.mapper.CourseMenuMapper;
 import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
 import com.zhongzheng.modules.course.service.ICourseMenuService;
 import com.zhongzheng.modules.course.service.ICourseSectionService;
@@ -32,6 +33,7 @@ import com.zhongzheng.modules.exam.vo.ExamApplyGoodsVo;
 import com.zhongzheng.modules.goods.bo.CheckGoodsStatusBo;
 import com.zhongzheng.modules.goods.bo.GoodsCourseQueryBo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
+import com.zhongzheng.modules.goods.bo.GoodsSectionListBo;
 import com.zhongzheng.modules.goods.domain.Goods;
 import com.zhongzheng.modules.goods.service.IGoodsCourseService;
 import com.zhongzheng.modules.goods.service.IGoodsService;
@@ -147,6 +149,9 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
     @Autowired
     private IShoppingCartService iShoppingCartService;
 
+    @Autowired
+    private CourseMenuMapper courseMenuMapper;
+
     @Override
     public OrderGoodsVo queryById(Long orderGoodsId) {
         OrderGoods db = this.baseMapper.selectById(orderGoodsId);
@@ -642,8 +647,22 @@ public class OrderGoodsServiceImpl extends ServiceImpl<OrderGoodsMapper, OrderGo
     }
 
     @Override
-    public List<GoodsSectionListVo> getGoodsSectionList(Long goodsId) {
-        return baseMapper.getGoodsSectionList(goodsId);
+    public List<GoodsSectionListVo> getGoodsSectionList(GoodsSectionListBo bo) {
+        List<GoodsSectionListVo> resultVos = baseMapper.getGoodsSectionList(bo.getGoodsId());
+        if (CollectionUtils.isEmpty(resultVos)){
+            return new ArrayList<>();
+        }
+        if (ObjectUtils.isNull(bo.getRebuild()) || bo.getRebuild() == 0){
+            return resultVos;
+        }
+        //获取需要重修的节
+        resultVos.forEach(item -> {
+            Integer rebuild = courseMenuMapper.rebuildSectionCheck(item.getSectionId(),item.getModuleId(), item.getChapterId(),bo.getGradeId(), bo.getUserId(),item.getCourseId());
+            if (rebuild > 0) {
+                item.setRebuild(1);
+            }
+        });
+        return  resultVos.stream().filter(s -> s.getRebuild() != null && s.getRebuild().equals(1)).collect(Collectors.toList());
     }
 
     private boolean checkUnique(Long GoodsId,Long UserId) {

+ 17 - 0
zhongzheng-system/src/main/resources/mapper/modules/course/CourseMenuMapper.xml

@@ -269,6 +269,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           and (ups.`status` = 0 or ups.`status` = 3)
     </select>
 
+    <select id="rebuildSectionCheck" parameterType="map"  resultType="Integer">
+        SELECT
+            COUNT(up.id)
+        FROM
+            user_period up
+                LEFT JOIN user_period_status ups ON up.id = ups.period_id
+        WHERE
+            up.grade_id =#{gradeId}
+          AND up.user_id = #{userId}
+          AND up.module_id= #{moduleId}
+          and up.chapter_id= #{chapterId}
+          and up.course_id=#{courseId}
+          and up.section_id=#{sectionId}
+          AND ups.period_status =1
+          and (ups.`status` = 0 or ups.`status` = 3)
+    </select>
+
     <select id="auditCheck" parameterType="map"  resultType="Integer">
         SELECT
             COUNT(up.id)