java110 лет назад: 2
Родитель
Сommit
7606c7f9a4

+ 52 - 2
java110-db/src/main/resources/mapper/report/ReportFeeStatisticsServiceDaoImplMapper.xml

@@ -872,7 +872,7 @@
     <!-- 退款订单数 -->
     <select id="geRefundOrderCount" parameterType="Map" resultType="Map">
         select count(1) refundOrderCount from return_pay_fee t
-        where  t.status_cd = '0'
+        where t.status_cd = '0'
         and t.state = '1001'
         and t.community_id = #{communityId}
         and t.create_time &gt; #{startDate}
@@ -882,7 +882,7 @@
     <!-- 退款金额 -->
     <select id="geRefundFee" parameterType="Map" resultType="Map">
         select ifnull(sum(t.received_amount),0.0) refundFee from return_pay_fee t
-        where  t.status_cd = '0'
+        where t.status_cd = '0'
         and t.state = '1001'
         and t.community_id = #{communityId}
         and t.create_time &gt; #{startDate}
@@ -899,5 +899,55 @@
         and t.create_time &lt; #{endDate}
     </select>
 
+    <!-- 查询楼栋实收-->
+    <select id="getReceivedFeeByFloor" 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 ifnull(sum(t.received_amount),0.0) receivedFee
+        from pay_fee_detail 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.create_time &gt; #{startDate}
+        and t.create_time &lt; #{endDate}
+        and pf1.fee_type_cd = td.status_cd
+        ) receivedFee
+        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>

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

@@ -180,4 +180,12 @@ public interface IReportFeeStatisticsInnerServiceSMO {
      */
     @RequestMapping(value = "/getChargeFee", method = RequestMethod.POST)
     double getChargeFee(@RequestBody QueryStatisticsDto queryStatisticsDto);
+
+    /**
+     * 查询楼栋实收统计
+     * @param queryStatisticsDto
+     * @return
+     */
+    @RequestMapping(value = "/getReceivedFeeByFloor", method = RequestMethod.POST)
+    List<Map> getReceivedFeeByFloor(@RequestBody QueryStatisticsDto queryStatisticsDto);
 }

+ 112 - 0
service-report/src/main/java/com/java110/report/cmd/dataReport/QueryReceivedStatisticsCmd.java

@@ -0,0 +1,112 @@
+package com.java110.report.cmd.dataReport;
+
+import com.alibaba.fastjson.JSONArray;
+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.RoomDto;
+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 org.springframework.http.HttpStatus;
+import org.springframework.http.ResponseEntity;
+
+import java.math.BigDecimal;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 查询实收统计
+ */
+@Java110Cmd(serviceCode = "dataReport.queryReceivedStatistics")
+public class QueryReceivedStatisticsCmd 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.getReceivedFeeByFloor(queryStatisticsDto);
+
+        datas = computeFloorReceivedFee(datas);
+
+        context.setResponseEntity(ResultVo.createResponseEntity(datas));
+    }
+
+    private List<Map> computeFloorReceivedFee(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("receivedFee").toString()));
+                tmpData.put("receivedFee" + data.get("feeTypeCd").toString(), data.get("receivedFee"));
+            }
+            tmpData.put("receivedFee", 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;
+    }
+
+}

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

@@ -26,6 +26,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 欠费信息查询
+     *
      * @param info
      * @return
      */
@@ -121,6 +122,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询优惠费用
+     *
      * @param info
      * @return
      */
@@ -128,6 +130,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询滞纳金
+     *
      * @param info
      * @return
      */
@@ -135,6 +138,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询预存款
+     *
      * @param info
      * @return
      */
@@ -142,6 +146,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询扣款
+     *
      * @param info
      * @return
      */
@@ -149,6 +154,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询临时车费用
+     *
      * @param info
      * @return
      */
@@ -156,6 +162,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询退款押金
+     *
      * @param info
      * @return
      */
@@ -163,6 +170,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 退款订单
+     *
      * @param info
      * @return
      */
@@ -170,6 +178,7 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 退款金额
+     *
      * @param info
      * @return
      */
@@ -177,8 +186,17 @@ public interface IReportFeeStatisticsServiceDao {
 
     /**
      * 查询充电金额
+     *
      * @param info
      * @return
      */
     double getChargeFee(Map info);
+
+    /**
+     * 查询楼栋实收
+     *
+     * @param info
+     * @return
+     */
+    List<Map> getReceivedFeeByFloor(Map info);
 }

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

@@ -340,4 +340,10 @@ public class ReportFeeStatisticsServiceDaoImpl extends BaseServiceDao implements
         return Double.parseDouble(infos.get(0).get("chargeFee").toString());
     }
 
+    @Override
+    public List<Map> getReceivedFeeByFloor(Map info) {
+        List<Map> infos = sqlSessionTemplate.selectList("reportFeeStatisticsServiceDaoImpl.getReceivedFeeByFloor", info);
+        return infos;
+    }
+
 }

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

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

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

@@ -173,4 +173,11 @@ public interface IFeeStatistics {
      * @return
      */
     double getChargeFee(QueryStatisticsDto queryStatisticsDto);
+
+    /**
+     * 按楼栋计算实收
+     * @param queryStatisticsDto
+     * @return
+     */
+    List<Map> getReceivedFeeByFloor(QueryStatisticsDto queryStatisticsDto);
 }

+ 5 - 0
service-report/src/main/java/com/java110/report/statistics/impl/FeeStatisticsImpl.java

@@ -203,4 +203,9 @@ public class FeeStatisticsImpl implements IFeeStatistics {
         return reportFeeStatisticsInnerServiceSMOImpl.getChargeFee(queryStatisticsDto);
     }
 
+    @Override
+    public List<Map> getReceivedFeeByFloor(QueryStatisticsDto queryStatisticsDto) {
+        return reportFeeStatisticsInnerServiceSMOImpl.getReceivedFeeByFloor(queryStatisticsDto);
+    }
+
 }