|
|
|
@ -2,6 +2,10 @@ package com.project.exam.domain.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.util.BooleanUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.project.appeal.domain.entity.AppealEntity; |
|
|
|
import com.project.appeal.domain.enums.AppealStatusEnum; |
|
|
|
import com.project.appeal.domain.service.AppealBaseService; |
|
|
|
import com.project.base.domain.utils.ServletUtils; |
|
|
|
import com.project.ding.domain.enums.UserRoleEnum; |
|
|
|
import com.project.ding.utils.SecurityUtils; |
|
|
|
@ -9,6 +13,7 @@ import com.project.exam.domain.dto.ExamRecordDTO; |
|
|
|
import com.project.exam.domain.service.BuildExamRecordDomainService; |
|
|
|
import com.project.task.domain.enums.QuestionTypeEnum; |
|
|
|
import io.vavr.control.Try; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import java.util.Objects; |
|
|
|
@ -21,7 +26,8 @@ public class BuildExamRecordDomainServiceImpl implements BuildExamRecordDomainSe |
|
|
|
|
|
|
|
private final static String X_DEBUG_MODE_HEADER = "X-Debug-Mode"; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AppealBaseService appealBaseService; |
|
|
|
|
|
|
|
private final static String X_DEBUG_MODE_VALUE = "true"; |
|
|
|
@Override |
|
|
|
@ -63,6 +69,17 @@ public class BuildExamRecordDomainServiceImpl implements BuildExamRecordDomainSe |
|
|
|
if (Objects.isNull(answerSnapshotDTO.getHasAppealed())) { |
|
|
|
answerSnapshotDTO.setHasAppealed(Boolean.FALSE); |
|
|
|
} |
|
|
|
if (BooleanUtil.isTrue(answerSnapshotDTO.getHasAppealed())) { |
|
|
|
LambdaQueryWrapper<AppealEntity> entityQueryWrapper = new LambdaQueryWrapper<>(); |
|
|
|
entityQueryWrapper.eq(AppealEntity::getQuestionId, answerSnapshotDTO.getQuestionId()); |
|
|
|
entityQueryWrapper.eq(AppealEntity::getExamId, dto.getId()); |
|
|
|
AppealEntity appeal = appealBaseService.getOne(entityQueryWrapper); |
|
|
|
if (Objects.nonNull(appeal)) { |
|
|
|
answerSnapshotDTO.setAppealStatus(appeal.getStatus()); |
|
|
|
answerSnapshotDTO.setAppealStatusText(AppealStatusEnum.getDescByValue(appeal.getStatus())); |
|
|
|
answerSnapshotDTO.setAppealReason(appeal.getReason()); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
return dto; |
|
|
|
} |
|
|
|
|