Your Name
2023-04-17 da3b5c72fa45bc26a9868c2b26e3efda14845179
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package com.java110.report.bmo.search.impl;
 
import com.java110.dto.data.SearchDataDto;
import com.java110.dto.owner.OwnerDto;
import com.java110.intf.user.IOwnerInnerServiceSMO;
import com.java110.intf.user.IOwnerV1InnerServiceSMO;
import com.java110.report.bmo.search.ISearchOwnerBMO;
import com.java110.report.bmo.search.ISearchOwnerMemberBMO;
import com.java110.utils.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
 
import java.util.ArrayList;
import java.util.List;
 
@Service
public class SearchOwnerMemberBMOImpl implements ISearchOwnerMemberBMO {
    @Autowired
    private IOwnerV1InnerServiceSMO ownerV1InnerServiceSMOImpl;
 
    @Override
    public SearchDataDto query(SearchDataDto searchDataDto) {
        List<OwnerDto> ownerDtos = new ArrayList<>();
 
        //todo 根据名称模糊
        queryOwnerMemberByName(searchDataDto,ownerDtos);
 
        //todo 根据手机号查询
        queryOwnerMemberByLink(searchDataDto,ownerDtos);
 
        searchDataDto.setOwnerMembers(ownerDtos);
 
        return searchDataDto;
    }
 
    private void queryOwnerMemberByLink(SearchDataDto searchDataDto, List<OwnerDto> ownerDtos) {
 
        if(StringUtil.isEmpty(searchDataDto.getTel())){
            return ;
        }
 
        OwnerDto ownerDto = new OwnerDto();
        ownerDto.setLink(searchDataDto.getTel());
        ownerDto.setCommunityId(searchDataDto.getCommunityId());
        ownerDto.setOwnerTypeCds(new String[]{OwnerDto.OWNER_TYPE_CD_MEMBER,OwnerDto.OWNER_TYPE_CD_RENTING});
        List<OwnerDto> tmpOwnerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
        if(tmpOwnerDtos == null || tmpOwnerDtos.size() < 1){
            return ;
        }
 
        ownerDtos.addAll(tmpOwnerDtos);
    }
 
    private void queryOwnerMemberByName(SearchDataDto searchDataDto, List<OwnerDto> ownerDtos) {
 
        OwnerDto ownerDto = new OwnerDto();
        ownerDto.setNameLike(searchDataDto.getSearchValue());
        ownerDto.setCommunityId(searchDataDto.getCommunityId());
        ownerDto.setOwnerTypeCds(new String[]{OwnerDto.OWNER_TYPE_CD_MEMBER,OwnerDto.OWNER_TYPE_CD_RENTING,OwnerDto.OWNER_TYPE_CD_TEMP,OwnerDto.OWNER_TYPE_CD_OTHER});
        List<OwnerDto> tmpOwnerDtos = ownerV1InnerServiceSMOImpl.queryOwners(ownerDto);
        if(tmpOwnerDtos == null || tmpOwnerDtos.size() < 1){
            return ;
        }
 
        ownerDtos.addAll(tmpOwnerDtos);
    }
}