Skip to content

Commit

Permalink
Merge pull request #587 from hanwei1980/dev-1.2.0
Browse files Browse the repository at this point in the history
fix apiService module openFile api pageSize default value bug
  • Loading branch information
zqburde authored Mar 18, 2024
2 parents a465e73 + 5138294 commit bbcfaef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)) {
Expand All @@ -172,7 +173,7 @@ public void openFile(HttpServletRequest req,
if(null != apiServiceJob && userName.equals(apiServiceJob.getSubmitUser())) {
Map<String, String> 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;
}
Expand Down

0 comments on commit bbcfaef

Please sign in to comment.