|
@@ -313,6 +313,7 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
313
|
313
|
tpPhase.setName(nodeNumber);
|
314
|
314
|
tpPhase.setCreateDate(LocalDateTime.now());
|
315
|
315
|
tpPhaseMapper.insert(tpPhase);
|
|
316
|
+ return ResponseBean.success(tpPhase);
|
316
|
317
|
}
|
317
|
318
|
TpPhase tpPhase= tpPhaseMapper.selectById(id);
|
318
|
319
|
if(type.equals("building")){
|
|
@@ -334,6 +335,7 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
334
|
335
|
.setName(nodeNumber)
|
335
|
336
|
.setCreateDate(LocalDateTime.now());
|
336
|
337
|
tpBuildingMapper.insert(tpBuilding);
|
|
338
|
+ return ResponseBean.success(tpBuilding);
|
337
|
339
|
}
|
338
|
340
|
//查询栋,维护单元
|
339
|
341
|
TpBuilding selectTpBuilding= tpBuildingMapper.selectById(id);
|
|
@@ -358,6 +360,7 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
358
|
360
|
.setName(nodeNumber)
|
359
|
361
|
.setCreateDate(LocalDateTime.now());
|
360
|
362
|
tpUnitMapper.insert(tpUnit);
|
|
363
|
+ return ResponseBean.success(tpUnit);
|
361
|
364
|
}
|
362
|
365
|
|
363
|
366
|
//查询单元,维护楼层
|
|
@@ -387,6 +390,7 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
387
|
390
|
.setName(nodeNumber)
|
388
|
391
|
.setCreateDate(LocalDateTime.now());
|
389
|
392
|
tpLevelMapper.insert(tpLevel);
|
|
393
|
+ return ResponseBean.success(tpLevel);
|
390
|
394
|
}
|
391
|
395
|
//房间号
|
392
|
396
|
TpLevel selectTpLevel= tpLevelMapper.selectById(id);
|
|
@@ -415,6 +419,7 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
415
|
419
|
.setName(nodeNumber)
|
416
|
420
|
.setCreateDate(LocalDateTime.now());
|
417
|
421
|
tpRoomNoMapper.insert(tpRoomNo);
|
|
422
|
+ return ResponseBean.success(tpRoomNo);
|
418
|
423
|
}
|
419
|
424
|
responseBean.addSuccess("成功");
|
420
|
425
|
return responseBean;
|
|
@@ -518,10 +523,11 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
518
|
523
|
tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
|
519
|
524
|
}
|
520
|
525
|
}
|
|
526
|
+
|
|
527
|
+ //删除所有楼层
|
|
528
|
+ tpLevelMapper.delete(tpLevel);
|
521
|
529
|
}
|
522
|
530
|
}
|
523
|
|
- //删除所有楼层
|
524
|
|
- tpLevelMapper.delete(tpLevel);
|
525
|
531
|
//删除此单元
|
526
|
532
|
tpUnitMapper.delete(tpUnit);
|
527
|
533
|
//删除栋
|
|
@@ -536,47 +542,46 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
536
|
542
|
building.eq("name", phase.getName());
|
537
|
543
|
List<TpBuilding> tpBuildingList= tpBuildingMapper.selectList(building);
|
538
|
544
|
for (TpBuilding tpBuilding:tpBuildingList){
|
539
|
|
- //删除单元-楼层-房间
|
540
|
|
- QueryWrapper<TpUnit> tpUnit = new QueryWrapper<>();
|
541
|
|
- List<TpUnit> unitList=null;
|
542
|
|
- if (null!=tpBuilding) {
|
|
545
|
+ //删除单元-楼层-房间
|
|
546
|
+ QueryWrapper<TpUnit> tpUnit = new QueryWrapper<>();
|
543
|
547
|
tpUnit.eq("org_id", tpBuilding.getOrgId());
|
544
|
548
|
tpUnit.eq("phase_id", tpBuilding.getPhaseId());
|
545
|
549
|
tpUnit.eq("building_id", tpBuilding.getId());
|
546
|
550
|
tpUnit.eq("building_name", tpBuilding.getName());
|
547
|
|
- unitList= tpUnitMapper.selectList(tpUnit);
|
548
|
|
- }
|
549
|
|
- //先查询楼层
|
550
|
|
- QueryWrapper<TpLevel> tpLevel = new QueryWrapper<>();
|
551
|
|
- if (null!=unitList) {
|
552
|
|
- for (TpUnit unit : unitList) {
|
553
|
|
- tpLevel.eq("phase_id", unit.getPhaseId());
|
554
|
|
- tpLevel.eq("org_id", unit.getOrgId());
|
555
|
|
- tpLevel.eq("building_id", unit.getBuildingId());
|
556
|
|
- tpLevel.eq("unit_id", unit.getId());
|
557
|
|
- tpLevel.eq("unit_name", unit.getName());
|
558
|
|
- //查询房间
|
559
|
|
- List<TpLevel> levelList = tpLevelMapper.selectList(tpLevel);
|
560
|
|
- if (null != levelList) {
|
561
|
|
- for (TpLevel level : levelList) {
|
562
|
|
- QueryWrapper<TpRoomNo> tpRoomNoQueryWrapper = new QueryWrapper<>();
|
563
|
|
- tpRoomNoQueryWrapper.eq("phase_id", level.getPhaseId());
|
564
|
|
- tpRoomNoQueryWrapper.eq("org_id", level.getOrgId());
|
565
|
|
- tpRoomNoQueryWrapper.eq("building_id", level.getBuildingId());
|
566
|
|
- tpRoomNoQueryWrapper.eq("unit_id", level.getUnitId());
|
567
|
|
- tpRoomNoQueryWrapper.eq("level_id", level.getId());
|
568
|
|
- tpRoomNoQueryWrapper.eq("level_name", level.getName());
|
569
|
|
- //先删除所有房间
|
570
|
|
- tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
|
|
551
|
+
|
|
552
|
+ List<TpUnit> unitList = tpUnitMapper.selectList(tpUnit);
|
|
553
|
+
|
|
554
|
+ //先查询楼层
|
|
555
|
+ QueryWrapper<TpLevel> tpLevel = new QueryWrapper<>();
|
|
556
|
+ if (null!=unitList) {
|
|
557
|
+ for (TpUnit unit : unitList) {
|
|
558
|
+ tpLevel.eq("phase_id", unit.getPhaseId());
|
|
559
|
+ tpLevel.eq("org_id", unit.getOrgId());
|
|
560
|
+ tpLevel.eq("building_id", unit.getBuildingId());
|
|
561
|
+ tpLevel.eq("unit_id", unit.getId());
|
|
562
|
+ tpLevel.eq("unit_name", unit.getName());
|
|
563
|
+ //查询房间
|
|
564
|
+ List<TpLevel> levelList = tpLevelMapper.selectList(tpLevel);
|
|
565
|
+ if (null != levelList) {
|
|
566
|
+ for (TpLevel level : levelList) {
|
|
567
|
+ QueryWrapper<TpRoomNo> tpRoomNoQueryWrapper = new QueryWrapper<>();
|
|
568
|
+ tpRoomNoQueryWrapper.eq("phase_id", level.getPhaseId());
|
|
569
|
+ tpRoomNoQueryWrapper.eq("org_id", level.getOrgId());
|
|
570
|
+ tpRoomNoQueryWrapper.eq("building_id", level.getBuildingId());
|
|
571
|
+ tpRoomNoQueryWrapper.eq("unit_id", level.getUnitId());
|
|
572
|
+ tpRoomNoQueryWrapper.eq("level_id", level.getId());
|
|
573
|
+ tpRoomNoQueryWrapper.eq("level_name", level.getName());
|
|
574
|
+ //先删除所有房间
|
|
575
|
+ tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
|
|
576
|
+ }
|
571
|
577
|
}
|
|
578
|
+ //再删除所有楼层
|
|
579
|
+ tpLevelMapper.delete(tpLevel);
|
572
|
580
|
}
|
573
|
|
- //再删除所有楼层
|
574
|
|
- tpLevelMapper.delete(tpLevel);
|
575
|
581
|
}
|
|
582
|
+ //删除此单元
|
|
583
|
+ tpUnitMapper.delete(tpUnit);
|
576
|
584
|
}
|
577
|
|
- //删除此单元
|
578
|
|
- tpUnitMapper.delete(tpUnit);
|
579
|
|
- }
|
580
|
585
|
//删除栋
|
581
|
586
|
tpBuildingMapper.delete(building);
|
582
|
587
|
//删除整个期
|
|
@@ -591,6 +596,63 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
|
591
|
596
|
return tpRoomNoMapper.getRoomList(page, orgId, phaseId, buildingId, unitId, levelId, roomNoId);
|
592
|
597
|
}
|
593
|
598
|
|
|
599
|
+ @Override
|
|
600
|
+ public ResponseBean editNode(Map<String, Object> parameter, Integer orgId) {
|
|
601
|
+ if (null == parameter) {
|
|
602
|
+ return ResponseBean.error("编辑内容不能为空", ResponseBean.ERROR_MISSING_PARAMS);
|
|
603
|
+ }
|
|
604
|
+
|
|
605
|
+ Integer id = (Integer) parameter.get("id");
|
|
606
|
+ String type = (String) parameter.get("type");
|
|
607
|
+ String name = (String) parameter.get("name");
|
|
608
|
+
|
|
609
|
+ if (null == id || StringUtils.isEmpty(type) || StringUtils.isEmpty(name)) {
|
|
610
|
+ return ResponseBean.error("部分编辑内容不能为空", ResponseBean.ERROR_MISSING_PARAMS);
|
|
611
|
+ }
|
|
612
|
+
|
|
613
|
+ // 如果是期数
|
|
614
|
+ if ("phase".equals(type)) {
|
|
615
|
+ tpPhaseMapper.updateName(orgId, id, name);
|
|
616
|
+ tpBuildingMapper.updatePhaseName(orgId, id, name);
|
|
617
|
+ tpUnitMapper.updatePhaseName(orgId, id, name);
|
|
618
|
+ tpLevelMapper.updatePhaseName(orgId, id, name);
|
|
619
|
+ tpRoomNoMapper.updatePhaseName(orgId, id, name);
|
|
620
|
+ return ResponseBean.success("success");
|
|
621
|
+ }
|
|
622
|
+
|
|
623
|
+ // 如果是楼栋
|
|
624
|
+ if ("building".equals(type)) {
|
|
625
|
+ tpBuildingMapper.updateName(orgId, id, name);
|
|
626
|
+ tpUnitMapper.updateBuildingName(orgId, id, name);
|
|
627
|
+ tpLevelMapper.updateBuildingName(orgId, id, name);
|
|
628
|
+ tpRoomNoMapper.updateBuildingName(orgId, id, name);
|
|
629
|
+ return ResponseBean.success("success");
|
|
630
|
+ }
|
|
631
|
+
|
|
632
|
+ // 如果是单元
|
|
633
|
+ if ("unit".equals(type)) {
|
|
634
|
+ tpUnitMapper.updateName(orgId, id, name);
|
|
635
|
+ tpLevelMapper.updateUnitName(orgId, id, name);
|
|
636
|
+ tpRoomNoMapper.updateUnitName(orgId, id, name);
|
|
637
|
+ return ResponseBean.success("success");
|
|
638
|
+ }
|
|
639
|
+
|
|
640
|
+ // 如果是楼层
|
|
641
|
+ if ("level".equals(type)) {
|
|
642
|
+ tpLevelMapper.updateName(orgId, id, name);
|
|
643
|
+ tpRoomNoMapper.updateLevelName(orgId, id, name);
|
|
644
|
+ return ResponseBean.success("success");
|
|
645
|
+ }
|
|
646
|
+
|
|
647
|
+ // 如果是房间
|
|
648
|
+ if ("roomNo".equals(type)) {
|
|
649
|
+ tpRoomNoMapper.updateName(orgId, id, name);
|
|
650
|
+ return ResponseBean.success("success");
|
|
651
|
+ }
|
|
652
|
+
|
|
653
|
+ return ResponseBean.error("数据类型不正确", ResponseBean.ERROR_ILLEGAL_PARAMS);
|
|
654
|
+ }
|
|
655
|
+
|
594
|
656
|
private void saveBuildingTreeData(Integer orgId, List<TpBuildingOwnerInfo> list) {
|
595
|
657
|
String lastPhaseName = "";
|
596
|
658
|
String lastBuildingName = "";
|