Browse Source

增加域参数,删除没有数据的列

master
liuchen864 6 months ago
parent
commit
42268fcc52
  1. 40
      win-admin/src/main/java/com/win/web/controller/base/ExcelController.java
  2. BIN
      win-admin/src/main/resources/changchun.xlsx
  3. BIN
      win-admin/src/main/resources/foshan_qingdao.xlsx
  4. BIN
      win-admin/src/main/resources/guowai1.xlsx
  5. BIN
      win-admin/src/main/resources/guowai2.xls

40
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 type = jsonObject.getString("type");
String companyCode = "LEARPROD-CCJV"; String companyCode = "LEARPROD-CCJV";
String interfaceName = "supplierrsexport"; String interfaceName = "supplierrsexport";
String orderDomain = jsonObject.getString("orderDomain");
String domain = "CCJV"; String domain = "CCJV";
if("guowai2".equals(type)) { if("guowai2".equals(type)) {
interfaceName = "xxpomrpexport"; interfaceName = "xxpomrpexport";
@ -87,6 +88,7 @@ public class ExcelController {
JSONObject ttSearchCondition = new JSONObject(); JSONObject ttSearchCondition = new JSONObject();
ttSearchCondition.put("order_from", orderNo); ttSearchCondition.put("order_from", orderNo);
ttSearchCondition.put("order_to", orderNo); ttSearchCondition.put("order_to", orderNo);
ttSearchCondition.put("order_domain", orderDomain);
jsonArray.add(ttSearchCondition); jsonArray.add(ttSearchCondition);
JSONObject dsSearchCondition = new JSONObject(); JSONObject dsSearchCondition = new JSONObject();
dsSearchCondition.put("ttSearchCondition", jsonArray); dsSearchCondition.put("ttSearchCondition", jsonArray);
@ -164,10 +166,40 @@ public class ExcelController {
orderArray.add(mainMap.get(mainKey)); orderArray.add(mainMap.get(mainKey));
} }
for(String firmKey : firmMap.keySet()) { 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()) { 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)) {//长春模板 if("changchun".equals(type)) {//长春模板
fileNames.add(fillChangchun(orderNo, jsonObjectHeader, orderArray, firmArray, forecastArray)); fileNames.add(fillChangchun(orderNo, jsonObjectHeader, orderArray, firmArray, forecastArray));
@ -336,7 +368,7 @@ public class ExcelController {
nextCell.setCellStyle(cellStyle7); 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); CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 6, firmArray.size() + forecastArray.size() + 5);
sheet.addMergedRegion(cellRangeAddress3); sheet.addMergedRegion(cellRangeAddress3);
@ -512,7 +544,7 @@ public class ExcelController {
nextCell.setCellStyle(cellStyle7); 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); CellRangeAddress cellRangeAddress3 = new CellRangeAddress(14, 14, firmArray.size() + 9, firmArray.size() + forecastArray.size() + 8);
sheet.addMergedRegion(cellRangeAddress3); sheet.addMergedRegion(cellRangeAddress3);

BIN
win-admin/src/main/resources/changchun.xlsx

Binary file not shown.

BIN
win-admin/src/main/resources/foshan_qingdao.xlsx

Binary file not shown.

BIN
win-admin/src/main/resources/guowai1.xlsx

Binary file not shown.

BIN
win-admin/src/main/resources/guowai2.xls

Binary file not shown.
Loading…
Cancel
Save