wuxw
2025-02-28 307bc98d632594a5081d1bf21b392277df2b6893
service-user/src/main/java/com/java110/user/bmo/owner/impl/QueryOwnerStatisticsBMOImpl.java
@@ -1,6 +1,9 @@
package com.java110.user.bmo.owner.impl;
import com.java110.dto.community.CommunityDto;
import com.java110.dto.owner.OwnerDto;
import com.java110.dto.room.RoomDto;
import com.java110.intf.community.ICommunityV1InnerServiceSMO;
import com.java110.intf.store.IComplaintV1InnerServiceSMO;
import com.java110.intf.community.IRepairPoolV1InnerServiceSMO;
import com.java110.intf.report.IReportOweFeeInnerServiceSMO;
@@ -9,6 +12,7 @@
import com.java110.intf.user.IOwnerRoomRelV1InnerServiceSMO;
import com.java110.intf.user.IOwnerV1InnerServiceSMO;
import com.java110.user.bmo.owner.IQueryOwnerStatisticsBMO;
import com.java110.utils.util.ListUtil;
import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -22,7 +26,7 @@
public class QueryOwnerStatisticsBMOImpl implements IQueryOwnerStatisticsBMO {
    public static final int MAX_LINE_COUNT = 15;
    @Autowired
    private IOwnerRoomRelV1InnerServiceSMO ownerRoomRelV1InnerServiceSMOImpl;
@@ -44,21 +48,24 @@
    @Autowired
    private IContractInnerServiceSMO contractInnerServiceSMOImpl;
    @Autowired
    private ICommunityV1InnerServiceSMO communityV1InnerServiceSMOImpl;
    @Override
    public List<OwnerDto> query(List<OwnerDto> ownerDtos) {
        if(ownerDtos == null || ownerDtos.size() < 1){
        if (ListUtil.isNull(ownerDtos)) {
            return ownerDtos;
        }
        //这里限制行数,以免影响系统性能
        if(ownerDtos.size() > MAX_LINE_COUNT){
        if (ownerDtos.size() > MAX_LINE_COUNT) {
            return ownerDtos;
        }
        List<String> ownerIds = new ArrayList<>();
        List<String> memberIds = new ArrayList<>();
        List<String> ownerTels = new ArrayList<>();
        for(OwnerDto ownerDto : ownerDtos){
        for (OwnerDto ownerDto : ownerDtos) {
            ownerIds.add(ownerDto.getOwnerId());
            ownerTels.add(ownerDto.getLink());
            memberIds.add(ownerDto.getMemberId());
@@ -66,13 +73,13 @@
        // 查询 房屋数量
        queryRoomCount(ownerIds,ownerDtos);
        queryRoomCount(ownerIds, ownerDtos);
        // 查询 家庭成员数
        queryOwnerMemberCount(ownerIds,ownerDtos);
        queryOwnerMemberCount(ownerIds, ownerDtos);
        // 查询 车辆数
        queryCarCount(memberIds,ownerDtos);
        queryCarCount(memberIds, ownerDtos);
        // 查询 投诉数
        //queryComplaintCount(ownerTels,ownerDtos);
@@ -81,7 +88,54 @@
        //queryRepairCount(ownerTels,ownerDtos);
        // 查询业主欠费
        queryOwnerOweFee(ownerIds,ownerDtos);
        queryOwnerOweFee(ownerIds, ownerDtos);
        // 查询业主合同
        //queryOwnerContractCount(ownerIds,ownerDtos);
        return ownerDtos;
    }
    @Override
    public List<OwnerDto> queryAdminData(List<OwnerDto> ownerDtos) {
        if (ListUtil.isNull(ownerDtos)) {
            return ownerDtos;
        }
        //这里限制行数,以免影响系统性能
        if (ownerDtos.size() > MAX_LINE_COUNT) {
            return ownerDtos;
        }
        List<String> ownerIds = new ArrayList<>();
        List<String> memberIds = new ArrayList<>();
        List<String> ownerTels = new ArrayList<>();
        List<String> communityIds = new ArrayList<>();
        for (OwnerDto ownerDto : ownerDtos) {
            ownerIds.add(ownerDto.getOwnerId());
            ownerTels.add(ownerDto.getLink());
            memberIds.add(ownerDto.getMemberId());
            communityIds.add(ownerDto.getCommunityId());
        }
// 查询小区名称
        queryCommunityName(communityIds,ownerDtos);
        // 查询 房屋数量
        queryRoomCount(ownerIds, ownerDtos);
        // 查询 家庭成员数
        queryOwnerMemberCount(ownerIds, ownerDtos);
        // 查询 车辆数
        queryCarCount(memberIds, ownerDtos);
        // 查询 投诉数
        //queryComplaintCount(ownerTels,ownerDtos);
        // 查询 报修数
        //queryRepairCount(ownerTels,ownerDtos);
        // 查询业主欠费
        queryOwnerOweFee(ownerIds, ownerDtos);
        // 查询业主合同
        //queryOwnerContractCount(ownerIds,ownerDtos);
@@ -91,13 +145,13 @@
    private void queryOwnerContractCount(List<String> ownerIds, List<OwnerDto> ownerDtos) {
        Map info = new HashMap();
        info.put("communityId",ownerDtos.get(0).getCommunityId());
        info.put("ownerIds",ownerIds.toArray(new String[ownerIds.size()]));
        info.put("communityId", ownerDtos.get(0).getCommunityId());
        info.put("ownerIds", ownerIds.toArray(new String[ownerIds.size()]));
        List<Map> contractsCount = contractInnerServiceSMOImpl.queryContractsByOwnerIds(info);
        for(OwnerDto ownerDto : ownerDtos) {
        for (OwnerDto ownerDto : ownerDtos) {
            for (Map count : contractsCount) {
                if(ownerDto.getOwnerId().equals(count.get("ownerId"))){
                if (ownerDto.getOwnerId().equals(count.get("ownerId"))) {
                    ownerDto.setContractCount(count.get("contractCount").toString());
                }
            }
@@ -106,18 +160,19 @@
    /**
     * 查询业主欠费
     *
     * @param ownerIds
     * @param ownerDtos
     */
    private void queryOwnerOweFee(List<String> ownerIds, List<OwnerDto> ownerDtos) {
        Map info = new HashMap();
        info.put("communityId",ownerDtos.get(0).getCommunityId());
        info.put("ownerIds",ownerIds.toArray(new String[ownerIds.size()]));
        info.put("communityId", ownerDtos.get(0).getCommunityId());
        info.put("ownerIds", ownerIds.toArray(new String[ownerIds.size()]));
        List<Map> repairCounts = reportOweFeeInnerServiceSMOImpl.queryOweFeesByOwnerIds(info);
        for(OwnerDto ownerDto : ownerDtos) {
        for (OwnerDto ownerDto : ownerDtos) {
            for (Map count : repairCounts) {
                if(ownerDto.getOwnerId().equals(count.get("ownerId"))){
                if (ownerDto.getOwnerId().equals(count.get("ownerId"))) {
                    ownerDto.setOweFee(count.get("oweFee").toString());
                }
            }
@@ -127,6 +182,7 @@
    /**
     * 查询业主投诉数
     *
     * @param ownerTels
     * @param ownerDtos
     */
@@ -134,13 +190,13 @@
        Map info = new HashMap();
        info.put("communityId",ownerDtos.get(0).getCommunityId());
        info.put("ownerTels",ownerTels.toArray(new String[ownerTels.size()]));
        info.put("communityId", ownerDtos.get(0).getCommunityId());
        info.put("ownerTels", ownerTels.toArray(new String[ownerTels.size()]));
        List<Map> repairCounts = repairPoolV1InnerServiceSMOImpl.queryRepairCountByOwnerTels(info);
        for(OwnerDto ownerDto : ownerDtos) {
        for (OwnerDto ownerDto : ownerDtos) {
            for (Map count : repairCounts) {
                if(ownerDto.getLink().equals(count.get("ownerTel"))){
                if (ownerDto.getLink().equals(count.get("ownerTel"))) {
                    ownerDto.setRepairCount(count.get("repairCount").toString());
                }
            }
@@ -149,6 +205,7 @@
    /**
     * 查询业主投诉数
     *
     * @param ownerTels
     * @param ownerDtos
     */
@@ -156,13 +213,13 @@
        Map info = new HashMap();
        info.put("communityId",ownerDtos.get(0).getCommunityId());
        info.put("ownerTels",ownerTels.toArray(new String[ownerTels.size()]));
        info.put("communityId", ownerDtos.get(0).getCommunityId());
        info.put("ownerTels", ownerTels.toArray(new String[ownerTels.size()]));
        List<Map> complaintCounts = complaintV1InnerServiceSMOImpl.queryComplaintCountByOwnerTels(info);
        for(OwnerDto ownerDto : ownerDtos) {
        for (OwnerDto ownerDto : ownerDtos) {
            for (Map count : complaintCounts) {
                if(ownerDto.getLink().equals(count.get("ownerTel"))){
                if (ownerDto.getLink().equals(count.get("ownerTel"))) {
                    ownerDto.setComplaintCount(count.get("complaintCount").toString());
                }
            }
@@ -171,6 +228,7 @@
    /**
     * 查询业主车辆数
     *
     * @param memberIds
     * @param ownerDtos
     */
@@ -178,9 +236,9 @@
        List<Map> memberCounts = ownerCarV1InnerServiceSMOImpl.queryOwnerCarCountByOwnerIds(memberIds);
        for(OwnerDto ownerDto : ownerDtos) {
        for (OwnerDto ownerDto : ownerDtos) {
            for (Map count : memberCounts) {
                if(ownerDto.getMemberId().equals(count.get("ownerId"))){
                if (ownerDto.getMemberId().equals(count.get("ownerId"))) {
                    ownerDto.setCarCount(count.get("carCount").toString());
                }
            }
@@ -189,6 +247,7 @@
    /**
     * 查询 业主成员数
     *
     * @param ownerIds
     * @param ownerDtos
     */
@@ -196,13 +255,13 @@
        List<Map> memberCounts = ownerV1InnerServiceSMOImpl.queryOwnerMembersCount(ownerIds);
        for(OwnerDto ownerDto : ownerDtos) {
            if(OwnerDto.OWNER_TYPE_CD_MEMBER.equals(ownerDto.getOwnerTypeCd())){
        for (OwnerDto ownerDto : ownerDtos) {
            if (OwnerDto.OWNER_TYPE_CD_MEMBER.equals(ownerDto.getOwnerTypeCd())) {
                ownerDto.setMemberCount("0");
                continue;
            }
            for (Map count : memberCounts) {
                if(ownerDto.getOwnerId().equals(count.get("ownerId"))){
                if (ownerDto.getOwnerId().equals(count.get("ownerId"))) {
                    ownerDto.setMemberCount(count.get("memberCount").toString());
                }
            }
@@ -211,6 +270,7 @@
    /**
     * 查询 房屋数量
     *
     * @param ownerIds
     * @param ownerDtos
     */
@@ -219,18 +279,38 @@
        //查询业主房屋数
        List<Map> ownerRoomCounts = ownerRoomRelV1InnerServiceSMOImpl.queryRoomCountByOwnerIds(ownerIds);
        for(OwnerDto ownerDto : ownerDtos) {
        for (OwnerDto ownerDto : ownerDtos) {
            for (Map count : ownerRoomCounts) {
                if(StringUtil.isEmpty(ownerDto.getOwnerId())){
                if (StringUtil.isEmpty(ownerDto.getOwnerId())) {
                    continue;
                }
                if(StringUtil.isEmpty(count.get("ownerId").toString())){
                if (StringUtil.isEmpty(count.get("ownerId").toString())) {
                    continue;
                }
                if(ownerDto.getOwnerId().equals(count.get("ownerId").toString())){
                if (ownerDto.getOwnerId().equals(count.get("ownerId").toString())) {
                    ownerDto.setRoomCount(count.get("roomCount").toString());
                }
            }
        }
    }
    private void queryCommunityName(List<String> communityIds, List<OwnerDto> ownerDtos) {
        if(ListUtil.isNull(communityIds)){
            return ;
        }
        CommunityDto communityDto = new CommunityDto();
        communityDto.setCommunityIds(communityIds.toArray(new String[communityIds.size()]));
        List<CommunityDto> communityDtos = communityV1InnerServiceSMOImpl.queryCommunitys(communityDto);
        if(ListUtil.isNull(communityDtos)){
            return;
        }
        for (OwnerDto tmpOwnerDto : ownerDtos) {
            for (CommunityDto tCommunityDto : communityDtos) {
                if (!tmpOwnerDto.getCommunityId().equals(tCommunityDto.getCommunityId())) {
                    continue;
                }
                tmpOwnerDto.setCommunityName(tCommunityDto.getName());
            }
        }
    }
}