| 
					
				 | 
			
			
				@@ -1,6 +1,7 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package org.jeecg.modules.spapl.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.File; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.io.FileOutputStream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.io.IOException; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.text.SimpleDateFormat; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -8,15 +9,22 @@ import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import javax.servlet.http.HttpServletResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.afterturn.easypoi.excel.ExcelExportUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.afterturn.easypoi.excel.entity.TemplateExportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.alibaba.fastjson.JSONObject; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.gson.Gson; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.google.gson.GsonBuilder; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.poi.hssf.usermodel.HSSFCellStyle; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.poi.hssf.usermodel.HSSFWorkbook; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.poi.hssf.util.HSSFColor; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.apache.poi.ss.usermodel.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.common.system.base.controller.JeecgController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.openApi.entity.DxpDataPlan; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.openApi.service.IDxpDataPlanService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import org.jeecg.modules.spapl.entity.SizeTable; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.spapl.vo.PackingHeaderVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.spapl.vo.SyPreAssembledPackingListVo; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.system.util.InterfaceConnUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -29,12 +37,13 @@ import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.spapl.vo.SyPreAssembledPackingListPage; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecg.modules.spapl.service.ISyPreAssembledPackingListItemService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//import org.jeecgframework.poi.excel.ExcelExportUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.ExcelImportUtil; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.def.NormalExcelConstants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.def.TemplateExcelConstants; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.entity.ExportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.entity.ImportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import org.jeecgframework.poi.excel.entity.TemplateExportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+//import org.jeecgframework.poi.excel.entity.TemplateExportParams; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.entity.enmus.ExcelType; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.BeanUtils; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -372,6 +381,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 //获取返回信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 JSONObject jsonArray = informationJson.getJSONObject("payload"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			 System.out.println("jsonArray\n"+jsonArray); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			//获取code判断是否成功 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 String code = jsonArray.getString("code"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 //获取返回消息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -724,7 +734,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		queryWrapper.eq("id",id).eq("del_flag",0);//预装箱单主表id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		SyPreAssembledPackingList preAssembledPackingList=syPreAssembledPackingListService.queryById(queryWrapper);//已筛选删除状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		List<SyPreAssembledPackingListItem> spaplItems = syPreAssembledPackingListItemService.selectByMainId(id);//已筛选删除状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		List<String> strings=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//List<String> strings=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		if(spaplItems.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			preAssembledPackingList.setSyPreAssembledPackingListItemList(spaplItems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 //			for (SyPreAssembledPackingListItem item : spaplItems){ 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -795,7 +805,7 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  Map<String, Object> maps = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  for (int i = 1; i <=count ; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			  System.out.println("循环了"+i+"次"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			  //System.out.println("循环了"+i+"次"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			 // List<SyPreAssembledPackingList exportList = new ArrayList<SyPreAssembledPackingList>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			  SyPreAssembledPackingList exportList = new SyPreAssembledPackingList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			  exportList=syPreAssembledPackingListList.get(i-1); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -824,13 +834,221 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  ModelAndView mv = new ModelAndView(new JeecgTemplateExcelView()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  maps.put("orderNumber",listMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		  System.out.println("maps的值为:\n"+maps.get("orderNumber")); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  mv.addObject(TemplateExcelConstants.FILE_NAME,"预装箱单模板导出测试"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  mv.addObject(TemplateExcelConstants.PARAMS,templateExcelConstants); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  mv.addObject(TemplateExcelConstants.MAP_DATA, maps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		  return mv; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@RequestMapping(value = "/exportXls2") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public ModelAndView exportXls2(HttpServletRequest request, SyPreAssembledPackingList syPreAssembledPackingList) throws Exception { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		QueryWrapper<SyPreAssembledPackingList> queryWrapper = QueryGenerator.initQueryWrapper(syPreAssembledPackingList, request.getParameterMap()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		queryWrapper.eq("del_flag","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<SyPreAssembledPackingList> syPreAssembledPackingListList = syPreAssembledPackingListService.list(queryWrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for (SyPreAssembledPackingList temp : syPreAssembledPackingListList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			QueryWrapper queryWrapper1=new QueryWrapper(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			queryWrapper1.eq("sy_Pre_Assembled_Packing_List_Id",temp.getId());//获取主表id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			queryWrapper1.eq("del_flag","0");//未删除数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<SyPreAssembledPackingListItem> items = syPreAssembledPackingListItemService.list(queryWrapper1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			temp.setSyPreAssembledPackingListItemList(items); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		// return exportXlsSheet2(request,SyPreAssembledPackingList.class,syPreAssembledPackingListList,"预装箱单",1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		String load= "/static/test.xlsx";//文件名 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		double total = syPreAssembledPackingListList.size();//总条数 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		int count = (int)Math.ceil(total/1);//每条sheet分几条数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		File filePath=new File(ResourceUtils.getURL("classpath:").getPath());//获取路径 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		File file=new File(filePath,load); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath(),true,"预装箱单"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//templateExcelConstants.setTempParams("true"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Map<String, Object> maps = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Map<Integer, List<Map<String, Object>>> mapscoce = new HashMap<Integer, List<Map<String, Object>>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		List<String> strs=new ArrayList<String>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		for (int i = 1; i <=count ; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			strs.add("预装箱单"+i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			SyPreAssembledPackingList exportList = new SyPreAssembledPackingList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List list=new ArrayList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//templateExcelConstants.setSheetNum(i); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			exportList=syPreAssembledPackingListList.get(i-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//ExportParams exportParams=new ExportParams("预装箱单报表", "导出人:admin" , "预装箱单"+i,file.getAbsolutePath());//sysUser.getRealname() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//exportParams.setType(ExcelType.XSSF); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<String, Object> map = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//map.put("entity",SyPreAssembledPackingList.class);//表格对应实体 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//map.put(NormalExcelConstants.PARAMS,exportParams+""+i);//表格Title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			//map.put("title",exportParams);//表格Title 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			list.add(exportList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			map.put("data", list);//数据集合 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			listMap.add(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+/*if(i>12){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				break; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			}*//* 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		mapscoce.put(0,listMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//templateExcelConstants.setSheetName(strs.toArray(new String[strs.size()]));//转数组 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		maps.put("orderNumber",listMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//Workbook workbook = ExcelExportUtil.exportExcel(listMap,null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Workbook workbook = ExcelExportUtil.exportExcelClone(mapscoce,templateExcelConstants); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		//Workbook workbook =ExcelExportUtil.exportExcel(templateExcelConstants,maps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		File savefile = new File("D:/excel"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if (!savefile.exists()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			savefile.mkdirs(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		FileOutputStream fos = new FileOutputStream("D:/excel/装箱单报表.xls"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		workbook.write(fos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		fos.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+*/ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@AutoLog(value = "导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@ApiOperation(value="导出", notes="导出") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	@RequestMapping(value = "/exportXls3") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	public Result<IPage<SyPreAssembledPackingList>> exportXls3(HttpServletRequest request, SyPreAssembledPackingList syPreAssembledPackingList,String path,String excelName) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(oConvertUtils.isEmpty(path)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if(oConvertUtils.isEmpty(excelName)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			excelName="预装箱单"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Result result=new Result(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		FileOutputStream fos = null; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			QueryWrapper<SyPreAssembledPackingList> queryWrapper = QueryGenerator.initQueryWrapper(syPreAssembledPackingList, request.getParameterMap()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			queryWrapper.eq("del_flag","0"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			queryWrapper.orderByDesc(	"create_time");//创建时间倒序 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<SyPreAssembledPackingList> syPreAssembledPackingListList = syPreAssembledPackingListService.list(queryWrapper); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(syPreAssembledPackingListList.size()==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				result.setResult(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				result.setMessage("导出失败!没有查询到数据"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				result.setSuccess(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<SyPreAssembledPackingList> temps=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (SyPreAssembledPackingList temp : syPreAssembledPackingListList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				QueryWrapper<SyPreAssembledPackingList> queryWrapper1 = new QueryWrapper<SyPreAssembledPackingList>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				queryWrapper1.eq("id",temp.getId()).eq("del_flag",0);//预装箱单主表id 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SyPreAssembledPackingList preAssembledPackingList=syPreAssembledPackingListService.queryById(queryWrapper1);//已筛选删除状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<SyPreAssembledPackingListItem> spaplItems = syPreAssembledPackingListItemService.selectByMainId(temp.getId());//已筛选删除状态 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				if(spaplItems.size()>0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					preAssembledPackingList.setSyPreAssembledPackingListItemList(spaplItems); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				temps.add(preAssembledPackingList); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			String load="D:\\单证模板\\test2.xlsx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			int count = temps.size();//分几条sheet 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			File file=new File(load); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			TemplateExportParams templateExcelConstants=new TemplateExportParams(file.getAbsolutePath(),true,"预装箱单"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Map<Integer, List<Map<String, Object>>> maps = new HashMap<Integer, List<Map<String, Object>>>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (int i = 1; i <=count ; i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<SyPreAssembledPackingList> exportList=new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				exportList.add(temps.get(i-1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SyPreAssembledPackingList exportList2=temps.get(i-1); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Map<String, Object> map = new HashMap<String, Object>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				map.put("entity", exportList2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				listMap.add(map); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			maps.put(0,listMap); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			templateExcelConstants.setColForEach(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Workbook workbook = ExcelExportUtil.exportExcelClone(maps,templateExcelConstants); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			path=path+"\\"+excelName+".xlsx"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			System.out.println(path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			File savefile = new File(path); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if (!savefile.exists()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				savefile.createNewFile(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			refreshSheet(workbook,temps);//配置某列数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			fos = new FileOutputStream(savefile); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			workbook.write(fos); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setCode(200); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setResult(temps); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setMessage("导出成功!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setSuccess(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setResult(null); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setMessage(e.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			result.setSuccess(false); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		}finally { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(fos!=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				try{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					fos.close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				}catch (Exception e){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					e.getMessage(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			return result; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	protected static void refreshSheet(Workbook workbook,List<SyPreAssembledPackingList> items) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		CellStyle cellStyle = workbook.createCellStyle();//设置单元格样式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setAlignment(HorizontalAlignment.CENTER);//左右居中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);//上下居中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setBorderBottom(BorderStyle.THIN);//边框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setBorderTop(BorderStyle.THIN);//边框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setBorderLeft(BorderStyle.THIN);//边框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setBorderRight(BorderStyle.THIN);//边框 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setFillForegroundColor(IndexedColors.LIGHT_GREEN.getIndex());//设置前景色 现在是浅绿色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setFillBackgroundColor(HSSFColor.HSSFColorPredefined.LIGHT_GREEN.getIndex());//设置背景色 现在是浅绿色 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);//必须设置 否则无效 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		CellStyle cellStyle2=workbook.createCellStyle();//设置单元格样式 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle2.setAlignment(HorizontalAlignment.CENTER);//左右居中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		cellStyle2.setVerticalAlignment(VerticalAlignment.CENTER);//上下居中 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		Iterator sheets=workbook.sheetIterator(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		int num=items.size()-1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		while (sheets.hasNext()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			Sheet sheet=(Sheet) sheets.next(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			SyPreAssembledPackingList sypres=items.get(num); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			workbook.setSheetName(num,sypres.getDocumentNo()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			num--; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			List<SyPreAssembledPackingListItem> list=sypres.getSyPreAssembledPackingListItemList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			if(list==null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				continue;//退出本次循环 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			for (int i=0; i < list.size(); i++) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Row row = sheet.createRow(4+i);//列 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String strs=""; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for (SizeTable size : sypres.getSizeTables()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					strs+=size.getSize()+","; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				String[] params=("序号,H/D,PO,款号,订单号,UNIT PRICE(单价),分销点,ITEMCODE,启始箱号,结束箱号,颜色(中英文),"+strs+"件数/每箱,箱数,总件数,外箱长度,外箱宽度,外箱高度,总体积,外箱净重,总净重,外箱毛重,总毛重,NN.W,总价,Lot NO,Packs CODE,DC NO,SKU号码,LABEL(标签),ORDER NO,Pre-Pack SKU Number").split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				Row row2 = sheet.createRow(3); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for (int x=0;x<params.length;x++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					Cell cell = row2.createCell(x);//横向 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(x>10&&x<params.length-20){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						cell.setCellStyle(cellStyle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						cell.setCellStyle(cellStyle2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					cell.setCellValue(params[x]);//比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				List<SizeTable> sizes=list.get(i).getSizeTables(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				SyPreAssembledPackingListItem itemN=list.get(0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				params=list.get(i).toString().replace("null","").split(","); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				for (int y=0;y<params.length;y++){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					Cell cell = row.createCell(y);//横向 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					if(y==0){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						cell.setCellStyle(cellStyle2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						cell.setCellValue(i+1);//比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						continue; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} else if(y>10&&y<params.length-20){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						cell.setCellStyle(cellStyle); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					}else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+						cell.setCellStyle(cellStyle2); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+					cell.setCellValue(params[y]);//比例 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+				} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	  /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	   * 通过excel导入数据 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	   * 
			 |