Przeglądaj źródła

modify pay fee month

java110 2 lat temu
rodzic
commit
fdaa6e8aa5

+ 2 - 0
java110-bean/src/main/java/com/java110/dto/fee/FeeDto.java

@@ -748,4 +748,6 @@ public class FeeDto extends PageDto implements Serializable {
     public void setUserName(String userName) {
     public void setUserName(String userName) {
         this.userName = userName;
         this.userName = userName;
     }
     }
+
+
 }
 }

+ 116 - 28
java110-bean/src/main/java/com/java110/dto/payFeeDetailMonth/PayFeeDetailMonthDto.java

@@ -1,6 +1,7 @@
 package com.java110.dto.payFeeDetailMonth;
 package com.java110.dto.payFeeDetailMonth;
 
 
 import com.java110.dto.PageDto;
 import com.java110.dto.PageDto;
+
 import java.io.Serializable;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -14,81 +15,112 @@ import java.util.Date;
  **/
  **/
 public class PayFeeDetailMonthDto extends PageDto implements Serializable {
 public class PayFeeDetailMonthDto extends PageDto implements Serializable {
 
 
+    public static final String STATE_W = "W";//待缴费
+    public static final String STATE_C = "C";//已缴费
+    public static final String STATE_R = "R";//已退费
+
     private String detailMonth;
     private String detailMonth;
-private String detailYear;
-private String detailId;
-private String receivableAmount;
-private String discountAmount;
-private String remark;
-private String receivedAmount;
-private String communityId;
-private String feeId;
-private String monthId;
+    private String detailYear;
+    private String detailId;
+    private String receivableAmount;
+    private String discountAmount;
+    private String remark;
+    private String receivedAmount;
+    private String communityId;
+    private String feeId;
+    private String monthId;
 
 
 
 
     private Date createTime;
     private Date createTime;
 
 
     private String statusCd = "0";
     private String statusCd = "0";
 
 
+    private String objName;
+    private String objId;
+    private String ownerName;
+    private String ownerId;
+    private String link;
+    private String state;
+    private String payFeeTime;
+
 
 
     public String getDetailMonth() {
     public String getDetailMonth() {
         return detailMonth;
         return detailMonth;
     }
     }
-public void setDetailMonth(String detailMonth) {
+
+    public void setDetailMonth(String detailMonth) {
         this.detailMonth = detailMonth;
         this.detailMonth = detailMonth;
     }
     }
-public String getDetailYear() {
+
+    public String getDetailYear() {
         return detailYear;
         return detailYear;
     }
     }
-public void setDetailYear(String detailYear) {
+
+    public void setDetailYear(String detailYear) {
         this.detailYear = detailYear;
         this.detailYear = detailYear;
     }
     }
-public String getDetailId() {
+
+    public String getDetailId() {
         return detailId;
         return detailId;
     }
     }
-public void setDetailId(String detailId) {
+
+    public void setDetailId(String detailId) {
         this.detailId = detailId;
         this.detailId = detailId;
     }
     }
-public String getReceivableAmount() {
+
+    public String getReceivableAmount() {
         return receivableAmount;
         return receivableAmount;
     }
     }
-public void setReceivableAmount(String receivableAmount) {
+
+    public void setReceivableAmount(String receivableAmount) {
         this.receivableAmount = receivableAmount;
         this.receivableAmount = receivableAmount;
     }
     }
-public String getDiscountAmount() {
+
+    public String getDiscountAmount() {
         return discountAmount;
         return discountAmount;
     }
     }
-public void setDiscountAmount(String discountAmount) {
+
+    public void setDiscountAmount(String discountAmount) {
         this.discountAmount = discountAmount;
         this.discountAmount = discountAmount;
     }
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
         return remark;
     }
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
         this.remark = remark;
     }
     }
-public String getReceivedAmount() {
+
+    public String getReceivedAmount() {
         return receivedAmount;
         return receivedAmount;
     }
     }
-public void setReceivedAmount(String receivedAmount) {
+
+    public void setReceivedAmount(String receivedAmount) {
         this.receivedAmount = receivedAmount;
         this.receivedAmount = receivedAmount;
     }
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
         return communityId;
     }
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
         this.communityId = communityId;
     }
     }
