|
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
6
|
6
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
7
|
7
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
8
|
8
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
9
|
+import com.google.common.collect.Lists;
|
9
|
10
|
import com.huiju.estateagents.base.ResponseBean;
|
10
|
11
|
import com.huiju.estateagents.common.CommConstant;
|
11
|
12
|
import com.huiju.estateagents.common.DateUtils;
|
|
@@ -98,7 +99,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
98
|
99
|
//查询当前图片
|
99
|
100
|
QueryWrapper<TaBuildingImg> queryWrapper = new QueryWrapper<>();
|
100
|
101
|
queryWrapper.eq("building_id", taBuilding.getBuildingId());
|
101
|
|
- queryWrapper.eq("img_type", "banner");
|
|
102
|
+ queryWrapper.eq("img_type", CommConstant.BUILDING_IMG_BANNER);
|
102
|
103
|
queryWrapper.orderByAsc("create_date");
|
103
|
104
|
|
104
|
105
|
List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(queryWrapper);
|
|
@@ -121,6 +122,21 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
121
|
122
|
return ResponseBean.success(page);
|
122
|
123
|
}
|
123
|
124
|
|
|
125
|
+ /**
|
|
126
|
+ * 查询项目图片
|
|
127
|
+ * @param buildingId
|
|
128
|
+ * @param imgType
|
|
129
|
+ * @return
|
|
130
|
+ */
|
|
131
|
+ private List<TaBuildingImg> getBuildingImg(String buildingId, String imgType) {
|
|
132
|
+ //查询当前图片
|
|
133
|
+ QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
|
|
134
|
+ BuildingImgQueryWrapper.eq("building_id", buildingId);
|
|
135
|
+ BuildingImgQueryWrapper.eq("img_type", imgType);
|
|
136
|
+ List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(BuildingImgQueryWrapper);
|
|
137
|
+ return buildingImg.size() > 0 ? buildingImg : null;
|
|
138
|
+ }
|
|
139
|
+
|
124
|
140
|
@Override
|
125
|
141
|
public ResponseBean buildingSelectId(String id) {
|
126
|
142
|
// 查询基础信息
|
|
@@ -130,19 +146,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
130
|
146
|
TaBuilding building = taBuildingMapper.selectOne(buildingtWrapper);
|
131
|
147
|
|
132
|
148
|
//查询当前图片
|
133
|
|
- QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
|
134
|
|
- BuildingImgQueryWrapper.eq("building_id", id);
|
135
|
|
- BuildingImgQueryWrapper.eq("img_type", "banner");
|
136
|
|
- List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(BuildingImgQueryWrapper);
|
137
|
|
- building.setBuildingImg(buildingImg);
|
|
149
|
+ building.setBuildingImg(getBuildingImg(id, CommConstant.BUILDING_IMG_BANNER));
|
138
|
150
|
|
139
|
151
|
// 列表图
|
140
|
|
- QueryWrapper<TaBuildingImg> BuildingListImgQueryWrapper = new QueryWrapper<>();
|
141
|
|
- BuildingListImgQueryWrapper.eq("building_id", building.getBuildingId());
|
142
|
|
- BuildingListImgQueryWrapper.eq("img_type", "list");
|
143
|
|
- List<TaBuildingImg> buildingListImg = taBuildingImgMapper.selectList(BuildingListImgQueryWrapper);
|
144
|
|
- building.setBuildingListImg(buildingListImg);
|
|
152
|
+ building.setBuildingListImg(getBuildingImg(building.getBuildingId(), CommConstant.BUILDING_IMG_LIST));
|
145
|
153
|
|
|
154
|
+ // 视频封面图
|
|
155
|
+ building.setVideoImage(getBuildingImg(building.getBuildingId(), CommConstant.BUILDING_IMG_VIDEOIMAGE));
|
146
|
156
|
|
147
|
157
|
// 查询tag
|
148
|
158
|
QueryWrapper<TaBuildingTag> BuildingTagQueryWrapper = new QueryWrapper<>();
|
|
@@ -170,11 +180,10 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
170
|
180
|
TaBuilding building = taBuildingMapper.selectOne(buildingtWrapper);
|
171
|
181
|
|
172
|
182
|
//查询当前图片
|
173
|
|
- QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
|
174
|
|
- BuildingImgQueryWrapper.eq("building_id", id);
|
175
|
|
- BuildingImgQueryWrapper.eq("img_type", "banner");
|
176
|
|
- List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(BuildingImgQueryWrapper);
|
177
|
|
- building.setBuildingImg(buildingImg);
|
|
183
|
+ building.setBuildingImg(getBuildingImg(id, CommConstant.BUILDING_IMG_BANNER));
|
|
184
|
+
|
|
185
|
+ // 视频封面图
|
|
186
|
+ building.setVideoImage(getBuildingImg(building.getBuildingId(), CommConstant.BUILDING_IMG_VIDEOIMAGE));
|
178
|
187
|
|
179
|
188
|
// 查询tag
|
180
|
189
|
QueryWrapper<TaBuildingTag> BuildingTagQueryWrapper = new QueryWrapper<>();
|
|
@@ -268,7 +277,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
268
|
277
|
taBuildingMapper.update(building,buildingIdQueryWrapper);
|
269
|
278
|
QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
|
270
|
279
|
BuildingImgQueryWrapper.eq("building_id", building.getBuildingId());
|
271
|
|
- BuildingImgQueryWrapper.eq("img_type", "banner");
|
|
280
|
+ BuildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_BANNER);
|
272
|
281
|
taBuildingImgMapper.delete(BuildingImgQueryWrapper);
|
273
|
282
|
insertImgBatch(buildingImgs, building.getBuildingId());
|
274
|
283
|
}
|
|
@@ -279,11 +288,22 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
279
|
288
|
if (CollectionUtils.isNotEmpty(buildingListImg)) {
|
280
|
289
|
QueryWrapper<TaBuildingImg> BuildingListImgQueryWrapper = new QueryWrapper<>();
|
281
|
290
|
BuildingListImgQueryWrapper.eq("building_id", building.getBuildingId());
|
282
|
|
- BuildingListImgQueryWrapper.eq("img_type", "list");
|
|
291
|
+ BuildingListImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_LIST);
|
283
|
292
|
taBuildingImgMapper.delete(BuildingListImgQueryWrapper);
|
284
|
293
|
buildingListImg = insertImgBatch(buildingListImg, building.getBuildingId());
|
285
|
294
|
}
|
286
|
295
|
|
|
296
|
+ // 视频封面图
|
|
297
|
+ String videoImage = object.getString("videoImage");
|
|
298
|
+ List<TaBuildingImg> videoImageList = JSONObject.parseArray(videoImage, TaBuildingImg.class);
|
|
299
|
+ if (CollectionUtils.isNotEmpty(videoImageList)) {
|
|
300
|
+ QueryWrapper<TaBuildingImg> BuildingListImgQueryWrapper = new QueryWrapper<>();
|
|
301
|
+ BuildingListImgQueryWrapper.eq("building_id", building.getBuildingId());
|
|
302
|
+ BuildingListImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_VIDEOIMAGE);
|
|
303
|
+ taBuildingImgMapper.delete(BuildingListImgQueryWrapper);
|
|
304
|
+ videoImageList = insertImgBatch(videoImageList, building.getBuildingId());
|
|
305
|
+ }
|
|
306
|
+
|
287
|
307
|
|
288
|
308
|
// tag先删除再增加
|
289
|
309
|
String tagStr = object.getString("tag");
|
|
@@ -354,6 +374,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
354
|
374
|
buildingImgs = insertImgBatch(buildingImgs, building.getBuildingId());
|
355
|
375
|
}
|
356
|
376
|
|
|
377
|
+ // 视频封面图
|
|
378
|
+ String videoImage = object.getString("videoImage");
|
|
379
|
+ List<TaBuildingImg> videoImageList = JSONObject.parseArray(imgStr, TaBuildingImg.class);
|
|
380
|
+ if (CollectionUtils.isNotEmpty(videoImageList)) {
|
|
381
|
+ videoImageList = insertImgBatch(videoImageList, building.getBuildingId());
|
|
382
|
+ }
|
|
383
|
+
|
357
|
384
|
// 列表图
|
358
|
385
|
String listImg = object.getString("listImg");
|
359
|
386
|
List<TaBuildingImg> buildingListImg = JSONObject.parseArray(listImg, TaBuildingImg.class);
|
|
@@ -481,7 +508,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
481
|
508
|
for (TaApartmentImg apartmentImg:buildingImg){
|
482
|
509
|
QueryWrapper<TaBuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
|
483
|
510
|
buildingImgQueryWrapper.eq("img_id",apartmentImg.getImgId());
|
484
|
|
- buildingImgQueryWrapper.eq("img_type","aparment");
|
|
511
|
+ buildingImgQueryWrapper.eq("img_type",CommConstant.BUILDING_IMG_APARMENT);
|
485
|
512
|
List<TaBuildingImg> buildingImgList= taBuildingImgMapper.selectList(buildingImgQueryWrapper);
|
486
|
513
|
for (TaBuildingImg buImg:buildingImgList) {
|
487
|
514
|
arrayList.add(buImg);
|
|
@@ -539,11 +566,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
539
|
566
|
}
|
540
|
567
|
|
541
|
568
|
private void getBuildingAttaches(TaBuilding build) {
|
542
|
|
- QueryWrapper<TaBuildingImg> BuildingImgQueryWrapper = new QueryWrapper<>();
|
543
|
|
- BuildingImgQueryWrapper.eq("building_id", build.getBuildingId());
|
544
|
|
- BuildingImgQueryWrapper.eq("img_type", "banner");
|
545
|
|
- List<TaBuildingImg> buildingImg = taBuildingImgMapper.selectList(BuildingImgQueryWrapper);
|
546
|
|
- build.setBuildingImg(buildingImg);
|
|
569
|
+ build.setBuildingImg(getBuildingImg(build.getBuildingId(), CommConstant.BUILDING_IMG_BANNER));
|
|
570
|
+ build.setBuildingListImg(getBuildingImg(build.getBuildingId(), CommConstant.BUILDING_IMG_LIST));
|
|
571
|
+ build.setVideoImage(getBuildingImg(build.getBuildingId(), CommConstant.BUILDING_IMG_VIDEOIMAGE));
|
547
|
572
|
|
548
|
573
|
// QueryWrapper<Visit> BuildingVisitQueryWrapper = new QueryWrapper<>();
|
549
|
574
|
// BuildingVisitQueryWrapper.eq("visit_type", "building");
|
|
@@ -605,7 +630,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
605
|
630
|
// 楼盘Banner
|
606
|
631
|
QueryWrapper<TaBuildingImg> buildingImgBannerQueryWrapper = new QueryWrapper<>();
|
607
|
632
|
buildingImgBannerQueryWrapper.eq("building_id", building.getBuildingId());
|
608
|
|
- buildingImgBannerQueryWrapper.eq("img_type", "banner");
|
|
633
|
+ buildingImgBannerQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_BANNER);
|
609
|
634
|
buildingImgBannerQueryWrapper.orderBy(true, true, "order_no");
|
610
|
635
|
List<TaBuildingImg> buildingBannerImg = taBuildingImgMapper.selectList(buildingImgBannerQueryWrapper);
|
611
|
636
|
|
|
@@ -647,7 +672,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
647
|
672
|
List<TaBuildingImg> buildingImag = buildingImg.stream().map(img -> {
|
648
|
673
|
QueryWrapper<TaBuildingImg> buildingImgQueryWrapper = new QueryWrapper<>();
|
649
|
674
|
buildingImgQueryWrapper.eq("img_id", img.getImgId());
|
650
|
|
- buildingImgQueryWrapper.eq("img_type", "aparment");
|
|
675
|
+ buildingImgQueryWrapper.eq("img_type", CommConstant.BUILDING_IMG_APARMENT);
|
651
|
676
|
return taBuildingImgMapper.selectOne(buildingImgQueryWrapper);
|
652
|
677
|
}).collect(Collectors.toList());
|
653
|
678
|
|