diff --git a/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/constant/ApiCommonConstant.java b/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/constant/ApiCommonConstant.java index a91850d291..19a490badf 100644 --- a/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/constant/ApiCommonConstant.java +++ b/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/constant/ApiCommonConstant.java @@ -20,4 +20,7 @@ public class ApiCommonConstant { public static final String DEFAULT_APPROVAL_NO="0001"; public static final Integer API_DELETE_STATUS=2; + public static final String PAGE = "1"; + public static final String PAGE_SIZE = "5000"; + public static final String CHARSET = "utf-8"; } diff --git a/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/execute/ExecuteCodeHelper.java b/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/execute/ExecuteCodeHelper.java index 67a8a84fa0..ba4b2f78ba 100644 --- a/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/execute/ExecuteCodeHelper.java +++ b/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/execute/ExecuteCodeHelper.java @@ -155,12 +155,14 @@ public static String getResultList(JobExecuteResult executeResult,UJESClient cl - public static String getResultContent(String user, String path, int maxSize,UJESClient client) { + public static String getResultContent(String user, String path,int page, int maxSize,String charset,UJESClient client) { String fileContent = client.resultSet(ResultSetAction.builder() - .setPath(path) - .setUser(user) - .setPageSize(maxSize).build()).getResponseBody(); + .setPath(path) + .setUser(user) + .setPage(page) + .setCharset(charset) + .setPageSize(maxSize).build()).getResponseBody(); return fileContent; } diff --git a/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceExecuteRestfulApi.java b/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceExecuteRestfulApi.java index e32d4fabab..1af38f16d0 100644 --- a/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceExecuteRestfulApi.java +++ b/dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceExecuteRestfulApi.java @@ -20,6 +20,7 @@ import com.fasterxml.jackson.databind.JavaType; import com.webank.wedatasphere.dss.apiservice.core.bo.*; import com.webank.wedatasphere.dss.apiservice.core.config.ApiServiceConfiguration; +import com.webank.wedatasphere.dss.apiservice.core.constant.ApiCommonConstant; import com.webank.wedatasphere.dss.apiservice.core.exception.ApiServiceQueryException; import com.webank.wedatasphere.dss.apiservice.core.execute.ExecuteCodeHelper; import com.webank.wedatasphere.dss.apiservice.core.execute.LinkisJobSubmit; @@ -156,9 +157,9 @@ public void getDirFileTrees(HttpServletRequest req, HttpServletResponse resp, public void openFile(HttpServletRequest req, @RequestParam(required = false, name = "path") String path, @RequestParam(required = false, name = "taskId") String taskId, - @DefaultValue("1") @RequestParam(required = false, name = "page") Integer page, - @DefaultValue("5000") @RequestParam(required = false, name = "pageSize") Integer pageSize, - @DefaultValue("utf-8") @RequestParam(required = false, name = "charset") String charset, + @RequestParam(required = false, name = "page",defaultValue = ApiCommonConstant.PAGE) Integer page, + @RequestParam(required = false, name = "pageSize",defaultValue = ApiCommonConstant.PAGE_SIZE) Integer pageSize, + @RequestParam(required = false, name = "charset",defaultValue = ApiCommonConstant.CHARSET) String charset, HttpServletResponse resp) throws IOException, ApiServiceQueryException { String userName = SecurityFilter.getLoginUsername(req); if (StringUtils.isEmpty(path)) { @@ -172,7 +173,7 @@ public void openFile(HttpServletRequest req, if(null != apiServiceJob && userName.equals(apiServiceJob.getSubmitUser())) { Map props = new HashMap<>(); UJESClient client = LinkisJobSubmit.getClient(props); - fileContent = ExecuteCodeHelper.getResultContent(apiServiceJob.getProxyUser(), path, pageSize, client); + fileContent = ExecuteCodeHelper.getResultContent(apiServiceJob.getProxyUser(), path, page, pageSize, charset, client); }else{ fileContent="当前用户不存在运行的TaskId: "+taskId; }