-public String getFeeId() {
+
+    public String getFeeId() {
         return feeId;
         return feeId;
     }
     }
-public void setFeeId(String feeId) {
+
+    public void setFeeId(String feeId) {
         this.feeId = feeId;
         this.feeId = feeId;
     }
     }
-public String getMonthId() {
+
+    public String getMonthId() {
         return monthId;
         return monthId;
     }
     }
-public void setMonthId(String monthId) {
+
+    public void setMonthId(String monthId) {
         this.monthId = monthId;
         this.monthId = monthId;
     }
     }
 
 
@@ -108,4 +140,60 @@ public void setMonthId(String monthId) {
     public void setStatusCd(String statusCd) {
     public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
+
+    public String getObjName() {
+        return objName;
+    }
+
+    public void setObjName(String objName) {
+        this.objName = objName;
+    }
+
+    public String getObjId() {
+        return objId;
+    }
+
+    public void setObjId(String objId) {
+        this.objId = objId;
+    }
+
+    public String getOwnerName() {
+        return ownerName;
+    }
+
+    public void setOwnerName(String ownerName) {
+        this.ownerName = ownerName;
+    }
+
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
+
+    public String getPayFeeTime() {
+        return payFeeTime;
+    }
+
+    public void setPayFeeTime(String payFeeTime) {
+        this.payFeeTime = payFeeTime;
+    }
 }
 }

+ 67 - 0
java110-bean/src/main/java/com/java110/dto/payFeeDetailMonth/PayFeeMonthOwnerDto.java

@@ -0,0 +1,67 @@
+package com.java110.dto.payFeeDetailMonth;
+
+import java.io.Serializable;
+
+/**
+ * 缴费月业主数据封装
+ * 主要包括:
+ * 房屋,合同 ,车辆
+ * 业主信息
+ * add by wuxw
+ */
+public class PayFeeMonthOwnerDto implements Serializable {
+    private String objName;
+    private String objId;
+    private String ownerName;
+    private String ownerId;
+    private String link;
+    private String payFeeTime;
+
+    public String getObjName() {
+        return objName;
+    }
+
+    public void setObjName(String objName) {
+        this.objName = objName;
+    }
+
+    public String getObjId() {
+        return objId;
+    }
+
+    public void setObjId(String objId) {
+        this.objId = objId;
+    }
+
+    public String getOwnerName() {
+        return ownerName;
+    }
+
+    public void setOwnerName(String ownerName) {
+        this.ownerName = ownerName;
+    }
+
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    public String getPayFeeTime() {
+        return payFeeTime;
+    }
+
+    public void setPayFeeTime(String payFeeTime) {
+        this.payFeeTime = payFeeTime;
+    }
+}

+ 116 - 32
java110-bean/src/main/java/com/java110/po/payFeeDetailMonth/PayFeeDetailMonthPo.java

