|
|
@ -14,6 +14,7 @@ import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionResultDTO; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
@ -536,12 +537,15 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
//如果楼宇单元大于之前的楼宇单元,新增单元
|
|
|
|
Integer nowUnit= formDTO.getTotalUnitNum(); |
|
|
|
Integer unit = icBuilding.getTotalUnitNum(); |
|
|
|
if(nowUnit>=unit){ |
|
|
|
if(nowUnit<unit){ |
|
|
|
//如果小于,判断是否存在房屋,如果存在就提示不能更改
|
|
|
|
throw new EpmetException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),"暂不支持单元号减小"); |
|
|
|
} |
|
|
|
//新增单元
|
|
|
|
List<OptionResultDTO> units = icBuildingUnitService.getUnitOptions(icBuilding.getId()); |
|
|
|
Map<String, String> unitMap = units.stream().collect(Collectors.toMap(OptionResultDTO::getCode, OptionResultDTO::getLabel)); |
|
|
|
List<IcBuildingUnitEntity> unitList = new ArrayList<>(); |
|
|
|
for(int i = 1 ;i<nowUnit;i++){ |
|
|
|
for (int i = 1; i <= nowUnit; i++) { |
|
|
|
String unitNum = String.valueOf(i); |
|
|
|
if (!unitMap.containsKey(unitNum)) { |
|
|
|
IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity(); |
|
|
@ -553,13 +557,6 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
} |
|
|
|
} |
|
|
|
icBuildingUnitService.insertBatch(unitList); |
|
|
|
}else{ |
|
|
|
//如果小于,判断是否存在房屋,如果存在就提示不能更改
|
|
|
|
throw new RenException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),"楼宇单元下存在房屋,无法更新"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|