| 
						
						
							
								
							
						
						
					 | 
					@ -16,6 +16,7 @@ import com.epmet.dto.result.HouseInfoResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.result.OrganizationCodeResultDTO; | 
					 | 
					 | 
					import com.epmet.dto.result.OrganizationCodeResultDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.dto.result.OrganizationCommunityDTO; | 
					 | 
					 | 
					import com.epmet.dto.result.OrganizationCommunityDTO; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.entity.*; | 
					 | 
					 | 
					import com.epmet.entity.*; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					import com.epmet.enums.OrganizationTypeEnums; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.redis.IcOrganizationCodeInfoRedis; | 
					 | 
					 | 
					import com.epmet.redis.IcOrganizationCodeInfoRedis; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import com.epmet.service.IcOrganizationCodeInfoService; | 
					 | 
					 | 
					import com.epmet.service.IcOrganizationCodeInfoService; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
					 | 
					 | 
					import org.apache.commons.lang3.StringUtils; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					@ -108,7 +109,7 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getNeighborHoodCoding(String customerId, String gridId,Boolean updateFlag) { | 
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getNeighborHoodCoding(String customerId, String gridId, Boolean updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(gridId)) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(gridId)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -119,16 +120,16 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关社区信息", "未查到相关社区信息"); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "未查到相关社区信息", "未查到相关社区信息"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //查询该社区下是否存在数据
 | 
					 | 
					 | 
					        //查询该社区下是否存在数据
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        IcOrganizationCodeInfoEntity communEntity = baseDao.selectByCommunityIdAndCustomerId(customerId, communResult.getCommunityId()); | 
					 | 
					 | 
					        IcOrganizationCodeInfoEntity communEntity = baseDao.selectByIdAndType(customerId, communResult.getCommunityId(), OrganizationTypeEnums.COMM.getCode()); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (null == communEntity) { | 
					 | 
					 | 
					        if (null == communEntity) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            Integer neighborMaxNum = 1; | 
					 | 
					 | 
					            Integer neighborMaxNum = 1; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
					 | 
					 | 
					            String neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //开发测试需要检测,因为包含行政编码为空的社区,会出现小区编码重复的情况
 | 
					 | 
					 | 
					            //开发测试需要检测,因为包含行政编码为空的社区,会出现小区编码重复的情况
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(neighborCode,null); | 
					 | 
					 | 
					            IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(neighborCode, null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            while (null != isHaveCoding) { | 
					 | 
					 | 
					            while (null != isHaveCoding) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                neighborMaxNum++; | 
					 | 
					 | 
					                neighborMaxNum++; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
					 | 
					 | 
					                neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                isHaveCoding = icNeighborHoodDao.selectByCoding(neighborCode,null); | 
					 | 
					 | 
					                isHaveCoding = icNeighborHoodDao.selectByCoding(neighborCode, null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            result.setCoding(neighborCode); | 
					 | 
					 | 
					            result.setCoding(neighborCode); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -136,28 +137,29 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //新增该社区辅助数据
 | 
					 | 
					 | 
					            //新增该社区辅助数据
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); | 
					 | 
					 | 
					            IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            newEntity.setCustomerId(customerId); | 
					 | 
					 | 
					            newEntity.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            newEntity.setCommunityId(communResult.getCommunityId()); | 
					 | 
					 | 
					            newEntity.setSysId(communResult.getCommunityId()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if(updateFlag){ | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                newEntity.setNeighborMaxNum(getNewMaxIndex(3, neighborMaxNum)); | 
					 | 
					 | 
					                newEntity.setMaxNum(getNewMaxIndex(3, neighborMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysType(OrganizationTypeEnums.COMM.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            baseDao.insert(newEntity); | 
					 | 
					 | 
					            baseDao.insert(newEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer neighborMaxNum = Integer.valueOf(communEntity.getNeighborMaxNum()) + 1; | 
					 | 
					 | 
					            Integer neighborMaxNum = StringUtils.isBlank(communEntity.getMaxNum()) ? 1 : Integer.valueOf(communEntity.getMaxNum()) + 1; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String neiCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
					 | 
					 | 
					            String neiCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(neiCode,null); | 
					 | 
					 | 
					            IcNeighborHoodEntity isHaveCoding = icNeighborHoodDao.selectByCoding(neiCode, null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            while (null != isHaveCoding) { | 
					 | 
					 | 
					            while (null != isHaveCoding) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                //先更新已有的最大值
 | 
					 | 
					 | 
					                //先更新已有的最大值
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                communEntity.setNeighborMaxNum(getNewMaxIndex(3, neighborMaxNum)); | 
					 | 
					 | 
					                communEntity.setMaxNum(getNewMaxIndex(3, neighborMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                baseDao.updateNeiByCuIdAndCoId(communEntity); | 
					 | 
					 | 
					                baseDao.updateMaxNumByIdAndType(communEntity); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                neighborMaxNum++; | 
					 | 
					 | 
					                neighborMaxNum++; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                neiCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
					 | 
					 | 
					                neiCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                isHaveCoding = icNeighborHoodDao.selectByCoding(neiCode,null); | 
					 | 
					 | 
					                isHaveCoding = icNeighborHoodDao.selectByCoding(neiCode, null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //更新该社区下最大的小区编号
 | 
					 | 
					 | 
					            //更新该社区下最大的小区编号
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if(updateFlag) { | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                communEntity.setNeighborMaxNum(getNewMaxIndex(3, neighborMaxNum)); | 
					 | 
					 | 
					                communEntity.setMaxNum(getNewMaxIndex(3, neighborMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                baseDao.updateNeiByCuIdAndCoId(communEntity); | 
					 | 
					 | 
					                baseDao.updateMaxNumByIdAndType(communEntity); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
					 | 
					 | 
					            String neighborCode = getCompleteAreaCode(communResult.getAreaCode()) + getNewMaxIndex(3, neighborMaxNum); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            result.setCoding(neiCode); | 
					 | 
					 | 
					            result.setCoding(neiCode); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -168,7 +170,7 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getBuildingCoding(String customerId, String neighborhoodId,Boolean updateFlag) { | 
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getBuildingCoding(String customerId, String neighborhoodId, Boolean updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(neighborhoodId)) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(neighborhoodId)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -181,7 +183,7 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //如果小区编码为空,先生成小区编码并更新
 | 
					 | 
					 | 
					        //如果小区编码为空,先生成小区编码并更新
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(neighborHood.getSysCoding())) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(neighborHood.getSysCoding())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            OrganizationCodeResultDTO org = getNeighborHoodCoding(customerId, neighborHood.getGridId(),true).getData(); | 
					 | 
					 | 
					            OrganizationCodeResultDTO org = getNeighborHoodCoding(customerId, neighborHood.getGridId(), true).getData(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            neighborHood.setCoding(org.getCoding()); | 
					 | 
					 | 
					            neighborHood.setCoding(org.getCoding()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            neighborHood.setSysCoding(org.getSysCoding()); | 
					 | 
					 | 
					            neighborHood.setSysCoding(org.getSysCoding()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            icNeighborHoodDao.updateById(neighborHood); | 
					 | 
					 | 
					            icNeighborHoodDao.updateById(neighborHood); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -189,43 +191,49 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //获取社区id、小区编码
 | 
					 | 
					 | 
					        //获取社区id、小区编码
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        OrganizationCommunityDTO communResult = icNeighborHoodDao.selectCommunityByNeiId(neighborhoodId); | 
					 | 
					 | 
					        OrganizationCommunityDTO communResult = icNeighborHoodDao.selectCommunityByNeiId(neighborhoodId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //查询该社区下是否存在楼栋数据
 | 
					 | 
					 | 
					        //查询该小区下是否存在楼栋数据
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        IcOrganizationCodeInfoEntity buildingEntity = baseDao.selectByCommunityIdAndCustomerId(customerId, communResult.getCommunityId()); | 
					 | 
					 | 
					        IcOrganizationCodeInfoEntity buildingEntity = baseDao.selectByIdAndType(customerId, neighborhoodId, OrganizationTypeEnums.NEI.getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (StringUtils.isBlank(buildingEntity.getBuildingMaxNum())) { | 
					 | 
					 | 
					        if (null == buildingEntity) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            result.setCoding(communResult.getCoding() + "001"); | 
					 | 
					 | 
					            Integer maxNum = 1; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + "001"); | 
					 | 
					 | 
					            result.setCoding(communResult.getCoding() + getNewMaxIndex(3, maxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //补充该社区的楼栋最大数
 | 
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(3, maxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					//            buildingEntity.setBuildingMaxNum("001");
 | 
					 | 
					 | 
					            //新增该楼栋辅助数据
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysId(neighborhoodId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                newEntity.setMaxNum(getNewMaxIndex(3, maxNum)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysType(OrganizationTypeEnums.NEI.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            baseDao.insert(newEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer buildingMaxNum = Integer.valueOf(buildingEntity.getBuildingMaxNum()) + 1; | 
					 | 
					 | 
					            Integer buildingMaxNum = StringUtils.isBlank(buildingEntity.getMaxNum()) ? 1 : Integer.valueOf(buildingEntity.getMaxNum()) + 1; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String buildingCode = communResult.getCoding() + getNewMaxIndex(3, buildingMaxNum); | 
					 | 
					 | 
					            String buildingCode = communResult.getCoding() + getNewMaxIndex(3, buildingMaxNum); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            IcBuildingEntity isHaveCoding = icBuildingDao.selectByCoding(buildingCode,null); | 
					 | 
					 | 
					            IcBuildingEntity isHaveCoding = icBuildingDao.selectByCoding(buildingCode, null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            while (null != isHaveCoding) { | 
					 | 
					 | 
					            while (null != isHaveCoding) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                //先更新已有的最大值
 | 
					 | 
					 | 
					                //先更新已有的最大值
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                buildingEntity.setBuildingMaxNum(getNewMaxIndex(3, buildingMaxNum)); | 
					 | 
					 | 
					                buildingEntity.setMaxNum(getNewMaxIndex(3, buildingMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                baseDao.updateBuildingByCuIdAndCoId(buildingEntity); | 
					 | 
					 | 
					                baseDao.updateMaxNumByIdAndType(buildingEntity); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                buildingMaxNum++; | 
					 | 
					 | 
					                buildingMaxNum++; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                buildingCode = communResult.getCoding() + getNewMaxIndex(3, buildingMaxNum); | 
					 | 
					 | 
					                buildingCode = communResult.getCoding() + getNewMaxIndex(3, buildingMaxNum); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                isHaveCoding = icBuildingDao.selectByCoding(buildingCode,null); | 
					 | 
					 | 
					                isHaveCoding = icBuildingDao.selectByCoding(buildingCode, null); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            result.setCoding(buildingCode); | 
					 | 
					 | 
					            result.setCoding(buildingCode); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(3, buildingMaxNum)); | 
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(3, buildingMaxNum)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //更新该社区下最大的楼栋编号
 | 
					 | 
					 | 
					            //更新该社区下最大的楼栋编号
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if(updateFlag) { | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                buildingEntity.setBuildingMaxNum(getNewMaxIndex(3, buildingMaxNum)); | 
					 | 
					 | 
					                buildingEntity.setMaxNum(getNewMaxIndex(3, buildingMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                baseDao.updateMaxNumByIdAndType(buildingEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if(updateFlag) { | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            baseDao.updateBuildingByCuIdAndCoId(buildingEntity); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result<OrganizationCodeResultDTO>().ok(result); | 
					 | 
					 | 
					        return new Result<OrganizationCodeResultDTO>().ok(result); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getUnitCoding(String customerId, String buildingId,Boolean updateFlag) { | 
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getUnitCoding(String customerId, String buildingId, Boolean updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(buildingId)) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(buildingId)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -238,8 +246,8 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //如果楼栋编码为空,先生成楼栋编码并更新
 | 
					 | 
					 | 
					        //如果楼栋编码为空,先生成楼栋编码并更新
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(buildingEntity.getSysCoding())) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(buildingEntity.getSysCoding())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            ImportGeneralDTO neiInfo =  icBuildingDao.selectBuildingById(buildingId); | 
					 | 
					 | 
					            ImportGeneralDTO neiInfo = icBuildingDao.selectBuildingById(buildingId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            OrganizationCodeResultDTO org = getBuildingCoding(customerId, neiInfo.getNeighborHoodId(),true).getData(); | 
					 | 
					 | 
					            OrganizationCodeResultDTO org = getBuildingCoding(customerId, neiInfo.getNeighborHoodId(), true).getData(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            buildingEntity.setCoding(org.getCoding()); | 
					 | 
					 | 
					            buildingEntity.setCoding(org.getCoding()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            buildingEntity.setSysCoding(org.getSysCoding()); | 
					 | 
					 | 
					            buildingEntity.setSysCoding(org.getSysCoding()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            icBuildingDao.updateById(buildingEntity); | 
					 | 
					 | 
					            icBuildingDao.updateById(buildingEntity); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -247,15 +255,23 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //获取社区id、楼栋编码
 | 
					 | 
					 | 
					        //获取社区id、楼栋编码
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        OrganizationCommunityDTO communResult = icBuildingDao.selectCommunityByBuildingId(buildingId); | 
					 | 
					 | 
					        OrganizationCommunityDTO communResult = icBuildingDao.selectCommunityByBuildingId(buildingId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //查询该社区下是否存在单元数据
 | 
					 | 
					 | 
					        //查询该楼栋下是否存在单元数据
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        IcOrganizationCodeInfoEntity unitEntity = baseDao.selectByCommunityIdAndCustomerId(customerId, communResult.getCommunityId()); | 
					 | 
					 | 
					        IcOrganizationCodeInfoEntity unitEntity = baseDao.selectByIdAndType(customerId, buildingId, OrganizationTypeEnums.BUI.getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (StringUtils.isBlank(unitEntity.getUnitMaxNum())) { | 
					 | 
					 | 
					        if (null == unitEntity) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            result.setCoding(communResult.getCoding() + "01"); | 
					 | 
					 | 
					            Integer maxNum = 1; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + "01"); | 
					 | 
					 | 
					            result.setCoding(communResult.getCoding() + getNewMaxIndex(2, maxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //补充该社区的单元最大数
 | 
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(2, maxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            unitEntity.setUnitMaxNum("01"); | 
					 | 
					 | 
					            //新增该单元辅助数据
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysId(buildingId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                newEntity.setMaxNum(getNewMaxIndex(2, maxNum)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysType(OrganizationTypeEnums.BUI.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            baseDao.insert(newEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer unitMaxNum = Integer.valueOf(unitEntity.getUnitMaxNum()) + 1; | 
					 | 
					 | 
					            Integer unitMaxNum = StringUtils.isBlank(unitEntity.getMaxNum()) ? 1 : Integer.valueOf(unitEntity.getMaxNum()) + 1; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String unitCode = communResult.getCoding() + getNewMaxIndex(2, unitMaxNum); | 
					 | 
					 | 
					            String unitCode = communResult.getCoding() + getNewMaxIndex(2, unitMaxNum); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            IcBuildingUnitEntity isHaveCoding = icBuildingUnitDao.selectByCoding(unitCode); | 
					 | 
					 | 
					            IcBuildingUnitEntity isHaveCoding = icBuildingUnitDao.selectByCoding(unitCode); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -268,17 +284,17 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(2, unitMaxNum)); | 
					 | 
					 | 
					            result.setSysCoding(communResult.getSysCoding() + getNewMaxIndex(2, unitMaxNum)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //更新该社区下最大的单元编号
 | 
					 | 
					 | 
					            //更新该社区下最大的单元编号
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            if(updateFlag) { | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                unitEntity.setUnitMaxNum(getNewMaxIndex(2, unitMaxNum)); | 
					 | 
					 | 
					                unitEntity.setMaxNum(getNewMaxIndex(2, unitMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                baseDao.updateMaxNumByIdAndType(unitEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            } | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        baseDao.updateUnitByCuIdAndCoId(unitEntity); | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result<OrganizationCodeResultDTO>().ok(result); | 
					 | 
					 | 
					        return new Result<OrganizationCodeResultDTO>().ok(result); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
					 | 
					 | 
					    @Transactional(rollbackFor = Exception.class) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getHouseCoding(String customerId, String unitId,Boolean updateFlag) { | 
					 | 
					 | 
					    public Result<OrganizationCodeResultDTO> getHouseCoding(String customerId, String unitId, Boolean updateFlag) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(unitId)) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(customerId) || StringUtils.isBlank(unitId)) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
					 | 
					 | 
					            throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "所有字段不可为空", "所有字段不可为空"); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -291,8 +307,8 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //如果单元编码为空,先生成单元编码并更新
 | 
					 | 
					 | 
					        //如果单元编码为空,先生成单元编码并更新
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        if (StringUtils.isBlank(unitEntity.getSysCoding())) { | 
					 | 
					 | 
					        if (StringUtils.isBlank(unitEntity.getSysCoding())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            HouseInfoResultDTO buildingInfo =  icBuildingUnitDao.getUnitDetail(unitId); | 
					 | 
					 | 
					            HouseInfoResultDTO buildingInfo = icBuildingUnitDao.getUnitDetail(unitId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            OrganizationCodeResultDTO org = getUnitCoding(customerId, buildingInfo.getBuildingId(),true).getData(); | 
					 | 
					 | 
					            OrganizationCodeResultDTO org = getUnitCoding(customerId, buildingInfo.getBuildingId(), true).getData(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            unitEntity.setCoding(org.getCoding()); | 
					 | 
					 | 
					            unitEntity.setCoding(org.getCoding()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            unitEntity.setSysCoding(org.getSysCoding()); | 
					 | 
					 | 
					            unitEntity.setSysCoding(org.getSysCoding()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            icBuildingUnitDao.updateById(unitEntity); | 
					 | 
					 | 
					            icBuildingUnitDao.updateById(unitEntity); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -300,21 +316,29 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        //获取社区id、单元编码
 | 
					 | 
					 | 
					        //获取社区id、单元编码
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        OrganizationCommunityDTO communResult = icBuildingUnitDao.selectCommunityByUnitId(unitId); | 
					 | 
					 | 
					        OrganizationCommunityDTO communResult = icBuildingUnitDao.selectCommunityByUnitId(unitId); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					        //查询该社区下是否存在单元数据
 | 
					 | 
					 | 
					        //查询该单元下是否存在房屋数据
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        IcOrganizationCodeInfoEntity houseEntity = baseDao.selectByCommunityIdAndCustomerId(customerId, communResult.getCommunityId()); | 
					 | 
					 | 
					        IcOrganizationCodeInfoEntity houseEntity = baseDao.selectByIdAndType(customerId, unitId, OrganizationTypeEnums.UNIT.getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					        if (StringUtils.isBlank(houseEntity.getUnitMaxNum())) { | 
					 | 
					 | 
					        if (null == houseEntity) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            result.setCoding(communResult.getCoding() + "001"); | 
					 | 
					 | 
					            Integer maxNum = 1; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					            //补充该社区的房屋最大数
 | 
					 | 
					 | 
					            result.setCoding(communResult.getCoding() + getNewMaxIndex(4, maxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					//            houseEntity.setHouseMaxNum("001");
 | 
					 | 
					 | 
					            //新增该单元辅助数据
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            IcOrganizationCodeInfoEntity newEntity = new IcOrganizationCodeInfoEntity(); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setCustomerId(customerId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysId(unitId); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            if (updateFlag) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					                newEntity.setMaxNum(getNewMaxIndex(4, maxNum)); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            newEntity.setSysType(OrganizationTypeEnums.UNIT.getCode()); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					            baseDao.insert(newEntity); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } else { | 
					 | 
					 | 
					        } else { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					            Integer houseMaxNum = Integer.valueOf(houseEntity.getUnitMaxNum()) + 1; | 
					 | 
					 | 
					            Integer houseMaxNum = StringUtils.isBlank(houseEntity.getMaxNum()) ? 1 : Integer.valueOf(houseEntity.getMaxNum()) + 1; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
					 | 
					 | 
					            //验证可编辑的编码是否有重复
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            String houseCode = communResult.getCoding() + getNewMaxIndex(4, houseMaxNum); | 
					 | 
					 | 
					            String houseCode = communResult.getCoding() + getNewMaxIndex(4, houseMaxNum); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            IcHouseEntity isHaveCoding = icHouseDao.selectByCoding(houseCode); | 
					 | 
					 | 
					            IcHouseEntity isHaveCoding = icHouseDao.selectByCoding(houseCode); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            while (null != isHaveCoding) { | 
					 | 
					 | 
					            while (null != isHaveCoding) { | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                //先更新已有的最大值
 | 
					 | 
					 | 
					                //先更新已有的最大值
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					                houseEntity.setHouseMaxNum(getNewMaxIndex(4, houseMaxNum)); | 
					 | 
					 | 
					                houseEntity.setMaxNum(getNewMaxIndex(4, houseMaxNum)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					                baseDao.updateHouseByCuIdAndCoId(houseEntity); | 
					 | 
					 | 
					                baseDao.updateMaxNumByIdAndType(houseEntity); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					 | 
					 | 
					                houseMaxNum++; | 
					 | 
					 | 
					                houseMaxNum++; | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                houseCode = communResult.getCoding() + getNewMaxIndex(4, houseMaxNum); | 
					 | 
					 | 
					                houseCode = communResult.getCoding() + getNewMaxIndex(4, houseMaxNum); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					                isHaveCoding = icHouseDao.selectByCoding(houseCode); | 
					 | 
					 | 
					                isHaveCoding = icHouseDao.selectByCoding(houseCode); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					@ -323,8 +347,8 @@ public class IcOrganizationCodeInfoServiceImpl extends BaseServiceImpl<IcOrganiz | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					            //更新该社区下最大的房屋编号
 | 
					 | 
					 | 
					            //更新该社区下最大的房屋编号
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//            houseEntity.setHouseMaxNum(getNewMaxIndex(4, houseMaxNum));
 | 
					 | 
					 | 
					//            houseEntity.setHouseMaxNum(getNewMaxIndex(4, houseMaxNum));
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					 | 
					 | 
					 | 
					//            baseDao.updateMaxNumByIdAndType(houseEntity);
 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        } | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					//        baseDao.updateHouseByCuIdAndCoId(houseEntity);
 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					        return new Result<OrganizationCodeResultDTO>().ok(result); | 
					 | 
					 | 
					        return new Result<OrganizationCodeResultDTO>().ok(result); | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					    } | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					 | 
					 | 
					
 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					
  |