Explorar el Código

Merge branch '2.0.0' of http://git.ycjcjy.com/fuxingfan/smartCommunity into 2.0.0

魏熙美 hace 6 años
padre
commit
e8a71478be

+ 167
- 122
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/BuildingTreeServiceImpl.java Ver fichero

@@ -71,6 +71,10 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
71 71
 	
72 72
 	@Autowired
73 73
 	private TaUserVerifyMapper taUserVerifyMapper;
74
+
75
+	@Autowired
76
+	private TpBuildingOwnerInfoMapper tpBuildingOwnerInfoMapper;
77
+
74 78
 	
75 79
 	/**
76 80
 	 * 获取整个小区的基础数据
@@ -293,6 +297,15 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
293 297
 		//楼栋
294 298
 		/*查询出期*/
295 299
 		if(type.equals("phase")) {
300
+			//是否存在同样的名字
301
+			QueryWrapper<TpPhase> tpPhaseQuery = new QueryWrapper<>();
302
+			tpPhaseQuery.eq("community_id",communityId);
303
+			tpPhaseQuery.eq("NAME",nodeNumber);
304
+			TpPhase phase= tpPhaseMapper.selectOne(tpPhaseQuery);
305
+			if (null!=phase){
306
+				responseBean.addError("节点名称已存在");
307
+				return responseBean;
308
+			}
296 309
 			TpPhase tpPhase= new TpPhase();
297 310
 					tpPhase.setCommunityId(communityId);
298 311
 					tpPhase.setName(nodeNumber);
@@ -301,21 +314,40 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
301 314
 		}
302 315
 		TpPhase	tpPhase= tpPhaseMapper.selectById(id);
303 316
 		if(type.equals("building")){
317
+			//是否存在同样的名字
318
+			QueryWrapper<TpBuilding> tpBuildingQuery = new QueryWrapper<>();
319
+			tpBuildingQuery.eq("community_id",communityId);
320
+			tpBuildingQuery.eq("phase_id",tpPhase.getId());
321
+			tpBuildingQuery.eq("phase_name",tpPhase.getName());
322
+			tpBuildingQuery.eq("name",nodeNumber);
323
+			TpBuilding building= tpBuildingMapper.selectOne(tpBuildingQuery);
324
+			if (null!=building){
325
+				responseBean.addError("节点名称已存在");
326
+				return responseBean;
327
+			}
304 328
 		 TpBuilding tpBuilding= new TpBuilding();
305 329
 					tpBuilding.setCommunityId(tpPhase.getCommunityId())
306 330
 						 .setPhaseId(tpPhase.getId())
307 331
 						 .setPhaseName(tpPhase.getName())
308 332
 						 .setName(nodeNumber)
309 333
 						 .setCreateDate(LocalDateTime.now());
310
-		 //判断书否为期
311
-
312 334
 			tpBuildingMapper.insert(tpBuilding);
313 335
 		}
314 336
 		//单元
315 337
 		//查询栋,维护单元
316
-
317 338
 		 TpBuilding selectTpBuilding= tpBuildingMapper.selectById(id);
318 339
 		if (type.equals("unit")){
340
+			// 校验节点名称
341
+			QueryWrapper<TpUnit> unitQuery=new QueryWrapper<>();
342
+			unitQuery.eq("community_id",selectTpBuilding.getCommunityId());
343
+			unitQuery.eq("phase_id",selectTpBuilding.getPhaseId());
344
+			unitQuery.eq("building_id",selectTpBuilding.getId());
345
+			unitQuery.eq("name",nodeNumber);
346
+			TpUnit unit= tpUnitMapper.selectOne(unitQuery);
347
+			if (null!=unit){
348
+				responseBean.addError("节点名称已存在");
349
+				return responseBean;
350
+			}
319 351
 		 TpUnit tpUnit= new TpUnit();
320 352
 				tpUnit.setCommunityId(selectTpBuilding.getCommunityId())
321 353
 						.setPhaseId(selectTpBuilding.getPhaseId())
@@ -323,7 +355,6 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
323 355
 						.setBuildingId(selectTpBuilding.getId())
324 356
 						.setName(nodeNumber)
325 357
 						.setCreateDate(LocalDateTime.now());
326
-		//判断是否为单
327 358
 		 	 tpUnitMapper.insert(tpUnit);
328 359
 		 }
