wuxw лет назад: 2
Родитель
Сommit
17bfc74d35
18 измененных файлов с 629 добавлено и 774 удалено
  1. 47 0
      java110-bean/src/main/java/com/java110/dto/fee/FeeDetailDto.java
  2. 9 0
      java110-bean/src/main/java/com/java110/dto/fee/FeeDiscountDto.java
  3. 11 0
      java110-bean/src/main/java/com/java110/dto/fee/FeeDiscountRuleDto.java
  4. 46 0
      java110-bean/src/main/java/com/java110/dto/fee/PayFeeDetailDto.java
  5. 9 0
      java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java
  6. 39 0
      java110-bean/src/main/java/com/java110/dto/reportFee/ReportFeeMonthStatisticsDto.java
  7. 46 0
      java110-bean/src/main/java/com/java110/po/fee/PayFeeDetailPo.java
  8. 5 2
      java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml
  9. 1 1
      java110-db/src/main/resources/mapper/fee/FeeDiscountServiceDaoImplMapper.xml
  10. 4 2
      java110-db/src/main/resources/mapper/fee/PayFeeDetailNewV1ServiceDaoImplMapper.xml
  11. 204 459
      java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml
  12. 1 0
      service-fee/src/main/java/com/java110/fee/cmd/fee/PayBatchFeeCmd.java
  13. 59 23
      service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java
  14. 3 0
      service-fee/src/main/java/com/java110/fee/cmd/fee/PayOweFeeCmd.java
  15. 2 2
      service-fee/src/main/java/com/java110/fee/dao/impl/FeeDetailServiceDaoImpl.java
  16. 14 1
      service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryPayFeeDetailCmd.java
  17. 8 7
      service-report/src/main/java/com/java110/report/dao/impl/ReportFeeMonthStatisticsServiceDaoImpl.java
  18. 121 277
      service-report/src/main/java/com/java110/report/smo/impl/QueryPayFeeDetailInnerServiceSMOImpl.java

+ 47 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDetailDto.java

