Просмотр исходного кода

优化 缴费离散为月 databus 开发完成

java110 лет назад: 5
Родитель
Сommit
99ef1d864f

+ 134 - 121
java110-db/src/main/resources/mapper/fee/PayFeeDetailMonthServiceDaoImplMapper.xml

@@ -5,147 +5,160 @@
 <mapper namespace="payFeeDetailMonthServiceDaoImpl">
 
 
-
-
-
     <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
     <insert id="savePayFeeDetailMonthInfo" parameterType="Map">
         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
-) values (
-#{detailMonth},#{detailYear},#{detailId},#{receivableAmount},#{discountAmount},#{remark},#{receivedAmount},#{communityId},#{feeId},#{monthId}
-)
+        detail_month,detail_year,detail_id,receivable_amount,discount_amount,remark,received_amount,community_id,fee_id,month_id
+        ) values (
+        #{detailMonth},#{detailYear},#{detailId},#{receivableAmount},#{discountAmount},#{remark},#{receivedAmount},#{communityId},#{feeId},#{monthId}
+        )
     </insert>
 
+    <!-- 保存月缴费表信息 add by wuxw 2018-07-03 -->
+    <insert id="savePayFeeDetailMonthInfos" parameterType="Map">
+        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
+        ) values
+        <foreach collection="payFeeDetailMonthPos" item="item" index="index" separator=",">
+            (
+            #{item.detailMonth},#{item.detailYear},#{item.detailId},#{item.receivableAmount},#{item.discountAmount},
+            #{item.remark},#{item.receivedAmount},#{item.communityId},#{item.feeId},#{item.monthId}
+            )
+        </foreach>
+    </insert>
+
+
 
 
     <!-- 查询月缴费表信息 add by wuxw 2018-07-03 -->
     <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 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 receivedAmount,t.community_id,t.community_id communityId,t.fee_id,t.fee_id feeId,t.month_id,t.month_id monthId 
-from pay_fee_detail_month t 
-where 1 =1 
-<if test="detailMonth !=null and detailMonth != ''">
-   and t.detail_month= #{detailMonth}
-</if> 
-<if test="detailYear !=null and detailYear != ''">
-   and t.detail_year= #{detailYear}
-</if> 
-<if test="detailId !=null and detailId != ''">
-   and t.detail_id= #{detailId}
-</if> 
-<if test="receivableAmount !=null and receivableAmount != ''">
-   and t.receivable_amount= #{receivableAmount}
-</if> 
-<if test="discountAmount !=null and discountAmount != ''">
-   and t.discount_amount= #{discountAmount}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="receivedAmount !=null and receivedAmount != ''">
-   and t.received_amount= #{receivedAmount}
-</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="monthId !=null and monthId != ''">
-   and t.month_id= #{monthId}
-</if> 
-order by t.create_time desc
-<if test="page != -1 and page != null ">
-   limit #{page}, #{row}
-</if> 
+        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
+        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
+        from pay_fee_detail_month t
+        where 1 =1
+        <if test="detailMonth !=null and detailMonth != ''">
+            and t.detail_month= #{detailMonth}
+        </if>
+        <if test="detailYear !=null and detailYear != ''">
+            and t.detail_year= #{detailYear}
+        </if>
+        <if test="detailId !=null and detailId != ''">
+            and t.detail_id= #{detailId}
+        </if>
+        <if test="receivableAmount !=null and receivableAmount != ''">
+            and t.receivable_amount= #{receivableAmount}
+        </if>
+        <if test="discountAmount !=null and discountAmount != ''">
+            and t.discount_amount= #{discountAmount}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="receivedAmount !=null and receivedAmount != ''">
+            and t.received_amount= #{receivedAmount}
+        </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="monthId !=null and monthId != ''">
+            and t.month_id= #{monthId}
+        </if>
+        order by t.create_time desc
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
 
     </select>
 
 
-
-
     <!-- 修改月缴费表信息 add by wuxw 2018-07-03 -->
     <update id="updatePayFeeDetailMonthInfo" parameterType="Map">
