Browse Source

优化代码

java110 4 years ago
parent
commit
7c218db815

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/owner/OwnerDto.java

@@ -52,7 +52,9 @@ public class OwnerDto extends PageDto implements Serializable {
     private String num;
     private String idCard;
     private String floorId;
+    private String floorNum;
     private String unitId;
+    private String unitNum;
     private String state;
     private String startTime;
     private String endTime;
@@ -346,4 +348,20 @@ public class OwnerDto extends PageDto implements Serializable {
     public void setAppUserName(String appUserName) {
         this.appUserName = appUserName;
     }
+
+    public String getFloorNum() {
+        return floorNum;
+    }
+
+    public void setFloorNum(String floorNum) {
+        this.floorNum = floorNum;
+    }
+
+    public String getUnitNum() {
+        return unitNum;
+    }
+
+    public void setUnitNum(String unitNum) {
+        this.unitNum = unitNum;
+    }
 }

+ 18 - 0
java110-bean/src/main/java/com/java110/dto/reportFeeMonthStatistics/ReportFeeMonthStatisticsDto.java

@@ -43,9 +43,11 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     private String roomId;
     private String roomNum;
     private String carNum;
+    private String psName;
     private String contractCode;
     private String payerObjType;
     private String ownerName;
+    private String ownerId;
     private String detailId;
     private String builtUpArea;
 
@@ -706,4 +708,20 @@ public class ReportFeeMonthStatisticsDto extends PageDto implements Serializable
     public void setAllHisOweReceivedAmount(double allHisOweReceivedAmount) {
         this.allHisOweReceivedAmount = allHisOweReceivedAmount;
     }
+
+    public String getOwnerId() {
+        return ownerId;
+    }
+
+    public void setOwnerId(String ownerId) {
+        this.ownerId = ownerId;
+    }
+
+    public String getPsName() {
+        return psName;
+    }
+
+    public void setPsName(String psName) {
+        this.psName = psName;
+    }
 }

+ 25 - 3
java110-db/src/main/resources/mapper/report/ReportFeeMonthStatisticsServiceDaoImplMapper.xml

@@ -776,7 +776,8 @@
         SUM(t.his_owe_amount + t.cur_receivable_amount) allReceivableAmount,
         SUM(t.cur_received_amount+t.his_owe_received_amount+t.pre_received_amount) allReceivedAmount,
         if(SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount) < 0,0,
-        SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount)) allOweAmount,
+        SUM(t.his_owe_amount + t.cur_receivable_amount - t.cur_received_amount - t.his_owe_received_amount))
+        allOweAmount,
         SUM(t.his_owe_received_amount) allHisOweReceivedAmount
         from report_fee_month_statistics t
         inner join pay_fee_config pfc on t.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -1221,13 +1222,14 @@
 
     <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
     <select id="queryPayFeeDetail" parameterType="Map" resultType="Map">
-        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,br.built_up_area builtUpArea ,oc.car_num carNum,
+        select pfc.fee_name feeName,f.floor_num floorNum,bu.unit_num unitNum,br.room_num roomNum,br.built_up_area
+        builtUpArea ,oc.car_num carNum,
         pf.payer_obj_type payerObjType,t.start_time startTime,t.end_time endTime,t.create_time createTime,
         t.receivable_amount receivableAmount,t.received_amount receivedAmount,pfa.`value`
         importFeeName,t.prime_rate,d.name primeRate,fdr.discount_small_type discountSmallType,fdr.rule_name
         ruleName,pfdd.discount_price discountPrice,co.contract_code contractCode,pfo.`value` ownerName,cb.o_id oId,
         d2.name feeTypeCdName,pfc.fee_type_cd feeTypeCd,t.state,d3.name stateName,t.fee_id feeId,pft.`value` repairId,
