From 4fafe2304ab5e3df321808f5120b29baf27c7eab Mon Sep 17 00:00:00 2001
From: chengf <cgf12138@163.com>
Date: 星期一, 25 八月 2025 16:09:52 +0800
Subject: [PATCH] 暂存0822

---
 service-job/src/main/java/com/java110/job/export/adapt/DataFeeManualCollectionAdapt.java |  899 +++++++++++++++++++++++++++++++++++++----------------------
 1 files changed, 563 insertions(+), 336 deletions(-)

diff --git a/service-job/src/main/java/com/java110/job/export/adapt/DataFeeManualCollectionAdapt.java b/service-job/src/main/java/com/java110/job/export/adapt/DataFeeManualCollectionAdapt.java
index a2211ce..9683c74 100644
--- a/service-job/src/main/java/com/java110/job/export/adapt/DataFeeManualCollectionAdapt.java
+++ b/service-job/src/main/java/com/java110/job/export/adapt/DataFeeManualCollectionAdapt.java
@@ -1,36 +1,32 @@
 package com.java110.job.export.adapt;
 
-import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.java110.core.smo.IComputeFeeSMO;
+import com.java110.dto.community.CommunityDto;
 import com.java110.dto.data.ExportDataDto;
 import com.java110.dto.fee.FeeDto;
-import com.java110.dto.fee.FeePrintSpecDto;
-import com.java110.dto.reportFee.ReportOweFeeDto;
 import com.java110.dto.room.RoomDto;
+import com.java110.intf.community.ICommunityV1InnerServiceSMO;
 import com.java110.intf.community.IRoomInnerServiceSMO;
 import com.java110.intf.community.IRoomV1InnerServiceSMO;
 import com.java110.intf.fee.IFeeInnerServiceSMO;
 import com.java110.intf.fee.IFeePrintSpecInnerServiceSMO;
-import com.java110.intf.report.IReportOweFeeInnerServiceSMO;
 import com.java110.job.export.IExportDataAdapt;
 import com.java110.utils.util.*;
-import com.java110.utils.util.DateUtil;
-import org.apache.poi.ss.usermodel.*;
-import org.apache.poi.ss.util.CellRangeAddress;
-import org.apache.poi.xssf.streaming.SXSSFWorkbook;
-import org.apache.poi.xssf.usermodel.XSSFClientAnchor;
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.apache.poi.xwpf.usermodel.XWPFDocument;
+import org.apache.poi.xwpf.usermodel.XWPFParagraph;
+import org.apache.poi.xwpf.usermodel.XWPFRun;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.ClassPathResource;
 import org.springframework.stereotype.Service;
 
-import java.awt.image.ImagingOpException;
 import java.io.IOException;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
