Skip to content

Commit 306a0ff

Browse files
authored
Merge pull request #194 from Tangjiafeng/master
add new feature
2 parents c684777 + 42e4582 commit 306a0ff

File tree

574 files changed

+35910
-5439
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

574 files changed

+35910
-5439
lines changed

web/scheduler/src/main/java/com/webank/wedatasphere/qualitis/dao/AuthListDao.java renamed to core/analysis/src/main/java/com/webank/wedatasphere/qualitis/dao/FieldsAnalyseDao.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,20 @@
1616

1717
package com.webank.wedatasphere.qualitis.dao;
1818

19-
import com.webank.wedatasphere.qualitis.entity.AuthList;
20-
import com.webank.wedatasphere.qualitis.entity.AuthList;
19+
import com.webank.wedatasphere.qualitis.entity.FieldsAnalyse;
20+
21+
import java.util.List;
2122

2223
/**
23-
* @author howeye
24+
* @author v_wenxuanzhang
2425
*/
25-
public interface AuthListDao {
26+
public interface FieldsAnalyseDao {
2627

2728
/**
28-
* Find auth list by appId
29-
* @param appId
29+
* Find all by application ID list
30+
* @param ruleIdList
31+
* @param dataDateList
3032
* @return
3133
*/
32-
AuthList findByAppId(String appId);
33-
34+
List< FieldsAnalyse > findByRuleIdInAndDataDateIn(List< Long > ruleIdList, List< Integer > dataDateList);
3435
}

core/analysis/src/main/java/com/webank/wedatasphere/qualitis/dao/TaskResultDao.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,11 @@ public interface TaskResultDao {
152152
* @return
153153
*/
154154
List<TaskResult> findByApplicationId(String applicationId);
155+
156+
/**
157+
* Find all by application ID list
158+
* @param applicationIdList
159+
* @return
160+
*/
161+
List< TaskResult> findByApplicationIdIn(List< String> applicationIdList);
155162
}

web/scheduler/src/main/java/com/webank/wedatasphere/qualitis/dao/impl/AuthListDaoImpl.java renamed to core/analysis/src/main/java/com/webank/wedatasphere/qualitis/dao/impl/FieldsAnalyseDaoImpl.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,25 @@
1616

1717
package com.webank.wedatasphere.qualitis.dao.impl;
1818

19-
import com.webank.wedatasphere.qualitis.dao.AuthListDao;
20-
import com.webank.wedatasphere.qualitis.dao.repository.AuthListRepository;
21-
import com.webank.wedatasphere.qualitis.entity.AuthList;
19+
import com.webank.wedatasphere.qualitis.dao.FieldsAnalyseDao;
20+
import com.webank.wedatasphere.qualitis.dao.repository.FieldsAnalyseRepository;
21+
import com.webank.wedatasphere.qualitis.entity.FieldsAnalyse;
2222
import org.springframework.beans.factory.annotation.Autowired;
2323
import org.springframework.stereotype.Repository;
2424

25+
import java.util.List;
26+
2527
/**
26-
* @author howeye
28+
* @author v_wenxuanzhang
2729
*/
2830
@Repository
29-
public class AuthListDaoImpl implements AuthListDao {
31+
public class FieldsAnalyseDaoImpl implements FieldsAnalyseDao {
3032

3133
@Autowired
32-
private AuthListRepository authListRepository;
34+
private FieldsAnalyseRepository fieldsAnalyseRepository;
3335

3436
@Override
35-
public AuthList findByAppId(String appId) {
36-
return authListRepository.findByAppId(appId);
37+
public List< FieldsAnalyse > findByRuleIdInAndDataDateIn(List< Long > ruleIdList, List< Integer > dataDateList) {
38+
return fieldsAnalyseRepository.findByRuleIdInAndDataDateIn(ruleIdList, dataDateList);
3739
}
3840
}

core/analysis/src/main/java/com/webank/wedatasphere/qualitis/dao/impl/TaskResultDaoImpl.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,4 +110,8 @@ public List<TaskResult> findByApplicationId(String applicationId) {
110110
return resultRepository.findByApplicationId(applicationId);
111111
}
112112

113+
@Override
114+
public List<TaskResult> findByApplicationIdIn(List< String> applicationIdList) {
115+
return resultRepository.findByApplicationIdIn(applicationIdList);
116+
}
113117
}

web/scheduler/src/main/java/com/webank/wedatasphere/qualitis/dao/repository/AuthListRepository.java renamed to core/analysis/src/main/java/com/webank/wedatasphere/qualitis/dao/repository/FieldsAnalyseRepository.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@
1616

1717
package com.webank.wedatasphere.qualitis.dao.repository;
1818

19-
import com.webank.wedatasphere.qualitis.entity.AuthList;
20-
import com.webank.wedatasphere.qualitis.entity.AuthList;
19+
import com.webank.wedatasphere.qualitis.entity.FieldsAnalyse;
2120
import org.springframework.data.jpa.repository.JpaRepository;
2221

22+
import java.util.List;
23+
2324
/**
24-
* @author howeye
25+
* @author v_wenxuanzhang
2526
*/
26-
public interface AuthListRepository extends JpaRepository<AuthList, String> {
27+
public interface FieldsAnalyseRepository extends JpaRepository< FieldsAnalyse, Long > {
2728

2829
/**
29-
* Find auth list by appId
30-
* @param appId
30+
* Find all by application ID list
31+
* @param ruleIdList
32+
* @param dataDateList
3133
* @return
3234
*/
33-
AuthList findByAppId(String appId);
34-
35+
List< FieldsAnalyse > findByRuleIdInAndDataDateIn(List< Long > ruleIdList, List< Integer > dataDateList);
3536
}

core/analysis/src/main/java/com/webank/wedatasphere/qualitis/dao/repository/TaskResultRepository.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
5252
* @param applicationId
5353
* @return
5454
*/
55-
@Query("select avg(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (t.ruleMetricId = ?4) and t.applicationId != ?5 and t.saveResult = 1")
55+
@Query("select avg(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (?4 IS NULL OR t.ruleMetricId = ?4) and t.applicationId != ?5 and t.saveResult = 1")
5656
Double findAvgByCreateTimeBetweenAndRuleAndMetricAndApplication(String begin, String end, Long ruleId, Long ruleMetricId, String applicationId);
5757

5858

@@ -65,7 +65,7 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
6565
* @param applicationId
6666
* @return
6767
*/
68-
@Query("select count(t.id) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (t.ruleMetricId = ?4) and t.applicationId != ?5 and t.saveResult = 1")
68+
@Query("select count(t.id) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (?4 IS NULL OR t.ruleMetricId = ?4) and t.applicationId != ?5 and t.saveResult = 1")
6969
long countByCreateTimeBetweenAndRuleAndMetricAndApplication(String begin, String end, Long ruleId, Long ruleMetricId, String applicationId);
7070

7171
/**
@@ -76,7 +76,7 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
7676
* @param ruleMetricId
7777
* @return
7878
*/
79-
@Query("select avg(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (t.ruleMetricId = ?4) and t.saveResult = 1")
79+
@Query("select avg(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (?4 IS NULL OR t.ruleMetricId = ?4) and t.saveResult = 1")
8080
Double findAvgByCreateTimeBetweenAndRuleAndRuleMetric(String begin, String end, Long ruleId, Long ruleMetricId);
8181

8282
/**
@@ -88,7 +88,7 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
8888
* @param applicationId
8989
* @return
9090
*/
91-
@Query("select count(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (t.ruleMetricId = ?4) and t.applicationId != ?5 and t.saveResult = 1")
91+
@Query("select count(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (?4 IS NULL OR t.ruleMetricId = ?4) and t.applicationId != ?5 and t.saveResult = 1")
9292
long countByCreateTimeBetweenAndRuleAndRuleMetric(String start, String end, Long ruleId, Long ruleMetricId, String applicationId);
9393

9494
/**
@@ -138,7 +138,7 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
138138
* @param ruleMetricId
139139
* @return
140140
*/
141-
@Query(value = "SELECT tr from TaskResult tr where tr.applicationId = ?1 and tr.ruleId = ?2 and tr.ruleMetricId = ?3")
141+
@Query(value = "SELECT tr from TaskResult tr where tr.applicationId = ?1 and tr.ruleId = ?2 and (?3 IS NULL OR tr.ruleMetricId = ?3)")
142142
TaskResult findValue(String applicationId, Long ruleId, Long ruleMetricId);
143143

144144
/**
@@ -158,4 +158,11 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
158158
*/
159159
@Query(value = "SELECT tr from TaskResult tr where tr.applicationId = ?1")
160160
List<TaskResult> findByApplicationId(String applicationId);
161+
162+
/**
163+
* Find all by application ID list
164+
* @param applicationIdList
165+
* @return
166+
*/
167+
List<TaskResult> findByApplicationIdIn(List<String> applicationIdList);
161168
}
Lines changed: 180 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,180 @@
1+
/*
2+
* Copyright 2019 WeBank
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.webank.wedatasphere.qualitis.entity;
18+
19+
import javax.persistence.*;
20+
import java.math.BigDecimal;
21+
import java.util.Date;
22+
23+
/**
24+
* @author v_wenxuanzhang
25+
*/
26+
@Entity
27+
@Table(name = "qualitis_imsmetric_fields_analyse")
28+
@IdClass(FieldsAnalysePrimaryKey.class)
29+
public class FieldsAnalyse {
30+
31+
@Id
32+
@Column(name = "rule_id")
33+
private Long ruleId;
34+
35+
@Id
36+
@Column(name = "data_date")
37+
private Integer dataDate;
38+
39+
@Column(name = "analyse_type", columnDefinition = "TINYINT(5)")
40+
private Integer analyseType;
41+
42+
@Column(name = "datasource_type", columnDefinition = "TINYINT(5)")
43+
private Integer datasourceType;
44+
45+
@Column(name = "database_name")
46+
private String databaseName;
47+
48+
@Column(name = "table_name")
49+
private String tableName;
50+
51+
@Column(name = "field_name")
52+
private String fieldName;
53+
54+
@Column(name = "value")
55+
private BigDecimal value;
56+
57+
@Column(name = "partition_attrs")
58+
private String partitionAttrs;
59+
60+
@Column(name = "create_time")
61+
private Date createTime;
62+
63+
@Column(name = "update_time")
64+
private Date updateTime;
65+
66+
@Column(name = "datasource_user")
67+
private String datasourceUser;
68+
69+
@Column(name = "remark")
70+
private String remark;
71+
72+
73+
public FieldsAnalyse() {
74+
// Default Constructor
75+
}
76+
77+
public Long getRuleId() {
78+
return ruleId;
79+
}
80+
81+
public void setRuleId(Long ruleId) {
82+
this.ruleId = ruleId;
83+
}
84+
85+
public Integer getDataDate() {
86+
return dataDate;
87+
}
88+
89+
public void setDataDate(Integer dataDate) {
90+
this.dataDate = dataDate;
91+
}
92+
93+
public Integer getAnalyseType() {
94+
return analyseType;
95+
}
96+
97+
public void setAnalyseType(Integer analyseType) {
98+
this.analyseType = analyseType;
99+
}
100+
101+
public Integer getDatasourceType() {
102+
return datasourceType;
103+
}
104+
105+
public void setDatasourceType(Integer datasourceType) {
106+
this.datasourceType = datasourceType;
107+
}
108+
109+
public String getDatabaseName() {
110+
return databaseName;
111+
}
112+
113+
public void setDatabaseName(String databaseName) {
114+
this.databaseName = databaseName;
115+
}
116+
117+
public String getTableName() {
118+
return tableName;
119+
}
120+
121+
public void setTableName(String tableName) {
122+
this.tableName = tableName;
123+
}
124+
125+
public String getFieldName() {
126+
return fieldName;
127+
}
128+
129+
public void setFieldName(String fieldName) {
130+
this.fieldName = fieldName;
131+
}
132+
133+
public BigDecimal getValue() {
134+
return value;
135+
}
136+
137+
public void setValue(BigDecimal value) {
138+
this.value = value;
139+
}
140+
141+
public String getPartitionAttrs() {
142+
return partitionAttrs;
143+
}
144+
145+
public void setPartitionAttrs(String partitionAttrs) {
146+
this.partitionAttrs = partitionAttrs;
147+
}
148+
149+
public Date getCreateTime() {
150+
return createTime;
151+
}
152+
153+
public void setCreateTime(Date createTime) {
154+
this.createTime = createTime;
155+
}
156+
157+
public Date getUpdateTime() {
158+
return updateTime;
159+
}
160+
161+
public void setUpdateTime(Date updateTime) {
162+
this.updateTime = updateTime;
163+
}
164+
165+
public String getDatasourceUser() {
166+
return datasourceUser;
167+
}
168+
169+
public void setDatasourceUser(String datasourceUser) {
170+
this.datasourceUser = datasourceUser;
171+
}
172+
173+
public String getRemark() {
174+
return remark;
175+
}
176+
177+
public void setRemark(String remark) {
178+
this.remark = remark;
179+
}
180+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package com.webank.wedatasphere.qualitis.entity;
2+
3+
import java.io.Serializable;
4+
import java.util.Objects;
5+
6+
/**
7+
* @author v_wenxuanzhang
8+
*/
9+
public class FieldsAnalysePrimaryKey implements Serializable {
10+
private Long ruleId;
11+
private Integer dataDate;
12+
13+
@Override
14+
public boolean equals(Object o) {
15+
if (this == o) return true;
16+
if (o == null || getClass() != o.getClass()) return false;
17+
FieldsAnalysePrimaryKey that = (FieldsAnalysePrimaryKey) o;
18+
return ruleId.equals(that.ruleId) &&
19+
dataDate.equals(that.dataDate);
20+
}
21+
22+
@Override
23+
public int hashCode() {
24+
return Objects.hash(ruleId, dataDate);
25+
}
26+
27+
public Long getMetricId() {
28+
return ruleId;
29+
}
30+
31+
public void setMetricId(Long metricId) {
32+
this.ruleId = metricId;
33+
}
34+
35+
public Integer getDs() {
36+
return dataDate;
37+
}
38+
39+
public void setDs(Integer ds) {
40+
this.dataDate = ds;
41+
}
42+
}

0 commit comments

Comments
 (0)