diff --git a/win-admin/src/main/java/com/win/web/controller/base/ExcelController.java b/win-admin/src/main/java/com/win/web/controller/base/ExcelController.java index a092f07..b4d329a 100644 --- a/win-admin/src/main/java/com/win/web/controller/base/ExcelController.java +++ b/win-admin/src/main/java/com/win/web/controller/base/ExcelController.java @@ -65,6 +65,7 @@ public class ExcelController { String type = jsonObject.getString("type"); String companyCode = "LEARPROD-CCJV"; String interfaceName = "supplierrsexport"; + String orderDomain = jsonObject.getString("orderDomain"); String domain = "CCJV"; if("guowai2".equals(type)) { interfaceName = "xxpomrpexport"; @@ -87,6 +88,7 @@ public class ExcelController { JSONObject ttSearchCondition = new JSONObject(); ttSearchCondition.put("order_from", orderNo); ttSearchCondition.put("order_to", orderNo); + ttSearchCondition.put("order_domain", orderDomain); jsonArray.add(ttSearchCondition); JSONObject dsSearchCondition = new JSONObject(); dsSearchCondition.put("ttSearchCondition", jsonArray); @@ -164,10 +166,40 @@ public class ExcelController { orderArray.add(mainMap.get(mainKey)); } for(String firmKey : firmMap.keySet()) { - firmArray.add(firmMap.get(firmKey)); + JSONObject firm = firmMap.get(firmKey); + boolean isAllZero = false; + for(int count = 0; count < orderArray.size(); count++) { + String cellValue = ""; + JSONObject object = orderArray.getJSONObject(count); + JSONObject order = firm.getJSONObject(object.getString("schd_line_line")); + if(order != null) { + cellValue = order.getString("schd_line_qty"); + } + if(!cellValue.isEmpty() && !cellValue.equals("0")) { + isAllZero = true; + } + } + if(isAllZero) { + firmArray.add(firm); + } } for(String forecastKey : forecastMap.keySet()) { - forecastArray.add(forecastMap.get(forecastKey)); + JSONObject forecast = forecastMap.get(forecastKey); + boolean isAllZero = false; + for(int count = 0; count < orderArray.size(); count++) { + String cellValue = ""; + JSONObject object = orderArray.getJSONObject(count); + JSONObject order = forecast.getJSONObject(object.getString("schd_line_line")); + if(order != null) { + cellValue = order.getString("schd_line_qty"); + } + if(!cellValue.isEmpty() && !cellValue.equals("0")) { + isAllZero = true; + } + } + if(isAllZero) { + forecastArray.add(forecastMap.get(forecastKey)); + } } if("changchun".equals(type)) {//长春模板 fileNames.add(fillChangchun(orderNo, jsonObjectHeader, orderArray, firmArray, forecastArray)); @@ -336,7 +368,7 @@ public class ExcelController { nextCell.setCellStyle(cellStyle7); } } - if (!forecastArray.isEmpty()) { + if (!forecastArray.isEmpty() && forecastArray.size() > 1) { // 合并单元格 CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 6, firmArray.size() + forecastArray.size() + 5); sheet.addMergedRegion(cellRangeAddress3); @@ -512,7 +544,7 @@ public class ExcelController { nextCell.setCellStyle(cellStyle7); } } - if (!forecastArray.isEmpty()) { + if (!forecastArray.isEmpty() && forecastArray.size() > 1) { // 合并单元格 CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 9, firmArray.size() + forecastArray.size() + 8); sheet.addMergedRegion(cellRangeAddress3); diff --git a/win-admin/src/main/resources/changchun.xlsx b/win-admin/src/main/resources/changchun.xlsx new file mode 100644 index 0000000..c7d90be Binary files /dev/null and b/win-admin/src/main/resources/changchun.xlsx differ diff --git a/win-admin/src/main/resources/foshan_qingdao.xlsx b/win-admin/src/main/resources/foshan_qingdao.xlsx new file mode 100644 index 0000000..cd77e74 Binary files /dev/null and b/win-admin/src/main/resources/foshan_qingdao.xlsx differ diff --git a/win-admin/src/main/resources/guowai1.xlsx b/win-admin/src/main/resources/guowai1.xlsx new file mode 100644 index 0000000..fe257db Binary files /dev/null and b/win-admin/src/main/resources/guowai1.xlsx differ diff --git a/win-admin/src/main/resources/guowai2.xls b/win-admin/src/main/resources/guowai2.xls new file mode 100644 index 0000000..1aad2e5 Binary files /dev/null and b/win-admin/src/main/resources/guowai2.xls differ