+import java.io.InputStream;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
 
 
 /**
@@ -54,352 +50,576 @@
     @Autowired
     private IRoomV1InnerServiceSMO roomV1InnerServiceSMOImpl;
 
+    @Autowired
+    private ICommunityV1InnerServiceSMO communityV1InnerServiceSMO;
 
-    private static final int MAX_ROW = 100;
+    // 妯℃澘鏂囦欢璺緞锛堟斁鍦╮esources鐩綍涓嬶級
+    private static final String DOCX_TEMPLATE_PATH = "templates/fee_reminder_template.docx";
+
+//
+//    @Override
+//    public SXSSFWorkbook exportData(ExportDataDto exportDataDto) {
+//
+//        JSONObject reqJson = exportDataDto.getReqJson();
+//        Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖�");
+//        Assert.hasKeyAndValue(reqJson, "configIds", "鏈寘鍚垂鐢�");
+//        Assert.hasKeyAndValue(reqJson, "roomIds", "鏈寘鍚埧灞�");
+//
+//        String configIds = reqJson.getString("configIds");
+//
+//        String roomIds = reqJson.getString("roomIds");
+//
+//
+//        SXSSFWorkbook workbook = null;  //宸ヤ綔绨�
+//        workbook = new SXSSFWorkbook();
+//        workbook.setCompressTempFiles(false);
+//
+//        Sheet sheet = workbook.createSheet("鍌即鍗�");
+//        Drawing patriarch = sheet.createDrawingPatriarch();
+//
+//        FeePrintSpecDto feePrintSpecDto = new FeePrintSpecDto();
+//        feePrintSpecDto.setCommunityId(reqJson.getString("communityId"));
+//        feePrintSpecDto.setSpecCd("1010");
+//        feePrintSpecDto.setPage(1);
+//        feePrintSpecDto.setRow(1);
+//        List<FeePrintSpecDto> feePrintSpecDtos = feePrintSpecInnerServiceSMOImpl.queryFeePrintSpecs(feePrintSpecDto);
+//
+//        if (ListUtil.isNull(feePrintSpecDtos)) {
+//            feePrintSpecDto = null;
+//        } else {
+//            feePrintSpecDto = feePrintSpecDtos.get(0);
+//        }
+//        int line = 0;
+//        double totalPageHeight = 0;
+//
+//        RoomDto roomDto = new RoomDto();
+//        roomDto.setRoomIds(roomIds.split(","));
+//        roomDto.setCommunityId(reqJson.getString("communityId"));
+//        List<RoomDto> roomDtos = roomV1InnerServiceSMOImpl.queryRooms(roomDto);
+//
+//        if (ListUtil.isNull(roomDtos)) {
+//            throw new IllegalArgumentException("鏈寘鍚埧灞�");
+//        }
+//
+//        for (RoomDto roomDto1 : roomDtos) {
+//            getTmpRoomDtos(roomDto1, configIds, reqJson);
+//        }
+//        for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) {
+//            //todo 鏈夊彲鑳芥埧灞嬩笅娌℃湁娆犺垂
+//            if (ListUtil.isNull(roomDtos.get(roomIndex).getFees())) {
+//                continue;
+//            }
+//            Map<String, Object> info = generatorRoomOweFee(sheet, workbook, roomDtos.get(roomIndex), line, totalPageHeight, patriarch, feePrintSpecDto);
+//            line = Integer.parseInt(info.get("line").toString()) + 1;
+//            totalPageHeight = Double.parseDouble(info.get("totalPageHeight").toString());
+//        }
+//
+//
+//        return workbook;
+//    }
+//
+//    private Map<String, Object> generatorRoomOweFee(Sheet sheet, SXSSFWorkbook workbook, RoomDto roomDto, int line,
+//                                                    double totalPageHeight, Drawing patriarch, FeePrintSpecDto feePrintSpecDto
+//    ) {
+//        List<FeeDto> fees = roomDto.getFees();
+//        String[] feePrintRemarks = null;
+//        if (feePrintSpecDto != null) {
+//            feePrintRemarks = feePrintSpecDto.getContent().toLowerCase().replace("</br>", "").split("\n");
+//        } else {
+//            feePrintRemarks = new String[]{""};
+//        }
+//        int defaultRowHeight = 280;
+//        //璁$畻褰撳墠鍗曞瓙鐨勯珮搴�
+//        int titleHeight = defaultRowHeight * 3;
+//        int subTitleHeight = defaultRowHeight * 5;
+//        int totalHeight = titleHeight + subTitleHeight + defaultRowHeight * 3 + fees.size() * defaultRowHeight;
+//        //澶囨敞锛屽姞涓婃墦鍗伴厤缃唴瀹�
+//        if (feePrintRemarks != null && feePrintRemarks.length > 0) {
+//            totalHeight += (feePrintRemarks.length * defaultRowHeight);
+//        }
+//        double A4_lengthways_pageSize = defaultRowHeight * 57;//15960
+//
+//        //褰撳墠椤� 宸茬粡鍗犵敤鐨勯珮搴�
+//        double curPageHeight = totalPageHeight % A4_lengthways_pageSize;
+//        //褰撳墠椤电┖闂查珮搴�
+//        double freePageHeight = A4_lengthways_pageSize - curPageHeight;
+//        if (freePageHeight < totalHeight && curPageHeight != 0) {
+//            line += Math.ceil(freePageHeight / defaultRowHeight);
+//            totalPageHeight += freePageHeight;
+//        }
+//
+//        totalPageHeight += totalHeight;
+//
+//
+//        sheet.setColumnWidth(0, 8 * 256 * 2);
+//        sheet.setColumnWidth(1, 8 * 256 * 1);
+//        sheet.setColumnWidth(2, 8 * 256 * 1);
+//        sheet.setColumnWidth(3, 8 * 256 * 3);
+//        sheet.setColumnWidth(4, 8 * 256 * 1);
+//        sheet.setColumnWidth(5, 8 * 256 * 1);
+//        sheet.setColumnWidth(6, 8 * 256 * 1);
+//
+//        //閫氱敤鏍峰紡
+//        CellStyle cellStyle = workbook.createCellStyle();
+////璁剧疆鏍峰紡瀵硅薄锛岃繖閲屼粎璁剧疆浜嗚竟妗嗗睘鎬�
+//        cellStyle.setBorderBottom(BorderStyle.THIN); //涓嬭竟妗�
+//        cellStyle.setBorderLeft(BorderStyle.THIN);//宸﹁竟妗�
+//        cellStyle.setBorderTop(BorderStyle.THIN);//涓婅竟妗�
+//        cellStyle.setBorderRight(BorderStyle.THIN);//鍙宠竟妗�
+//        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+//
+//        // 鏍囬
+//        Row row = sheet.createRow(0 + line);
+//        Cell cell0 = row.createCell(0);
+//        //cell0.setCellValue("缂磋垂閫氱煡鍗晅otalHeight:" + totalHeight + "-totalPageHeight:" + totalPageHeight + "-curPageHeight:" + curPageHeight + "-freePageHeight:" + freePageHeight + "-line:" + line);
+//        if (feePrintSpecDto != null) {
+//            cell0.setCellValue(feePrintSpecDto.getPrintName() + "缂磋垂閫氱煡鍗�");
+//        } else {
+//            cell0.setCellValue("缂磋垂閫氱煡鍗�");
+//        }
+//        //鏍囬璁剧疆瀛椾綋
+//        Font font = workbook.createFont();
+//        font.setFontName("榛戜綋");
+//        font.setFontHeightInPoints((short) 26);
+//        CellStyle titleCellStyle = workbook.createCellStyle();
+//        titleCellStyle.setFont(font);
+//        titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
+//        cell0.setCellStyle(titleCellStyle);
+//        row.setHeight((short) (titleHeight));
+//
+//        //鍚堝苟鏍囬
+//        CellRangeAddress region = new CellRangeAddress(0 + line, 0 + line, 0, 6);
+//        sheet.addMergedRegion(region);
+//
+//
+//        //瀛愭爣棰�
+//        if (feePrintSpecDto != null) {
+//            XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) 0, 1 + line, (short) 1, 1 + line + 1);
+//            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);//璁剧疆鍥剧墖闅忓崟鍏冪Щ鍔ㄨ皟鏁村ぇ灏�
+//            try {
+//                String qrImg = ImageUtils.getBase64ByImgUrl(feePrintSpecDto.getQrImg()).replace("data:image/webp;base64,", "")
+//                        .replace("data:image/png;base64,", "")
+//                        .replace("data:image/jpeg;base64,", "");
+//                patriarch.createPicture(anchor, workbook.addPicture(Base64Convert.base64ToByte(qrImg), XSSFWorkbook.PICTURE_TYPE_JPEG));
+//            } catch (IOException e) {
+//                e.printStackTrace();
+//            }
+//        }
+//        CellStyle subTitleCellStyle = workbook.createCellStyle();
+//        subTitleCellStyle.setAlignment(HorizontalAlignment.CENTER);
+//        subTitleCellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);
+//        row = sheet.createRow(1 + line);
+//        Cell cell1 = row.createCell(1);
+//        if (!ListUtil.isNull(fees)) {
+//            cell1.setCellValue("涓氫富锛�" + fees.get(0).getOwnerName());
+//        } else {
+//            cell1.setCellValue("涓氫富锛氭棤");
+//        }
+//        cell1.setCellStyle(subTitleCellStyle);
+//
+//        Cell cell2 = row.createCell(2);
+//        cell2.setCellValue("鎴垮彿锛�" + roomDto.getFloorNum()
+//                + "-" + roomDto.getUnitNum()
+//                + "-" + roomDto.getRoomNum());
+//        cell2.setCellStyle(subTitleCellStyle);
+//
+//        row.createCell(3).setCellValue("");
+//        row.createCell(4).setCellValue("");
+//        Cell cell5 = row.createCell(5);
+//        cell5.setCellValue(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B));
+//        cell5.setCellStyle(subTitleCellStyle);
+//        CellStyle rowCellStyle = workbook.createCellStyle();
+//        rowCellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);
+//        row.setRowStyle(rowCellStyle);
+//
+//        //璁剧疆琛ㄥご涔嬩笂
+//        region = new CellRangeAddress(1 + line, 1 + line, 2, 3);
+//        sheet.addMergedRegion(region);
+//        region = new CellRangeAddress(1 + line, 1 + line, 5, 6);
+//        sheet.addMergedRegion(region);
+//        //瀛愭爣棰橀珮搴�
+//        row.setHeight((short) (subTitleHeight));
+//
+//
+//        row = sheet.createRow(2 + line);
+//        cell0 = row.createCell(0);
+//        cell0.setCellValue("鏀惰垂鍚嶇О");
+//        cell0.setCellStyle(cellStyle);
+//        cell1 = row.createCell(1);
+//        cell1.setCellValue("鏀惰垂鏍囧噯");
+//        cell1.setCellStyle(cellStyle);
+//        cell2 = row.createCell(2);
+//        cell2.setCellValue("鏁伴噺/闈㈢Н");
+//        cell2.setCellStyle(cellStyle);
+//        Cell cell3 = row.createCell(3);
+//        cell3.setCellValue("娆犺垂鏃堕棿");
+//        cell3.setCellStyle(cellStyle);
+//        Cell cell4 = row.createCell(4);
+//        cell4.setCellValue("搴旂即閲戦锛堝厓锛�");
+//        cell4.setCellStyle(cellStyle);
+//        cell5 = row.createCell(5);
+//        cell5.setCellValue("杩濈害閲戯紙鍏冿級");
+//        cell5.setCellStyle(cellStyle);
+//        Cell cell6 = row.createCell(6);
+//        cell6.setCellValue("澶囨敞");
+//        cell6.setCellStyle(cellStyle);
+//        row.setHeight((short) (defaultRowHeight));
+//
+//
+//        BigDecimal totalPrice = new BigDecimal(0);
+//        String startTime = "";
+//        String endTime = "";
+//        String squarePrice = "";
+//        for (int feeIndex = 0; feeIndex < fees.size(); feeIndex++) {
+//            JSONObject feeObj = BeanConvertUtil.beanCovertJson(fees.get(feeIndex));
+//            row = sheet.createRow(line + feeIndex + 3);
+//            startTime = DateUtil.getFormatTimeStringB(feeObj.getDate("endTime"));
+//            endTime = DateUtil.getFormatTimeStringB(feeObj.getDate("deadlineTime"));
+//            squarePrice = feeObj.getString("squarePrice");
+//
+//            //鍔ㄦ�佽垂鐢ㄥ崟浠峰氨鍘诲姩鎬佸崟浠�
+//            if (feeObj.containsKey("computingFormula") && "9009".equals(feeObj.getString("computingFormula"))) {
+//                squarePrice = feeObj.getString("mwPrice");
+//            }
+//
+//            cell0 = row.createCell(0);
+//            cell0.setCellValue(feeObj.getString("feeName"));
+//            cell0.setCellStyle(cellStyle);
+//            cell1 = row.createCell(1);
+//            cell1.setCellValue(squarePrice);
+//            cell1.setCellStyle(cellStyle);
+//            cell2 = row.createCell(2);
+//            //todo 涓嶈兘鍙睍绀洪潰绉�
+//            cell2.setCellValue(roomDto.getBuiltUpArea());
+//            if (!StringUtil.isEmpty(feeObj.getString("curDegrees"))) {
+//                BigDecimal degrees = new BigDecimal(feeObj.getString("curDegrees"))
+//                        .subtract(new BigDecimal(feeObj.getString("preDegrees")));
+//                cell2.setCellValue(degrees.doubleValue());
+//            }
+//
+//            cell2.setCellStyle(cellStyle);
+//            cell3 = row.createCell(3);
+//            if (feeObj.containsKey("curDegrees")) {
+//                cell3.setCellValue(startTime + "鑷�" + endTime + " " + feeObj.getString("preDegrees") + "鑷�" + feeObj.getString("curDegrees"));
+//            } else {
+//                cell3.setCellValue(startTime + "鑷�" + endTime);
+//            }
+//            cell3.setCellStyle(cellStyle);
+//            cell4 = row.createCell(4);
+//            cell4.setCellValue(feeObj.getString("feeTotalPrice"));
+//            cell4.setCellStyle(cellStyle);
+//            cell5 = row.createCell(5);
+//            cell5.setCellValue("0");
+//            cell5.setCellStyle(cellStyle);
+//            cell6 = row.createCell(6);
+//            cell6.setCellValue("");
+//            cell6.setCellStyle(cellStyle);
+//            row.setHeight((short) (defaultRowHeight));
+//            totalPrice = totalPrice.add(new BigDecimal(feeObj.getString("feeTotalPrice")));
+//        }
+//
+//        row = sheet.createRow(line + fees.size() + 3);
+//
+//        cell0 = row.createCell(0);
+//        cell0.setCellValue("鍚堣锛堝ぇ鍐欙級");
+//        cell0.setCellStyle(cellStyle);
+//        cell1 = row.createCell(1);
+//        cell1.setCellValue(Money2ChineseUtil.toChineseChar(totalPrice.doubleValue()));
+//        cell1.setCellStyle(cellStyle);
+//        cell2 = row.createCell(2);
+//        cell2.setCellValue("");
+//        cell2.setCellStyle(cellStyle);
+//        cell3 = row.createCell(3);
+//        cell3.setCellValue("");
+//        cell3.setCellStyle(cellStyle);
+//        cell4 = row.createCell(4);
+//        cell4.setCellValue(totalPrice.doubleValue());
+//        cell4.setCellStyle(cellStyle);
+//        cell5 = row.createCell(5);
+//        cell5.setCellValue("");
+//        cell5.setCellStyle(cellStyle);
+//        cell6 = row.createCell(6);
+//        cell6.setCellValue("");
+//        cell6.setCellStyle(cellStyle);
+//        row.setHeight((short) (defaultRowHeight));
+//
+//
+//        //鍚堣 鍚堝苟
+//        region = new CellRangeAddress(line + fees.size() + 3, line + fees.size() + 3, 1, 3);
+//        sheet.addMergedRegion(region);
+//
+//        if (feePrintRemarks != null && feePrintRemarks.length > 0) {
+//            for (int remarkIndex = 0; remarkIndex < feePrintRemarks.length; remarkIndex++) {
+//                row = sheet.createRow(line + fees.size() + 4 + remarkIndex);
+//                row.createCell(0).setCellValue(feePrintRemarks[remarkIndex]);
+//                row.setHeight((short) (defaultRowHeight));
+//            }
+//        }
+//        row = sheet.createRow(line + fees.size() + 4 + feePrintRemarks.length);
+//        row.createCell(0).setCellValue("");
+//        row.setHeight((short) (defaultRowHeight));
+//        Map info = new HashMap();
+//        info.put("line", line + fees.size() + 4 + feePrintRemarks.length);
+//        info.put("totalPageHeight", totalPageHeight);
+//        return info;
+//    }
+//
+//    private RoomDto getTmpRoomDtos(RoomDto tmpRoomDto, String configIds, JSONObject reqJson) {
+//        FeeDto tmpFeeDto = null;
+//        tmpFeeDto = new FeeDto();
+//       // tmpFeeDto.setArrearsEndTime(DateUtil.getCurrentDate());
+//        tmpFeeDto.setState(FeeDto.STATE_DOING);
+//        tmpFeeDto.setPayerObjId(tmpRoomDto.getRoomId());
+//        tmpFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
+//        tmpFeeDto.setConfigIds(configIds.split(","));
+//        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.querySimpleFees(tmpFeeDto);
+//
+//        if (ListUtil.isNull(feeDtos)) {
+//            return null;
+//        }
+//
+//        List<FeeDto> tmpFeeDtos = new ArrayList<>();
+//        for (FeeDto tempFeeDto : feeDtos) {
+//
+//            computeFeeSMOImpl.computeEveryOweFee(tempFeeDto, tmpRoomDto);//璁$畻娆犺垂閲戦
+//            //濡傛灉閲戦涓�0 灏辨帓闄�
+//            //if (tempFeeDto.getFeePrice() > 0 && tempFeeDto.getEndTime().getTime() <= DateUtil.getCurrentDate().getTime()) {
+//            // todo  鏍¢獙 鏃堕棿鑼冨洿
+//            if (!hasInTime(tempFeeDto, reqJson)) {
+//                continue;
+//            }
+//            if (tempFeeDto.getFeeTotalPrice() != 0) {
+//                tmpFeeDtos.add(tempFeeDto);
+//            }
+//        }
+//
+//        if (tmpFeeDtos.size() < 1) {
+//            return null;
+//        }
+//        tmpRoomDto.setFees(tmpFeeDtos);
+//        return tmpRoomDto;
+//    }
+//
+//    private boolean hasInTime(FeeDto tempFeeDto, JSONObject reqJson) {
+//        if (!reqJson.containsKey("startTime") || !reqJson.containsKey("endTime")) {
+//            return true;
+//        }
+//
+//        String startTime = reqJson.getString("startTime");
+//        String endTime = reqJson.getString("endTime");
+//
+//        if (StringUtil.isEmpty(startTime) || StringUtil.isEmpty(endTime)) {
+//            return true;
+//        }
+//        if (tempFeeDto.getDeadlineTime() == null) {
+//            return true;
+//        }
+//
+//        if (tempFeeDto.getEndTime().before(DateUtil.getDateFromStringB(startTime))
+//                && tempFeeDto.getDeadlineTime().after(DateUtil.getDateFromStringB(endTime))
+//        ) {
+//            return true;
+//        }
+//
+//        return false;
+//    }
+
 
     @Override
-    public SXSSFWorkbook exportData(ExportDataDto exportDataDto) {
+    public Object exportData(ExportDataDto exportDataDto) throws ParseException {
+        try {
+            // 1. 鑾峰彇璇锋眰鏁版嵁
+            JSONObject reqJson = exportDataDto.getReqJson();
+            validateParams(reqJson); // 楠岃瘉蹇呰鍙傛暟
 
-        JSONObject reqJson = exportDataDto.getReqJson();
+            String configId = reqJson.getString("configId");
+            String roomId = reqJson.getString("roomId");
+
+            // 2. 鏌ヨ鎴垮眿淇℃伅
+            RoomDto roomDto = getRoomInfo(roomId, reqJson.getString("communityId"));
+            if (roomDto == null) {
+                throw new IllegalArgumentException("鏈壘鍒版埧灞嬫暟鎹�");
+            }
+
+            // 3. 澶勭悊璐圭敤鏁版嵁
+            getTmpRoomDtos(roomDto, configId, reqJson);
+            if (ListUtil.isNull(roomDto.getFees())) {
+                throw new IllegalArgumentException("鏈壘鍒拌鎴垮眿鐨勮垂鐢ㄦ暟鎹�");
+            }
+            // 鍑嗗鏇挎崲鐨勫崰浣嶇鏁版嵁
+            Map<String, String> placeholders = preparePlaceholders(roomDto, reqJson);
+
+            // 璇诲彇Docx妯℃澘骞舵浛鎹㈠崰浣嶇
+            XWPFDocument doc = renderDocxTemplate(placeholders);
+            return doc;
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new RuntimeException("鐢熸垚鍌閫氱煡澶辫触: " + e.getMessage());
+        }
+    }
+
+    /**
+     * 楠岃瘉蹇呰鍙傛暟
+     */
+    private void validateParams(JSONObject reqJson) {
         Assert.hasKeyAndValue(reqJson, "communityId", "鏈寘鍚皬鍖�");
         Assert.hasKeyAndValue(reqJson, "configIds", "鏈寘鍚垂鐢�");
-        Assert.hasKeyAndValue(reqJson, "roomIds", "鏈寘鍚埧灞�");
+        Assert.hasKeyAndValue(reqJson, "roomId", "鏈寘鍚埧灞�");
+    }
 