329 360
 
@@ -331,6 +362,18 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
331 362
 		//查询单元,维护楼层
332 363
 		 TpUnit selectTpUnit= tpUnitMapper.selectById(id);
333 364
 		if(type.equals("level")){
365
+			//校验楼层名称
366
+			QueryWrapper<TpLevel>  levelQuery=new  QueryWrapper<>();
367
+			levelQuery.eq("community_id",selectTpUnit.getCommunityId());
368
+			levelQuery.eq("phase_id",selectTpUnit.getPhaseId());
369
+			levelQuery.eq("building_id",selectTpUnit.getBuildingId());
370
+			levelQuery.eq("unit_id",selectTpUnit.getId());
371
+			levelQuery.eq("name",nodeNumber);
372
+			TpLevel level= tpLevelMapper.selectOne(levelQuery);
373
+			if (null!=level){
374
+				responseBean.addError("节点名称已存在");
375
+				return responseBean;
376
+			}
334 377
 		 TpLevel tpLevel= new TpLevel();
335 378
 		tpLevel.setId(selectTpUnit.getId())
336 379
 				.setCommunityId(selectTpUnit.getCommunityId())
@@ -342,15 +385,23 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
342 385
 				.setUnitName(selectTpUnit.getName())
343 386
 				.setName(nodeNumber)
344 387
 				.setCreateDate(LocalDateTime.now());
345
-		//判断是否是楼层
346
-
347 388
 			 tpLevelMapper.insert(tpLevel);
348 389
 			}
349
-
350 390
 		 //房间号
351 391
 	 	TpLevel selectTpLevel= tpLevelMapper.selectById(id);
352 392
 		if(type.equals("roomNo")){
353
-		 TpRoomNo tpRoomNo= new TpRoomNo();
393
+			 QueryWrapper<TpRoomNo> tpRoomNoQuery= new QueryWrapper<>();
394
+			tpRoomNoQuery.eq("community_id",selectTpLevel.getCommunityId());
395
+			tpRoomNoQuery.eq("phase_id",selectTpLevel.getPhaseId());
396
+			tpRoomNoQuery.eq("building_id",selectTpLevel.getBuildingId());
397
+			tpRoomNoQuery.eq("unit_id",selectTpLevel.getUnitId());
398
+			tpRoomNoQuery.eq("name",nodeNumber);
399
+			TpRoomNo roomNo= tpRoomNoMapper.selectOne(tpRoomNoQuery);
400
+			if (null!=roomNo){
401
+				responseBean.addError("节点名称已存在");
402
+				return  responseBean;
403
+			}
404
+			TpRoomNo tpRoomNo= new TpRoomNo();
354 405
 			tpRoomNo.setCommunityId(selectTpLevel.getCommunityId())
355 406
 							.setPhaseId(selectTpLevel.getPhaseId())
356 407
 							.setPhaseName(selectTpLevel.getPhaseName())
@@ -362,8 +413,6 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
362 413
 							.setLevelName(selectTpLevel.getName())
363 414
 							.setName(nodeNumber)
364 415
 							.setCreateDate(LocalDateTime.now());
365
-
366
-
367 416
 			tpRoomNoMapper.insert(tpRoomNo);
368 417
 		}
369 418
 		responseBean.addSuccess("成功");
@@ -383,7 +432,11 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
383 432
 		String nodeNumber= object.getString("nodeNumber");
384 433
 
385 434
 		//审核是否通过
386
-		InfoPass(type,id);
435
+		  Boolean isA= InfoPass(type,id);
436
+		  if (isA==false){
437
+		  	responseBean.addError("需要先删除相关人员");
438
+		  	return responseBean;
439
+		  }
387 440
 		if (type.equals("end")) {
388 441
 			tpRoomNoMapper.deleteById(id);
389 442
 		}
@@ -396,10 +449,10 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
396 449
 			Info.eq("building_id",tpLevel.getBuildingId());
397 450
 			Info.eq("unit_id", tpLevel.getUnitId());
398 451
 			Info.eq("level_id", tpLevel.getId());
