chengf
2025-09-15 ebf6117ccea680eae81a91f2fa355ce3a76eb621
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
package com.java110.job.export.adapt;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.data.ExportDataDto;
import com.java110.dto.room.ApplyRoomDiscountDto;
import com.java110.intf.fee.IApplyRoomDiscountInnerServiceSMO;
import com.java110.intf.fee.IReportFeeInnerServiceSMO;
import com.java110.job.export.IExportDataAdapt;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.FeeQueryParams;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.Date;
import java.util.List;
import java.util.Map;
 
/**
 * 优惠申请导出
 *
 * @author fqz
 * @date 2023-12-14 13:52
 */
@Service(value = "whiteOrderReport")
public class WhiteOrderReportFeeAdapt implements IExportDataAdapt {
 
    @Autowired
    private IReportFeeInnerServiceSMO reportFeeInnerServiceSMOImpl;
 
    @Autowired
    private IApplyRoomDiscountInnerServiceSMO applyRoomDiscountInnerServiceSMOImpl;
 
    private static final int MAX_ROW = 60000;
 
    @Override
    public SXSSFWorkbook exportData(ExportDataDto exportDataDto) {
        SXSSFWorkbook workbook = null;  //工作簿
        //工作表
        workbook = new SXSSFWorkbook();
        workbook.setCompressTempFiles(false);
        Sheet sheet = workbook.createSheet("白单流水报表");
        Row row = sheet.createRow(0);
 
        row.createCell(0).setCellValue("RowNo");
        row.createCell(1).setCellValue("房屋");
        row.createCell(2).setCellValue("序号");
        row.createCell(3).setCellValue("收费日期");
        row.createCell(4).setCellValue("发票、收据号码");
        row.createCell(5).setCellValue("业主地址");
        row.createCell(6).setCellValue("门幢室号");
        row.createCell(7).setCellValue("归属年份(年)");
        row.createCell(8).setCellValue("收费区间");
        row.createCell(9).setCellValue("收费内容");
        row.createCell(10).setCellValue("收费金额");
        row.createCell(11).setCellValue("收费人");
        row.createCell(12).setCellValue("银行解款日期");
        row.createCell(13).setCellValue("银行解款人");
        row.createCell(14).setCellValue("拆分后银行解款金额");
        row.createCell(15).setCellValue("银行解款金额");
        row.createCell(16).setCellValue("核对金额");
        row.createCell(17).setCellValue("白单存档编号");
        row.createCell(18).setCellValue("张数");
        row.createCell(19).setCellValue("财务收账人");
        row.createCell(20).setCellValue("输入时间");
        row.createCell(21).setCellValue("输入人员");
        row.createCell(22).setCellValue("收款年/月");
        row.createCell(23).setCellValue("收款年度");
        row.createCell(24).setCellValue("白单存档单号");
        row.createCell(25).setCellValue("车牌号");
        row.createCell(26).setCellValue("待解决问题");
        row.createCell(27).setCellValue("22项分类");
        row.createCell(28).setCellValue("财务核对");
        row.createCell(29).setCellValue("车位号");
        JSONObject reqJson = exportDataDto.getReqJson();
        //查询数据
        getApplyRoomDiscount(sheet, reqJson);
        return workbook;
    }
 
    private void getApplyRoomDiscount(Sheet sheet, JSONObject reqJson) {
        FeeQueryParams feeQueryParams = BeanConvertUtil.covertBean(reqJson, FeeQueryParams.class);
        feeQueryParams.setPage(1);
        feeQueryParams.setRow(MAX_ROW);
        feeQueryParams.setCommunityId(reqJson.getString("communityId"));
        feeQueryParams.setEndYear(new Date().getYear());
        feeQueryParams.setStartYear(2020);
        List<Map> applyRoomDiscounts = reportFeeInnerServiceSMOImpl.repostPaidInFeeByWhiteOrder(feeQueryParams);
        appendData(applyRoomDiscounts, sheet);
    }
 