-        t.detail_id,t.detail_id detailId,pf.payer_obj_id
+        t.detail_id,t.detail_id detailId,pf.payer_obj_id,pfb.value ownerId,concat(pa.num,'停车场',ps.num,'车位') psName
         from pay_fee_detail t
         INNER JOIN pay_fee pf on t.fee_id = pf.fee_id and pf.status_cd = '0'
         inner join pay_fee_config pfc on pf.config_id = pfc.config_id and pfc.status_cd = '0'
@@ -1235,7 +1237,10 @@
         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 owner_car oc on pf.payer_obj_id = oc.car_id and oc.car_type_cd='1001'
+        LEFT JOIN parking_space ps on oc.ps_id = ps.ps_id and ps.status_cd = '0'
+        left join parking_area pa on ps.pa_id = pa.pa_id and pa.status_cd = '0'
         left join pay_fee_attrs pfa on t.fee_id = pfa.fee_id and pfa.spec_cd = '390002'
+        left join pay_fee_attrs pfb on t.fee_id = pfb.fee_id and pfb.spec_cd = '390007'
         left join pay_fee_attrs pfo on t.fee_id = pfo.fee_id and pfo.spec_cd = '390008'
         left join pay_fee_attrs pft on t.fee_id = pft.fee_id and pft.spec_cd = '390001'
         left join pay_fee_detail_discount pfdd on t.detail_id = pfdd.detail_id and pfdd.status_cd = '0'
@@ -2566,4 +2571,21 @@
         </if>
     </select>
 
+    <!-- 查询费用月统计信息 add by wuxw 2018-07-03 -->
+    <select id="queryRoomAndParkingSpace" parameterType="Map" resultType="Map">
+        select
+        br.room_id roomId,br.room_num roomNum,bu.unit_num unitNum,f.floor_num floorNum,t.owner_id ownerId
+        from building_owner_room_rel t
+        left join building_room br on t.room_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'
+        left join f_floor f on bu.floor_id = f.floor_id and f.status_cd = '0'
+        where t.status_cd = '0'
+        and t.owner_id in
+        <foreach collection="ownerIds" item="item" open="(" close=")" separator=",">
+            #{item}
+        </foreach>
+    </select>
+
+
+
 </mapper>

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

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.java110.config.feign.FeignConfiguration;
 import com.java110.dto.RoomDto;
 import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.repair.RepairUserDto;
 import com.java110.dto.report.ReportDeposit;
 import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
@@ -387,4 +388,12 @@ public interface IReportFeeMonthStatisticsInnerServiceSMO {
 
     @RequestMapping(value = "/queryHuaningOweFeeDetail", method = RequestMethod.POST)
     List<Map> queryHuaningOweFeeDetail(@RequestBody Map paramInfo);
+
+    /**
+     *
+     * @param ownerDto
+     * @return
+     */
+    @RequestMapping(value = "/queryRoomAndParkingSpace", method = RequestMethod.POST)
+    List<OwnerDto> queryRoomAndParkingSpace(@RequestBody OwnerDto ownerDto);
 }

+ 2 - 1
service-api/src/main/java/com/java110/api/smo/assetExport/impl/ExportReportFeeSMOImpl.java

@@ -353,7 +353,7 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
         row.createCell(15).setCellValue("空置房打折金额");
         row.createCell(16).setCellValue("空置房减免金额");
         row.createCell(17).setCellValue("面积");
-//        row.createCell(14).setCellValue("业主");
+        row.createCell(18).setCellValue("车位");
         //查询楼栋信息
         JSONArray rooms = this.getReportPayFeeDetail(pd, result);
         if (rooms == null || rooms.size() == 0) {
@@ -381,6 +381,7 @@ public class ExportReportFeeSMOImpl extends DefaultAbstractComponentSMO implemen
             row.createCell(15).setCellValue(dataObj.getDouble("vacantHousingDiscount"));
             row.createCell(16).setCellValue(dataObj.getDouble("vacantHousingReduction"));
             row.createCell(17).setCellValue(dataObj.getString("builtUpArea"));
+            row.createCell(18).setCellValue(dataObj.getString("psName"));
         }
     }
 

