Browse Source

优化代码

java110 4 years ago
parent
commit
7380c2ea89

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

@@ -667,6 +667,64 @@
             limit #{page}, #{row}
             limit #{page}, #{row}
         </if>
         </if>
     </select>
     </select>
+    <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
+    <select id="queryFeeBreakdownMajor" parameterType="Map" resultType="Map">
+        select  SUM(t.receivable_amount)
+        allReceivableAmount,SUM(t.received_amount)
+        allReceivedAmount,SUM(t.owe_amount) allOweAmount
+        from report_fee_month_statistics t
+        inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
+        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'
+        left join t_dict td on pfc.fee_type_cd = td.status_cd and td.table_name='pay_fee_config' and
+        td.table_columns='fee_type_cd'
+        inner join pay_fee pf on t.fee_id = pf.fee_id and pf.community_id = t.community_id and pf.status_cd = '0'
+        where t.status_cd = '0' and t.receivable_amount >= 0 and t.received_amount >= 0 and t.owe_amount >= 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 pfc.config_id= #{configId}
+        </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="feeTypeCd != null and feeTypeCd != ''">
+            and pfc.fee_type_cd = #{feeTypeCd}
+        </if>
+        <if test="communityId !=null and communityId != ''">
+            and t.community_id= #{communityId}
+        </if>
+        <if test="startTime !=null">
+            and pfc.start_time &gt;= #{startTime}
+        </if>
+        <if test="endTime !=null">
+            and pfc.start_time &lt;= #{endTime}
+        </if>
+        order by t.create_time desc
+    </select>
 
 
     <select id="queryFeeDetailCount" parameterType="Map" resultType="Map">
     <select id="queryFeeDetailCount" parameterType="Map" resultType="Map">
         select count(1) count
         select count(1) count

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

@@ -122,6 +122,9 @@ public interface IReportFeeMonthStatisticsInnerServiceSMO {
     @RequestMapping(value = "/queryFeeBreakdown", method = RequestMethod.POST)
     @RequestMapping(value = "/queryFeeBreakdown", method = RequestMethod.POST)
     List<ReportFeeMonthStatisticsDto> queryFeeBreakdown(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto);
     List<ReportFeeMonthStatisticsDto> queryFeeBreakdown(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto);
 
 
+    @RequestMapping(value = "/queryFeeBreakdownMajor", method = RequestMethod.POST)
+    ReportFeeMonthStatisticsDto queryFeeBreakdownMajor(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto);
+
     /**
     /**
      * 查询费用汇总表个数
      * 查询费用汇总表个数
      *
      *

+ 8 - 0
service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java

@@ -132,6 +132,14 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos = null;
         if (count > 0) {
         if (count > 0) {
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdown(reportFeeMonthStatisticsDto);
             reportFeeMonthStatisticsDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdown(reportFeeMonthStatisticsDto);
+            ReportFeeMonthStatisticsDto tmpReportFeeMonthStatisticsDto = reportFeeMonthStatisticsInnerServiceSMOImpl.queryFeeBreakdownMajor(reportFeeMonthStatisticsDto);
+            if(reportFeeMonthStatisticsDtos != null && reportFeeMonthStatisticsDtos.size()> 0){
+                for(ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto1 : reportFeeMonthStatisticsDtos){
+                    reportFeeMonthStatisticsDto1.setAllReceivableAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
+                    reportFeeMonthStatisticsDto1.setAllReceivedAmount(tmpReportFeeMonthStatisticsDto.getAllReceivableAmount());
+                    reportFeeMonthStatisticsDto1.setAllOweAmount(tmpReportFeeMonthStatisticsDto.getAllOweAmount());
+                }
+            }
         } else {
         } else {
             reportFeeMonthStatisticsDtos = new ArrayList<>();
             reportFeeMonthStatisticsDtos = new ArrayList<>();
         }
         }

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

@@ -306,4 +306,6 @@ public interface IReportFeeMonthStatisticsServiceDao {
     Map queryReportFeeSummaryMajor(Map beanCovertMap);
     Map queryReportFeeSummaryMajor(Map beanCovertMap);
 
 
     Map queryReportFloorUnitFeeSummaryMajor(Map beanCovertMap);
     Map queryReportFloorUnitFeeSummaryMajor(Map beanCovertMap);
+
+    Map queryFeeBreakdownMajor(Map beanCovertMap);
 }
 }

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

@@ -189,7 +189,14 @@ public class ReportFeeMonthStatisticsServiceDaoImpl extends BaseServiceDao imple
 
 
         return businessReportFeeMonthStatisticsInfos;
         return businessReportFeeMonthStatisticsInfos;
     }
     }
+    @Override
+    public Map queryFeeBreakdownMajor(Map info) {
+        logger.debug("查询费用queryFeeBreakdownMajor 入参 info : {}", info);
+
+        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryFeeBreakdownMajor", info);
 
 
+        return businessReportFeeMonthStatisticsInfos.get(0);
+    }
     @Override
     @Override
     public int queryFeeDetailCount(Map info) {
     public int queryFeeDetailCount(Map info) {
         logger.debug("查询费用月统计数据 入参 info : {}", info);
         logger.debug("查询费用月统计数据 入参 info : {}", info);

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

@@ -17,6 +17,7 @@ import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.DateUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.ResponseBody;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.bind.annotation.RestController;
 
 
 import java.util.Calendar;
 import java.util.Calendar;
@@ -157,6 +158,14 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
         return reportFeeMonthStatisticss;
         return reportFeeMonthStatisticss;
     }
     }
 
 
+    @Override
+    public ReportFeeMonthStatisticsDto queryFeeBreakdownMajor(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
+        ReportFeeMonthStatisticsDto reportFeeMonthStatistics = BeanConvertUtil.covertBean(
+                reportFeeMonthStatisticsServiceDaoImpl.queryFeeBreakdownMajor(
+                        BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto)), ReportFeeMonthStatisticsDto.class);
+        return reportFeeMonthStatistics;
+    }
+
     @Override
     @Override
     public int queryFeeDetailCount(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
     public int queryFeeDetailCount(@RequestBody ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto) {
         return reportFeeMonthStatisticsServiceDaoImpl.queryFeeDetailCount(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto));
         return reportFeeMonthStatisticsServiceDaoImpl.queryFeeDetailCount(BeanConvertUtil.beanCovertMap(reportFeeMonthStatisticsDto));