| 
					
				 | 
			
			
				@@ -1,5 +1,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.kmall.admin.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.google.common.collect.Lists; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.google.common.collect.Maps; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.entity.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.service.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.service.OrderExceptionRecordService; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -9,6 +11,8 @@ import com.kmall.admin.utils.ParamUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.constant.Dict; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.entity.SysUserEntity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.utils.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.common.utils.excel.ExcelExport; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.common.utils.excel.ExcelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.utils.pingan.PinganUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.utils.pingan.dto.PinganResponseDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.common.utils.print.ticket.item.Ticket; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,16 +26,15 @@ import net.sf.json.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.lang3.StringUtils; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.logging.Log; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.commons.logging.LogFactory; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.apache.log4j.Logger; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.shiro.authz.annotation.RequiresPermissions; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Date; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.List; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -674,4 +677,57 @@ public class OrderController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         return r; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 订单导出请求 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RequiresPermissions(value = {"order:export"}) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RequestMapping(value = "export") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public Object export(@RequestParam Map<String, Object> params, HttpServletResponse response, HttpServletRequest request) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ParamUtils.setQueryPowerByRoleType(params, "storeId", "merchSn", false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //查询列表数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        params.put("isOnfiilineOrder", Dict.isOnfflineOrder.item_0.getItem()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<OrderEntity> orderList = orderService.queryExportList(params); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ExcelExport ee = new ExcelExport("订单信息"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String[] header = new String[]{"订单编号","商户订单编号", "订单状态", "保税模式", "快递公司名称", "快递单编号", "海关清单编号", "收货人姓名", "收件人手机", "收件人省份", "收件人城市", "收件人区县", "收件人地址", "下单时间", "实际支付金额", "SKU", "商品名称", "数量", "销售价"}; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<Map<String, Object>> list = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (orderList != null && orderList.size() != 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (OrderEntity orderEntity : orderList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                LinkedHashMap<String, Object> map = new LinkedHashMap<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Integer orderStatus = orderEntity.getOrderStatus(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                String orderBizType = orderEntity.getOrderBizType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("OrderSn", orderEntity.getOrderSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("MerchOrderSn", orderEntity.getMerchOrderSn()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("OrderStatus", StringUtils.isEmpty(orderStatus.toString())? "":Dict.orderStatus.valueOf("item_"+ orderStatus).getItemName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("OrderBizType", StringUtils.isEmpty(orderBizType)? "":Dict.orderBizType.valueOf("item_"+orderBizType).getItemName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("ShippingName", orderEntity.getShippingName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("ShippingNo", orderEntity.getShippingNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("InvtNo", orderEntity.getOrderProcessRecord().getInvtNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("Consignee", orderEntity.getConsignee()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("Mobile", orderEntity.getMobile()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("Province", orderEntity.getProvince()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("City", orderEntity.getCity()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("District", orderEntity.getDistrict()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("Address", orderEntity.getAddress()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("OrderStartTime", DateUtils.format(orderEntity.getOrderProcessRecord().getAddOrderStartTime(),"yyyy-MM-dd HH:mm:ss")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                map.put("ActualPrice", orderEntity.getActualPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                for (OrderGoodsEntity orderGoodsEntity : orderEntity.getOrderGoodsEntityList()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    map.put("SKU", orderGoodsEntity.getSku()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    map.put("GoodsName", orderGoodsEntity.getGoodsName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    map.put("Number", orderGoodsEntity.getNumber()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    map.put("RetailPrice", orderGoodsEntity.getRetailPrice()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    list.add(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ee.addSheetByMap("订单信息", list, header); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        ee.export(response); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |