|
@@ -39,7 +39,7 @@ public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
|
|
|
|
|
|
|
|
|
public ParkRoomListener(ParkRoomService roomService, MnpBuildingService buildingService, ParkFloorDiscService floorDiscService,
|
|
|
- ParkInfoService parkInfoService,SysDictService sysDictService, JSONObject jsonObject) {
|
|
|
+ ParkInfoService parkInfoService, SysDictService sysDictService, JSONObject jsonObject) {
|
|
|
this.roomService = roomService;
|
|
|
this.buildingService = buildingService;
|
|
|
this.floorDiscService = floorDiscService;
|
|
@@ -66,123 +66,135 @@ public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
|
|
|
List<Map<String, String>> saleStatus = sysDictService.selectDictList("SALE_STATUS");
|
|
|
|
|
|
|
|
|
- if(CollectionUtils.isNotEmpty(excelList)){
|
|
|
+ if (CollectionUtils.isNotEmpty(excelList)) {
|
|
|
ParkRoom data;
|
|
|
ParkRoomExcel excel = null;
|
|
|
Map<String, String> buildNameIdMap = buildingService.getNameIdMap();
|
|
|
Map<String, String> discNameIdMap = floorDiscService.getNameIdMap();
|
|
|
Map<String, String> parkNameIdMap = parkInfoService.getNameIdMap();
|
|
|
- for(int i = 0; i < excelList.size(); i++){
|
|
|
+ for (int i = 0; i < excelList.size(); i++) {
|
|
|
+
|
|
|
+ boolean groupNameFlag = true;
|
|
|
+ boolean discNameFlag = true;
|
|
|
+ boolean buildNumFlag = true;
|
|
|
+ boolean roomNoFlag = true;
|
|
|
+ boolean floorFlag = true;
|
|
|
+ boolean actualInternalAreaFlag = true;
|
|
|
+ boolean actualShareAreaFlag = true;
|
|
|
+ boolean actualBuildAreaFlag = true;
|
|
|
+ boolean roomUseFlag = true;
|
|
|
+ boolean decorationSituationFlag = true;
|
|
|
+ boolean houseTypeFlag = true;
|
|
|
+ boolean saleStatusFlag = true;
|
|
|
+
|
|
|
+ StringBuilder builder = new StringBuilder();
|
|
|
+
|
|
|
+
|
|
|
try {
|
|
|
data = new ParkRoom();
|
|
|
excel = excelList.get(i);
|
|
|
if (StringUtils.isEmpty(excel.getGroupName())) {
|
|
|
- throw new RuntimeException("楼盘/小区名称为空");
|
|
|
+ groupNameFlag = false;
|
|
|
+ builder.append("楼盘/小区名称为空").append(",");
|
|
|
+ excel.setGroupName("{" + excel.getGroupName() + "}");
|
|
|
}
|
|
|
+
|
|
|
if (StringUtils.isEmpty(excel.getDiscName())) {
|
|
|
- throw new RuntimeException("分期名称为空");
|
|
|
+ discNameFlag = false;
|
|
|
+ builder.append("分期名称为空").append(",");
|
|
|
+ excel.setDiscName("{" + excel.getDiscName() + "}");
|
|
|
}
|
|
|
+
|
|
|
if (StringUtils.isEmpty(excel.getBuildNum())) {
|
|
|
- throw new RuntimeException("单元楼栋号为空");
|
|
|
+ buildNumFlag = false;
|
|
|
+ builder.append("单元楼栋号为空").append(",");
|
|
|
+ excel.setBuildNum("{" + excel.getBuildNum() + "}");
|
|
|
}
|
|
|
+
|
|
|
// 判断小区是否存在
|
|
|
- if(StringUtils.isEmpty(parkNameIdMap.get(excel.getGroupName()))){
|
|
|
- throw new RuntimeException("楼盘/小区不存在");
|
|
|
+ if (StringUtils.isEmpty(parkNameIdMap.get(excel.getGroupName()))) {
|
|
|
+ groupNameFlag = false;
|
|
|
+ builder.append("楼盘/小区不存在").append(",");
|
|
|
+ excel.setGroupName("{" + excel.getGroupName() + "}");
|
|
|
}
|
|
|
data.setGroupId(parkNameIdMap.get(excel.getGroupName()));
|
|
|
+
|
|
|
// 判断分期是否存在
|
|
|
- if(StringUtils.isEmpty(discNameIdMap.get(excel.getDiscName()))){
|
|
|
- throw new RuntimeException("分期不存在");
|
|
|
+ if (StringUtils.isEmpty(discNameIdMap.get(excel.getDiscName()))) {
|
|
|
+ discNameFlag = false;
|
|
|
+ builder.append("分期不存在").append(",");
|
|
|
+ excel.setDiscName("{" + excel.getDiscName() + "}");
|
|
|
}
|
|
|
data.setDiscId(discNameIdMap.get(excel.getDiscName()));
|
|
|
+
|
|
|
// 判断楼栋是否存在
|
|
|
- if(StringUtils.isEmpty(buildNameIdMap.get(excel.getBuildNum()))){
|
|
|
- throw new RuntimeException("楼栋不存在");
|
|
|
+ if (StringUtils.isEmpty(buildNameIdMap.get(excel.getBuildNum()))) {
|
|
|
+ buildNumFlag = false;
|
|
|
+ builder.append("楼栋不存在").append(",");
|
|
|
+ excel.setBuildNum("{" + excel.getBuildNum() + "}");
|
|
|
}
|
|
|
data.setBuildId(buildNameIdMap.get(excel.getBuildNum()));
|
|
|
+
|
|
|
// 户室号
|
|
|
if (StringUtils.isEmpty(excel.getRoomNo())) {
|
|
|
- throw new RuntimeException("户室号为空");
|
|
|
+ roomNoFlag = false;
|
|
|
+ builder.append("户室号为空").append(",");
|
|
|
+ excel.setRoomNo("{" + excel.getRoomNo() + "}");
|
|
|
}
|
|
|
data.setRoomNo(excel.getRoomNo());
|
|
|
+
|
|
|
// 所在层
|
|
|
if (StringUtils.isEmpty(excel.getFloor())) {
|
|
|
- throw new RuntimeException("所在层为空");
|
|
|
+ floorFlag = false;
|
|
|
+ builder.append("所在层为空").append(",");
|
|
|
+ excel.setFloor("{" + excel.getFloor() + "}");
|
|
|
}
|
|
|
data.setFloor(excel.getFloor());
|
|
|
- // 预测套内面积
|
|
|
- if (StringUtils.isEmpty(excel.getPredictionInternalArea())) {
|
|
|
- throw new RuntimeException("预测套内面积为空");
|
|
|
- }
|
|
|
- try {
|
|
|
- data.setPredictionInternalArea(Double.valueOf(excel.getPredictionInternalArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("预测套内面积格式有误");
|
|
|
- }
|
|
|
- // 预测分摊面积
|
|
|
- if (StringUtils.isEmpty(excel.getPredictionShareArea())) {
|
|
|
- throw new RuntimeException("预测分摊面积为空");
|
|
|
- }
|
|
|
- try {
|
|
|
- data.setPredictionShareArea(Double.valueOf(excel.getPredictionShareArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("预测分摊面积格式有误");
|
|
|
- }
|
|
|
- // 预测建筑面积
|
|
|
- if (StringUtils.isEmpty(excel.getPredictionBuildArea())) {
|
|
|
- throw new RuntimeException("预测建筑面积为空");
|
|
|
- }
|
|
|
- try {
|
|
|
- data.setPredictionBuildArea(Double.valueOf(excel.getPredictionBuildArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("预测建筑面积格式有误");
|
|
|
- }
|
|
|
- // 预测土地面积
|
|
|
- if (StringUtils.isEmpty(excel.getPredictionLandArea())) {
|
|
|
- throw new RuntimeException("预测土地面积为空");
|
|
|
- }
|
|
|
- try {
|
|
|
- data.setPredictionLandArea(Double.valueOf(excel.getPredictionLandArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("预测土地面积");
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
// 实测套内面积
|
|
|
if (StringUtils.isEmpty(excel.getActualInternalArea())) {
|
|
|
- throw new RuntimeException("实测套内面积为空");
|
|
|
+ actualInternalAreaFlag = false;
|
|
|
+ builder.append("实测套内面积为空").append(",");
|
|
|
+ excel.setActualInternalArea("{" + excel.getActualInternalArea() + "}");
|
|
|
}
|
|
|
try {
|
|
|
data.setActualInternalArea(Double.valueOf(excel.getActualInternalArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("实测套内面积格式有误");
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ actualInternalAreaFlag = false;
|
|
|
+ builder.append("实测套内面积格式有误").append(",");
|
|
|
+ excel.setActualInternalArea("{" + excel.getActualInternalArea() + "}");
|
|
|
}
|
|
|
+
|
|
|
// 实测分摊面积
|
|
|
if (StringUtils.isEmpty(excel.getActualShareArea())) {
|
|
|
- throw new RuntimeException("实测分摊面积为空");
|
|
|
+ actualShareAreaFlag = false;
|
|
|
+ builder.append("实测分摊面积为空").append(",");
|
|
|
+ excel.setActualShareArea("{" + excel.getActualShareArea() + "}");
|
|
|
}
|
|
|
try {
|
|
|
data.setActualShareArea(Double.valueOf(excel.getActualShareArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("实测分摊面积格式有误");
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ actualShareAreaFlag = false;
|
|
|
+ builder.append("实测分摊面积格式有误").append(",");
|
|
|
+ excel.setActualShareArea("{" + excel.getActualShareArea() + "}");
|
|
|
}
|
|
|
+
|
|
|
// 实测建筑面积
|
|
|
if (StringUtils.isEmpty(excel.getActualBuildArea())) {
|
|
|
- throw new RuntimeException("实测建筑面积");
|
|
|
+ actualBuildAreaFlag = false;
|
|
|
+ builder.append("实测建筑面积").append(",");
|
|
|
+ excel.setActualBuildArea("{" + excel.getActualBuildArea() + "}");
|
|
|
}
|
|
|
try {
|
|
|
data.setActualBuildArea(Double.valueOf(excel.getActualBuildArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("预测建筑面积格式有误");
|
|
|
- }
|
|
|
- // 实测土地面积
|
|
|
- if (StringUtils.isEmpty(excel.getActualLandArea())) {
|
|
|
- throw new RuntimeException("实测土地面积");
|
|
|
- }
|
|
|
- try {
|
|
|
- data.setActualLandArea(Double.valueOf(excel.getActualLandArea()));
|
|
|
- }catch (NumberFormatException e){
|
|
|
- throw new RuntimeException("实测土地面积格式有误");
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
+ actualBuildAreaFlag = false;
|
|
|
+ builder.append("预测建筑面积格式有误").append(",");
|
|
|
+ excel.setActualBuildArea("{" + excel.getActualBuildArea() + "}");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
// 用途
|
|
|
if (StringUtils.isNotEmpty(excel.getRoomUse())) {
|
|
|
for (Map<String, String> stringStringMap : houseUsage) {
|
|
@@ -191,15 +203,13 @@ public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
|
|
|
}
|
|
|
}
|
|
|
// 没匹配上的情况
|
|
|
- if(data.getRoomUse() == null){
|
|
|
- throw new RuntimeException("用途格式有误");
|
|
|
+ if (data.getRoomUse() == null) {
|
|
|
+ roomUseFlag = false;
|
|
|
+ builder.append("用途格式有误").append(",");
|
|
|
+ excel.setRoomUse("{" + excel.getRoomUse() + "}");
|
|
|
}
|
|
|
}
|
|
|
- // 户编号
|
|
|
- if (StringUtils.isEmpty(excel.getRoomNumber())) {
|
|
|
- throw new RuntimeException("户编号为空");
|
|
|
- }
|
|
|
- data.setRoomNumber(excel.getRoomNumber());
|
|
|
+
|
|
|
// 装修情况
|
|
|
if (StringUtils.isNotEmpty(excel.getDecorationSituation())) {
|
|
|
for (Map<String, String> stringStringMap : decorationSituation) {
|
|
@@ -208,10 +218,13 @@ public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
|
|
|
}
|
|
|
}
|
|
|
// 没匹配上的情况
|
|
|
- if(data.getDecorationSituation() == null){
|
|
|
- throw new RuntimeException("装修情况格式有误");
|
|
|
+ if (data.getDecorationSituation() == null) {
|
|
|
+ decorationSituationFlag = false;
|
|
|
+ builder.append("装修情况格式有误").append(",");
|
|
|
+ excel.setDecorationSituation("{" + excel.getDecorationSituation() + "}");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// 可售状态
|
|
|
if (StringUtils.isNotEmpty(excel.getSaleStatus())) {
|
|
|
for (Map<String, String> stringStringMap : saleStatus) {
|
|
@@ -220,18 +233,38 @@ public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
|
|
|
}
|
|
|
}
|
|
|
// 没匹配上的情况
|
|
|
- if(data.getSaleStatus() == null){
|
|
|
- throw new RuntimeException("可售状态格式有误");
|
|
|
+ if (data.getSaleStatus() == null) {
|
|
|
+ saleStatusFlag = false;
|
|
|
+ builder.append("可售状态格式有误").append(",");
|
|
|
+ excel.setSaleStatus("{" + excel.getSaleStatus() + "}");
|
|
|
}
|
|
|
}
|
|
|
- // TODO: 2024/9/11 户型处理
|
|
|
- data.setId(IdUtil.simpleUUID());
|
|
|
- data.setRemark(excel.getRemark());
|
|
|
- data.setCreatedId(ShiroUtils.getUserId());
|
|
|
- data.setCreatedAt(new Date());
|
|
|
- list.add(data);
|
|
|
-
|
|
|
- }catch (Exception e){
|
|
|
+
|
|
|
+ if (groupNameFlag && discNameFlag && buildNumFlag && roomNoFlag && floorFlag && actualInternalAreaFlag
|
|
|
+ && actualShareAreaFlag && actualBuildAreaFlag && roomUseFlag && decorationSituationFlag && houseTypeFlag
|
|
|
+ && saleStatusFlag
|
|
|
+ ) {
|
|
|
+ // TODO: 2024/9/11 户型处理
|
|
|
+ data.setId(IdUtil.simpleUUID());
|
|
|
+ data.setCreatedId(ShiroUtils.getUserId());
|
|
|
+ data.setCreatedAt(new Date());
|
|
|
+ data.setRoomNumber(excel.getRoomNumber());
|
|
|
+ data.setPredictionShareArea(Double.valueOf(excel.getPredictionShareArea()));
|
|
|
+ data.setPredictionInternalArea(Double.valueOf(excel.getPredictionInternalArea()));
|
|
|
+ data.setPredictionLandArea(Double.valueOf(excel.getPredictionLandArea()));
|
|
|
+ data.setPredictionBuildArea(Double.valueOf(excel.getPredictionBuildArea()));
|
|
|
+ data.setTwoPointTwo(excel.getTwoPointTwo());
|
|
|
+ data.setRoomNumber(excel.getRoomNumber());
|
|
|
+ data.setRemark(excel.getRemark());
|
|
|
+
|
|
|
+
|
|
|
+ list.add(data);
|
|
|
+ } else {
|
|
|
+ throw new RuntimeException(builder.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
String message = e.getMessage();
|
|
|
excel.setReason(message);
|
|
@@ -248,13 +281,13 @@ public class ParkRoomListener extends AnalysisEventListener<ParkRoomExcel> {
|
|
|
excelList.clear();
|
|
|
list.clear();
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
throw new RuntimeException("excel无数据");
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
- private void saveData(){
|
|
|
+ private void saveData() {
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
roomService.insertBatch(list);
|
|
|
}
|