@@ -6,83 +6,167 @@ import java.util.Date;
 public class PayFeeDetailMonthPo implements Serializable {
 public class PayFeeDetailMonthPo implements Serializable {
 
 
     private String detailMonth;
     private String detailMonth;
-private String detailYear;
-private String detailId;
-private String receivableAmount;
-private String discountAmount;
-private String remark;
-private String statusCd = "0";
-private String receivedAmount;
-private String communityId;
-private String feeId;
-private String monthId;
-public String getDetailMonth() {
+    private String detailYear;
+    private String detailId;
+    private String receivableAmount;
+    private String discountAmount;
+    private String remark;
+    private String statusCd = "0";
+    private String receivedAmount;
+    private String communityId;
+    private String feeId;
+    private String monthId;
+
+    private String objName;
+    private String objId;
+    private String ownerName;
+    private String ownerId;
+    private String link;
+    private String state;
+    private String payFeeTime;
+
+
+    public String getDetailMonth() {
         return detailMonth;
         return detailMonth;
     }
     }
-public void setDetailMonth(String detailMonth) {
+
+    public void setDetailMonth(String detailMonth) {
         this.detailMonth = detailMonth;
         this.detailMonth = detailMonth;
     }
     }
-public String getDetailYear() {
+
+    public String getDetailYear() {
         return detailYear;
         return detailYear;
     }
     }
-public void setDetailYear(String detailYear) {
+
+    public void setDetailYear(String detailYear) {
         this.detailYear = detailYear;
         this.detailYear = detailYear;
     }
     }
-public String getDetailId() {
+
+    public String getDetailId() {
         return detailId;
         return detailId;
     }
     }
-public void setDetailId(String detailId) {
+
+    public void setDetailId(String detailId) {
         this.detailId = detailId;
         this.detailId = detailId;
     }
     }
-public String getReceivableAmount() {
+
+    public String getReceivableAmount() {
         return receivableAmount;
         return receivableAmount;
     }
     }
-public void setReceivableAmount(String receivableAmount) {
+
+    public void setReceivableAmount(String receivableAmount) {
         this.receivableAmount = receivableAmount;
         this.receivableAmount = receivableAmount;
     }
     }
-public String getDiscountAmount() {
+
+    public String getDiscountAmount() {
         return discountAmount;
         return discountAmount;
     }
     }
-public void setDiscountAmount(String discountAmount) {
+
+    public void setDiscountAmount(String discountAmount) {
         this.discountAmount = discountAmount;
         this.discountAmount = discountAmount;
     }
     }
-public String getRemark() {
+
+    public String getRemark() {
         return remark;
         return remark;
     }
     }
-public void setRemark(String remark) {
+
+    public void setRemark(String remark) {
         this.remark = remark;
         this.remark = remark;
     }
     }
-public String getStatusCd() {
+
+    public String getStatusCd() {
         return statusCd;
         return statusCd;
     }
     }
-public void setStatusCd(String statusCd) {
+
+    public void setStatusCd(String statusCd) {
         this.statusCd = statusCd;
         this.statusCd = statusCd;
     }
     }
-public String getReceivedAmount() {
+
+    public String getReceivedAmount() {
         return receivedAmount;
         return receivedAmount;
     }
     }
-public void setReceivedAmount(String receivedAmount) {
+
+    public void setReceivedAmount(String receivedAmount) {
         this.receivedAmount = receivedAmount;
         this.receivedAmount = receivedAmount;
     }
     }
-public String getCommunityId() {
+
+    public String getCommunityId() {
         return communityId;
         return communityId;
     }
     }
-public void setCommunityId(String communityId) {
+
+    public void setCommunityId(String communityId) {
         this.communityId = communityId;
         this.communityId = communityId;
     }
     }
-public String getFeeId() {
+
+    public String getFeeId() {
         return feeId;
         return feeId;
     }
     }
-public void setFeeId(String feeId) {
+
+    public void setFeeId(String feeId) {
         this.feeId = feeId;
         this.feeId = feeId;
     }
     }
-public String getMonthId() {
+
+    public String getMonthId() {
         return monthId;
         return monthId;
     }
     }
-public void setMonthId(String monthId) {
+
+    public void setMonthId(String monthId) {
         this.monthId = monthId;
         this.monthId = monthId;
     }
     }
 
 
+    public String getObjName() {
+        return objName;
+    }
 
 
+    public void setObjName(String objName) {
+        this.objName = objName;
+    }
+
+    public String getObjId() {
+        return objId;
+    }
+
+    public void setObjId(String objId) {
+        this.objId = objId;
+    }
+
+    public String getOwnerName() {
+        return ownerName;
+    }
+
+    public void setOwnerName(String ownerName) {
+        this.ownerName = ownerName;
+    }
+
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    public String getLink() {
+        return link;
+    }
+
+    public void setLink(String link) {
+        this.link = link;
+    }
+
+    public String getState() {
+        return state;
+    }
+
+    public void setState(String state) {
+        this.state = state;
+    }
 
 
+    public String getPayFeeTime() {
+        return payFeeTime;
+    }
+
+    public void setPayFeeTime(String payFeeTime) {
+        this.payFeeTime = payFeeTime;
+    }
 }
 }

+ 67 - 15
java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml

@@ -4,7 +4,6 @@
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="payFeeDetailMonthServiceDaoImpl">
 <mapper namespace="payFeeDetailMonthServiceDaoImpl">
 
 
