From dd73bec0d5eb2186317ca565432fe6e73992e7e8 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 25 三月 2025 21:19:56 +0800
Subject: [PATCH] 优化代码

---
 service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportRoomSMOImpl.java |  167 -------------------------------------------------------
 1 files changed, 0 insertions(+), 167 deletions(-)

diff --git a/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportRoomSMOImpl.java b/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportRoomSMOImpl.java
index 0814f05..2b1c42c 100644
--- a/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportRoomSMOImpl.java
+++ b/service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportRoomSMOImpl.java
@@ -69,96 +69,6 @@
     @Autowired
     private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
 
-    @Override
-    public ResponseEntity<Object> exportExcelData(IPageData pd) throws Exception {
-
-        ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate);
-
-        JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
-
-        Assert.hasKeyAndValue(JSONObject.parseObject(pd.getReqData()), "communityId", "璇锋眰涓湭鍖呭惈灏忓尯");
-        Assert.hasKeyAndValue(paramIn, "objType", "璇锋眰涓湭鍖呭惈璐圭敤瀵硅薄");
-
-        Workbook workbook = null;  //宸ヤ綔绨�
-        //宸ヤ綔琛�
-        workbook = new XSSFWorkbook();
-
-        if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(paramIn.getString("objType"))) {
-            //鑾峰彇妤间俊鎭�
-            getRooms(pd, result, workbook);
-        } else {
-            getCars(pd, result, workbook);
-        }
-
-
-        ByteArrayOutputStream os = new ByteArrayOutputStream();
-        MultiValueMap headers = new HttpHeaders();
-        headers.add("content-type", "application/octet-stream;charset=UTF-8");
-        headers.add("Content-Disposition", "attachment;filename=feeImport_" + DateUtil.getyyyyMMddhhmmssDateString() + ".xlsx");
-        headers.add("Pargam", "no-cache");
-        headers.add("Cache-Control", "no-cache");
-        //headers.add("Content-Disposition", "attachment; filename=" + outParam.getString("fileName"));
-        headers.add("Accept-Ranges", "bytes");
-        byte[] context = null;
-        try {
-            workbook.write(os);
-            context = os.toByteArray();
-            os.close();
-            workbook.close();
-        } catch (IOException e) {
-            e.printStackTrace();
-            // 淇濆瓨鏁版嵁
-            return new ResponseEntity<Object>("瀵煎嚭澶辫触", HttpStatus.INTERNAL_SERVER_ERROR);
-        }
-        // 淇濆瓨鏁版嵁
-        return new ResponseEntity<Object>(context, headers, HttpStatus.OK);
-    }
-    /**
-     * 鏌ヨ杞﹁締
-     *
-     * @param pd
-     * @param result
-     * @param workbook
-     */
-    private void getCars(IPageData pd, ComponentValidateResult result, Workbook workbook) {
-        Sheet sheet = workbook.createSheet("杞︿綅璐圭敤淇℃伅");
-        Row row = sheet.createRow(0);
-        Cell cell0 = row.createCell(0);
-        cell0.setCellValue("璐圭敤鍚嶇О: 璇峰~鍐欑郴缁熶腑璐圭敤绫诲瀷锛屽鍋滆溅璐圭瓑 锛沑n寮�濮嬫椂闂�: " +
-                "鏀惰垂寮�濮嬫椂闂达紝鏍煎紡涓篩YYY-MM-DD锛沑n缁撴潫鏃堕棿: 璐圭敤缁撴潫鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛� \n鏀惰垂閲戦: 鏈鏀跺彇閲戦 鍗曚綅鍏冿紱 " +
-                "\n娉ㄦ剰锛氭墍鏈夊崟鍏冩牸寮忎负鏂囨湰");
-        CellStyle cs = workbook.createCellStyle();
-        cs.setWrapText(true);  //鍏抽敭
-        cell0.setCellStyle(cs);
-        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("鏀惰垂閲戦");
-
-        //鏌ヨ妤兼爧淇℃伅
-        JSONArray cars = this.getExistsCars(pd, result);
-        if (cars == null) {
-            CellRangeAddress region = new CellRangeAddress(0, 0, 0, 4);
-            sheet.addMergedRegion(region);
-            return;
-        }
-        for (int carIndex = 0; carIndex < cars.size(); carIndex++) {
-            row = sheet.createRow(carIndex + 2);
-            row.createCell(0).setCellValue(cars.getJSONObject(carIndex).getString("carNum"));
-            row.createCell(1).setCellValue("");
-            row.createCell(2).setCellValue("");
-            row.createCell(3).setCellValue("");
-            row.createCell(4).setCellValue("");
-        }
-
-        CellRangeAddress region = new CellRangeAddress(0, 0, 0, 4);
-        sheet.addMergedRegion(region);
-    }
-
-
     /**
      * 鏌ヨ瀛樺湪鐨勬埧灞嬩俊鎭�
      * room.queryRooms
@@ -189,83 +99,6 @@
 
     }
 
-    /**
-     * 鏌ヨ瀛樺湪鐨勬埧灞嬩俊鎭�
-     * room.queryRooms
-     *
-     * @param pd
-     * @param result
-     * @return
-     */
-    private JSONArray getExistsCars(IPageData pd, ComponentValidateResult result) {
-        String apiUrl = "";
-        ResponseEntity<String> responseEntity = null;
-        apiUrl = "owner.queryOwnerCars?page=1&row=10000&communityId=" + result.getCommunityId();
-        responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
-
-        if (responseEntity.getStatusCode() != HttpStatus.OK) { //璺宠繃 淇濆瓨鍗曞厓淇℃伅
-            return null;
-        }
-
-        JSONObject savedCarInfoResults = JSONObject.parseObject(responseEntity.getBody());
-
-
-        if (!savedCarInfoResults.containsKey("data")) {
-            return null;
-        }
-
-
-        return savedCarInfoResults.getJSONArray("data");
-
-    }
-
-    /**
-     * 鑾峰彇 鎴垮眿淇℃伅
-     *
-     * @param componentValidateResult
-     * @param workbook
-     */
-    private void getRooms(IPageData pd, ComponentValidateResult componentValidateResult, Workbook workbook) {
-        Sheet sheet = workbook.createSheet("鎴垮眿璐圭敤淇℃伅");
-        Row row = sheet.createRow(0);
-        Cell cell0 = row.createCell(0);
-        cell0.setCellValue("鎴垮眿缂栧彿: 妤兼爧-鍗曞厓-鎴垮彿 锛沑n璐圭敤鍚嶇О: 璇峰~鍐欑郴缁熶腑璐圭敤绫诲瀷锛屽鐗╀笟璐癸紝鎶奸噾绛� 锛沑n寮�濮嬫椂闂�: " +
-                "鏀惰垂寮�濮嬫椂闂达紝鏍煎紡涓篩YYY-MM-DD锛沑n缁撴潫鏃堕棿: 璐圭敤缁撴潫鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛� \n鏀惰垂閲戦: 鏈鏀跺彇閲戦 鍗曚綅鍏冿紱 " +
-                "\n娉ㄦ剰锛氭墍鏈夊崟鍏冩牸寮忎负鏂囨湰");
-        CellStyle cs = workbook.createCellStyle();
-        cs.setWrapText(true);  //鍏抽敭
-        cell0.setCellStyle(cs);
-        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("鏀惰垂閲戦");
-
-        //鏌ヨ妤兼爧淇℃伅
-        JSONArray rooms = this.getExistsRoom(pd, componentValidateResult);
-        if (rooms == null) {
-            CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6);
-            sheet.addMergedRegion(region);
-            return;
-        }
-        String roomName = "";
-        for (int roomIndex = 0; roomIndex < rooms.size(); roomIndex++) {
-            row = sheet.createRow(roomIndex + 2);
-            roomName = rooms.getJSONObject(roomIndex).getString("floorNum")
-                    +"-"+rooms.getJSONObject(roomIndex).getString("unitNum")
-                    +"-"+rooms.getJSONObject(roomIndex).getString("roomNum");
-            row.createCell(0).setCellValue(roomName);
-            row.createCell(1).setCellValue("");
-            row.createCell(2).setCellValue("");
-            row.createCell(3).setCellValue("");
-            row.createCell(4).setCellValue("");
-        }
-
-        CellRangeAddress region = new CellRangeAddress(0, 0, 0, 6);
-        sheet.addMergedRegion(region);
-    }
 
 
     /**

--
Gitblit v1.8.0