wuxw
2024-03-15 35f4412614a4801dc26f9284c8c15457e1db2a7f
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
package com.java110.report.smo.impl;
 
import com.alibaba.fastjson.JSONObject;
import com.java110.dto.PageDto;
import com.java110.dto.ReportFeeMonthStatisticsPrepaymentDto.ReportFeeMonthStatisticsPrepaymentDto;
import com.java110.dto.ReportFeeMonthStatisticsPrepaymentDto.ReportFeeMonthStatisticsPrepaymentTotalDto;
import com.java110.dto.fee.FeeAccountDetailDto;
import com.java110.dto.fee.FeeConfigDto;
import com.java110.dto.fee.FeeDto;
import com.java110.dto.owner.OwnerCarDto;
import com.java110.dto.owner.OwnerDto;
import com.java110.dto.owner.OwnerRoomRelDto;
import com.java110.dto.repair.RepairDto;
import com.java110.dto.reportFee.ReportFeeMonthStatisticsDto;
import com.java110.dto.reportFee.ReportFeeMonthStatisticsTotalDto;
import com.java110.dto.room.RoomDto;
import com.java110.intf.community.IParkingSpaceV1InnerServiceSMO;
import com.java110.intf.community.IRepairInnerServiceSMO;
import com.java110.intf.community.IRoomInnerServiceSMO;
import com.java110.intf.community.IRoomV1InnerServiceSMO;
import com.java110.intf.fee.IFeeAccountDetailServiceSMO;
import com.java110.intf.fee.IFeeDetailInnerServiceSMO;
import com.java110.intf.report.IQueryPayFeeDetailInnerServiceSMO;
import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO;
import com.java110.intf.report.IReportFeeMonthStatisticsPrepaymentInnerServiceSMO;
import com.java110.intf.user.IOwnerCarInnerServiceSMO;
import com.java110.intf.user.IOwnerInnerServiceSMO;
import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
import com.java110.utils.util.Assert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.ListUtil;
import com.java110.utils.util.StringUtil;
import com.java110.vo.ResultVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
 
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
 
/**
 * 查询缴费明细
 */
@RestController
public class QueryPayFeeDetailInnerServiceSMOImpl implements IQueryPayFeeDetailInnerServiceSMO {
 
    private int MAX_ROWS = 500;  // 最大行数
 
    @Autowired
    private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl;
 
    @Autowired
    private IReportFeeMonthStatisticsPrepaymentInnerServiceSMO reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl;
 
    @Autowired
    private IRepairInnerServiceSMO repairInnerServiceSMOImpl;
 
    @Autowired
    private IOwnerRoomRelInnerServiceSMO ownerRoomRelInnerServiceSMOImpl;
 
    @Autowired
    private IOwnerInnerServiceSMO ownerInnerServiceSMOImpl;
 
    @Autowired
    private IFeeAccountDetailServiceSMO feeAccountDetailServiceSMOImpl;
 
    @Autowired
    private IRoomV1InnerServiceSMO roomV1InnerServiceSMOImpl;
 
    @Autowired
    private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
 
    @Autowired
    private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
 
    /**
     * 查询缴费明细
     *
     * @param reportFeeMonthStatisticsDto
     * @return
     */
    @Override
    public ResultVo query(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
 
        JSONObject countInfo = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetailCount(reportFeeMonthStatisticsDto);
        int count = Integer.parseInt(countInfo.get("count").toString());
        List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
        ReportFeeMonthStatisticsTotalDto reportFeeMonthStatisticsTotalDto = new ReportFeeMonthStatisticsTotalDto();
        ResultVo resultVo = null;
        if (count < 1) {
            resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos, reportFeeMonthStatisticsTotalDto);
            return resultVo;
        }
 
