|
@@ -556,7 +556,6 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
|
556
|
556
|
return responseBean;
|
557
|
557
|
} else {
|
558
|
558
|
List<String> temBuildingList = new ArrayList<String>();
|
559
|
|
- List<String> temTelList = new ArrayList<String>();
|
560
|
559
|
//获取一个sheet也就是一个工作簿
|
561
|
560
|
Sheet sheet = workbook.getSheetAt(0);
|
562
|
561
|
int lastRowNum = sheet.getLastRowNum();
|
|
@@ -564,40 +563,32 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
|
564
|
563
|
for (int j = 3; j <= lastRowNum; j++) {
|
565
|
564
|
Row row = sheet.getRow(j);
|
566
|
565
|
TpBuildingOwnerInfo tpBuildingOwnerInfo = new TpBuildingOwnerInfo();
|
567
|
|
- String phase = row.getCell(0).getStringCellValue().trim();
|
568
|
|
- String building = row.getCell(1).getStringCellValue().trim();
|
569
|
|
- String unit = row.getCell(2).getStringCellValue().trim();
|
570
|
|
- String level = row.getCell(3).getStringCellValue().trim();
|
571
|
|
- String roomNo = row.getCell(4).getStringCellValue().trim();
|
572
|
|
- String ownerName = row.getCell(5).getStringCellValue().trim();
|
573
|
|
- String ownerTel = row.getCell(6).getStringCellValue().trim();
|
|
566
|
+ String buildingInfo = row.getCell(0).getStringCellValue().trim();
|
|
567
|
+ String roomNoId = row.getCell(1).getStringCellValue().trim();
|
|
568
|
+ String ownerName = row.getCell(2).getStringCellValue().trim();
|
|
569
|
+ String ownerTel = row.getCell(3).getStringCellValue().trim();
|
|
570
|
+ String ownerRole = row.getCell(4).getStringCellValue().trim();
|
574
|
571
|
int currentRow = j+1;
|
575
|
|
- if (StringUtils.isEmpty(phase)){
|
576
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
|
572
|
+ if (StringUtils.isEmpty(buildingInfo)){
|
|
573
|
+ responseBean.addError("第" + currentRow + "行" + "房产信息不能为空!");
|
577
|
574
|
return responseBean;
|
578
|
575
|
}
|
579
|
|
- if (StringUtils.isEmpty(building)){
|
580
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
|
576
|
+ if (StringUtils.isEmpty(roomNoId)){
|
|
577
|
+ responseBean.addError("第" + currentRow + "行" + "房产ID不能为空!");
|
581
|
578
|
return responseBean;
|
582
|
579
|
}
|
583
|
|
- if (StringUtils.isEmpty(unit)){
|
584
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
585
|
|
- return responseBean;
|
586
|
|
- }
|
587
|
|
- if (StringUtils.isEmpty(level)){
|
588
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
589
|
|
- return responseBean;
|
590
|
|
- }
|
591
|
|
- if (StringUtils.isEmpty(roomNo)){
|
592
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
|
580
|
+ //房产ID不为空的情况下检查房产是否存在
|
|
581
|
+ TpBuildingOwnerInfo checkOwnerInfo =tpBuildingOwnerInfoMapper.selectById(roomNoId);
|
|
582
|
+ if (null == checkOwnerInfo){
|
|
583
|
+ responseBean.addError("第" + currentRow + "行" + "房产ID不存在!");
|
593
|
584
|
return responseBean;
|
594
|
585
|
}
|
595
|
586
|
if (StringUtils.isEmpty(ownerName)){
|
596
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
|
587
|
+ responseBean.addError("第" + currentRow + "行" + "姓名不能为空!");
|
597
|
588
|
return responseBean;
|
598
|
589
|
}
|
599
|
590
|
if (StringUtils.isEmpty(ownerTel)){
|
600
|
|
- responseBean.addError("第" + currentRow + "行" + "期/区不能为空!");
|
|
591
|
+ responseBean.addError("第" + currentRow + "行" + "手机号不能为空!");
|
601
|
592
|
return responseBean;
|
602
|
593
|
}
|
603
|
594
|
//校验手机号码
|
|
@@ -605,20 +596,19 @@ public class BuildingOwnerInfoServiceImpl extends ServiceImpl<TpBuildingOwnerInf
|
605
|
596
|
responseBean.addError("第"+ currentRow +"行请输入正确手机号:" + ownerTel);
|
606
|
597
|
return responseBean;
|
607
|
598
|
}
|
608
|
|
- String buildingInfo = phase + building + unit + level + roomNo;
|
609
|
|
- if (temBuildingList.contains(buildingInfo)){
|
610
|
|
- logger.info("存在重复房源:{}",buildingInfo);
|
611
|
|
- responseBean.addError("第"+ currentRow +"行存在重复房源");
|
|
599
|
+ if (StringUtils.isEmpty(ownerRole)){
|
|
600
|
+ responseBean.addError("第" + currentRow + "行" + "身份不能为空!");
|
612
|
601
|
return responseBean;
|
613
|
602
|
}
|
614
|
|
- if (temTelList.contains(ownerTel)){
|
615
|
|
- logger.info("存在重复手机号:{}",ownerTel);
|
616
|
|
- responseBean.addError("第"+ currentRow +"行存在重复手机号");
|
|
603
|
+
|
|
604
|
+ if (temBuildingList.contains(roomNoId)){
|
|
605
|
+ logger.info("存在重复房源:{}",roomNoId);
|
|
606
|
+ responseBean.addError("第"+ currentRow +"行存在重复房源");
|
617
|
607
|
return responseBean;
|
618
|
608
|
}
|
|
609
|
+
|
619
|
610
|
//把数据塞入temList校验是否有重复的数据
|
620
|
|
- temBuildingList.add(buildingInfo);
|
621
|
|
- temTelList.add(ownerTel);
|
|
611
|
+ temBuildingList.add(roomNoId);
|
622
|
612
|
//构建数据
|
623
|
613
|
tpBuildingOwnerInfo.setPhaseName(phase);
|
624
|
614
|
tpBuildingOwnerInfo.setBuildingName(building);
|