-
     <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
     <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
     <insert id="savePayFeeDetailMonthInfo" parameterType="Map">
     <insert id="savePayFeeDetailMonthInfo" parameterType="Map">
         insert into pay_fee_detail_month(
         insert into pay_fee_detail_month(
@@ -17,25 +16,25 @@
     <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
     <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
     <insert id="savePayFeeDetailMonthInfos" parameterType="Map">
     <insert id="savePayFeeDetailMonthInfos" parameterType="Map">
         insert into pay_fee_detail_month(
         insert into pay_fee_detail_month(
-        detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id
+        detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id,
+        obj_name,obj_id,owner_name,owner_id,link,state,pay_fee_time
         ) values
         ) values
         <foreach collection="payFeeDetailMonthPos" item="item" index="index" separator=",">
         <foreach collection="payFeeDetailMonthPos" item="item" index="index" separator=",">
             (
             (
             #{item.detailMonth},#{item.detailYear},#{item.detailId},#{item.receivableAmount},#{item.discountAmount},
             #{item.detailMonth},#{item.detailYear},#{item.detailId},#{item.receivableAmount},#{item.discountAmount},
-            #{item.remark},#{item.receivedAmount},#{item.communityId},#{item.feeId},#{item.monthId}
+            #{item.remark},#{item.receivedAmount},#{item.communityId},#{item.feeId},#{item.monthId},
+            #{item.objName},#{item.objId},#{item.ownerName},#{item.ownerId},#{item.link},#{item.state},#{item.payFeeTime}
             )
             )
         </foreach>
         </foreach>
     </insert>
     </insert>
 
 
-
-
-
     <!-- 查询月缴费表信息 add by wuxw 2018-07-03 -->
     <!-- 查询月缴费表信息 add by wuxw 2018-07-03 -->
     <select id="getPayFeeDetailMonthInfo" parameterType="Map" resultType="Map">
     <select id="getPayFeeDetailMonthInfo" parameterType="Map" resultType="Map">
         select t.detail_month,t.detail_month detailMonth,t.detail_year,t.detail_year detailYear,t.detail_id,t.detail_id
         select t.detail_month,t.detail_month detailMonth,t.detail_year,t.detail_year detailYear,t.detail_id,t.detail_id
         detailId,t.receivable_amount,t.receivable_amount receivableAmount,t.discount_amount,t.discount_amount
         detailId,t.receivable_amount,t.receivable_amount receivableAmount,t.discount_amount,t.discount_amount
         discountAmount,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount
         discountAmount,t.remark,t.status_cd,t.status_cd statusCd,t.received_amount,t.received_amount
-        receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId
+        receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId,
+        t.obj_name objName,t.obj_id objId,t.owner_name ownerName,t.owner_id ownerId,t.link,t.state,t.pay_fee_time payFeeTime
         from pay_fee_detail_month t
         from pay_fee_detail_month t
         where 1 =1
         where 1 =1
         <if test="detailMonth !=null and detailMonth != ''">
         <if test="detailMonth !=null and detailMonth != ''">
@@ -71,6 +70,24 @@
         <if test="monthId !=null and monthId != ''">
         <if test="monthId !=null and monthId != ''">
             and t.month_id= #{monthId}
             and t.month_id= #{monthId}
         </if>
         </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name= #{ownerName}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and t.owner_id= #{ownerId}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="payFeeTime !=null and payFeeTime != ''">
+            and t.pay_fee_time= #{payFeeTime}
+        </if>
         order by t.create_time desc
         order by t.create_time desc
         <if test="page != -1 and page != null ">
         <if test="page != -1 and page != null ">
             limit #{page}, #{row}
             limit #{page}, #{row}
@@ -91,9 +108,6 @@
         <if test="detailYear !=null and detailYear != ''">
         <if test="detailYear !=null and detailYear != ''">
             , t.detail_year= #{detailYear}
             , t.detail_year= #{detailYear}
         </if>
         </if>
-        <if test="detailId !=null and detailId != ''">
-            , t.detail_id= #{detailId}
-        </if>
         <if test="receivableAmount !=null and receivableAmount != ''">
         <if test="receivableAmount !=null and receivableAmount != ''">
             , t.receivable_amount= #{receivableAmount}
             , t.receivable_amount= #{receivableAmount}
         </if>
         </if>
@@ -106,17 +120,37 @@
         <if test="receivedAmount !=null and receivedAmount != ''">
         <if test="receivedAmount !=null and receivedAmount != ''">
             , t.received_amount= #{receivedAmount}
             , t.received_amount= #{receivedAmount}
         </if>
         </if>
-        <if test="communityId !=null and communityId != ''">
-            , t.community_id= #{communityId}
+        <if test="objName !=null and objName != ''">
+            , t.obj_name= #{objName}
         </if>
         </if>
-        <if test="feeId !=null and feeId != ''">
-            , t.fee_id= #{feeId}
+        <if test="objId !=null and objId != ''">
+            , t.obj_id= #{objId}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            , t.owner_name= #{ownerName}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            , t.owner_id= #{ownerId}
+        </if>
+        <if test="state !=null and state != ''">
+            , t.state= #{state}
+        </if>
+        <if test="payFeeTime !=null and payFeeTime != ''">
+            , t.pay_fee_time= #{payFeeTime}
         </if>
         </if>
         where 1=1
         where 1=1
         <if test="monthId !=null and monthId != ''">
         <if test="monthId !=null and monthId != ''">
             and t.month_id= #{monthId}
             and t.month_id= #{monthId}
         </if>
         </if>
-
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="detailId !=null and detailId != ''">
+            and t.detail_id= #{detailId}
+        </if>
     </update>
     </update>
 
 
     <!-- 查询月缴费表数量 add by wuxw 2018-07-03 -->
     <!-- 查询月缴费表数量 add by wuxw 2018-07-03 -->
@@ -157,6 +191,24 @@
         <if test="monthId !=null and monthId != ''">
         <if test="monthId !=null and monthId != ''">
             and t.month_id= #{monthId}
             and t.month_id= #{monthId}
         </if>
         </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name= #{ownerName}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and t.owner_id= #{ownerId}
+        </if>
+        <if test="state !=null and state != ''">
+            and t.state= #{state}
+        </if>
+        <if test="payFeeTime !=null and payFeeTime != ''">
+            and t.pay_fee_time= #{payFeeTime}
+        </if>
 
 
 
 
     </select>
     </select>

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

@@ -1743,7 +1743,7 @@
         ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
         ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
         d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
         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,
         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
+        fad.amount withholdAmount,t.cashier_id cashierId,t.cashier_name cashierName,t.payable_amount payableAmount
         from pay_fee_detail t
         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 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 pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'

+ 25 - 0
service-fee/src/main/java/com/java110/fee/feeMonth/IPayFeeMonth.java

@@ -0,0 +1,25 @@
+package com.java110.fee.feeMonth;
+
+/**
+ * 费用离散为 月 应收实收数据
+ * <p>
+ * 主要是为了报表统计好统计 而设计的
+ */
+public interface IPayFeeMonth {
+
+    /**
+     * 单个费用生成或者刷新 离散月
+     *
+     * @param feeId
+     * @param communityId
+     */
+    void doGeneratorOrRefreshFeeMonth(String feeId, String communityId);
+
+    /**
+     * 所有费用 生成月数据
+     *
+     * @param communityId
+     */
+    void doGeneratorOrRefreshAllFeeMonth(String communityId);
+
+}

+ 11 - 0
service-fee/src/main/java/com/java110/fee/feeMonth/IPayFeeMonthHelp.java

@@ -0,0 +1,11 @@
+package com.java110.fee.feeMonth;
+
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.payFeeDetailMonth.PayFeeMonthOwnerDto;
+
+public interface IPayFeeMonthHelp {
+
+    PayFeeMonthOwnerDto generatorOwnerRoom(FeeDto feeDto);
+
+    Double getMonthFeePrice(FeeDto feeDto);
+}

+ 62 - 0
service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthHelp.java

@@ -0,0 +1,62 @@
+package com.java110.fee.feeMonth;
+
+import com.java110.core.smo.IComputeFeeSMO;
+import com.java110.dto.RoomDto;
+import com.java110.dto.fee.FeeAttrDto;
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.payFeeDetailMonth.PayFeeMonthOwnerDto;
+import com.java110.intf.community.IRoomInnerServiceSMO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class PayFeeMonthHelp implements IPayFeeMonthHelp {
+
+    @Autowired
+    private IRoomInnerServiceSMO roomInnerServiceSMOImpl;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+
+    public PayFeeMonthOwnerDto generatorOwnerRoom(FeeDto feeDto) {
+
+        PayFeeMonthOwnerDto payFeeMonthOwnerDto = new PayFeeMonthOwnerDto();
+        payFeeMonthOwnerDto.setOwnerId(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_ID));
+        payFeeMonthOwnerDto.setOwnerName(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_NAME));
+        payFeeMonthOwnerDto.setLink(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_OWNER_LINK));
+        payFeeMonthOwnerDto.setObjName(FeeAttrDto.getFeeAttrValue(feeDto, FeeAttrDto.SPEC_CD_PAY_OBJECT_NAME));
+        payFeeMonthOwnerDto.setObjId(feeDto.getPayerObjId());
+        return payFeeMonthOwnerDto;
+    }
+
+    /**
+     * 计算每月单价
+     *
+     * @param feeDto
+     * @return
+     */
+    public Double getMonthFeePrice(FeeDto feeDto) {
+        Map feePriceAll = computeFeeSMOImpl.getFeePrice(feeDto);
+
+        Double feePrice = Double.parseDouble(feePriceAll.get("feePrice").toString());
+        //todo 如果是一次性费用 除以
+        if (!FeeDto.FEE_FLAG_ONCE.equals(feeDto.getPayerObjType())) {
+            return feePrice;
+        }
+        double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(feeDto.getStartTime(), feeDto.getEndTime()));
+        if (maxMonth <= 0) {
+            return feePrice;
+
+        }
+        BigDecimal feePriceDec = new BigDecimal(feePrice).divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_UP);
+        feePrice = feePriceDec.doubleValue();
+        return feePrice;
+    }
+
+
+}

