he2802 3 vuotta sitten
vanhempi
commit
2be6ed4c91

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

+ 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());

+ 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