|
|
@ -43,6 +43,7 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.HashSet; |
|
|
@ -123,9 +124,11 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic |
|
|
|
if (projectMapper.insert(project) > 0) { |
|
|
|
if (projectMapper.insert(project) > 0) { |
|
|
|
result.put(Constants.DATA_LIST, project); |
|
|
|
result.put(Constants.DATA_LIST, project); |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
permissionPostHandle(AuthorizationType.PROJECTS, loginUser.getId(), Collections.singletonList(project.getId()), logger); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
putMsg(result, Status.CREATE_PROJECT_ERROR); |
|
|
|
putMsg(result, Status.CREATE_PROJECT_ERROR); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
logger.info("create project complete and id is :{}", project.getId()); |
|
|
|
return result; |
|
|
|
return result; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -205,7 +208,7 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic |
|
|
|
boolean checkResult = false; |
|
|
|
boolean checkResult = false; |
|
|
|
if (project == null) { |
|
|
|
if (project == null) { |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUND, ""); |
|
|
|
putMsg(result, Status.PROJECT_NOT_FOUND, ""); |
|
|
|
} else if (!canOperatorPermissions(loginUser, new Object[]{project.getId()},AuthorizationType.PROJECTS,null)) { |
|
|
|
} else if (!canOperatorPermissions(loginUser, new Object[]{project.getId()},AuthorizationType.PROJECTS,PROJECT)) { |
|
|
|
putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), project.getName()); |
|
|
|
putMsg(result, Status.USER_NO_OPERATION_PROJECT_PERM, loginUser.getUserName(), project.getName()); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
checkResult = true; |
|
|
|
checkResult = true; |
|
|
@ -226,10 +229,17 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic |
|
|
|
public Result queryProjectListPaging(User loginUser, Integer pageSize, Integer pageNo, String searchVal) { |
|
|
|
public Result queryProjectListPaging(User loginUser, Integer pageSize, Integer pageNo, String searchVal) { |
|
|
|
Result result = new Result(); |
|
|
|
Result result = new Result(); |
|
|
|
PageInfo<Project> pageInfo = new PageInfo<>(pageNo, pageSize); |
|
|
|
PageInfo<Project> pageInfo = new PageInfo<>(pageNo, pageSize); |
|
|
|
|
|
|
|
|
|
|
|
Page<Project> page = new Page<>(pageNo, pageSize); |
|
|
|
Page<Project> page = new Page<>(pageNo, pageSize); |
|
|
|
|
|
|
|
if (!canOperatorPermissions(loginUser, null, AuthorizationType.PROJECTS, PROJECT)) { |
|
|
|
|
|
|
|
putMsg(result, Status.NO_CURRENT_OPERATING_PERMISSION); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
|
|
|
|
if (projectIds.isEmpty()) { |
|
|
|
|
|
|
|
result.setData(pageInfo); |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
IPage<Project> projectIPage = projectMapper.queryProjectListPaging(page, new ArrayList<>(projectIds), searchVal); |
|
|
|
IPage<Project> projectIPage = projectMapper.queryProjectListPaging(page, new ArrayList<>(projectIds), searchVal); |
|
|
|
|
|
|
|
|
|
|
|
List<Project> projectList = projectIPage.getRecords(); |
|
|
|
List<Project> projectList = projectIPage.getRecords(); |
|
|
@ -353,6 +363,11 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
|
|
|
|
if (projectIds.isEmpty()) { |
|
|
|
|
|
|
|
result.put(Constants.DATA_LIST, Collections.emptyList()); |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
List<Project> projectList = projectMapper.listAuthorizedProjects(loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), new ArrayList<>(projectIds)); |
|
|
|
List<Project> projectList = projectMapper.listAuthorizedProjects(loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), new ArrayList<>(projectIds)); |
|
|
|
|
|
|
|
|
|
|
|
List<Project> resultList = new ArrayList<>(); |
|
|
|
List<Project> resultList = new ArrayList<>(); |
|
|
@ -459,6 +474,11 @@ public class ProjectServiceImpl extends BaseServiceImpl implements ProjectServic |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
Set<Integer> projectIds = resourcePermissionCheckService.userOwnedResourceIdsAcquisition(AuthorizationType.PROJECTS, loginUser.getId(), logger); |
|
|
|
|
|
|
|
if (projectIds.isEmpty()) { |
|
|
|
|
|
|
|
result.put(Constants.DATA_LIST, Collections.emptyList()); |
|
|
|
|
|
|
|
putMsg(result, Status.SUCCESS); |
|
|
|
|
|
|
|
return result; |
|
|
|
|
|
|
|
} |
|
|
|
List<Project> projects = projectMapper.listAuthorizedProjects(loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), new ArrayList<>(projectIds)); |
|
|
|
List<Project> projects = projectMapper.listAuthorizedProjects(loginUser.getUserType().equals(UserType.ADMIN_USER) ? 0 : loginUser.getId(), new ArrayList<>(projectIds)); |
|
|
|
|
|
|
|
|
|
|
|
result.put(Constants.DATA_LIST, projects); |
|
|
|
result.put(Constants.DATA_LIST, projects); |
|
|
|