|
@@ -1,7 +1,5 @@
|
|
|
package com.kmall.admin.controller;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
-import com.google.gson.Gson;
|
|
|
import com.kmall.admin.dto.OrderExpressDto;
|
|
|
import com.kmall.admin.dto.SystemFormatDto;
|
|
|
import com.kmall.admin.entity.*;
|
|
@@ -10,8 +8,6 @@ import com.kmall.admin.service.*;
|
|
|
import com.kmall.admin.utils.CalculateTax;
|
|
|
import com.kmall.admin.utils.ParamUtils;
|
|
|
import com.kmall.admin.utils.ShiroUtils;
|
|
|
-import com.kmall.admin.utils.data.response.ResponseMessage;
|
|
|
-import com.kmall.admin.utils.oms.OmsSign;
|
|
|
import com.kmall.common.constant.Dict;
|
|
|
import com.kmall.common.constant.JxlsXmlTemplateName;
|
|
|
import com.kmall.common.utils.*;
|
|
@@ -30,10 +26,10 @@ import com.kmall.manager.manager.wechat.WechatGlobalUtil;
|
|
|
import com.kmall.manager.manager.wechat.WechatUtil;
|
|
|
import com.kmall.manager.manager.wechat.wxglobal.dto.WechatGlobalRefundApiResult;
|
|
|
import net.sf.json.JSONObject;
|
|
|
-import okhttp3.Request;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.logging.Log;
|
|
|
import org.apache.commons.logging.LogFactory;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -44,7 +40,6 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.math.RoundingMode;
|
|
|
-import java.text.Bidi;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
@@ -1499,7 +1494,10 @@ public class OrderController {
|
|
|
|
|
|
// =================================================System Format导出结束=====================================
|
|
|
|
|
|
- ee.addSheetByMap("Daily sales report", list, header);
|
|
|
+ List<List<Map<String, Object>>> lists = splitList(list, page(list.size()));
|
|
|
+ for (int i = 0; i < lists.size(); i++) {
|
|
|
+ ee.addSheetByMap("Daily sales report " + (i + 1), lists.get(i), header);
|
|
|
+ }
|
|
|
ee.export(response);
|
|
|
|
|
|
|
|
@@ -1550,5 +1548,39 @@ public class OrderController {
|
|
|
return headerMap;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据页数分割集合,分割后的集合一般都会少于3000
|
|
|
+ * 如果大于3000了可能会导出失败
|
|
|
+ * @param list 需要分割的list
|
|
|
+ * @param n 页数
|
|
|
+ * @return 分割后的list集合
|
|
|
+ */
|
|
|
+ public static <T> List<List<T>> splitList(List<T> list, int n){
|
|
|
+ List<List<T>> result = new ArrayList<>();
|
|
|
+ int remainder =list.size() % n; // 先计算出余数
|
|
|
+ int number = list.size() / n; // 然后是商
|
|
|
+ int offset = 0; // 偏移量
|
|
|
+ for (int i = 0; i < n; i++){
|
|
|
+ List<T> value;
|
|
|
+ if (remainder > 0){
|
|
|
+ value = list.subList(i * number + offset, (i + 1) * number + offset + 1);
|
|
|
+ remainder--;
|
|
|
+ offset++;
|
|
|
+ }else{
|
|
|
+ value = list.subList(i * number + offset, (i + 1) * number + offset);
|
|
|
+ }
|
|
|
+ result.add(value);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 根据集合大小判断有多少页
|
|
|
+ * @param size 集合大小
|
|
|
+ * @return 多少页
|
|
|
+ */
|
|
|
+ private int page(int size) {
|
|
|
+ return size % 3000 == 0 ? size / 3000 : (size / 3000) + 1;
|
|
|
+ }
|
|
|
|
|
|
}
|