修改部门问题

This commit is contained in:
2025-07-24 16:04:36 +08:00
parent 87825b2d88
commit 21a1e61c46
5 changed files with 18 additions and 12 deletions

View File

@ -61,20 +61,18 @@ public class CjOptionController extends BaseController
{
List<CjOption> listOption = cjOptionService.selectCjOptionByIds(userVo.getOptionId());
List<CjStudent> listStudent = cjStudentService.selectCjStudentByIds(userVo.getStudentId());
// 设置响应头,通知浏览器下载 ZIP 文件
String zipFileName = "export_data_" + System.currentTimeMillis() + ".zip";
response.setContentType("application/zip");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + zipFileName + "\"");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + zipFileName);
// 使用 ZipOutputStream 将两个 Excel 文件打包
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
// 1. 导出选项数据 Excel
addExcelToZip(zipOut, listOption, "选项数据.xlsx", CjOption.class);
// 2. 导出学生信息 Excel
addExcelToZip(zipOut, listStudent, "学生信息.xlsx", CjStudent.class);
}
}
/**
@ -84,15 +82,12 @@ public class CjOptionController extends BaseController
ExcelUtil<T> excelUtil = new ExcelUtil<>(clazz);
excelUtil.init(dataList, "数据", StringUtils.EMPTY, Excel.Type.EXPORT);
excelUtil.writeSheet();
// 创建 ZIP 条目
ZipEntry zipEntry = new ZipEntry(fileName);
zipOut.putNextEntry(zipEntry);
// 将 Excel 写入 ZIP 流
Workbook workbook = excelUtil.getWb();
workbook.write(zipOut);
// 关闭当前 ZIP 条目
zipOut.closeEntry();
}

View File

@ -86,7 +86,8 @@ public class DwQuestionController extends BaseController
// 设置响应头,通知浏览器下载 ZIP 文件
String zipFileName = "export_data_" + System.currentTimeMillis() + ".zip";
response.setContentType("application/zip");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=\"" + zipFileName + "\"");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + zipFileName);
// 使用 ZipOutputStream 将两个 Excel 文件打包
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
// 1. 导出选项数据 Excel

View File

@ -113,6 +113,7 @@ public class DwIndexConfigServiceImpl implements IDwIndexConfigService
Map<String, Object> result = new HashMap<String, Object>();
result.put("id", config.getId());
result.put("indexType", config.getIndexType());
result.put("indexTitle", config.getIndexTitle());
DwQuestion question = dwQuestionMapper.selectDwQuestionById(Long.valueOf(config.getQuestionId()));
result.put("question", question.getQuestion());
List<AnswerCountVo> list = dwIndexConfigMapper.selectIndex(Long.valueOf(config.getQuestionId()), config.getInfoId());