Prechádzať zdrojové kódy

submit:每日一练02

yangdamao 3 rokov pred
rodič
commit
946fb1f22f

+ 7 - 0
zhongzheng-api/src/main/java/com/zhongzheng/controller/bank/QuestionController.java

@@ -21,6 +21,8 @@ import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.bank.vo.QuestionImport;
 import com.zhongzheng.modules.bank.vo.QuestionVo;
 import com.zhongzheng.modules.course.bo.CourseQueryBo;
+import com.zhongzheng.modules.exam.service.IExamPaperService;
+import com.zhongzheng.modules.exam.vo.ExamPaperVo;
 import com.zhongzheng.modules.goods.bo.GoodsQueryBo;
 import com.zhongzheng.modules.goods.bo.SpecialExamRecordAddBo;
 import com.zhongzheng.modules.goods.bo.SpecialExamRecordQuery;
@@ -65,6 +67,8 @@ public class QuestionController extends BaseController {
 
     private final IUserSpecialExamRecordService iUserSpecialExamRecordService;
 
+    private final IExamPaperService iExamPaperService;
+
 
     /**
      * 查询商品列表
@@ -130,6 +134,9 @@ public class QuestionController extends BaseController {
             Long totalNum = iGoodsService.getQuestionNum(g.getGoodsId());
             g.setDoNum(doNum);
             g.setTotalNum(totalNum);
+            //试卷类型
+            List<ExamPaperVo> paperVos = iExamPaperService.getGoodsExamPaper(g.getGoodsId());
+            g.setPaperVos(paperVos);
         }
         return getDataTable(list);
     }

+ 13 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -21,6 +21,7 @@ import com.zhongzheng.modules.bank.bo.*;
 import com.zhongzheng.modules.bank.domain.*;
 import com.zhongzheng.modules.bank.mapper.QuestionMapper;
 import com.zhongzheng.modules.bank.service.IExamQuestionService;
+import com.zhongzheng.modules.bank.service.IExamService;
 import com.zhongzheng.modules.bank.service.IQuestionBusinessService;
 import com.zhongzheng.modules.bank.service.IQuestionService;
 import com.zhongzheng.modules.bank.vo.*;
@@ -116,6 +117,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
     @Autowired
     private IUserSpecialExamRecordService userSpecialExamRecordService;
 
+    @Autowired
+    private IExamService iExamService;
+
     @Autowired
     private IGoodsService iGoodsService;
 
@@ -1813,6 +1817,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             return null;
         }
         GoodsExamTimeVo vo = BeanUtil.toBean(goodsExamTime, GoodsExamTimeVo.class);
+        Exam exam = iExamService.getById(vo.getExamId());
+        vo.setExamName(exam.getExamName());
         //获取打卡记录
         List<UserSpecialExamRecord> list = userSpecialExamRecordService.list(new LambdaQueryWrapper<UserSpecialExamRecord>()
                 .eq(UserSpecialExamRecord::getGoodsId, vo.getGoodsId()));
@@ -1826,9 +1832,16 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
             Long countAll = collect.keySet().stream().filter(x -> !x.equals(userId)).count();
             String percent = getPercent(count.intValue(), countAll.intValue());
             vo.setRecordPercentage(percent);
+            //当天是否打卡
+            Long record = list.stream().filter(item -> item.getUserId().equals(userId)
+                    && item.getGoodsId().equals(vo.getGoodsId()) && item.getModuleExamId().equals(vo.getModuleExamId())
+                    && item.getChapterExamId().equals(vo.getChapterExamId()) && item.getExamId().equals(vo.getExamId())
+                    && item.getRecordTime().equals(DateUtils.getTodayZeroTime())).count();
+            vo.setExamRecord(record > 0 ? 1:0);
         }else {
             vo.setRecordCount(0);
             vo.setRecordPercentage("0.00%");
+            vo.setExamRecord(0);
         }
         return vo;
     }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsExamTimeVo.java

@@ -29,6 +29,8 @@ public class GoodsExamTimeVo implements Serializable {
     /** 试卷ID */
     @ApiModelProperty("试卷ID")
     private Long examId;
+    @ApiModelProperty("试卷名称")
+    private String examName;
     /** 每日一练时间 */
     @ApiModelProperty("每日一练时间")
     private Long examTime;
@@ -39,5 +41,7 @@ public class GoodsExamTimeVo implements Serializable {
     private Integer recordCount;
     @ApiModelProperty("打卡次数百分比")
     private String recordPercentage;
+    @ApiModelProperty("是否打卡:1是 0否")
+    private Integer examRecord;
 
 }

+ 4 - 0
zhongzheng-system/src/main/java/com/zhongzheng/modules/goods/vo/GoodsUserQuestionVo.java

@@ -1,6 +1,7 @@
 package com.zhongzheng.modules.goods.vo;
 
 import com.zhongzheng.common.annotation.Excel;
+import com.zhongzheng.modules.exam.vo.ExamPaperVo;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -274,4 +275,7 @@ public class GoodsUserQuestionVo {
 	private Long userId;
 	@ApiModelProperty("科目名称拼接")
 	private String subjectNames;
+
+	@ApiModelProperty("试卷类型集合")
+	private List<ExamPaperVo> paperVos;
 }