diff --git a/dss-commons/dss-common/src/main/java/com/webank/wedatasphere/dss/common/auditlog/TargetTypeEnum.java b/dss-commons/dss-common/src/main/java/com/webank/wedatasphere/dss/common/auditlog/TargetTypeEnum.java index 678bfc3e0b..7710aca4c4 100644 --- a/dss-commons/dss-common/src/main/java/com/webank/wedatasphere/dss/common/auditlog/TargetTypeEnum.java +++ b/dss-commons/dss-common/src/main/java/com/webank/wedatasphere/dss/common/auditlog/TargetTypeEnum.java @@ -69,6 +69,10 @@ public enum TargetTypeEnum { * 工作流引用默认模板 */ DSS_EC_CONFIG_TEMPLATE_WORKFLOW("dss_ec_config_template_workflow"), + + + DSS_WORKSPACE_DEFAULT_TEMPLATE("dss_workspace_default_template"), + ; private String name; diff --git a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/DSSWorkspace.java b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/DSSWorkspace.java index f0c45a994a..de39a5efa6 100644 --- a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/DSSWorkspace.java +++ b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/DSSWorkspace.java @@ -33,9 +33,9 @@ public class DSSWorkspace { private String lastUpdateUser; private String workspaceType; private int adminPermission; - private Boolean enabledFlowKeywordsCheck; + private String enabledFlowKeywordsCheck; - private Boolean isDefaultReference; + private String isDefaultReference; public int getAdminPermission() { return adminPermission; @@ -141,19 +141,20 @@ public void setLastUpdateUser(String lastUpdateUser) { this.lastUpdateUser = lastUpdateUser; } - public Boolean getEnabledFlowKeywordsCheck() { + + public String getEnabledFlowKeywordsCheck() { return enabledFlowKeywordsCheck; } - public void setEnabledFlowKeywordsCheck(Boolean enabledFlowKeywordsCheck) { + public void setEnabledFlowKeywordsCheck(String enabledFlowKeywordsCheck) { this.enabledFlowKeywordsCheck = enabledFlowKeywordsCheck; } - public Boolean getDefaultReference() { + public String getIsDefaultReference() { return isDefaultReference; } - public void setDefaultReference(Boolean defaultReference) { - isDefaultReference = defaultReference; + public void setIsDefaultReference(String isDefaultReference) { + this.isDefaultReference = isDefaultReference; } } diff --git a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceMapper.java b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceMapper.java index 1f16ce9d6e..256d427714 100644 --- a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceMapper.java +++ b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/DSSWorkspaceMapper.java @@ -83,4 +83,6 @@ void updateDepartmentsForWorkspace(@Param("workspaceId") Long workspaceId, @Para void updateWorkSpace(DSSWorkspace dssWorkspace); + + void updateWorkspaceInfo(DSSWorkspace dssWorkspace); } diff --git a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/impl/DSSWorkspaceMapper.xml b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/impl/DSSWorkspaceMapper.xml index f1e74cedfa..86b3e90b90 100644 --- a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/impl/DSSWorkspaceMapper.xml +++ b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/impl/DSSWorkspaceMapper.xml @@ -81,4 +81,10 @@ where id = #{id} + + update dss_workspace set enabled_flow_keywords_check = #{enabledFlowKeywordsCheck}, + is_default_reference = #{isDefaultReference} + where id = #{id} + + \ No newline at end of file diff --git a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspaceRestful.java b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspaceRestful.java index 5434c2ee2f..14cf710324 100644 --- a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspaceRestful.java +++ b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/restful/DSSWorkspaceRestful.java @@ -474,5 +474,35 @@ public Message deleteFavorite(@PathVariable("workspaceId") Long workspaceId, @Pa OperateTypeEnum.REM_FROM_FAVORITES, json); return Message.ok().data("favoriteId", favoriteId); } + + + @RequestMapping(value = "/updateWorkspaceInfo",method = RequestMethod.POST) + public Message updateWorkspaceInfo(@RequestBody Map json) throws DSSErrorException{ + + Workspace workspace = SSOHelper.getWorkspace(httpServletRequest); + String username = SecurityFilter.getLoginUsername(httpServletRequest); + + String workspaceId= json.getOrDefault("workspaceId",String.valueOf(workspace.getWorkspaceId())); + + if(!workspaceId.equals(String.valueOf(workspace.getWorkspaceId()))){ + throw new DSSErrorException(90053,"当前工作空间与cookie中的不一致,重新刷新页面后在操作"); + } + + String enabledFlowKeywordsCheck = json.getOrDefault("enabledFlowKeywordsCheck","0"); + String isDefaultReference = json.getOrDefault("isDefaultReference","0"); + + DSSWorkspace dssWorkspace = new DSSWorkspace(); + dssWorkspace.setId(Integer.parseInt(workspaceId)); + dssWorkspace.setEnabledFlowKeywordsCheck(enabledFlowKeywordsCheck); + dssWorkspace.setIsDefaultReference(isDefaultReference); + + dssWorkspaceService.updateWorkspaceInfo(dssWorkspace); + + AuditLogUtils.printLog(username, workspaceId, workspace.getWorkspaceName(), TargetTypeEnum.WORKSPACE, workspaceId, workspace.getWorkspaceName(), + OperateTypeEnum.UPDATE, json); + + return Message.ok().data("workspaceId", workspaceId); + + } } diff --git a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/DSSWorkspaceService.java b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/DSSWorkspaceService.java index 9407d265e1..bf8331ae68 100644 --- a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/DSSWorkspaceService.java +++ b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/DSSWorkspaceService.java @@ -119,4 +119,6 @@ List getWorkspaceAppConns(Workspace workspace, Long workspaceId int transferWorkspace(String workspaceName,String oldOwner,String newOwner,String desc) throws DSSErrorException; boolean checkUserIfSettingAdmin(String username); + + void updateWorkspaceInfo(DSSWorkspace dssWorkspace); } diff --git a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/impl/DSSWorkspaceServiceImpl.java b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/impl/DSSWorkspaceServiceImpl.java index 252503713a..976e9fe9b9 100644 --- a/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/impl/DSSWorkspaceServiceImpl.java +++ b/dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/service/impl/DSSWorkspaceServiceImpl.java @@ -795,4 +795,10 @@ private void joinWorkspaceForNewUser(String userName, Long userId, int workspace }); }); } + + + @Override + public void updateWorkspaceInfo(DSSWorkspace dssWorkspace){ + dssWorkspaceMapper.updateWorkspaceInfo(dssWorkspace); + } }