Skip to content

Commit eafcfc7

Browse files
committed
Merge branch 'dev-1.2.0_k8s' into feature-sprint1
2 parents d79d75c + f4d7f7f commit eafcfc7

File tree

21 files changed

+260
-154
lines changed

21 files changed

+260
-154
lines changed

db/dss_ddl.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,7 @@ CREATE TABLE `dss_orchestrator_release_info` (
12891289

12901290
alter table dss_orchestrator_version_info add context_id varchar(200) DEFAULT NULL COMMENT '上下文ID'
12911291

1292-
1292+
ALTER TABLE dss_onestop_user_favorites ADD COLUMN `type` varchar(20) comment '类型,区分收藏和盯一盯';
12931293

12941294
/**
12951295
* 鲁班产品及文档 dss-guide
@@ -1325,4 +1325,5 @@ CREATE TABLE IF NOT EXISTS `dss_guide_content` (
13251325
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
13261326
`is_delete` tinyint(1) DEFAULT '0' COMMENT '0:未删除(默认), 1已删除',
13271327
PRIMARY KEY (`id`)
1328-
) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='用户向导页面内容详情';
1328+
) ENGINE=INNODB DEFAULT CHARSET=utf8 COMMENT='用户向导页面内容详情';
1329+

db/dss_dml.sql

Lines changed: 29 additions & 8 deletions
Large diffs are not rendered by default.

dss-data-api/dss-data-api-server/src/main/java/com/webank/wedatasphere/dss/data/api/server/entity/ApiAuth.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
import com.baomidou.mybatisplus.annotation.IdType;
44
import com.baomidou.mybatisplus.annotation.TableId;
55
import com.baomidou.mybatisplus.annotation.TableName;
6+
import com.fasterxml.jackson.annotation.JsonFormat;
67
import com.webank.wedatasphere.dss.data.api.server.util.DateJsonDeserializer;
78
import com.webank.wedatasphere.dss.data.api.server.util.DateJsonSerializer;
89
import lombok.Data;
910
import org.codehaus.jackson.map.annotate.JsonDeserialize;
1011
import org.codehaus.jackson.map.annotate.JsonSerialize;
12+
import org.springframework.format.annotation.DateTimeFormat;
1113

1214
import java.io.Serializable;
1315
import java.util.Date;
@@ -27,17 +29,23 @@ public class ApiAuth implements Serializable {
2729
private Long workspaceId;
2830
private String caller;
2931
private String token;
30-
@JsonSerialize(using= DateJsonSerializer.class)
31-
@JsonDeserialize(using= DateJsonDeserializer.class)
32+
// @JsonSerialize(using= DateJsonSerializer.class)
33+
// @JsonDeserialize(using= DateJsonDeserializer.class)
34+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
35+
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
3236
private Date expire;
3337
private Long groupId;
3438

35-
@JsonSerialize(using= DateJsonSerializer.class)
36-
@JsonDeserialize(using= DateJsonDeserializer.class)
39+
// @JsonSerialize(using= DateJsonSerializer.class)
40+
// @JsonDeserialize(using= DateJsonDeserializer.class)
41+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
42+
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
3743
private Date createTime;
3844
private String createBy;
39-
@JsonSerialize(using= DateJsonSerializer.class)
40-
@JsonDeserialize(using= DateJsonDeserializer.class)
45+
// @JsonSerialize(using= DateJsonSerializer.class)
46+
// @JsonDeserialize(using= DateJsonDeserializer.class)
47+
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
48+
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
4149
private Date updateTime;
4250
private String updateBy;
4351
private Integer isDelete;
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.data.api.server.entity;
17+
18+
19+
public class VariableString {
20+
private String path;
21+
22+
public VariableString(String unparsedPath) {
23+
this.path = unparsedPath;
24+
}
25+
26+
public String getPath() {
27+
return path;
28+
}
29+
30+
public void setPath(String path) {
31+
this.path = path;
32+
}
33+
}

dss-data-api/dss-data-api-server/src/main/java/com/webank/wedatasphere/dss/data/api/server/restful/DSSDbApiConfigRestful.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import com.webank.wedatasphere.dss.data.api.server.entity.ApiConfig;
2222
import com.webank.wedatasphere.dss.data.api.server.entity.ApiGroup;
23+
import com.webank.wedatasphere.dss.data.api.server.entity.VariableString;
2324
import com.webank.wedatasphere.dss.data.api.server.entity.response.ApiExecuteInfo;
2425
import com.webank.wedatasphere.dss.data.api.server.entity.response.ApiGroupInfo;
2526
import com.webank.wedatasphere.dss.data.api.server.exception.DataApiException;
@@ -113,11 +114,12 @@ public Message getApiDetail(@RequestParam("apiId") int apiId) {
113114
* @param map
114115
* @return
115116
*/
116-
@RequestMapping(path ="/test/{path:[a-zA-Z0-9_/]+}", method = RequestMethod.POST)
117-
public Message testApi(@Context HttpServletRequest request, @PathVariable("path") String path, Map<String, Object> map) {
117+
118+
@RequestMapping(value ="/test/{path:[a-zA-Z0-9_-]+}", method = RequestMethod.POST)
119+
public Message testApi(@Context HttpServletRequest request, @PathVariable("path") VariableString path, @RequestBody Map<String, Object> map) {
118120

119121
try {
120-
ApiExecuteInfo resJo = apiConfigService.apiTest(path, request, map,true);
122+
ApiExecuteInfo resJo = apiConfigService.apiTest(path.getPath(), request, map,true);
121123
Message message = Message.ok().data("response", resJo);
122124
return message;
123125
} catch (Exception exception) {
@@ -136,10 +138,10 @@ public Message testApi(@Context HttpServletRequest request, @PathVariable("path"
136138
* @return
137139
*/
138140

139-
@RequestMapping(path ="/execute/{path:[a-zA-Z0-9_/]+}", method = RequestMethod.POST)
140-
public Message executeApi(@Context HttpServletRequest request, @PathVariable("path") String path, Map<String, Object> map) {
141+
@RequestMapping(value ="/execute/{path:[a-zA-Z0-9_-]+}", method = RequestMethod.POST)
142+
public Message executeApi(@Context HttpServletRequest request, @PathVariable("path") VariableString path, @RequestBody Map<String, Object> map) {
141143
try {
142-
ApiExecuteInfo resJo = apiConfigService.apiExecute(path, request, map);
144+
ApiExecuteInfo resJo = apiConfigService.apiExecute(path.getPath(), request, map);
143145
Message message = Message.ok().data("response", resJo);
144146
return message;
145147
} catch (Exception exception) {

dss-data-api/dss-data-api-server/src/main/java/com/webank/wedatasphere/dss/data/api/server/restful/DSSDbApiMonitorRestful.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@
1010
import org.springframework.beans.factory.annotation.Autowired;
1111
import org.springframework.web.bind.annotation.RequestMapping;
1212
import org.springframework.web.bind.annotation.RequestMethod;
13+
import org.springframework.web.bind.annotation.RequestParam;
1314
import org.springframework.web.bind.annotation.RestController;
1415

1516
import javax.servlet.http.HttpServletRequest;
1617
import javax.ws.rs.BeanParam;
17-
import javax.ws.rs.QueryParam;
1818
import javax.ws.rs.core.Context;
1919
import java.util.ArrayList;
2020
import java.util.List;
@@ -37,8 +37,8 @@ public class DSSDbApiMonitorRestful {
3737
@RequestMapping(path = "list", method = RequestMethod.GET)
3838

3939
public Message getApiList(@Context HttpServletRequest request,
40-
@QueryParam("workspaceId") Long workspaceId, @QueryParam("apiName") String apiName,
41-
@QueryParam("pageNow") Integer pageNow, @QueryParam("pageSize") Integer pageSize){
40+
@RequestParam("workspaceId") Long workspaceId, @RequestParam(value = "apiName",required = false) String apiName,
41+
@RequestParam("pageNow") Integer pageNow, @RequestParam("pageSize") Integer pageSize){
4242
if(pageNow == null){
4343
pageNow = 1;
4444
}
@@ -54,13 +54,13 @@ public Message getApiList(@Context HttpServletRequest request,
5454

5555
@RequestMapping(path = "onlineApiCnt", method = RequestMethod.GET)
5656

57-
public Message getOnlineApiCnt(@QueryParam("workspaceId") Long workspaceId){
57+
public Message getOnlineApiCnt(@RequestParam("workspaceId") Long workspaceId){
5858
return Message.ok().data("onlineApiCnt",apiMonitorService.getOnlineApiCnt(workspaceId));
5959
}
6060

6161

6262
@RequestMapping(path = "offlineApiCnt", method = RequestMethod.GET)
63-
public Message getOfflineApiCnt(@QueryParam("workspaceId") Long workspaceId){
63+
public Message getOfflineApiCnt(@RequestParam("workspaceId") Long workspaceId){
6464
return Message.ok().data("offlineApiCnt",apiMonitorService.getOfflineApiCnt(workspaceId));
6565
}
6666

@@ -94,7 +94,7 @@ public Message getCallListByFailRate(@BeanParam CallMonitorResquest callMonitorR
9494
*/
9595

9696
@RequestMapping(path = "callCntForPast24H", method = RequestMethod.GET)
97-
public Message getCallCntForPast24H(@QueryParam("workspaceId") Long workspaceId) throws Exception {
97+
public Message getCallCntForPast24H(@RequestParam("workspaceId") Long workspaceId) throws Exception {
9898
return Message.ok().data("list",apiMonitorService.getCallCntForPast24H(workspaceId));
9999
}
100100

dss-data-governance/dss-data-asset-server/src/main/java/com/webank/wedatasphere/dss/data/asset/service/impl/AssetServiceImpl.java

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import java.util.HashMap;
3030
import java.util.List;
3131
import java.util.Map;
32+
import java.util.Objects;
3233
import java.util.Set;
3334
import java.util.stream.Collectors;
3435

@@ -77,28 +78,28 @@ public List<HiveTblSimpleInfo> searchHiveTable(String classification, String que
7778
}
7879

7980
if (atlasEntityHeaders != null) {
80-
return atlasEntityHeaders.parallelStream().map(atlasEntityHeader -> {
81+
return atlasEntityHeaders.parallelStream().filter(Objects::nonNull).map(atlasEntityHeader -> {
8182
HiveTblSimpleInfo hiveTblBasic = new HiveTblSimpleInfo();
8283
hiveTblBasic.setGuid(atlasEntityHeader.getGuid());
83-
hiveTblBasic.setName(atlasEntityHeader.getAttribute("name").toString());
84-
hiveTblBasic.setQualifiedName(atlasEntityHeader.getAttribute("qualifiedName").toString());
85-
Object owner =atlasEntityHeader.getAttribute("owner");
86-
if(owner !=null) {
87-
hiveTblBasic.setOwner(owner.toString());
88-
}
84+
hiveTblBasic.setName(stringValueOfObject(atlasEntityHeader.getAttribute("name")));
85+
String qualifiedName =stringValueOfObject(atlasEntityHeader.getAttribute("qualifiedName"));
86+
hiveTblBasic.setQualifiedName(qualifiedName);
87+
hiveTblBasic.setOwner(stringValueOfObject(atlasEntityHeader.getAttribute("owner")));
8988
Object createTime = atlasEntityHeader.getAttribute("createTime");
9089
if (createTime != null) {
9190
hiveTblBasic.setCreateTime(DateUtil.unixToTimeStr((Double) createTime));
9291
}
93-
String dbName = (atlasEntityHeader.getAttribute("qualifiedName").toString().split("\\."))[0];
94-
hiveTblBasic.setDbName(dbName);
92+
if(null != qualifiedName && qualifiedName.split("\\.").length >0){
93+
String dbName = qualifiedName.split("\\.")[0];
94+
hiveTblBasic.setDbName(dbName);
95+
}
9596

9697
try {
9798
AtlasEntity atlasEntity = atlasService.getHiveTblByGuid(atlasEntityHeader.getGuid());
9899
List<HiveTblDetailInfo.HiveClassificationInfo> classificationInfoList = getClassificationInfoList(atlasEntity);
99100
hiveTblBasic.setClassifications(classificationInfoList);
100101
} catch (AtlasServiceException ex) {
101-
throw new DataGovernanceException(ex.getMessage());
102+
logger.error(ex.getMessage());
102103
}
103104

104105
return hiveTblBasic;
@@ -107,6 +108,15 @@ public List<HiveTblSimpleInfo> searchHiveTable(String classification, String que
107108
return null;
108109
}
109110

111+
private String stringValueOfObject(Object obj){
112+
if(null !=obj) {
113+
return obj.toString();
114+
}
115+
else {
116+
return null;
117+
}
118+
}
119+
110120
@Override
111121
public String getHiveTblGuid(String qualifiedName) throws DataGovernanceException{
112122
qualifiedName = qualifiedName + "@" + AtlasConf.ATLAS_CLUSTER_NAME.getValue();

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/bean/DSSFavorite.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class DSSFavorite extends BaseEntity{
2727
private Long menuApplicationId;
2828

2929
private Integer order;
30-
30+
private String type;
3131
public Long getId() {
3232
return id;
3333
}
@@ -67,4 +67,11 @@ public Integer getOrder() {
6767
public void setOrder(Integer order) {
6868
this.order = order;
6969
}
70+
public String getType() {
71+
return type;
72+
}
73+
74+
public void setType(String type) {
75+
this.type = type;
76+
}
7077
}

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/WorkspaceMapper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ public interface WorkspaceMapper {
5959
List<OnestopMenuAppInstanceVo> getMenuAppInstancesCn(Long id);
6060
List<OnestopMenuAppInstanceVo> getMenuAppInstancesEn(Long id);
6161

62-
List<WorkspaceFavoriteVo> getWorkspaceFavoritesCn(@Param("username") String username, @Param("workspaceId") Long workspaceId);
62+
List<WorkspaceFavoriteVo> getWorkspaceFavoritesCn(@Param("username") String username, @Param("workspaceId") Long workspaceId,@Param("type") String type);
6363

64-
List<WorkspaceFavoriteVo> getWorkspaceFavoritesEn(@Param("username") String username, @Param("workspaceId") Long workspaceId);
64+
List<WorkspaceFavoriteVo> getWorkspaceFavoritesEn(@Param("username") String username, @Param("workspaceId") Long workspaceId,@Param("type") String type);
6565

6666
void addFavorite(DSSFavorite dssFavorite);
6767

68-
void deleteFavorite(@Param("username") String username,@Param("applicationId") Long applicationId, @Param("workspaceId") Long workspaceId);
68+
void deleteFavorite(@Param("username") String username,@Param("applicationId") Long applicationId, @Param("workspaceId") Long workspaceId,@Param("type") String type);
6969

7070
String getDepartName(@Param("id") Long id);
7171
List<DSSWorkspaceUser01> getWorkspaceUsers(@Param("id") Long id);

dss-framework/dss-framework-workspace-server/src/main/java/com/webank/wedatasphere/dss/framework/workspace/dao/impl/WorkspaceMapper.xml

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
</sql>
3535

3636
<sql id="favorite_main">
37-
id,`username`,`workspace_id`,`menu_application_id`,`order`,`create_by`,`create_time`,`last_update_user`,`last_update_time`
37+
id,`username`,`workspace_id`,`menu_application_id`,`order`,`create_by`,`create_time`,`last_update_user`,`last_update_time`,`type`
3838
</sql>
3939

4040
<resultMap id="dss_workspace_user01_map" type="com.webank.wedatasphere.dss.framework.workspace.bean.DSSWorkspaceUser01">
@@ -194,6 +194,13 @@
194194
<where>
195195
dss_onestop_user_favorites.`username` = #{username} and `workspace_id` = #{workspaceId}
196196
or `dss_onestop_user_favorites`.`workspace_id` = -1
197+
<if test="type != null">
198+
AND type = #{type}
199+
</if>
200+
201+
<if test="type = null">
202+
AND type is null
203+
</if>
197204
</where>
198205
</select>
199206

@@ -204,13 +211,20 @@
204211
join dss_application on dss_application.id = dss_onestop_menu_application.application_id
205212
<where>
206213
dss_onestop_user_favorites.`username` = #{username} and `workspace_id` = #{workspaceId}
214+
<if test="type != null">
215+
AND type = #{type}
216+
</if>
217+
218+
<if test="type = null">
219+
AND type is null
220+
</if>
207221
</where>
208222
</select>
209223

210224
<insert id="addFavorite" useGeneratedKeys="true" keyProperty="id" parameterType="com.webank.wedatasphere.dss.framework.workspace.bean.DSSFavorite">
211225
INSERT INTO dss_onestop_user_favorites (<include refid = "favorite_main" />)
212226
VALUES
213-
(#{id},#{username},#{workspaceId},#{menuApplicationId},#{order},#{createBy},#{createTime},#{lastUpdateUser},#{lastUpdateTime})
227+
(#{id},#{username},#{workspaceId},#{menuApplicationId},#{order},#{createBy},#{createTime},#{lastUpdateUser},#{lastUpdateTime},#{type})
214228
</insert>
215229

216230
<delete id="deleteFavorite">
@@ -221,6 +235,14 @@
221235
menu_application_id = #{applicationId}
222236
AND username = #{username}
223237
AND workspace_id = #{workspaceId}
238+
<if test="type != null">
239+
AND type = #{type}
240+
</if>
241+
242+
<if test="type = null">
243+
AND type is null
244+
</if>
245+
224246
</delete>
225247

226248

0 commit comments

Comments
 (0)