Skip to content

Commit e249ef0

Browse files
authored
Merge pull request #82 from Tangjiafeng/branch-0.9.0
Branch 0.9.0
2 parents d5d34b1 + ded3d02 commit e249ef0

File tree

572 files changed

+42954
-5464
lines changed

Some content is hidden

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

572 files changed

+42954
-5464
lines changed

build.gradle

+22-14
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ buildscript {
3636
url "http://maven.aliyun.com/nexus/content/groups/public/"
3737
}
3838
}
39+
40+
dependencies {
41+
classpath 'net.sf.proguard:proguard-gradle:6.2.0'
42+
classpath 'org.springframework.boot:spring-boot-gradle-plugin:1.5.15.RELEASE'
43+
}
3944
}
4045

4146
dependencies {
@@ -91,7 +96,7 @@ distributions {
9196
fileMode = 0755
9297
}
9398
into { "doc" } {
94-
from "web/app/src/main/doc"
99+
from "docs"
95100
dirMode = 0755
96101
fileMode = 0644
97102
}
@@ -130,20 +135,23 @@ subprojects {
130135

131136
configurations.all {
132137
resolutionStrategy {
133-
force 'org.springframework:spring-aop:5.1.15.RELEASE'
134-
force 'org.springframework:spring-aspects:5.1.15.RELEASE'
135-
force 'org.springframework:spring-beans:5.1.15.RELEASE'
136-
force 'org.springframework:spring-context:5.1.15.RELEASE'
137-
force 'org.springframework:spring-core:5.1.15.RELEASE'
138-
force 'org.springframework:spring-expressions:5.1.15.RELEASE'
139-
force 'org.springframework:spring-jcl:5.1.15.RELEASE'
140-
force 'org.springframework:spring-jdbc:5.1.15.RELEASE'
141-
force 'org.springframework:spring-orm:5.1.15.RELEASE'
142-
force 'org.springframework:spring-test:5.1.15.RELEASE'
143-
force 'org.springframework:spring-tx:5.1.15.RELEASE'
144-
force 'org.springframework:spring-web:5.1.15.RELEASE'
145-
force 'org.springframework:spring-webmvc:5.1.15.RELEASE'
138+
force 'org.springframework:spring-aop:5.1.18.RELEASE'
139+
force 'org.springframework:spring-aspects:5.1.18.RELEASE'
140+
force 'org.springframework:spring-beans:5.1.18.RELEASE'
141+
force 'org.springframework:spring-context:5.1.18.RELEASE'
142+
force 'org.springframework:spring-core:5.1.18.RELEASE'
143+
force 'org.springframework:spring-expressions:5.1.18.RELEASE'
144+
force 'org.springframework:spring-jcl:5.1.18.RELEASE'
145+
force 'org.springframework:spring-jdbc:5.1.18.RELEASE'
146+
force 'org.springframework:spring-orm:5.1.18.RELEASE'
147+
force 'org.springframework:spring-test:5.1.18.RELEASE'
148+
force 'org.springframework:spring-tx:5.1.18.RELEASE'
149+
force 'org.springframework:spring-web:5.1.18.RELEASE'
150+
force 'org.springframework:spring-webmvc:5.1.18.RELEASE'
151+
force 'org.apache.logging.log4j:log4j-slf4j-impl:2.16.0'
146152
}
153+
exclude group: 'log4j', module: 'log4j'
154+
exclude group: 'org.codehaus.jackson', module: 'jackson-mapper-asl'
147155
}
148156

149157
apply from: "profile.gradle"

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

+69-4
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,13 @@
2424
* @author howeye
2525
*/
2626
public interface TaskResultDao {
27-
2827
/**
2928
* Find task result by application id and rule id
3029
* @param applicationId
3130
* @param ruleId
3231
* @return
3332
*/
34-
TaskResult findByApplicationIdAndRuleId(String applicationId, Long ruleId);
33+
List<TaskResult> findByApplicationAndRule(String applicationId, Long ruleId);
3534

3635
/**
3736
* Find avg value between create time and rule id
@@ -40,14 +39,80 @@ public interface TaskResultDao {
4039
* @param ruleId
4140
* @return
4241
*/
43-
Double findAvgByCreateTimeBetweenAndRuleId(String begin, String end, Long ruleId);
42+
Double findAvgByCreateTimeBetweenAndRule(String begin, String end, Long ruleId);
4443

4544
/**
4645
* Find task result by application and rule id in
4746
* @param applicationId
4847
* @param ruleIds
4948
* @return
5049
*/
51-
List<TaskResult> findByApplicationIdAndRuleIdIn(String applicationId, List<Long> ruleIds);
50+
List<TaskResult> findByApplicationIdAndRuleIn(String applicationId, List<Long> ruleIds);
51+
52+
/**
53+
* Save file task result.
54+
* @param taskResult
55+
* @return
56+
*/
57+
TaskResult saveTaskResult(TaskResult taskResult);
58+
59+
/**
60+
* Find rule IDs by rule metric ID.
61+
* @param id
62+
* @param page
63+
* @param size
64+
* @return
65+
*/
66+
List<Long> findRuleByRuleMetric(Long id, int page, int size);
67+
68+
/**
69+
* Find values by rule ID and rule metric ID.
70+
* @param ruleMetricId
71+
* @param page
72+
* @param size
73+
* @return
74+
*/
75+
List<TaskResult> findValuesByRuleMetric(long ruleMetricId, int page, int size);
76+
77+
/**
78+
* Find avg value by rule ID and rule metric ID.
79+
* @param start
80+
* @param end
81+
* @param ruleId
82+
* @param ruleMetricId
83+
* @return
84+
*/
85+
Double findAvgByCreateTimeBetweenAndRuleAndRuleMetric(String start, String end, Long ruleId, Long ruleMetricId);
5286

87+
/**
88+
* Find value.
89+
* @param applicationId
90+
* @param ruleId
91+
* @param ruleMetricId
92+
* @return
93+
*/
94+
TaskResult find(String applicationId, Long ruleId, Long ruleMetricId);
95+
96+
/**
97+
* Find value.
98+
* @param runDate
99+
* @param ruleId
100+
* @param ruleMetricId
101+
* @return
102+
*/
103+
TaskResult find(Long runDate, Long ruleId, Long ruleMetricId);
104+
105+
/**
106+
* Count values.
107+
* @param ruleMetricId
108+
* @return
109+
*/
110+
int countValuesByRuleMetric(long ruleMetricId);
111+
112+
/**
113+
* Count rules.
114+
* @param ruleMetricId
115+
* @return
116+
*/
117+
int countRuleByRuleMetric(Long ruleMetricId);
53118
}

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

+51-6
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
import com.webank.wedatasphere.qualitis.dao.TaskResultDao;
2020
import com.webank.wedatasphere.qualitis.dao.repository.TaskResultRepository;
2121
import com.webank.wedatasphere.qualitis.entity.TaskResult;
22-
import com.webank.wedatasphere.qualitis.dao.TaskResultDao;
2322
import org.springframework.beans.factory.annotation.Autowired;
23+
import org.springframework.data.domain.PageRequest;
24+
import org.springframework.data.domain.Pageable;
25+
import org.springframework.data.domain.Sort;
2426
import org.springframework.stereotype.Repository;
2527

2628
import java.util.List;
@@ -30,22 +32,65 @@
3032
*/
3133
@Repository
3234
public class TaskResultDaoImpl implements TaskResultDao {
33-
3435
@Autowired
3536
private TaskResultRepository resultRepository;
3637

3738
@Override
38-
public TaskResult findByApplicationIdAndRuleId(String applicationId, Long ruleId) {
39+
public List<TaskResult> findByApplicationAndRule(String applicationId, Long ruleId) {
3940
return resultRepository.findByApplicationIdAndRuleId(applicationId, ruleId);
4041
}
4142

4243
@Override
43-
public Double findAvgByCreateTimeBetweenAndRuleId(String begin, String end, Long ruleId) {
44-
return resultRepository.findAvgByCreateTimeBetweenAndRuleId(begin, end, ruleId);
44+
public Double findAvgByCreateTimeBetweenAndRule(String begin, String end, Long ruleId) {
45+
return resultRepository.findAvgByCreateTimeBetween(begin, end, ruleId);
4546
}
4647

4748
@Override
48-
public List<TaskResult> findByApplicationIdAndRuleIdIn(String applicationId, List<Long> ruleIds) {
49+
public List<TaskResult> findByApplicationIdAndRuleIn(String applicationId, List<Long> ruleIds) {
4950
return resultRepository.findByApplicationIdAndRuleIdIn(applicationId, ruleIds);
5051
}
52+
53+
@Override
54+
public TaskResult saveTaskResult(TaskResult taskResult) {
55+
return resultRepository.save(taskResult);
56+
}
57+
58+
@Override
59+
public List<Long> findRuleByRuleMetric(Long ruleMetricId, int page, int size) {
60+
Sort sort = new Sort(Sort.Direction.ASC, "id");
61+
Pageable pageable = PageRequest.of(page, size, sort);
62+
return resultRepository.findRuleByRuleMetricId(ruleMetricId, pageable).getContent();
63+
}
64+
65+
@Override
66+
public List<TaskResult> findValuesByRuleMetric(long ruleMetricId, int page, int size) {
67+
Sort sort = new Sort(Sort.Direction.DESC, "id");
68+
Pageable pageable = PageRequest.of(page, size, sort);
69+
return resultRepository.findValuesByRuleAndRuleMetric(ruleMetricId, pageable).getContent();
70+
}
71+
72+
@Override
73+
public Double findAvgByCreateTimeBetweenAndRuleAndRuleMetric(String start, String end, Long ruleId, Long ruleMetricId) {
74+
return resultRepository.findAvgByCreateTimeBetween(start, end, ruleId, ruleMetricId);
75+
}
76+
77+
@Override
78+
public TaskResult find(String applicationId, Long ruleId, Long ruleMetricId) {
79+
return resultRepository.findValue(applicationId, ruleId, ruleMetricId);
80+
}
81+
82+
@Override
83+
public TaskResult find(Long runDate, Long ruleId, Long ruleMetricId) {
84+
return resultRepository.findWithRunDate(runDate, ruleId, ruleMetricId);
85+
}
86+
87+
@Override
88+
public int countValuesByRuleMetric(long ruleMetricId) {
89+
return resultRepository.countValuesByRuleMetric(ruleMetricId);
90+
}
91+
92+
@Override
93+
public int countRuleByRuleMetric(Long ruleMetricId) {
94+
return resultRepository.countRulesByRuleMetric(ruleMetricId);
95+
}
5196
}

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

+71-6
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,23 @@
1717
package com.webank.wedatasphere.qualitis.dao.repository;
1818

1919
import com.webank.wedatasphere.qualitis.entity.TaskResult;
20-
import com.webank.wedatasphere.qualitis.entity.TaskResult;
20+
import java.util.List;
21+
import org.springframework.data.domain.Page;
22+
import org.springframework.data.domain.Pageable;
2123
import org.springframework.data.jpa.repository.JpaRepository;
2224
import org.springframework.data.jpa.repository.Query;
2325

24-
import java.util.List;
25-
2626
/**
2727
* @author howeye
2828
*/
2929
public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
30-
3130
/**
3231
* Find task result by application and ruls
3332
* @param applicationId
3433
* @param ruleId
3534
* @return
3635
*/
37-
TaskResult findByApplicationIdAndRuleId(String applicationId, Long ruleId);
36+
List<TaskResult> findByApplicationIdAndRuleId(String applicationId, Long ruleId);
3837

3938
/**
4039
* Find value avg from begin time and end time
@@ -44,7 +43,19 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
4443
* @return
4544
*/
4645
@Query("select avg(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3")
47-
Double findAvgByCreateTimeBetweenAndRuleId(String begin, String end, Long ruleId);
46+
Double findAvgByCreateTimeBetween(String begin, String end, Long ruleId);
47+
48+
49+
/**
50+
* Find avg value by rule ID and rule metric ID.
51+
* @param begin
52+
* @param end
53+
* @param ruleId
54+
* @param ruleMetricId
55+
* @return
56+
*/
57+
@Query("select avg(value) from TaskResult t where (t.createTime between ?1 and ?2) and t.ruleId = ?3 and (t.ruleMetricId = ?4)")
58+
Double findAvgByCreateTimeBetween(String begin, String end, Long ruleId, Long ruleMetricId);
4859

4960
/**
5061
* Find task result by application and rule id
@@ -53,4 +64,58 @@ public interface TaskResultRepository extends JpaRepository<TaskResult, Long> {
5364
* @return
5465
*/
5566
List<TaskResult> findByApplicationIdAndRuleIdIn(String applicationId, List<Long> ruleIds);
67+
68+
/**
69+
* Find rule IDs by rule metric ID.
70+
* @param id
71+
* @param pageable
72+
* @return
73+
*/
74+
@Query(value = "SELECT tr.ruleId from TaskResult tr where tr.ruleMetricId = ?1")
75+
Page<Long> findRuleByRuleMetricId(Long id, Pageable pageable);
76+
77+
/**
78+
* Find values by rule ID and rule metric ID.
79+
* @param ruleMetricId
80+
* @param pageable
81+
* @return
82+
*/
83+
@Query(value = "SELECT tr from TaskResult tr where tr.ruleMetricId = ?1")
84+
Page<TaskResult> findValuesByRuleAndRuleMetric(long ruleMetricId, Pageable pageable);
85+
86+
/**
87+
* Find value.
88+
* @param applicationId
89+
* @param ruleId
90+
* @param ruleMetricId
91+
* @return
92+
*/
93+
@Query(value = "SELECT tr from TaskResult tr where tr.applicationId = ?1 and tr.ruleId = ?2 and tr.ruleMetricId = ?3")
94+
TaskResult findValue(String applicationId, Long ruleId, Long ruleMetricId);
95+
96+
/**
97+
* Find value with run date.
98+
* @param runDate
99+
* @param ruleId
100+
* @param ruleMetricId
101+
* @return
102+
*/
103+
@Query(value = "SELECT tr from TaskResult tr where tr.runDate = ?1 and tr.ruleId = ?2 and tr.ruleMetricId = ?3")
104+
TaskResult findWithRunDate(Long runDate, Long ruleId, Long ruleMetricId);
105+
106+
/**
107+
* Count values.
108+
* @param ruleMetricId
109+
* @return
110+
*/
111+
@Query(value = "SELECT count(tr.id) from TaskResult tr where tr.ruleMetricId = ?1")
112+
int countValuesByRuleMetric(long ruleMetricId);
113+
114+
/**
115+
* Count rules.
116+
* @param ruleMetricId
117+
* @return
118+
*/
119+
@Query(value = "SELECT count(tr.ruleId) from TaskResult tr where tr.ruleMetricId = ?1")
120+
int countRulesByRuleMetric(Long ruleMetricId);
56121
}

0 commit comments

Comments
 (0)