| 
					
				 | 
			
			
				@@ -1,20 +1,25 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.kmall.admin.controller.exportPDF; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.admin.dto.StoreGoodsDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.service.GoodsService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.admin.utils.pdf.ViewPDF; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.kmall.api.entity.exportpdf.PDFGoodsDto; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.common.constant.JxlsXmlTemplateName; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.common.utils.R; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.kmall.common.utils.excel.ExcelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.apache.http.HttpResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.stereotype.Controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.RequestParam; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.bind.annotation.ResponseBody; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.springframework.web.multipart.MultipartFile; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.servlet.ModelAndView; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.math.BigDecimal; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.HashMap; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Map; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import java.util.Objects; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  * @author zhangchuangbiao 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -31,6 +36,9 @@ public class ExportPDFController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Value("${font.url}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     private String fontUrl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Autowired 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private ExcelUtil excelUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //    @Value("${upload.dir}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //    private String uploadDir; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -87,6 +95,46 @@ public class ExportPDFController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     * 批量生成pdf 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+     */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @RequestMapping("/batchPrintPdf") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @ResponseBody 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public R batchPrintPdf(@RequestParam("file") MultipartFile file) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        List<PDFGoodsDto> PDFGoodsDtoList = new ArrayList<>();//信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            PDFGoodsDto PDFGoodsDto = new PDFGoodsDto(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            Map<String, Object> beans = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            beans.put("PDFGoodsDto", PDFGoodsDto); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            beans.put("PDFGoodsDtoList", PDFGoodsDtoList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (file.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return R.error("文件不能为空!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            excelUtil.readExcel(JxlsXmlTemplateName.PDF_GOODS_DTO_LIST, beans, file.getInputStream()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception e) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            e.printStackTrace(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return R.error("导入失败!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        //上传文件 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return R.ok("导入成功!").put("PDFGoodsDtoList",PDFGoodsDtoList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |