Your Name před 3 roky
rodič
revize
e144b12f3c

+ 66 - 0
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml

@@ -964,4 +964,70 @@
         and t.create_time < #{endDate}
         group by td.status_cd,td.`name`
     </select>
+
+    <!-- 按楼栋统计欠费 -->
+    <select id="getOweFeeByFloor" parameterType="Map" resultType="Map">
+        select a.floor_id floorId,a.floor_num floorNum,a.name floorName,td.status_cd feeTypeCd,
+        (
+        select count(1)
+        from building_room br
+        left join building_unit bu on bu.unit_id = br.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and a.status_cd = '0'
+        and br.status_cd = '0'
+        and bu.floor_id = a.floor_id
+        ) roomCount,
+        (
+        select count(1) from (
+        select bu.floor_id,br.room_id
+        from building_room br
+        INNER JOIN pay_fee pf on br.room_id = pf.payer_obj_id and pf.payer_obj_type = '3333' and pf.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and br.status_cd = '0'
+        and br.community_id= #{communityId}
+        group by bu.floor_id,br.room_id
+        ) b
+        where b.floor_id = a.floor_id
+        ) feeRoomCount,
+        (
+        select count(1) from (
+        select bu.floor_id,br.room_id
+        from building_room br
+        INNER JOIN pay_fee_detail_month pf on br.room_id = pf.obj_id and pf.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        where
+        1=1
+        and br.status_cd = '0'
+        and br.community_id= #{communityId}
+        and pf.detail_id = '-1'
+        and pf.cur_month_time &lt; {endDate}
+        group by bu.floor_id,br.room_id
+        ) b
+        where b.floor_id = a.floor_id
+        ) oweRoomCount,
+        (
+        select ifnull(sum(t.received_amount),0.0) oweFee
+        from pay_fee_detail_month t
+        INNER JOIN pay_fee pf1 on t.fee_id = pf1.fee_id and pf1.payer_obj_type='3333' and pf1.status_cd = '0'
+        LEFT JOIN building_room br on pf1.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 bu.floor_id = a.floor_id
+        and t.status_cd = '0'
+        and t.community_id = #{communityId}
+        and t.detail_id = '-1'
+        and pf.cur_month_time &lt; {endDate}
+        and pf1.fee_type_cd = td.status_cd
+        ) oweFee
+        from f_floor a
+        left join t_dict td on td.table_name='pay_fee_config' and td.table_columns = 'fee_type_cd_show'
+        where 1=1
+        and a.status_cd = '0'
+        and a.community_id = #{communityId}
+        order by a.seq
+    </select>
 </mapper>

+ 20 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportFeeStatisticsInnerServiceSMO.java

@@ -46,6 +46,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询欠费金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -99,6 +100,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 费用项收费率统计
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -113,6 +115,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 业主明细表
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -121,6 +124,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 优惠费用
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -129,6 +133,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 滞纳金
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -137,6 +142,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询预存金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -145,6 +151,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询扣款金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -153,6 +160,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询临时车收入
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -161,6 +169,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询退款押金
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -175,6 +184,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询充电桩 充电金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -183,6 +193,7 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     /**
      * 查询楼栋实收统计
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -191,4 +202,13 @@ public interface IReportFeeStatisticsInnerServiceSMO {
 
     @RequestMapping(value = "/getReceivedFeeByPrimeRate", method = RequestMethod.POST)
     List<Map> getReceivedFeeByPrimeRate(@RequestBody QueryStatisticsDto queryStatisticsDto);
+
+    /**
+     * 根据楼栋查询欠费信息
+     *
+     * @param queryStatisticsDto
+     * @return
+     */
+    @RequestMapping(value = "/getOweFeeByFloor", method = RequestMethod.POST)
+    List<Map> getOweFeeByFloor(@RequestBody QueryStatisticsDto queryStatisticsDto);
 }

+ 107 - 0
service-report/src/main/java/com/java110/report/cmd/dataReport/QueryOweStatisticsCmd.java

