|
@@ -13,6 +13,7 @@ import com.huiju.estateagents.common.DateUtils;
|
13
|
13
|
import com.huiju.estateagents.common.StringUtils;
|
14
|
14
|
import com.huiju.estateagents.entity.*;
|
15
|
15
|
import com.huiju.estateagents.mapper.*;
|
|
16
|
+import com.huiju.estateagents.service.ITaBuildingMapRelationService;
|
16
|
17
|
import com.huiju.estateagents.service.ITaBuildingService;
|
17
|
18
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
18
|
19
|
import com.huiju.estateagents.service.TaPosterService;
|
|
@@ -86,6 +87,9 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
86
|
87
|
@Autowired
|
87
|
88
|
private TaOrgMapper taOrgMapper;
|
88
|
89
|
|
|
90
|
+ @Autowired
|
|
91
|
+ private ITaBuildingMapRelationService iTaBuildingMapRelationService;
|
|
92
|
+
|
89
|
93
|
@Override
|
90
|
94
|
public ResponseBean buildingList(Integer pageNum, Integer pageSize, String name, String code, LocalDateTime startDate, String buildingStatus, String marketStatus, Integer cityId, Integer isMain, Integer orgId) {
|
91
|
95
|
Page<TaBuilding> page = new Page<>();
|
|
@@ -168,6 +172,13 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
168
|
172
|
building.setPosters(taPosterService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
|
169
|
173
|
building.setShareContents(taShareContentService.getPostersForTarget(id,CommConstant.POSTER_CONTENT_TYPE_BUILDING));
|
170
|
174
|
|
|
175
|
+ // 查询 周边数据
|
|
176
|
+ QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
|
|
177
|
+ mapRelationQueryWrapper.eq("building_id", building.getBuildingId());
|
|
178
|
+ mapRelationQueryWrapper.eq("org_id", building.getOrgId());
|
|
179
|
+ List<TaBuildingMapRelation> mapRelationList = iTaBuildingMapRelationService.list(mapRelationQueryWrapper);
|
|
180
|
+ building.setMapJson(mapRelationList.size() > 0 ? JSONObject.toJSONString(mapRelationList) : null);
|
|
181
|
+
|
171
|
182
|
return ResponseBean.success(building);
|
172
|
183
|
}
|
173
|
184
|
|
|
@@ -247,9 +258,14 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
247
|
258
|
shareActivityQueryWrapper.eq("status", 1);
|
248
|
259
|
shareActivityQueryWrapper.in("activity_status", 0, 1);
|
249
|
260
|
List<TaShareActivity> shareActivityList = taShareActivityMapper.selectList(shareActivityQueryWrapper);
|
250
|
|
-
|
251
|
261
|
building.setShareActivityList(shareActivityList);
|
252
|
262
|
|
|
263
|
+ // 查询 周边数据
|
|
264
|
+ QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
|
|
265
|
+ mapRelationQueryWrapper.eq("building_id", building.getBuildingId());
|
|
266
|
+ mapRelationQueryWrapper.eq("org_id", building.getOrgId());
|
|
267
|
+ List<TaBuildingMapRelation> mapRelationList = iTaBuildingMapRelationService.list(mapRelationQueryWrapper);
|
|
268
|
+ building.setMapJson(mapRelationList.size() > 0 ? JSONObject.toJSONString(mapRelationList) : null);
|
253
|
269
|
|
254
|
270
|
return ResponseBean.success(building);
|
255
|
271
|
}
|
|
@@ -258,7 +274,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
258
|
274
|
public ResponseBean buildingUpdate(String parameter, Integer orgId) {
|
259
|
275
|
JSONObject object= JSONObject.parseObject(parameter);
|
260
|
276
|
|
261
|
|
- TaBuilding building = JSONObject.parseObject(parameter,TaBuilding.class);
|
|
277
|
+ TaBuilding building = object.toJavaObject(TaBuilding.class);
|
262
|
278
|
|
263
|
279
|
// 先删除视频
|
264
|
280
|
UpdateWrapper<TaBuilding> updateWrapper = new UpdateWrapper<>();
|
|
@@ -328,6 +344,20 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
328
|
344
|
if (CollectionUtils.isNotEmpty(buildingProjectTypeArray)) {
|
329
|
345
|
taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
|
330
|
346
|
}
|
|
347
|
+
|
|
348
|
+ // 地图周边
|
|
349
|
+ JSONArray mapJson = object.getJSONArray("mapJson");
|
|
350
|
+ if (null != mapJson) {
|
|
351
|
+ // 先删除
|
|
352
|
+ QueryWrapper<TaBuildingMapRelation> mapRelationQueryWrapper = new QueryWrapper<>();
|
|
353
|
+ mapRelationQueryWrapper.eq("building_id", building.getBuildingId());
|
|
354
|
+ mapRelationQueryWrapper.eq("org_id", orgId);
|
|
355
|
+ iTaBuildingMapRelationService.remove(mapRelationQueryWrapper);
|
|
356
|
+
|
|
357
|
+ List<TaBuildingMapRelation> taBuildingMapRelations = mapJson.toJavaList(TaBuildingMapRelation.class);
|
|
358
|
+ insertBuildingMapRelationBeach(taBuildingMapRelations, building.getBuildingId(), orgId);
|
|
359
|
+ }
|
|
360
|
+
|
331
|
361
|
return ResponseBean.success(building);
|
332
|
362
|
}
|
333
|
363
|
|
|
@@ -350,7 +380,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
350
|
380
|
return ResponseBean.error("楼盘已超过最大限制", ResponseBean.ERROR_UNAVAILABLE);
|
351
|
381
|
}
|
352
|
382
|
|
353
|
|
- TaBuilding building = JSONObject.parseObject(parameter,TaBuilding.class);
|
|
383
|
+ TaBuilding building = object.toJavaObject(TaBuilding.class);
|
354
|
384
|
if(null!= object.getDate("openingDate")){
|
355
|
385
|
building.setOpeningDate(DateUtils.date2LocalDateTime(object.getDate("openingDate")));
|
356
|
386
|
}
|
|
@@ -401,9 +431,37 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
401
|
431
|
taBuildingProjectTypeMapper.insertBuildingProjectTypeBatch(buildingProjectTypeArray, building.getBuildingId());
|
402
|
432
|
}
|
403
|
433
|
|
|
434
|
+ // 地图周边
|
|
435
|
+ JSONArray mapJson = object.getJSONArray("mapJson");
|
|
436
|
+ if (null != mapJson) {
|
|
437
|
+ List<TaBuildingMapRelation> taBuildingMapRelations = mapJson.toJavaList(TaBuildingMapRelation.class);
|
|
438
|
+ insertBuildingMapRelationBeach(taBuildingMapRelations, building.getBuildingId(), orgId);
|
|
439
|
+ }
|
|
440
|
+
|
|
441
|
+
|
404
|
442
|
return ResponseBean.success(building);
|
405
|
443
|
}
|
406
|
444
|
|
|
445
|
+ /**
|
|
446
|
+ * 批量插入 周边地图数据
|
|
447
|
+ * @param list
|
|
448
|
+ * @param buildingId
|
|
449
|
+ * @param orgId
|
|
450
|
+ * @return
|
|
451
|
+ */
|
|
452
|
+ private List<TaBuildingMapRelation> insertBuildingMapRelationBeach(List<TaBuildingMapRelation> list, String buildingId, Integer orgId) {
|
|
453
|
+ List<TaBuildingMapRelation> newList = list.stream().map(e -> {
|
|
454
|
+ e.setBuildingId(buildingId);
|
|
455
|
+ e.setOrgId(orgId);
|
|
456
|
+ e.setStatus(1);
|
|
457
|
+ e.setCreateDate(LocalDateTime.now());
|
|
458
|
+ return e;
|
|
459
|
+ }).collect(Collectors.toList());
|
|
460
|
+
|
|
461
|
+ iTaBuildingMapRelationService.saveBatch(newList);
|
|
462
|
+ return newList;
|
|
463
|
+ }
|
|
464
|
+
|
407
|
465
|
@Override
|
408
|
466
|
public ResponseBean buildingUpdateStatus(String parameter, Integer orgId) {
|
409
|
467
|
TaBuilding building = new TaBuilding();
|
|
@@ -449,6 +507,7 @@ public class TaBuildingServiceImpl extends ServiceImpl<TaBuildingMapper, TaBuild
|
449
|
507
|
}
|
450
|
508
|
|
451
|
509
|
JSONObject jsonobject = JSONObject.parseObject(parameter);
|
|
510
|
+
|
452
|
511
|
//图片数组
|
453
|
512
|
String imgStr = jsonobject.getString("img");
|
454
|
513
|
//转集合
|