452
+			Info.eq("level_name", tpLevel.getName());
399 453
 			tpRoomNoMapper.delete(Info);
400 454
 			tpLevelMapper.deleteById(id);
401 455
 		}
402
-
403 456
 		//删除单元
404 457
 		if(type.equals("level")){
405 458
 			TpUnit tpUnit= tpUnitMapper.selectById(id);
@@ -412,24 +465,23 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
412 465
 			//删除单元-楼层-下的房间
413 466
 			//查询楼层ID
414 467
 			Integer tpLevelID=null;
415
-
416
-			TpLevel levelevel = tpLevelMapper.selectOne(tpLevel);
417
-			QueryWrapper<TpRoomNo> Info = new QueryWrapper<>();
418
-			Info.eq("community_id", tpUnit.getCommunityId());
419
-			Info.eq("phase_id", tpUnit.getPhaseId());
420
-			Info.eq("building_id",tpUnit.getBuildingId());
421
-			Info.eq("unit_id", tpUnit.getId());
422
-			if (null!=levelevel) {
423
-				Info.eq("level_id", levelevel.getId());
468
+			List<TpLevel> levelevelList = tpLevelMapper.selectList(tpLevel);
469
+			for (TpLevel levelevel:levelevelList) {
470
+				QueryWrapper<TpRoomNo> Info = new QueryWrapper<>();
471
+				Info.eq("community_id", tpUnit.getCommunityId());
472
+				Info.eq("phase_id", tpUnit.getPhaseId());
473
+				Info.eq("building_id", tpUnit.getBuildingId());
474
+				Info.eq("unit_id", tpUnit.getId());
475
+				if (null != levelevel) {
476
+					Info.eq("level_id", levelevel.getId());
477
+				}
478
+				//先删除所有房间
479
+				tpRoomNoMapper.delete(Info);
424 480
 			}
425
-
426
-			//先删除所有房间
427
-			tpRoomNoMapper.delete(Info);
428 481
 			//再删除所有楼层
429 482
 			tpLevelMapper.delete(tpLevel);
430 483
 			//删除此单元
431 484
 			tpUnitMapper.deleteById(id);
432
-
433 485
 		}
434 486
 		//删除楼栋
435 487
 		if (type.equals("unit")){
@@ -439,92 +491,92 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
439 491
 			tpUnit.eq("community_id", tpBuilding.getCommunityId());
440 492
 			tpUnit.eq("phase_id", tpBuilding.getPhaseId());
441 493
 			tpUnit.eq("building_id", tpBuilding.getId());
442
-			
443
-			//删除单元-楼层-下的房间
444
-			TpLevel tpLevelToo= tpLevelMapper.selectById(id);
445
-				QueryWrapper<TpRoomNo> Info = new QueryWrapper<>();
446
-			Info.eq("community_id", tpLevelToo.getCommunityId());
447
-			Info.eq("phase_id", tpLevelToo.getPhaseId());
448
-			Info.eq("building_id",tpLevelToo.getBuildingId());
449
-			Info.eq("unit_id", tpLevelToo.getUnitId());
450
-			Info.eq("level_id", tpLevelToo.getId());
451
-			//先删除所有房间
452
-			tpRoomNoMapper.delete(Info);
494
+			tpUnit.eq("building_name", tpBuilding.getName());
453 495
 			//先查询楼层
454
-			TpUnit unit= tpUnitMapper.selectOne(tpUnit);
496
+			List<TpUnit> unitList= tpUnitMapper.selectList(tpUnit);
455 497
 			QueryWrapper<TpLevel> tpLevel = new QueryWrapper<>();
456
-			if (null!=unit) {
457
-				tpLevel.eq("phase_id", unit.getPhaseId());
458
-				tpLevel.eq("community_id", unit.getCommunityId());
459
-				tpLevel.eq("building_id", unit.getBuildingId());
460
-				tpLevel.eq("unit_id", unit.getId());
461
-			}
462
-			//查询房间
463
-			List<TpLevel> levelList= tpLevelMapper.selectList(tpLevel);
464
-			QueryWrapper<TpRoomNo> tpRoomNoQueryWrapper = new QueryWrapper<>();
465
-			if (null!=levelList) {
466
-				for (TpLevel level:levelList) {
467
-					tpRoomNoQueryWrapper.eq("phase_id", level.getPhaseId());
468
-					tpRoomNoQueryWrapper.eq("community_id", level.getCommunityId());
469
-					tpRoomNoQueryWrapper.eq("building_id", level.getBuildingId());
470
-					tpRoomNoQueryWrapper.eq("unit_id", level.getUnitId());
471
-					tpRoomNoQueryWrapper.eq("level_id", level.getId());
472
-					//先删除所有房间
473
-					tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
498
+			if (null!=unitList) {
499
+				for (TpUnit unit: unitList) {
500
+					tpLevel.eq("phase_id", unit.getPhaseId());
501
+					tpLevel.eq("community_id", unit.getCommunityId());
502
+					tpLevel.eq("building_id", unit.getBuildingId());
503
+					tpLevel.eq("unit_id", unit.getId());
504
+					tpLevel.eq("unit_name", unit.getName());
505
+					//查询房间
506
+					List<TpLevel> levelList= tpLevelMapper.selectList(tpLevel);
507
+					QueryWrapper<TpRoomNo> tpRoomNoQueryWrapper = new QueryWrapper<>();
508
+					if (null!=levelList) {
509
+						for (TpLevel level:levelList) {
510
+							tpRoomNoQueryWrapper.eq("phase_id", level.getPhaseId());
511
+							tpRoomNoQueryWrapper.eq("community_id", level.getCommunityId());
512
+							tpRoomNoQueryWrapper.eq("building_id", level.getBuildingId());
513
+							tpRoomNoQueryWrapper.eq("unit_id", level.getUnitId());
514
+							tpRoomNoQueryWrapper.eq("level_id", level.getId());
515
+							tpRoomNoQueryWrapper.eq("level_name", level.getName());
516
+							//先删除所有房间
517
+							tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
518
+						}
474 519
 				}
520
+			  }
475 521
 			}
476
-
477
-			//再删除所有楼层
522
+			//删除所有楼层
478 523
 			tpLevelMapper.delete(tpLevel);
479 524
 			//删除此单元
480 525
 			tpUnitMapper.delete(tpUnit);
481
-			//判断是否为单
526
+			//删除栋
482 527
 			tpBuildingMapper.deleteById(id);
483 528
 		}
484
-
485 529
 		if (type.equals("building")){
486 530
 			TpPhase phase= tpPhaseMapper.selectById(id);
487 531
 
488
-			TpBuilding tpBuilding= tpBuildingMapper.selectById(phase.getId());
532
+			QueryWrapper<TpBuilding> building= new QueryWrapper<>();
533
+			building.eq("phase_id", phase.getId());
534
+			building.eq("community_id", phase.getCommunityId());
535
+			building.eq("name", phase.getName());
536
+			List<TpBuilding> tpBuildingList= tpBuildingMapper.selectList(building);
537
+			for (TpBuilding tpBuilding:tpBuildingList){
489 538
 			//删除单元-楼层-房间
490 539
 			QueryWrapper<TpUnit> tpUnit = new QueryWrapper<>();
540
+			List<TpUnit> unitList=null;
491 541
 			if (null!=tpBuilding) {
492 542
 				tpUnit.eq("community_id", tpBuilding.getCommunityId());
493 543
 				tpUnit.eq("phase_id", tpBuilding.getPhaseId());
494 544
 				tpUnit.eq("building_id", tpBuilding.getId());
545
+				tpUnit.eq("building_name", tpBuilding.getName());
546
+				unitList= tpUnitMapper.selectList(tpUnit);
495 547
 			}
496 548
 			//先查询楼层
497
-			List<TpUnit> unitList= tpUnitMapper.selectList(tpUnit);
498 549
 			QueryWrapper<TpLevel> tpLevel = new QueryWrapper<>();
499 550
 			if (null!=unitList) {
500
-				for (TpUnit unit:unitList) {
551
+				for (TpUnit unit : unitList) {
501 552
 					tpLevel.eq("phase_id", unit.getPhaseId());
502 553
 					tpLevel.eq("community_id", unit.getCommunityId());
503 554
 					tpLevel.eq("building_id", unit.getBuildingId());
504 555
 					tpLevel.eq("unit_id", unit.getId());
505
-
556
+					tpLevel.eq("unit_name", unit.getName());
506 557
 					//查询房间
507
-					TpLevel level= tpLevelMapper.selectOne(tpLevel);
508
-					if (null!=level) {
509
-						QueryWrapper<TpRoomNo> tpRoomNoQueryWrapper = new QueryWrapper<>();
510
-						tpRoomNoQueryWrapper.eq("phase_id", level.getPhaseId());
511
-						tpRoomNoQueryWrapper.eq("community_id", level.getCommunityId());
512
-						tpRoomNoQueryWrapper.eq("building_id", level.getBuildingId());
513
-						tpRoomNoQueryWrapper.eq("unit_id", level.getUnitId());
514
-						tpRoomNoQueryWrapper.eq("level_id", level.getId());
515
-						//先删除所有房间
516
-						tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
517
-				}
558
+					List<TpLevel> levelList = tpLevelMapper.selectList(tpLevel);
559
+					if (null != levelList) {
560
+						for (TpLevel level : levelList) {
561
+							QueryWrapper<TpRoomNo> tpRoomNoQueryWrapper = new QueryWrapper<>();
562
+							tpRoomNoQueryWrapper.eq("phase_id", level.getPhaseId());
563
+							tpRoomNoQueryWrapper.eq("community_id", level.getCommunityId());
564
+							tpRoomNoQueryWrapper.eq("building_id", level.getBuildingId());
565
+							tpRoomNoQueryWrapper.eq("unit_id", level.getUnitId());
566
+							tpRoomNoQueryWrapper.eq("level_id", level.getId());
567
+							tpRoomNoQueryWrapper.eq("level_name", level.getName());
568
+							//先删除所有房间
569
+							tpRoomNoMapper.delete(tpRoomNoQueryWrapper);
570
+						}
571
+					}
518 572
 					//再删除所有楼层
519 573
 					tpLevelMapper.delete(tpLevel);
520
-			 }
574
+				}
521 575
 			}
522 576
 			//删除此单元
523 577
 			tpUnitMapper.delete(tpUnit);
578
+	}
524 579
 			//删除栋
525
-			QueryWrapper<TpBuilding> building= new QueryWrapper<>();
526
-			tpLevel.eq("phase_id", phase.getId());
527
-			tpLevel.eq("community_id", phase.getCommunityId());
528 580
 			tpBuildingMapper.delete(building);
529 581
 			//删除整个期
530 582
 			tpPhaseMapper.deleteById(id);
@@ -622,7 +674,7 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
622 674
 		}
623 675
 	}
624 676
 	//删除当前节点判断是否有审核通过的
625
-	private ResponseBean InfoPass(String type,Integer id ) {
677
+	private boolean InfoPass(String type,Integer id ) {
626 678
 		ResponseBean responseBean = new ResponseBean();
627 679
 		if (type.equals("end")) {
628 680
 			//判断书否有已审核人员
@@ -636,67 +688,60 @@ public class BuildingTreeServiceImpl implements BuildingTreeServiceI {
636 688
 					.eq("room_no_id", id)
637 689
 					.eq("verify_status", 1);
638 690
 			List<TaUserVerify> taUserVerifyList = taUserVerifyMapper.selectList(taUserVerify);
639
-			if (null != taUserVerifyList) {
640
-				responseBean.addError("不可删除审核已通过人员");
641
-				return responseBean;
691
+			if (null != taUserVerifyList && taUserVerifyList.size()>0) {
692
+				return false;
642 693
 			}
643 694
 		}
644 695
 		if (type.equals("roomNo")) {
645 696
 			TpLevel tpLevel = tpLevelMapper.selectById(id);
646
-			QueryWrapper<TaUserVerify> taUserVerify = new QueryWrapper<>();
647
-			taUserVerify.eq("community_id", tpLevel.getCommunityId())
648
-					.eq("phase_id", tpLevel.getPhaseId())
649
-					.eq("building_id", tpLevel.getBuildingId())
650
-					.eq("unit_id", tpLevel.getUnitId())
651
-					.eq("level_id", tpLevel.getId())
652
-					.eq("verify_status", 1);
653
-			List<TaUserVerify> taUserVerifyList = taUserVerifyMapper.selectList(taUserVerify);
654
-			if (null != taUserVerifyList) {
655
-				responseBean.addError("不可删除审核已通过人员");
656
-				return responseBean;
697
+			QueryWrapper<TpBuildingOwnerInfo> tpBuildingOwnerInfo = new QueryWrapper<>();
698
+			 tpBuildingOwnerInfo.eq("community_id", tpLevel.getCommunityId())
699
+								.eq("phase_id", tpLevel.getPhaseId())
700
+								.eq("building_id", tpLevel.getBuildingId())
701
+								.eq("unit_id", tpLevel.getUnitId())
702
+								.eq("level_id", tpLevel.getId())
703
+								.eq("verify_status", 1);
704
+			List<TpBuildingOwnerInfo> ifoBuid = tpBuildingOwnerInfoMapper .selectList(tpBuildingOwnerInfo);
705
+			if (null != ifoBuid && ifoBuid.size()>0) {
706
+				return false;
657 707
 			}
658 708
 		}
659 709
 		if (type.equals("level")) {
660 710
 			TpUnit tpUnit = tpUnitMapper.selectById(id);
661
-			QueryWrapper<TaUserVerify> taUserVerify = new QueryWrapper<>();
662
-			taUserVerify.eq("community_id", tpUnit.getCommunityId())
663
-					.eq("phase_id", tpUnit.getPhaseId())
664
-					.eq("building_id", tpUnit.getBuildingId())
665
-					.eq("verify_status", 1);
666
-			List<TaUserVerify> taUserVerifyList = taUserVerifyMapper.selectList(taUserVerify);
667
-			if (null != taUserVerifyList) {
668
-				responseBean.addError("不可删除审核已通过人员");
669
-				return responseBean;
711
+			QueryWrapper<TpBuildingOwnerInfo> tpBuildingOwnerInfo = new QueryWrapper<>();
712
+			 tpBuildingOwnerInfo.eq("community_id", tpUnit.getCommunityId())
713
+								.eq("phase_id", tpUnit.getPhaseId())
714
+								.eq("building_id", tpUnit.getBuildingId())
715
+								.eq("verify_status", 1);
716
+			List<TpBuildingOwnerInfo> ifoBuid = tpBuildingOwnerInfoMapper.selectList(tpBuildingOwnerInfo);
717
+			if (null != ifoBuid && ifoBuid.size()>0) {
718
+				return false;
670 719
 			}
671 720
 		}
672 721
 		if (type.equals("unit")) {
673 722
 			//判断书否有已审核人员
674 723
 			TpBuilding tpBuilding = tpBuildingMapper.selectById(id);
675
-			QueryWrapper<TaUserVerify> taUserVerify = new QueryWrapper<>();
676
-			taUserVerify.eq("community_id", tpBuilding.getCommunityId())
677
-					.eq("phase_id", tpBuilding.getPhaseId())
678
-					.eq("building_id", tpBuilding.getId())
679
-					.eq("verify_status", 1);
680
-			List<TaUserVerify> taUserVerifyList = taUserVerifyMapper.selectList(taUserVerify);
681
-			if (null != taUserVerifyList) {
682
-				responseBean.addError("不可删除审核已通过人员");
683
-
684
-				return responseBean;
724
+			QueryWrapper<TpBuildingOwnerInfo> tpBuildingOwnerInfo = new QueryWrapper<>();
725
+			 tpBuildingOwnerInfo.eq("community_id", tpBuilding.getCommunityId())
726
+								.eq("phase_id", tpBuilding.getPhaseId())
727
+								.eq("building_id", tpBuilding.getId())
728
+								.eq("verify_status", 1);
729
+			List<TpBuildingOwnerInfo> ifoBuid = tpBuildingOwnerInfoMapper.selectList(tpBuildingOwnerInfo);
730
+			if (null != ifoBuid && ifoBuid.size()>0) {
731
+				return false;
685 732
 			}
686 733
 		}
687 734
 		if (type.equals("building")) {
688 735
 			TpPhase phase = tpPhaseMapper.selectById(id);
689
-			QueryWrapper<TaUserVerify> taUserVerify = new QueryWrapper<>();
690
-			taUserVerify.eq("community_id", phase.getCommunityId())
691
-					.eq("phase_id", phase.getId())
692
-					.eq("verify_status", 1);
693
-			List<TaUserVerify> taUserVerifyList = taUserVerifyMapper.selectList(taUserVerify);
694
-			if (null != taUserVerifyList) {
695
-				responseBean.addError("不可删除审核已通过人员");
696
-				return responseBean;
736
+			QueryWrapper<TpBuildingOwnerInfo> tpBuildingOwnerInfo = new QueryWrapper<>();
737
+			 tpBuildingOwnerInfo.eq("community_id", phase.getCommunityId())
738
+								.eq("phase_id", phase.getId())
739
+								.eq("verify_status", 1);
740
+			List<TpBuildingOwnerInfo> ifoBuid = tpBuildingOwnerInfoMapper.selectList(tpBuildingOwnerInfo);
741
+			if (null != ifoBuid && ifoBuid.size()>0) {
742
+				return false;
697 743
 			}
698 744
 		}
699
-		responseBean.addError("成功");
700
-		return responseBean;
745
+		return true;
701 746
 	}
702 747
 }

+ 29
- 16
VUECODE/smart-property-manage/src/views/building/buildingdata/index.vue Ver fichero

@@ -96,20 +96,24 @@ export default {
96 96
       aAddNode(id){
97 97
       // 添加当前节点
98 98
       this.$store.dispatch('AddNode', this.treeQuery).then((res) => {
99
-         
100
-          
99
+         console.log('res.code',res)
100
+        if(res.code=='1'){
101
+        this.$message({
102
+          showClose: true,
103
+          message: res.message,
104
+          type: 'warning'
105
+        })
106
+        return
107
+        }   
101 108
           this.$router.go(0)
102
-           
103
-           this.suo()
104
-
105 109
       }).catch(() => {
106 110
         console.log('error addNode')
107 111
       })
108 112
       },
109
-      suo(){
110
-        this.liste=[177,26,25]
111
-         console.log('1111'); 
112
-      },
113
+      // suo(){
114
+      //   this.liste=[177,26,25]
115
+      //    console.log('1111'); 
116
+      // },
113 117
       //删除当前节点
114 118
       remove(data){
115 119
       this.treeQuery.id = data.id
@@ -118,11 +122,26 @@ export default {
118 122
       console.log('当前节点',data.id)
119 123
       console.log('当前名称',data.name)
120 124
       console.log('当前类型',data.type)
125
+      // if(data.type=='phase'){
126
+      //   his.$message({
127
+      //       type: 'info',
128
+      //       message: '不可删除根节点'
129
+      //     }); 
130
+      //     return
131
+      // }
121 132
       this.$store.dispatch('DeleteNode', this.treeQuery).then((res) => {
133
+        if(res.code=='1'){
134
+          this.$message({
135
+          showClose: true,
136
+          message: res.message,
137
+          type: 'warning'
138
+        }) 
139
+        return 
140
+        }
141
+         location.reload()
122 142
       }).catch(() => {
123 143
         console.log('error addNode')
124 144
       })
125
-      location.reload()
126 145
       },
127 146
     ...mapActions('buildingTree', [
128 147
       'BuildingTreeList'
@@ -131,8 +150,6 @@ export default {
131 150
       if (node.level === 0) {
132 151
           return resolve(this.defaulData);
133 152
         }
134
-        
135
-        // var data = [];  
136 153
           this.treeQuery.treeType = node.data.type
137 154
           this.treeQuery.id = node.data.id
138 155
           this.BuildingTreeList(this.treeQuery).then(response => {
@@ -144,10 +161,6 @@ export default {
144 161
           }).catch(() => {
145 162
             console.log("get tree error");
146 163
           });
147
-
148
-        // setTimeout(() => {
149
-        //   resolve(data);
150
-        // }, 500);
151 164
     },
152 165
     dialogBatchImport() {
153 166
       this.$router.push({ name: 'building-batch-import' })