文件下载问题处理。

master
Leon 3 years ago
parent 6d3caa44d5
commit ee80ad3d9d

@ -55,37 +55,48 @@ public class ExportAspect {
String exportCode = ""; String exportCode = "";
//------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------
if (paramtes == null || args == null || args.length == 0) return joinPoint.proceed(); if (paramtes == null || args == null || args.length == 0) return joinPoint.proceed();
Boolean isDuoDuo = (args != null && args.length == 1) ? false : true;
//------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------
request.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8");
//-------------------------------------------------------------------------------------------------------------------
if (isDuoDuo) {
while (paramtes.hasMoreElements()) {
String param = paramtes.nextElement();
String value = request.getParameter(param);
if (param != null && param.equals("export")) export = true;
if (param != null && param.equals("exportCode")) exportCode = value;
Object[] params = new Object[1]; if (export && StringUtil.notEmpty(exportCode)) break;
Map<String, Object> paramMap = new HashMap<>(); }//while
while (paramtes.hasMoreElements()) { } else {
String param = paramtes.nextElement(); Map<String, Object> paramMap = new HashMap<>();
String value = request.getParameter(param); while (paramtes.hasMoreElements()) {
//------------------------------------------------------------------------------------------------------------------- String param = paramtes.nextElement();
if (param != null && param.equals("export")) export = true; String value = request.getParameter(param);
if (param != null && param.equals("exportCode")) exportCode = value; if (param != null && param.equals("export")) export = true;
if (param != null && param.equals("exportCode")) exportCode = value;
paramMap.put(param, value); paramMap.put(param, value);
}//while }//while
params[0] = paramMap; args[0] = paramMap;
}
//------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------
if (export == false || StringUtil.isEmpty(exportCode)) return joinPoint.proceed(); if (export == false || StringUtil.isEmpty(exportCode)) return joinPoint.proceed();
//------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------
for (Object arg : params) { for (Object arg : args) {
if (arg instanceof FrontPage) { if (arg instanceof FrontPage) {
((FrontPage)arg).setRows(20000); ((FrontPage)arg).setRows(20000);
} }
}//for }//for
//------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------
Object result = joinPoint.proceed(params); Object result = joinPoint.proceed(args);
JSONObject resultJson = JSON.parseObject(JSON.toJSONStringWithDateFormat(result, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteDateUseDateFormat)); JSONObject resultJson = JSON.parseObject(JSON.toJSONStringWithDateFormat(result, "yyyy-MM-dd HH:mm:ss", SerializerFeature.WriteDateUseDateFormat));
if (resultJson.get("data") instanceof List) { if (resultJson.get("data") instanceof List) {
List dataList = (List)resultJson.get("data"); List dataList = (List)resultJson.get("data");
exportData(exportCode, dataList, request, attributes.getResponse()); exportData(exportCode, dataList, request, attributes.getResponse());
} }
//------------------------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------------------------
return result; return result;
} }

Loading…
Cancel
Save