    private void appendData(List<Map> applyRoomDiscounts, Sheet sheet) {
        Row row = null;
        for (int index = 0; index < applyRoomDiscounts.size(); index++) {
            row = sheet.createRow(index + 1);
            Map applyRoomDiscountDto = applyRoomDiscounts.get(index);
            row.createCell(0).setCellValue(applyRoomDiscountDto.get("row2") != null ? applyRoomDiscountDto.get("row1").toString() : "");
            row.createCell(1).setCellValue(applyRoomDiscountDto.get("row2") != null ? applyRoomDiscountDto.get("row2").toString() : "");
            row.createCell(2).setCellValue(applyRoomDiscountDto.get("row3") != null ? applyRoomDiscountDto.get("row3").toString() : "");
            row.createCell(3).setCellValue(applyRoomDiscountDto.get("row4") != null ? applyRoomDiscountDto.get("row4").toString() : "");
            row.createCell(4).setCellValue(applyRoomDiscountDto.get("row5") != null ? applyRoomDiscountDto.get("row5").toString() : "");
            row.createCell(5).setCellValue(applyRoomDiscountDto.get("row6") != null ? applyRoomDiscountDto.get("row6").toString() : "");
            row.createCell(6).setCellValue(applyRoomDiscountDto.get("row7") != null ? applyRoomDiscountDto.get("row7").toString() : "");
            row.createCell(7).setCellValue(applyRoomDiscountDto.get("row8") != null ? applyRoomDiscountDto.get("row8").toString() : "");
            row.createCell(8).setCellValue(applyRoomDiscountDto.get("row9") != null ? applyRoomDiscountDto.get("row9").toString() : "");
            row.createCell(9).setCellValue(applyRoomDiscountDto.get("row10") != null ? applyRoomDiscountDto.get("row10").toString() : "");
            row.createCell(10).setCellValue(applyRoomDiscountDto.get("row11") != null ? applyRoomDiscountDto.get("row11").toString() : "");
            row.createCell(11).setCellValue(applyRoomDiscountDto.get("row12") != null ? applyRoomDiscountDto.get("row12").toString() : "");
            row.createCell(12).setCellValue(applyRoomDiscountDto.get("row13") != null ? applyRoomDiscountDto.get("row13").toString() : "");
            row.createCell(13).setCellValue(applyRoomDiscountDto.get("row14") != null ? applyRoomDiscountDto.get("row14").toString() : "");
            row.createCell(14).setCellValue(applyRoomDiscountDto.get("row15") != null ? applyRoomDiscountDto.get("row15").toString() : "");
            row.createCell(15).setCellValue(applyRoomDiscountDto.get("row16") != null ? applyRoomDiscountDto.get("row16").toString() : "");
            row.createCell(16).setCellValue(applyRoomDiscountDto.get("row17") != null ? applyRoomDiscountDto.get("row17").toString() : "");
            row.createCell(17).setCellValue(applyRoomDiscountDto.get("row18") != null ? applyRoomDiscountDto.get("row18").toString() : "");
            row.createCell(18).setCellValue(applyRoomDiscountDto.get("row19") != null ? applyRoomDiscountDto.get("row19").toString() : "");
            row.createCell(19).setCellValue(applyRoomDiscountDto.get("row20") != null ? applyRoomDiscountDto.get("row20").toString() : "");
            row.createCell(20).setCellValue(applyRoomDiscountDto.get("row21") != null ? applyRoomDiscountDto.get("row21").toString() : "");
            row.createCell(21).setCellValue(applyRoomDiscountDto.get("row22") != null ? applyRoomDiscountDto.get("row22").toString() : "");
            row.createCell(22).setCellValue(applyRoomDiscountDto.get("row23") != null ? applyRoomDiscountDto.get("row23").toString() : "");
            row.createCell(23).setCellValue(applyRoomDiscountDto.get("row24") != null ? applyRoomDiscountDto.get("row24").toString() : "");
            row.createCell(24).setCellValue(applyRoomDiscountDto.get("row25") != null ? applyRoomDiscountDto.get("row25").toString() : "");
            row.createCell(25).setCellValue(applyRoomDiscountDto.get("row26") != null ? applyRoomDiscountDto.get("row26").toString() : "");
            row.createCell(26).setCellValue(applyRoomDiscountDto.get("row27") != null ? applyRoomDiscountDto.get("row27").toString() : "");
            row.createCell(27).setCellValue(applyRoomDiscountDto.get("row28") != null ? applyRoomDiscountDto.get("row28").toString() : "");
        }
    }
}