|
|
@ -16,6 +16,7 @@ import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Objects; |
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
@ -27,6 +28,9 @@ public class AdminExportExamRecordDomainServiceImpl implements AdminExportExamRe |
|
|
|
|
|
|
|
|
private final static Long MAX_EXPORT_NUM = 5000L; |
|
|
private final static Long MAX_EXPORT_NUM = 5000L; |
|
|
|
|
|
|
|
|
|
|
|
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public void export(ExamRecordParam examRecordParam , HttpServletResponse response) throws Exception { |
|
|
public void export(ExamRecordParam examRecordParam , HttpServletResponse response) throws Exception { |
|
|
long count = adminSearchExamRecordDomainService.count(examRecordParam); |
|
|
long count = adminSearchExamRecordDomainService.count(examRecordParam); |
|
|
@ -37,6 +41,9 @@ public class AdminExportExamRecordDomainServiceImpl implements AdminExportExamRe |
|
|
Result<PageResult<ExamRecordDTO>> pageResultResult = adminSearchExamRecordDomainService.adminSearch(examRecordParam); |
|
|
Result<PageResult<ExamRecordDTO>> pageResultResult = adminSearchExamRecordDomainService.adminSearch(examRecordParam); |
|
|
|
|
|
|
|
|
List<ExamRecordDTO> dataList = pageResultResult.getData().getContent(); |
|
|
List<ExamRecordDTO> dataList = pageResultResult.getData().getContent(); |
|
|
|
|
|
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat(DATE_FORMAT); |
|
|
|
|
|
|
|
|
List<ExportExamRecordDTO> exportList = dataList.stream().map(dto -> { |
|
|
List<ExportExamRecordDTO> exportList = dataList.stream().map(dto -> { |
|
|
ExportExamRecordDTO exportDTO = new ExportExamRecordDTO(); |
|
|
ExportExamRecordDTO exportDTO = new ExportExamRecordDTO(); |
|
|
BeanUtil.copyProperties(dto, exportDTO); |
|
|
BeanUtil.copyProperties(dto, exportDTO); |
|
|
@ -45,6 +52,9 @@ public class AdminExportExamRecordDomainServiceImpl implements AdminExportExamRe |
|
|
} else { |
|
|
} else { |
|
|
exportDTO.setScore(""); |
|
|
exportDTO.setScore(""); |
|
|
} |
|
|
} |
|
|
|
|
|
if (dto.getSubmitTime() != null) { |
|
|
|
|
|
exportDTO.setSubmitTime(sdf.format(dto.getSubmitTime())); |
|
|
|
|
|
} |
|
|
return exportDTO; |
|
|
return exportDTO; |
|
|
}).toList(); |
|
|
}).toList(); |
|
|
EasyExcel.write(response.getOutputStream(), ExportExamRecordDTO.class) |
|
|
EasyExcel.write(response.getOutputStream(), ExportExamRecordDTO.class) |
|
|
|