修改部门问题
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
# 项目相关配置
|
# 项目相关配置
|
||||||
ruoyi:
|
ruoyi:
|
||||||
# 名称
|
# 名称
|
||||||
name: sdwu_du
|
name: sdwu_dw
|
||||||
# 版本
|
# 版本
|
||||||
version: 3.9.0
|
version: 3.9.0
|
||||||
# 版权年份
|
# 版权年份
|
||||||
@ -52,7 +52,7 @@ spring:
|
|||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
profiles:
|
profiles:
|
||||||
active: dev
|
active: test
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
@ -61,20 +61,18 @@ public class CjOptionController extends BaseController
|
|||||||
{
|
{
|
||||||
List<CjOption> listOption = cjOptionService.selectCjOptionByIds(userVo.getOptionId());
|
List<CjOption> listOption = cjOptionService.selectCjOptionByIds(userVo.getOptionId());
|
||||||
List<CjStudent> listStudent = cjStudentService.selectCjStudentByIds(userVo.getStudentId());
|
List<CjStudent> listStudent = cjStudentService.selectCjStudentByIds(userVo.getStudentId());
|
||||||
|
|
||||||
// 设置响应头,通知浏览器下载 ZIP 文件
|
// 设置响应头,通知浏览器下载 ZIP 文件
|
||||||
String zipFileName = "export_data_" + System.currentTimeMillis() + ".zip";
|
String zipFileName = "export_data_" + System.currentTimeMillis() + ".zip";
|
||||||
response.setContentType("application/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 文件打包
|
// 使用 ZipOutputStream 将两个 Excel 文件打包
|
||||||
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
|
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
|
||||||
// 1. 导出选项数据 Excel
|
// 1. 导出选项数据 Excel
|
||||||
addExcelToZip(zipOut, listOption, "选项数据.xlsx", CjOption.class);
|
addExcelToZip(zipOut, listOption, "选项数据.xlsx", CjOption.class);
|
||||||
|
|
||||||
// 2. 导出学生信息 Excel
|
// 2. 导出学生信息 Excel
|
||||||
addExcelToZip(zipOut, listStudent, "学生信息.xlsx", CjStudent.class);
|
addExcelToZip(zipOut, listStudent, "学生信息.xlsx", CjStudent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,15 +82,12 @@ public class CjOptionController extends BaseController
|
|||||||
ExcelUtil<T> excelUtil = new ExcelUtil<>(clazz);
|
ExcelUtil<T> excelUtil = new ExcelUtil<>(clazz);
|
||||||
excelUtil.init(dataList, "数据", StringUtils.EMPTY, Excel.Type.EXPORT);
|
excelUtil.init(dataList, "数据", StringUtils.EMPTY, Excel.Type.EXPORT);
|
||||||
excelUtil.writeSheet();
|
excelUtil.writeSheet();
|
||||||
|
|
||||||
// 创建 ZIP 条目
|
// 创建 ZIP 条目
|
||||||
ZipEntry zipEntry = new ZipEntry(fileName);
|
ZipEntry zipEntry = new ZipEntry(fileName);
|
||||||
zipOut.putNextEntry(zipEntry);
|
zipOut.putNextEntry(zipEntry);
|
||||||
|
|
||||||
// 将 Excel 写入 ZIP 流
|
// 将 Excel 写入 ZIP 流
|
||||||
Workbook workbook = excelUtil.getWb();
|
Workbook workbook = excelUtil.getWb();
|
||||||
workbook.write(zipOut);
|
workbook.write(zipOut);
|
||||||
|
|
||||||
// 关闭当前 ZIP 条目
|
// 关闭当前 ZIP 条目
|
||||||
zipOut.closeEntry();
|
zipOut.closeEntry();
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,8 @@ public class DwQuestionController extends BaseController
|
|||||||
// 设置响应头,通知浏览器下载 ZIP 文件
|
// 设置响应头,通知浏览器下载 ZIP 文件
|
||||||
String zipFileName = "export_data_" + System.currentTimeMillis() + ".zip";
|
String zipFileName = "export_data_" + System.currentTimeMillis() + ".zip";
|
||||||
response.setContentType("application/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 文件打包
|
// 使用 ZipOutputStream 将两个 Excel 文件打包
|
||||||
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
|
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
|
||||||
// 1. 导出选项数据 Excel
|
// 1. 导出选项数据 Excel
|
||||||
|
@ -113,6 +113,7 @@ public class DwIndexConfigServiceImpl implements IDwIndexConfigService
|
|||||||
Map<String, Object> result = new HashMap<String, Object>();
|
Map<String, Object> result = new HashMap<String, Object>();
|
||||||
result.put("id", config.getId());
|
result.put("id", config.getId());
|
||||||
result.put("indexType", config.getIndexType());
|
result.put("indexType", config.getIndexType());
|
||||||
|
result.put("indexTitle", config.getIndexTitle());
|
||||||
DwQuestion question = dwQuestionMapper.selectDwQuestionById(Long.valueOf(config.getQuestionId()));
|
DwQuestion question = dwQuestionMapper.selectDwQuestionById(Long.valueOf(config.getQuestionId()));
|
||||||
result.put("question", question.getQuestion());
|
result.put("question", question.getQuestion());
|
||||||
List<AnswerCountVo> list = dwIndexConfigMapper.selectIndex(Long.valueOf(config.getQuestionId()), config.getInfoId());
|
List<AnswerCountVo> list = dwIndexConfigMapper.selectIndex(Long.valueOf(config.getQuestionId()), config.getInfoId());
|
||||||
|
@ -25,10 +25,19 @@ public class AuthenticationEntryPointImpl implements AuthenticationEntryPoint, S
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
|
public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException e)
|
||||||
throws IOException
|
|
||||||
{
|
{
|
||||||
int code = HttpStatus.UNAUTHORIZED;
|
int code = HttpStatus.UNAUTHORIZED;
|
||||||
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
|
String msg = StringUtils.format("请求访问:{},认证失败,无法访问系统资源", request.getRequestURI());
|
||||||
ServletUtils.renderString(response, JSON.toJSONString(AjaxResult.error(code, msg)));
|
try
|
||||||
|
{
|
||||||
|
response.setStatus(401);
|
||||||
|
response.setContentType("application/json");
|
||||||
|
response.setCharacterEncoding("utf-8");
|
||||||
|
response.getWriter().print(JSON.toJSONString(AjaxResult.error(code, msg)));
|
||||||
|
}
|
||||||
|
catch (IOException ex)
|
||||||
|
{
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user