Эх сурвалжийг харах

Merge branch 'master' into dev-v5.2

he2802 3 жил өмнө
parent
commit
a54ce84758

+ 2 - 2
zhongzheng-api/src/main/java/com/zhongzheng/controller/cmmon/CommonController.java

@@ -100,8 +100,8 @@ public class CommonController extends BaseController {
         Map<String,Object> map = new HashMap<>();
         map.put("hide",false);
         if(Validator.isNotEmpty(bo.getVersion())){
-            if(bo.getVersion().equals("5.2.2")){
-                map.put("hide",false);
+            if(bo.getVersion().equals("5.2.5")){
+                map.put("hide",true);
             }
         }
         return AjaxResult.success(map);

+ 1 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/bo/QuestionChapterExamQueryBo.java

@@ -54,4 +54,5 @@ public class QuestionChapterExamQueryBo extends BaseEntity {
 	private Long goodsId;
 	@ApiModelProperty("模块卷ID")
 	private Long moduleExamId;
+	private Long orderGoodsId;
 }

+ 3 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/base/service/impl/UserProfileServiceImpl.java

@@ -163,6 +163,9 @@ public class UserProfileServiceImpl extends ServiceImpl<UserProfileMapper, UserP
                 throw new CustomException("图片地址错误");
             }
         }
+        if(Validator.isEmpty(bo.getOrderGoodsId())||bo.getOrderGoodsId()==0L){
+            throw new CustomException("参数错误");
+        }
         UserProfile add = BeanUtil.toBean(bo, UserProfile.class);
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());

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

@@ -157,4 +157,7 @@ GoodsQueryBo extends BaseEntity {
 
 	@ApiModelProperty("排序模式 1默认 2价格从低到高 3价格从高到低")
 	private Integer sortType;
+
+	@ApiModelProperty("订单商品ID")
+	private Long orderGoodsId;
 }

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

@@ -49,7 +49,7 @@ public class ClassPeriodStudentVo {
 	/** 学员编码 */
 	@Excel(name = "学员姓名")
 	@ApiModelProperty("学员姓名")
-	private String realname;
+	private String realName;
 
 
 	/** 学员编码 */

+ 21 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/schedule/service/impl/ScheduleServiceImpl.java

@@ -183,6 +183,9 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
     @Autowired
     private IUserSubscribeService iUserSubscribeService;
 
+    @Autowired
+    private IUserStudyRecordService iUserStudyRecordService;
+
 
     @Autowired
     private IUserPlanService userPlanService;
@@ -1028,9 +1031,27 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                     userPeriodStatusAddBo.setPeriodId(userPeriod.getId());
                     userPeriodStatusAddBo.setCreateTime(DateUtils.getNowTime());
                     userPeriodStatusAddBo.setUpdateTime(DateUtils.getNowTime());
+                    userPeriodStatusAddBo.setRecordEndTime(DateUtils.getNowTime());
                     iUserPeriodStatusService.save(userPeriodStatusAddBo);
                     periodId = userPeriodStatusAddBo.getId();
+
                 }
+                UserStudyRecordQueryBo queryBo = BeanUtil.toBean(entity, UserStudyRecordQueryBo.class);
+                UserStudyRecordVo recordVo = iUserStudyRecordService.queryLast(queryBo);
+                if(Validator.isEmpty(recordVo)||(Validator.isEmpty(recordVo.getStatus()))||recordVo.getStatus()!=1){
+                    UserStudyRecord add = BeanUtil.toBean(entity, UserStudyRecord.class);
+                    add.setCreateTime(DateUtils.getNowTime());
+                    add.setUpdateTime(DateUtils.getNowTime());
+                    add.setCurrentStatus(1);
+                    add.setStatus(1);
+                    iUserStudyRecordService.save(add);
+                    iUserStudyRecordService.studyFinish(add);
+                    UserPeriodStatus userPeriodStatus = userStudyRecordMapper.selectPeriodCount(entity);
+                    userPeriodStatus.setRecordEndTime(DateUtils.getNowTime());
+                    userPeriodStatus.setUpdateTime(DateUtils.getNowTime());
+                    iUserPeriodStatusService.updateById(userPeriodStatus);
+                }
+
             }
         }
 

+ 16 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java

@@ -9,6 +9,8 @@ import com.zhongzheng.modules.collect.domain.CollectBank;
 import com.zhongzheng.modules.collect.domain.CollectQuestion;
 import com.zhongzheng.modules.collect.service.ICollectBankService;
 import com.zhongzheng.modules.collect.service.ICollectQuestionService;
+import com.zhongzheng.modules.order.service.IOrderGoodsService;
+import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.user.bo.UserExamRecordAddBo;
 import com.zhongzheng.modules.user.bo.UserExamRecordEditBo;
 import com.zhongzheng.modules.user.bo.UserExamRecordQueryBo;
