From 45149c4de50d945a27cbc7324ec0699f5b15df14 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期二, 27 二月 2024 13:57:47 +0800
Subject: [PATCH] 取消空格问题
---
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportRoomSMOImpl.java | 115 ++++++++++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 105 insertions(+), 10 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 fd16e91..e031cc2 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
@@ -6,12 +6,12 @@
import com.java110.api.smo.assetExport.IExportRoomSMO;
import com.java110.core.context.IPageData;
import com.java110.core.log.LoggerFactory;
-import com.java110.dto.RoomDto;
+import com.java110.dto.room.RoomDto;
import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.owner.OwnerCarDto;
import com.java110.dto.parking.ParkingSpaceDto;
-import com.java110.entity.component.ComponentValidateResult;
+import com.java110.dto.system.ComponentValidateResult;
import com.java110.intf.community.IParkingSpaceInnerServiceSMO;
import com.java110.intf.community.IRoomV1InnerServiceSMO;
import com.java110.intf.fee.IPayFeeConfigV1InnerServiceSMO;
@@ -126,7 +126,7 @@
ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate);
JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
-
+ paramIn.put("storeId",result.getStoreId());
Assert.hasKeyAndValue(paramIn, "communityId", "璇锋眰涓湭鍖呭惈灏忓尯");
//Assert.hasKeyAndValue(paramIn, "floorIds", "璇锋眰涓湭鍖呭惈妤兼爧");
Assert.hasKeyAndValue(paramIn, "configIds", "璇锋眰涓湭鍖呭惈璐圭敤椤�");
@@ -167,28 +167,31 @@
return new ResponseEntity<Object>(context, headers, HttpStatus.OK);
}
+
private void getParkspaceAndConfigs(JSONObject paramIn, Workbook workbook) {
Sheet sheet = workbook.createSheet("鍒涘缓璐圭敤");
Row row = sheet.createRow(0);
Cell cell0 = row.createCell(0);
cell0.setCellValue("璐圭敤鍚嶇О: 璇峰~鍐欑郴缁熶腑璐圭敤绫诲瀷锛屽鐗╀笟璐癸紝鎶奸噾绛� 锛沑n璁¤垂璧峰鏃堕棿: " +
- "璁¤垂璧峰鏃堕棿鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛沑n寤鸿处鏃堕棿: 寤鸿处鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛� \n 绫诲瀷锛氳〃鏄庢槸鍚堝悓 鎴垮眿 杩樻槸杞﹁締 鎴垮眿 1001 杞﹁締 2002 鍚堝悓 3003" +
- "\n娉ㄦ剰锛氭墍鏈夊崟鍏冩牸寮忎负鏂囨湰");
+ "璁¤垂璧峰鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛沑n璁¤垂缁撴潫鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛沑n" +
+ "寤鸿处鏃堕棿: 寤鸿处鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛� \n 绫诲瀷锛氳〃鏄庢槸鍚堝悓 鎴垮眿 杩樻槸杞﹁締 鎴垮眿 1001 杞﹁締 2002 鍚堝悓 3003" +
+ "\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(0).setCellValue("杞︾墝鍙�");
row.createCell(1).setCellValue("绫诲瀷");
row.createCell(2).setCellValue("璐圭敤椤笽D");
row.createCell(3).setCellValue("鏀惰垂椤圭洰");
row.createCell(4).setCellValue("寤鸿处鏃堕棿");
row.createCell(5).setCellValue("璁¤垂璧峰鏃堕棿");
+ row.createCell(6).setCellValue("璁¤垂缁撴潫鏃堕棿");
ParkingSpaceDto parkingSpaceDto = new ParkingSpaceDto();
parkingSpaceDto.setCommunityId(paramIn.getString("communityId"));
- parkingSpaceDto.setPsIds(paramIn.getString("psIds").split(","));
+ parkingSpaceDto.setPaIds(paramIn.getString("paIds").split(","));
List<ParkingSpaceDto> parkingSpaceDtos = parkingSpaceInnerServiceSMOImpl.queryParkingSpaces(parkingSpaceDto);
if (parkingSpaceDtos == null || parkingSpaceDtos.size() < 1) {
@@ -257,19 +260,23 @@
Row row = sheet.createRow(0);
Cell cell0 = row.createCell(0);
cell0.setCellValue("璐圭敤鍚嶇О: 璇峰~鍐欑郴缁熶腑璐圭敤绫诲瀷锛屽鐗╀笟璐癸紝鎶奸噾绛� 锛沑n璁¤垂璧峰鏃堕棿: " +
- "璁¤垂璧峰鏃堕棿鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛沑n寤鸿处鏃堕棿: 寤鸿处鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛� \n 绫诲瀷锛氳〃鏄庢槸鍚堝悓 鎴垮眿 杩樻槸杞﹁締 鎴垮眿 1001 杞﹁締 2002 鍚堝悓 3003" +
- "\n娉ㄦ剰锛氭墍鏈夊崟鍏冩牸寮忎负鏂囨湰");
+ "璁¤垂璧峰鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛沑n璁¤垂缁撴潫鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛沑n" +
+ "寤鸿处鏃堕棿: 寤鸿处鏃堕棿锛屾牸寮忎负YYYY-MM-DD锛� \n 绫诲瀷锛氳〃鏄庢槸鍚堝悓 鎴垮眿 杩樻槸杞﹁締 鎴垮眿 1001 杞﹁締 2002 鍚堝悓 3003" +
+ "\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(0).setCellValue("鎴垮彿");
row.createCell(1).setCellValue("绫诲瀷");
row.createCell(2).setCellValue("璐圭敤椤笽D");
row.createCell(3).setCellValue("鏀惰垂椤圭洰");
row.createCell(4).setCellValue("寤鸿处鏃堕棿");
row.createCell(5).setCellValue("璁¤垂璧峰鏃堕棿");
+ row.createCell(6).setCellValue("璁¤垂缁撴潫鏃堕棿");
+ row.createCell(7).setCellValue("鎴垮眿鐘舵��");
+
RoomDto roomDto = new RoomDto();
roomDto.setCommunityId(paramIn.getString("communityId"));
@@ -298,12 +305,15 @@
row.createCell(3).setCellValue(tmpFeeConfigDto.getFeeName());
row.createCell(4).setCellValue("");
row.createCell(5).setCellValue("");
+ row.createCell(6).setCellValue("");
+ row.createCell(7).setCellValue(tmpRoomDto.getStateName());
roomIndex += 1;
}
}
CellRangeAddress region = new CellRangeAddress(0, 0, 0, 5);
sheet.addMergedRegion(region);
}
+
/**
* 鏌ヨ杞﹁締
@@ -477,6 +487,91 @@
sheet.addMergedRegion(region);
}
+
+ /**
+ * 瀵煎嚭鎶ヨ〃
+ *
+ * @param pd 鍓嶅彴鏁版嵁灏佽
+ * @return
+ * @throws Exception
+ */
+ @Override
+ public ResponseEntity<Object> exportCustomReportTableData(IPageData pd) throws Exception {
+ ComponentValidateResult result = this.validateStoreStaffCommunityRelationship(pd, restTemplate);
+
+ JSONObject paramIn = JSONObject.parseObject(pd.getReqData());
+
+ Assert.hasKeyAndValue(paramIn, "communityId", "璇锋眰涓湭鍖呭惈灏忓尯");
+ //Assert.hasKeyAndValue(paramIn, "floorIds", "璇锋眰涓湭鍖呭惈妤兼爧");
+
+ Workbook workbook = null; //宸ヤ綔绨�
+ //宸ヤ綔琛�
+ workbook = new XSSFWorkbook();
+
+ //鏌ヨ璧勪骇鍜岃垂鐢ㄩ」
+ getCustomReportTableData(paramIn, workbook, pd);
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ MultiValueMap headers = new HttpHeaders();
+ headers.add("content-type", "application/octet-stream;charset=UTF-8");
+ headers.add("Content-Disposition", "attachment;filename=customReportTableImport_" + 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);
+ }
+
+
+ private void getCustomReportTableData(JSONObject paramIn, Workbook workbook, IPageData pd) {
+ Sheet sheet = workbook.createSheet("鎶ヨ〃鏁版嵁");
+ String apiUrl = "reportCustomComponent.listReportCustomComponentData" + super.mapToUrlParam(paramIn);
+ ResponseEntity<String> responseEntity = this.callCenterService(restTemplate, pd, "", apiUrl, HttpMethod.GET);
+ if (responseEntity.getStatusCode() != HttpStatus.OK) {
+ return;
+ }
+ JSONObject paramOut = JSONObject.parseObject(responseEntity.getBody());
+ if (paramOut.getIntValue("code") != 0) {
+ return;
+ }
+ JSONArray th = paramOut.getJSONObject("data").getJSONArray("th");
+
+ if (th == null || th.size() < 1) {
+ return;
+ }
+
+ Row row = sheet.createRow(0);
+ for (int thIndex = 0; thIndex < th.size(); thIndex++) {
+ row.createCell(thIndex).setCellValue(th.getString(thIndex));
+ }
+
+ JSONArray td = paramOut.getJSONObject("data").getJSONArray("td");
+
+ if (td == null || td.size() < 1) {
+ return;
+ }
+ JSONObject tdObj = null;
+ for (int tdIndex = 0; tdIndex < td.size(); tdIndex++) {
+ row = sheet.createRow(tdIndex + 1);
+ tdObj = td.getJSONObject(tdIndex);
+ for (int thIndex = 0; thIndex < th.size(); thIndex++) {
+ row.createCell(thIndex).setCellValue(tdObj.getString(th.getString(thIndex)));
+ }
+ }
+ }
+
public RestTemplate getRestTemplate() {
return restTemplate;
}
--
Gitblit v1.8.0