xiangpei
2024-05-15 851990e521ed5b0cb0e367b319bb484f04c4c47e
src/main/java/com/mindskip/xzs/service/impl/ExamTemplatesServiceImpl.java
@@ -11,6 +11,7 @@
import com.mindskip.xzs.service.ExamTemplatesUserCountService;
import com.mindskip.xzs.utility.convert.ExamTemplatesClassConvert;
import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVM;
import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperEditRequestVO;
import com.mindskip.xzs.viewmodel.admin.exam.ExamPaperTitleItemVM;
import com.mindskip.xzs.viewmodel.admin.exam.QuestionTypeVM;
import lombok.extern.slf4j.Slf4j;
@@ -58,7 +59,6 @@
        if (model.getId() != null) {
            removes(model.getId());
        }
        ExamTemplates examTemplates = ExamTemplatesClassConvert.INSTANCE.ExamPaperEditRequestVMToExamTemplates(model);
        if (!CollectionUtils.isEmpty(model.getLimitDateTime())) {
            SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
@@ -121,6 +121,12 @@
    }
    @Override
    public PageInfo<ExamTemplates> getByadmins(ExamTemplatesVO templatesVO) {
        return PageHelper.startPage(templatesVO.getPageIndex(), templatesVO.getPageSize(), "id desc").doSelectPageInfo(() ->
                examTemplatesMapper.getByadmins(templatesVO));
    }
    @Override
    public ExamPaperEditRequestVM getById(Integer id) {
        return restore(id);
    }
@@ -142,7 +148,7 @@
        vm.setType("1");
        vm.setId(null);
        ExamPaper examPaper = examPaperService.savePaperFromVM(vm, user);
        ExamPaperEditRequestVM newVM = examPaperService.examPaperToVM(examPaper.getId());
        ExamPaperEditRequestVO newVM = examPaperService.examPaperToVM(examPaper.getId());
        count.setExamPaperId(examPaper.getId());
        count.setUserId(user.getId());
        examTemplatesUserCountService.add(count);
@@ -152,20 +158,20 @@
    @Override
    public Integer randomExam1(User user, Integer templatesId) throws Exception {
        ExamTemplatesUserCount count = new ExamTemplatesUserCount();
//        ExamTemplatesUserCount count = new ExamTemplatesUserCount();
        ExamPaperEditRequestVM vm = restore(templatesId);
        count.setExamTemplatesId(vm.getId());
//        count.setExamTemplatesId(vm.getId());
        Integer[] id = {user.getId()};
        vm.setUserIds(id);
        vm.setType("1");
        vm.setId(null);
        ExamPaper examPaper = examPaperService.savePaperFromVM(vm, user);
        ExamPaperEditRequestVM newVM = examPaperService.examPaperToVM(examPaper.getId());
        count.setExamPaperId(examPaper.getId());
        count.setUserId(user.getId());
        examTemplatesUserCountService.add(count);
        return count.getExamPaperId();
        ExamPaperEditRequestVO newVM = examPaperService.examPaperToVM(examPaper.getId());
//        count.setExamPaperId(examPaper.getId());
//        count.setUserId(user.getId());
//        examTemplatesUserCountService.add(count);
        return examPaper.getId();
    }
    @Override