+ 186 - 0
service-fee/src/main/java/com/java110/fee/feeMonth/PayFeeMonthImpl.java

@@ -0,0 +1,186 @@
+package com.java110.fee.feeMonth;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.log.LoggerFactory;
+import com.java110.core.smo.IComputeFeeSMO;
+import com.java110.dto.fee.FeeDto;
+import com.java110.dto.payFeeDetailMonth.PayFeeDetailMonthDto;
+import com.java110.dto.payFeeDetailMonth.PayFeeMonthOwnerDto;
+import com.java110.dto.report.ReportRoomDto;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
+import com.java110.intf.fee.IPayFeeConfigV1InnerServiceSMO;
+import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO;
+import com.java110.po.payFeeDetailMonth.PayFeeDetailMonthPo;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.DateUtil;
+import org.slf4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.util.*;
+
+/**
+ * 费用离散为月 实现类
+ */
+@Service
+public class PayFeeMonthImpl implements IPayFeeMonth {
+    private static Logger logger = LoggerFactory.getLogger(PayFeeMonthImpl.class);
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+    @Autowired
+    private IPayFeeConfigV1InnerServiceSMO payFeeConfigV1InnerServiceSMOImpl;
+
+    @Autowired
+    private IPayFeeDetailMonthInnerServiceSMO payFeeDetailMonthInnerServiceSMOImpl;
+
+    @Autowired
+    private IPayFeeMonthHelp payFeeMonthHelp;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+    public static final int DEFAULT_DEAL_COUNT = 200;
+
+
+    /**
+     * 生成单个费用 并 离散到月
+     * @param feeId
+     * @param communityId
+     */
+    @Override
+    public void doGeneratorOrRefreshFeeMonth(String feeId, String communityId) {
+
+        // todo 查询费用
+        FeeDto feeDto = new FeeDto();
+        feeDto.setCommunityId(communityId);
+        feeDto.setFeeId(feeId);
+        List<FeeDto> tmpFeeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+
+        Assert.listOnlyOne(tmpFeeDtos, "费用不存在");
+
+        doGeneratorOrRefreshFeeMonth(tmpFeeDtos.get(0), communityId);
+    }
+
+    public void doGeneratorOrRefreshFeeMonth(FeeDto feeDto, String communityId) {
+
+        //todo 计算每月单价
+        Double feePrice = payFeeMonthHelp.getMonthFeePrice(feeDto);
+
+        // 准备离散的基础数据
+        PayFeeMonthOwnerDto payFeeMonthOwnerDto = payFeeMonthHelp.generatorOwnerRoom(feeDto);
+
+
+        //todo 检查费用是否离散过,如果没有离散过,先离散 start_time 到 end_time 的数据
+        ifHasNoMonthData(feeDto,payFeeMonthOwnerDto,feePrice);
+
+    }
+
+
+
+
+    /**
+     * 如果费用没有month 数据,则直接离散 start_time 到end_time 数据
+     * @param feeDto
+     */
+    private void ifHasNoMonthData(FeeDto feeDto,PayFeeMonthOwnerDto payFeeMonthOwnerDto,Double feePrice) {
+
+        //todo 分析建账时间 和开始时间
+        Date startTime = feeDto.getStartTime();
+        if(startTime == null){
+            throw new IllegalArgumentException("数据错误,未包含开始时间");
+        }
+
+        Calendar calendar = Calendar.getInstance();
+        int startYear = calendar.get(Calendar.YEAR);
+        int startMonth = calendar.get(Calendar.MONTH)+1;
+
+        PayFeeDetailMonthDto payFeeDetailMonthDto = new PayFeeDetailMonthDto();
+        payFeeDetailMonthDto.setCommunityId(feeDto.getCommunityId());
+        payFeeDetailMonthDto.setFeeId(feeDto.getFeeId());
+        payFeeDetailMonthDto.setDetailYear(startYear+"");
+        payFeeDetailMonthDto.setDetailMonth(startMonth+"");
+        int count = payFeeDetailMonthInnerServiceSMOImpl.queryPayFeeDetailMonthsCount(payFeeDetailMonthDto);
+
+        // todo 说明这个费用已经第一次离散过
+        if(count > 0){
+            return ;
+        }
+
+        double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, feeDto.getEndTime()));
+
+        if (maxMonth < 1) {
+            return;
+        }
+
+        PayFeeDetailMonthPo tmpPayFeeDetailMonthPo;
+        String detailId = "";
+        String discountAmount = "";
+        String receivedAmount = "";
+        List<PayFeeDetailMonthPo> payFeeDetailMonthPos = new ArrayList<>();
+        for (int month = 0; month < maxMonth; month++) {
+            calendar.setTime(startTime);
+            calendar.add(Calendar.MONTH, month);
+            tmpPayFeeDetailMonthPo = new PayFeeDetailMonthPo();
+            tmpPayFeeDetailMonthPo.setFeeId(feeDto.getFeeId());
+            tmpPayFeeDetailMonthPo.setCommunityId(feeDto.getCommunityId());
+            tmpPayFeeDetailMonthPo.setDetailId(detailId);
+            tmpPayFeeDetailMonthPo.setDetailMonth((calendar.get(Calendar.MONTH) + 1) + "");
+            tmpPayFeeDetailMonthPo.setDetailYear(calendar.get(Calendar.YEAR) + "");
+            tmpPayFeeDetailMonthPo.setDiscountAmount(discountAmount);
+            tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId));
+            tmpPayFeeDetailMonthPo.setReceivableAmount(feePrice + "");
+            tmpPayFeeDetailMonthPo.setReceivedAmount(receivedAmount);
+            tmpPayFeeDetailMonthPo.setRemark("程序计算生成");
+            tmpPayFeeDetailMonthPo.setObjName(payFeeMonthOwnerDto.getObjName());
+            tmpPayFeeDetailMonthPo.setObjId(payFeeMonthOwnerDto.getObjId());
+            tmpPayFeeDetailMonthPo.setOwnerId(payFeeMonthOwnerDto.getOwnerId());
+            tmpPayFeeDetailMonthPo.setOwnerName(payFeeMonthOwnerDto.getOwnerName());
+            payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo);
+        }
+        payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
+    }
+
+    @Override
+    public void doGeneratorOrRefreshAllFeeMonth(String communityId) {
+
+
+        FeeDto feeDto = new FeeDto();
+        feeDto.setCommunityId(communityId);
+        int count = feeInnerServiceSMOImpl.queryFeesCount(feeDto);
+
+        int page = 1;
+        int max = 15;
+        if (count < DEFAULT_DEAL_COUNT) {
+            page = 1;
+            max = count;
+        } else {
+            page = (int) Math.ceil((double) count / (double) DEFAULT_DEAL_COUNT);
+            max = DEFAULT_DEAL_COUNT;
+        }
+
+        //todo  每次按200条处理
+        for (int pageIndex = 0; pageIndex < page; pageIndex++) {
+            feeDto.setPage(pageIndex * max);
+            feeDto.setRow(max);
+            List<FeeDto> tmpFeeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+            // 离散费用
+            doTmpFeeDtoMonths(communityId, tmpFeeDtos);
+        }
+
+    }
+
+    private void doTmpFeeDtoMonths(String communityId, List<FeeDto> tmpFeeDtos) {
+        for (FeeDto tmpFeeDto : tmpFeeDtos) {
+            try {
+                doGeneratorOrRefreshFeeMonth(tmpFeeDto, communityId);
+            } catch (Exception e) {
+                e.printStackTrace();
+                logger.error("生成费用报表失败" + JSONObject.toJSONString(tmpFeeDto), e);
+            }
+        }
+    }
+}

