From d8bc08083504bc5d8ba61513ac21ec0f26ba5c8d Mon Sep 17 00:00:00 2001
From: java110 <928255095@qq.com>
Date: 星期三, 30 十二月 2020 23:51:23 +0800
Subject: [PATCH] 优化代码

---
 service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java |   33 ++++++++++++++++++---------------
 1 files changed, 18 insertions(+), 15 deletions(-)

diff --git a/service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java b/service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
index 12e5d57..0d87994 100644
--- a/service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
+++ b/service-front/src/main/java/com/java110/front/smo/assetExport/impl/ExportFeeManualCollectionSMOImpl.java
@@ -2,6 +2,7 @@
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.parser.Feature;
 import com.java110.core.component.BaseComponentSMO;
 import com.java110.core.context.IPageData;
 import com.java110.entity.component.ComponentValidateResult;
@@ -9,11 +10,7 @@
 import com.java110.utils.constant.ServiceConstant;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.DateUtil;
-import org.apache.poi.ss.usermodel.Cell;
-import org.apache.poi.ss.usermodel.CellStyle;
-import org.apache.poi.ss.usermodel.Row;
-import org.apache.poi.ss.usermodel.Sheet;
-import org.apache.poi.ss.usermodel.Workbook;
+import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.slf4j.Logger;
@@ -101,7 +98,7 @@
             return null;
         }
 
-        JSONObject savedRoomInfoResults = JSONObject.parseObject(responseEntity.getBody());
+        JSONObject savedRoomInfoResults = JSONObject.parseObject(responseEntity.getBody(), Feature.OrderedField);
 
 
         if (!savedRoomInfoResults.containsKey("data")) {
@@ -135,41 +132,47 @@
         row.setHeight((short) (200 * 10));
         row = sheet.createRow(1);
         row.createCell(0).setCellValue("搴忓彿");
-        row.createCell(1).setCellValue("鎴垮彿");
-        row.createCell(2).setCellValue("濮撳悕");
-        row.createCell(3).setCellValue("鑱旂郴鐢佃瘽");
-        row.createCell(4).setCellValue("鏀惰垂闈㈢Н/m2");
 
 
         //鏌ヨ妤兼爧淇℃伅
         JSONArray rooms = this.getExistsRoomFee(pd, componentValidateResult);
         if (rooms == null || rooms.size() < 1) {
-            CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6);
+            CellRangeAddress region = new CellRangeAddress(0, 0, 0, 1);
             sheet.addMergedRegion(region);
             return;
         }
         JSONObject dataObj = rooms.getJSONObject(0);
         int dataKeyIndex = 1;
         for (String key : dataObj.keySet()) {
-            if (key.contains("-")) {
-                row.createCell(dataKeyIndex).setCellValue(key.substring(key.indexOf("-") + 1));
+            if (key.contains("_")) {
+                row.createCell(dataKeyIndex).setCellValue(key.substring(key.indexOf("_") + 1));
             } else {
                 row.createCell(dataKeyIndex).setCellValue(key);
             }
             dataKeyIndex++;
         }
+        row.createCell(dataKeyIndex).setCellValue("澶囨敞");
+
 
         for (int roomIndex = 0; roomIndex < rooms.size(); roomIndex++) {
             row = sheet.createRow(roomIndex + 2);
             dataObj = rooms.getJSONObject(roomIndex);
-            dataKeyIndex = 0;
+            dataKeyIndex = 1;
+            row.createCell(0).setCellValue(roomIndex + 1);
             for (String key : dataObj.keySet()) {
                 row.createCell(dataKeyIndex).setCellValue(dataObj.getString(key));
                 dataKeyIndex++;
             }
+            row.createCell(dataKeyIndex + 2).setCellValue("");
         }
 
-        CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6);
+        row = sheet.createRow(rooms.size() + 2);
+        cell0 = row.createCell(0);
+        cell0.setCellValue("娉細姝ゃ�婃瑺璐圭粺璁¤〃銆嬩氦鐢卞帵闂ㄧ淮搴︽櫤涓寸鎶�鏈夐檺鍏徃杩涜鍌敹");
+
+        CellRangeAddress region = new CellRangeAddress(0, 0, 0, dataKeyIndex);
+        sheet.addMergedRegion(region);
+        region = new CellRangeAddress(rooms.size() + 2, rooms.size() + 2, 0, dataKeyIndex);
         sheet.addMergedRegion(region);
     }
 

--
Gitblit v1.8.0