|
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.qmth.boot.tools.excel.ExcelWriter;
|
|
|
|
+import com.qmth.boot.tools.excel.enums.ExcelType;
|
|
import com.qmth.boot.tools.io.ZipReader;
|
|
import com.qmth.boot.tools.io.ZipReader;
|
|
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
|
|
import com.qmth.teachcloud.common.bean.dto.DataPermissionRule;
|
|
import com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto;
|
|
import com.qmth.teachcloud.common.bean.dto.mark.MarkSettingDto;
|
|
@@ -36,10 +38,10 @@ import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreQuery;
|
|
import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
|
|
import com.qmth.teachcloud.mark.bean.archivescore.ArchiveScoreVo;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.CourseCard;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.CourseCard;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.Description;
|
|
import com.qmth.teachcloud.mark.bean.cardJson.Description;
|
|
-import com.qmth.teachcloud.mark.bean.cardJson.DescriptionCode;
|
|
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperQuery;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
|
|
import com.qmth.teachcloud.mark.bean.document.ArchivePaperVo;
|
|
import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
|
|
import com.qmth.teachcloud.mark.bean.vo.parseCard.Struct;
|
|
|
|
+import com.qmth.teachcloud.mark.dto.ArchiveScoreExportDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.CheckScoreListDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.MarkPaperPackageDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.MarkPaperPackageDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.SettingDto;
|
|
import com.qmth.teachcloud.mark.dto.mark.score.SettingDto;
|
|
@@ -58,12 +60,17 @@ import org.apache.commons.collections4.CollectionUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FileUtils;
|
|
import org.apache.commons.io.FilenameUtils;
|
|
import org.apache.commons.io.FilenameUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import javax.servlet.ServletOutputStream;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.net.URLEncoder;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.function.Function;
|
|
import java.util.function.Function;
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
@@ -672,4 +679,37 @@ public class MarkPaperServiceImpl extends ServiceImpl<MarkPaperMapper, MarkPaper
|
|
.eq(MarkPaper::getCourseId, courseId);
|
|
.eq(MarkPaper::getCourseId, courseId);
|
|
return this.list(queryWrapper);
|
|
return this.list(queryWrapper);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void scoreListExport(ArchiveScoreQuery query, HttpServletResponse response) throws IOException {
|
|
|
|
+ IPage<ArchiveScoreVo> page = this.scoreList(query);
|
|
|
|
+ List<ArchiveScoreExportDto> dtoList = new ArrayList<>();
|
|
|
|
+ for (ArchiveScoreVo record : page.getRecords()) {
|
|
|
|
+ ArchiveScoreExportDto dto = new ArchiveScoreExportDto();
|
|
|
|
+ BeanUtils.copyProperties(record, dto);
|
|
|
|
+ dto.setCourseInfo(record.getCourseName() + "(" + record.getCourseCode() + ")");
|
|
|
|
+ if (SystemConstant.strNotNull(dto.getPassRate())) {
|
|
|
|
+ dto.setPassRate(dto.getPassRate() + "%");
|
|
|
|
+ }
|
|
|
|
+ if (SystemConstant.strNotNull(dto.getExcellentRate())) {
|
|
|
|
+ dto.setExcellentRate(dto.getExcellentRate() + "%");
|
|
|
|
+ }
|
|
|
|
+ dtoList.add(dto);
|
|
|
|
+ }
|
|
|
|
+ try {
|
|
|
|
+ log.debug("导出Excel开始...");
|
|
|
|
+ response.setHeader("Content-Disposition",
|
|
|
|
+ "inline;filename=" + URLEncoder.encode("成绩导出", SystemConstant.CHARSET_NAME) + ".xlsx");
|
|
|
|
+ response.setContentType("application/vnd.ms-excel");
|
|
|
|
+ ServletOutputStream outputStream = response.getOutputStream();
|
|
|
|
+ ExcelWriter writer = ExcelWriter.create(ExcelType.XLSX);
|
|
|
|
+ writer.writeObjects("总量分析", null, ArchiveScoreExportDto.class, dtoList.listIterator());
|
|
|
|
+ writer.output(response.getOutputStream());
|
|
|
|
+ outputStream.flush();
|
|
|
|
+ outputStream.close();
|
|
|
|
+ log.debug("导出Excel结束");
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw new RuntimeException(e);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|