he2802 2 年之前
父节点
当前提交
e3151228c9

+ 0 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/grade/vo/ClassPeriodVo.java

@@ -47,7 +47,6 @@ public class ClassPeriodVo implements Comparable<ClassPeriodVo> {
 	@ApiModelProperty("模塊ID")
 	private Long moduleId;
 
-	/** 商品ID */
 	@ApiModelProperty("商品ID")
 	private Long goodsId;
 

+ 42 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/service/impl/OrderServiceImpl.java

@@ -5,6 +5,7 @@ import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.IdUtil;
 import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.zhongzheng.common.core.redis.RedisCache;
 import com.zhongzheng.common.core.redis.RedisLockEntity;
 import com.zhongzheng.common.exception.CustomException;
@@ -16,8 +17,12 @@ import com.zhongzheng.modules.base.bo.ConsoleQueryBo;
 import com.zhongzheng.modules.base.service.IProfileTpService;
 import com.zhongzheng.modules.base.service.IShoppingCartService;
 import com.zhongzheng.modules.course.bo.CourseMenuQueryBo;
+import com.zhongzheng.modules.course.domain.CourseEducationType;
+import com.zhongzheng.modules.course.domain.CourseSubject;
 import com.zhongzheng.modules.course.service.ICourseBusinessService;
+import com.zhongzheng.modules.course.service.ICourseEducationTypeService;
 import com.zhongzheng.modules.course.service.ICourseMenuService;
+import com.zhongzheng.modules.course.service.ICourseSubjectService;
 import com.zhongzheng.modules.course.vo.CourseBusinessVo;
 import com.zhongzheng.modules.course.vo.CourseMenuVo;
 import com.zhongzheng.modules.course.vo.CourseModuleFreeExamVo;
@@ -56,6 +61,7 @@ import com.zhongzheng.modules.user.service.IUserMockSubscribeService;
 import com.zhongzheng.modules.user.service.IUserService;
 import com.zhongzheng.modules.user.vo.UserVo;
 import com.zhongzheng.modules.wx.service.IWxPayService;
+import net.polyv.common.v1.util.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -140,6 +146,11 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
     @Autowired
     private IUserMockSubscribeService iUserMockSubscribeService;
 
+    @Autowired
+    private ICourseEducationTypeService courseEducationTypeService;
+    @Autowired
+    private ICourseSubjectService courseSubjectService;
+
 
     @Override
     public OrderVo queryById(Long orderId) {
@@ -1529,7 +1540,36 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         classGrade.setStatus(1);
         String gradeCode = ServletUtils.getEncoded("BJ");
         classGrade.setGradeCode(gradeCode);
-        classGrade.setClassName(goodsName + gradeCode);
+//        classGrade.setClassName(goodsName + gradeCode);
+        //班级名称 年份+期数+业务层次(俗名)+教育类型+科目(存在多个科目时,显示多个科目,用“+”分割)
+        String businessName = businessVo.getAliasName();
+        Goods goods = iGoodsService.getById(goodsId);
+        CourseEducationType educationType = courseEducationTypeService.getById(goods.getEducationTypeId());
+        String educationName = educationType.getEducationName();
+        String className = businessName + educationName;
+        if (StringUtils.isNotBlank(goods.getSubjectIds())){
+            List<CourseSubject> subjects = courseSubjectService.listByIds(Arrays.stream(goods.getSubjectIds().split(",")).collect(Collectors.toList()));
+            List<String> names = subjects.stream().map(CourseSubject::getSubjectName).collect(Collectors.toList());
+            className = String.format("%s(%s)",className,org.apache.commons.lang3.StringUtils.join(names,'+'));
+        }
+        Integer nameSort = 1;
+        //获取排序值
+        List<ClassGrade> list = iClassGradeService
+                .list(new LambdaQueryWrapper<ClassGrade>()
+                .like(ClassGrade::getClassName, className));
+        if (CollectionUtils.isNotEmpty(list)){
+            List<Integer> collect = list.stream().filter(x -> x.getClassName().contains("第") && x.getClassName().contains("期")).map(item -> {
+                String name = item.getClassName();
+                String substring = name.substring(name.indexOf("第") + 1, name.indexOf("期"));
+                return Integer.parseInt(substring);
+            }).collect(Collectors.toList());
+            if (CollectionUtils.isNotEmpty(collect)){
+                Integer integer = collect.stream().sorted(Comparator.reverseOrder()).findFirst().get();
+                nameSort = integer + 1;
+            }
+        }
+        classGrade.setClassName(String.format("%s年第%s期%s",goods.getYear(),nameSort,className));
+
         boolean save = iClassGradeService.save(classGrade);
         //绑定班级商品
         ClassGradeGoods classGradeGoods = new ClassGradeGoods();
@@ -1543,6 +1583,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
         return true;
     }
 
+
     //选择新的班级
     @Override
     public Long changeGrade(String goodsName, Long goodsId, Long orderGoodsId, Long gradeId, Long userId, Long businessId) {

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/order/vo/OrderGoodsVo.java

@@ -316,5 +316,6 @@ public class OrderGoodsVo {
 	@Excel(name = "用户剩余学习次数")
 	@ApiModelProperty("用户剩余学习次数")
 	private Long userStudyCount;
-
+	@ApiModelProperty("0不限制 2限制整个目录顺序")
+	private Integer goodsLearningOrder;
 }

+ 5 - 5
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserStudyRecordServiceImpl.java

@@ -18,13 +18,11 @@ import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
 import com.zhongzheng.modules.course.bo.*;
 import com.zhongzheng.modules.course.domain.CourseBusiness;
+import com.zhongzheng.modules.course.domain.CourseMenuExam;
 import com.zhongzheng.modules.course.domain.CoursePhotoLog;
 import com.zhongzheng.modules.course.domain.CourseSection;
 import com.zhongzheng.modules.course.mapper.CourseChapterSectionMapper;
-import com.zhongzheng.modules.course.service.ICourseBusinessService;
-import com.zhongzheng.modules.course.service.ICourseChapterSectionService;
-import com.zhongzheng.modules.course.service.ICoursePhotoLogService;
-import com.zhongzheng.modules.course.service.ICourseSectionService;
+import com.zhongzheng.modules.course.service.*;
 import com.zhongzheng.modules.course.vo.CourseChapterSectionVo;
 import com.zhongzheng.modules.course.vo.CourseSectionVo;
 import com.zhongzheng.modules.goods.domain.Goods;
@@ -142,6 +140,9 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
     @Autowired
     private CourseChapterSectionMapper courseChapterSectionMapper;
 
+    @Autowired
+    private ICourseMenuExamService courseMenuExamService;
+
     @Override
     public UserStudyRecordVo queryById(Long recordId) {
         UserStudyRecord db = this.baseMapper.selectById(recordId);
@@ -590,7 +591,6 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
                     classSectionVo.setSectionId(classSectionVo.getId());
                     sectionList.add(classSectionVo);
                 }
-
             }
             //为节搜索学时记录
             if (classPeriodVo.getType() == 3){

+ 2 - 0
zhongzheng-system/src/main/resources/mapper/modules/order/OrderGoodsMapper.xml

@@ -100,6 +100,7 @@
         <result property="subscribeId" column="subscribe_id"/>
         <result property="gradeId" column="grade_id"/>
         <result property="userStudyCount" column="user_study_count"/>
+        <result property="goodsLearningOrder" column="goods_learning_order"/>
     </resultMap>
 
     <select id="selectList" parameterType="com.zhongzheng.modules.order.bo.OrderGoodsQueryBo"
@@ -447,6 +448,7 @@
         cet.education_name,
         cpt.project_name,
         cb.business_name,
+        cb.goods_learning_order,
         o.user_id,
         og.create_time as order_create_time,
         og.service_start_time,