|
@ -454,7 +454,20 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
Integer unit = icBuilding.getTotalUnitNum(); |
|
|
Integer unit = icBuilding.getTotalUnitNum(); |
|
|
if (nowUnit < unit) { |
|
|
if (nowUnit < unit) { |
|
|
//如果小于,判断是否存在房屋,如果存在就提示不能更改
|
|
|
//如果小于,判断是否存在房屋,如果存在就提示不能更改
|
|
|
throw new EpmetException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(), EpmetErrorCode.ORG_EDIT_FAILED.getMsg(), "暂不支持单元号减小"); |
|
|
/** |
|
|
|
|
|
* 校验规则,单元号倒序,校验(原来的单元数 - 现在单元数)个单元下是不是存在房屋,存在房屋不能更新 |
|
|
|
|
|
* 2022-05-31修改逻辑,可以修改变小,先去校验,单元下存在房屋就报错,不存在,删除对应单元,更新楼栋单元数 |
|
|
|
|
|
*/ |
|
|
|
|
|
Integer size = unit - nowUnit; |
|
|
|
|
|
List<String> ids = icBuildingUnitDao.getUnitIdByBuildingId(formDTO.getBuildingId(), size); |
|
|
|
|
|
if (!CollectionUtils.isEmpty(ids)){ |
|
|
|
|
|
Integer houseCount = icHouseDao.getHouseCountByUnitIds(ids); |
|
|
|
|
|
if (houseCount.compareTo(NumConstant.ZERO) != NumConstant.ZERO){ |
|
|
|
|
|
throw new EpmetException(EpmetErrorCode.UNIT_EXIST_HOUSES_ERROR.getCode()); |
|
|
|
|
|
} |
|
|
|
|
|
icBuildingUnitDao.delUnit(ids); |
|
|
|
|
|
} |
|
|
|
|
|
// throw new EpmetException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(), EpmetErrorCode.ORG_EDIT_FAILED.getMsg(), "暂不支持单元号减小");
|
|
|
} else { |
|
|
} else { |
|
|
//新增单元
|
|
|
//新增单元
|
|
|
List<OptionResultDTO> units = icBuildingUnitService.getUnitOptions(icBuilding.getId()); |
|
|
List<OptionResultDTO> units = icBuildingUnitService.getUnitOptions(icBuilding.getId()); |
|
|