+ 6 - 14
service-report/src/main/java/com/java110/report/smo/impl/QueryPayFeeDetailInnerServiceSMOImpl.java

@@ -87,14 +87,6 @@ public class QueryPayFeeDetailInnerServiceSMOImpl implements IQueryPayFeeDetailI
         if (count > 0) {
         if (count > 0) {
             //查询缴费明细
             //查询缴费明细
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto);
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto);
-            //吴学文 注释 感觉和上面的369 功能重复
-//            if (reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size() > 0) {
-//                //查询所有缴费明细记录
-//                ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 = BeanConvertUtil.covertBean(reportFeeMonthStatisticsDto, ReportFeeMonthStatisticsDto.class);
-//                reportFeeMonthStatisticsDto1.setPage(PageDto.DEFAULT_PAGE);
-//                List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos1 = reportFeeMonthStatisticsInnerServiceSMOImpl.queryPayFeeDetail(reportFeeMonthStatisticsDto1);
-//                size = reportFeeMonthStatisticsDtos1.size();
-//            }
             //查询应收、实收总金额(大计)
             //查询应收、实收总金额(大计)
             List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllPayFeeDetail(reportFeeMonthStatisticsDto);
             List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsList = reportFeeMonthStatisticsInnerServiceSMOImpl.queryAllPayFeeDetail(reportFeeMonthStatisticsDto);
             //查询(优惠、减免、滞纳金、空置房打折、空置房减免金额等)大计总金额
             //查询(优惠、减免、滞纳金、空置房打折、空置房减免金额等)大计总金额