@@ -93,6 +93,13 @@ public class FeeDetailDto extends PageDto implements Serializable {
 
     private String receiptCode;
 
+
+    private String acctAmount;
+    private String discountAmount;
+    private String deductionAmount;
+    private String lateAmount;
+    private String giftAmount;
+
     public String getPrimeRate() {
         return primeRate;
     }
@@ -436,4 +443,44 @@ public class FeeDetailDto extends PageDto implements Serializable {
     public void setOpenInvoice(String openInvoice) {
         this.openInvoice = openInvoice;
     }
+
+    public String getAcctAmount() {
+        return acctAmount;
+    }
+
+    public void setAcctAmount(String acctAmount) {
+        this.acctAmount = acctAmount;
+    }
+
+    public String getDiscountAmount() {
+        return discountAmount;
+    }
+
+    public void setDiscountAmount(String discountAmount) {
+        this.discountAmount = discountAmount;
+    }
+
+    public String getDeductionAmount() {
+        return deductionAmount;
+    }
+
+    public void setDeductionAmount(String deductionAmount) {
+        this.deductionAmount = deductionAmount;
+    }
+
+    public String getLateAmount() {
+        return lateAmount;
+    }
+
+    public void setLateAmount(String lateAmount) {
+        this.lateAmount = lateAmount;
+    }
+
+    public String getGiftAmount() {
+        return giftAmount;
+    }
+
+    public void setGiftAmount(String giftAmount) {
+        this.giftAmount = giftAmount;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDiscountDto.java

@@ -31,6 +31,7 @@ public class FeeDiscountDto extends PageDto implements Serializable {
     private String ruleName;
     private String beanImpl;
     private String feeId;
+    private String discountSmallType;
     private double cycles;
 
     private List<FeeDiscountSpecDto> feeDiscountSpecs;
@@ -150,4 +151,12 @@ public class FeeDiscountDto extends PageDto implements Serializable {
     public void setDiscountTypeName(String discountTypeName) {
         this.discountTypeName = discountTypeName;
     }
+
+    public String getDiscountSmallType() {
+        return discountSmallType;
+    }
+
+    public void setDiscountSmallType(String discountSmallType) {
+        this.discountSmallType = discountSmallType;
+    }
 }

+ 11 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDiscountRuleDto.java

@@ -16,6 +16,17 @@ import java.util.List;
  **/
 public class FeeDiscountRuleDto extends PageDto implements Serializable {
 
+    //todo 1: 打折  2:减免  3:滞纳金  4:空置房打折  5:空置房减免
+
+    public static final String DISCOUNT_SMALL_TYPE_DISCOUNT = "1"; //1: 打折
+    public static final String DISCOUNT_SMALL_TYPE_DEDUCTION = "2"; //2:减免
+    public static final String DISCOUNT_SMALL_TYPE_LATE = "3"; //3:滞纳金
+    public static final String DISCOUNT_SMALL_TYPE_APPLY_DISCOUNT = "4"; //4:空置房打折
+    public static final String DISCOUNT_SMALL_TYPE_APPLY_DEDUCTION = "5"; //5:空置房减免
+
+    public static final String DISCOUNT_SMALL_TYPE_GIFT = "6"; //6:赠送
+
+
     private String ruleName;
     private String remark;
     private String ruleId;

+ 46 - 0
java110-bean/src/main/java/com/java110/dto/fee/PayFeeDetailDto.java

@@ -40,6 +40,12 @@ public class PayFeeDetailDto extends PageDto implements Serializable {
     private String cashierId;
     private String cashierName;
 
+    private String acctAmount;
+    private String discountAmount;
+    private String deductionAmount;
+    private String lateAmount;
+    private String giftAmount;
+
     public String getDetailId() {
         return detailId;
     }
@@ -231,4 +237,44 @@ public class PayFeeDetailDto extends PageDto implements Serializable {
     public void setUserName(String userName) {
         this.userName = userName;
     }
+
+    public String getAcctAmount() {
+        return acctAmount;
+    }
+
+    public void setAcctAmount(String acctAmount) {
+        this.acctAmount = acctAmount;
+    }
+
+    public String getDiscountAmount() {
+        return discountAmount;
+    }
+
+    public void setDiscountAmount(String discountAmount) {
+        this.discountAmount = discountAmount;
+    }
+
+    public String getDeductionAmount() {
+        return deductionAmount;
+    }
+
+    public void setDeductionAmount(String deductionAmount) {
+        this.deductionAmount = deductionAmount;
+    }
+
+    public String getLateAmount() {
+        return lateAmount;
+    }
+
+    public void setLateAmount(String lateAmount) {
+        this.lateAmount = lateAmount;
+    }
+
+    public String getGiftAmount() {
+        return giftAmount;
+    }
+
+    public void setGiftAmount(String giftAmount) {
+        this.giftAmount = giftAmount;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerCarDto.java

@@ -87,6 +87,7 @@ public class OwnerCarDto extends PageDto implements Serializable {
     private String carTypeCdName;
     private String[] carTypeCds;
     private String memberId;
+    private String[] memberIds;
     private String unitId;
     private String floorNum;
     private String unitNum;
@@ -576,4 +577,12 @@ public class OwnerCarDto extends PageDto implements Serializable {
     public void setPaId(String paId) {
         this.paId = paId;
     }
+
+    public String[] getMemberIds() {
+        return memberIds;
+    }
+
+    public void setMemberIds(String[] memberIds) {
+        this.memberIds = memberIds;
+    }
 }

+ 39 - 0
java110-bean/src/main/java/com/java110/dto/reportFee/ReportFeeMonthStatisticsDto.java

@@ -49,6 +49,7 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     private String psName;
     private String contractCode;
     private String payerObjType;
+    private String payerObjId;
     private String ownerName;
     private String ownerId;
     private String detailId;
@@ -179,6 +180,20 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     private String discountSmallTypeFive;
     private String discountSmallTypeSix;
 
+
+
+    private String acctAmount;
+    private String discountAmount;
+    private String lateAmount;
+
+    public String getPayerObjId() {
+        return payerObjId;
+    }
+
+    public void setPayerObjId(String payerObjId) {
+        this.payerObjId = payerObjId;
+    }
+
     public String getReceivableAmount() {
         return receivableAmount;
     }
@@ -978,4 +993,28 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     public void setDiscountSmallTypeSix(String discountSmallTypeSix) {
         this.discountSmallTypeSix = discountSmallTypeSix;
     }
+
+    public String getAcctAmount() {
+        return acctAmount;
+    }
+
+    public void setAcctAmount(String acctAmount) {
+        this.acctAmount = acctAmount;
+    }
+
+    public String getDiscountAmount() {
+        return discountAmount;
+    }
+
+    public void setDiscountAmount(String discountAmount) {
+        this.discountAmount = discountAmount;
+    }
+
+    public String getLateAmount() {
+        return lateAmount;
+    }
+
+    public void setLateAmount(String lateAmount) {
+        this.lateAmount = lateAmount;
+    }
 }

+ 46 - 0
java110-bean/src/main/java/com/java110/po/fee/PayFeeDetailPo.java

@@ -40,6 +40,12 @@ public class PayFeeDetailPo implements Serializable {
     private String openInvoice; // todo 默认 未开票
 
 
+    private String acctAmount = "0";
+    private String discountAmount = "0";
+    private String deductionAmount = "0";
+    private String lateAmount = "0";
+    private String giftAmount = "0";
+
 
     public String getDetailId() {
         return detailId;
@@ -192,4 +198,44 @@ public class PayFeeDetailPo implements Serializable {
     public void setOpenInvoice(String openInvoice) {
         this.openInvoice = openInvoice;
     }
+
+    public String getAcctAmount() {
+        return acctAmount;
+    }
+
+    public void setAcctAmount(String acctAmount) {
+        this.acctAmount = acctAmount;
+    }
+
+    public String getDiscountAmount() {
+        return discountAmount;
+    }
+
+    public void setDiscountAmount(String discountAmount) {
+        this.discountAmount = discountAmount;
+    }
+
+    public String getDeductionAmount() {
+        return deductionAmount;
+    }
+
+    public void setDeductionAmount(String deductionAmount) {
+        this.deductionAmount = deductionAmount;
+    }
+
+    public String getLateAmount() {
+        return lateAmount;
+    }
+
+    public void setLateAmount(String lateAmount) {
+        this.lateAmount = lateAmount;
+    }
+
+    public String getGiftAmount() {
+        return giftAmount;
+    }
+
+    public void setGiftAmount(String giftAmount) {
+        this.giftAmount = giftAmount;
+    }
 }

+ 5 - 2
java110-db/src/main/resources/mapper/fee/FeeDetailServiceDaoImplMapper.xml

@@ -353,13 +353,16 @@
     <insert id="saveFeeDetail" parameterType="Map">
         insert into
         pay_fee_detail(
-        prime_rate,detail_id,receivable_amount,cycles,remark,received_amount,community_id,fee_id,state,start_time,end_time,payable_amount,cashier_name,cashier_id,open_invoice
+        prime_rate,detail_id,receivable_amount,cycles,remark,received_amount,community_id,
+        fee_id,state,start_time,end_time,payable_amount,cashier_name,cashier_id,open_invoice,
+        acct_amount,discount_amount,deduction_amount,late_amount,gift_amount
         <if test="createTime != null and createTime != ''">
             ,create_time
         </if>
         )
         values(#{primeRate},#{detailId},#{receivableAmount},#{cycles},#{remark},#{receivedAmount},#{communityId},#{feeId},#{state},
-        #{startTime},#{endTime},#{payableAmount},#{cashierName},#{cashierId},#{openInvoice}
+        #{startTime},#{endTime},#{payableAmount},#{cashierName},#{cashierId},#{openInvoice},
+        #{acctAmount},#{discountAmount},#{deductionAmount},#{lateAmount}#{giftAmount}
         <if test="createTime != null and createTime != ''">
             ,#{createTime}
         </if>

+ 1 - 1
java110-db/src/main/resources/mapper/fee/FeeDiscountServiceDaoImplMapper.xml

@@ -18,7 +18,7 @@
         select t.discount_name,t.discount_name discountName,t.discount_desc,t.discount_desc
         discountDesc,t.discount_type,t.discount_type discountType,td.name discountTypeName,t.status_cd,t.status_cd
         statusCd,t.discount_id,t.discount_id discountId,t.community_id,t.community_id communityId,t.rule_id,t.rule_id
-        ruleId,t.create_time createTime,fdr.rule_name ruleName,fdr.bean_impl beanImpl
+        ruleId,t.create_time createTime,fdr.rule_name ruleName,fdr.bean_impl beanImpl,fdr.discount_small_type discountSmallType
         from fee_discount t
         left join fee_discount_rule fdr on t.rule_id = fdr.rule_id and fdr.status_cd = '0'
         left join t_dict td on td.status_cd = t.discount_type and td.table_name = 'fee_discount'

+ 4 - 2
java110-db/src/main/resources/mapper/fee/PayFeeDetailNewV1ServiceDaoImplMapper.xml

@@ -7,13 +7,15 @@
     <insert id="savePayFeeDetailNewInfo" parameterType="Map">
         insert into pay_fee_detail(
         prime_rate,detail_id,receivable_amount,cycles,remark,start_time,received_amount,state,end_time,community_id,
-        fee_id,b_id,payable_amount,pay_order_id,cashier_id,cashier_name,open_invoice
+        fee_id,b_id,payable_amount,pay_order_id,cashier_id,cashier_name,open_invoice,
+        acct_amount,discount_amount,deduction_amount,late_amount,gift_amount
         <if test="createTime != null">
             ,create_time
         </if>
         ) values (
         #{primeRate},#{detailId},#{receivableAmount},#{cycles},#{remark},#{startTime},#{receivedAmount},#{state},#{endTime},#{communityId},
-        #{feeId},#{bId},#{payableAmount},#{payOrderId},#{cashierId},#{cashierName},#{openInvoice}
+        #{feeId},#{bId},#{payableAmount},#{payOrderId},#{cashierId},#{cashierName},#{openInvoice},
+        #{acctAmount},#{discountAmount},#{deductionAmount},#{lateAmount}#{giftAmount}
         <if test="createTime != null">
             ,#{createTime}
         </if>

+ 204 - 459
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -6,17 +6,17 @@
     <!-- 保存费用月统计信息 add by wuxw 2018-07-03 -->
     <insert id="saveReportFeeMonthStatisticsInfo" parameterType="Map">
         insert into report_fee_month_statistics(receivable_amount, statistics_id, update_time, remark, obj_name,
-                                                received_amount, fee_year, fee_month, fee_id, config_id,
-                                                obj_id, fee_name, owe_amount, community_id, fee_create_time, obj_type,
-                                                deadline_time, cur_max_time,
-                                                his_owe_amount, cur_receivable_amount, cur_received_amount,
-                                                his_owe_received_amount, pre_received_amount, obj_name_num)
+        received_amount, fee_year, fee_month, fee_id, config_id,
+        obj_id, fee_name, owe_amount, community_id, fee_create_time, obj_type,
+        deadline_time, cur_max_time,
+        his_owe_amount, cur_receivable_amount, cur_received_amount,
+        his_owe_received_amount, pre_received_amount, obj_name_num)
         values (#{receivableAmount}, #{statisticsId}, #{updateTime}, #{remark}, #{objName}, #{receivedAmount},
-                #{feeYear}, #{feeMonth},
-                #{feeId}, #{configId}, #{objId}, #{feeName}, #{oweAmount}, #{communityId}, #{feeCreateTime}, #{objType},
-                #{deadlineTime}, #{curMaxTime},
-                #{hisOweAmount}, #{curReceivableAmount}, #{curReceivedAmount}, #{hisOweReceivedAmount},
-                #{preReceivedAmount}, #{objNameNum})
+        #{feeYear}, #{feeMonth},
+        #{feeId}, #{configId}, #{objId}, #{feeName}, #{oweAmount}, #{communityId}, #{feeCreateTime}, #{objType},
+        #{deadlineTime}, #{curMaxTime},
+        #{hisOweAmount}, #{curReceivableAmount}, #{curReceivedAmount}, #{hisOweReceivedAmount},
+        #{preReceivedAmount}, #{objNameNum})
     </insert>
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
@@ -1640,172 +1640,38 @@
     </select>
 
     <select id="queryPayFeeDetailCount" parameterType="Map" resultType="Map">
-        select count(1) count,SUM(receivedAmount) totalReceivedAmount,SUM(receivableAmount) totalReceivableAmount
-        from (
-        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,br.built_up_area
-        builtUpArea ,oc.car_num carNum,
-        pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
-        t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
-        importFeeName,t.prime_rate,d.name primeRate,co.contract_code contractCode,pfo.`value` ownerName,t.pay_order_id
-        oId,
-        d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
-        t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'停车场',ps.num,'车位') psName,
-        fad.amount withholdAmount,t.cashier_id cashierId,t.cashier_name cashierName,t.payable_amount
-        payableAmount,pfc.fee_flag feeFlag,dt1.discountPrice discountPriceOne,dt1.discountSmallType
-        discountSmallTypeOne,
-        dt1.ruleName ruleNameOne,dt2.discountPrice discountPriceTwo,dt2.discountSmallType discountSmallTypeTwo,
-        dt2.ruleName ruleNameTwo,dt3.discountPrice discountPriceThree,dt3.discountSmallType discountSmallTypeThree,
-        dt3.ruleName ruleNameThree,dt4.discountPrice discountPriceFour,dt4.discountSmallType discountSmallTypeFour,
-        dt4.ruleName ruleNameFour,dt5.discountPrice discountPriceFive,dt5.discountSmallType discountSmallTypeFive,
-        dt5.ruleName ruleNameFive,dt6.discountPrice discountPriceSix,dt6.discountSmallType discountSmallTypeSix,
-        dt6.ruleName ruleNameSix
+        select count(1) count,SUM(t.received_amount) totalReceivedAmount,SUM(t.receivable_amount) totalReceivableAmount,
+        sum(t.acct_amount) accAmount,sum(t.discount_amount) discountAmount,sum(t.deduction_amount) deductionAmount,sum(t.late_amount) lateAmount,
+        sum(t.gift_amount) giftAmount
         from pay_fee_detail t
         left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
-        LEFT JOIN parking_space ps on oc.ps_id = ps.ps_id and ps.status_cd = '0'
-        left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
-        left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
-        left join pay_fee_attrs pfb on t.fee_id = pfb.fee_id and pfb.spec_cd = '390007'
-        left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
-        left join pay_fee_attrs pft on t.fee_id = pft.fee_id and pft.spec_cd = '390001'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
+        <if test="ownerId != null and ownerId != ''">
+            left join pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390007'
         </if>
-        ) dt1
-        on t.detail_id = dt1.detailId and dt1.discountSmallType = '1'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt2
-        on t.detail_id = dt2.detailId and dt2.discountSmallType = '2'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt3
-        on t.detail_id = dt3.detailId and dt3.discountSmallType = '3'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt4
-        on t.detail_id = dt4.detailId and dt4.discountSmallType = '4'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt5
-        on t.detail_id = dt5.detailId and dt5.discountSmallType = '5'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt6
-        on t.detail_id = dt6.detailId and dt6.discountSmallType = '6'
-        left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
-        d.table_columns="prime_rate"
-        left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = "pay_fee_config" and d2.table_columns
-        = "fee_type_cd"
-        left join t_dict d3 on t.state = d3.status_cd and d3.table_name = "pay_fee_detail" and d3.table_columns =
-        "state"
-        LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
-        left join fee_account_detail fad on t.detail_id = fad.detail_id and t.community_id = fad.community_id and
-        fad.status_cd = '0' and fad.state = '1002'
         where t.status_cd = '0'
         and pf.status_cd = '0'
         and t.state != '1500'
         <if test="detailId !=null and detailId != ''">
             and t.detail_id= #{detailId}
         </if>
-        <if test="roomNum !=null and roomNum != ''">
-            and br.room_num= #{roomNum}
-        </if>
-        <if test="unitId !=null and unitId != ''">
-            and bu.unit_id= #{unitId}
-        </if>
-        <if test="unitNum !=null and unitNum != ''">
-            and bu.unit_num= #{unitNum}
-        </if>
-        <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
-        </if>
-        <if test="floorNum !=null and floorNum != ''">
-            and f.floor_num = #{floorNum}
-        </if>
-        <if test="objName !=null and objName != ''">
-            and t.obj_name= #{objName}
-        </if>
-        <if test="feeYear !=null and feeYear != ''">
-            and t.fee_year= #{feeYear}
+        <if test="payerObjName !=null and payerObjName != ''">
+            and pfa3.value = #{payerObjName}
         </if>
-        <if test="feeMonth !=null and feeMonth != ''">
-            and t.fee_month= #{feeMonth}
+        <if test="ownerId !=null and ownerId != ''">
+            and pfa1.value = #{ownerId}
         </if>
         <if test="feeId !=null and feeId != ''">
-            and t.fee_id= #{feeId}
+            and pf.fee_id= #{feeId}
         </if>
         <if test="configId !=null and configId != ''">
-            and pfc.config_id= #{configId}
+            and pf.config_id= #{configId}
         </if>
         <if test="objId !=null and objId != ''">
             and pf.payer_obj_id = #{objId}
         </if>
         <if test="feeName !=null and feeName != ''">
-            and t.fee_name= #{feeName}
+            and pf.fee_name= #{feeName}
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -1817,7 +1683,7 @@
             and t.state = #{state}
         </if>
         <if test="feeTypeCd != null and feeTypeCd != ''">
-            and pfc.fee_type_cd = #{feeTypeCd}
+            and pf.fee_type_cd = #{feeTypeCd}
         </if>
         <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
@@ -1837,175 +1703,54 @@
         <if test="cashierName !=null and cashierName != ''">
             and t.cashier_name= #{cashierName}
         </if>
-        ) t
     </select>
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
-        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,br.built_up_area
-        builtUpArea ,oc.car_num carNum,
-        pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
-        t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
-        importFeeName,t.prime_rate,d.name primeRate,co.contract_code contractCode,pfo.`value` ownerName,t.pay_order_id
-        oId,
-        d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
-        t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'停车场',ps.num,'车位') psName,
-        fad.amount withholdAmount,t.cashier_id cashierId,t.cashier_name cashierName,t.payable_amount
-        payableAmount,pfc.fee_flag feeFlag,dt1.discountPrice discountPriceOne,dt1.discountSmallType
-        discountSmallTypeOne,
-        dt1.ruleName ruleNameOne,dt2.discountPrice discountPriceTwo,dt2.discountSmallType discountSmallTypeTwo,
-        dt2.ruleName ruleNameTwo,dt3.discountPrice discountPriceThree,dt3.discountSmallType discountSmallTypeThree,
-        dt3.ruleName ruleNameThree,dt4.discountPrice discountPriceFour,dt4.discountSmallType discountSmallTypeFour,
-        dt4.ruleName ruleNameFour,dt5.discountPrice discountPriceFive,dt5.discountSmallType discountSmallTypeFive,
-        dt5.ruleName ruleNameFive,dt6.discountPrice discountPriceSix,dt6.discountSmallType discountSmallTypeSix,
-        dt6.ruleName ruleNameSix
+        select pfc.fee_name feeName,pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time
+        endTime,t.create_time createTime,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
+        t.prime_rate,d.name primeRate,pfa2.`value` ownerName,t.pay_order_id oId,d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,
+        t.state,d3.name stateName,t.fee_id feeId,t.detail_id detailId,pf.payer_obj_id payerObjId,
+        t.cashier_id cashierId,t.cashier_name cashierName,t.payable_amount payableAmount,pfc.fee_flag feeFlag,
+        t.acct_amount acctAmount, t.discount_amount discountAmount, t.deduction_amount deductionAmount, t.late_amount lateAmount,
+        t.gift_amount giftAmount
         from pay_fee_detail t
         left JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         left join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
-        left join building_room br on pf.payer_obj_id = br.room_id and pf.payer_obj_type = '3333' and br.status_cd = '0'
-        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
-        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
-        left join owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
-        LEFT JOIN parking_space ps on oc.ps_id = ps.ps_id and ps.status_cd = '0'
-        left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
-        left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
-        left join pay_fee_attrs pfb on t.fee_id = pfb.fee_id and pfb.spec_cd = '390007'
-        left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
-        left join pay_fee_attrs pft on t.fee_id = pft.fee_id and pft.spec_cd = '390001'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt1
-        on t.detail_id = dt1.detailId and dt1.discountSmallType = '1'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt2
-        on t.detail_id = dt2.detailId and dt2.discountSmallType = '2'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt3
-        on t.detail_id = dt3.detailId and dt3.discountSmallType = '3'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt4
-        on t.detail_id = dt4.detailId and dt4.discountSmallType = '4'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt5
-        on t.detail_id = dt5.detailId and dt5.discountSmallType = '5'
-        left JOIN
-        (select t.detail_id detailId,t.receivable_amount receivableAmount,t.received_amount receivedAmount,
-        pfdd.discount_price discountPrice,fdr.discount_small_type discountSmallType,fdr.rule_name
-        ruleName
-        from pay_fee_detail t
-        left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
-        left join fee_discount fd on pfdd.discount_id = fd.discount_id and fd.status_cd = '0'
-        left join fee_discount_rule fdr on fd.rule_id = fdr.rule_id and fdr.status_cd = '0'
-        where 1=1
-        <if test="detailId !=null and detailId != ''">
-            and t.detail_id= #{detailId}
-        </if>
-        ) dt6
-        on t.detail_id = dt6.detailId and dt6.discountSmallType = '6'
-        left join t_dict d on t.prime_rate = d.status_cd and d.table_name="pay_fee_detail" and
-        d.table_columns="prime_rate"
-        left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = "pay_fee_config" and d2.table_columns
-        = "fee_type_cd"
-        left join t_dict d3 on t.state = d3.status_cd and d3.table_name = "pay_fee_detail" and d3.table_columns =
-        "state"
-        LEFT JOIN contract co on pf.payer_obj_id = co.contract_id and co.status_cd = '0' and pf.payer_obj_type='7777'
-        left join fee_account_detail fad on t.detail_id = fad.detail_id and t.community_id = fad.community_id and
-        fad.status_cd = '0' and fad.state = '1002'
+        <if test="ownerId != null and ownerId != ''">
+            left join pay_fee_attrs pfa1 on t.fee_id = pfa1.fee_id and pfa1.spec_cd = '390007'
+        </if>
+        left join pay_fee_attrs pfa2 on t.fee_id = pfa2.fee_id and pfa2.spec_cd = '390008'
+        left join pay_fee_attrs pfa3 on t.fee_id = pfa3.fee_id and pfa3.spec_cd = '390012'
+        left join t_dict d on t.prime_rate = d.status_cd and d.table_name='pay_fee_detail' and
+        d.table_columns='prime_rate'
+        left join t_dict d2 on pfc.fee_type_cd = d2.status_cd and d2.table_name = 'pay_fee_config' and d2.table_columns
+        = 'fee_type_cd'
+        left join t_dict d3 on t.state = d3.status_cd and d3.table_name = 'pay_fee_detail' and d3.table_columns =
+        'state'
         where t.status_cd = '0'
         and pf.status_cd = '0'
         and t.state != '1500'
         <if test="detailId !=null and detailId != ''">
             and t.detail_id= #{detailId}
         </if>
-        <if test="roomNum !=null and roomNum != ''">
-            and br.room_num= #{roomNum}
+        <if test="payerObjName !=null and payerObjName != ''">
+            and pfa3.value = #{payerObjName}
         </if>
-        <if test="unitId !=null and unitId != ''">
-            and bu.unit_id= #{unitId}
-        </if>
-        <if test="unitNum !=null and unitNum != ''">
-            and bu.unit_num= #{unitNum}
-        </if>
-        <if test="floorId !=null and floorId != ''">
-            and f.floor_id = #{floorId}
-        </if>
-        <if test="floorNum !=null and floorNum != ''">
-            and f.floor_num = #{floorNum}
-        </if>
-        <if test="objName !=null and objName != ''">
-            and t.obj_name= #{objName}
-        </if>
-        <if test="feeYear !=null and feeYear != ''">
-            and t.fee_year= #{feeYear}
-        </if>
-        <if test="feeMonth !=null and feeMonth != ''">
-            and t.fee_month= #{feeMonth}
+        <if test="ownerId !=null and ownerId != ''">
+            and pfa1.value = #{ownerId}
         </if>
         <if test="feeId !=null and feeId != ''">
-            and t.fee_id= #{feeId}
+            and pf.fee_id= #{feeId}
         </if>
         <if test="configId !=null and configId != ''">
-            and pfc.config_id= #{configId}
+            and pf.config_id= #{configId}
         </if>
         <if test="objId !=null and objId != ''">
             and pf.payer_obj_id = #{objId}
         </if>
         <if test="feeName !=null and feeName != ''">
-            and t.fee_name= #{feeName}
+            and pf.fee_name= #{feeName}
         </if>
         <if test="communityId !=null and communityId != ''">
             and t.community_id= #{communityId}
@@ -2017,7 +1762,7 @@
             and t.state = #{state}
         </if>
         <if test="feeTypeCd != null and feeTypeCd != ''">
-            and pfc.fee_type_cd = #{feeTypeCd}
+            and pf.fee_type_cd = #{feeTypeCd}
         </if>
         <if test="startTime !=null and startTime != ''">
             and t.create_time &gt;= #{startTime}
@@ -2330,12 +2075,12 @@
     <select id="queryPrePaymentCount" parameterType="Map" resultType="Map">
         select pfc.fee_name feeName, count(t.payer_obj_id) objCount
         from pay_fee t
-                 inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
         where t.state = '2008001'
-          and t.status_cd = '0'
-          and t.end_time &gt; #{startTime}
-          and t.end_time &lt; #{endTime}
-          and t.community_id = #{communityId}
+        and t.status_cd = '0'
+        and t.end_time &gt; #{startTime}
+        and t.end_time &lt; #{endTime}
+        and t.community_id = #{communityId}
         group by pfc.fee_name, pfc.config_id
         order by objCount
     </select>
@@ -2343,13 +2088,13 @@
     <select id="queryDeadlinePaymentCount" parameterType="Map" resultType="Map">
         SELECT t.fee_name feeName, count(t.obj_id) objCount
         FROM report_fee_month_statistics t
-                 inner join pay_fee pf on t.fee_id = pf.fee_id
-            and pf.community_id = t.community_id and pf.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id
+        and pf.community_id = t.community_id and pf.status_cd = '0'
         WHERE 1 = 1
-          AND t.status_cd = '0'
-          and t.community_id = #{communityId}
-          AND t.deadline_time &gt; #{startTime}
-          AND t.deadline_time &lt; #{endTime}
+        AND t.status_cd = '0'
+        and t.community_id = #{communityId}
+        AND t.deadline_time &gt; #{startTime}
+        AND t.deadline_time &lt; #{endTime}
         group by t.config_id, t.fee_name
         order by objCount desc
     </select>
@@ -2357,10 +2102,10 @@
     <select id="queryOwePaymentCount" parameterType="Map" resultType="Map">
         select t.fee_name feeName, count(distinct t.obj_id) objCount
         from report_fee_month_statistics t
-                 inner join pay_fee pf
-                            on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        inner join pay_fee pf
+        on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
         where t.community_id = #{communityId}
-          and t.owe_amount > 0
+        and t.owe_amount > 0
         group by t.config_id, t.fee_name
         order by objCount desc
     </select>
@@ -2368,26 +2113,26 @@
     <select id="queryAllPaymentCount" parameterType="Map" resultType="Map">
         select t.fee_name feeName, count(distinct t.obj_id) objCount
         from report_fee_month_statistics t
-                 inner join pay_fee pf
-                            on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        inner join pay_fee pf
+        on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
         where t.community_id = #{communityId}
         group by t.config_id, t.fee_name
         order by objCount desc
     </select>
 
     <select id="queryFinishOweFee" parameterType="Map" resultType="Map">
-        select t.config_id     configId,
-               t.fee_id        feeId,
-               t.statistics_id statisticsId,
-               t.fee_year      feeYear,
-               fee_month       feeMonth
+        select t.config_id configId,
+        t.fee_id feeId,
+        t.statistics_id statisticsId,
+        t.fee_year feeYear,
+        fee_month feeMonth
         from report_fee_month_statistics t
-                 inner join pay_fee pf
-                            on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
-                               pf.status_cd = '0'
+        inner join pay_fee pf
+        on t.fee_id = pf.fee_id and pf.state = '2009001' and pf.community_id = #{communityId} and
+        pf.status_cd = '0'
         where t.owe_amount > 0
-          and t.status_cd = '0'
-          and t.community_id = #{communityId} limit 100
+        and t.status_cd = '0'
+        and t.community_id = #{communityId} limit 100
     </select>
 
     <!-- 查询费用配置信息 add by wuxw 2018-07-03 -->
@@ -2619,79 +2364,79 @@
 
     <select id="getReceivableInformation" parameterType="Map" resultType="Map">
         select a.receivableAmount,
-               a.receivedAmount,
-               IF(a.receivableAmount &lt;
-                  a.oweReceivedAmount, '0', a.receivableAmount - a.oweReceivedAmount) oweAmount
+        a.receivedAmount,
+        IF(a.receivableAmount &lt;
+        a.oweReceivedAmount, '0', a.receivableAmount - a.oweReceivedAmount) oweAmount
         from (
-                 select sum(t.his_owe_amount + t.cur_receivable_amount)
-                                                                                                       receivableAmount,
-                        sum(t.cur_received_amount + t.his_owe_received_amount + t.pre_received_amount) receivedAmount,
-                        sum(t.cur_received_amount + t.his_owe_received_amount)                         oweReceivedAmount
-                 from report_fee_month_statistics t
-                          inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-                 where 1 = 1
-                   and t.fee_year = #{feeYear}
-                   and t.fee_month = #{feeMonth}
-                   and t.community_id = #{communityId}
-             ) a
+        select sum(t.his_owe_amount + t.cur_receivable_amount)
+        receivableAmount,
+        sum(t.cur_received_amount + t.his_owe_received_amount + t.pre_received_amount) receivedAmount,
+        sum(t.cur_received_amount + t.his_owe_received_amount) oweReceivedAmount
+        from report_fee_month_statistics t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        where 1 = 1
+        and t.fee_year = #{feeYear}
+        and t.fee_month = #{feeMonth}
+        and t.community_id = #{communityId}
+        ) a
     </select>
 
     <select id="getFloorReceivableInformation" parameterType="Map" resultType="Map">
         select a.floorNum,
-               a.`name`,
-               a.receivableAmount,
-               a.receivedAmount,
-               IF(a.receivableAmount &lt;
-                  a.oweReceivedAmount, '0', a.receivableAmount - a.oweReceivedAmount) oweAmount
+        a.`name`,
+        a.receivableAmount,
+        a.receivedAmount,
+        IF(a.receivableAmount &lt;
+        a.oweReceivedAmount, '0', a.receivableAmount - a.oweReceivedAmount) oweAmount
         from (
-                 select f.floor_num                                                                    floorNum,
-                        f.`name`,
-                        sum(t.his_owe_amount + t.cur_receivable_amount)
-                                                                                                       receivableAmount,
-                        sum(t.cur_received_amount + t.his_owe_received_amount + t.pre_received_amount) receivedAmount,
-                        sum(t.cur_received_amount + t.his_owe_received_amount)                         oweReceivedAmount
-                 from report_fee_month_statistics t
-                          inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-                          inner join building_room br
-                                     on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
-                                                                                          t.community_id and
-                                        br.status_cd = '0'
-                          inner join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
-                          inner join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
-                 where 1 = 1
-                   and t.fee_year = #{feeYear}
-                   and t.fee_month = #{feeMonth}
-                   and t.community_id = #{communityId}
-                 group by f.floor_num, f.`name`
-             ) a
+        select f.floor_num floorNum,
+        f.`name`,
+        sum(t.his_owe_amount + t.cur_receivable_amount)
+        receivableAmount,
+        sum(t.cur_received_amount + t.his_owe_received_amount + t.pre_received_amount) receivedAmount,
+        sum(t.cur_received_amount + t.his_owe_received_amount) oweReceivedAmount
+        from report_fee_month_statistics t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        inner join building_room br
+        on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
+        t.community_id and
+        br.status_cd = '0'
+        inner join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
+        inner join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
+        where 1 = 1
+        and t.fee_year = #{feeYear}
+        and t.fee_month = #{feeMonth}
+        and t.community_id = #{communityId}
+        group by f.floor_num, f.`name`
+        ) a
     </select>
 
     <select id="getFeeConfigReceivableInformation" parameterType="Map" resultType="Map">
         select a.feeName,
-               a.receivableAmount,
-               a.receivedAmount,
-               IF(a.receivableAmount &lt;
-                  a.oweReceivedAmount, '0', a.receivableAmount - a.oweReceivedAmount) oweAmount
+        a.receivableAmount,
+        a.receivedAmount,
+        IF(a.receivableAmount &lt;
+        a.oweReceivedAmount, '0', a.receivableAmount - a.oweReceivedAmount) oweAmount
         from (
-                 select t.fee_name                                                                     feeName,
-                        sum(t.his_owe_amount + t.cur_receivable_amount)
-                                                                                                       receivableAmount,
-                        sum(t.cur_received_amount + t.his_owe_received_amount + t.pre_received_amount) receivedAmount,
-                        sum(t.cur_received_amount + t.his_owe_received_amount)                         oweReceivedAmount
-                 from report_fee_month_statistics t
-                          inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
-                          left join building_room br
-                                    on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
-                                                                                         t.community_id and
-                                       br.status_cd = '0'
-                          left join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
-                          left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
-                 where 1 = 1
-                   and t.fee_year = #{feeYear}
-                   and t.fee_month = #{feeMonth}
-                   and t.community_id = #{communityId}
-                 group by t.fee_name
-             ) a
+        select t.fee_name feeName,
+        sum(t.his_owe_amount + t.cur_receivable_amount)
+        receivableAmount,
+        sum(t.cur_received_amount + t.his_owe_received_amount + t.pre_received_amount) receivedAmount,
+        sum(t.cur_received_amount + t.his_owe_received_amount) oweReceivedAmount
+        from report_fee_month_statistics t
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
+        left join building_room br
+        on br.room_id = t.obj_id and t.obj_type = '3333' and br.community_id =
+        t.community_id and
+        br.status_cd = '0'
+        left join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
+        left join f_floor f on f.floor_id = bu.floor_id and f.status_cd = '0'
+        where 1 = 1
+        and t.fee_year = #{feeYear}
+        and t.fee_month = #{feeMonth}
+        and t.community_id = #{communityId}
+        group by t.fee_name
+        ) a
     </select>
 
 
@@ -3027,8 +2772,8 @@
         select count(1) count
         from f_floor f
         where 1=1
-          and f.community_id = #{communityId}
-          and f.status_cd = '0'
+        and f.community_id = #{communityId}
+        and f.status_cd = '0'
     </select>
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
@@ -3156,12 +2901,12 @@
     <select id="queryHuaningPayFeeCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-            select t.floor_num
-            from f_floor t
-            where 1=1
-            and t.community_id= #{communityId}
-            GROUP BY t.floor_num
-            ) tt
+        select t.floor_num
+        from f_floor t
+        where 1=1
+        and t.community_id= #{communityId}
+        GROUP BY t.floor_num
+        ) tt
     </select>
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
@@ -3396,62 +3141,62 @@
     <select id="queryHuaningPayFeeTwoCount" parameterType="Map" resultType="Map">
         select count(1) count
         from (
-            select a.floorNum, d.receivableAmount,
-            a.receivedAmount, b.receivedAmount1,
-            c.receivedAmount2
-            from
-            (select t.floor_num floorNum, sum (pfd.received_amount) receivedAmount
-            from f_floor t
-            inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-            inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-            inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
-            inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-            where 1=1
-            and t.status_cd = '0'
-            and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
-            and t.community_id= #{communityId}
-            GROUP BY floor_num
-            ) a,
-            (select t.floor_num floorNum, SUM (pfdm1.discount_amount) receivedAmount1
-            from f_floor t
-            inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-            inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-            inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
-            inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-            LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
-            pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
-            where 1=1
-            and t.status_cd = '0'
-            and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
-            and t.community_id= #{communityId}
-            GROUP BY floor_num
-            ) b,
-            (select t.floor_num floorNum, SUM (pfdm2.received_amount) receivedAmount2
-            from f_floor t
-            inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-            inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-            inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
-            inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
-            LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
-            pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
-            where 1=1
-            and t.status_cd = '0'
-            and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
-            and t.community_id= #{communityId}
-            GROUP BY floor_num
-            ) c,
-            (select t.floor_num floorNum, SUM (rfms.owe_amount) receivableAmount
-            from f_floor t
-            inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
-            inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
-            inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
-            where t.community_id= #{communityId}
-            group by t.floor_num
-            ) d
-            where a.floorNum = b.floorNum
-            and b.floorNum = c.floorNum
-            and c.floorNum = d.floorNum
-            ) tt
+        select a.floorNum, d.receivableAmount,
+        a.receivedAmount, b.receivedAmount1,
+        c.receivedAmount2
+        from
+        (select t.floor_num floorNum, sum (pfd.received_amount) receivedAmount
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) a,
+        (select t.floor_num floorNum, SUM (pfdm1.discount_amount) receivedAmount1
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm1 on pf.fee_id = pfdm1.fee_id and pfd.detail_id = pfdm1.detail_id and
+        pfdm1.status_cd = '0' and pfdm1.detail_year = #{year} and pfdm1.detail_month &lt; #{month}
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) b,
+        (select t.floor_num floorNum, SUM (pfdm2.received_amount) receivedAmount2
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN pay_fee pf on pf.payer_obj_id = br.room_id and pf.status_cd = '0'
+        inner join pay_fee_detail pfd on pf.fee_id = pfd.fee_id and pfd.status_cd = '0'
+        LEFT JOIN pay_fee_detail_month pfdm2 on pf.fee_id = pfdm2.fee_id and pfd.detail_id = pfdm2.detail_id and
+        pfdm2.status_cd = '0' and pfdm2.detail_year = #{year} and pfdm2.detail_month &gt; #{month}
+        where 1=1
+        and t.status_cd = '0'
+        and DATE_FORMAT(pfd.create_time, '%Y-%m') = #{yearMonth}
+        and t.community_id= #{communityId}
+        GROUP BY floor_num
+        ) c,
+        (select t.floor_num floorNum, SUM (rfms.owe_amount) receivableAmount
+        from f_floor t
+        inner JOIN building_unit bu on t.floor_id = bu.floor_id and bu.status_cd = '0'
+        inner JOIN building_room br on br.unit_id = bu.unit_id and br.status_cd = '0'
+        inner JOIN report_fee_month_statistics rfms on rfms.obj_id = br.room_id and rfms.status_cd = '0'
+        where t.community_id= #{communityId}
+        group by t.floor_num
+        ) d
+        where a.floorNum = b.floorNum
+        and b.floorNum = c.floorNum
+        and c.floorNum = d.floorNum
+        ) tt
     </select>
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
@@ -3640,10 +3385,10 @@
     <select id="queryInvalidFeeMonthStatistics" parameterType="Map" resultType="Map">
         select t.fee_id feeId
         from pay_fee t
-                 inner join pay_fee_config pfc on t.config_id = pfc.config_id
-                 inner join report_fee_month_statistics rfms on t.fee_id = rfms.fee_id and rfms.status_cd = '0'
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id
+        inner join report_fee_month_statistics rfms on t.fee_id = rfms.fee_id and rfms.status_cd = '0'
         where (t.status_cd = '1' or pfc.status_cd = '1')
-          and t.community_id = #{communityId}
+        and t.community_id = #{communityId}
     </select>
 
     <!--清理报表 无效数据-->

+ 1 - 0
service-fee/src/main/java/com/java110/fee/cmd/fee/PayBatchFeeCmd.java

@@ -219,6 +219,7 @@ public class PayBatchFeeCmd extends Cmd {
          *         payFeeDetailPo.setPayableAmount(receivableAmount);
          */
         computeEndTimeCycleAmount(payFeeDataDto, payFeeDetailPo);
+        payFeeDetailPo.setAcctAmount(payFeeDataDto.getAcctAmount());
 
         //todo 缓存收据编号
         CommonCache.setValue(payFeeDetailPo.getDetailId() + CommonCache.RECEIPT_CODE, receiptCode, CommonCache.DEFAULT_EXPIRETIME_TWO_MIN);

+ 59 - 23
service-fee/src/main/java/com/java110/fee/cmd/fee/PayFeeCmd.java

@@ -120,6 +120,9 @@ public class PayFeeCmd extends Cmd {
     @Autowired
     private FeeReceiptInnerServiceSMOImpl feeReceiptInnerServiceSMOImpl;
 
+    @Autowired
+    private IFeeDiscountInnerServiceSMO feeDiscountInnerServiceSMOImpl;
+
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException {
         Assert.jsonObjectHaveKey(reqJson, "communityId", "请求报文中未包含communityId节点");
@@ -179,6 +182,8 @@ public class PayFeeCmd extends Cmd {
         for (int paramIndex = 0; paramIndex < params.size(); paramIndex++) {
             JSONObject param = params.getJSONObject(paramIndex);
             String maximumNumber = param.getString("maximumNumber");
+            Assert.hasKeyAndValue(param, "discountId", "未包含优惠ID");
+            Assert.hasKeyAndValue(param, "discountPrice", "未包含优惠金额");
         }
 
         //todo 是否按缴费时间段缴费
@@ -222,12 +227,13 @@ public class PayFeeCmd extends Cmd {
             //todo 缓存收据编号
             CommonCache.setValue(payFeeDetailPo.getDetailId() + CommonCache.RECEIPT_CODE, receiptCode, CommonCache.DEFAULT_EXPIRETIME_TWO_MIN);
 
-            //todo 判断是否有赠送规则
-            hasDiscount(paramObj, payFeePo, payFeeDetailPo);
+            //todo 判断是否有折扣规则
+            hasDiscount(paramObj, payFeePo, payFeeDetailPo,feeInfo);
 
             // todo 处理用户账户
             dealUserAccount(paramObj, payFeeDetailPo);
 
+
             String oId = Java110TransactionalFactory.getOId();
             if (StringUtil.isEmpty(oId)) {
                 oId = payFeeDetailPo.getDetailId();
@@ -235,7 +241,7 @@ public class PayFeeCmd extends Cmd {
 
             payFeeDetailPo.setPayOrderId(oId);
             // todo 如果 扫码枪支付 输入支付订单ID
-            if(!StringUtil.isEmpty(payOrderId)){
+            if (!StringUtil.isEmpty(payOrderId)) {
                 payFeeDetailPo.setPayOrderId(payOrderId);
             }
             payFeeDetailPo.setCashierId(userDtos.get(0).getUserId());
@@ -257,22 +263,14 @@ public class PayFeeCmd extends Cmd {
         } finally {
             DistributedLock.releaseDistributedLock(key, requestId);
         }
-        //账户处理
+        //todo 账户处理
         dealAccount(paramObj);
-        //折扣管理
-        if (paramObj.containsKey("selectDiscount")) {
-            JSONObject discountBusiness = null;
-            JSONArray selectDiscounts = paramObj.getJSONArray("selectDiscount");
-            for (int discountIndex = 0; discountIndex < selectDiscounts.size(); discountIndex++) {
-                JSONObject param = selectDiscounts.getJSONObject(discountIndex);
-                addPayFeeDetailDiscount(paramObj, param);
-            }
-        }
 
-        //为停车费单独处理
+
+        //todo 为停车费单独处理
         updateCarEndTime(paramObj);
 
-        //处理报修单
+        //todo 处理报修单
         doDealRepairOrder(paramObj);
 
 
@@ -302,7 +300,7 @@ public class PayFeeCmd extends Cmd {
     private void dealUserAccount(JSONObject paramObj, PayFeeDetailPo payFeeDetailPo) {
         //判断选择的账号
         JSONArray jsonArray = paramObj.getJSONArray("selectUserAccount");
-        if (jsonArray == null || jsonArray.size() < 1) {
+        if (ListUtil.isNull(jsonArray)) {
             return;
         }
 
@@ -395,6 +393,7 @@ public class PayFeeCmd extends Cmd {
                 BigDecimal receivedAmountDec = new BigDecimal(payFeeDetailPo.getReceivedAmount());
                 receivedAmountDec = receivedAmountDec.subtract(cashSum);
                 payFeeDetailPo.setReceivedAmount(receivedAmountDec.doubleValue() + "");
+                payFeeDetailPo.setAcctAmount(cashSum.doubleValue() + "");
             }
         }
     }
@@ -407,22 +406,23 @@ public class PayFeeCmd extends Cmd {
      * @param payFeeDetailPo
      * @throws ParseException
      */
-    private void hasDiscount(JSONObject paramObj, PayFeePo payFeePo, PayFeeDetailPo payFeeDetailPo) throws ParseException {
+    private void hasDiscount(JSONObject paramObj, PayFeePo payFeePo, PayFeeDetailPo payFeeDetailPo,FeeDto feeDto) throws ParseException {
         if (!paramObj.containsKey("selectDiscount")) {
             return;
         }
-        JSONArray selectDiscount = paramObj.getJSONArray("selectDiscount");
+        JSONArray selectDiscounts = paramObj.getJSONArray("selectDiscount");
 
-        if (selectDiscount == null || selectDiscount.size() < 1) {
+        if (ListUtil.isNull(selectDiscounts)) {
             return;
         }
-        for (int index = 0; index < selectDiscount.size(); index++) {
-            JSONObject paramJson = selectDiscount.getJSONObject(index);
+        Map feePriceMap = computeFeeSMOImpl.getFeePrice(feeDto);
+        for (int index = 0; index < selectDiscounts.size(); index++) {
+            JSONObject paramJson = selectDiscounts.getJSONObject(index);
             if (!"102020008".equals(paramJson.getString("ruleId"))) { //赠送规则
                 continue;
             }
             JSONArray feeDiscountSpecs = paramJson.getJSONArray("feeDiscountSpecs");
-            if (feeDiscountSpecs == null || feeDiscountSpecs.size() < 1) {
+            if (ListUtil.isNull(feeDiscountSpecs)) {
                 continue;
             }
             for (int specIndex = 0; specIndex < feeDiscountSpecs.size(); specIndex++) {
@@ -439,8 +439,18 @@ public class PayFeeCmd extends Cmd {
                 cal.add(Calendar.MONTH, Integer.parseInt(specValue));
                 payFeeDetailPo.setEndTime(df.format(cal.getTime()));
                 payFeePo.setEndTime(df.format(cal.getTime()));
+
+                BigDecimal value = new BigDecimal(payFeeDetailPo.getGiftAmount());
+                value = value.add(new BigDecimal(specValue).multiply(new BigDecimal((double)feePriceMap.get("feePrice"))));
+                payFeeDetailPo.setGiftAmount(value.doubleValue() + "");
             }
         }
+
+        for (int discountIndex = 0; discountIndex < selectDiscounts.size(); discountIndex++) {
+            JSONObject param = selectDiscounts.getJSONObject(discountIndex);
+            addPayFeeDetailDiscount(paramObj, param, payFeeDetailPo);
+        }
+
     }
 
     /**
@@ -655,7 +665,7 @@ public class PayFeeCmd extends Cmd {
      * @param paramInJson 接口调用放传入入参
      * @return 订单服务能够接受的报文
      */
-    public void addPayFeeDetailDiscount(JSONObject paramInJson, JSONObject discountJson) {
+    public void addPayFeeDetailDiscount(JSONObject paramInJson, JSONObject discountJson, PayFeeDetailPo payFeeDetailPo) {
         JSONObject businessFee = new JSONObject();
         businessFee.put("detailDiscountId", GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_detailDiscountId));
         businessFee.put("discountPrice", discountJson.getString("discountPrice"));
@@ -670,6 +680,32 @@ public class PayFeeCmd extends Cmd {
         if (fage < 1) {
             throw new CmdException("更新费用信息失败");
         }
+
+        FeeDiscountDto feeDiscountDto = new FeeDiscountDto();
+        feeDiscountDto.setDiscountId(discountJson.getString("discountId"));
+        List<FeeDiscountDto> feeDiscountDtos = feeDiscountInnerServiceSMOImpl.queryFeeDiscounts(feeDiscountDto);
+
+        if (ListUtil.isNull(feeDiscountDtos)) {
+            return;
+        }
+
+        //todo 打折或者空置房打折
+        if (FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_DISCOUNT.equals(feeDiscountDtos.get(0).getDiscountSmallType())
+                || FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_APPLY_DISCOUNT.equals(feeDiscountDtos.get(0).getDiscountSmallType())
+        ) {
+            BigDecimal value = new BigDecimal(payFeeDetailPo.getDiscountAmount());
+            value = value.add(new BigDecimal(discountJson.getString("discountPrice")));
+            payFeeDetailPo.setDiscountAmount(value.doubleValue() + "");
+        } else if (FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_DEDUCTION.equals(feeDiscountDtos.get(0).getDiscountSmallType())
+                || FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_APPLY_DEDUCTION.equals(feeDiscountDtos.get(0).getDiscountSmallType())) {
+            BigDecimal value = new BigDecimal(payFeeDetailPo.getDeductionAmount());
+            value = value.add(new BigDecimal(discountJson.getString("discountPrice")));
+            payFeeDetailPo.setDeductionAmount(value.doubleValue() + "");
+        } else if (FeeDiscountRuleDto.DISCOUNT_SMALL_TYPE_LATE.equals(feeDiscountDtos.get(0).getDiscountSmallType())) {
+            BigDecimal value = new BigDecimal(payFeeDetailPo.getLateAmount());
+            value = value.add(new BigDecimal(discountJson.getString("discountPrice")));
+            payFeeDetailPo.setLateAmount(value.doubleValue() + "");
+        }
     }
 
     /**

+ 3 - 0
service-fee/src/main/java/com/java110/fee/cmd/fee/PayOweFeeCmd.java

@@ -297,6 +297,9 @@ public class PayOweFeeCmd extends Cmd {
         if (!StringUtil.isEmpty(payOrderId)) {
             payFeeDetailPo.setPayOrderId(payOrderId);
         }
+        if (paramInJson.containsKey("accountAmount")) {
+            payFeeDetailPo.setAcctAmount(paramInJson.getString("accountAmount"));
+        }
 
         payFeeDetailPo.setCashierId(userDto.getUserId());
         payFeeDetailPo.setCashierName(userDto.getName());

+ 2 - 2
service-fee/src/main/java/com/java110/fee/dao/impl/FeeDetailServiceDaoImpl.java

@@ -88,9 +88,9 @@ public class FeeDetailServiceDaoImpl extends BaseServiceDao implements IFeeDetai
     public List<Map> getFeeDetailInfo(Map info) throws DAOException {
         logger.debug("查询费用明细信息 入参 info : {}",info);
 
-        List<Map> businessFeeDetailInfos = sqlSessionTemplate.selectList("feeDetailServiceDaoImpl.getFeeDetailInfo",info);
+        List<Map> infos = sqlSessionTemplate.selectList("feeDetailServiceDaoImpl.getFeeDetailInfo",info);
 
-        return businessFeeDetailInfos;
+        return infos;
     }
 
 

+ 14 - 1
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryPayFeeDetailCmd.java

@@ -7,14 +7,20 @@ import com.java110.core.event.cmd.Cmd;
 import com.java110.core.event.cmd.CmdEvent;
 import com.java110.dto.reportFee.ReportFeeMonthStatisticsDto;
 import com.java110.intf.fee.IFeeDetailInnerServiceSMO;
+import com.java110.intf.report.IQueryPayFeeDetailInnerServiceSMO;
 import com.java110.report.dao.IReportAttendanceServiceDao;
 import com.java110.utils.exception.CmdException;
 import com.java110.utils.util.Assert;
 import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
+import com.java110.vo.ResultVo;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
 
 import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
 
 /**
  * 缴费明细查询
@@ -25,7 +31,7 @@ import java.text.ParseException;
 public class QueryPayFeeDetailCmd extends Cmd {
 
     @Autowired
-    private IFeeDetailInnerServiceSMO feeDetailInnerServiceSMOImpl;
+    private IQueryPayFeeDetailInnerServiceSMO queryPayFeeDetailInnerServiceSMOImpl;
 
     @Override
     public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
@@ -41,6 +47,13 @@ public class QueryPayFeeDetailCmd extends Cmd {
         reportFeeMonthStatisticsDto.setFeeYear(DateUtil.getYear() + "");
         reportFeeMonthStatisticsDto.setFeeMonth(DateUtil.getMonth() + "");
 
+        ResultVo resultVo =queryPayFeeDetailInnerServiceSMOImpl.query(reportFeeMonthStatisticsDto);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+
+
 
 
     }

+ 8 - 7
service-report/src/main/java/com/java110/report/dao/impl/ReportFeeMonthStatisticsServiceDaoImpl.java

@@ -5,6 +5,7 @@ import com.java110.core.base.dao.BaseServiceDao;
 import com.java110.report.dao.IReportFeeMonthStatisticsServiceDao;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.DAOException;
+import com.java110.utils.util.ListUtil;
 import org.slf4j.Logger;
 import com.java110.core.log.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -449,9 +450,9 @@ public class ReportFeeMonthStatisticsServiceDaoImpl extends BaseServiceDao imple
     public List<Map> queryHuaningOweFeeDetail(Map info) {
         logger.debug("查询queryHuaningOweFeeDetail 入参 info : {}", info);
 
-        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryHuaningOweFeeDetail", info);
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryHuaningOweFeeDetail", info);
 
-        return businessReportFeeMonthStatisticsInfos;
+        return infos;
     }
 
 
@@ -459,21 +460,21 @@ public class ReportFeeMonthStatisticsServiceDaoImpl extends BaseServiceDao imple
     public Map queryPayFeeDetailCount(Map info) {
         logger.debug("查询费用月统计数据 入参 info : {}", info);
 
-        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryPayFeeDetailCount", info);
-        if (businessReportFeeMonthStatisticsInfos.size() < 1) {
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryPayFeeDetailCount", info);
+        if (ListUtil.isNull(infos)) {
             return null;
         }
 
-        return businessReportFeeMonthStatisticsInfos.get(0);
+        return infos.get(0);
     }
 
     @Override
     public List<Map> queryPayFeeDetail(Map info) throws DAOException {
         logger.debug("查询费用月统计信息 入参 info : {}", info);
 
-        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryPayFeeDetail", info);
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryPayFeeDetail", info);
 
-        return businessReportFeeMonthStatisticsInfos;
+        return infos;
     }
 
     @Override

+ 121 - 277
service-report/src/main/java/com/java110/report/smo/impl/QueryPayFeeDetailInnerServiceSMOImpl.java

@@ -6,20 +6,26 @@ import com.java110.dto.ReportFeeMonthStatisticsPrepaymentDto.ReportFeeMonthStati
 import com.java110.dto.ReportFeeMonthStatisticsPrepaymentDto.ReportFeeMonthStatisticsPrepaymentTotalDto;
 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.IRoomV1InnerServiceSMO;
 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;
@@ -27,6 +33,7 @@ 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;
 
@@ -56,302 +63,139 @@ public class QueryPayFeeDetailInnerServiceSMOImpl implements IQueryPayFeeDetailI
     @Autowired
     private IFeeDetailInnerServiceSMO feeDetailInnerServiceSMOImpl;
 
+    @Autowired
+    private IRoomV1InnerServiceSMO roomV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IOwnerCarInnerServiceSMO ownerCarInnerServiceSMOImpl;
+
+    /**
+     * 查询缴费明细
+     *
+     * @param reportFeeMonthStatisticsDto
+     * @return
+     */
     @Override
     public ResultVo query(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
-        JSONObject countInfo = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetailCount(reportFeeMonthStatisticsDto);
 
+        JSONObject countInfo = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetailCount(reportFeeMonthStatisticsDto);
         int count = Integer.parseInt(countInfo.get("count").toString());
-
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         ReportFeeMonthStatisticsTotalDto reportFeeMonthStatisticsTotalDto = new ReportFeeMonthStatisticsTotalDto();
-        List<ReportFeeMonthStatisticsDto> reportList = new ArrayList<>();
-        //应收总金额(大计)
-        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;
-        //吴学文 注释 感觉和上面的369 功能重复
-        //int size = 0;
-        if (count > 0) {
-            //查询缴费明细
-            reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto);
-            //查询应收、实收总金额(大计)
-            List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllPayFeeDetail(reportFeeMonthStatisticsDto);
-            //查询(优惠、减免、滞纳金、空置房打折、空置房减免金额等)大计总金额
-            List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsSum = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetailSum(reportFeeMonthStatisticsDto);
-            allReceivableAmount = Double.valueOf(reportFeeMonthStatisticsList.get(0).getAllReceivableAmount());
-            allReceivedAmount = Double.valueOf(reportFeeMonthStatisticsList.get(0).getAllReceivedAmount());
-            for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsSum) {
-                //这里是查询出的金额总和
-                String discountPrice = reportFeeMonthStatistics.getDiscountPrice();
-                //优惠金额(大计)
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("1")) {
-//                    allPreferentialAmount = Double.valueOf(discountPrice);
-                    Double aDouble = Double.valueOf(discountPrice);
-                    allPreferentialAmount = allPreferentialAmount + aDouble;
-                }
-                //减免金额(大计)
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("2")) {
-                    //allDeductionAmount = Double.valueOf(discountPrice);
-                    Double aDouble = Double.valueOf(discountPrice);
-                    allDeductionAmount = allDeductionAmount + aDouble;
-                }
-                //滞纳金(大计)
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("3")) {
-//                    allLateFee = Double.valueOf(discountPrice);
-                    Double aDouble = Double.valueOf(discountPrice);
-                    allLateFee = allLateFee + aDouble;
-                }
-                //空置房打折金额(大计)
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("4")) {
-//                    allVacantHousingDiscount = Double.valueOf(discountPrice);
-                    Double aDouble = Double.valueOf(discountPrice);
-                    allVacantHousingDiscount = allVacantHousingDiscount + aDouble;
-                }
-                //空置房减免金额(大计)
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("5")) {
-//                    allVacantHousingReduction = Double.valueOf(discountPrice);
-                    Double aDouble = Double.valueOf(discountPrice);
-                    allVacantHousingReduction = allVacantHousingReduction + aDouble;
-                }
-                //赠送金额(大计)
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("6")) {
-//                    allGiftAmount = Double.valueOf(discountPrice);
-                    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;
-            List<String> ownerIds = new ArrayList<>();
-            for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
-                //应收金额
-                Double receivableAmount = Double.valueOf(reportFeeMonthStatistics.getReceivableAmount());
-                //实收金额
-                Double receivedAmount = Double.valueOf(reportFeeMonthStatistics.getReceivedAmount());
-                totalReceivableAmount = totalReceivableAmount + receivableAmount;
-                totalReceivedAmount = totalReceivedAmount + receivedAmount;
+        ResultVo resultVo = null;
+        if (count < 1) {
+            resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos, reportFeeMonthStatisticsTotalDto);
+            return resultVo;
+        }
 
-                if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(reportFeeMonthStatistics.getPayerObjType())) {
-                    ownerIds.add(reportFeeMonthStatistics.getOwnerId());
-                }
+        //todo 查询缴费明细
+        reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto);
 
-                // 最大记录时 就去刷新
-                //如果是车位刷房屋信息
-                if (ownerIds.size() == MAX_ROWS) {
-                    refreshReportFeeMonthStatistics(ownerIds, reportFeeMonthStatisticsDtos);
-                    ownerIds = new ArrayList<>();
-                }
+        //todo 应收金额(大计)
+        reportFeeMonthStatisticsTotalDto.setAllReceivableAmount(String.format("%.2f", countInfo.getDouble("totalReceivableAmount")));
+        //todo 实收金额(大计)
+        reportFeeMonthStatisticsTotalDto.setAllReceivedAmount(String.format("%.2f", countInfo.getDouble("totalReceivedAmount")));
 
-                //优惠金额
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallTypeOne()) && reportFeeMonthStatistics.getDiscountSmallTypeOne().equals("1")) {
-                    //获取优惠金额
-                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPriceOne());
-                    totalPreferentialAmount = totalPreferentialAmount + discountPrice;
-                    //优惠金额
-                    reportFeeMonthStatistics.setPreferentialAmount(reportFeeMonthStatistics.getDiscountPriceOne());
-                } else {
-                    reportFeeMonthStatistics.setPreferentialAmount("0");
-                }
-                //减免金额
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallTypeTwo()) && reportFeeMonthStatistics.getDiscountSmallTypeTwo().equals("2")) {
-                    //获取减免金额
-                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPriceTwo());
-                    totalDeductionAmount = totalDeductionAmount + discountPrice;
-                    //减免金额
-                    reportFeeMonthStatistics.setDeductionAmount(reportFeeMonthStatistics.getDiscountPriceTwo());
-                } else {
-                    reportFeeMonthStatistics.setDeductionAmount("0");
-                }
-                //滞纳金
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallTypeThree()) && reportFeeMonthStatistics.getDiscountSmallTypeThree().equals("3")) {
-                    //获取滞纳金金额
-                    Double discountPrice = (Double.valueOf(reportFeeMonthStatistics.getDiscountPriceThree()));
-                    totalLateFee = totalLateFee + discountPrice;
-                    //滞纳金
-                    reportFeeMonthStatistics.setLateFee(reportFeeMonthStatistics.getDiscountPriceThree());
-                } else {
-                    reportFeeMonthStatistics.setLateFee("0");
-                }
-                //空置房打折
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallTypeFour()) && reportFeeMonthStatistics.getDiscountSmallTypeFour().equals("4")) {
-                    //空置房打折金额
-                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPriceFour());
-                    totalVacantHousingDiscount = totalVacantHousingDiscount + discountPrice;
-                    //空置房打折
-                    reportFeeMonthStatistics.setVacantHousingDiscount(reportFeeMonthStatistics.getDiscountPriceFour());
-                } else {
-                    reportFeeMonthStatistics.setVacantHousingDiscount("0");
-                }
-                //空置房减免
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallTypeFive()) && reportFeeMonthStatistics.getDiscountSmallTypeFive().equals("5")) {
-                    //空置房减免金额
-                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPriceFive());
-                    totalVacantHousingReduction = totalVacantHousingReduction + discountPrice;
-                    //空置房减免
-                    reportFeeMonthStatistics.setVacantHousingReduction(reportFeeMonthStatistics.getDiscountPriceFive());
-                } else {
-                    reportFeeMonthStatistics.setVacantHousingReduction("0");
-                }
-                //赠送金额
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallTypeSix()) && reportFeeMonthStatistics.getDiscountSmallTypeSix().equals("6")) {
-                    //赠送金额
-                    Double discountPrice = Double.valueOf(reportFeeMonthStatistics.getDiscountPriceSix());
-                    totalGiftAmount = totalGiftAmount + discountPrice;
-                    //赠送金额
-                    reportFeeMonthStatistics.setGiftAmount(reportFeeMonthStatistics.getDiscountPriceSix());
-                } else {
-                    reportFeeMonthStatistics.setGiftAmount("0");
-                }
-                if (FeeDto.PAYER_OBJ_TYPE_ROOM.equals(reportFeeMonthStatistics.getPayerObjType())) {
-                    reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getFloorNum()
-                            + "栋" + reportFeeMonthStatistics.getUnitNum()
-                            + "单元" + reportFeeMonthStatistics.getRoomNum() + "室");
-                } else if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(reportFeeMonthStatistics.getPayerObjType())) {
-                    reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getCarNum());
-                } else {
-                    reportFeeMonthStatistics.setObjName(reportFeeMonthStatistics.getContractCode());
+        //todo 打折金额(大计)
+        reportFeeMonthStatisticsTotalDto.setAllPreferentialAmount(String.format("%.2f", countInfo.getDouble("discountAmount")));
 
-                }
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getImportFeeName())) {
-                    reportFeeMonthStatistics.setFeeName(reportFeeMonthStatistics.getImportFeeName());
-                }
-                if (!StringUtil.isEmpty(reportFeeMonthStatistics.getRepairId())) {
-                    RepairDto repairDto = new RepairDto();
-                    repairDto.setRepairId(reportFeeMonthStatistics.getRepairId());
-                    //查询报修单
-                    List<RepairDto> repairDtos = repairInnerServiceSMOImpl.queryRepairs(repairDto);
-                    //Assert.listOnlyOne(repairDtos, "查询报修单错误!");
-                    if (repairDtos != null && repairDtos.size() == 1) {
-                        if (!StringUtil.isEmpty(repairDtos.get(0).getRepairObjType()) && repairDtos.get(0).getRepairObjType().equals("004")) {
-                            OwnerRoomRelDto ownerRoomRelDto = new OwnerRoomRelDto();
-                            ownerRoomRelDto.setRoomId(repairDtos.get(0).getRepairObjId());
-                            List<OwnerRoomRelDto> ownerRoomRelDtos = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRelDto);
-                            if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() == 0) { //查询条数为0条
-                                OwnerRoomRelDto ownerRoomRel = new OwnerRoomRelDto();
-                                ownerRoomRel.setRoomId(repairDtos.get(0).getRepairObjId());
-                                ownerRoomRel.setStatusCd("1"); //看看业主房屋关系数据是否删除了
-                                List<OwnerRoomRelDto> ownerRoomRels = ownerRoomRelInnerServiceSMOImpl.queryOwnerRoomRels(ownerRoomRel);
-                                Assert.listOnlyOne(ownerRoomRels, "查询业主房屋关系表错误!");
-                                OwnerDto owner = new OwnerDto();
-                                owner.setOwnerId(ownerRoomRels.get(0).getOwnerId());
-                                owner.setOwnerTypeCd("1001"); //业主本人
-                                List<OwnerDto> owners = ownerInnerServiceSMOImpl.queryOwners(owner);
-                                if (owners != null && owners.size() == 0) { //查出条数为0条
-                                    //判断业主是否删除了
-                                    OwnerDto newOwner = new OwnerDto();
-                                    newOwner.setOwnerId(ownerRoomRels.get(0).getOwnerId());
-                                    newOwner.setOwnerTypeCd("1001"); //业主本人
-                                    newOwner.setStatusCd("1");
-                                    List<OwnerDto> newOwners = ownerInnerServiceSMOImpl.queryOwners(newOwner);
-                                    Assert.listOnlyOne(newOwners, "查询业主信息错误!");
-                                    reportFeeMonthStatistics.setOwnerName(newOwners.get(0).getName());
-                                } else if (owners != null && owners.size() == 1) { //查出条数为1条
-                                    reportFeeMonthStatistics.setOwnerName(owners.get(0).getName());
-                                } else {
-                                    throw new IllegalArgumentException("查询业主信息错误!");
-                                }
-                            } else if (ownerRoomRelDtos != null && ownerRoomRelDtos.size() == 1) { //查询条数为1条
-                                OwnerDto ownerDto = new OwnerDto();
-                                ownerDto.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
-                                ownerDto.setOwnerTypeCd("1001"); //业主本人
-                                List<OwnerDto> ownerDtos = ownerInnerServiceSMOImpl.queryOwners(ownerDto);
-                                if (ownerDtos != null && ownerDtos.size() == 0) { //业主查询条数为0条
-                                    //判断业主是否删除了
-                                    OwnerDto newOwner = new OwnerDto();
-                                    newOwner.setOwnerId(ownerRoomRelDtos.get(0).getOwnerId());
-                                    newOwner.setOwnerTypeCd("1001"); //业主本人
-                                    newOwner.setStatusCd("1");
-                                    List<OwnerDto> newOwners = ownerInnerServiceSMOImpl.queryOwners(newOwner);
-                                    Assert.listOnlyOne(newOwners, "查询业主信息错误!");
-                                    reportFeeMonthStatistics.setOwnerName(newOwners.get(0).getName());
-                                } else if (ownerDtos != null || ownerDtos.size() == 1) {
-                                    reportFeeMonthStatistics.setOwnerName(ownerDtos.get(0).getName());
-                                } else {
-                                    throw new IllegalArgumentException("查询业主信息错误!");
-                                }
-                            } else {
-                                throw new IllegalArgumentException("查询业主房屋关系表错误!");
-                            }
-                        }
+        //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());
                     }
                 }
