Browse Source

加入费用汇总明细

java110 3 years ago
parent
commit
834f4d992b

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

@@ -391,6 +391,128 @@
         </if>
     </select>
 
+    <select id="queryReportFeeSummaryDetailCount" parameterType="Map" resultType="Map">
+        select count(1) count
+        from report_fee_month_statistics t
+        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        left join pay_fee_config pfc on pf.config_id = pf.config_id and pfc.community_id = t.community_id and pfc.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </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" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
+    </select>
+
+    <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
+    <select id="queryReportFeeSummaryDetail" parameterType="Map" resultType="Map">
+        select t.fee_year feeYear,t.fee_month feeMonth,t.create_time createTime
+        ,t.config_id configId
+        ,t.his_owe_amount hisOweAmount,t.cur_receivable_amount curReceivableAmount,
+        t.cur_received_amount curReceivedAmount,t.his_owe_received_amount
+        hisOweReceivedAmount,t.pre_received_amount preReceivedAmount,
+        t.update_time updateTime,t.his_owe_amount+t.cur_receivable_amount
+        receivableAmount,t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount receivedAmount
+        from report_fee_month_statistics t
+        left join building_room br on t.obj_id = br.room_id and t.obj_type = '3333' and br.status_cd = '0'
+        left join building_unit bu on br.unit_id = bu.unit_id and bu.status_cd = '0'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        left join pay_fee_config pfc on pf.config_id = pf.config_id and pfc.community_id = t.community_id and pfc.status_cd = '0'
+        where t.status_cd = '0'
+        <if test="roomNum !=null and roomNum != ''">
+            and br.room_num= #{roomNum}
+        </if>
+        <if test="unitId !=null and unitId != ''">
+            and bu.unit_id= #{unitId}
+        </if>
+        <if test="floorId !=null and floorId != ''">
+            and f.floor_id = #{floorId}
+        </if>
+        <if test="objName !=null and objName != ''">
+            and t.obj_name= #{objName}
+        </if>
+        <if test="feeYear !=null and feeYear != ''">
+            and t.fee_year= #{feeYear}
+        </if>
+        <if test="feeMonth !=null and feeMonth != ''">
+            and t.fee_month= #{feeMonth}
+        </if>
+        <if test="feeId !=null and feeId != ''">
+            and t.fee_id= #{feeId}
+        </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" open="(" close=")" separator=",">
+                #{item}
+            </foreach>
+        </if>
+        <if test="objId !=null and objId != ''">
+            and t.obj_id= #{objId}
+        </if>
+        <if test="feeName !=null and feeName != ''">
+            and t.fee_name= #{feeName}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null and startTime != ''">
+            and t.create_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null and endTime != ''">
+            and t.create_time &lt;= #{endTime}
+        </if>
+        <if test="page != -1 and page != null ">
+            limit #{page}, #{row}
+        </if>
+    </select>
+
     <!-- 查询费用月统计信息 大计 add by wuxw 2018-07-03 -->
     <select id="queryReportFeeSummaryMajor" parameterType="Map" resultType="Map">
         select

+ 18 - 0
java110-interface/src/main/java/com/java110/intf/report/IReportFeeMonthStatisticsInnerServiceSMO.java

