Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
448b132c56
|
|
@ -20,8 +20,8 @@ jobs:
|
|||
path: ~/.m2
|
||||
key: ${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
||||
- name: Build with Maven
|
||||
run: ./mvnw clean install -Dmaven.build.timestamp="$(date "+%Y-%m-%d %H:%M:%S")" -Dmaven.test.skip=true -Pbuild && cd jetlinks-standalone && docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) .
|
||||
run: ./mvnw clean install -Dmaven.build.timestamp="$(date "+%Y-%m-%d %H:%M:%S")" -Dmaven.test.skip=true -Pbuild && cd jetlinks-standalone && docker build -t registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) .
|
||||
- name: Login Docker Repo
|
||||
run: echo "${{ secrets.ALIYUN_DOCKER_REPO_PWD }}" | docker login registry.cn-shenzhen.aliyuncs.com -u ${{ secrets.ALIYUN_DOCKER_REPO_USERNAME }} --password-stdin
|
||||
- name: Push Docker
|
||||
run: docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
run: docker push registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
|
|
|
|||
12
README.md
12
README.md
|
|
@ -1,17 +1,17 @@
|
|||
# JetLinks 物联网基础平台
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
[](https://app.codacy.com/gh/jetlinks/jetlinks-community?utm_source=github.com&utm_medium=referral&utm_content=jetlinks/jetlinks-community&utm_campaign=Badge_Grade_Settings)
|
||||
[](https://www.oscs1024.com/project/jetlinks/jetlinks-community?ref=badge_small)
|
||||
[](https://github.com/jetlinks/jetlinks-community)
|
||||
[](https://gitee.com/jetlinks/jetlinks-community/stargazers)
|
||||
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=LGf0OPQqvLGdJIZST3VTcypdVWhdfAOG&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=IMas2cH-TNsYxUcY8lRbsXqPnA2sGHYQ&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=K5m27CkhDn3B_Owr-g6rfiTBC5DKEY59&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=jiirLiyFUecy_gsankzVQ-cl6SrZCnv9&&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=Gj47w9kg7TlV5ceD5Bqew_M_O0PIjh_l&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=K5m27CkhDn3B_Owr-g6rfiTBC5DKEY59&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=IMas2cH-TNsYxUcY8lRbsXqPnA2sGHYQ&jump_from=webapi)
|
||||
[](https://qm.qq.com/cgi-bin/qm/qr?k=LGf0OPQqvLGdJIZST3VTcypdVWhdfAOG&jump_from=webapi)
|
||||
|
||||
JetLinks 基于Java8,Spring Boot 2.x,WebFlux,Netty,Vert.x,Reactor等开发,
|
||||
是一个开箱即用,可二次开发的企业级物联网基础平台。平台实现了物联网相关的众多基础功能,
|
||||
|
|
@ -73,7 +73,7 @@ TCP/UDP/MQTT/HTTP、TLS/DTLS、不同厂商、不同设备、不同报文、统
|
|||
|
||||
| 服务项 | 服务内容 | 服务收费 | 服务方式 |
|
||||
|-----------|-----------------|--------|-------------|
|
||||
| 基础问题答疑 | 问题答疑 | 免费 | 技术交流群支持 [](https://qm.qq.com/cgi-bin/qm/qr?k=LGf0OPQqvLGdJIZST3VTcypdVWhdfAOG&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=IMas2cH-TNsYxUcY8lRbsXqPnA2sGHYQ&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=K5m27CkhDn3B_Owr-g6rfiTBC5DKEY59&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=Gj47w9kg7TlV5ceD5Bqew_M_O0PIjh_l&jump_from=webapi) |
|
||||
| 基础问题答疑 | 问题答疑 | 免费 | 技术交流群支持 [](https://qm.qq.com/cgi-bin/qm/qr?k=jiirLiyFUecy_gsankzVQ-cl6SrZCnv9&&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=Gj47w9kg7TlV5ceD5Bqew_M_O0PIjh_l&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=K5m27CkhDn3B_Owr-g6rfiTBC5DKEY59&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=IMas2cH-TNsYxUcY8lRbsXqPnA2sGHYQ&jump_from=webapi) [](https://qm.qq.com/cgi-bin/qm/qr?k=LGf0OPQqvLGdJIZST3VTcypdVWhdfAOG&jump_from=webapi) |
|
||||
| 系统部署 | 系统部署 | 免费 | 文档自助。[源码部署](https://hanta.yuque.com/px7kg1/yfac2l/vvoa3u2ztymtp4oh) [Docker部署](https://hanta.yuque.com/px7kg1/yfac2l/mzq23z4iey5ev1a5) |
|
||||
| 产品使用 | 教学产品各功能使用 | 免费 | 文档自助。[产品文档](https://hanta.yuque.com/px7kg1/yfac2l) |
|
||||
| 二次开发 | 教学平台源码开发过程、工具使用等;| 免费 | 文档自助。[开发文档](https://hanta.yuque.com/px7kg1/nn1gdr) |
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
dockerImage=registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
dockerImage=registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
|
||||
./mvnw clean package -Dmaven.test.skip=true -Dmaven.build.timestamp="$(date "+%Y-%m-%d %H:%M:%S")"
|
||||
if [ $? -ne 0 ];then
|
||||
echo "构建失败!"
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ services:
|
|||
links:
|
||||
- jetlinks:jetlinks
|
||||
jetlinks:
|
||||
image: registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-standalone:2.2.0-SNAPSHOT
|
||||
image: registry.cn-shenzhen.aliyuncs.com/jetlinks/jetlinks-community:2.2.0-SNAPSHOT
|
||||
container_name: jetlinks-ce
|
||||
|
||||
ports:
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<artifactId>h2-mvstore</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -157,7 +157,7 @@
|
|||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<artifactId>h2-mvstore</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
|
|
@ -18,42 +18,56 @@ public class DefaultLinkTypeParser implements LinkTypeParser {
|
|||
|
||||
private final TermTypeParser parser = new DefaultTermTypeParser();
|
||||
|
||||
|
||||
@Override
|
||||
public BoolQueryBuilder process(Term term, Consumer<Term> consumer, BoolQueryBuilder queryBuilders) {
|
||||
if (term.getValue() == null && CollectionUtils.isEmpty(term.getTerms())) {
|
||||
return queryBuilders;
|
||||
public void process(List<Term> terms,
|
||||
Consumer<Term> consumer,
|
||||
BoolQueryBuilder queryBuilders) {
|
||||
|
||||
if (CollectionUtils.isEmpty(terms)) {
|
||||
return;
|
||||
}
|
||||
if (term.getType() == Term.Type.or) {
|
||||
handleOr(queryBuilders, term, consumer);
|
||||
} else {
|
||||
handleAnd(queryBuilders, term, consumer);
|
||||
for (TermsHandler.TermGroup group : TermsHandler.groupTerms(terms)) {
|
||||
if (group.type == Term.Type.or) {
|
||||
for (Term groupTerm : group.getTerms()) {
|
||||
handleOr(queryBuilders, groupTerm, consumer);
|
||||
}
|
||||
} else {
|
||||
BoolQueryBuilder andQuery = QueryBuilders.boolQuery();
|
||||
for (Term groupTerm : group.getTerms()) {
|
||||
handleAnd(andQuery, groupTerm, consumer);
|
||||
}
|
||||
if (!CollectionUtils.isEmpty(andQuery.must())){
|
||||
queryBuilders.should(andQuery);
|
||||
}
|
||||
}
|
||||
}
|
||||
return queryBuilders;
|
||||
}
|
||||
|
||||
private void handleOr(BoolQueryBuilder queryBuilders, Term term, Consumer<Term> consumer) {
|
||||
private void handleOr(BoolQueryBuilder queryBuilders,
|
||||
Term term,
|
||||
Consumer<Term> consumer) {
|
||||
consumer.accept(term);
|
||||
if (term.getTerms().isEmpty() && term.getValue() != null) {
|
||||
parser.process(() -> term, queryBuilders::should);
|
||||
} else {
|
||||
} else if (!term.getTerms().isEmpty()){
|
||||
BoolQueryBuilder nextQuery = QueryBuilders.boolQuery();
|
||||
List<Term> terms = (term.getTerms());
|
||||
terms.forEach(t -> process(t, consumer, nextQuery));
|
||||
process(term.getTerms(), consumer, nextQuery);
|
||||
queryBuilders.should(nextQuery);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleAnd(BoolQueryBuilder queryBuilders, Term term, Consumer<Term> consumer) {
|
||||
private void handleAnd(BoolQueryBuilder queryBuilders,
|
||||
Term term,
|
||||
Consumer<Term> consumer) {
|
||||
consumer.accept(term);
|
||||
if (term.getTerms().isEmpty() && term.getValue() != null) {
|
||||
parser.process(() -> term, queryBuilders::must);
|
||||
} else {
|
||||
} else if (!term.getTerms().isEmpty()){
|
||||
BoolQueryBuilder nextQuery = QueryBuilders.boolQuery();
|
||||
List<Term> terms = term.getTerms();
|
||||
terms.forEach(t -> process(t, consumer, nextQuery));
|
||||
process(term.getTerms(), consumer, nextQuery);
|
||||
queryBuilders.must(nextQuery);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -3,6 +3,7 @@ package org.jetlinks.community.elastic.search.parser;
|
|||
import org.elasticsearch.index.query.BoolQueryBuilder;
|
||||
import org.hswebframework.ezorm.core.param.Term;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
|
|
@ -10,5 +11,5 @@ import java.util.function.Consumer;
|
|||
**/
|
||||
public interface LinkTypeParser {
|
||||
|
||||
BoolQueryBuilder process(Term term, Consumer<Term> consumer, BoolQueryBuilder queryBuilders);
|
||||
void process(List<Term> terms, Consumer<Term> consumer, BoolQueryBuilder queryBuilders);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,71 @@
|
|||
package org.jetlinks.community.elastic.search.parser;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.hswebframework.ezorm.core.param.Term;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 根据terms条件的type分组
|
||||
* 如:条件 where a = 1 or b = 2 and c = 3 or d = 4 or e = 5 and f = 6
|
||||
* 分组为
|
||||
* (a = 1)
|
||||
* OR
|
||||
* (b = 2 AND c = 3)
|
||||
* OR
|
||||
* (d = 4)
|
||||
* OR
|
||||
* (e = 5 AND f = 6)
|
||||
*
|
||||
* @author bestfeng
|
||||
*/
|
||||
public class TermsHandler {
|
||||
|
||||
public static Set<TermGroup> groupTerms(List<Term> terms) {
|
||||
Set<TermGroup> groups = new HashSet<>();
|
||||
TermGroup currentGroup = null;
|
||||
|
||||
for (int i = 0; i < terms.size(); i++) {
|
||||
Term currentTerm = terms.get(i);
|
||||
Term nextTerm = (i + 1 < terms.size()) ? terms.get(i + 1) : null;
|
||||
|
||||
if (currentTerm.getType() == Term.Type.or){
|
||||
if (currentGroup == null || currentGroup.type == Term.Type.and){
|
||||
currentGroup = new TermGroup(Term.Type.or);
|
||||
}
|
||||
// 如果下一个Term为"AND",创建一个新分组
|
||||
if (nextTerm != null && nextTerm.getType() == Term.Type.and){
|
||||
currentGroup = new TermGroup(Term.Type.and);
|
||||
}
|
||||
}else {
|
||||
if (currentGroup == null){
|
||||
currentGroup = new TermGroup(Term.Type.and);
|
||||
}
|
||||
}
|
||||
currentGroup.addTerm(currentTerm);
|
||||
groups.add(currentGroup);
|
||||
}
|
||||
return groups;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public static class TermGroup {
|
||||
public TermGroup(Term.Type type) {
|
||||
this.type = type;
|
||||
this.terms = new ArrayList<>();
|
||||
}
|
||||
|
||||
List<Term> terms;
|
||||
|
||||
Term.Type type;
|
||||
public void addTerm(Term term) {
|
||||
terms.add(term);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -103,9 +103,7 @@ public class QueryParamTranslator {
|
|||
}
|
||||
};
|
||||
}
|
||||
for (Term term : queryParam.getTerms()) {
|
||||
linkTypeParser.process(term, paramConverter, queryBuilders);
|
||||
}
|
||||
linkTypeParser.process(queryParam.getTerms(), paramConverter, queryBuilders);
|
||||
return queryBuilders;
|
||||
}
|
||||
|
||||
|
|
|
|||
14
pom.xml
14
pom.xml
|
|
@ -36,11 +36,11 @@
|
|||
<!-- 第三方依赖版本 -->
|
||||
<r2dbc.version>Borca-SR2</r2dbc.version>
|
||||
<hsweb.expands.version>3.0.2</hsweb.expands.version>
|
||||
<netty.version>4.1.89.Final</netty.version>
|
||||
<netty.version>4.1.97.Final</netty.version>
|
||||
<elasticsearch.version>7.17.5</elasticsearch.version>
|
||||
<californium.version>3.7.0</californium.version>
|
||||
<fastjson.version>1.2.83</fastjson.version>
|
||||
<reactor.version>2020.0.31</reactor.version>
|
||||
<reactor.version>2020.0.36</reactor.version>
|
||||
<vertx.version>4.3.8</vertx.version>
|
||||
<log4j.version>2.18.0</log4j.version>
|
||||
<logback.version>1.2.11</logback.version>
|
||||
|
|
@ -235,7 +235,13 @@
|
|||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2</artifactId>
|
||||
<version>2.1.210</version>
|
||||
<version>2.2.224</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.h2database</groupId>
|
||||
<artifactId>h2-mvstore</artifactId>
|
||||
<version>2.1.214</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
@ -444,7 +450,7 @@
|
|||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>32.0.0-jre</version>
|
||||
<version>32.1.2-jre</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
|
|
|
|||
Loading…
Reference in New Issue