|
@@ -5,6 +5,7 @@ import java.io.InputStream;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.io.IOException;
|
|
|
import java.lang.reflect.Array;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
@@ -84,13 +85,14 @@ public class SyPackingListFabricController {
|
|
|
private ISyPackingListFabricItemService syPackingListFabricItemService;
|
|
|
|
|
|
/**
|
|
|
- * 分页列表查询
|
|
|
*
|
|
|
+ * 分页列表查询
|
|
|
* @param syPackingListFabric
|
|
|
* @param pageNo
|
|
|
* @param pageSize
|
|
|
* @param req
|
|
|
* @return
|
|
|
+ *
|
|
|
*/
|
|
|
@AutoLog(value = "装箱单-面辅料-分页列表查询")
|
|
|
@ApiOperation(value="装箱单-面辅料-分页列表查询", notes="装箱单-面辅料-分页列表查询")
|
|
@@ -509,8 +511,6 @@ public class SyPackingListFabricController {
|
|
|
} catch (Exception e) {
|
|
|
log.error(e.getMessage(),e);
|
|
|
return Result.error("文件导入失败:"+e.getMessage());
|
|
|
- } finally {
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
return Result.OK("文件导入失败!");
|
|
@@ -569,6 +569,17 @@ public class SyPackingListFabricController {
|
|
|
return Result.OK(massage);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ public static boolean isNumeric(String str) {
|
|
|
+ String bigStr;
|
|
|
+ try {
|
|
|
+ bigStr = new BigDecimal(str).toString();
|
|
|
+ } catch (Exception e) {
|
|
|
+ return false;//异常 说明包含非数字。
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
@AutoLog(value = "装箱单面辅料JSON")
|
|
|
@ApiOperation(value="装箱单面辅料JSON", notes="装箱单面辅料JSON")
|
|
|
@GetMapping(value = "/pushSplt")
|
|
@@ -645,11 +656,7 @@ public class SyPackingListFabricController {
|
|
|
@RequestMapping(value = "/exportXls")
|
|
|
public Result<SyPackingListFabric> exportXls(HttpServletRequest request,HttpServletResponse response,SyPackingListFabric syPackingListFabric) {
|
|
|
long startTime = System.currentTimeMillis();
|
|
|
- /*要计算的程序部分*/
|
|
|
- /* SyPackingListFabric syPackingListFabric=new SyPackingListFabric();
|
|
|
- if(oConvertUtils.isNotEmpty(id)){
|
|
|
- syPackingListFabric.setId(id);
|
|
|
- }*/
|
|
|
+ System.out.println("开始导出");
|
|
|
Result result=new Result();
|
|
|
try{
|
|
|
QueryWrapper<SyPackingListFabric> queryWrapper = new QueryWrapper<>(); //QueryGenerator.initQueryWrapper(syPackingListFabric, request.getParameterMap());
|
|
@@ -667,14 +674,15 @@ public class SyPackingListFabricController {
|
|
|
}
|
|
|
queryWrapper.eq("a.del_flag","0");
|
|
|
Page<SyPackingListFabric> page = new Page<SyPackingListFabric>(1, 10000);
|
|
|
- List<SyPackingListFabric> packingListFabrics = syPackingListFabricService.selectPage(page, queryWrapper).getRecords();
|
|
|
+ // List<SyPackingListFabric> packingListFabrics = syPackingListFabricService.selectPage(page, queryWrapper).getRecords();
|
|
|
+
|
|
|
+ List<SyPackingListFabric> packingListFabrics =syPackingListFabricService.selectByList(page, queryWrapper);//进行合并
|
|
|
if(packingListFabrics.size()==0){
|
|
|
result.setResult(null);
|
|
|
result.setMessage("导出失败!没有查询到数据");
|
|
|
result.setSuccess(false);
|
|
|
return result;
|
|
|
}
|
|
|
- packingListFabrics=syPackingListFabricService.selectByList(packingListFabrics);
|
|
|
long endTime = System.currentTimeMillis();
|
|
|
System.out.println("查询子表后程序运行时间:" + (endTime - startTime) + "ms");
|
|
|
String load="D:\\单证模板\\面辅料.xlsx";
|
|
@@ -683,11 +691,10 @@ public class SyPackingListFabricController {
|
|
|
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<SyPackingListFabric> exportList=new ArrayList<>();
|
|
|
- exportList.add(packingListFabrics.get(i-1));
|
|
|
- SyPackingListFabric exportList2=packingListFabrics.get(i-1);
|
|
|
+ for (int i = 0; i <count ; i++) {
|
|
|
+ SyPackingListFabric exportList2=packingListFabrics.get(i);
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ //map.put("entity", packingListFabrics);//主表数据
|
|
|
map.put("entity", exportList2);//主表数据
|
|
|
map.put("maps", exportList2.getSyPackingListFabricItem());//子表数据
|
|
|
listMap.add(map);
|
|
@@ -695,7 +702,8 @@ public class SyPackingListFabricController {
|
|
|
maps.put(0,listMap);
|
|
|
templateExcelConstants.setColForEach(true);
|
|
|
Workbook workbook = ExcelExportUtil.exportExcelClone(maps,templateExcelConstants);
|
|
|
- for(int i=0;i<packingListFabrics.size();i++){
|
|
|
+ // Workbook workbook = ExcelExportUtil.exportExcel(maps,templateExcelConstants);
|
|
|
+ for(int i=0;i<count;i++){
|
|
|
workbook.setSheetName(i,"面辅料"+(i+1));
|
|
|
}
|
|
|
//refreshSheet(workbook,temps);//配置某列数据
|
|
@@ -707,7 +715,6 @@ public class SyPackingListFabricController {
|
|
|
result.setSuccess(true);
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
- System.err.println("message\t"+e.getMessage());
|
|
|
result.setResult(null);
|
|
|
result.setMessage(e.getMessage());
|
|
|
result.setSuccess(false);
|