fix 导出Excel加密后无法查看的问题

This commit is contained in:
lijiarao
2024-03-22 14:45:49 +08:00
parent 2994848bc8
commit d1ae0625c4
6 changed files with 22 additions and 14 deletions
@@ -26,6 +26,8 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.*;
import java.util.stream.Collectors;
/**
@@ -71,7 +73,11 @@ public class JeroController<T, S extends IService<T>> {
// Step.3 AutoPoi 导出Excel
ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
mv.addObject(FILE_NAME, title); //此处设置的filename无效 ,前端会重更新设置一下
try {
mv.addObject(FILE_NAME, URLEncoder.encode(title, "UTF-8")); //此处设置的filename无效 ,前端会重更新设置一下
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
mv.addObject(CLASS, clazz);
//update-begin--Author:liusq Date:20210126 for:图片导出报错,ImageBasePath未设置--------------------
ExportParams exportParams=new ExportParams(title, "导出人:" + sysUser.getRealname(), title);
@@ -57,7 +57,7 @@ public class AutoPoiDictConfig implements AutoPoiDictServiceI {
}
}
if (!dictReplaces.isEmpty()) {
log.info("---AutoPoi--Get_DB_Dict------"+ dictReplaces.toString());
log.debug("---AutoPoi--Get_DB_Dict------"+ dictReplaces.toString());
return dictReplaces.toArray(new String[dictReplaces.size()]);
}
return new String[0];