-        String configIds = reqJson.getString("configIds");
-
-        String roomIds = reqJson.getString("roomIds");
-
-
-        SXSSFWorkbook workbook = null;  //宸ヤ綔绨�
-        workbook = new SXSSFWorkbook();
-        workbook.setCompressTempFiles(false);
-
-        Sheet sheet = workbook.createSheet("鍌即鍗�");
-        Drawing patriarch = sheet.createDrawingPatriarch();
-
-        FeePrintSpecDto feePrintSpecDto = new FeePrintSpecDto();
-        feePrintSpecDto.setCommunityId(reqJson.getString("communityId"));
-        feePrintSpecDto.setSpecCd("1010");
-        feePrintSpecDto.setPage(1);
-        feePrintSpecDto.setRow(1);
-        List<FeePrintSpecDto> feePrintSpecDtos = feePrintSpecInnerServiceSMOImpl.queryFeePrintSpecs(feePrintSpecDto);
-
-        if (ListUtil.isNull(feePrintSpecDtos)) {
-            feePrintSpecDto = null;
-        } else {
-            feePrintSpecDto = feePrintSpecDtos.get(0);
-        }
-        int line = 0;
-        double totalPageHeight = 0;
-
+    /**
+     * 鑾峰彇鎴垮眿淇℃伅
+     */
+    private RoomDto getRoomInfo(String roomId, String communityId) {
         RoomDto roomDto = new RoomDto();
-        roomDto.setRoomIds(roomIds.split(","));
-        roomDto.setCommunityId(reqJson.getString("communityId"));
+        roomDto.setRoomIds(roomId.split(","));
+        roomDto.setCommunityId(communityId);
         List<RoomDto> roomDtos = roomV1InnerServiceSMOImpl.queryRooms(roomDto);
-
-        if (ListUtil.isNull(roomDtos)) {
-            throw new IllegalArgumentException("鏈寘鍚埧灞�");
-        }
-
-        for (RoomDto roomDto1 : roomDtos) {
-            getTmpRoomDtos(roomDto1, configIds, reqJson);
-        }
-        for (int roomIndex = 0; roomIndex < roomDtos.size(); roomIndex++) {
-            //todo 鏈夊彲鑳芥埧灞嬩笅娌℃湁娆犺垂
-            if (ListUtil.isNull(roomDtos.get(roomIndex).getFees())) {
-                continue;
-            }
-            Map<String, Object> info = generatorRoomOweFee(sheet, workbook, roomDtos.get(roomIndex), line, totalPageHeight, patriarch, feePrintSpecDto);
-            line = Integer.parseInt(info.get("line").toString()) + 1;
-            totalPageHeight = Double.parseDouble(info.get("totalPageHeight").toString());
-        }
-
-
-        return workbook;
+        return ListUtil.isNull(roomDtos) ? null : roomDtos.get(0);
     }
 