@@ -49,6 +51,9 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
     @Autowired
     private ICollectQuestionService iCollectQuestionService;
 
+    @Autowired
+    private IOrderGoodsService iOrderGoodsService;
+
     @Override
     public UserExamRecordVo queryById(Long recordId){
         UserExamRecord db = this.baseMapper.selectById(recordId);
@@ -166,6 +171,10 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
         if(Validator.isEmpty(bo.getOrderGoodsId())){
             throw new CustomException("缺失订单商品ID");
         }
+        OrderGoodsVo orderGoodsVo = iOrderGoodsService.queryById(bo.getOrderGoodsId());
+        if(orderGoodsVo.getRefundStatus()==2){
+            throw new CustomException("操作失败");
+        }
         UserExamRecord add = BeanUtil.toBean(bo, UserExamRecord.class);
         validEntityBeforeSave(add);
         add.setCreateTime(DateUtils.getNowTime());
@@ -176,6 +185,13 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
 
     @Override
     public Boolean updateByEditBo(UserExamRecordEditBo bo) {
+        if(Validator.isEmpty(bo.getOrderGoodsId())){
+            throw new CustomException("缺失订单商品ID");
+        }
+        OrderGoodsVo orderGoodsVo = iOrderGoodsService.queryById(bo.getOrderGoodsId());
+        if(orderGoodsVo.getRefundStatus()==2){
+            throw new CustomException("操作失败");
+        }
         UserExamRecord update = BeanUtil.toBean(bo, UserExamRecord.class);
         validEntityBeforeSave(update);
         update.setUpdateTime(DateUtils.getNowTime());

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

@@ -273,6 +273,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         CourseSectionVo courseSectionVo =iCourseSectionService.queryById(bo.getSectionId());
         if(courseSectionVo.getSectionType()==2&&Validator.isNotEmpty(bo.getPhoto())){  //直播有拍照即学完 第五阶段去掉这个需求
         //    bo.setStatus(1);
+
         }
         UserStudyRecordQueryBo userStudyRecordQueryBo = BeanUtil.toBean(bo, UserStudyRecordQueryBo.class);
         UserStudyRecordVo first = queryFirst(userStudyRecordQueryBo);
@@ -322,7 +323,7 @@ public class UserStudyRecordServiceImpl extends ServiceImpl<UserStudyRecordMappe
         //判断有无学习结束
         studyFinish(add);
         //完成当天学习计划
-        userPlanSave(add);
+    //    userPlanSave(add);
 
         return 0;
     }

+ 3 - 2
zhongzheng-system/src/main/resources/mapper/modules/bank/QuestionChapterExamMapper.xml

@@ -47,9 +47,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                3 as type
         <if test="userId != null ">
                 ,
-            ifnull( (select `status` from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} and uer.goods_id = #{goodsId} and uer.chapter_exam_id = qce.chapter_exam_id and uer.module_exam_id = #{moduleExamId} ORDER BY uer.record_id desc limit 1),-1) record_status
+            ifnull( (select `status` from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = qce.chapter_exam_id and uer.module_exam_id = #{moduleExamId} ORDER BY uer.record_id desc limit 1),-1) record_status
             ,
-            ifnull( (select record_id from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} and uer.goods_id = #{goodsId} and uer.chapter_exam_id = qce.chapter_exam_id and uer.module_exam_id = #{moduleExamId} ORDER BY uer.record_id desc limit 1),-1) record_id
+            ifnull( (select record_id from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = qce.chapter_exam_id and uer.module_exam_id = #{moduleExamId} ORDER BY uer.record_id desc limit 1),-1) record_id,
+            ifnull( (select do_question_num from user_exam_record uer where uer.exam_id = e.exam_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = qce.chapter_exam_id and uer.module_exam_id = #{moduleExamId} ORDER BY uer.record_id desc limit 1),0) do_question_num
         </if>
         FROM
             question_chapter_exam qce

+ 9 - 0
zhongzheng-system/src/main/resources/mapper/modules/goods/GoodsAttachedMapper.xml

@@ -121,6 +121,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				WHEN ga.type = 3 THEN
 				(select count(*) from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and ga.goods_id =uer.goods_id )
 				END do_num
+				,
+				CASE
+				WHEN ga.type = 1 THEN
+				-1
+				WHEN ga.type = 2 THEN
+				-1
+				WHEN ga.type = 3 THEN
+				(select do_question_num from user_exam_record uer where uer.exam_id = ga.major_id and uer.user_id = #{userId} and uer.order_goods_id = #{orderGoodsId} and uer.chapter_exam_id = 0 and uer.module_exam_id = 0 ORDER BY uer.record_id desc limit 1)
+				END do_question_num
 			</if>
 		FROM
 			goods_attached ga