+ 49 - 1
service-report/src/main/java/com/java110/report/bmo/reportFeeMonthStatistics/impl/GetReportFeeMonthStatisticsBMOImpl.java

@@ -20,7 +20,6 @@ import com.java110.intf.user.IOwnerInnerServiceSMO;
 import com.java110.intf.user.IOwnerRoomRelInnerServiceSMO;
 import com.java110.report.bmo.reportFeeMonthStatistics.IGetReportFeeMonthStatisticsBMO;
 import com.java110.utils.util.Assert;
-import com.java110.utils.util.BeanConvertUtil;
 import com.java110.utils.util.DateUtil;
 import com.java110.utils.util.StringUtil;
 import com.java110.vo.ResultVo;
@@ -41,6 +40,9 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
 
     private static final Logger logger = LoggerFactory.getLogger(GetReportFeeMonthStatisticsBMOImpl.class);
 
+
+    private int MAX_ROWS = 500;  // 最大行数
+
     @Autowired
     private IReportFeeMonthStatisticsInnerServiceSMO reportFeeMonthStatisticsInnerServiceSMOImpl;
 
@@ -391,6 +393,8 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         Double allVacantHousingDiscount = 0.0;
         //空置房减免(大计)
         Double allVacantHousingReduction = 0.0;
+
+
         //吴学文 注释 感觉和上面的369 功能重复
         //int size = 0;
         if (count > 0) {
@@ -448,6 +452,7 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
             Double totalVacantHousingReduction = 0.0;
             //滞纳金(小计)
             Double totalLateFee = 0.0;
+            List<String> ownerIds = new ArrayList<>();
             for (ReportFeeMonthStatisticsDto reportFeeMonthStatistics : reportFeeMonthStatisticsDtos) {
                 //应收金额
                 Double receivableAmount = Double.valueOf(reportFeeMonthStatistics.getReceivableAmount());
@@ -455,6 +460,18 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
                 Double receivedAmount = Double.valueOf(reportFeeMonthStatistics.getReceivedAmount());
                 totalReceivableAmount = totalReceivableAmount + receivableAmount;
                 totalReceivedAmount = totalReceivedAmount + receivedAmount;
+
+                if (FeeDto.PAYER_OBJ_TYPE_CAR.equals(reportFeeMonthStatistics.getPayerObjType())) {
+                    ownerIds.add(reportFeeMonthStatistics.getOwnerId());
+                }
+
+                // 最大记录时 就去刷新
+                //如果是车位刷房屋信息
+                if (ownerIds.size() == MAX_ROWS) {
+                    refreshReportFeeMonthStatistics(ownerIds, reportFeeMonthStatisticsDtos);
+                    ownerIds = new ArrayList<>();
+                }
+
                 //优惠金额
                 if (!StringUtil.isEmpty(reportFeeMonthStatistics.getDiscountSmallType()) && reportFeeMonthStatistics.getDiscountSmallType().equals("1")) {
                     //获取优惠金额
@@ -582,6 +599,12 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
                     reportList.add(reportFeeMonthStatistics);
                 }
             }
+
+            //如果是车位刷房屋信息
+            if (ownerIds.size() > 0) {
+                refreshReportFeeMonthStatistics(ownerIds, reportFeeMonthStatisticsDtos);
+            }
+
             //应收总金额(小计)
             reportFeeMonthStatisticsTotalDto.setTotalReceivableAmount(String.format("%.2f", totalReceivableAmount));
             //实收金额(小计)
@@ -623,6 +646,31 @@ public class GetReportFeeMonthStatisticsBMOImpl implements IGetReportFeeMonthSta
         return responseEntity;
     }
 