        //todo 查询缴费明细
        reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto);
 
        //todo 应收金额(大计)
        reportFeeMonthStatisticsTotalDto.setAllReceivableAmount(String.format("%.2f", countInfo.getDouble("totalReceivableAmount")));
        //todo 实收金额(大计)
        reportFeeMonthStatisticsTotalDto.setAllReceivedAmount(String.format("%.2f", countInfo.getDouble("totalReceivedAmount")));
 
        //todo 打折金额(大计)
        reportFeeMonthStatisticsTotalDto.setAllPreferentialAmount(String.format("%.2f", countInfo.getDouble("discountAmount")));
 
        //todo 减免金额(大计)
        reportFeeMonthStatisticsTotalDto.setAllDeductionAmount(String.format("%.2f", countInfo.getDouble("deductionAmount")));
        //todo 滞纳金(大计)
        reportFeeMonthStatisticsTotalDto.setAllLateFee(String.format("%.2f", countInfo.getDouble("lateAmount")));
 
        //todo 赠送规则金额(大计)
        reportFeeMonthStatisticsTotalDto.setAllGiftAmount(String.format("%.2f", countInfo.getDouble("giftAmount")));
 
        //todo 计算小计
        computeTotalInfo(reportFeeMonthStatisticsTotalDto, reportFeeMonthStatisticsDtos);
 
        //todo 计算房屋面积 和车位信息
        computeRoomAndParkingSpace(reportFeeMonthStatisticsDtos);
 
 
        resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos, reportFeeMonthStatisticsTotalDto);
        return resultVo;
    }
 
    private void computeRoomAndParkingSpace(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
 
        List<String> payerObjIds = new ArrayList<>();
 
        for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
            payerObjIds.add(reportFeeMonthStatisticsDto.getPayerObjId());
        }
 
        if (ListUtil.isNull(payerObjIds)) {
            return;
        }
        RoomDto roomDto = new RoomDto();
        roomDto.setRoomIds(payerObjIds.toArray(new String[payerObjIds.size()]));
        roomDto.setCommunityId(reportFeeMonthStatisticsDtos.get(0).getCommunityId());
        List<RoomDto> roomDtos = roomV1InnerServiceSMOImpl.queryRooms(roomDto);
 
        if (!ListUtil.isNull(roomDtos)) {
            for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
                for (RoomDto tmpRoomDto : roomDtos) {
                    if (reportFeeMonthStatisticsDto.getPayerObjId().equals(tmpRoomDto.getRoomId())) {
                        reportFeeMonthStatisticsDto.setBuiltUpArea(tmpRoomDto.getBuiltUpArea());
                    }
                }
            }
        }
 
        computeParkingSpace(reportFeeMonthStatisticsDtos, payerObjIds);
 
    }
 
    private void computeParkingSpace(List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos, List<String> payerObjIds) {
        OwnerCarDto ownerCarDto = new OwnerCarDto();
        ownerCarDto.setMemberIds(payerObjIds.toArray(new String[payerObjIds.size()]));
        ownerCarDto.setCommunityId(reportFeeMonthStatisticsDtos.get(0).getCommunityId());
        List<OwnerCarDto> ownerCarDtos = ownerCarInnerServiceSMOImpl.queryOwnerCars(ownerCarDto);
 
        if (ListUtil.isNull(ownerCarDtos)) {
            return;
        }
        freshRoomInfo(ownerCarDtos);
        for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
            for (OwnerCarDto tmpOwnerCarDto : ownerCarDtos) {
                if (!reportFeeMonthStatisticsDto.getPayerObjId().equals(tmpOwnerCarDto.getMemberId())) {
                    continue;
                }
                reportFeeMonthStatisticsDto.setPsName(tmpOwnerCarDto.getAreaNum() + "-" + tmpOwnerCarDto.getNum());
                reportFeeMonthStatisticsDto.setRoomName(tmpOwnerCarDto.getRoomName());
            }
        }
 
    }
 
    /**
     * 刷入房屋信息
     *
     * @param ownerCarDtos
     */
    private void freshRoomInfo(List<OwnerCarDto> ownerCarDtos) {
 
        if (ListUtil.isNull(ownerCarDtos) || ownerCarDtos.size() > 30) {
            return;
        }
        for (OwnerCarDto ownerCarDto : ownerCarDtos) {
            doFreshRoomInfo(ownerCarDto);
        }
    }
 
    /**
     * 车位信息刷入房屋信息
     *
     * @param ownerCarDto
     */
    private void doFreshRoomInfo(OwnerCarDto ownerCarDto) {
        OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
        ownerRoomRelDto.setOwnerId(ownerCarDto.getOwnerId());
        ownerRoomRelDto.setPage(1);
        ownerRoomRelDto.setRow(3); //只展示3个房屋以内 不然页面太乱
        List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
        if (ListUtil.isNull(ownerRoomRelDtos)) {
            ownerCarDto.setRoomName("-");
            return;
        }
        List<String> roomIds = new ArrayList<>();
        for (OwnerRoomRelDto tOwnerRoomRelDto : ownerRoomRelDtos) {
            roomIds.add(tOwnerRoomRelDto.getRoomId());
        }
        RoomDto roomDto = new RoomDto();
        roomDto.setCommunityId(ownerCarDto.getCommunityId());
        roomDto.setRoomIds(roomIds.toArray(new String[roomIds.size()]));
        List<RoomDto> roomDtos = roomInnerServiceSMOImpl.queryRooms(roomDto);
        String roomName = "";
        for (RoomDto tRoomDto : roomDtos) {
            roomName += (tRoomDto.getFloorNum() + "-" + tRoomDto.getUnitNum() + "-" + tRoomDto.getRoomNum() + "-" + "/");
        }
        roomName = roomName.endsWith("/") ? roomName.substring(0, roomName.length() - 1) : roomName;
        ownerCarDto.setRoomName(roomName);
    }
 
    /**
     * 计算大计小计
     *
     * @param reportFeeMonthStatisticsTotalDto
     */
    private void computeTotalInfo(ReportFeeMonthStatisticsTotalDto reportFeeMonthStatisticsTotalDto,
                                  List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
 
        BigDecimal totalReceivableAmount = new BigDecimal(0.00);
 
        BigDecimal totalReceivedAmount = new BigDecimal(0.00);
        BigDecimal totalPreferentialAmount = new BigDecimal(0.00);
        BigDecimal totalDeductionAmount = new BigDecimal(0.00);
        BigDecimal totalLateFee = new BigDecimal(0.00);
        BigDecimal totalGiftAmount = new BigDecimal(0.00);
 
        for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
            totalReceivableAmount = totalReceivableAmount.add(new BigDecimal(reportFeeMonthStatisticsDto.getReceivableAmount()));
            totalReceivedAmount = totalReceivedAmount.add(new BigDecimal(reportFeeMonthStatisticsDto.getReceivedAmount()));
            totalPreferentialAmount = totalPreferentialAmount.add(new BigDecimal(reportFeeMonthStatisticsDto.getDiscountAmount()));
            totalDeductionAmount = totalDeductionAmount.add(new BigDecimal(reportFeeMonthStatisticsDto.getDeductionAmount()));
            totalLateFee = totalLateFee.add(new BigDecimal(reportFeeMonthStatisticsDto.getLateAmount()));
            totalGiftAmount = totalGiftAmount.add(new BigDecimal(reportFeeMonthStatisticsDto.getGiftAmount()));
 
            reportFeeMonthStatisticsDto.setWithholdAmount(reportFeeMonthStatisticsDto.getAcctAmount());
            reportFeeMonthStatisticsDto.setPreferentialAmount(reportFeeMonthStatisticsDto.getDiscountAmount());
            reportFeeMonthStatisticsDto.setLateFee(reportFeeMonthStatisticsDto.getLateAmount());
        }
 
        //todo 应收金额(小计)
        reportFeeMonthStatisticsTotalDto.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount.doubleValue()));
 
        //todo 实收金额(小计)
        reportFeeMonthStatisticsTotalDto.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount.doubleValue()));
        //todo 优惠金额(小计)
        reportFeeMonthStatisticsTotalDto.setTotalPreferentialAmount(String.format("%.2f", totalPreferentialAmount));
        //todo 减免金额(小计)
        reportFeeMonthStatisticsTotalDto.setTotalDeductionAmount(String.format("%.2f", totalDeductionAmount));
        //todo 滞纳金(小计)
        reportFeeMonthStatisticsTotalDto.setTotalLateFee(String.format("%.2f", totalLateFee));
 
    }
 
 
    @Override
    public ResultVo queryPrepayment(@RequestBody ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepaymentDto) {
        JSONObject countInfo = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryPayFeeDetailPrepaymentCount(reportFeeMonthStatisticsPrepaymentDto);
        int count = Integer.parseInt(countInfo.get("count").toString());
        List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentDtos = null;
        ReportFeeMonthStatisticsPrepaymentTotalDto reportFeeMonthStatisticsPrepaymentTotalDto = new ReportFeeMonthStatisticsPrepaymentTotalDto();
        List<ReportFeeMonthStatisticsPrepaymentDto> reportList = new ArrayList<>();
        //查询该小区下的费用项目
        FeeConfigDto feeConfigDto = new FeeConfigDto();
        feeConfigDto.setCommunityId(reportFeeMonthStatisticsPrepaymentDto.getCommunityId());
        List<FeeConfigDto> feeConfigDtos = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryFeeConfigPrepayments(feeConfigDto);
        //应收总金额(大计)
        Double allReceivableAmount = 0.0;
        //实收金额(大计)
        Double allReceivedAmount = 0.0;
        //优惠金额(大计)
        Double allPreferentialAmount = 0.0;
        //减免金额(大计)
        Double allDeductionAmount = 0.0;
        //滞纳金(大计)
        Double allLateFee = 0.0;
        //空置房打折(大计)
        Double allVacantHousingDiscount = 0.0;
        //空置房减免(大计)
        Double allVacantHousingReduction = 0.0;
        //赠送金额(大计)
        Double allGiftAmount = 0.0;
        //欠费金额(大计)
        Double allOweAmount = 0.0;
        //应缴金额(大计)
        Double allPayableAmount = 0.0;
        if (count > 0) {
            //查询缴费明细
            reportFeeMonthStatisticsPrepaymentDtos = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryNewPayFeeDetailPrepayment(reportFeeMonthStatisticsPrepaymentDto);
            //查询应收、实收总金额(大计)
            List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentList = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryAllPayFeeDetailPrepayment(reportFeeMonthStatisticsPrepaymentDto);
            //查询(优惠、减免、滞纳金、空置房打折、空置房减免金额等)大计总金额
            List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentSum = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryPayFeeDetailPrepaymentSum(reportFeeMonthStatisticsPrepaymentDto);
            allReceivableAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllReceivableAmount());
            allReceivedAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllReceivedAmount());
            allOweAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllOweAmount());
            allPayableAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllPayableAmount());
            for (ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepayment : reportFeeMonthStatisticsPrepaymentSum) {
                //这里是查询出的金额总和
                String discountPrice = reportFeeMonthStatisticsPrepayment.getDiscountPrice();
                // discountSmallType 1: 打折  2:减免  3:滞纳金  4:空置房打折  5:空置房减免  6:赠送
                //优惠金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("1")) {
                    Double aDouble = Double.valueOf(discountPrice);
                    allPreferentialAmount = allPreferentialAmount + aDouble;
                }
                //减免金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("2")) {
                    Double aDouble = Double.valueOf(discountPrice);
                    allDeductionAmount = allDeductionAmount + aDouble;
                }
                //滞纳金(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("3")) {
                    Double aDouble = Double.valueOf(discountPrice);
                    allLateFee = allLateFee + aDouble;
                }
                //空置房打折金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("4")) {
                    Double aDouble = Double.valueOf(discountPrice);
                    allVacantHousingDiscount = allVacantHousingDiscount + aDouble;
                }
                //空置房减免金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("5")) {
                    Double aDouble = Double.valueOf(discountPrice);
                    allVacantHousingReduction = allVacantHousingReduction + aDouble;
                }
                //赠送金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("6")) {
                    Double aDouble = Double.valueOf(discountPrice);
                    allGiftAmount = allGiftAmount + aDouble;
                }
            }
            //应收总金额(小计)
            Double totalReceivableAmount = 0.0;
            //实收总金额(小计)
            Double totalReceivedAmount = 0.0;
            //优惠金额(小计)
            Double totalPreferentialAmount = 0.0;
            //减免金额(小计)
            Double totalDeductionAmount = 0.0;
            //空置房打折金额(小计)
            Double totalVacantHousingDiscount = 0.0;
            //空置房减免金额(小计)
            Double totalVacantHousingReduction = 0.0;
            //赠送金额(小计)
            Double totalGiftAmount = 0.0;
            //滞纳金(小计)
            Double totalLateFee = 0.0;
            //欠费金额(小计)
            Double totalOweAmount = 0.0;
            //应缴金额(小计)
            Double totalPayableAmount = 0.0;
            for (ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepayment : reportFeeMonthStatisticsPrepaymentDtos) {
                //应收金额
                Double receivableAmount = 0.0;
                if (!StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getPrepaymentReceivableAmount())) {
                    receivableAmount = Double.valueOf(reportFeeMonthStatisticsPrepayment.getPrepaymentReceivableAmount());
                }
                //实收金额
                Double receivedAmount = 0.0;
                if (!StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getPrepaymentReceivedAmount())) {
                    receivedAmount = Double.valueOf(reportFeeMonthStatisticsPrepayment.getPrepaymentReceivedAmount());
                }
                //欠费金额
                Double oweAmount = 0.0;
                if (!StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getOweAmount())) {
                    oweAmount = Double.valueOf(reportFeeMonthStatisticsPrepayment.getOweAmount());
                }
                //应缴金额
                Double payableAmount = 0.0;
                if (!StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getPayableAmount())) {
                    payableAmount = Double.valueOf(reportFeeMonthStatisticsPrepayment.getPayableAmount());
                }
                totalReceivableAmount = totalReceivableAmount + receivableAmount;
                totalReceivedAmount = totalReceivedAmount + receivedAmount;
                totalOweAmount = totalOweAmount + oweAmount;
                totalPayableAmount = totalPayableAmount + payableAmount;
                ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepaymentDto1 = new ReportFeeMonthStatisticsPrepaymentDto();
                reportFeeMonthStatisticsPrepaymentDto1.setPrepaymentId(reportFeeMonthStatisticsPrepayment.getPrepaymentId());
                List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepayments = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryPayFeeDetailPrepayment(reportFeeMonthStatisticsPrepaymentDto1);
                for (ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatistics : reportFeeMonthStatisticsPrepayments) {
                    //优惠金额
                    if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountPrice()) && !StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType())
                            && reportFeeMonthStatistics.getDiscountSmallType().equals("1")) {
                        //获取优惠金额
                        Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
                        totalPreferentialAmount = totalPreferentialAmount + discountPrice;
                        //优惠金额
                        reportFeeMonthStatisticsPrepayment.setPreferentialAmount(reportFeeMonthStatistics.getDiscountPrice());
                    } else if (StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getPreferentialAmount())) {
                        reportFeeMonthStatisticsPrepayment.setPreferentialAmount("0");
                    }
                    //减免金额
                    if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountPrice()) && !StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType())
                            && reportFeeMonthStatistics.getDiscountSmallType().equals("2")) {
                        //获取减免金额
                        Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
                        totalDeductionAmount = totalDeductionAmount + discountPrice;
                        //减免金额
                        reportFeeMonthStatisticsPrepayment.setDeductionAmount(reportFeeMonthStatistics.getDiscountPrice());
                    } else if (StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDeductionAmount())) {
                        reportFeeMonthStatisticsPrepayment.setDeductionAmount("0");
                    }
                    //滞纳金
                    if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountPrice()) && !StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType())
                            && reportFeeMonthStatistics.getDiscountSmallType().equals("3")) {
                        //获取滞纳金金额
                        Double discountPrice = (Double.valueOf(reportFeeMonthStatistics.getDiscountPrice()));
                        totalLateFee = totalLateFee + discountPrice;
                        //滞纳金
                        reportFeeMonthStatisticsPrepayment.setLateFee(reportFeeMonthStatistics.getDiscountPrice());
                    } else if (StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getLateFee())) {
                        reportFeeMonthStatisticsPrepayment.setLateFee("0");
                    }
                    //空置房打折
                    if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountPrice()) && !StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType())
                            && reportFeeMonthStatistics.getDiscountSmallType().equals("4")) {
                        //空置房打折金额
                        Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
                        totalVacantHousingDiscount = totalVacantHousingDiscount + discountPrice;
                        //空置房打折
                        reportFeeMonthStatisticsPrepayment.setVacantHousingDiscount(reportFeeMonthStatistics.getDiscountPrice());
                    } else if (StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getVacantHousingDiscount())) {
                        reportFeeMonthStatisticsPrepayment.setVacantHousingDiscount("0");
                    }
                    //空置房减免
                    if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountPrice()) && !StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType())
                            && reportFeeMonthStatistics.getDiscountSmallType().equals("5")) {
                        //空置房减免金额
                        Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
                        totalVacantHousingReduction = totalVacantHousingReduction + discountPrice;
                        //空置房减免
                        reportFeeMonthStatisticsPrepayment.setVacantHousingReduction(reportFeeMonthStatistics.getDiscountPrice());
                    } else if (StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getVacantHousingReduction())) {
                        reportFeeMonthStatisticsPrepayment.setVacantHousingReduction("0");
                    }
                    //赠送金额
                    if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountPrice()) && !StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType())
                            && reportFeeMonthStatistics.getDiscountSmallType().equals("6")) {
                        //赠送金额
                        Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPrice());
                        totalGiftAmount = totalGiftAmount + discountPrice;
                        //赠送金额
                        reportFeeMonthStatisticsPrepayment.setGiftAmount(reportFeeMonthStatistics.getDiscountPrice());
                    } else if (StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getGiftAmount())) {
                        reportFeeMonthStatisticsPrepayment.setGiftAmount("0");
                    }
                }
                //费用项目
                reportFeeMonthStatisticsPrepayment.setFeeConfigDtos(feeConfigDtos);
                reportList.add(reportFeeMonthStatisticsPrepayment);
            }
            //应收总金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount));
            //实收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount));
            //欠费金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalOweAmount(String.format("%.2f", totalOweAmount));
            //应缴金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalPayableAmount(String.format("%.2f", totalPayableAmount));
            //优惠金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalPreferentialAmount(String.format("%.2f", totalPreferentialAmount));
            //减免金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalDeductionAmount(String.format("%.2f", totalDeductionAmount));
            //滞纳金(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalLateFee(String.format("%.2f", totalLateFee));
            //空置房打折(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalVacantHousingDiscount(String.format("%.2f", totalVacantHousingDiscount));
            //空置房减免(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalVacantHousingReduction(String.format("%.2f", totalVacantHousingReduction));
            //赠送规则金额(小计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setTotalGiftAmount(String.format("%.2f", totalGiftAmount));
            //应收金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllReceivableAmount(String.format("%.2f", allReceivableAmount));
            //欠费金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllOweAmount(String.format("%.2f", allOweAmount));
            //欠费金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllPayableAmount(String.format("%.2f", allPayableAmount));
            //实收金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllReceivedAmount(String.format("%.2f", allReceivedAmount));
            //优惠金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllPreferentialAmount(String.format("%.2f", allPreferentialAmount));
            //减免金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllDeductionAmount(String.format("%.2f", allDeductionAmount));
            //滞纳金(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllLateFee(String.format("%.2f", allLateFee));
            //空置房打折金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllVacantHousingDiscount(String.format("%.2f", allVacantHousingDiscount));
            //空置房减免金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllVacantHousingReduction(String.format("%.2f", allVacantHousingReduction));
            //赠送规则金额(大计)
            reportFeeMonthStatisticsPrepaymentTotalDto.setAllGiftAmount(String.format("%.2f", allGiftAmount));
        } else {
            reportFeeMonthStatisticsPrepaymentDtos = new ArrayList<>();
            reportList.addAll(reportFeeMonthStatisticsPrepaymentDtos);
            reportFeeMonthStatisticsPrepaymentTotalDto = new ReportFeeMonthStatisticsPrepaymentTotalDto();
        }