-                if (!hasInReportListAndMerge(reportList, reportFeeMonthStatistics)) {
-                    reportList.add(reportFeeMonthStatistics);
-                }
             }
+        }
 
-            //如果是车位刷房屋信息
-            if (ownerIds.size() > 0) {
-                refreshReportFeeMonthStatistics(ownerIds, reportFeeMonthStatisticsDtos);
+        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)){
+            for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
+                for(OwnerCarDto tmpOwnerCarDto: ownerCarDtos){
+                    if(reportFeeMonthStatisticsDto.getPayerObjId().equals(tmpOwnerCarDto.getMemberId())){
+                        reportFeeMonthStatisticsDto.setPsName(tmpOwnerCarDto.getAreaNum()+"-"+tmpOwnerCarDto.getNum());
+                    }
+                }
             }
+        }
 
-            //应收总金额(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount));
-            //实收金额(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount));
-            //优惠金额(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalPreferentialAmount(String.format("%.2f", totalPreferentialAmount));
-            //减免金额(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalDeductionAmount(String.format("%.2f", totalDeductionAmount));
-            //滞纳金(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalLateFee(String.format("%.2f", totalLateFee));
-            //空置房打折(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalVacantHousingDiscount(String.format("%.2f", totalVacantHousingDiscount));
-            //空置房减免(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalVacantHousingReduction(String.format("%.2f", totalVacantHousingReduction));
-            //赠送规则金额(小计)
-            reportFeeMonthStatisticsTotalDto.setTotalGiftAmount(String.format("%.2f", totalGiftAmount));
-            //应收金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllReceivableAmount(String.format("%.2f", allReceivableAmount));
-            //实收金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllReceivedAmount(String.format("%.2f", allReceivedAmount));
-            //优惠金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllPreferentialAmount(String.format("%.2f", allPreferentialAmount));
-            //减免金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllDeductionAmount(String.format("%.2f", allDeductionAmount));
-            //滞纳金(大计)
-            reportFeeMonthStatisticsTotalDto.setAllLateFee(String.format("%.2f", allLateFee));
-            //空置房打折金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllVacantHousingDiscount(String.format("%.2f", allVacantHousingDiscount));
-            //空置房减免金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllVacantHousingReduction(String.format("%.2f", allVacantHousingReduction));
-            //赠送规则金额(大计)
-            reportFeeMonthStatisticsTotalDto.setAllGiftAmount(String.format("%.2f", allGiftAmount));
-        } else {
-            reportFeeMonthStatisticsDtos = new ArrayList<>();
-            reportList.addAll(reportFeeMonthStatisticsDtos);
-            reportFeeMonthStatisticsTotalDto = new ReportFeeMonthStatisticsTotalDto();
+    }
+
+    /**
+     * 计算大计小计
+     *
+     * @param reportFeeMonthStatisticsTotalDto
+     */
+    private void computeTotalInfo(ReportFeeMonthStatisticsTotalDto reportFeeMonthStatisticsTotalDto,
+                                  List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
+
+        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) {
+            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());
         }
 
-        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportList, reportFeeMonthStatisticsTotalDto);
+        //todo 实收金额(小计)
+        reportFeeMonthStatisticsTotalDto.setTotalReceivedAmount(String.format("%.2f", totalReceivedAmount.doubleValue()));
+        //优惠金额(小计)
+        reportFeeMonthStatisticsTotalDto.setTotalPreferentialAmount(String.format("%.2f", totalPreferentialAmount));
+        //减免金额(小计)
+        reportFeeMonthStatisticsTotalDto.setTotalDeductionAmount(String.format("%.2f", totalDeductionAmount));
+        //滞纳金(小计)
+        reportFeeMonthStatisticsTotalDto.setTotalLateFee(String.format("%.2f", totalLateFee));
 
-        return resultVo;
     }
 
     @Override