Преглед изворни кода

submit:处理随机练习的试卷

yangdamao пре 2 година
родитељ
комит
fb8f4c36c7

+ 2 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/exam/service/impl/ExamApplyServiceImpl.java

@@ -326,7 +326,8 @@ public class ExamApplyServiceImpl extends ServiceImpl<ExamApplyMapper, ExamApply
         TableDataInfo tableDataInfo = new TableDataInfo();
         Exam exam = iExamService.getById(bo.getExamId());
         if (ObjectUtils.isNull(exam)){
-            throw new CustomException("获取试卷信息失败");
+//            throw new CustomException("获取试卷信息失败");
+            return new TableDataInfo<>();
         }
         //获取试卷业务层次信息
         QuestionBusiness business = iQuestionBusinessService.getOne(new LambdaQueryWrapper<QuestionBusiness>()

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

@@ -886,8 +886,8 @@ public class ScheduleServiceImpl extends ServiceImpl<PolyvVideoMapper, PolyvVide
                         paramMap.put("first","今天每日一练还没有打卡,为了你的学习效果,请尽快去学习吧");
                         paramMap.put("keyword1",goods.getGoodsName());
                         paramMap.put("keyword2","未打卡");
-//                        paramMap.put("pagepath","/pages2/dailyPractice/index?goodsId="+subscription.getGoodsId()+"&orderGoodsId="+subscription.getOrderGoodsId());
-                        paramMap.put("pagepath","");
+                        paramMap.put("pagepath","/pages2/dailyPractice/index?goodsId="+subscription.getGoodsId()+"&orderGoodsId="+subscription.getOrderGoodsId());
+//                        paramMap.put("pagepath","");
                         iWxLoginService.sendSmallTpMsg(userVo.getOpenId(),paramMap);
                     }
                 }

+ 28 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserBankRecordServiceImpl.java

@@ -4,10 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
 import com.zhongzheng.common.utils.ServletUtils;
 import com.zhongzheng.common.utils.ip.IpUtils;
+import com.zhongzheng.modules.bank.domain.ExamTemp;
+import com.zhongzheng.modules.bank.service.IExamTempService;
+import com.zhongzheng.modules.exam.domain.ExamPaper;
+import com.zhongzheng.modules.exam.service.IExamPaperService;
 import com.zhongzheng.modules.grade.domain.UserPeriod;
 import com.zhongzheng.modules.grade.domain.UserPeriodStatus;
 import com.zhongzheng.modules.grade.service.IUserPeriodService;
@@ -21,6 +27,7 @@ import com.zhongzheng.modules.user.mapper.UserBankRecordMapper;
 import com.zhongzheng.modules.user.mapper.UserStudyRecordMapper;
 import com.zhongzheng.modules.user.service.*;
 import com.zhongzheng.modules.user.vo.UserBankRecordVo;
+import com.zhongzheng.modules.user.vo.UserExamRecordVo;
 import com.zhongzheng.modules.user.vo.UserVo;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -70,6 +77,12 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
     @Autowired
     private IUserStudyRecordService iUserStudyRecordService;
 
+    @Autowired
+    private IExamTempService iExamTempService;
+
+    @Autowired
+    private IExamPaperService iExamPaperService;
+
 
 
     private static Logger log = LoggerFactory.getLogger(UserBankRecordServiceImpl.class);
@@ -275,7 +288,21 @@ public class UserBankRecordServiceImpl extends ServiceImpl<UserBankRecordMapper,
 
     @Override
     public List<UserBankRecordVo> getUserBankList(UserBankRecordQueryBo bo) {
-        return baseMapper.getUserBankList(bo);
+        List<UserBankRecordVo> userBankList = baseMapper.getUserBankList(bo);
+        if (!CollectionUtils.isEmpty(userBankList)){
+            for (UserBankRecordVo vo : userBankList) {
+                if (StringUtils.isBlank(vo.getExamName()) && StringUtils.isBlank(vo.getPaperName())){
+                    //随机练习的试卷
+                    ExamTemp examTemp = iExamTempService.getById(vo.getExamId());
+                    if (ObjectUtils.isNotNull(examTemp)){
+                        vo.setExamName(examTemp.getExamName());
+                        ExamPaper examPaper = iExamPaperService.getById(examTemp.getExamPaperId());
+                        vo.setPaperName(ObjectUtils.isNotNull(examPaper)?examPaper.getPaperName():"");
+                    }
+                }
+            }
+        }
+        return userBankList;
     }
 
 

+ 28 - 1
zhongzheng-system/src/main/java/com/zhongzheng/modules/user/service/impl/UserExamRecordServiceImpl.java

@@ -3,12 +3,19 @@ package com.zhongzheng.modules.user.service.impl;
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.lang.Validator;
 import cn.hutool.core.util.StrUtil;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.zhongzheng.common.exception.CustomException;
 import com.zhongzheng.common.utils.DateUtils;
+import com.zhongzheng.modules.bank.domain.ExamTemp;
+import com.zhongzheng.modules.bank.service.IExamTempService;
 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.exam.domain.ExamPaper;
+import com.zhongzheng.modules.exam.service.IExamPaperService;
 import com.zhongzheng.modules.order.service.IOrderGoodsService;
 import com.zhongzheng.modules.order.vo.OrderGoodsVo;
 import com.zhongzheng.modules.user.bo.CheckUserExamRecordBo;
@@ -55,6 +62,12 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
     @Autowired
     private IOrderGoodsService iOrderGoodsService;
 
+    @Autowired
+    private IExamTempService iExamTempService;
+
+    @Autowired
+    private IExamPaperService iExamPaperService;
+
     @Override
     public UserExamRecordVo queryById(Long recordId){
         UserExamRecord db = this.baseMapper.selectById(recordId);
@@ -149,7 +162,21 @@ public class UserExamRecordServiceImpl extends ServiceImpl<UserExamRecordMapper,
 
     @Override
     public List<UserExamRecordVo> selectList(UserExamRecordQueryBo bo) {
-        return userExamRecordMapper.selectListAll(bo);
+        List<UserExamRecordVo> vos = userExamRecordMapper.selectListAll(bo);
+        if (!CollectionUtils.isEmpty(vos)){
+            for (UserExamRecordVo vo : vos) {
+                if (StringUtils.isBlank(vo.getExamName()) && StringUtils.isBlank(vo.getPaperName())){
+                    //随机练习的试卷
+                    ExamTemp examTemp = iExamTempService.getById(vo.getExamId());
+                    if (ObjectUtils.isNotNull(examTemp)){
+                        vo.setExamName(examTemp.getExamName());
+                        ExamPaper examPaper = iExamPaperService.getById(examTemp.getExamPaperId());
+                        vo.setPaperName(ObjectUtils.isNotNull(examPaper)?examPaper.getPaperName():"");
+                    }
+                }
+            }
+        }
+        return vos;
     }
 
     /**