-    private Map<String, Object> generatorRoomOweFee(Sheet sheet, SXSSFWorkbook workbook, RoomDto roomDto, int line,
-                                                    double totalPageHeight, Drawing patriarch, FeePrintSpecDto feePrintSpecDto
-    ) {
-        List<FeeDto> fees = roomDto.getFees();
-        String[] feePrintRemarks = null;
-        if (feePrintSpecDto != null) {
-            feePrintRemarks = feePrintSpecDto.getContent().toLowerCase().replace("</br>", "").split("\n");
-        } else {
-            feePrintRemarks = new String[]{""};
-        }
-        int defaultRowHeight = 280;
-        //璁$畻褰撳墠鍗曞瓙鐨勯珮搴�
-        int titleHeight = defaultRowHeight * 3;
-        int subTitleHeight = defaultRowHeight * 5;
-        int totalHeight = titleHeight + subTitleHeight + defaultRowHeight * 3 + fees.size() * defaultRowHeight;
-        //澶囨敞锛屽姞涓婃墦鍗伴厤缃唴瀹�
-        if (feePrintRemarks != null && feePrintRemarks.length > 0) {
-            totalHeight += (feePrintRemarks.length * defaultRowHeight);
-        }
-        double A4_lengthways_pageSize = defaultRowHeight * 57;//15960
+    /**
+     * 鍑嗗鍗犱綅绗︽暟鎹紙鏂囨湰鏇挎崲锛�
+     */
+    private Map<String, String> preparePlaceholders(RoomDto roomDto, JSONObject reqJson) {
+        Map<String, String> placeholders = new HashMap<>();
 
-        //褰撳墠椤� 宸茬粡鍗犵敤鐨勯珮搴�
-        double curPageHeight = totalPageHeight % A4_lengthways_pageSize;
-        //褰撳墠椤电┖闂查珮搴�
-        double freePageHeight = A4_lengthways_pageSize - curPageHeight;
-        if (freePageHeight < totalHeight && curPageHeight != 0) {
-            line += Math.ceil(freePageHeight / defaultRowHeight);
-            totalPageHeight += freePageHeight;
-        }
+        CommunityDto communityDto = new CommunityDto();
+        communityDto.setCommunityId(roomDto.getCommunityId());
+        List<CommunityDto> communityDtos = communityV1InnerServiceSMO.queryCommunitys(communityDto);
 
-        totalPageHeight += totalHeight;
+        placeholders.put("area", communityDtos.get(0).getNearbyLandmarks());
+        // 鎴垮眿淇℃伅
+        placeholders.put("buildingNum", roomDto.getUnitNum() != null ? roomDto.getUnitNum() : "");
+        placeholders.put("roomNum", roomDto.getRoomNum() != null ? roomDto.getRoomNum() : "");
 
+        // 涓氫富涓庤垂鐢ㄤ俊鎭�
+        FeeDto fee = roomDto.getFees().get(0);
+        placeholders.put("ownerName", fee.getOwnerName() != null ? fee.getOwnerName() : "");
+        placeholders.put("price", String.valueOf(fee.getFeeTotalPrice()));
 
-        sheet.setColumnWidth(0, 8 * 256 * 2);
-        sheet.setColumnWidth(1, 8 * 256 * 1);
-        sheet.setColumnWidth(2, 8 * 256 * 1);
-        sheet.setColumnWidth(3, 8 * 256 * 3);
-        sheet.setColumnWidth(4, 8 * 256 * 1);
-        sheet.setColumnWidth(5, 8 * 256 * 1);
-        sheet.setColumnWidth(6, 8 * 256 * 1);
+        JSONObject feeObj = BeanConvertUtil.beanCovertJson(fee);
+        String startTime = DateUtil.getFormatTimeStringB(feeObj.getDate("endTime"));
+        String endTime = DateUtil.getFormatTimeStringB(feeObj.getDate("deadlineTime"));
 
-        //閫氱敤鏍峰紡
-        CellStyle cellStyle = workbook.createCellStyle();
-//璁剧疆鏍峰紡瀵硅薄锛岃繖閲屼粎璁剧疆浜嗚竟妗嗗睘鎬�
-        cellStyle.setBorderBottom(BorderStyle.THIN); //涓嬭竟妗�
-        cellStyle.setBorderLeft(BorderStyle.THIN);//宸﹁竟妗�
-        cellStyle.setBorderTop(BorderStyle.THIN);//涓婅竟妗�
-        cellStyle.setBorderRight(BorderStyle.THIN);//鍙宠竟妗�
-        cellStyle.setAlignment(HorizontalAlignment.CENTER);
+        LocalDate startDate = LocalDate.parse(startTime, DateTimeFormatter.ISO_LOCAL_DATE);
+        LocalDate endDate = LocalDate.parse(endTime, DateTimeFormatter.ISO_LOCAL_DATE);
+        // 鏃堕棿淇℃伅
+        placeholders.put("startYear", String.valueOf(startDate.getYear()));
+        placeholders.put("startMonth", startDate.getMonthValue() >= 10 ? String.valueOf(startDate.getMonthValue()) : ("0" + startDate.getMonthValue()));
+        placeholders.put("endYear", String.valueOf(endDate.getYear()));
+        placeholders.put("endMonth", endDate.getMonthValue() >= 10 ? String.valueOf(endDate.getMonthValue()) : ("0" + endDate.getMonthValue()));
 
-        // 鏍囬
-        Row row = sheet.createRow(0 + line);
-        Cell cell0 = row.createCell(0);
-        //cell0.setCellValue("缂磋垂閫氱煡鍗晅otalHeight:" + totalHeight + "-totalPageHeight:" + totalPageHeight + "-curPageHeight:" + curPageHeight + "-freePageHeight:" + freePageHeight + "-line:" + line);
-        if (feePrintSpecDto != null) {
-            cell0.setCellValue(feePrintSpecDto.getPrintName() + "缂磋垂閫氱煡鍗�");
-        } else {
-            cell0.setCellValue("缂磋垂閫氱煡鍗�");
-        }
-        //鏍囬璁剧疆瀛椾綋
-        Font font = workbook.createFont();
-        font.setFontName("榛戜綋");
-        font.setFontHeightInPoints((short) 26);
-        CellStyle titleCellStyle = workbook.createCellStyle();
-        titleCellStyle.setFont(font);
-        titleCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        cell0.setCellStyle(titleCellStyle);
-        row.setHeight((short) (titleHeight));
+        // 褰撳墠鏃ユ湡
+        Date currentDate = new Date();
+        SimpleDateFormat yearFormat = new SimpleDateFormat("yyyy");
+        SimpleDateFormat monthFormat = new SimpleDateFormat("MM");
+        SimpleDateFormat dayFormat = new SimpleDateFormat("dd");
+        placeholders.put("a", yearFormat.format(currentDate));
+        placeholders.put("b", monthFormat.format(currentDate));
+        placeholders.put("c", dayFormat.format(currentDate));
 
-        //鍚堝苟鏍囬
-        CellRangeAddress region = new CellRangeAddress(0 + line, 0 + line, 0, 6);
-        sheet.addMergedRegion(region);
-
-
-        //瀛愭爣棰�
-        if (feePrintSpecDto != null) {
-            XSSFClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) 0, 1 + line, (short) 1, 1 + line + 1);
-            anchor.setAnchorType(ClientAnchor.AnchorType.MOVE_AND_RESIZE);//璁剧疆鍥剧墖闅忓崟鍏冪Щ鍔ㄨ皟鏁村ぇ灏�
-            try {
-                String qrImg = ImageUtils.getBase64ByImgUrl(feePrintSpecDto.getQrImg()).replace("data:image/webp;base64,", "")
-                        .replace("data:image/png;base64,", "")
-                        .replace("data:image/jpeg;base64,", "");
-                patriarch.createPicture(anchor, workbook.addPicture(Base64Convert.base64ToByte(qrImg), XSSFWorkbook.PICTURE_TYPE_JPEG));
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-        }
-        CellStyle subTitleCellStyle = workbook.createCellStyle();
-        subTitleCellStyle.setAlignment(HorizontalAlignment.CENTER);
-        subTitleCellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);
-        row = sheet.createRow(1 + line);
-        Cell cell1 = row.createCell(1);
-        if (!ListUtil.isNull(fees)) {
-            cell1.setCellValue("涓氫富锛�" + fees.get(0).getOwnerName());
-        } else {
-            cell1.setCellValue("涓氫富锛氭棤");
-        }
-        cell1.setCellStyle(subTitleCellStyle);
-
-        Cell cell2 = row.createCell(2);
-        cell2.setCellValue("鎴垮彿锛�" + roomDto.getFloorNum()
-                + "-" + roomDto.getUnitNum()
-                + "-" + roomDto.getRoomNum());
-        cell2.setCellStyle(subTitleCellStyle);
-
-        row.createCell(3).setCellValue("");
-        row.createCell(4).setCellValue("");
-        Cell cell5 = row.createCell(5);
-        cell5.setCellValue(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_B));
-        cell5.setCellStyle(subTitleCellStyle);
-        CellStyle rowCellStyle = workbook.createCellStyle();
-        rowCellStyle.setVerticalAlignment(VerticalAlignment.BOTTOM);
-        row.setRowStyle(rowCellStyle);
-
-        //璁剧疆琛ㄥご涔嬩笂
-        region = new CellRangeAddress(1 + line, 1 + line, 2, 3);
-        sheet.addMergedRegion(region);
-        region = new CellRangeAddress(1 + line, 1 + line, 5, 6);
-        sheet.addMergedRegion(region);
-        //瀛愭爣棰橀珮搴�
-        row.setHeight((short) (subTitleHeight));
-
-
-        row = sheet.createRow(2 + line);
-        cell0 = row.createCell(0);
-        cell0.setCellValue("鏀惰垂鍚嶇О");
-        cell0.setCellStyle(cellStyle);
-        cell1 = row.createCell(1);
-        cell1.setCellValue("鏀惰垂鏍囧噯");
-        cell1.setCellStyle(cellStyle);
-        cell2 = row.createCell(2);
-        cell2.setCellValue("鏁伴噺/闈㈢Н");
-        cell2.setCellStyle(cellStyle);
-        Cell cell3 = row.createCell(3);
-        cell3.setCellValue("娆犺垂鏃堕棿");
-        cell3.setCellStyle(cellStyle);
-        Cell cell4 = row.createCell(4);
-        cell4.setCellValue("搴旂即閲戦锛堝厓锛�");
-        cell4.setCellStyle(cellStyle);
-        cell5 = row.createCell(5);
-        cell5.setCellValue("杩濈害閲戯紙鍏冿級");
-        cell5.setCellStyle(cellStyle);
-        Cell cell6 = row.createCell(6);
-        cell6.setCellValue("澶囨敞");
-        cell6.setCellStyle(cellStyle);
-        row.setHeight((short) (defaultRowHeight));
-
-
-        BigDecimal totalPrice = new BigDecimal(0);
-        String startTime = "";
-        String endTime = "";
-        String squarePrice = "";
-        for (int feeIndex = 0; feeIndex < fees.size(); feeIndex++) {
-            JSONObject feeObj = BeanConvertUtil.beanCovertJson(fees.get(feeIndex));
-            row = sheet.createRow(line + feeIndex + 3);
-            startTime = DateUtil.getFormatTimeStringB(feeObj.getDate("endTime"));
-            endTime = DateUtil.getFormatTimeStringB(feeObj.getDate("deadlineTime"));
-            squarePrice = feeObj.getString("squarePrice");
-
-            //鍔ㄦ�佽垂鐢ㄥ崟浠峰氨鍘诲姩鎬佸崟浠�
-            if (feeObj.containsKey("computingFormula") && "9009".equals(feeObj.getString("computingFormula"))) {
-                squarePrice = feeObj.getString("mwPrice");
-            }
-
-            cell0 = row.createCell(0);
-            cell0.setCellValue(feeObj.getString("feeName"));
-            cell0.setCellStyle(cellStyle);
-            cell1 = row.createCell(1);
-            cell1.setCellValue(squarePrice);
-            cell1.setCellStyle(cellStyle);
-            cell2 = row.createCell(2);
-            //todo 涓嶈兘鍙睍绀洪潰绉�
-            cell2.setCellValue(roomDto.getBuiltUpArea());
-            if (!StringUtil.isEmpty(feeObj.getString("curDegrees"))) {
-                BigDecimal degrees = new BigDecimal(feeObj.getString("curDegrees"))
-                        .subtract(new BigDecimal(feeObj.getString("preDegrees")));
-                cell2.setCellValue(degrees.doubleValue());
-            }
-
-            cell2.setCellStyle(cellStyle);
-            cell3 = row.createCell(3);
-            if (feeObj.containsKey("curDegrees")) {
-                cell3.setCellValue(startTime + "鑷�" + endTime + " " + feeObj.getString("preDegrees") + "鑷�" + feeObj.getString("curDegrees"));
-            } else {
-                cell3.setCellValue(startTime + "鑷�" + endTime);
-            }
-            cell3.setCellStyle(cellStyle);
-            cell4 = row.createCell(4);
-            cell4.setCellValue(feeObj.getString("feeTotalPrice"));
-            cell4.setCellStyle(cellStyle);
-            cell5 = row.createCell(5);
-            cell5.setCellValue("0");
-            cell5.setCellStyle(cellStyle);
-            cell6 = row.createCell(6);
-            cell6.setCellValue("");
-            cell6.setCellStyle(cellStyle);
-            row.setHeight((short) (defaultRowHeight));
-            totalPrice = totalPrice.add(new BigDecimal(feeObj.getString("feeTotalPrice")));
-        }
-
-        row = sheet.createRow(line + fees.size() + 3);
-
-        cell0 = row.createCell(0);
-        cell0.setCellValue("鍚堣锛堝ぇ鍐欙級");
-        cell0.setCellStyle(cellStyle);
-        cell1 = row.createCell(1);
-        cell1.setCellValue(Money2ChineseUtil.toChineseChar(totalPrice.doubleValue()));
-        cell1.setCellStyle(cellStyle);
-        cell2 = row.createCell(2);
-        cell2.setCellValue("");
-        cell2.setCellStyle(cellStyle);
-        cell3 = row.createCell(3);
-        cell3.setCellValue("");
-        cell3.setCellStyle(cellStyle);
-        cell4 = row.createCell(4);
-        cell4.setCellValue(totalPrice.doubleValue());
-        cell4.setCellStyle(cellStyle);
-        cell5 = row.createCell(5);
-        cell5.setCellValue("");
-        cell5.setCellStyle(cellStyle);
-        cell6 = row.createCell(6);
-        cell6.setCellValue("");
-        cell6.setCellStyle(cellStyle);
-        row.setHeight((short) (defaultRowHeight));
-
-
-        //鍚堣 鍚堝苟
-        region = new CellRangeAddress(line + fees.size() + 3, line + fees.size() + 3, 1, 3);
-        sheet.addMergedRegion(region);
-
-        if (feePrintRemarks != null && feePrintRemarks.length > 0) {
-            for (int remarkIndex = 0; remarkIndex < feePrintRemarks.length; remarkIndex++) {
-                row = sheet.createRow(line + fees.size() + 4 + remarkIndex);
-                row.createCell(0).setCellValue(feePrintRemarks[remarkIndex]);
-                row.setHeight((short) (defaultRowHeight));
-            }
-        }
-        row = sheet.createRow(line + fees.size() + 4 + feePrintRemarks.length);
-        row.createCell(0).setCellValue("");
-        row.setHeight((short) (defaultRowHeight));
-        Map info = new HashMap();
-        info.put("line", line + fees.size() + 4 + feePrintRemarks.length);
-        info.put("totalPageHeight", totalPageHeight);
-        return info;
+        return placeholders;
     }
 
