|
|
@ -17,6 +17,7 @@ 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.page.PageData; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis; |
|
|
|
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
@ -553,24 +554,26 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
Integer unit = icBuilding.getTotalUnitNum(); |
|
|
|
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++) { |
|
|
|
String unitNum = String.valueOf(i); |
|
|
|
if (!unitMap.containsKey(unitNum)) { |
|
|
|
IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity(); |
|
|
|
icBuildingUnit.setBuildingId(icBuilding.getId()); |
|
|
|
icBuildingUnit.setCustomerId(customerId); |
|
|
|
icBuildingUnit.setUnitName(unitNum + "单元"); |
|
|
|
icBuildingUnit.setUnitNum(unitNum); |
|
|
|
unitList.add(icBuildingUnit); |
|
|
|
throw new EpmetException(EpmetErrorCode.ORG_EDIT_FAILED.getCode(),EpmetErrorCode.ORG_EDIT_FAILED.getMsg(),"暂不支持单元号减小"); |
|
|
|
}else{ |
|
|
|
//新增单元
|
|
|
|
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++) { |
|
|
|
String unitNum = String.valueOf(i); |
|
|
|
if (!unitMap.containsKey(unitNum)) { |
|
|
|
IcBuildingUnitEntity icBuildingUnit = new IcBuildingUnitEntity(); |
|
|
|
icBuildingUnit.setBuildingId(icBuilding.getId()); |
|
|
|
icBuildingUnit.setCustomerId(customerId); |
|
|
|
icBuildingUnit.setUnitName(unitNum + "单元"); |
|
|
|
icBuildingUnit.setUnitNum(unitNum); |
|
|
|
unitList.add(icBuildingUnit); |
|
|
|
} |
|
|
|
icBuildingUnitService.insertBatch(unitList); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
icBuildingUnitService.insertBatch(unitList); |
|
|
|
//删除楼栋下所有的房屋缓存
|
|
|
|
List<IcHouseEntity> houseList = icHouseDao.selectList(new QueryWrapper<IcHouseEntity>().lambda().eq(IcHouseEntity::getBuildingId, formDTO.getBuildingId())); |
|
|
|
if (!CollectionUtils.isEmpty(houseList)) { |
|
|
@ -579,8 +582,8 @@ public class BuildingServiceImpl implements BuildingService { |
|
|
|
icHouseRedis.delHouseInfo(house.getId(), customerId); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//删除楼栋缓存
|
|
|
|
CustomerIcHouseRedis.delBuildingInfo(formDTO.getBuildingId()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|