-        update  pay_fee_detail_month t set t.status_cd = #{statusCd}
-<if test="newBId != null and newBId != ''">
-,t.b_id = #{newBId}
-</if> 
-<if test="detailMonth !=null and detailMonth != ''">
-, t.detail_month= #{detailMonth}
-</if> 
-<if test="detailYear !=null and detailYear != ''">
-, t.detail_year= #{detailYear}
-</if> 
-<if test="detailId !=null and detailId != ''">
-, t.detail_id= #{detailId}
-</if> 
-<if test="receivableAmount !=null and receivableAmount != ''">
-, t.receivable_amount= #{receivableAmount}
-</if> 
-<if test="discountAmount !=null and discountAmount != ''">
-, t.discount_amount= #{discountAmount}
-</if> 
-<if test="remark !=null and remark != ''">
-, t.remark= #{remark}
-</if> 
-<if test="receivedAmount !=null and receivedAmount != ''">
-, t.received_amount= #{receivedAmount}
-</if> 
-<if test="communityId !=null and communityId != ''">
-, t.community_id= #{communityId}
-</if> 
-<if test="feeId !=null and feeId != ''">
-, t.fee_id= #{feeId}
-</if> 
- where 1=1 <if test="monthId !=null and monthId != ''">
-and t.month_id= #{monthId}
-</if> 
+        update pay_fee_detail_month t set t.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,t.b_id = #{newBId}
+        </if>
+        <if test="detailMonth !=null and detailMonth != ''">
+            , t.detail_month= #{detailMonth}
+        </if>
+        <if test="detailYear !=null and detailYear != ''">
+            , t.detail_year= #{detailYear}
+        </if>
+        <if test="detailId !=null and detailId != ''">
+            , t.detail_id= #{detailId}
+        </if>
+        <if test="receivableAmount !=null and receivableAmount != ''">
+            , t.receivable_amount= #{receivableAmount}
+        </if>
+        <if test="discountAmount !=null and discountAmount != ''">
+            , t.discount_amount= #{discountAmount}
+        </if>
+        <if test="remark !=null and remark != ''">
+            , t.remark= #{remark}
+        </if>
+        <if test="receivedAmount !=null and receivedAmount != ''">
+            , t.received_amount= #{receivedAmount}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            , t.community_id= #{communityId}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            , t.fee_id= #{feeId}
+        </if>
+        where 1=1
+        <if test="monthId !=null and monthId != ''">
+            and t.month_id= #{monthId}
+        </if>
 
     </update>
 
     <!-- 查询月缴费表数量 add by wuxw 2018-07-03 -->
-     <select id="queryPayFeeDetailMonthsCount" parameterType="Map" resultType="Map">
-        select  count(1) count 
-from pay_fee_detail_month t 
-where 1 =1 
-<if test="detailMonth !=null and detailMonth != ''">
-   and t.detail_month= #{detailMonth}
-</if> 
-<if test="detailYear !=null and detailYear != ''">
-   and t.detail_year= #{detailYear}
-</if> 
-<if test="detailId !=null and detailId != ''">
-   and t.detail_id= #{detailId}
-</if> 
-<if test="receivableAmount !=null and receivableAmount != ''">
-   and t.receivable_amount= #{receivableAmount}
-</if> 
-<if test="discountAmount !=null and discountAmount != ''">
-   and t.discount_amount= #{discountAmount}
-</if> 
-<if test="remark !=null and remark != ''">
-   and t.remark= #{remark}
-</if> 
-<if test="statusCd !=null and statusCd != ''">
-   and t.status_cd= #{statusCd}
-</if> 
-<if test="receivedAmount !=null and receivedAmount != ''">
-   and t.received_amount= #{receivedAmount}
-</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="monthId !=null and monthId != ''">
-   and t.month_id= #{monthId}
-</if> 
+    <select id="queryPayFeeDetailMonthsCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from pay_fee_detail_month t
+        where 1 =1
+        <if test="detailMonth !=null and detailMonth != ''">
+            and t.detail_month= #{detailMonth}
+        </if>
+        <if test="detailYear !=null and detailYear != ''">
+            and t.detail_year= #{detailYear}
+        </if>
+        <if test="detailId !=null and detailId != ''">
+            and t.detail_id= #{detailId}
+        </if>
+        <if test="receivableAmount !=null and receivableAmount != ''">
+            and t.receivable_amount= #{receivableAmount}
+        </if>
+        <if test="discountAmount !=null and discountAmount != ''">
+            and t.discount_amount= #{discountAmount}
+        </if>
+        <if test="remark !=null and remark != ''">
+            and t.remark= #{remark}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and t.status_cd= #{statusCd}
+        </if>
+        <if test="receivedAmount !=null and receivedAmount != ''">
+            and t.received_amount= #{receivedAmount}
+        </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="monthId !=null and monthId != ''">
+            and t.month_id= #{monthId}
+        </if>
 
 
-     </select>
+    </select>
 
 </mapper>