-    private RoomDto getTmpRoomDtos(RoomDto tmpRoomDto, String configIds, JSONObject reqJson) {
-        FeeDto tmpFeeDto = null;
-        tmpFeeDto = new FeeDto();
-       // tmpFeeDto.setArrearsEndTime(DateUtil.getCurrentDate());
+    /**
+     * 璇诲彇Docx妯℃澘骞舵浛鎹㈠崰浣嶇
+     */
+    private XWPFDocument renderDocxTemplate(Map<String, String> placeholders) throws IOException {
+        // 1. 璇诲彇妯℃澘鏂囦欢
+        ClassPathResource resource = new ClassPathResource(DOCX_TEMPLATE_PATH);
+        try (InputStream is = resource.getInputStream()) {
+            XWPFDocument doc = new XWPFDocument(is);
+
+            // 2. 鏇挎崲鏂囨湰鍗犱綅绗�
+            replaceTextPlaceholders(doc, placeholders);
+
+            return doc;
+        }
+    }
+
+    /**
+     * 鏇挎崲鏂囨湰鍗犱綅绗︼紙濡� ${ownerName}锛�
+     */
+    private void replaceTextPlaceholders(XWPFDocument doc, Map<String, String> placeholders) {
+        // 澶勭悊娈佃惤涓殑鍗犱綅绗�
+        for (XWPFParagraph para : doc.getParagraphs()) {
+            for (XWPFRun run : para.getRuns()) {
+                String text = run.getText(0);
+                if (text == null) { // 鏂囨湰鏈韩涓簄ull鏃惰烦杩�
+                    continue;
+                }
+                String replacedText = text; // 涓存椂瀛樺偍鏇挎崲鍚庣殑鏂囨湰
+                for (Map.Entry<String, String> entry : placeholders.entrySet()) {
+                    String placeholder = "${" + entry.getKey() + "}";
+                    // 鍏抽敭淇锛氬鏋滄浛鎹㈠�间负null锛岀敤绌哄瓧绗︿覆鏇夸唬
+                    String replacement = entry.getValue() != null ? entry.getValue() : "";
+                    // 鏇挎崲鍗犱綅绗�
+                    if (replacedText.contains(placeholder)) {
+                        replacedText = replacedText.replace(placeholder, replacement);
+                    }
+                }
+                // 鍙湁鏂囨湰鍙樺寲鏃舵墠鏇存柊锛岄伩鍏嶆棤鏁堟搷浣�
+                if (!replacedText.equals(text)) {
+                    run.setText(replacedText, 0);
+                }
+            }
+        }
+
+        // 澶勭悊琛ㄦ牸涓殑鍗犱綅绗︼紙鍚屾牱澶勭悊null鍊硷級
+        doc.getTables().forEach(table -> {
+            table.getRows().forEach(row -> {
+                row.getTableCells().forEach(cell -> {
+                    cell.getParagraphs().forEach(para -> {
+                        para.getRuns().forEach(run -> {
+                            String text = run.getText(0);
+                            if (text == null) {
+                                return;
+                            }
+                            String replacedText = text;
+                            for (Map.Entry<String, String> entry : placeholders.entrySet()) {
+                                String placeholder = "${" + entry.getKey() + "}";
+                                String replacement = entry.getValue() != null ? entry.getValue() : ""; // 澶勭悊null
+                                if (replacedText.contains(placeholder)) {
+                                    replacedText = replacedText.replace(placeholder, replacement);
+                                }
+                            }
+                            if (!replacedText.equals(text)) {
+                                run.setText(replacedText, 0);
+                            }
+                        });
+                    });
+                });
+            });
+        });
+    }
+
+    /**
+     * 澶勭悊鎴垮眿璐圭敤鏁版嵁
+     */
+    private RoomDto getTmpRoomDtos(RoomDto tmpRoomDto, String configId, JSONObject reqJson) {
+        FeeDto tmpFeeDto = new FeeDto();
         tmpFeeDto.setState(FeeDto.STATE_DOING);
         tmpFeeDto.setPayerObjId(tmpRoomDto.getRoomId());
         tmpFeeDto.setPayerObjType(FeeDto.PAYER_OBJ_TYPE_ROOM);
-        tmpFeeDto.setConfigIds(configIds.split(","));
+        tmpFeeDto.setConfigId(configId);
         List<FeeDto> feeDtos = feeInnerServiceSMOImpl.querySimpleFees(tmpFeeDto);
-
-        if (ListUtil.isNull(feeDtos)) {
-            return null;
-        }
-
         List<FeeDto> tmpFeeDtos = new ArrayList<>();
-        for (FeeDto tempFeeDto : feeDtos) {
-
-            computeFeeSMOImpl.computeEveryOweFee(tempFeeDto, tmpRoomDto);//璁$畻娆犺垂閲戦
-            //濡傛灉閲戦涓�0 灏辨帓闄�
-            //if (tempFeeDto.getFeePrice() > 0 && tempFeeDto.getEndTime().getTime() <= DateUtil.getCurrentDate().getTime()) {
-            // todo  鏍¢獙 鏃堕棿鑼冨洿
-            if (!hasInTime(tempFeeDto, reqJson)) {
-                continue;
+        if (!ListUtil.isNull(feeDtos)) {
+            for (FeeDto tempFeeDto : feeDtos) {
+                computeFeeSMOImpl.computeEveryOweFee(tempFeeDto, tmpRoomDto);
+                if (hasInTime(tempFeeDto, reqJson) && tempFeeDto.getFeeTotalPrice() != 0) {
+                    tmpFeeDtos.add(tempFeeDto);
+                }
             }
-            if (tempFeeDto.getFeeTotalPrice() != 0) {
-                tmpFeeDtos.add(tempFeeDto);
-            }
-        }
-
-        if (tmpFeeDtos.size() < 1) {
-            return null;
         }
         tmpRoomDto.setFees(tmpFeeDtos);
         return tmpRoomDto;
     }
 
+    /**
+     * 楠岃瘉璐圭敤鏄惁鍦ㄦ椂闂磋寖鍥村唴
+     */
     private boolean hasInTime(FeeDto tempFeeDto, JSONObject reqJson) {
         if (!reqJson.containsKey("startTime") || !reqJson.containsKey("endTime")) {
             return true;
@@ -411,16 +631,23 @@
         if (StringUtil.isEmpty(startTime) || StringUtil.isEmpty(endTime)) {
             return true;
         }
+
         if (tempFeeDto.getDeadlineTime() == null) {
             return true;
         }
 
-        if (tempFeeDto.getEndTime().before(DateUtil.getDateFromStringB(startTime))
-                && tempFeeDto.getDeadlineTime().after(DateUtil.getDateFromStringB(endTime))
-        ) {
-            return true;
+        try {
+            Date startDate = DateUtil.getDateFromStringB(startTime);
+            Date endDate = DateUtil.getDateFromStringB(endTime);
+            return tempFeeDto.getEndTime().before(startDate) && tempFeeDto.getDeadlineTime().after(endDate);
+        } catch (Exception e) {
+            e.printStackTrace();
+            return false;
         }
+    }
 
-        return false;
+    @Override
+    public String getFileType() {
+        return "docx"; // 鏄庣‘鐢熸垚docx鏍煎紡
     }
 }

--
Gitblit v1.8.0