From ee80ad3d9d5f55895e145a9c7865eaacf7a545f3 Mon Sep 17 00:00:00 2001 From: Leon <3066758958@qq.com> Date: Fri, 3 Sep 2021 19:24:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=87=E4=BB=B6=E4=B8=8B=E8=BD=BD=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E5=A4=84=E7=90=86=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mesnac/common/aspect/ExportAspect.java | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java b/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java index 0c00a60e..8bcf3198 100644 --- a/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java +++ b/common/src/main/java/com/foreverwin/mesnac/common/aspect/ExportAspect.java @@ -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]; - Map 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; + if (export && StringUtil.notEmpty(exportCode)) break; + }//while + } else { + Map 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; + paramMap.put(param, value); + }//while + 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; }