diff --git a/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/restful/api/ProjectManagerRestfulApi.java b/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/restful/api/ProjectManagerRestfulApi.java index 67e35f065..d147f3e04 100644 --- a/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/restful/api/ProjectManagerRestfulApi.java +++ b/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/restful/api/ProjectManagerRestfulApi.java @@ -67,6 +67,10 @@ public class ProjectManagerRestfulApi { private static final String NO_OPERATION_PERMISSION_MESSAGE = "the current user has no operation permission"; + private static final String TYPE_PROJECT = "project"; + + private static final String TYPE_JOB = "job"; + @RequestMapping(path = "/files/upload", method = RequestMethod.POST) public Message upload(HttpServletRequest req, @RequestParam(name = "version",required = false) String version, @@ -217,8 +221,10 @@ public Message download( HttpServletRequest req, HttpServletResponse response, if (StringUtils.isBlank(projectName)) { if (StringUtils.isBlank(materialType)) { return Message.error("projectName and materialType is null"); - } else if (materialType.equals("job")) { + } else if (materialType.equals(TYPE_JOB)) { file = streamJobService.getJobFileById(id); + } else if (materialType.equals(TYPE_PROJECT)){ + file = projectManagerService.getFile(id, projectName); } } else { if (!projectPrivilegeService.hasEditPrivilege(req, projectName)) diff --git a/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/service/impl/ProjectManagerServiceImpl.java b/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/service/impl/ProjectManagerServiceImpl.java index dc744483b..eb773a9a9 100644 --- a/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/service/impl/ProjectManagerServiceImpl.java +++ b/streamis-jobmanager/streamis-projectmanager-server/src/main/java/com/webank/wedatasphere/streamis/projectmanager/service/impl/ProjectManagerServiceImpl.java @@ -103,7 +103,7 @@ public boolean delete(String fileName, String projectName, String username) { @Override public ProjectFiles getFile(Long id, String projectName) { - return StringUtils.isBlank(projectName) ? projectManagerMapper.getJobFile(id) : projectManagerMapper.getProjectFile(id); + return projectManagerMapper.getProjectFile(id); } @Override