|
@@ -6,17 +6,20 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
7
|
7
|
import com.huiju.estateagents.base.ResponseBean;
|
8
|
8
|
import com.huiju.estateagents.common.CommConstant;
|
9
|
|
-import com.huiju.estateagents.entity.TaBuildingApartment;
|
10
|
|
-import com.huiju.estateagents.entity.TaBuildingBlock;
|
11
|
|
-import com.huiju.estateagents.entity.TaHousingResources;
|
|
9
|
+import com.huiju.estateagents.entity.*;
|
|
10
|
+import com.huiju.estateagents.mapper.TaApartmentImgMapper;
|
|
11
|
+import com.huiju.estateagents.mapper.TaBuildingImgMapper;
|
12
|
12
|
import com.huiju.estateagents.mapper.TaHousingResourcesMapper;
|
|
13
|
+import com.huiju.estateagents.mapper.TaPreselectionRecordMapper;
|
13
|
14
|
import com.huiju.estateagents.po.TaHousingResourcesPO;
|
14
|
15
|
import com.huiju.estateagents.service.ITaHousingResourcesService;
|
|
16
|
+import org.apache.commons.collections.CollectionUtils;
|
15
|
17
|
import org.slf4j.Logger;
|
16
|
18
|
import org.slf4j.LoggerFactory;
|
17
|
19
|
import org.springframework.beans.factory.annotation.Autowired;
|
18
|
20
|
import org.springframework.stereotype.Service;
|
19
|
21
|
|
|
22
|
+import java.util.ArrayList;
|
20
|
23
|
import java.util.List;
|
21
|
24
|
|
22
|
25
|
/**
|
|
@@ -35,6 +38,15 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
|
35
|
38
|
@Autowired
|
36
|
39
|
private TaHousingResourcesMapper taHousingResourcesMapper;
|
37
|
40
|
|
|
41
|
+ @Autowired
|
|
42
|
+ private TaPreselectionRecordMapper taPreselectionRecordMapper;
|
|
43
|
+
|
|
44
|
+ @Autowired
|
|
45
|
+ TaBuildingImgMapper taBuildingImgMapper;
|
|
46
|
+
|
|
47
|
+ @Autowired
|
|
48
|
+ TaApartmentImgMapper taApartmentImgMapper;
|
|
49
|
+
|
38
|
50
|
/**
|
39
|
51
|
* 分页获取房源详情数据
|
40
|
52
|
*
|
|
@@ -91,7 +103,32 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
|
91
|
103
|
public List<TaBuildingApartment> listBuildApartmentBySalesBatchId(String salesBatchId) {
|
92
|
104
|
logger.info("listBuildApartmentBySalesBatchId 接收参数:salesBatchId:{}", salesBatchId);
|
93
|
105
|
|
94
|
|
- return taHousingResourcesMapper.listBuildApartmentBySalesBatchId(salesBatchId);
|
|
106
|
+ // 获取户型列表
|
|
107
|
+ List<TaBuildingApartment> apartmentList = taHousingResourcesMapper.listBuildApartmentBySalesBatchId(salesBatchId);
|
|
108
|
+ if (CollectionUtils.isEmpty(apartmentList)) {
|
|
109
|
+ return null;
|
|
110
|
+ }
|
|
111
|
+
|
|
112
|
+ // 组装户型图片
|
|
113
|
+ List<TaBuildingApartment> resultList = new ArrayList<>();
|
|
114
|
+ List<TaBuildingImg> taBuildingImgList;
|
|
115
|
+ List<TaApartmentImg> buildingImg;
|
|
116
|
+ QueryWrapper<TaApartmentImg> apartmentImgQueryWrapper;
|
|
117
|
+ QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
|
|
118
|
+ for (TaBuildingApartment apartment : apartmentList) {
|
|
119
|
+ apartmentImgQueryWrapper = new QueryWrapper<>();
|
|
120
|
+ apartmentImgQueryWrapper.eq("apartment_id", apartment.getApartmentId());
|
|
121
|
+ buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
|
|
122
|
+ for (TaApartmentImg apartmentImg : buildingImg) {
|
|
123
|
+ buildingImgQueryWrapper = new QueryWrapper<>();
|
|
124
|
+ buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
|
|
125
|
+ buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
|
|
126
|
+ taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
|
|
127
|
+ apartment.setBuildingImgList(taBuildingImgList);
|
|
128
|
+ resultList.add(apartment);
|
|
129
|
+ }
|
|
130
|
+ }
|
|
131
|
+ return resultList;
|
95
|
132
|
}
|
96
|
133
|
|
97
|
134
|
/**
|
|
@@ -105,6 +142,37 @@ public class TaHousingResourcesServiceImpl extends ServiceImpl<TaHousingResource
|
105
|
142
|
public TaHousingResourcesPO getHousingDetailById(String personId, String houseId) {
|
106
|
143
|
logger.info("getHousingDetailById 接收参数:personId:{},houseId:{}", personId, houseId);
|
107
|
144
|
|
108
|
|
- return taHousingResourcesMapper.getHousingDetailById(houseId, "1");
|
|
145
|
+ // 查询房源详情
|
|
146
|
+ TaHousingResourcesPO resourcesPO = taHousingResourcesMapper.getHousingDetailById(houseId, "1");
|
|
147
|
+ if (resourcesPO == null) {
|
|
148
|
+ return null;
|
|
149
|
+ }
|
|
150
|
+
|
|
151
|
+ // 获取该用户是否预选房源信息
|
|
152
|
+ TaPreselectionRecord taPreselectionRecord = taPreselectionRecordMapper.getRecordByPersonIdAndHouseId(personId, houseId);
|
|
153
|
+ if (taPreselectionRecord == null) {
|
|
154
|
+ resourcesPO.setIsPreselect(false);
|
|
155
|
+ } else {
|
|
156
|
+ resourcesPO.setIsPreselect(true);
|
|
157
|
+ }
|
|
158
|
+
|
|
159
|
+ // 获取户型图片列表
|
|
160
|
+ List<TaBuildingImg> taBuildingImgList = new ArrayList<>();
|
|
161
|
+ List<TaApartmentImg> buildingImg;
|
|
162
|
+ QueryWrapper<TaBuildingImg> buildingImgQueryWrapper;
|
|
163
|
+ QueryWrapper<TaApartmentImg> apartmentImgQueryWrapper = new QueryWrapper<>();
|
|
164
|
+ apartmentImgQueryWrapper.eq("apartment_id", resourcesPO.getApartmentId());
|
|
165
|
+ buildingImg = taApartmentImgMapper.selectList(apartmentImgQueryWrapper);
|
|
166
|
+ for (TaApartmentImg apartmentImg : buildingImg) {
|
|
167
|
+ buildingImgQueryWrapper = new QueryWrapper<>();
|
|
168
|
+ buildingImgQueryWrapper.eq("img_id", apartmentImg.getImgId());
|
|
169
|
+ buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
|
|
170
|
+ taBuildingImgList = taBuildingImgMapper.selectList(buildingImgQueryWrapper);
|
|
171
|
+ }
|
|
172
|
+ if(CollectionUtils.isNotEmpty(taBuildingImgList)){
|
|
173
|
+ resourcesPO.setBuildingImgList(taBuildingImgList);
|
|
174
|
+ }
|
|
175
|
+
|
|
176
|
+ return resourcesPO;
|
109
|
177
|
}
|
110
|
178
|
}
|