文件下载问题处理。

master
Leon 3 years ago
parent 6d3caa44d5
commit ee80ad3d9d

@ -55,37 +55,48 @@ public class ExportAspect {
String exportCode = "";
//-------------------------------------------------------------------------------------------------------------------
if (paramtes == null || args == null || args.length == 0) return joinPoint.proceed();
Boolean isDuoDuo = (args != null && args.length == 1) ? false : true;
//-------------------------------------------------------------------------------------------------------------------
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;
}//while
} else {
Map<String, Object> paramMap = new HashMap<>();
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;
paramMap.put(param, value);
}//while
params[0] = paramMap;
args[0] = paramMap;
}
//-------------------------------------------------------------------------------------------------------------------
if (export == false || StringUtil.isEmpty(exportCode)) return joinPoint.proceed();
//-------------------------------------------------------------------------------------------------------------------
for (Object arg : params) {
for (Object arg : args) {
if (arg instanceof FrontPage) {
((FrontPage)arg).setRows(20000);
}
}//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));
if (resultJson.get("data") instanceof List) {
List dataList = (List)resultJson.get("data");
exportData(exportCode, dataList, request, attributes.getResponse());
}
//-------------------------------------------------------------------------------------------------------------------
return result;
}

Loading…
Cancel
Save