java110 лет назад: 4
Родитель
Сommit
0076dcabbb

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/reportOweFee/ReportOweFeeDto.java

@@ -39,7 +39,9 @@ public class ReportOweFeeDto extends PageDto implements Serializable {
     private String unitId;
     private String roomSubType;
     private String roomNum;
+    private double totalOweAmount;
     List<ReportOweFeeItemDto> items;
+    List<ReportOweFeeItemDto> itemTotalOweAmounts;
 
 
     private Date createTime;
@@ -255,4 +257,20 @@ public class ReportOweFeeDto extends PageDto implements Serializable {
     public void setRoomNum(String roomNum) {
         this.roomNum = roomNum;
     }
+
+    public double getTotalOweAmount() {
+        return totalOweAmount;
+    }
+
+    public void setTotalOweAmount(double totalOweAmount) {
+        this.totalOweAmount = totalOweAmount;
+    }
+
+    public List<ReportOweFeeItemDto> getItemTotalOweAmounts() {
+        return itemTotalOweAmounts;
+    }
+
+    public void setItemTotalOweAmounts(List<ReportOweFeeItemDto> itemTotalOweAmounts) {
+        this.itemTotalOweAmounts = itemTotalOweAmounts;
+    }
 }

+ 9 - 0
java110-bean/src/main/java/com/java110/dto/reportOweFee/ReportOweFeeItemDto.java

@@ -23,6 +23,7 @@ public class ReportOweFeeItemDto extends PageDto implements Serializable {
     private String payerObjId;
     private Date startTime;
     private Date endTime;
+    private double totalOweAmount;
 
 
     public String getConfigId() {
@@ -88,4 +89,12 @@ public class ReportOweFeeItemDto extends PageDto implements Serializable {
     public void setConfigName(String configName) {
         this.configName = configName;
     }
+
+    public double getTotalOweAmount() {
+        return totalOweAmount;
+    }
+
+    public void setTotalOweAmount(double totalOweAmount) {
+        this.totalOweAmount = totalOweAmount;
+    }
 }

+ 159 - 0
java110-db/src/main/resources/mapper/report/ReportOweFeeServiceDaoImplMapper.xml

@@ -502,4 +502,163 @@
         </if>
     </select>
 
+
+    <select id="computeReportOweFeeTotalAmount" parameterType="Map" resultType="Map">
+        select sum(t.amount_owed) total
+        from report_owe_fee t
+        LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
+        LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
+        LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where 1 =1
+        and pf.status_cd = '0'
+        <if test="roomSubType !=null and roomSubType != ''">
+            and br.room_sub_type = #{roomSubType}
+        </if>
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num = #{roomNum}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id = #{unitId}
+        </if>
+        <if test="configName !=null and configName != ''">
+            and t.config_name= #{configName}
+        </if>
+        <if test="deadlineTime !=null and deadlineTime != ''">
+            and t.deadline_time= #{deadlineTime}
+        </if>
+        <if test="ownerTel !=null and ownerTel != ''">
+            and t.owner_tel= #{ownerTel}
+        </if>
+        <if test="updateTime !=null and updateTime != ''">
+            and t.update_time= #{updateTime}
+        </if>
+        <if test="oweId !=null and oweId != ''">
+            and t.owe_id= #{oweId}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and t.owner_id= #{ownerId}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="amountOwed !=null and amountOwed != ''">
+            and t.amount_owed= #{amountOwed}
+        </if>
+        <if test='hasOweFee !=null and hasOweFee == "Y"'>
+            and t.amount_owed &gt; 0
+        </if>
+        <if test="payerObjName !=null and payerObjName != ''">
+            and t.payer_obj_name= #{payerObjName}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name= #{ownerName}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="payerObjType !=null and payerObjType != ''">
+            and t.payer_obj_type= #{payerObjType}
+        </if>
+        <if test="payerObjId !=null and payerObjId != ''">
+            and t.payer_obj_id= #{payerObjId}
+        </if>
+    </select>
+    <select id="computeReportOweFeeItemAmount" parameterType="Map" resultType="Map">
+        select t.config_name configName,sum(t.amount_owed) totalOweAmount
+        from report_owe_fee t
+        LEFT JOIN pay_fee pf on t.fee_id = pf.fee_id
+        LEFT JOIN building_room br on pf.payer_obj_id = br.room_id and br.status_cd = '0'
+        LEFT JOIN building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where 1 =1
+        and pf.status_cd = '0'
+        <if test="roomSubType !=null and roomSubType != ''">
+            and br.room_sub_type = #{roomSubType}
+        </if>
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num = #{roomNum}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and bu.floor_id = #{floorId}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id = #{unitId}
+        </if>
+        <if test="configName !=null and configName != ''">
+            and t.config_name= #{configName}
+        </if>
+        <if test="deadlineTime !=null and deadlineTime != ''">
+            and t.deadline_time= #{deadlineTime}
+        </if>
+        <if test="ownerTel !=null and ownerTel != ''">
+            and t.owner_tel= #{ownerTel}
+        </if>
+        <if test="updateTime !=null and updateTime != ''">
+            and t.update_time= #{updateTime}
+        </if>
+        <if test="oweId !=null and oweId != ''">
+            and t.owe_id= #{oweId}
+        </if>
+        <if test="ownerId !=null and ownerId != ''">
+            and t.owner_id= #{ownerId}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </if>
+        <if test="amountOwed !=null and amountOwed != ''">
+            and t.amount_owed= #{amountOwed}
+        </if>
+        <if test='hasOweFee !=null and hasOweFee == "Y"'>
+            and t.amount_owed &gt; 0
+        </if>
+        <if test="payerObjName !=null and payerObjName != ''">
+            and t.payer_obj_name= #{payerObjName}
+        </if>
+        <if test="ownerName !=null and ownerName != ''">
+            and t.owner_name= #{ownerName}
+        </if>
+        <if test="configId !=null and configId != ''">
+            and t.config_id= #{configId}
+        </if>
+        <if test="configIds !=null">
+            and t.config_id in
+            <foreach collection="configIds" item="item" index="index" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.end_time= #{endTime}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="payerObjType !=null and payerObjType != ''">
+            and t.payer_obj_type= #{payerObjType}
+        </if>
+        <if test="payerObjId !=null and payerObjId != ''">
+            and t.payer_obj_id= #{payerObjId}
+        </if>
+        GROUP BY t.config_id,t.config_name
+    </select>
+
 </mapper>

+ 11 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportOweFeeInnerServiceSMO.java

@@ -2,6 +2,7 @@ package com.java110.intf.report;
 
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.reportOweFee.ReportOweFeeDto;
+import com.java110.dto.reportOweFee.ReportOweFeeItemDto;
 import com.java110.po.reportOweFee.ReportOweFeePo;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -70,4 +71,14 @@ public interface IReportOweFeeInnerServiceSMO {
      */
     @RequestMapping(value = "/queryReportAllOweFeesByCar", method = RequestMethod.POST)
     List<ReportOweFeeDto> queryReportAllOweFeesByCar(@RequestBody ReportOweFeeDto reportOweFeeDto);
+
+    /**
+     * 计算总欠费
+     * @param reportOweFeeDto
+     * @return
+     */
+    @RequestMapping(value = "/computeReportOweFeeTotalAmount", method = RequestMethod.POST)
+    double computeReportOweFeeTotalAmount(@RequestBody ReportOweFeeDto reportOweFeeDto);
+    @RequestMapping(value = "/computeReportOweFeeItemAmount", method = RequestMethod.POST)
+    List<ReportOweFeeItemDto> computeReportOweFeeItemAmount(@RequestBody ReportOweFeeDto reportOweFeeDto);
 }

+ 40 - 0
service-report/src/main/java/com/java110/report/bmo/reportOweFee/impl/GetReportOweFeeBMOImpl.java

@@ -36,6 +36,8 @@ public class GetReportOweFeeBMOImpl implements IGetReportOweFeeBMO {
         if (count > 0) {
             reportOweFeeDtos = reportOweFeeInnerServiceSMOImpl.queryReportOweFees(reportOweFeeDto);
             refreshReportOwe(reportOweFeeDtos, reportOweFeeDto.getConfigIds());
+            //查询大计 合计
+            dealTheOweFeeSumAmount(reportOweFeeDtos, reportOweFeeDto);
         } else {
             reportOweFeeDtos = new ArrayList<>();
         }
@@ -55,6 +57,43 @@ public class GetReportOweFeeBMOImpl implements IGetReportOweFeeBMO {
         return responseEntity;
     }
 
+    /**
+     * 查询大计 总欠费 和 各个费用项总欠费
+     *
+     * @param reportOweFeeDtos
+     * @param reportOweFeeDto
+     */
+    private void dealTheOweFeeSumAmount(List<ReportOweFeeDto> reportOweFeeDtos, ReportOweFeeDto reportOweFeeDto) {
+        if (reportOweFeeDtos == null || reportOweFeeDtos.size() < 1) {
+            return;
+        }
+        //查询总计
+        double totalAmount = 0.0;
+        if (reportOweFeeDto.getConfigIds() == null || reportOweFeeDto.getConfigIds().length < 1) {
+            totalAmount = reportOweFeeInnerServiceSMOImpl.computeReportOweFeeTotalAmount(reportOweFeeDto);
+            for (ReportOweFeeDto reportOweFeeDto1 : reportOweFeeDtos) {
+                reportOweFeeDto1.setTotalOweAmount(totalAmount);
+            }
+            return;
+        }
+
+        //计算分项的累计值
+        List<ReportOweFeeItemDto> reportOweFeeItemDtos = reportOweFeeInnerServiceSMOImpl.computeReportOweFeeItemAmount(reportOweFeeDto);
+
+        if (reportOweFeeItemDtos == null || reportOweFeeItemDtos.size() < 1) {
+            return;
+        }
+        BigDecimal totalAmountDes = new BigDecimal(totalAmount);
+        for (ReportOweFeeItemDto tmpReportOweFeeItemDto : reportOweFeeItemDtos) {
+            totalAmountDes = totalAmountDes.add(new BigDecimal(tmpReportOweFeeItemDto.getTotalOweAmount())).setScale(2, BigDecimal.ROUND_HALF_UP);
+        }
+
+        for (ReportOweFeeDto reportOweFeeDto1 : reportOweFeeDtos) {
+            reportOweFeeDto1.setItemTotalOweAmounts(reportOweFeeItemDtos);
+            reportOweFeeDto1.setTotalOweAmount(totalAmountDes.doubleValue());
+        }
+    }
+
     /**
      * query all owe fee
      *
@@ -159,6 +198,7 @@ public class GetReportOweFeeBMOImpl implements IGetReportOweFeeBMO {
             dealItem(tmpReportOweFeeDto, reportOweFeeDtos);
         }
 
+
         if (configIds == null || configIds.length < 1) {
             return;
         }

+ 5 - 0
service-report/src/main/java/com/java110/report/dao/IReportOweFeeServiceDao.java

@@ -1,6 +1,7 @@
 package com.java110.report.dao;
 
 
+import com.java110.dto.reportOweFee.ReportOweFeeItemDto;
 import com.java110.utils.exception.DAOException;
 import com.java110.entity.merchant.BoMerchant;
 import com.java110.entity.merchant.BoMerchantAttr;
@@ -77,4 +78,8 @@ public interface IReportOweFeeServiceDao {
      * @return
      */
     List<Map> queryReportAllOweFeesByCar(Map beanCovertMap);
+
+    double computeReportOweFeeTotalAmount(Map beanCovertMap);
+
+    List<Map> computeReportOweFeeItemAmount(Map beanCovertMap);
 }

+ 16 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportOweFeeServiceDaoImpl.java

@@ -1,6 +1,7 @@
 package com.java110.report.dao.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.java110.dto.reportOweFee.ReportOweFeeItemDto;
 import com.java110.utils.constant.ResponseConstant;
 import com.java110.utils.exception.DAOException;
 import com.java110.core.base.dao.BaseServiceDao;
@@ -136,5 +137,20 @@ public class ReportOweFeeServiceDaoImpl extends BaseServiceDao implements IRepor
         return businessReportOweFeeByCarInfos;
     }
 
+    @Override
+    public double computeReportOweFeeTotalAmount(Map info) {
+        List<Map> businessReportOweFeeInfos = sqlSessionTemplate.selectList("reportOweFeeServiceDaoImpl.computeReportOweFeeTotalAmount", info);
+        if (businessReportOweFeeInfos.size() < 1) {
+            return 0;
+        }
+        return Integer.parseInt(businessReportOweFeeInfos.get(0).get("total").toString());
+    }
+
+    @Override
+    public List<Map> computeReportOweFeeItemAmount(Map info) {
+        List<Map> businessReportOweFeeInfos = sqlSessionTemplate.selectList("reportOweFeeServiceDaoImpl.computeReportOweFeeItemAmount", info);
+        return businessReportOweFeeInfos;
+    }
+
 
 }

+ 13 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportOweFeeInnerServiceSMOImpl.java

@@ -4,6 +4,7 @@ package com.java110.report.smo.impl;
 import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.reportOweFee.ReportOweFeeDto;
+import com.java110.dto.reportOweFee.ReportOweFeeItemDto;
 import com.java110.intf.report.IReportOweFeeInnerServiceSMO;
 import com.java110.po.reportOweFee.ReportOweFeePo;
 import com.java110.report.dao.IReportOweFeeServiceDao;
@@ -103,6 +104,18 @@ public class ReportOweFeeInnerServiceSMOImpl extends BaseServiceSMO implements I
         return reportOweFees;
     }
 
+    @Override
+    public double computeReportOweFeeTotalAmount(@RequestBody ReportOweFeeDto reportOweFeeDto) {
+        return reportOweFeeServiceDaoImpl.computeReportOweFeeTotalAmount(BeanConvertUtil.beanCovertMap(reportOweFeeDto));
+    }
+
+    @Override
+    public List<ReportOweFeeItemDto> computeReportOweFeeItemAmount(@RequestBody ReportOweFeeDto reportOweFeeDto) {
+        List<ReportOweFeeItemDto> reportOweFees = BeanConvertUtil.covertBeanList(
+                reportOweFeeServiceDaoImpl.computeReportOweFeeItemAmount(BeanConvertUtil.beanCovertMap(reportOweFeeDto)), ReportOweFeeItemDto.class);
+        return reportOweFees;
+    }
+
     public IReportOweFeeServiceDao getReportOweFeeServiceDaoImpl() {
         return reportOweFeeServiceDaoImpl;
     }