Skip to content

Commit bbcfaef

Browse files
authored
Merge pull request #587 from hanwei1980/dev-1.2.0
fix apiService module openFile api pageSize default value bug
2 parents a465e73 + 5138294 commit bbcfaef

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/constant/ApiCommonConstant.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@
2020
public class ApiCommonConstant {
2121
public static final String DEFAULT_APPROVAL_NO="0001";
2222
public static final Integer API_DELETE_STATUS=2;
23+
public static final String PAGE = "1";
24+
public static final String PAGE_SIZE = "5000";
25+
public static final String CHARSET = "utf-8";
2326
}

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/execute/ExecuteCodeHelper.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,12 +155,14 @@ public static String getResultList(JobExecuteResult executeResult,UJESClient cl
155155

156156

157157

158-
public static String getResultContent(String user, String path, int maxSize,UJESClient client) {
158+
public static String getResultContent(String user, String path,int page, int maxSize,String charset,UJESClient client) {
159159

160160
String fileContent = client.resultSet(ResultSetAction.builder()
161-
.setPath(path)
162-
.setUser(user)
163-
.setPageSize(maxSize).build()).getResponseBody();
161+
.setPath(path)
162+
.setUser(user)
163+
.setPage(page)
164+
.setCharset(charset)
165+
.setPageSize(maxSize).build()).getResponseBody();
164166

165167
return fileContent;
166168
}

dss-apps/dss-apiservice-server/src/main/java/com/webank/wedatasphere/dss/apiservice/core/restful/ApiServiceExecuteRestfulApi.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.fasterxml.jackson.databind.JavaType;
2121
import com.webank.wedatasphere.dss.apiservice.core.bo.*;
2222
import com.webank.wedatasphere.dss.apiservice.core.config.ApiServiceConfiguration;
23+
import com.webank.wedatasphere.dss.apiservice.core.constant.ApiCommonConstant;
2324
import com.webank.wedatasphere.dss.apiservice.core.exception.ApiServiceQueryException;
2425
import com.webank.wedatasphere.dss.apiservice.core.execute.ExecuteCodeHelper;
2526
import com.webank.wedatasphere.dss.apiservice.core.execute.LinkisJobSubmit;
@@ -156,9 +157,9 @@ public void getDirFileTrees(HttpServletRequest req, HttpServletResponse resp,
156157
public void openFile(HttpServletRequest req,
157158
@RequestParam(required = false, name = "path") String path,
158159
@RequestParam(required = false, name = "taskId") String taskId,
159-
@DefaultValue("1") @RequestParam(required = false, name = "page") Integer page,
160-
@DefaultValue("5000") @RequestParam(required = false, name = "pageSize") Integer pageSize,
161-
@DefaultValue("utf-8") @RequestParam(required = false, name = "charset") String charset,
160+
@RequestParam(required = false, name = "page",defaultValue = ApiCommonConstant.PAGE) Integer page,
161+
@RequestParam(required = false, name = "pageSize",defaultValue = ApiCommonConstant.PAGE_SIZE) Integer pageSize,
162+
@RequestParam(required = false, name = "charset",defaultValue = ApiCommonConstant.CHARSET) String charset,
162163
HttpServletResponse resp) throws IOException, ApiServiceQueryException {
163164
String userName = SecurityFilter.getLoginUsername(req);
164165
if (StringUtils.isEmpty(path)) {
@@ -172,7 +173,7 @@ public void openFile(HttpServletRequest req,
172173
if(null != apiServiceJob && userName.equals(apiServiceJob.getSubmitUser())) {
173174
Map<String, String> props = new HashMap<>();
174175
UJESClient client = LinkisJobSubmit.getClient(props);
175-
fileContent = ExecuteCodeHelper.getResultContent(apiServiceJob.getProxyUser(), path, pageSize, client);
176+
fileContent = ExecuteCodeHelper.getResultContent(apiServiceJob.getProxyUser(), path, page, pageSize, charset, client);
176177
}else{
177178
fileContent="当前用户不存在运行的TaskId: "+taskId;
178179
}

0 commit comments

Comments
 (0)