浏览代码

下载功能重置

xian 4 年之前
父节点
当前提交
b89586bd7a
共有 1 个文件被更改,包括 77 次插入83 次删除
  1. 77 83
      watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

+ 77 - 83
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -31,6 +31,7 @@ import com.iamberry.rst.utils.*;
 import com.iamberry.wechat.tools.NameUtils;
 import com.iamberry.wechat.tools.ResponseJson;
 import com.iamberry.wechat.tools.ResultInfo;
+import com.iamberry.wechat.tools.StrUtils;
 import net.sf.json.JSONArray;
 import net.sf.json.JSONObject;
 import org.apache.commons.codec.binary.Base64;
@@ -1375,6 +1376,7 @@ public class AdminCustomerController {
         mv.addObject("detectList", detectList);
         mv.addObject("signclosedList", signclosedList);
         mv.addObject("adminlist", adminlist);
+        mv.addObject("util", StaticModelUtil.useStaticPacker(StrUtils.class.getName()));
         return mv;
     }
 
@@ -1823,7 +1825,7 @@ public class AdminCustomerController {
     @RequestMapping("/download_customer_excel")
     public ResponseJson downloadEfastOrderExcel(HttpServletRequest request, HttpServletResponse res, CustomerInfo customerInfo,Integer type) throws Exception {
         String path = request.getSession().getServletContext().getRealPath("/");
-        AdminSalesOrderController.THREAD_POOL.submit(new Mythread(path,customerInfo,type));
+        AdminSalesOrderController.THREAD_POOL.submit(new Mythread(path,customerInfo,type, AdminUtils.getLoginAdminId()));
         return new ResponseJson(200, "查询成功", 200);
     }
 
@@ -1831,17 +1833,18 @@ public class AdminCustomerController {
         private String path;
         private CustomerInfo customerInfo;
         private Integer type;
-        public Mythread(String path,CustomerInfo customerInfo,Integer type) {
+        private Integer adminId;
+        Mythread(String path, CustomerInfo customerInfo, Integer type, Integer adminid) {
             this.path=path;
             this.customerInfo=customerInfo;
             this.type=type;
+            this.adminId = adminid;
         }
         @Override
         public void run(){
-            Admin admin = AdminUtils.getLoginAdmin();
             //添加一条下载记录
             DownloadProgressInfo downloadProgressInfo = new DownloadProgressInfo();
-            downloadProgressInfo.setDownloadAdminId(admin.getAdminId());
+            downloadProgressInfo.setDownloadAdminId(adminId);
             downloadProgressInfo.setDownloadProgress("00.00");
             downloadProgressInfo.setDownloadStatus(1);
             customerService.addDownloadProgressInfo(downloadProgressInfo);
@@ -1879,52 +1882,42 @@ public class AdminCustomerController {
                                     if (salesOrder.getSalesOrderItemList().size() > 0) {
                                         for (SalesOrderItem salesOrderItem : salesOrder.getSalesOrderItemList()) {
                                             if(common.getSignclosedInfos().size() > 0){
-                                                        //将数据copy到新容器
-                                                        CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
-                                                        BeanUtils.copyProperties(customer, customers);
-                                                  /*      customers.setRelationBackLogisticsCompany(signclosedInfo.getSignclosedLogistics());
-                                                        customers.setRelationBackLogisticsNo(signclosedInfo.getSignclosedLogisticsNumber());
-                                                        customers.setRelationBackStatus(String.valueOf(signclosedInfo.getSignclosedIsReceiving()));
-                                                        if(signclosedInfo.getSignclosedDate() == null){
-                                                            customers.setRelationBackReceiptDate(null);
-                                                        }else{
-                                                            customers.setRelationBackReceiptDate(sdf4.format(signclosedInfo.getSignclosedDate()));
+                                                //将数据copy到新容器
+                                                CustomerStatisticalInfo customers = new CustomerStatisticalInfo();
+                                                BeanUtils.copyProperties(customer, customers);
+                                                customers.setRelationSendLogisticsCompany(salesOrder.getSalesPostFirm());
+                                                customers.setRelationSendLogisticsNo(salesOrder.getSalesPostNum());
+
+                                                customers.setSalesPayTime(salesOrder.getSalesPayTime());
+                                                customers.setItemProductName(salesOrderItem.getItemProductName());
+
+                                                customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
+                                                if(salesOrderItem.getTypeName() != null || !salesOrderItem.getTypeName().equals("")){
+                                                    customers.setTypeName(String.valueOf(salesOrderItem.getTypeName()));
+                                                }
+                                                customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
+                                                customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
+                                                customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
+                                                String postageString = "";
+                                                //查询邮费信息
+                                                List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
+                                                if(listPostageInfo.size() > 0){
+                                                    for(PostageInfo postageInfo : listPostageInfo){
+                                                        String state = "";
+                                                        if(postageInfo.getPostageStatus() == 1){
+                                                            state = "未申请";
                                                         }
-                                                        customers.setSignclosedProductInfo(signclosedProductInfo.getProductName()+"("+signclosedProductInfo.getColorName()+")"+"*"+signclosedProductInfo.getProductNum());
-                                                        customers.setItemProductColor(signclosedProductInfo.getColorName());*/
-                                                        customers.setRelationSendLogisticsCompany(salesOrder.getSalesPostFirm());
-                                                        customers.setRelationSendLogisticsNo(salesOrder.getSalesPostNum());
-
-                                                        customers.setSalesPayTime(salesOrder.getSalesPayTime());
-                                                        customers.setItemProductName(salesOrderItem.getItemProductName());
-
-                                                        customers.setItemNum(String.valueOf(salesOrderItem.getItemNum()));
-                                                        if(salesOrderItem.getTypeName() != null || !salesOrderItem.getTypeName().equals("")){
-                                                            customers.setTypeName(String.valueOf(salesOrderItem.getTypeName()));
+                                                        if(postageInfo.getPostageStatus() == 2){
+                                                            state = "已申请(待转账)";
                                                         }
-                                                        customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
-                                                        customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
-                                                        customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
-                                                        String postageString = "";
-                                                        //查询邮费信息
-                                                        List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
-                                                        if(listPostageInfo.size() > 0){
-                                                            for(PostageInfo postageInfo : listPostageInfo){
-                                                                String state = "";
-                                                                if(postageInfo.getPostageStatus() == 1){
-                                                                    state = "未申请";
-                                                                }
-                                                                if(postageInfo.getPostageStatus() == 2){
-                                                                    state = "已申请(待转账)";
-                                                                }
-                                                                if(postageInfo.getPostageStatus() == 3){
-                                                                    state = "已转账";
-                                                                }
-                                                                postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
-                                                            }
+                                                        if(postageInfo.getPostageStatus() == 3){
+                                                            state = "已转账";
                                                         }
-                                                        customers.setPostageString(postageString);
-                                                        customerStatisticalInfoList.add(customers);
+                                                        postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
+                                                    }
+                                                }
+                                                customers.setPostageString(postageString);
+                                                customerStatisticalInfoList.add(customers);
                                             }
                                         }
                                     } else {
@@ -1946,46 +1939,47 @@ public class AdminCustomerController {
                                         customers.setRelationBackStatus(String.valueOf(signclosedInfo.getSignclosedIsReceiving()));
                                         if(signclosedInfo.getSignclosedDate() == null){
                                             customers.setRelationBackReceiptDate(null);
-                                            }else{
-                                                customers.setRelationBackReceiptDate(sdf4.format(signclosedInfo.getSignclosedDate()));
-                                            }
-                                            customers.setSignclosedProductInfo(signclosedProductInfo.getProductName()+"("+signclosedProductInfo.getColorName()+")"+"*"+signclosedProductInfo.getProductNum());
-                                            customers.setItemProductColor(signclosedProductInfo.getColorName());
-
-                                             customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
-                                             customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
-                                             customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
-                                             String postageString = "";
-                                             //查询邮费信息
-                                            List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
-                                            if(listPostageInfo.size() > 0){
-                                                for(PostageInfo postageInfo : listPostageInfo){
-                                                    String state = "";
-                                                    if(postageInfo.getPostageStatus() == 1){
-                                                        state = "未申请";
-                                                        }
-                                                     if(postageInfo.getPostageStatus() == 2){
-                                                        state = "已申请(待转账)";
-                                                     }
-                                                     if(postageInfo.getPostageStatus() == 3){
-                                                        state = "已转账";
-                                                     }
-                                                        postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
-                                                      }
-                                                     }
-                                                     customers.setPostageString(postageString);
-                                             customerStatisticalInfoList.add(customers);
-                                                    }
-                                                }
-                                            }else {
-                                                customerStatisticalInfoList.add(customer);
-                                            }
+                                        }else{
+                                            customers.setRelationBackReceiptDate(sdf4.format(signclosedInfo.getSignclosedDate()));
                                         }
+                                        customers.setSignclosedProductInfo(signclosedProductInfo.getProductName()+"("+signclosedProductInfo.getColorName()+")"+"*"+signclosedProductInfo.getProductNum());
+                                        customers.setItemProductColor(signclosedProductInfo.getColorName());
+
+                                         customers.setRelationFactoryCosts(customerInfo.getRelationFactoryCosts());
+                                         customers.setRelationCustomerCosts(customerInfo.getRelationCustomerCosts());
+                                         customers.setSignclosedProductInfos(common.getSignclosedProductInfos());
+                                         String postageString = "";
+                                         //查询邮费信息
+                                        List<PostageInfo> listPostageInfo = customerService.listPostageInfo(customers.getRelationId());
+                                        if(listPostageInfo.size() > 0){
+                                            for(PostageInfo postageInfo : listPostageInfo){
+                                                String state = "";
+                                                if(postageInfo.getPostageStatus() == 1){
+                                                    state = "未申请";
+                                                    }
+                                                 if(postageInfo.getPostageStatus() == 2){
+                                                    state = "已申请(待转账)";
+                                                 }
+                                                 if(postageInfo.getPostageStatus() == 3){
+                                                    state = "已转账";
+                                                 }
+                                                    postageString = postageString+"状态:"+state+" ,金额:"+postageInfo.getPostageAmount()/100+" ,支付宝账号:"+postageInfo.getPostageAlipay()+";";
+                                                  }
+                                         }
+                                        customers.setPostageString(postageString);
+                                        customerStatisticalInfoList.add(customers);
+                                    }
+                                }
+                            } else {
+                                customerStatisticalInfoList.add(customer);
+                            }
+                        }
                     }
                 }else{
                     customerStatisticalInfoList.add(customer);
                 }
-                long endTime=System.currentTimeMillis(); //获取结束时间
+                // 获取结束时间
+                long endTime=System.currentTimeMillis();
                 NumberFormat numberFormat = NumberFormat.getInstance();
                 float percentage = (float) s / (float) customerList.size() * 100;
                 String result = numberFormat.format(percentage);
@@ -2012,7 +2006,7 @@ public class AdminCustomerController {
             }
 
         }
-        }
+    }
 
 
     /**