Skip to content

Commit 588ca20

Browse files
committed
fix bug #448
1 parent b79accd commit 588ca20

File tree

5 files changed

+109
-10
lines changed

5 files changed

+109
-10
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright 2019 WeBank
3+
* Licensed under the Apache License, Version 2.0 (the "License");
4+
* you may not use this file except in compliance with the License.
5+
* You may obtain a copy of the License at
6+
*
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
*
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
*
15+
*/
16+
package com.webank.wedatasphere.dss.apiservice.core.bo;
17+
18+
public class ApiCommentUpdateRequest {
19+
private Long id;
20+
private String comment;
21+
22+
public Long getId() {
23+
return id;
24+
}
25+
26+
public void setId(Long id) {
27+
this.id = id;
28+
}
29+
30+
public String getComment() {
31+
return comment;
32+
}
33+
34+
public void setComment(String comment) {
35+
this.comment = comment;
36+
}
37+
}

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.webank.wedatasphere.dss.apiservice.core.restful;
1818

19+
import com.webank.wedatasphere.dss.apiservice.core.bo.ApiCommentUpdateRequest;
1920
import com.webank.wedatasphere.dss.apiservice.core.bo.ApiServiceQuery;
2021
import com.webank.wedatasphere.dss.apiservice.core.service.ApiService;
2122
import com.webank.wedatasphere.dss.apiservice.core.service.ApiServiceQueryService;
@@ -455,8 +456,9 @@ public Message apiDelete(@RequestParam(required = false, name = "id") Long id,
455456

456457
@RequestMapping(value = "/apiCommentUpdate",method = RequestMethod.POST)
457458
public Message apiCommentUpdate(@Context HttpServletRequest req,
458-
@RequestParam(required = false, name = "id") Long id,
459-
@RequestParam(required = false, name = "comment") String comment) {
459+
@RequestBody ApiCommentUpdateRequest apiCommentUpdateRequest) {
460+
Long id = apiCommentUpdateRequest.getId();
461+
String comment = apiCommentUpdateRequest.getComment();
460462
//目前暂时不实际删除数据,只做不可见和不可用。
461463
return ApiUtils.doAndResponse(() -> {
462464
String userName = SecurityFilter.getLoginUsername(req);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.webank.wedatasphere.dss.framework.workspace.bean.request;
2+
3+
import java.io.Serializable;
4+
5+
public class AddFavoriteRequest implements Serializable {
6+
private Long menuApplicationId;
7+
8+
public Long getMenuApplicationId() {
9+
return menuApplicationId;
10+
}
11+
12+
public void setMenuApplicationId(Long menuApplicationId) {
13+
this.menuApplicationId = menuApplicationId;
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.webank.wedatasphere.dss.framework.workspace.bean.request;
2+
3+
import java.io.Serializable;
4+
5+
public class AddWorkspaceRequest implements Serializable {
6+
private String name;
7+
private String department;
8+
private String label;
9+
private String description;
10+
11+
public String getName() {
12+
return name;
13+
}
14+
15+
public void setName(String name) {
16+
this.name = name;
17+
}
18+
19+
public String getDepartment() {
20+
return department;
21+
}
22+
23+
public void setDepartment(String department) {
24+
this.department = department;
25+
}
26+
27+
public String getLabel() {
28+
return label;
29+
}
30+
31+
public void setLabel(String label) {
32+
this.label = label;
33+
}
34+
35+
public String getDescription() {
36+
return description;
37+
}
38+
39+
public void setDescription(String description) {
40+
this.description = description;
41+
}
42+
}

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/WorkspaceRestfulApi.java

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import com.webank.wedatasphere.dss.framework.workspace.bean.dto.response.HomepageVideoVo;
2222
import com.webank.wedatasphere.dss.framework.workspace.bean.dto.response.OnestopMenuVo;
2323
import com.webank.wedatasphere.dss.framework.workspace.bean.dto.response.WorkspaceFavoriteVo;
24+
import com.webank.wedatasphere.dss.framework.workspace.bean.request.AddFavoriteRequest;
25+
import com.webank.wedatasphere.dss.framework.workspace.bean.request.AddWorkspaceRequest;
2426
import com.webank.wedatasphere.dss.framework.workspace.bean.vo.DepartmentVO;
2527
import com.webank.wedatasphere.dss.framework.workspace.service.DSSWorkspaceService;
2628
import org.apache.linkis.common.exception.ErrorException;
@@ -70,14 +72,15 @@ public Message getUsernameExistence(@Context HttpServletRequest req, @RequestPar
7072
return Message.ok().data("workspaceNameExists", exists);
7173
}
7274

73-
@RequestMapping(path ="/workspaces", method = RequestMethod.POST)
75+
@RequestMapping(path = "/workspaces", method = RequestMethod.POST)
7476
public Message addWorkspace(@Context HttpServletRequest req,
75-
@RequestParam(required = false, name = "name")String name ,
76-
@RequestParam(required = false, name = "department") String department,
77-
@RequestParam(required = false, name = "label") String label,
78-
@RequestParam(required = false, name = "description") String description) throws ErrorException {
77+
@RequestBody AddWorkspaceRequest addWorkspaceRequest) throws ErrorException {
78+
String name = addWorkspaceRequest.getName();
79+
String department = addWorkspaceRequest.getDepartment();
80+
String label = addWorkspaceRequest.getLabel();
81+
String description = addWorkspaceRequest.getDescription();
7982
String userName = SecurityFilter.getLoginUsername(req);
80-
if (!dssWorkspaceService.checkAdmin(userName)){
83+
if (!dssWorkspaceService.checkAdmin(userName)) {
8184
return Message.error("您好,您不是管理员,没有权限建立工作空间");
8285
}
8386
if (dssWorkspaceService.existWorkspaceName(name)) {
@@ -140,9 +143,9 @@ public Message getWorkspaceFavorites(@Context HttpServletRequest req, @PathVaria
140143
*/
141144
@RequestMapping(path ="/workspaces/{workspaceId}/favorites", method = RequestMethod.POST)
142145
public Message addFavorite(@Context HttpServletRequest req, @PathVariable("workspaceId") Long workspaceId,
143-
@RequestParam(required = false, name = "menuApplicationId") Long menuApplicationId) {
146+
@RequestBody AddFavoriteRequest addFavoriteRequest) {
144147
String username = SecurityFilter.getLoginUsername(req);
145-
Long favoriteId = dssWorkspaceService.addFavorite(username, workspaceId, menuApplicationId);
148+
Long favoriteId = dssWorkspaceService.addFavorite(username, workspaceId, addFavoriteRequest.getMenuApplicationId());
146149
return Message.ok().data("favoriteId", favoriteId);
147150
}
148151

0 commit comments

Comments
 (0)