+    /**
+     * @param ownerIds
+     * @param reportFeeMonthStatisticsDtos
+     */
+    private void refreshReportFeeMonthStatistics(List<String> ownerIds, List<ReportFeeMonthStatisticsDto> reportFeeMonthStatisticsDtos) {
+
+        if (ownerIds == null || ownerIds.size() < 1) {
+            return;
+        }
+
+        OwnerDto ownerDto = new OwnerDto();
+        ownerDto.setOwnerIds(ownerIds.toArray(new String[ownerIds.size()]));
+        List<OwnerDto> ownerDtos = reportFeeMonthStatisticsInnerServiceSMOImpl.queryRoomAndParkingSpace(ownerDto);
+        String objName = "";
+        for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportFeeMonthStatisticsDtos) {
+            for (OwnerDto ownerDto1 : ownerDtos) {
+                if (!reportFeeMonthStatisticsDto.getOwnerId().equals(ownerDto1.getOwnerId())) {
+                    continue;
+                }
+                objName = reportFeeMonthStatisticsDto.getObjName() + "(" + ownerDto1.getFloorNum() + "栋" + ownerDto1.getUnitNum() + "单元" + ownerDto1.getRoomNum() + "室)";
+                reportFeeMonthStatisticsDto.setObjName(objName);
+            }
+        }
+    }
+
     private boolean hasInReportListAndMerge(List<ReportFeeMonthStatisticsDto> reportList, ReportFeeMonthStatisticsDto reportFeeMonthStatistics) {
         for (ReportFeeMonthStatisticsDto reportFeeMonthStatisticsDto : reportList) {
             if (reportFeeMonthStatisticsDto.getDetailId().equals(reportFeeMonthStatistics.getDetailId())) {

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

@@ -334,4 +334,11 @@ public interface IReportFeeMonthStatisticsServiceDao {
      * @return
      */
     double getReceivedAmountByMonth(Map beanCovertMap);
+
+    /**
+     *
+     * @param info
+     * @return
+     */
+    List<Map> queryRoomAndParkingSpace(Map info);
 }

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

@@ -97,6 +97,15 @@ public class ReportFeeMonthStatisticsServiceDaoImpl extends BaseServiceDao imple
         return Double.parseDouble(businessReportFeeMonthStatisticsInfos.get(0).get("total").toString());
     }
 
+    @Override
+    public List<Map> queryRoomAndParkingSpace(Map info) {
+        logger.debug("查询费用月统计信息 入参 info : {}", info);
+
+        List<Map> businessReportFeeMonthStatisticsInfos = sqlSessionTemplate.selectList("reportFeeMonthStatisticsServiceDaoImpl.queryRoomAndParkingSpace", info);
+
+        return businessReportFeeMonthStatisticsInfos;
+    }
+
     /**
      * 修改费用月统计信息
      *

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

@@ -7,6 +7,7 @@ import com.java110.core.base.smo.BaseServiceSMO;
 import com.java110.dto.PageDto;
 import com.java110.dto.RoomDto;
 import com.java110.dto.fee.FeeConfigDto;
+import com.java110.dto.owner.OwnerDto;
 import com.java110.dto.repair.RepairUserDto;
 import com.java110.dto.report.ReportDeposit;
 import com.java110.dto.reportFeeMonthStatistics.ReportFeeMonthStatisticsDto;
@@ -526,6 +527,13 @@ public class ReportFeeMonthStatisticsInnerServiceSMOImpl extends BaseServiceSMO
         return deposits;
     }
 
+    @Override
+    public List<OwnerDto> queryRoomAndParkingSpace(@RequestBody OwnerDto ownerDto) {
+        List<OwnerDto> deposits = BeanConvertUtil.covertBeanList(reportFeeMonthStatisticsServiceDaoImpl.queryRoomAndParkingSpace(BeanConvertUtil.beanCovertMap(ownerDto)),
+                OwnerDto.class);
+        return deposits;
+    }
+
     public IReportFeeMonthStatisticsServiceDao getReportFeeMonthStatisticsServiceDaoImpl() {
         return reportFeeMonthStatisticsServiceDaoImpl;
     }