|
|
@@ -19,6 +19,7 @@ package org.springblade.community.service.impl;
|
|
|
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import net.logstash.logback.encoder.org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springblade.community.dto.AgencyMngDelDTO;
|
|
|
import org.springblade.community.entity.*;
|
|
|
import org.springblade.community.service.*;
|
|
|
import org.springblade.community.vo.BuildingVO;
|
|
|
@@ -82,17 +83,17 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
building.setAgencyName(agency.getName());
|
|
|
// 楼栋命名
|
|
|
String buildingName = "";
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getBuildingPrefix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getBuildingPrefix())) {
|
|
|
buildingName += batchAddInfo.getBuildingPrefix();
|
|
|
}
|
|
|
buildingName += (i + "");
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getBuildingSuffix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getBuildingSuffix())) {
|
|
|
buildingName += batchAddInfo.getBuildingSuffix();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
buildingName += "栋";
|
|
|
}
|
|
|
building.setName(buildingName);
|
|
|
- if (this.save(building)){
|
|
|
+ if (this.save(building)) {
|
|
|
// 更新楼栋的orgPosition
|
|
|
building.setOrgPosition(residential.getOrgPosition() + "/" + building.getId());
|
|
|
this.updateById(building);
|
|
|
@@ -109,17 +110,17 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
|
|
|
// 单元命名
|
|
|
String unitName = "";
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getUnitPrefix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getUnitPrefix())) {
|
|
|
unitName += batchAddInfo.getUnitPrefix();
|
|
|
}
|
|
|
unitName += (j + "");
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getUnitSuffix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getUnitSuffix())) {
|
|
|
unitName += batchAddInfo.getUnitSuffix();
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
unitName += "单元";
|
|
|
}
|
|
|
unit.setName(unitName);
|
|
|
- if (unitService.save(unit)){
|
|
|
+ if (unitService.save(unit)) {
|
|
|
// 更新单元orgPosition
|
|
|
unit.setOrgPosition(building.getOrgPosition() + "/" + unit.getId());
|
|
|
unitService.updateById(unit);
|
|
|
@@ -127,7 +128,7 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
// 遍历新建楼层
|
|
|
for (int k = batchAddInfo.getFloorBegin(); k <= batchAddInfo.getFloorEnd(); k++) {
|
|
|
//跳过排除楼层
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getFloorExclude()) && (batchAddInfo.getFloorExclude()).contains((k + ""))){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getFloorExclude()) && (batchAddInfo.getFloorExclude()).contains((k + ""))) {
|
|
|
continue;
|
|
|
}
|
|
|
Floor floor = new Floor();
|
|
|
@@ -142,18 +143,18 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
|
|
|
// 楼层命名
|
|
|
String floorName = "";
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getFloorPrefix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getFloorPrefix())) {
|
|
|
floorName += batchAddInfo.getFloorPrefix();
|
|
|
}
|
|
|
floorName += (k + "");
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getFloorSuffix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getFloorSuffix())) {
|
|
|
floorName += batchAddInfo.getFloorSuffix();
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
floorName += "层";
|
|
|
}
|
|
|
floor.setName(floorName);
|
|
|
|
|
|
- if (floorService.save(floor)){
|
|
|
+ if (floorService.save(floor)) {
|
|
|
//更新楼层orgPosition
|
|
|
floor.setOrgPosition(unit.getOrgPosition() + "/" + floor.getId());
|
|
|
floorService.updateById(floor);
|
|
|
@@ -161,7 +162,7 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
// 遍历新建房间/房屋
|
|
|
for (int m = batchAddInfo.getRoomBegin(); m <= batchAddInfo.getRoomEnd(); m++) {
|
|
|
// 跳过排除楼层
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getRoomExclude()) && (batchAddInfo.getRoomExclude()).contains((m + ""))){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getRoomExclude()) && (batchAddInfo.getRoomExclude()).contains((m + ""))) {
|
|
|
continue;
|
|
|
}
|
|
|
Room room = new Room();
|
|
|
@@ -178,16 +179,16 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
|
|
|
// 房屋命名
|
|
|
String roomName = "";
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getRoomPrefix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getRoomPrefix())) {
|
|
|
roomName += batchAddInfo.getRoomPrefix();
|
|
|
}
|
|
|
|
|
|
roomName += (k + (m < 10 ? "0" : "") + m);
|
|
|
- if (StringUtils.isNotBlank(batchAddInfo.getRoomSuffix())){
|
|
|
+ if (StringUtils.isNotBlank(batchAddInfo.getRoomSuffix())) {
|
|
|
roomName += batchAddInfo.getRoomSuffix();
|
|
|
}
|
|
|
room.setName(roomName);
|
|
|
- if (roomService.save(room)){
|
|
|
+ if (roomService.save(room)) {
|
|
|
// 更新房屋orgPosition
|
|
|
room.setOrgPosition(floor.getOrgPosition() + "/" + room.getId());
|
|
|
roomService.updateById(room);
|
|
|
@@ -196,7 +197,7 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
}
|
|
|
//更新楼层的房间数
|
|
|
Integer roomNumber = floor.getRoomCount();
|
|
|
- if ("null".equals(roomNumber + "")){
|
|
|
+ if ("null".equals(roomNumber + "")) {
|
|
|
roomNumber = 0;
|
|
|
}
|
|
|
floor.setRoomCount(roomNumber + roomCount);
|
|
|
@@ -204,12 +205,12 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
}
|
|
|
//更新单元的楼层数、房间数
|
|
|
Integer floorNumber = unit.getFloorCount();
|
|
|
- if ("null".equals(floorNumber + "")){
|
|
|
+ if ("null".equals(floorNumber + "")) {
|
|
|
floorNumber = 0;
|
|
|
}
|
|
|
unit.setFloorCount(floorNumber + floorCount);
|
|
|
Integer roomNumber = unit.getRoomCount();
|
|
|
- if ("null".equals(roomNumber + "")){
|
|
|
+ if ("null".equals(roomNumber + "")) {
|
|
|
roomNumber = 0;
|
|
|
}
|
|
|
unit.setRoomCount(roomNumber + roomCount * floorCount);
|
|
|
@@ -218,18 +219,18 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
}
|
|
|
// 更新楼栋的单元数、楼层数、房间数
|
|
|
Integer unitNumber = building.getUnitCount();
|
|
|
- if ("null".equals(unitNumber + "")){
|
|
|
+ if ("null".equals(unitNumber + "")) {
|
|
|
unitNumber = 0;
|
|
|
}
|
|
|
building.setUnitCount(unitNumber + unitCount);
|
|
|
Integer floorNumber = building.getFloorCount();
|
|
|
- if ("null".equals(floorNumber + "")){
|
|
|
- floorNumber = 0 ;
|
|
|
+ if ("null".equals(floorNumber + "")) {
|
|
|
+ floorNumber = 0;
|
|
|
}
|
|
|
building.setFloorCount(floorNumber + floorCount * unitCount);
|
|
|
Integer roomNumber = building.getRoomCount();
|
|
|
- if ("null".equals(roomNumber + "")){
|
|
|
- roomNumber = 0 ;
|
|
|
+ if ("null".equals(roomNumber + "")) {
|
|
|
+ roomNumber = 0;
|
|
|
}
|
|
|
building.setRoomCount(roomNumber + roomCount * floorCount * unitCount);
|
|
|
|
|
|
@@ -238,23 +239,23 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
}
|
|
|
// 更新小区的楼栋数、单元数、楼层数、房间数
|
|
|
Integer buildingNumber = residential.getBuildingCount();
|
|
|
- if ("null".equals(buildingNumber + "")){
|
|
|
- buildingNumber = 0 ;
|
|
|
+ if ("null".equals(buildingNumber + "")) {
|
|
|
+ buildingNumber = 0;
|
|
|
}
|
|
|
residential.setBuildingCount(buildingNumber + buildingCount);
|
|
|
Integer unitNumber = residential.getUnitCount();
|
|
|
- if ("null".equals(unitNumber + "")){
|
|
|
+ if ("null".equals(unitNumber + "")) {
|
|
|
unitNumber = 0;
|
|
|
}
|
|
|
residential.setUnitCount(unitNumber + unitCount * buildingCount);
|
|
|
Integer floorNumber = residential.getFloorCount();
|
|
|
- if ("null".equals(floorNumber + "")){
|
|
|
- floorNumber = 0 ;
|
|
|
+ if ("null".equals(floorNumber + "")) {
|
|
|
+ floorNumber = 0;
|
|
|
}
|
|
|
residential.setFloorCount(floorNumber + floorCount * unitCount * buildingCount);
|
|
|
Integer roomNumber = residential.getRoomCount();
|
|
|
- if ("null".equals(roomNumber + "")){
|
|
|
- roomNumber = 0 ;
|
|
|
+ if ("null".equals(roomNumber + "")) {
|
|
|
+ roomNumber = 0;
|
|
|
}
|
|
|
residential.setRoomCount(roomNumber + roomCount * floorCount * unitCount * buildingCount);
|
|
|
residentialService.updateById(residential);
|
|
|
@@ -262,4 +263,9 @@ public class BuildingServiceImpl extends BaseServiceImpl<BuildingMapper, Buildin
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public Boolean delete(AgencyMngDelDTO agencyMngDelDTO) {
|
|
|
+ return baseMapper.delete(agencyMngDelDTO);
|
|
|
+ }
|
|
|
+
|
|
|
}
|