//        count = reportList.size();
        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsPrepaymentDto.getRow()), count, reportList, reportFeeMonthStatisticsPrepaymentTotalDto);
        return resultVo;
    }
 
    @Override
    public ResultVo queryReportCollectFees(@RequestBody ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepaymentDto) {
        ReportFeeMonthStatisticsPrepaymentDto feeMonthStatisticsPrepayment = BeanConvertUtil.covertBean(reportFeeMonthStatisticsPrepaymentDto, ReportFeeMonthStatisticsPrepaymentDto.class);
        //查询预付期账单报表的费用项configId
        List<ReportFeeMonthStatisticsPrepaymentDto> configIds = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryPrepaymentConfigs(feeMonthStatisticsPrepayment);
        int count = configIds.size();
        List<ReportFeeMonthStatisticsPrepaymentDto> reportList = new ArrayList<>();
        //查询该小区下的费用项目
        FeeConfigDto feeConfigDto = new FeeConfigDto();
        feeConfigDto.setCommunityId(reportFeeMonthStatisticsPrepaymentDto.getCommunityId());
        if (count > 0) {
            for (ReportFeeMonthStatisticsPrepaymentDto feeMonthStatisticsPrepaymentDto : configIds) {
                reportFeeMonthStatisticsPrepaymentDto.setConfigId(feeMonthStatisticsPrepaymentDto.getConfigId());
                if (reportFeeMonthStatisticsPrepaymentDto.getPage() == 0) {
                    reportFeeMonthStatisticsPrepaymentDto.setPage(1);
                }
                //查询缴费明细
                List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentDtos = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryPayFeeDetailPrepayment(reportFeeMonthStatisticsPrepaymentDto);
                if (reportFeeMonthStatisticsPrepaymentDtos == null || reportFeeMonthStatisticsPrepaymentDtos.size() < 1) {
                    continue;
                }
                //查询应收、实收总金额(大计)
                List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentList = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryAllPayFeeDetailPrepayment(reportFeeMonthStatisticsPrepaymentDto);
                //查询(优惠、减免、滞纳金、空置房打折、空置房减免金额等)大计总金额
                List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentSum = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryPayFeeDetailPrepaymentSum(reportFeeMonthStatisticsPrepaymentDto);
                //应收总金额(大计)
                Double allReceivableAmount = 0.0;
                //实收金额(大计)
                Double allReceivedAmount = 0.0;
                //优惠金额(大计)
                Double allPreferentialAmount = 0.0;
                //减免金额(大计)
                Double allDeductionAmount = 0.0;
                //滞纳金(大计)
                Double allLateFee = 0.0;
                //空置房打折(大计)
                Double allVacantHousingDiscount = 0.0;
                //空置房减免(大计)
                Double allVacantHousingReduction = 0.0;
                //赠送金额(大计)
                Double allGiftAmount = 0.0;
                //欠费金额(大计)
                Double allOweAmount = 0.0;
                //应缴金额(大计)
                Double allPayableAmount = 0.0;
                allReceivableAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllReceivableAmount());
                allReceivedAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllReceivedAmount());
                allOweAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllOweAmount());
                allPayableAmount = Double.valueOf(reportFeeMonthStatisticsPrepaymentList.get(0).getAllPayableAmount());
                for (ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepayment : reportFeeMonthStatisticsPrepaymentSum) {
                    //这里是查询出的金额总和
                    String discountPrice = reportFeeMonthStatisticsPrepayment.getDiscountPrice();
                    // discountSmallType 1: 打折  2:减免  3:滞纳金  4:空置房打折  5:空置房减免  6:赠送
                    //优惠金额(大计)
                    if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("1")) {
                        Double aDouble = Double.valueOf(discountPrice);
                        allPreferentialAmount = allPreferentialAmount + aDouble;
                    }
                    //减免金额(大计)
                    if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("2")) {
                        Double aDouble = Double.valueOf(discountPrice);
                        allDeductionAmount = allDeductionAmount + aDouble;
                    }
                    //滞纳金(大计)
                    if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("3")) {
                        Double aDouble = Double.valueOf(discountPrice);
                        allLateFee = allLateFee + aDouble;
                    }
                    //空置房打折金额(大计)
                    if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("4")) {
                        Double aDouble = Double.valueOf(discountPrice);
                        allVacantHousingDiscount = allVacantHousingDiscount + aDouble;
                    }
                    //空置房减免金额(大计)
                    if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("5")) {
                        Double aDouble = Double.valueOf(discountPrice);
                        allVacantHousingReduction = allVacantHousingReduction + aDouble;
                    }
                    //赠送金额(大计)
                    if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(reportFeeMonthStatisticsPrepayment.getDiscountSmallType()) && reportFeeMonthStatisticsPrepayment.getDiscountSmallType().equals("6")) {
                        Double aDouble = Double.valueOf(discountPrice);
                        allGiftAmount = allGiftAmount + aDouble;
                    }
                }
                ReportFeeMonthStatisticsPrepaymentDto feeMonthStatistics = new ReportFeeMonthStatisticsPrepaymentDto();
                //费用名称
                feeMonthStatistics.setFeeName(reportFeeMonthStatisticsPrepaymentDtos.get(0).getFeeName());
                feeMonthStatistics.setFeeTypeCd(reportFeeMonthStatisticsPrepaymentDtos.get(0).getFeeTypeCd());
                feeMonthStatistics.setFeeTypeCdName(reportFeeMonthStatisticsPrepaymentDtos.get(0).getFeeTypeCdName());
                //应收金额(大计)
                feeMonthStatistics.setAllReceivableAmount(String.format("%.2f", allReceivableAmount));
                //欠费金额(大计)
                feeMonthStatistics.setAllOweAmount(String.format("%.2f", allOweAmount));
                //应缴金额(大计)
                feeMonthStatistics.setAllPayableAmount(String.format("%.2f", allPayableAmount));
                //实收金额(大计)
                feeMonthStatistics.setAllReceivedAmount(String.format("%.2f", allReceivedAmount));
                //优惠金额(大计)
                feeMonthStatistics.setAllPreferentialAmount(String.format("%.2f", allPreferentialAmount));
                //减免金额(大计)
                feeMonthStatistics.setAllDeductionAmount(String.format("%.2f", allDeductionAmount));
                //滞纳金(大计)
                feeMonthStatistics.setAllLateFee(String.format("%.2f", allLateFee));
                //空置房打折金额(大计)
                feeMonthStatistics.setAllVacantHousingDiscount(String.format("%.2f", allVacantHousingDiscount));
                //空置房减免金额(大计)
                feeMonthStatistics.setAllVacantHousingReduction(String.format("%.2f", allVacantHousingReduction));
                //赠送规则金额(大计)
                feeMonthStatistics.setAllGiftAmount(String.format("%.2f", allGiftAmount));
                reportList.add(feeMonthStatistics);
            }
        } else {
            reportList = new ArrayList<>();
        }
        //获取收费状况表大计、小计
        ReportFeeMonthStatisticsPrepaymentTotalDto reportFeeMonthStatisticsPrepaymentTotal = getReportFeeMonthStatisticsPrepaymentTotal(feeMonthStatisticsPrepayment);
        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsPrepaymentDto.getRow()), count, reportList, reportFeeMonthStatisticsPrepaymentTotal);
        return resultVo;
    }
 
    //获取收费状况表大计、小计
    private ReportFeeMonthStatisticsPrepaymentTotalDto getReportFeeMonthStatisticsPrepaymentTotal(ReportFeeMonthStatisticsPrepaymentDto reportFeeMonthStatisticsPrepaymentDto) {
        ReportFeeMonthStatisticsPrepaymentTotalDto reportFeeMonthStatisticsPrepaymentTotal = new ReportFeeMonthStatisticsPrepaymentTotalDto();
        //查询应缴、应收、实收、欠费金额(小计)
        if (reportFeeMonthStatisticsPrepaymentDto.getPage() == 0) {
            reportFeeMonthStatisticsPrepaymentDto.setPage(1);
        }
        List<ReportFeeMonthStatisticsPrepaymentDto> feeMonthStatisticsPrepaymentDtos = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryAllPrepaymentConfigs(reportFeeMonthStatisticsPrepaymentDto);
        if (feeMonthStatisticsPrepaymentDtos != null && feeMonthStatisticsPrepaymentDtos.size() == 1) {
            reportFeeMonthStatisticsPrepaymentTotal.setTotalPayableAmount(feeMonthStatisticsPrepaymentDtos.get(0).getAllPayableAmount()); //应缴金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalReceivableAmount(feeMonthStatisticsPrepaymentDtos.get(0).getAllReceivableAmount()); //应收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalReceivedAmount(feeMonthStatisticsPrepaymentDtos.get(0).getAllReceivedAmount()); //实收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalOweAmount(feeMonthStatisticsPrepaymentDtos.get(0).getAllOweAmount()); //欠费金额(小计)
        } else {
            reportFeeMonthStatisticsPrepaymentTotal.setTotalPayableAmount("0.0"); //应缴金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalReceivableAmount("0.0"); //应收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalReceivedAmount("0.0"); //实收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalOweAmount("0.0"); //欠费金额(小计)
        }
        //查询应缴、应收、实收、欠费金额(大计)
        reportFeeMonthStatisticsPrepaymentDto.setPage(PageDto.DEFAULT_PAGE);
        List<ReportFeeMonthStatisticsPrepaymentDto> feeMonthStatisticsPrepayments = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryAllPrepaymentConfigs(reportFeeMonthStatisticsPrepaymentDto);
        if (feeMonthStatisticsPrepayments != null && feeMonthStatisticsPrepayments.size() == 1) {
            reportFeeMonthStatisticsPrepaymentTotal.setAllPayableAmount(feeMonthStatisticsPrepayments.get(0).getAllPayableAmount()); //应缴金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllReceivableAmount(feeMonthStatisticsPrepayments.get(0).getAllReceivableAmount()); //应收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllReceivedAmount(feeMonthStatisticsPrepayments.get(0).getAllReceivedAmount()); //实收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllOweAmount(feeMonthStatisticsPrepayments.get(0).getAllOweAmount()); //欠费金额(小计)
        } else {
            reportFeeMonthStatisticsPrepaymentTotal.setAllPayableAmount("0.0"); //应缴金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllReceivableAmount("0.0"); //应收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllReceivedAmount("0.0"); //实收金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllOweAmount("0.0"); //欠费金额(小计)
        }
        //查询优惠、违约金额(小计)
        if (reportFeeMonthStatisticsPrepaymentDto.getPage() == 0) {
            reportFeeMonthStatisticsPrepaymentDto.setPage(1);
        }
        List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepayments = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryAllPrepaymentDiscounts(reportFeeMonthStatisticsPrepaymentDto);
        if (reportFeeMonthStatisticsPrepayments != null && reportFeeMonthStatisticsPrepayments.size() > 0) {
            for (ReportFeeMonthStatisticsPrepaymentDto feeMonthStatisticsPrepayment : reportFeeMonthStatisticsPrepayments) {
                //获取折扣类型
                String discountSmallType = feeMonthStatisticsPrepayment.getDiscountSmallType();
                //获取折扣金额
                String discountPrice = feeMonthStatisticsPrepayment.getDiscountPrice();
                // discountSmallType 1: 打折  2:减免  3:滞纳金  4:空置房打折  5:空置房减免  6:赠送
                //优惠金额(小计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("1")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setTotalPreferentialAmount(discountPrice); //优惠金额(小计)
                }
                //减免金额(小计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("2")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setTotalDeductionAmount(discountPrice); //减免金额(小计)
                }
                //滞纳金(小计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("3")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setTotalLateFee(discountPrice); //滞纳金(小计)
                }
                //空置房打折金额(小计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("4")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setTotalVacantHousingDiscount(discountPrice); //空置房打折金额(小计)
                }
                //空置房减免金额(小计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("5")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setTotalVacantHousingReduction(discountPrice); //空置房减免金额(小计)
                }
                //赠送金额(小计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("6")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setTotalGiftAmount(discountPrice); //赠送金额(小计)
                }
            }
        } else {
            reportFeeMonthStatisticsPrepaymentTotal.setTotalPreferentialAmount("0.0"); //优惠金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalDeductionAmount("0.0"); //减免金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalLateFee("0.0"); //滞纳金(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalVacantHousingDiscount("0.0"); //空置房打折金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalVacantHousingReduction("0.0"); //空置房减免金额(小计)
            reportFeeMonthStatisticsPrepaymentTotal.setTotalGiftAmount("0.0"); //赠送金额(小计)
        }
        //查询优惠、违约金额(大计)
        reportFeeMonthStatisticsPrepaymentDto.setPage(PageDto.DEFAULT_PAGE);
        List<ReportFeeMonthStatisticsPrepaymentDto> reportFeeMonthStatisticsPrepaymentDtos = reportFeeMonthStatisticsPrepaymentInnerServiceSMOImpl.queryAllPrepaymentDiscounts(reportFeeMonthStatisticsPrepaymentDto);
        if (reportFeeMonthStatisticsPrepaymentDtos != null && reportFeeMonthStatisticsPrepaymentDtos.size() > 0) {
            for (ReportFeeMonthStatisticsPrepaymentDto feeMonthStatisticsPrepaymentDto : reportFeeMonthStatisticsPrepaymentDtos) {
                //获取折扣类型
                String discountSmallType = feeMonthStatisticsPrepaymentDto.getDiscountSmallType();
                //获取折扣金额
                String discountPrice = feeMonthStatisticsPrepaymentDto.getDiscountPrice();
                // discountSmallType 1: 打折  2:减免  3:滞纳金  4:空置房打折  5:空置房减免  6:赠送
                //优惠金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("1")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setAllPreferentialAmount(discountPrice); //优惠金额(大计)
                }
                //减免金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("2")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setAllDeductionAmount(discountPrice); //减免金额(大计)
                }
                //滞纳金(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("3")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setAllLateFee(discountPrice); //滞纳金(大计)
                }
                //空置房打折金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("4")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setAllVacantHousingDiscount(discountPrice); //空置房打折金额(大计)
                }
                //空置房减免金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("5")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setAllVacantHousingReduction(discountPrice); //空置房减免金额(大计)
                }
                //赠送金额(大计)
                if (!StringUtil.isEmpty(discountPrice) && !StringUtil.isEmpty(discountSmallType) && discountSmallType.equals("6")) {
                    reportFeeMonthStatisticsPrepaymentTotal.setAllGiftAmount(discountPrice); //赠送金额(大计)
                }
            }
        } else {
            reportFeeMonthStatisticsPrepaymentTotal.setAllPreferentialAmount("0.0"); //优惠金额(大计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllDeductionAmount("0.0"); //减免金额(大计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllLateFee("0.0"); //滞纳金(大计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllVacantHousingDiscount("0.0"); //空置房打折金额(大计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllVacantHousingReduction("0.0"); //空置房减免金额(大计)
            reportFeeMonthStatisticsPrepaymentTotal.setAllGiftAmount("0.0"); //赠送金额(大计)
        }
        return reportFeeMonthStatisticsPrepaymentTotal;
    }
 
 
}