|
@@ -2,6 +2,7 @@ package com.zhongzheng.modules.user.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
+import com.zhongzheng.common.exception.CustomException;
|
|
|
import com.zhongzheng.common.utils.DateUtils;
|
|
|
import com.zhongzheng.modules.bank.vo.QuestionVo;
|
|
|
import com.zhongzheng.modules.collect.domain.CollectQuestion;
|
|
@@ -12,6 +13,7 @@ import com.zhongzheng.modules.user.domain.UserExamWrongRecord;
|
|
|
import com.zhongzheng.modules.user.mapper.UserExamRecordMapper;
|
|
|
import com.zhongzheng.modules.user.mapper.UserExamWrongRecordMapper;
|
|
|
import com.zhongzheng.modules.user.service.IUserExamWrongRecordService;
|
|
|
+import com.zhongzheng.modules.user.vo.SubjectStudyRecordVo;
|
|
|
import com.zhongzheng.modules.user.vo.UserExamWrongRecordVo;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -101,11 +103,20 @@ public class UserExamWrongRecordServiceImpl extends ServiceImpl<UserExamWrongRec
|
|
|
|
|
|
@Override
|
|
|
public Boolean insertByAddBo(UserExamWrongRecordAddBo bo) {
|
|
|
- UserExamWrongRecord add = BeanUtil.toBean(bo, UserExamWrongRecord.class);
|
|
|
- validEntityBeforeSave(add);
|
|
|
- add.setCreateTime(DateUtils.getNowTime());
|
|
|
- add.setUpdateTime(DateUtils.getNowTime());
|
|
|
- return this.save(add);
|
|
|
+ if(bo.getQuestionIds()==null||bo.getQuestionIds().size()==0){
|
|
|
+ throw new CustomException("题目数组错误");
|
|
|
+ }
|
|
|
+ boolean result = false;
|
|
|
+ for (Long questionId : bo.getQuestionIds()) {
|
|
|
+ UserExamWrongRecord add = BeanUtil.toBean(bo, UserExamWrongRecord.class);
|
|
|
+ validEntityBeforeSave(add);
|
|
|
+ add.setCreateTime(DateUtils.getNowTime());
|
|
|
+ add.setUpdateTime(DateUtils.getNowTime());
|
|
|
+ add.setQuestionId(questionId);
|
|
|
+ result = this.save(add);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
@Override
|