+ 4 - 0
java110-interface/src/main/java/com/java110/intf/fee/IPayFeeDetailMonthInnerServiceSMO.java

@@ -26,6 +26,10 @@ public interface IPayFeeDetailMonthInnerServiceSMO {
     @RequestMapping(value = "/savePayFeeDetailMonth", method = RequestMethod.POST)
     public int savePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo);
 
+    @RequestMapping(value = "/savePayFeeDetailMonths", method = RequestMethod.POST)
+    public int savePayFeeDetailMonths(@RequestBody List<PayFeeDetailMonthPo> payFeeDetailMonthPos);
+
+
     @RequestMapping(value = "/updatePayFeeDetailMonth", method = RequestMethod.POST)
     public int updatePayFeeDetailMonth(@RequestBody  PayFeeDetailMonthPo payFeeDetailMonthPo);
 

+ 3 - 0
service-fee/src/main/java/com/java110/fee/dao/IPayFeeDetailMonthServiceDao.java

@@ -28,6 +28,8 @@ public interface IPayFeeDetailMonthServiceDao {
      */
     void savePayFeeDetailMonthInfo(Map info) throws DAOException;
 
+    int savePayFeeDetailMonthInfos(Map info);
+
 
 
 
@@ -58,4 +60,5 @@ public interface IPayFeeDetailMonthServiceDao {
      */
     int queryPayFeeDetailMonthsCount(Map info);
 
+
 }

+ 28 - 20
service-fee/src/main/java/com/java110/fee/dao/impl/PayFeeDetailMonthServiceDaoImpl.java

@@ -1,15 +1,13 @@
 package com.java110.fee.dao.impl;
 
 import com.alibaba.fastjson.JSONObject;
-import com.java110.utils.constant.ResponseConstant;
-import com.java110.utils.exception.DAOException;
-import com.java110.utils.util.DateUtil;
 import com.java110.core.base.dao.BaseServiceDao;
 import com.java110.fee.dao.IPayFeeDetailMonthServiceDao;
+import com.java110.utils.constant.ResponseConstant;
+import com.java110.utils.exception.DAOException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
 import java.util.List;
 import java.util.Map;
@@ -25,37 +23,45 @@ public class PayFeeDetailMonthServiceDaoImpl extends BaseServiceDao implements I
     private static Logger logger = LoggerFactory.getLogger(PayFeeDetailMonthServiceDaoImpl.class);
 
 
-
-
-
     /**
      * 保存月缴费表信息 到 instance
-     * @param info   bId 信息
+     *
+     * @param info bId 信息
      * @throws DAOException DAO异常
      */
     @Override
     public void savePayFeeDetailMonthInfo(Map info) throws DAOException {
-        logger.debug("保存月缴费表信息Instance 入参 info : {}",info);
+        logger.debug("保存月缴费表信息Instance 入参 info : {}", info);
 
-        int saveFlag = sqlSessionTemplate.insert("payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfo",info);
+        int saveFlag = sqlSessionTemplate.insert("payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfo", info);
 
-        if(saveFlag < 1){
-            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"保存月缴费表信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "保存月缴费表信息Instance数据失败:" + JSONObject.toJSONString(info));
         }
     }
 
+    @Override
+    public int savePayFeeDetailMonthInfos(Map info) {
+        logger.debug("保存月缴费表信息Instance 入参 info : {}", info);
+
+        int saveFlag = sqlSessionTemplate.insert("payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfos", info);
+
+        return saveFlag;
+    }
+
 
     /**
      * 查询月缴费表信息(instance)
+     *
      * @param info bId 信息
      * @return List<Map>
      * @throws DAOException DAO异常
      */
     @Override
     public List<Map> getPayFeeDetailMonthInfo(Map info) throws DAOException {
-        logger.debug("查询月缴费表信息 入参 info : {}",info);
+        logger.debug("查询月缴费表信息 入参 info : {}", info);
 
-        List<Map> businessPayFeeDetailMonthInfos = sqlSessionTemplate.selectList("payFeeDetailMonthServiceDaoImpl.getPayFeeDetailMonthInfo",info);
+        List<Map> businessPayFeeDetailMonthInfos = sqlSessionTemplate.selectList("payFeeDetailMonthServiceDaoImpl.getPayFeeDetailMonthInfo", info);
 
         return businessPayFeeDetailMonthInfos;
     }
@@ -63,28 +69,30 @@ public class PayFeeDetailMonthServiceDaoImpl extends BaseServiceDao implements I
 
     /**
      * 修改月缴费表信息
+     *
      * @param info 修改信息
      * @throws DAOException DAO异常
      */
     @Override
     public void updatePayFeeDetailMonthInfo(Map info) throws DAOException {
-        logger.debug("修改月缴费表信息Instance 入参 info : {}",info);
+        logger.debug("修改月缴费表信息Instance 入参 info : {}", info);
 
-        int saveFlag = sqlSessionTemplate.update("payFeeDetailMonthServiceDaoImpl.updatePayFeeDetailMonthInfo",info);
+        int saveFlag = sqlSessionTemplate.update("payFeeDetailMonthServiceDaoImpl.updatePayFeeDetailMonthInfo", info);
 
-        if(saveFlag < 1){
-            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR,"修改月缴费表信息Instance数据失败:"+ JSONObject.toJSONString(info));
+        if (saveFlag < 1) {
+            throw new DAOException(ResponseConstant.RESULT_PARAM_ERROR, "修改月缴费表信息Instance数据失败:" + JSONObject.toJSONString(info));
         }
     }
 
-     /**
+    /**
      * 查询月缴费表数量
+     *
      * @param info 月缴费表信息
      * @return 月缴费表数量
      */
     @Override
     public int queryPayFeeDetailMonthsCount(Map info) {
-        logger.debug("查询月缴费表数据 入参 info : {}",info);
+        logger.debug("查询月缴费表数据 入参 info : {}", info);
 
         List<Map> businessPayFeeDetailMonthInfos = sqlSessionTemplate.selectList("payFeeDetailMonthServiceDaoImpl.queryPayFeeDetailMonthsCount", info);
         if (businessPayFeeDetailMonthInfos.size() < 1) {

+ 11 - 0
service-fee/src/main/java/com/java110/fee/smo/impl/PayFeeDetailMonthInnerServiceSMOImpl.java

@@ -12,7 +12,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName FloorInnerServiceSMOImpl
@@ -36,6 +38,15 @@ public class PayFeeDetailMonthInnerServiceSMOImpl extends BaseServiceSMO impleme
         return saveFlag;
     }
 
+    @Override
+    public int savePayFeeDetailMonths(@RequestBody List<PayFeeDetailMonthPo> payFeeDetailMonthPos) {
+        int saveFlag = 1;
+        Map info = new HashMap();
+        info.put("payFeeDetailMonthPos",payFeeDetailMonthPos);
+        payFeeDetailMonthServiceDaoImpl.savePayFeeDetailMonthInfos(info);
+        return saveFlag;
+    }
+
     @Override
     public int updatePayFeeDetailMonth(@RequestBody PayFeeDetailMonthPo payFeeDetailMonthPo) {
         int saveFlag = 1;

+ 2 - 14
service-job/src/main/java/com/java110/job/adapt/payment/fee/PayFeeDetailToMonthAdapt.java

@@ -1,35 +1,23 @@
-package com.java110.job.adapt.payment.fee;
+package com.java110.job.adapt.fee;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.core.smo.IComputeFeeSMO;
 import com.java110.dto.fee.FeeDetailDto;
-import com.java110.dto.fee.FeeDto;
-import com.java110.dto.owner.OwnerDto;
 import com.java110.entity.order.Business;
 import com.java110.intf.community.ICommunityInnerServiceSMO;
 import com.java110.intf.fee.IFeeDetailInnerServiceSMO;
-import com.java110.intf.fee.IFeeInnerServiceSMO;
-import com.java110.intf.fee.IFeeReceiptDetailInnerServiceSMO;
-import com.java110.intf.fee.IFeeReceiptInnerServiceSMO;
 import com.java110.intf.user.IOwnerAppUserInnerServiceSMO;
 import com.java110.intf.user.IOwnerCarInnerServiceSMO;
 import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
 import com.java110.job.adapt.DatabusAdaptImpl;
-import com.java110.job.adapt.payment.fee.asyn.IPayFeeDetailToMonth;
+import com.java110.job.adapt.fee.asyn.IPayFeeDetailToMonth;
 import com.java110.po.fee.PayFeeDetailPo;
-import com.java110.po.feeReceipt.FeeReceiptPo;
-import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo;
 import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
-import com.java110.utils.util.StringUtil;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 
 import java.util.List;

+ 1 - 1
service-job/src/main/java/com/java110/job/adapt/payment/fee/asyn/IPayFeeDetailToMonth.java

@@ -1,4 +1,4 @@
-package com.java110.job.adapt.payment.fee.asyn;
+package com.java110.job.adapt.fee.asyn;
 
 import com.alibaba.fastjson.JSONObject;
 import com.java110.entity.order.Business;

+ 101 - 0
service-job/src/main/java/com/java110/job/adapt/fee/asyn/impl/PayFeeDetailToMonthIImpl.java

@@ -0,0 +1,101 @@
+package com.java110.job.adapt.fee.asyn.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.factory.GenerateCodeFactory;
+import com.java110.core.smo.IComputeFeeSMO;
+import com.java110.dto.fee.FeeDto;
+import com.java110.entity.order.Business;
+import com.java110.intf.fee.IFeeInnerServiceSMO;
+import com.java110.intf.fee.IPayFeeDetailMonthInnerServiceSMO;
+import com.java110.job.adapt.fee.asyn.IPayFeeDetailToMonth;
+import com.java110.po.fee.PayFeeDetailPo;
+import com.java110.po.payFeeDetailMonth.PayFeeDetailMonthPo;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+import com.java110.utils.util.DateUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+
+@Service
+public class PayFeeDetailToMonthIImpl implements IPayFeeDetailToMonth {
+
+
+    @Autowired
+    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
+
+    @Autowired
+    private IComputeFeeSMO computeFeeSMOImpl;
+
+
+    @Autowired
+    private IPayFeeDetailMonthInnerServiceSMO payFeeDetailMonthInnerServiceSMOImpl;
+
+    @Override
+    @Async
+    public void doPayFeeDetail(Business business, JSONObject businessPayFeeDetail) {
+        //查询缴费明细
+        PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(businessPayFeeDetail, PayFeeDetailPo.class);
+        FeeDto feeDto = new FeeDto();
+        feeDto.setFeeId(payFeeDetailPo.getFeeId());
+        feeDto.setCommunityId(payFeeDetailPo.getCommunityId());
+        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
+        Assert.listOnlyOne(feeDtos, "未查询到费用信息");
+        feeDto = feeDtos.get(0);
+
+        Date startTime = null;
+        Date endTime = null;
+        try {
+            startTime = DateUtil.getDateFromString(businessPayFeeDetail.getString("startTime"), DateUtil.DATE_FORMATE_STRING_A);
+            endTime = DateUtil.getDateFromString(businessPayFeeDetail.getString("endTime"), DateUtil.DATE_FORMATE_STRING_A);
+        } catch (ParseException e) {
+            throw new IllegalArgumentException("时间格式错误");
+        }
+
+        double maxMonth = Math.ceil(computeFeeSMOImpl.dayCompare(startTime, endTime));
+
+        if (maxMonth < 1) {
+            return;
+        }
+
+        double feePrice = computeFeeSMOImpl.getFeePrice(feeDto);
+
+        BigDecimal totalRecDec = new BigDecimal(businessPayFeeDetail.getDouble("receivedAmount"));
+        //每月平均值
+        BigDecimal priRecDec = totalRecDec.divide(new BigDecimal(maxMonth), 2, BigDecimal.ROUND_HALF_EVEN);
+
+        List<PayFeeDetailMonthPo> payFeeDetailMonthPos = new ArrayList<>();
+        Calendar calendar = Calendar.getInstance();
+        PayFeeDetailMonthPo tmpPayFeeDetailMonthPo = null;
+        BigDecimal discountAmount = new BigDecimal(0.0);
+        for (int month = 0; month < maxMonth; month++) {
+            calendar.setTime(startTime);
+            calendar.add(Calendar.MONTH, month);
+            discountAmount = new BigDecimal(feePrice).subtract(priRecDec).setScale(2, BigDecimal.ROUND_HALF_EVEN);
+
+            tmpPayFeeDetailMonthPo = new PayFeeDetailMonthPo();
+            tmpPayFeeDetailMonthPo.setFeeId(feeDto.getFeeId());
+            tmpPayFeeDetailMonthPo.setCommunityId(feeDto.getCommunityId());
+            tmpPayFeeDetailMonthPo.setDetailId(businessPayFeeDetail.getString("detailId"));
+            tmpPayFeeDetailMonthPo.setDetailMonth((calendar.get(Calendar.MONTH) + 1) + "");
+            tmpPayFeeDetailMonthPo.setDetailYear(calendar.get(Calendar.YEAR) + "");
+            tmpPayFeeDetailMonthPo.setDiscountAmount(discountAmount.doubleValue() + "");
+            tmpPayFeeDetailMonthPo.setMonthId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_monthId));
+            tmpPayFeeDetailMonthPo.setReceivableAmount(feePrice + "");
+            tmpPayFeeDetailMonthPo.setReceivedAmount(priRecDec.doubleValue() + "");
+            tmpPayFeeDetailMonthPo.setRemark("程序计算生成");
+            payFeeDetailMonthPos.add(tmpPayFeeDetailMonthPo);
+        }
+
+        payFeeDetailMonthInnerServiceSMOImpl.savePayFeeDetailMonths(payFeeDetailMonthPos);
+
+    }
+
+}

+ 0 - 117
service-job/src/main/java/com/java110/job/adapt/payment/fee/asyn/impl/PayFeeDetailToMonthIImpl.java

@@ -1,117 +0,0 @@
-package com.java110.job.adapt.payment.fee.asyn.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.java110.core.factory.GenerateCodeFactory;
-import com.java110.core.smo.IComputeFeeSMO;
-import com.java110.dto.RoomDto;
-import com.java110.dto.fee.FeeDto;
-import com.java110.dto.owner.OwnerDto;
-import com.java110.dto.reportFeeYearCollection.ReportFeeYearCollectionDto;
-import com.java110.entity.order.Business;
-import com.java110.intf.fee.IFeeInnerServiceSMO;
-import com.java110.intf.report.IReportFeeYearCollectionInnerServiceSMO;
-import com.java110.job.adapt.payment.fee.asyn.IPayFeeDetailToMonth;
-import com.java110.po.fee.PayFeeDetailPo;
-import com.java110.po.feeReceipt.FeeReceiptPo;
-import com.java110.po.feeReceiptDetail.FeeReceiptDetailPo;
-import com.java110.po.reportFeeYearCollection.ReportFeeYearCollectionPo;
-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 org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Service;
-
-import java.util.Calendar;
-import java.util.List;
-
-@Service
-public class PayFeeDetailToMonthIImpl implements IPayFeeDetailToMonth {
-
-
-    @Autowired
-    private IFeeInnerServiceSMO feeInnerServiceSMOImpl;
-
-    @Autowired
-    private IComputeFeeSMO computeFeeSMOImpl;
-
-
-    @Autowired
-    private IReportFeeYearCollectionInnerServiceSMO reportFeeYearCollectionInnerServiceSMOImpl;
-
-    @Override
-    @Async
-    public void doPayFeeDetail(Business business, JSONObject businessPayFeeDetail) {
-        //查询缴费明细
-        PayFeeDetailPo payFeeDetailPo = BeanConvertUtil.covertBean(businessPayFeeDetail, PayFeeDetailPo.class);
-        FeeDto feeDto = new FeeDto();
-        feeDto.setFeeId(payFeeDetailPo.getFeeId());
-        feeDto.setCommunityId(payFeeDetailPo.getCommunityId());
-        List<FeeDto> feeDtos = feeInnerServiceSMOImpl.queryFees(feeDto);
-
-        Assert.listOnlyOne(feeDtos, "未查询到费用信息");
-
-        feeDto = feeDtos.get(0);
-
-        //查询业主信息
-        OwnerDto ownerDto = computeFeeSMOImpl.getFeeOwnerDto(feeDto);
-
-        ReportFeeYearCollectionDto reportFeeYearCollectionDto = new ReportFeeYearCollectionDto();
-        reportFeeYearCollectionDto.setCommunityId(feeDto.getCommunityId());
-        reportFeeYearCollectionDto.setConfigId(feeDto.getConfigId());
-        reportFeeYearCollectionDto.setObjId(feeDto.getPayerObjId());
-        reportFeeYearCollectionDto.setObjType(feeDto.getPayerObjType());
-        List<ReportFeeYearCollectionDto> statistics = BeanConvertUtil.covertBeanList(
-                reportFeeYearCollectionInnerServiceSMOImpl.getReportFeeYearCollectionInfo(BeanConvertUtil.beanCovertMap(reportFeeYearCollectionDto)),
-                ReportFeeYearCollectionDto.class);
-
-        ReportFeeYearCollectionPo reportFeeYearCollectionPo = new ReportFeeYearCollectionPo();
-        if (ListUtil.isNull(statistics)) {
-            reportFeeYearCollectionPo.setBuiltUpArea(reportRoomDto.getBuiltUpArea());
-            reportFeeYearCollectionPo.setCollectionId(GenerateCodeFactory.getGeneratorId(GenerateCodeFactory.CODE_PREFIX_collectionId));
-            reportFeeYearCollectionPo.setCommunityId(feeDto.getCommunityId());
-            reportFeeYearCollectionPo.setConfigId(feeDto.getConfigId());
-            reportFeeYearCollectionPo.setFeeId(feeDto.getFeeId());
-            reportFeeYearCollectionPo.setObjId(feeDto.getPayerObjId());
-            reportFeeYearCollectionPo.setObjType(feeDto.getPayerObjType());
-            reportFeeYearCollectionPo.setFeeName(StringUtil.isEmpty(feeDto.getImportFeeName()) ? feeDto.getFeeName() : feeDto.getImportFeeName());
-            if (RoomDto.ROOM_TYPE_ROOM.equals(reportRoomDto.getRoomType())) {
-                reportFeeYearCollectionPo.setObjName(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getUnitNum() + "-" + reportRoomDto.getRoomNum());
-            } else {
-                reportFeeYearCollectionPo.setObjName(reportRoomDto.getFloorNum() + "-" + reportRoomDto.getRoomNum());
-            }
-            reportFeeYearCollectionPo.setOwnerId(ownerDto.getOwnerId());
-            reportFeeYearCollectionPo.setOwnerName(ownerDto.getName());
-            reportFeeYearCollectionPo.setOwnerLink(ownerDto.getLink());
-
-            //reportFeeYearCollectionPo.setUpdateTime(DateUtil.getNow(DateUtil.DATE_FORMATE_STRING_A));
-            reportFeeYearCollectionInnerServiceSMOImpl.saveReportFeeYearCollectionInfo(BeanConvertUtil.beanCovertMap(reportFeeYearCollectionPo));
-        } else {
-            BeanConvertUtil.covertBean(statistics.get(0), reportFeeYearCollectionPo);
-        }
-
-        //计算费用项开始时间 起始 时间至现在的年份
-        Calendar configStartTime = Calendar.getInstance();
-        configStartTime.setTime(tmpReportFeeDto.getConfigStartTime());
-        int startYear = configStartTime.get(Calendar.YEAR);
-        //结束年
-        Calendar configEndTime = Calendar.getInstance();
-        configStartTime.setTime(tmpReportFeeDto.getConfigEndTime());
-        int endYear = configEndTime.get(Calendar.YEAR);
-
-        //当前年
-        int curYear = Calendar.getInstance().get(Calendar.YEAR)+1;
-
-        double feePrice = computeFeeSMOImpl.getReportFeePrice(tmpReportFeeDto, reportRoomDto, null);
-        tmpReportFeeDto.setFeePrice(feePrice);
-
-        if (endYear > curYear) {
-            endYear = curYear;
-        }
-
-        for (int year = startYear; year <= endYear; year++) {
-            computeYearFee(year, tmpReportFeeDto, reportFeeYearCollectionPo);
-        }
-    }
-}