@@ -159,12 +151,12 @@ public class QueryPayFeeDetailInnerServiceSMOImpl implements IQueryPayFeeDetailI
             Double totalLateFee = 0.0;
             Double totalLateFee = 0.0;
             List<String> ownerIds = new ArrayList<>();
             List<String> ownerIds = new ArrayList<>();
             for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
             for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
-                FeeDetailDto feeDetailDto = new FeeDetailDto();
-                feeDetailDto.setDetailId(reportFeeMonthStatistics.getDetailId());
-                List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto);
-                Assert.listOnlyOne(feeDetailDtos, "查询费用明细表错误");
-                reportFeeMonthStatistics.setReceivableAmount(feeDetailDtos.get(0).getReceivableAmount());
-                reportFeeMonthStatistics.setPayableAmount(feeDetailDtos.get(0).getPayableAmount());
+//                FeeDetailDto feeDetailDto = new FeeDetailDto();
+//                feeDetailDto.setDetailId(reportFeeMonthStatistics.getDetailId());
+//                List<FeeDetailDto> feeDetailDtos = feeDetailInnerServiceSMOImpl.queryFeeDetails(feeDetailDto);
+//                Assert.listOnlyOne(feeDetailDtos, "查询费用明细表错误");
+//                reportFeeMonthStatistics.setReceivableAmount(feeDetailDtos.get(0).getReceivableAmount());
+//                reportFeeMonthStatistics.setPayableAmount(feeDetailDtos.get(0).getPayableAmount());
                 //应收金额
                 //应收金额
                 Double receivableAmount = Double.valueOf(reportFeeMonthStatistics.getReceivableAmount());
                 Double receivableAmount = Double.valueOf(reportFeeMonthStatistics.getReceivableAmount());
                 //实收金额
                 //实收金额