|
|
|
@ -1,10 +1,16 @@ |
|
|
|
package com.project.exam.domain.service.impl; |
|
|
|
|
|
|
|
import cn.hutool.core.lang.Assert; |
|
|
|
import com.project.base.domain.result.Result; |
|
|
|
import com.project.exam.domain.dto.ExamRecordDTO; |
|
|
|
import com.project.exam.domain.service.BuildExamRecordDomainService; |
|
|
|
import com.project.exam.domain.service.GetDetailExamRecordDomainService; |
|
|
|
import com.project.exam.mapper.ExamRecordMapper; |
|
|
|
import com.project.task.domain.dto.TaskDTO; |
|
|
|
import com.project.task.domain.entity.TaskEntity; |
|
|
|
import com.project.task.domain.entity.TaskUserEntity; |
|
|
|
import com.project.task.domain.service.TaskBaseService; |
|
|
|
import com.project.task.domain.service.TaskUserBaseService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
@ -15,9 +21,20 @@ public class GetDetailExamRecordDomainServiceImpl implements GetDetailExamRecord |
|
|
|
private BuildExamRecordDomainService buildExamRecordDomainService; |
|
|
|
@Autowired |
|
|
|
private ExamRecordMapper examRecordMapper; |
|
|
|
@Autowired |
|
|
|
private TaskBaseService taskBaseService; |
|
|
|
@Autowired |
|
|
|
private TaskUserBaseService taskUserBaseService; |
|
|
|
@Override |
|
|
|
public Result<ExamRecordDTO> getDetail(Long id) throws Exception { |
|
|
|
// 入参校验:杜绝空ID查询
|
|
|
|
Assert.notNull(id, "考试记录ID不能为空"); |
|
|
|
ExamRecordDTO dto = examRecordMapper.selectById(id).toDTO(ExamRecordDTO::new); |
|
|
|
TaskUserEntity taskUserEntity = taskUserBaseService.getById(dto.getTaskUserId()); |
|
|
|
TaskDTO taskDTO = taskBaseService.getById(taskUserEntity.getTaskId()).toDTO(TaskDTO::new); |
|
|
|
|
|
|
|
dto.setTaskDTO(taskDTO); |
|
|
|
dto.setId(taskDTO.getId()); |
|
|
|
|
|
|
|
return Result.success(buildExamRecordDomainService.buildDTO(dto)); |
|
|
|
} |
|
|
|
|