diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java index 2c0fc01..5500fce 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/common/helper/impl/RegionsCacheHelperImpl.java @@ -54,6 +54,9 @@ public class RegionsCacheHelperImpl extends AbstractRegionCacheHelper implements @Override public Collection listChildRegionCodeList(String regionCode, int regionLevel) { RegionDTO currRegion = getByCodeAndLevel(regionCode, regionLevel); + if(Objects.isNull(currRegion)){ + return Collections.emptyList(); + } if (currRegion.getParentCode().equals(regionCode)) { return Collections.singletonList(regionCode); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java index 19b8b2b..5350444 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/datascope/provider/impl/RegionAdminDataScopeProviderImpl.java @@ -1,6 +1,7 @@ package com.ningdatech.pmapi.datascope.provider.impl; import cn.hutool.core.collection.CollUtil; +import com.google.common.collect.Lists; import com.ningdatech.pmapi.common.constant.RegionConst; import com.ningdatech.pmapi.common.helper.RegionCacheHelper; import com.ningdatech.pmapi.common.helper.UserInfoHelper; @@ -40,6 +41,7 @@ public class RegionAdminDataScopeProviderImpl implements DataScopeProvider { RegionConst.RL_CITY); //如果不是市本级的话 就直接放入本区域的县就好了 if(CollUtil.isEmpty(regionCodes)){ + regionCodes = Lists.newArrayList(); regionCodes.add(userFullInfo.getRegionCode()); } diff --git a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java index 7418a5b..5277eff 100644 --- a/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java +++ b/pmapi/src/main/java/com/ningdatech/pmapi/projectlib/manage/ProjectLibManage.java @@ -197,9 +197,11 @@ public class ProjectLibManage { }else{ //否则是重新提交的 新生成一个新版本的项目 project = newProjectWithVersion(projectDto); - project.setInstCode(instanceId); - project.setSponsor(employeeCode); - projectService.updateById(project); + if(Objects.nonNull(project)){ + project.setInstCode(instanceId); + project.setSponsor(employeeCode); + projectService.updateById(project); + } } //保存项目应用 @@ -213,6 +215,7 @@ public class ProjectLibManage { List applications = projectDto.getApplicationList().stream().map(application -> { ProjectApplication projectApplication = new ProjectApplication(); BeanUtils.copyProperties(application, projectApplication); + projectApplication.setId(null); projectApplication.setProjectId(finalProject.getId()); return projectApplication; }).collect(Collectors.toList()); @@ -246,6 +249,7 @@ public class ProjectLibManage { List applications = projectDto.getApplicationList().stream().map(application -> { ProjectApplication projectApplication = new ProjectApplication(); BeanUtils.copyProperties(application, projectApplication); + projectApplication.setId(null); projectApplication.setProjectId(finalProject.getId()); return projectApplication; }).collect(Collectors.toList());