@@ -0,0 +1,107 @@
+package com.java110.report.cmd.dataReport;
+
+import com.alibaba.fastjson.JSONObject;
+import com.java110.core.annotation.Java110Cmd;
+import com.java110.core.context.ICmdDataFlowContext;
+import com.java110.core.event.cmd.Cmd;
+import com.java110.core.event.cmd.CmdEvent;
+import com.java110.dto.report.QueryStatisticsDto;
+import com.java110.report.statistics.IFeeStatistics;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.StringUtil;
+import com.java110.vo.ResultVo;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 查询欠费统计
+ */
+@Java110Cmd(serviceCode = "dataReport.queryOweStatistics")
+public class QueryOweStatisticsCmd extends Cmd {
+
+    @Autowired
+    private IFeeStatistics feeStatisticsImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        Assert.hasKeyAndValue(reqJson, "communityId", "未包含小区");
+        String startDate = reqJson.getString("startDate");
+        String endDate = reqJson.getString("endDate");
+        if (!StringUtil.isEmpty(startDate) && !startDate.contains(":")) {
+            startDate += " 00:00:00";
+            reqJson.put("startDate", startDate);
+        }
+        if (!StringUtil.isEmpty(endDate) && !endDate.contains(":")) {
+            endDate += " 23:59:59";
+            reqJson.put("endDate", endDate);
+        }
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException, ParseException {
+        QueryStatisticsDto queryStatisticsDto = new QueryStatisticsDto();
+        queryStatisticsDto.setCommunityId(reqJson.getString("communityId"));
+        queryStatisticsDto.setStartDate(reqJson.getString("startDate"));
+        queryStatisticsDto.setEndDate(reqJson.getString("endDate"));
+        queryStatisticsDto.setConfigId(reqJson.getString("configId"));
+        queryStatisticsDto.setObjName(reqJson.getString("objName"));
+        queryStatisticsDto.setFeeTypeCd(reqJson.getString("feeTypeCd"));
+        queryStatisticsDto.setOwnerName(reqJson.getString("ownerName"));
+
+        List<Map> datas = null;
+        // todo 按楼栋计算实收情况
+        datas = feeStatisticsImpl.getOweFeeByFloor(queryStatisticsDto);
+
+        datas = computeOweReceivedFee(datas);
+
+        context.setResponseEntity(ResultVo.createResponseEntity(datas));
+    }
+
+    private List<Map> computeOweReceivedFee(List<Map> datas) {
+        if (datas == null || datas.size() < 1) {
+            return new ArrayList<>();
+        }
+
+        List<Map> tmpDatas = new ArrayList<>();
+        for (Map data : datas) {
+            if (!hasInTmp(tmpDatas, data)) {
+                tmpDatas.add(data);
+            }
+        }
+
+        if (tmpDatas == null || tmpDatas.size() < 1) {
+            return new ArrayList<>();
+        }
+
+        BigDecimal receivedFee = new BigDecimal(0.00);
+        for (Map tmpData : tmpDatas) {
+            for (Map data : datas) {
+                if (!data.get("floorId").toString().equals(tmpData.get("floorId"))) {
+                    continue;
+                }
+
+                receivedFee = receivedFee.add(new BigDecimal(data.get("oweFee").toString()));
+                tmpData.put("oweFee" + data.get("feeTypeCd").toString(), data.get("oweFee"));
+            }
+            tmpData.put("oweFee", receivedFee.doubleValue());
+        }
+
+        return tmpDatas;
+    }
+
+    private boolean hasInTmp(List<Map> tmpDatas, Map data) {
+        for (Map tmpData : tmpDatas) {
+            if (tmpData.get("floorId").equals(data.get("floorId"))) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+}

+ 7 - 0
service-report/src/main/java/com/java110/report/dao/IReportFeeStatisticsServiceDao.java

@@ -206,4 +206,11 @@ public interface IReportFeeStatisticsServiceDao {
      * @return
      */
     List<Map> getReceivedFeeByPrimeRate(Map info);
+
+    /**
+     * 根据楼栋查询欠费
+     * @param info
+     * @return
+     */
+    List<Map> getOweFeeByFloor(Map info);
 }

+ 6 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportFeeStatisticsServiceDaoImpl.java

@@ -352,4 +352,10 @@ public class ReportFeeStatisticsServiceDaoImpl extends BaseServiceDao implements
         return infos;
     }
 
+    @Override
+    public List<Map> getOweFeeByFloor(Map info) {
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getOweFeeByFloor", info);
+        return infos;
+    }
+
 }

+ 6 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportFeeStatisticsInnerServiceSMOImpl.java

@@ -244,4 +244,10 @@ public class ReportFeeStatisticsInnerServiceSMOImpl extends BaseServiceSMO imple
         List<Map> infos = reportFeeStatisticsServiceDaoImpl.getReceivedFeeByPrimeRate(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
         return infos;
     }