@@ -76,6 +76,24 @@ public interface IReportFeeMonthStatisticsInnerServiceSMO {
     @RequestMapping(value = "/queryReportFeeSummary", method = RequestMethod.POST)
     List<ReportFeeMonthStatisticsDto> queryReportFeeSummary(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto);
 
+    /**
+     * 查询费用汇总表个数
+     *
+     * @param reportFeeMonthStatisticsDto
+     * @return
+     */
+    @RequestMapping(value = "/queryReportFeeSummaryDetailCount", method = RequestMethod.POST)
+    int queryReportFeeSummaryDetailCount(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto);
+
+    /**
+     * 查询费用汇总表
+     *
+     * @param reportFeeMonthStatisticsDto
+     * @return
+     */
+    @RequestMapping(value = "/queryReportFeeSummaryDetail", method = RequestMethod.POST)
+    List<ReportFeeMonthStatisticsDto> queryReportFeeSummaryDetail(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto);
+
     /**
      * 查询费用汇总表 大计
      *

+ 65 - 0
service-report/src/main/java/com/java110/report/cmd/reportFeeMonthStatistics/QueryReportFeeSummaryDetailCmd.java

@@ -0,0 +1,65 @@
+package com.java110.report.cmd.reportFeeMonthStatistics;
+
+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.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
+import com.java110.intf.report.IReportFeeMonthStatisticsInnerServiceSMO;
+import com.java110.utils.exception.CmdException;
+import com.java110.utils.util.Assert;
+import com.java110.utils.util.BeanConvertUtil;
+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.util.ArrayList;
+import java.util.List;
+
+/**
+ * 费用汇总明细
+ */
+@Java110Cmd(serviceCode = "/reportFeeMonthStatistics/queryReportFeeSummaryDetail")
+public class QueryReportFeeSummaryDetailCmd extends Cmd {
+
+    @Autowired
+    private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl;
+
+    @Override
+    public void validate(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        Assert.hasKeyAndValue(reqJson, "communityId", "未传入小区信息");
+        Assert.hasKeyAndValue(reqJson, "feeYear", "未传入年份");
+        Assert.hasKeyAndValue(reqJson, "feeMonth", "未传入月份");
+        super.validatePageInfo(reqJson);
+    }
+
+    @Override
+    public void doCmd(CmdEvent event, ICmdDataFlowContext context, JSONObject reqJson) throws CmdException {
+        String[] configIds = null;
+        if (reqJson.containsKey("configIds") && !StringUtil.isEmpty(reqJson.getString("configIds"))) {
+            configIds = reqJson.getString("configIds").split(",");
+            reqJson.remove("configIds");
+        }
+        ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto = BeanConvertUtil.covertBean(reqJson, ReportFeeMonthStatisticsDto.class);
+        reportFeeMonthStatisticsDto.setConfigIds(configIds);
+
+
+        int count = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryDetailCount(reportFeeMonthStatisticsDto);
+
+        List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
+        if (count > 0) {
+            reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryReportFeeSummaryDetail(reportFeeMonthStatisticsDto);
+        } else {
+            reportFeeMonthStatisticsDtos = new ArrayList<>();
+        }
+
+        ResultVo resultVo = new ResultVo((int) Math.ceil((double) count / (double) reportFeeMonthStatisticsDto.getRow()), count, reportFeeMonthStatisticsDtos);
+
+        ResponseEntity<String> responseEntity = new ResponseEntity<String>(resultVo.toString(), HttpStatus.OK);
+
+        context.setResponseEntity(responseEntity);
+    }
+}

+ 19 - 0
service-report/src/main/java/com/java110/report/dao/IReportFeeMonthStatisticsServiceDao.java

@@ -81,6 +81,25 @@ public interface IReportFeeMonthStatisticsServiceDao {
      */
     List<Map> queryReportFeeSummary(Map info) throws DAOException;
 
+    /**
+     * 查询费用月统计总数
+     *
+     * @param info 费用月统计信息
+     * @return 费用月统计数量
+     */
+    int queryReportFeeSummaryDetailCount(Map info);
+
+
+    /**
+     * 查询费用月统计信息(instance过程)
+     * 根据bId 查询费用月统计信息
+     *
+     * @param info bId 信息
+     * @return 费用月统计信息
+     * @throws DAOException DAO异常
+     */
+    List<Map> queryReportFeeSummaryDetail(Map info) throws DAOException;
+
 
     /**
      * 查询费用月统计总数

+ 22 - 0
service-report/src/main/java/com/java110/report/dao/impl/ReportFeeMonthStatisticsServiceDaoImpl.java

@@ -160,6 +160,28 @@ public class ReportFeeMonthStatisticsServiceDaoImpl extends BaseServiceDao imple
         return businessReportFeeMonthStatisticsInfos;
     }
 
+    @Override
+    public int queryReportFeeSummaryDetailCount(Map info) {
+        logger.debug("查询费用月统计数据 入参 info : {}", info);
+
+        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryReportFeeSummaryDetailCount", info);
+        if (businessReportFeeMonthStatisticsInfos.size() < 1) {
+            return 0;
+        }
+
+        return Integer.parseInt(businessReportFeeMonthStatisticsInfos.get(0).get("count").toString());
+    }
+
+    @Override
+    public List<Map> queryReportFeeSummaryDetail(Map info) throws DAOException {
+        logger.debug("查询费用月统计信息 入参 info : {}", info);
+
+        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryReportFeeSummaryDetail", info);
+
+        return businessReportFeeMonthStatisticsInfos;
+    }
+
+
 
     @Override
     public Map queryReportFeeSummaryMajor(Map info) {

+ 20 - 0
service-report/src/main/java/com/java110/report/smo/impl/ReportFeeMonthStatisticsInnerServiceSMOImpl.java

@@ -103,6 +103,26 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
         return reportFeeMonthStatisticss;
     }
 
+    @Override
+    public int queryReportFeeSummaryDetailCount(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+        return reportFeeMonthStatisticsServiceDaoImpl.queryReportFeeSummaryDetailCount(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto));
+    }
+
+    @Override
+    public List<ReportFeeMonthStatisticsDto> queryReportFeeSummaryDetail(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+        //校验是否传了 分页信息
+
+        int page = reportFeeMonthStatisticsDto.getPage();
+
+        if (page != PageDto.DEFAULT_PAGE) {
+            reportFeeMonthStatisticsDto.setPage((page - 1) * reportFeeMonthStatisticsDto.getRow());
+        }
+
+        List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticss = BeanConvertUtil.covertBeanList(reportFeeMonthStatisticsServiceDaoImpl.queryReportFeeSummaryDetail(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)), ReportFeeMonthStatisticsDto.class);
+
+        return reportFeeMonthStatisticss;
+    }
+
     @Override
     public ReportFeeMonthStatisticsDto queryReportFeeSummaryMajor(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
         ReportFeeMonthStatisticsDto reportFeeMonthStatistics = BeanConvertUtil.covertBean(