+
+    @Override
+    public List<Map> getOweFeeByFloor(@RequestBody QueryStatisticsDto queryStatisticsDto) {
+        List<Map> infos = reportFeeStatisticsServiceDaoImpl.getOweFeeByFloor(BeanConvertUtil.beanCovertMap(queryStatisticsDto));
+        return infos;
+    }
 }

+ 26 - 0
service-report/src/main/java/com/java110/report/statistics/IFeeStatistics.java

@@ -28,6 +28,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询欠费
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -70,6 +71,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询收费房屋数
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -77,6 +79,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询楼栋费用统计信息
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -84,6 +87,7 @@ public interface IFeeStatistics {
 
     /**
      * 费用项 费用统计信息
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -91,6 +95,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询对象明细表(数量)
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -98,6 +103,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询对象明细表
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -105,6 +111,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询业主对象明细表
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -112,6 +119,7 @@ public interface IFeeStatistics {
 
     /**
      * 优惠金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -119,6 +127,7 @@ public interface IFeeStatistics {
 
     /**
      * 滞纳金
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -126,6 +135,7 @@ public interface IFeeStatistics {
 
     /**
      * 预存账户
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -133,6 +143,7 @@ public interface IFeeStatistics {
 
     /**
      * 扣款账户
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -140,6 +151,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询临时车费用收入
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -147,6 +159,7 @@ public interface IFeeStatistics {
 
     /**
      * 查询退款押金
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -154,6 +167,7 @@ public interface IFeeStatistics {
 
     /**
      * 退款订单数
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -161,6 +175,7 @@ public interface IFeeStatistics {
 
     /**
      * 退款金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -169,6 +184,7 @@ public interface IFeeStatistics {
 
     /**
      * 充电桩充电金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -176,6 +192,7 @@ public interface IFeeStatistics {
 
     /**
      * 按楼栋计算实收
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -183,8 +200,17 @@ public interface IFeeStatistics {
 
     /**
      * 查询 收款方式统计
+     *
      * @param queryStatisticsDto
      * @return
      */
     List<Map> getReceivedFeeByPrimeRate(QueryStatisticsDto queryStatisticsDto);
+
+    /**
+     * 根据楼栋查询欠费信息
+     *
+     * @param queryStatisticsDto
+     * @return
+     */
+    List<Map> getOweFeeByFloor(QueryStatisticsDto queryStatisticsDto);
 }

+ 24 - 2
service-report/src/main/java/com/java110/report/statistics/impl/FeeStatisticsImpl.java

@@ -31,6 +31,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询 当月欠费
+     *
      * @param queryFeeStatisticsDto
      * @return
      */
@@ -41,6 +42,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询总欠费
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -52,6 +54,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询当月应收
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -61,10 +64,9 @@ public class FeeStatisticsImpl implements IFeeStatistics {
     }
 
 
-
-
     /**
      * 查询 欠费追回
+     *
      * @param queryFeeStatisticsDto
      * @return
      */
@@ -75,6 +77,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询 预交费用
+     *
      * @param queryFeeStatisticsDto
      * @return
      */
@@ -85,6 +88,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询 实收费用
+     *
      * @param queryFeeStatisticsDto
      * @return
      */
@@ -105,6 +109,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 楼栋收费率信息统计
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -115,6 +120,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 费用项收费率信息统计
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -135,6 +141,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询 业主明细表
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -145,6 +152,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 优惠金额
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -155,6 +163,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 滞纳金
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -175,6 +184,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 查询临时车收入
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -210,6 +220,7 @@ public class FeeStatisticsImpl implements IFeeStatistics {
 
     /**
      * 收款方式统计
+     *
      * @param queryStatisticsDto
      * @return
      */
@@ -218,4 +229,15 @@ public class FeeStatisticsImpl implements IFeeStatistics {
         return reportFeeStatisticsInnerServiceSMOImpl.getReceivedFeeByPrimeRate(queryStatisticsDto);
     }
 
+    /**
+     * 根据楼栋查询欠费信息
+     *
+     * @param queryStatisticsDto
+     * @return
+     */
+    @Override
+    public List<Map> getOweFeeByFloor(QueryStatisticsDto queryStatisticsDto) {
+        return reportFeeStatisticsInnerServiceSMOImpl.getOweFeeByFloor(queryStatisticsDto);
+    }
+
 }