diff --git a/.gitignore b/.gitignore
index 6de61720e..aed2693a5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -460,3 +460,8 @@ hs_err_pid*
/logs/
**/spotless-index-file
**/pom.xml.versionsBackup
+
+!.mvn/wrapper/maven-wrapper.jar
+!.mvn/wrapper/maven-wrapper.properties
+!mvnw
+!mvnw.cmd
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
new file mode 100644
index 000000000..cb28b0e37
Binary files /dev/null and b/.mvn/wrapper/maven-wrapper.jar differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
new file mode 100644
index 000000000..ad1720743
--- /dev/null
+++ b/.mvn/wrapper/maven-wrapper.properties
@@ -0,0 +1,2 @@
+distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.5/apache-maven-3.9.5-bin.zip
+wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar
\ No newline at end of file
diff --git a/app/api/facade/pom.xml b/app/api/facade/pom.xml
new file mode 100644
index 000000000..e58e623d4
--- /dev/null
+++ b/app/api/facade/pom.xml
@@ -0,0 +1,40 @@
+
+
+
+ 4.0.0
+
+ com.antgroup.openspg.app
+ app-parent
+ 0.0.1-SNAPSHOT
+ ../../pom.xml
+
+
+ app-api-facade
+
+
+
+ com.antgroup.openspg.server
+ common-model
+
+
+ com.antgroup.openspg.app
+ app-core-reasoner-model
+
+
+ com.antgroup.openspg.app
+ app-core-builder-model
+
+
+
diff --git a/app/api/facade/scalastyle-config.xml b/app/api/facade/scalastyle-config.xml
new file mode 100644
index 000000000..a30c23f15
--- /dev/null
+++ b/app/api/facade/scalastyle-config.xml
@@ -0,0 +1,459 @@
+
+
+
+
+
+ Scalastyle standard configuration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW
+
+
+
+
+
+ ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW
+
+
+
+
+
+
+
+
+
+
+ ^FunSuite[A-Za-z]*$
+
+ Tests must extend org.apache.spark.SparkFunSuite instead.
+
+
+
+
+
+ ^println$
+
+
+
+
+
+
+ spark(.sqlContext)?.sparkContext.hadoopConfiguration
+
+
+
+
+
+
+ @VisibleForTesting
+
+
+
+
+
+
+ Runtime\.getRuntime\.addShutdownHook
+
+
+
+
+
+
+ mutable\.SynchronizedBuffer
+
+
+
+
+
+
+ Class\.forName
+
+
+
+
+
+
+ Await\.result
+
+
+
+
+
+
+ Await\.ready
+
+
+
+
+
+
+ (\.toUpperCase|\.toLowerCase)(?!(\(|\(Locale.ROOT\)))
+
+
+
+
+
+
+ throw new \w+Error\(
+
+
+
+
+
+
+
+ JavaConversions
+
+ Instead of importing implicits in scala.collection.JavaConversions._, import
+ scala.collection.JavaConverters._ and use .asScala / .asJava methods
+
+
+
+
+
+ org\.apache\.commons\.lang\.
+
+ Use Commons Lang 3 classes (package org.apache.commons.lang3.*) instead
+ of Commons Lang 2 (package org.apache.commons.lang.*)
+
+
+
+
+
+ FileSystem.get\([a-zA-Z_$][a-zA-Z_$0-9]*\)
+
+
+
+
+
+
+ extractOpt
+
+ Use jsonOption(x).map(.extract[T]) instead of .extractOpt[T], as the latter
+ is slower.
+
+
+
+
+
+ java,scala,3rdParty,kgreasoner
+ javax?\..*
+ scala\..*
+ (?!com\.antfin\.aikg\.kgreasoner\.).*
+ com\.antfin\.aikg\.kgreasoner\..*
+
+
+
+
+
+ COMMA
+
+
+
+
+
+
+ \)\{
+
+
+
+
+
+
+ (?m)^(\s*)/[*][*].*$(\r|)\n^\1 [*]
+
+ Use Javadoc style indentation for multiline comments
+
+
+
+
+ case[^\n>]*=>\s*\{
+
+ Omit braces in case clauses.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 800>
+
+
+
+
+
+
+ 30
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -1,0,1,2,3
+
+
+
+
+
+ Objects.toStringHelper
+
+ Avoid using Object.toStringHelper. Use ToStringBuilder instead.
+
+
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/Page.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/Page.java
new file mode 100644
index 000000000..ed13d1161
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/Page.java
@@ -0,0 +1,48 @@
+package com.antgroup.openspgapp.server.api.facade.dto;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/Page.class */
+public class Page {
+ Long total;
+ Long pageSize;
+ Long pageNo;
+ T data;
+
+ public void setTotal(final Long total) {
+ this.total = total;
+ }
+
+ public void setPageSize(final Long pageSize) {
+ this.pageSize = pageSize;
+ }
+
+ public void setPageNo(final Long pageNo) {
+ this.pageNo = pageNo;
+ }
+
+ public void setData(final T data) {
+ this.data = data;
+ }
+
+ public Long getTotal() {
+ return this.total;
+ }
+
+ public Long getPageSize() {
+ return this.pageSize;
+ }
+
+ public Long getPageNo() {
+ return this.pageNo;
+ }
+
+ public T getData() {
+ return this.data;
+ }
+
+ public Page() {}
+
+ public Page(Long pageSize, Long pageNo) {
+ this.pageSize = pageSize;
+ this.pageNo = pageNo;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/builder/BuilderJobSubGraphRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/builder/BuilderJobSubGraphRequest.java
new file mode 100644
index 000000000..f8ea36e22
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/builder/BuilderJobSubGraphRequest.java
@@ -0,0 +1,28 @@
+package com.antgroup.openspgapp.server.api.facade.dto.builder;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import com.antgroup.openspg.server.common.model.bulider.BuilderJob;
+import com.antgroup.openspgapp.core.reasoner.model.SubGraph;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/builder/BuilderJobSubGraphRequest.class */
+public class BuilderJobSubGraphRequest extends BaseRequest {
+ private static final long serialVersionUID = 2611087767712034352L;
+ private SubGraph subGraph;
+ private BuilderJob job;
+
+ public SubGraph getSubGraph() {
+ return this.subGraph;
+ }
+
+ public void setSubGraph(SubGraph subGraph) {
+ this.subGraph = subGraph;
+ }
+
+ public BuilderJob getJob() {
+ return this.job;
+ }
+
+ public void setJob(BuilderJob job) {
+ this.job = job;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/builder/WriterGraphRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/builder/WriterGraphRequest.java
new file mode 100644
index 000000000..a4af55ab4
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/builder/WriterGraphRequest.java
@@ -0,0 +1,44 @@
+package com.antgroup.openspgapp.server.api.facade.dto.builder;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import com.antgroup.openspgapp.core.reasoner.model.SubGraph;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/builder/WriterGraphRequest.class */
+public class WriterGraphRequest extends BaseRequest {
+ private static final long serialVersionUID = -5051318132737772511L;
+ private SubGraph subGraph;
+ private String operation;
+ Long projectId;
+
+ public WriterGraphRequest() {}
+
+ public WriterGraphRequest(SubGraph subGraph, String operation, Long projectId) {
+ this.subGraph = subGraph;
+ this.operation = operation;
+ this.projectId = projectId;
+ }
+
+ public SubGraph getSubGraph() {
+ return this.subGraph;
+ }
+
+ public void setSubGraph(SubGraph subGraph) {
+ this.subGraph = subGraph;
+ }
+
+ public String getOperation() {
+ return this.operation;
+ }
+
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/CreateSessionRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/CreateSessionRequest.java
new file mode 100644
index 000000000..1bf95d29a
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/CreateSessionRequest.java
@@ -0,0 +1,51 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.session;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/CreateSessionRequest.class */
+public class CreateSessionRequest extends BaseRequest {
+ private static final long serialVersionUID = 288748585428580417L;
+ private Long projectId;
+ private Long userId;
+ private String name;
+ private String description;
+
+ public CreateSessionRequest(Long projectId, Long userId, String name, String description) {
+ this.projectId = projectId;
+ this.userId = userId;
+ this.name = name;
+ this.description = description;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public Long getUserId() {
+ return this.userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/ListSessionRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/ListSessionRequest.java
new file mode 100644
index 000000000..808073ee6
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/ListSessionRequest.java
@@ -0,0 +1,43 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.session;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/ListSessionRequest.class */
+public class ListSessionRequest extends BaseRequest {
+ private static final long serialVersionUID = 2793740486506426124L;
+ private Long projectId;
+ private Long userId;
+ private Integer limit;
+
+ public ListSessionRequest() {}
+
+ public ListSessionRequest(Long projectId, Long userId, Integer limit) {
+ this.projectId = projectId;
+ this.userId = userId;
+ this.limit = limit;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public Long getUserId() {
+ return this.userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public Integer getLimit() {
+ return this.limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/SessionResponse.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/SessionResponse.java
new file mode 100644
index 000000000..ccaa1aca8
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/SessionResponse.java
@@ -0,0 +1,53 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.session;
+
+import com.antgroup.openspg.server.common.model.base.BaseResponse;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/SessionResponse.class */
+public class SessionResponse extends BaseResponse {
+ private static final long serialVersionUID = 7549125593003891395L;
+ private Long id;
+ private Long projectId;
+ private Long userId;
+ private String name;
+ private String description;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public Long getUserId() {
+ return this.userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/UpdateSessionRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/UpdateSessionRequest.java
new file mode 100644
index 000000000..d7c6bccc8
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/UpdateSessionRequest.java
@@ -0,0 +1,25 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.session;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/session/UpdateSessionRequest.class */
+public class UpdateSessionRequest extends CreateSessionRequest {
+ private static final long serialVersionUID = 2721946536933394886L;
+ private Long id;
+
+ public UpdateSessionRequest(Long projectId, Long userId, String name, String description) {
+ super(projectId, userId, name, description);
+ }
+
+ public UpdateSessionRequest(
+ Long id, Long projectId, Long userId, String name, String description) {
+ super(projectId, userId, name, description);
+ this.id = id;
+ }
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/CompletionContent.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/CompletionContent.java
new file mode 100644
index 000000000..3c3229c01
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/CompletionContent.java
@@ -0,0 +1,136 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.alibaba.fastjson.JSONObject;
+import java.util.List;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/CompletionContent.class */
+public class CompletionContent {
+ private String answer;
+ private List reference;
+ private String think;
+ private JSONObject metrics;
+ private List subgraph;
+
+ public void setAnswer(final String answer) {
+ this.answer = answer;
+ }
+
+ public void setReference(final List reference) {
+ this.reference = reference;
+ }
+
+ public void setThink(final String think) {
+ this.think = think;
+ }
+
+ public void setMetrics(final JSONObject metrics) {
+ this.metrics = metrics;
+ }
+
+ public void setSubgraph(final List subgraph) {
+ this.subgraph = subgraph;
+ }
+
+ public boolean equals(final Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof CompletionContent)) {
+ return false;
+ }
+ CompletionContent other = (CompletionContent) o;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+ Object this$answer = getAnswer();
+ Object other$answer = other.getAnswer();
+ if (this$answer == null) {
+ if (other$answer != null) {
+ return false;
+ }
+ } else if (!this$answer.equals(other$answer)) {
+ return false;
+ }
+ Object this$reference = getReference();
+ Object other$reference = other.getReference();
+ if (this$reference == null) {
+ if (other$reference != null) {
+ return false;
+ }
+ } else if (!this$reference.equals(other$reference)) {
+ return false;
+ }
+ Object this$think = getThink();
+ Object other$think = other.getThink();
+ if (this$think == null) {
+ if (other$think != null) {
+ return false;
+ }
+ } else if (!this$think.equals(other$think)) {
+ return false;
+ }
+ Object this$metrics = getMetrics();
+ Object other$metrics = other.getMetrics();
+ if (this$metrics == null) {
+ if (other$metrics != null) {
+ return false;
+ }
+ } else if (!this$metrics.equals(other$metrics)) {
+ return false;
+ }
+ Object this$subgraph = getSubgraph();
+ Object other$subgraph = other.getSubgraph();
+ return this$subgraph == null ? other$subgraph == null : this$subgraph.equals(other$subgraph);
+ }
+
+ protected boolean canEqual(final Object other) {
+ return other instanceof CompletionContent;
+ }
+
+ public int hashCode() {
+ Object $answer = getAnswer();
+ int result = (1 * 59) + ($answer == null ? 43 : $answer.hashCode());
+ Object $reference = getReference();
+ int result2 = (result * 59) + ($reference == null ? 43 : $reference.hashCode());
+ Object $think = getThink();
+ int result3 = (result2 * 59) + ($think == null ? 43 : $think.hashCode());
+ Object $metrics = getMetrics();
+ int result4 = (result3 * 59) + ($metrics == null ? 43 : $metrics.hashCode());
+ Object $subgraph = getSubgraph();
+ return (result4 * 59) + ($subgraph == null ? 43 : $subgraph.hashCode());
+ }
+
+ public String toString() {
+ return "CompletionContent(answer="
+ + getAnswer()
+ + ", reference="
+ + getReference()
+ + ", think="
+ + getThink()
+ + ", metrics="
+ + getMetrics()
+ + ", subgraph="
+ + getSubgraph()
+ + ")";
+ }
+
+ public String getAnswer() {
+ return this.answer;
+ }
+
+ public List getReference() {
+ return this.reference;
+ }
+
+ public String getThink() {
+ return this.think;
+ }
+
+ public JSONObject getMetrics() {
+ return this.metrics;
+ }
+
+ public List getSubgraph() {
+ return this.subgraph;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/MarkTaskRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/MarkTaskRequest.java
new file mode 100644
index 000000000..6975213b2
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/MarkTaskRequest.java
@@ -0,0 +1,17 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/MarkTaskRequest.class */
+public class MarkTaskRequest extends BaseRequest {
+ private static final long serialVersionUID = -8552512405819913632L;
+ private Long id;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTaskRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTaskRequest.java
new file mode 100644
index 000000000..b120d6cf1
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTaskRequest.java
@@ -0,0 +1,26 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTaskRequest.class */
+public class QueryTaskRequest extends BaseRequest {
+ private static final long serialVersionUID = -2641851823210333899L;
+ private Long id;
+ private Long jobId;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getJobId() {
+ return this.jobId;
+ }
+
+ public void setJobId(Long jobId) {
+ this.jobId = jobId;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTasksRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTasksRequest.java
new file mode 100644
index 000000000..c05aa937f
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTasksRequest.java
@@ -0,0 +1,71 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/QueryTasksRequest.class */
+public class QueryTasksRequest extends BaseRequest {
+ private static final long serialVersionUID = -3199400676929548621L;
+ private Long projectId;
+ private Long userId;
+ private Long sessionId;
+ private String mark;
+ private Long start;
+ private Integer limit;
+ private String keyword;
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public Long getUserId() {
+ return this.userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getMark() {
+ return this.mark;
+ }
+
+ public void setMark(String mark) {
+ this.mark = mark;
+ }
+
+ public Long getStart() {
+ return this.start;
+ }
+
+ public void setStart(Long start) {
+ this.start = start;
+ }
+
+ public Integer getLimit() {
+ return this.limit;
+ }
+
+ public void setLimit(Integer limit) {
+ this.limit = limit;
+ }
+
+ public String getKeyword() {
+ return this.keyword;
+ }
+
+ public void setKeyword(String keyword) {
+ this.keyword = keyword;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportCompletionRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportCompletionRequest.java
new file mode 100644
index 000000000..c71ebbfb7
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportCompletionRequest.java
@@ -0,0 +1,36 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import com.antgroup.openspgapp.core.reasoner.model.task.StatusEnum;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportCompletionRequest.class */
+public class ReportCompletionRequest extends BaseRequest {
+ private static final long serialVersionUID = -2641851826210334233L;
+ private Long taskId;
+ private StatusEnum statusEnum;
+ private CompletionContent content;
+
+ public void setTaskId(final Long taskId) {
+ this.taskId = taskId;
+ }
+
+ public void setStatusEnum(final StatusEnum statusEnum) {
+ this.statusEnum = statusEnum;
+ }
+
+ public void setContent(final CompletionContent content) {
+ this.content = content;
+ }
+
+ public Long getTaskId() {
+ return this.taskId;
+ }
+
+ public StatusEnum getStatusEnum() {
+ return this.statusEnum;
+ }
+
+ public CompletionContent getContent() {
+ return this.content;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportLogRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportLogRequest.java
new file mode 100644
index 000000000..b86dd2efc
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportLogRequest.java
@@ -0,0 +1,55 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import com.antgroup.openspg.server.common.model.job.SubGraph;
+import java.util.List;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportLogRequest.class */
+public class ReportLogRequest extends BaseRequest {
+ private static final long serialVersionUID = -2641851823210334233L;
+ private Long taskId;
+ private String content;
+ private List subgraph;
+ private String executeStatus;
+ private String gmtCreate;
+
+ public void setTaskId(final Long taskId) {
+ this.taskId = taskId;
+ }
+
+ public void setContent(final String content) {
+ this.content = content;
+ }
+
+ public void setSubgraph(final List subgraph) {
+ this.subgraph = subgraph;
+ }
+
+ public void setExecuteStatus(final String executeStatus) {
+ this.executeStatus = executeStatus;
+ }
+
+ public void setGmtCreate(final String gmtCreate) {
+ this.gmtCreate = gmtCreate;
+ }
+
+ public Long getTaskId() {
+ return this.taskId;
+ }
+
+ public String getContent() {
+ return this.content;
+ }
+
+ public List getSubgraph() {
+ return this.subgraph;
+ }
+
+ public String getExecuteStatus() {
+ return this.executeStatus;
+ }
+
+ public String getGmtCreate() {
+ return this.gmtCreate;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportPipelineRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportPipelineRequest.java
new file mode 100644
index 000000000..b22eb04b8
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportPipelineRequest.java
@@ -0,0 +1,36 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import com.antgroup.openspgapp.core.builder.model.CaPipeline;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/ReportPipelineRequest.class */
+public class ReportPipelineRequest extends BaseRequest {
+ private static final long serialVersionUID = -3546610993385943286L;
+ private Long taskId;
+ private CaPipeline pipeline;
+ private CaPipeline.Node node;
+
+ public void setTaskId(final Long taskId) {
+ this.taskId = taskId;
+ }
+
+ public void setPipeline(final CaPipeline pipeline) {
+ this.pipeline = pipeline;
+ }
+
+ public void setNode(final CaPipeline.Node node) {
+ this.node = node;
+ }
+
+ public Long getTaskId() {
+ return this.taskId;
+ }
+
+ public CaPipeline getPipeline() {
+ return this.pipeline;
+ }
+
+ public CaPipeline.Node getNode() {
+ return this.node;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/StopTaskRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/StopTaskRequest.java
new file mode 100644
index 000000000..77de90ff2
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/StopTaskRequest.java
@@ -0,0 +1,17 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/StopTaskRequest.class */
+public class StopTaskRequest extends BaseRequest {
+ private static final long serialVersionUID = -6171165802144423969L;
+ private Long id;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/SubmitTaskRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/SubmitTaskRequest.java
new file mode 100644
index 000000000..a2f6e6d3b
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/SubmitTaskRequest.java
@@ -0,0 +1,58 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import java.util.HashMap;
+import java.util.Map;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/SubmitTaskRequest.class */
+public class SubmitTaskRequest extends BaseRequest {
+ private static final long serialVersionUID = 6870684691952780677L;
+ private String dsl;
+ private String nl;
+ private Long sessionId;
+ private Long userId;
+ private Map params;
+
+ public String getDsl() {
+ return this.dsl;
+ }
+
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+ public String getNl() {
+ return this.nl;
+ }
+
+ public void setNl(String nl) {
+ this.nl = nl;
+ }
+
+ public Long getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public Long getUserId() {
+ return this.userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public Map getParams() {
+ if (null == this.params) {
+ return new HashMap();
+ }
+ return this.params;
+ }
+
+ public void setParams(Map params) {
+ this.params = params;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/TaskResponse.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/TaskResponse.java
new file mode 100644
index 000000000..0a205765f
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/TaskResponse.java
@@ -0,0 +1,142 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.task;
+
+import com.antgroup.openspg.server.common.model.base.BaseResponse;
+import com.antgroup.openspgapp.core.reasoner.model.task.MarkEnum;
+import com.antgroup.openspgapp.core.reasoner.model.task.StatusEnum;
+import com.antgroup.openspgapp.core.reasoner.model.task.result.Edge;
+import com.antgroup.openspgapp.core.reasoner.model.task.result.Node;
+import com.antgroup.openspgapp.core.reasoner.model.task.result.Path;
+import com.antgroup.openspgapp.core.reasoner.model.task.result.TableResult;
+import java.util.List;
+import java.util.Map;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/task/TaskResponse.class */
+public class TaskResponse extends BaseResponse {
+ private static final long serialVersionUID = -926986438586998539L;
+ private Long id;
+ private Long projectId;
+ private Long userId;
+ private Long sessionId;
+ private String dsl;
+ private String nl;
+ private Map params;
+ private MarkEnum mark;
+ private StatusEnum status;
+ private String resultMessage;
+ private TableResult resultTable;
+ private List resultNodes;
+ private List resultEdges;
+ private List resultPaths;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public Long getUserId() {
+ return this.userId;
+ }
+
+ public void setUserId(Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getSessionId() {
+ return this.sessionId;
+ }
+
+ public void setSessionId(Long sessionId) {
+ this.sessionId = sessionId;
+ }
+
+ public String getDsl() {
+ return this.dsl;
+ }
+
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+ public String getNl() {
+ return this.nl;
+ }
+
+ public void setNl(String nl) {
+ this.nl = nl;
+ }
+
+ public Map getParams() {
+ return this.params;
+ }
+
+ public void setParams(Map params) {
+ this.params = params;
+ }
+
+ public MarkEnum getMark() {
+ return this.mark;
+ }
+
+ public void setMark(MarkEnum mark) {
+ this.mark = mark;
+ }
+
+ public StatusEnum getStatus() {
+ return this.status;
+ }
+
+ public void setStatus(StatusEnum status) {
+ this.status = status;
+ }
+
+ public String getResultMessage() {
+ return this.resultMessage;
+ }
+
+ public void setResultMessage(String resultMessage) {
+ this.resultMessage = resultMessage;
+ }
+
+ public TableResult getResultTable() {
+ return this.resultTable;
+ }
+
+ public void setResultTable(TableResult resultTable) {
+ this.resultTable = resultTable;
+ }
+
+ public List getResultNodes() {
+ return this.resultNodes;
+ }
+
+ public void setResultNodes(List resultNodes) {
+ this.resultNodes = resultNodes;
+ }
+
+ public List getResultEdges() {
+ return this.resultEdges;
+ }
+
+ public void setResultEdges(List resultEdges) {
+ this.resultEdges = resultEdges;
+ }
+
+ public List getResultPaths() {
+ return this.resultPaths;
+ }
+
+ public void setResultPaths(List resultPaths) {
+ this.resultPaths = resultPaths;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/QueryTutorialRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/QueryTutorialRequest.java
new file mode 100644
index 000000000..c07fbe333
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/QueryTutorialRequest.java
@@ -0,0 +1,26 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.tutorial;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/QueryTutorialRequest.class */
+public class QueryTutorialRequest extends BaseRequest {
+ private static final long serialVersionUID = 1297975150638327274L;
+ private Long projectId;
+ private String keyword;
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getKeyword() {
+ return this.keyword;
+ }
+
+ public void setKeyword(String keyword) {
+ this.keyword = keyword;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialRequest.java
new file mode 100644
index 000000000..a8f0f1e2d
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialRequest.java
@@ -0,0 +1,81 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.tutorial;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+import java.util.Map;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialRequest.class */
+public class TutorialRequest extends BaseRequest {
+ private static final long serialVersionUID = -6557414741948672527L;
+ private Long id;
+ private Long projectId;
+ private Boolean enable;
+ private String name;
+ private String dsl;
+ private String nl;
+ private Map params;
+ private String description;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public Boolean getEnable() {
+ return this.enable;
+ }
+
+ public void setEnable(Boolean enable) {
+ this.enable = enable;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDsl() {
+ return this.dsl;
+ }
+
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+ public String getNl() {
+ return this.nl;
+ }
+
+ public void setNl(String nl) {
+ this.nl = nl;
+ }
+
+ public Map getParams() {
+ return this.params;
+ }
+
+ public void setParams(Map params) {
+ this.params = params;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialResponse.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialResponse.java
new file mode 100644
index 000000000..8095ee9db
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialResponse.java
@@ -0,0 +1,72 @@
+package com.antgroup.openspgapp.server.api.facade.dto.reasoner.tutorial;
+
+import com.antgroup.openspg.server.common.model.base.BaseResponse;
+import java.util.Map;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/reasoner/tutorial/TutorialResponse.class */
+public class TutorialResponse extends BaseResponse {
+ private static final long serialVersionUID = -2919986619258814697L;
+ private Long id;
+ private Long projectId;
+ private String name;
+ private String dsl;
+ private String nl;
+ private Map params;
+ private String description;
+
+ public Long getId() {
+ return this.id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public Long getProjectId() {
+ return this.projectId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getDsl() {
+ return this.dsl;
+ }
+
+ public void setDsl(String dsl) {
+ this.dsl = dsl;
+ }
+
+ public String getNl() {
+ return this.nl;
+ }
+
+ public void setNl(String nl) {
+ this.nl = nl;
+ }
+
+ public Map getParams() {
+ return this.params;
+ }
+
+ public void setParams(Map params) {
+ this.params = params;
+ }
+
+ public String getDescription() {
+ return this.description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+}
diff --git a/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/schema/SchemaSaveRequest.java b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/schema/SchemaSaveRequest.java
new file mode 100644
index 000000000..c0e9b1605
--- /dev/null
+++ b/app/api/facade/src/main/java/com/antgroup/openspgapp/server/api/facade/dto/schema/SchemaSaveRequest.java
@@ -0,0 +1,46 @@
+package com.antgroup.openspgapp.server.api.facade.dto.schema;
+
+import com.antgroup.openspg.server.common.model.base.BaseRequest;
+
+/* loaded from: com.antgroup.openspgapp-api-facade-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/server/api/facade/dto/schema/SchemaSaveRequest.class */
+public class SchemaSaveRequest extends BaseRequest {
+ private String data;
+
+ public void setData(final String data) {
+ this.data = data;
+ }
+
+ public boolean equals(final Object o) {
+ if (o == this) {
+ return true;
+ }
+ if (!(o instanceof SchemaSaveRequest)) {
+ return false;
+ }
+ SchemaSaveRequest other = (SchemaSaveRequest) o;
+ if (!other.canEqual(this)) {
+ return false;
+ }
+ Object this$data = getData();
+ Object other$data = other.getData();
+ return this$data == null ? other$data == null : this$data.equals(other$data);
+ }
+
+ protected boolean canEqual(final Object other) {
+ return other instanceof SchemaSaveRequest;
+ }
+
+ public int hashCode() {
+ Object $data = getData();
+ int result = (1 * 59) + ($data == null ? 43 : $data.hashCode());
+ return result;
+ }
+
+ public String toString() {
+ return "SchemaSaveRequest(data=" + getData() + ")";
+ }
+
+ public String getData() {
+ return this.data;
+ }
+}
diff --git a/app/api/http-client/pom.xml b/app/api/http-client/pom.xml
new file mode 100644
index 000000000..008a4f676
--- /dev/null
+++ b/app/api/http-client/pom.xml
@@ -0,0 +1,64 @@
+
+
+
+ 4.0.0
+
+ com.antgroup.openspg.app
+ app-parent
+ 0.0.1-SNAPSHOT
+ ../../pom.xml
+
+
+ app-api-http-client
+
+
+
+ com.antgroup.openspg.server
+ api-http-client
+ 0.0.1-SNAPSHOT
+
+
+
+ com.antgroup.openspg.app
+ app-common-util
+ 0.0.1-SNAPSHOT
+
+
+
+ com.alibaba
+ fastjson
+
+
+
+ org.springframework
+ spring-context
+
+
+
+ com.antgroup.openspg.server
+ biz-common
+ 0.0.1-SNAPSHOT
+ compile
+
+
+ javax.servlet
+ javax.servlet-api
+
+
+ com.antgroup.openspg.server
+ infra-dao
+
+
+
diff --git a/app/api/http-client/scalastyle-config.xml b/app/api/http-client/scalastyle-config.xml
new file mode 100644
index 000000000..a30c23f15
--- /dev/null
+++ b/app/api/http-client/scalastyle-config.xml
@@ -0,0 +1,459 @@
+
+
+
+
+
+ Scalastyle standard configuration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW
+
+
+
+
+
+ ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW
+
+
+
+
+
+
+
+
+
+
+ ^FunSuite[A-Za-z]*$
+
+ Tests must extend org.apache.spark.SparkFunSuite instead.
+
+
+
+
+
+ ^println$
+
+
+
+
+
+
+ spark(.sqlContext)?.sparkContext.hadoopConfiguration
+
+
+
+
+
+
+ @VisibleForTesting
+
+
+
+
+
+
+ Runtime\.getRuntime\.addShutdownHook
+
+
+
+
+
+
+ mutable\.SynchronizedBuffer
+
+
+
+
+
+
+ Class\.forName
+
+
+
+
+
+
+ Await\.result
+
+
+
+
+
+
+ Await\.ready
+
+
+
+
+
+
+ (\.toUpperCase|\.toLowerCase)(?!(\(|\(Locale.ROOT\)))
+
+
+
+
+
+
+ throw new \w+Error\(
+
+
+
+
+
+
+
+ JavaConversions
+
+ Instead of importing implicits in scala.collection.JavaConversions._, import
+ scala.collection.JavaConverters._ and use .asScala / .asJava methods
+
+
+
+
+
+ org\.apache\.commons\.lang\.
+
+ Use Commons Lang 3 classes (package org.apache.commons.lang3.*) instead
+ of Commons Lang 2 (package org.apache.commons.lang.*)
+
+
+
+
+
+ FileSystem.get\([a-zA-Z_$][a-zA-Z_$0-9]*\)
+
+
+
+
+
+
+ extractOpt
+
+ Use jsonOption(x).map(.extract[T]) instead of .extractOpt[T], as the latter
+ is slower.
+
+
+
+
+
+ java,scala,3rdParty,kgreasoner
+ javax?\..*
+ scala\..*
+ (?!com\.antfin\.aikg\.kgreasoner\.).*
+ com\.antfin\.aikg\.kgreasoner\..*
+
+
+
+
+
+ COMMA
+
+
+
+
+
+
+ \)\{
+
+
+
+
+
+
+ (?m)^(\s*)/[*][*].*$(\r|)\n^\1 [*]
+
+ Use Javadoc style indentation for multiline comments
+
+
+
+
+ case[^\n>]*=>\s*\{
+
+ Omit braces in case clauses.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 800>
+
+
+
+
+
+
+ 30
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -1,0,1,2,3
+
+
+
+
+
+ Objects.toStringHelper
+
+ Avoid using Object.toStringHelper. Use ToStringBuilder instead.
+
+
diff --git a/app/api/http-client/src/main/java/com/antgroup/openspgapp/api/http/client/AccountServiceAntImpl.java b/app/api/http-client/src/main/java/com/antgroup/openspgapp/api/http/client/AccountServiceAntImpl.java
new file mode 100644
index 000000000..34d5117c0
--- /dev/null
+++ b/app/api/http-client/src/main/java/com/antgroup/openspgapp/api/http/client/AccountServiceAntImpl.java
@@ -0,0 +1,289 @@
+package com.antgroup.openspgapp.api.http.client;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alipay.sofa.common.utils.StringUtil;
+import com.antgroup.openspg.server.api.facade.Paged;
+import com.antgroup.openspg.server.api.http.client.account.AccountService;
+import com.antgroup.openspg.server.biz.common.AccountManager;
+import com.antgroup.openspg.server.common.model.account.Account;
+import com.antgroup.openspg.server.common.model.exception.IllegalParamsException;
+import com.antgroup.openspg.server.infra.dao.repository.common.convertor.AccountConvertor;
+import com.antgroup.openspgapp.common.util.utils.LoginCacheHelper;
+import com.antgroup.openspgapp.common.util.utils.LoginContextHelper;
+import com.antgroup.openspgapp.common.util.utils.SimpleHttpClient;
+import com.google.common.collect.Lists;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.StringUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Service;
+
+@ConditionalOnProperty(
+ name = {"env"},
+ havingValue = "ant")
+@Service
+/* loaded from: com.antgroup.openspgapp-api-http-client-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/api/http/client/AccountServiceAntImpl.class */
+public class AccountServiceAntImpl implements AccountService {
+ private static final Logger log = LoggerFactory.getLogger(AccountServiceAntImpl.class);
+
+ @Value("${hrorg.masterdata.clientId:}")
+ private String clientId;
+
+ @Value("${hrorg.masterdata.secret:}")
+ private String secret;
+
+ @Value("${webgw.domain.url:}")
+ private String webgwDomainUrl;
+
+ @Value("${webgw.appId:}")
+ private String webgwAppId;
+
+ @Value("${webgw.webgwSecret:}")
+ private String webgwSecret;
+
+ @Value("${web_request_url:}")
+ private String webRequestUrl;
+
+ @Value("${spring.application.name:antspg}")
+ private String appName;
+
+ @Value("${ant_buservice_domain_url:}")
+ private String domainUrl;
+
+ @Value("${ant_buservice_domain_url:}")
+ private String antbuserviceUrl;
+
+ @Autowired private AccountManager accountManager;
+ private static final String USER_SEARCH_URL =
+ "/hrorg/com.alibaba.masterdata.client.service.Employee360Service/search";
+ private static final String HEADER_WEBGW_APP_ID = "x-webgw-appId";
+ private static final String HEADER_WEBGW_VERSION = "x-webgw-version";
+ private static final String HEADER_WEBGW_SECRET = "x-webgw-secret";
+ private static final String HR_SEARCHKEY = "searchKey";
+ private static final String HR_CLIENTID = "clientId";
+ private static final String HR_SECRET = "secret";
+ private static final String WEBGW_VERSION = "2.0";
+
+ public Account getLoginUser() {
+ Account account;
+ Object object = LoginContextHelper.getUserFromCtx();
+ if (!(object instanceof Account) || (account = (Account) object) == null) {
+ return null;
+ }
+ Account kgAccount = getByUserNo(account.getWorkNo());
+ if (null == kgAccount && null != account && StringUtils.isNotBlank(account.getWorkNo())) {
+ String salt = this.accountManager.createSalt();
+ account.setSalt(salt);
+ Long stamp = Long.valueOf(System.currentTimeMillis());
+ String str = account.getWorkNo() + salt + stamp;
+ String token = this.accountManager.createToken(str);
+ account.setToken(token);
+ this.accountManager.create(account);
+ }
+ return account;
+ }
+
+ public List getAccountByKeyword(String keyword) {
+ if (StringUtils.isBlank(keyword)) {
+ return null;
+ }
+ try {
+ return getUserListByHrOrg(keyword);
+ } catch (Exception e) {
+ log.error("getAccountByKeyword exception: {}", e.getMessage());
+ return null;
+ }
+ }
+
+ public Account getByUserNo(String userNo) {
+ return this.accountManager.getByUserNo(userNo);
+ }
+
+ public Account getWithPrivateByUserNo(String userNo) {
+ return this.accountManager.getWithPrivateByUserNo(userNo);
+ }
+
+ public Integer create(Account account) {
+ throw new IllegalParamsException("only support public cloud", new Object[0]);
+ }
+
+ public Integer updatePassword(Account account) {
+ throw new IllegalParamsException("only support public cloud", new Object[0]);
+ }
+
+ public Integer deleteAccount(String workNo) {
+ throw new IllegalParamsException("only support public cloud", new Object[0]);
+ }
+
+ public Paged getAccountList(String account, Integer page, Integer size) {
+ throw new IllegalParamsException("only support public cloud", new Object[0]);
+ }
+
+ public String getSha256HexPassword(String password, String salt) {
+ return this.accountManager.getSha256HexPassword(password, salt);
+ }
+
+ public Account getCurrentAccount(Cookie[] cookies) throws IOException {
+ Account account;
+ String iamToken = getCookieValue(cookies, "IAM_TOKEN");
+ if (StringUtil.isNotBlank(iamToken)
+ && (account = (Account) LoginCacheHelper.getLocalLoginAccount(iamToken)) != null) {
+ return account;
+ }
+ List requestCookie = getCookiesFromRequest(cookies);
+ String cookie = getCookieParam(requestCookie);
+ Map headers = new HashMap<>();
+ headers.put("Cookie", cookie);
+ headers.put("Referer", this.webRequestUrl);
+ headers.put("Content-Type", "application/json");
+ String loginUrl = this.domainUrl + "/pub/getLoginUser.json?appName=" + this.appName;
+ SimpleHttpClient.HttpResult httpResult =
+ SimpleHttpClient.doGet(loginUrl, headers, (Map) null, StandardCharsets.UTF_8.name());
+ if (httpResult.isOk()) {
+ String data = httpResult.content;
+ JSONObject jsonObject = JSONObject.parseObject(data);
+ if (jsonObject.getBooleanValue("success")) {
+ JSONObject userData = jsonObject.getJSONObject("data");
+ Account account2 = new Account();
+ account2.setWorkNo(userData.getString("outUserNo"));
+ account2.setRealName(userData.getString("realName"));
+ account2.setNickName(userData.getString("nickName"));
+ account2.setAccount(userData.getString("operatorName"));
+ account2.setEmail(userData.getString("email"));
+ if (StringUtil.isNotBlank(iamToken)) {
+ LoginCacheHelper.putLocalLoginAccount(iamToken, account2);
+ }
+ return account2;
+ }
+ if ("USER_NOT_LOGIN".equals(jsonObject.getString("buserviceErrorCode"))) {
+ log.info("aclFilter account not login");
+ return null;
+ }
+ }
+ log.info("aclFilter.httpResult:{}", JSONObject.toJSONString(httpResult));
+ return null;
+ }
+
+ public boolean login(Account account, HttpServletResponse response) {
+ throw new IllegalParamsException("only support public cloud", new Object[0]);
+ }
+
+ public String logout(String workNo, String redirectUrl) {
+ String originalUrl =
+ this.antbuserviceUrl + "/pub/logout.htm?appName=" + this.appName + "&goto=gotoUrl";
+ if (StringUtils.isNotBlank(redirectUrl)) {
+ originalUrl = originalUrl.replace("gotoUrl", redirectUrl);
+ }
+ return originalUrl;
+ }
+
+ public int updateUserConfig(Account account, Cookie[] cookies) {
+ String iamToken = getCookieValue(cookies, "IAM_TOKEN");
+ if (StringUtil.isNotBlank(iamToken)) {
+ LoginCacheHelper.putLocalLoginAccount(iamToken, account);
+ }
+ account.setUseCurrentLanguage(AccountConvertor.getUseCurrentLanguage(account.getConfig()));
+ return this.accountManager.updateUserConfig(account.getWorkNo(), account.getConfig());
+ }
+
+ private List getUserListByHrOrg(String searchKey) throws Exception {
+ List dataList = Lists.newArrayList();
+ String url = this.webgwDomainUrl + USER_SEARCH_URL;
+ Map headers = new HashMap<>();
+ headers.put("Content-Type", "application/json;charset=UTF-8");
+ headers.put(HEADER_WEBGW_APP_ID, this.webgwAppId);
+ headers.put(HEADER_WEBGW_VERSION, WEBGW_VERSION);
+ headers.put(HEADER_WEBGW_SECRET, this.webgwSecret);
+ Map params = new HashMap<>();
+ params.put(HR_SEARCHKEY, searchKey);
+ params.put(HR_CLIENTID, this.clientId);
+ params.put(HR_SECRET, this.secret);
+ try {
+ SimpleHttpClient.HttpResult result =
+ SimpleHttpClient.doPost(
+ url, headers, JSON.toJSONString(params), StandardCharsets.UTF_8.name());
+ if (result.isOk()) {
+ JSONObject jsonObject = JSON.parseObject(result.content);
+ if (jsonObject.getBoolean("success").booleanValue()) {
+ JSONArray data = jsonObject.getJSONArray("result");
+ if (data == null || data.size() == 0) {
+ log.info("getUserListByHrOrg:{}", result.content);
+ return dataList;
+ }
+ for (int i = 0; i < data.size(); i++) {
+ JSONObject userObj = data.getJSONObject(i);
+ Account account = new Account();
+ account.setRealName(userObj.getString("name"));
+ account.setAccount(userObj.getString("loginAccount"));
+ account.setNickName(userObj.getString("nickName"));
+ account.setWorkNo(removeZeroPrefix(userObj.getString("workNo")));
+ account.setEmail(userObj.getString("buMail"));
+ dataList.add(account);
+ }
+ } else {
+ log.info("getUserListByHrOrg fail:{}", result.content);
+ throw new Exception("Hr search fail:" + result.content + "--" + searchKey);
+ }
+ }
+ return dataList;
+ } catch (Exception e) {
+ log.info("getUserListByHrOrg exception:{}", e.getMessage(), e);
+ throw new Exception("Hr search exception:", e);
+ }
+ }
+
+ public static String removeZeroPrefix(String userNo) {
+ if (StringUtils.isBlank(userNo)) {
+ return userNo;
+ }
+ if (!userNo.startsWith("0")) {
+ return userNo;
+ }
+ return userNo.replaceFirst("^0+", "");
+ }
+
+ private String getCookieValue(Cookie[] cookies, String key) {
+ if (cookies != null && StringUtils.isNotBlank(key)) {
+ for (Cookie cookie : cookies) {
+ if (key.equalsIgnoreCase(cookie.getName())) {
+ return cookie.getValue();
+ }
+ }
+ return null;
+ }
+ return null;
+ }
+
+ private List getCookiesFromRequest(Cookie[] cookies) {
+ List cookieList = new ArrayList<>();
+ if (cookies != null) {
+ for (Cookie cookie : cookies) {
+ cookieList.add(cookie.getName() + "=" + cookie.getValue());
+ }
+ }
+ return cookieList;
+ }
+
+ public static String getCookieParam(List cookies) {
+ StringBuilder cookieString = new StringBuilder();
+ for (String cookie : cookies) {
+ if (cookieString.length() > 0) {
+ cookieString.append("; ");
+ }
+ cookieString.append(cookie);
+ }
+ return cookieString.toString();
+ }
+}
diff --git a/app/api/http-client/src/main/java/com/antgroup/openspgapp/api/http/client/AccountServicePublicImpl.java b/app/api/http-client/src/main/java/com/antgroup/openspgapp/api/http/client/AccountServicePublicImpl.java
new file mode 100644
index 000000000..867a68a44
--- /dev/null
+++ b/app/api/http-client/src/main/java/com/antgroup/openspgapp/api/http/client/AccountServicePublicImpl.java
@@ -0,0 +1,174 @@
+package com.antgroup.openspgapp.api.http.client;
+
+import com.alipay.sofa.common.utils.StringUtil;
+import com.antgroup.openspg.server.api.facade.Paged;
+import com.antgroup.openspg.server.api.http.client.account.AccountService;
+import com.antgroup.openspg.server.biz.common.AccountManager;
+import com.antgroup.openspg.server.biz.common.PermissionManager;
+import com.antgroup.openspg.server.common.model.account.Account;
+import com.antgroup.openspg.server.common.model.exception.IllegalParamsException;
+import com.antgroup.openspg.server.infra.dao.repository.common.convertor.AccountConvertor;
+import com.antgroup.openspgapp.common.util.utils.AESUtils;
+import com.antgroup.openspgapp.common.util.utils.LoginCacheHelper;
+import com.antgroup.openspgapp.common.util.utils.LoginContextHelper;
+import java.io.IOException;
+import java.util.List;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.stereotype.Service;
+
+@ConditionalOnProperty(
+ name = {"env"},
+ havingValue = "public")
+@Service
+/* loaded from: com.antgroup.openspgapp-api-http-client-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/api/http/client/AccountServicePublicImpl.class */
+public class AccountServicePublicImpl implements AccountService {
+
+ @Autowired private AccountManager accountManager;
+
+ @Autowired private PermissionManager permissionManager;
+
+ public Account getLoginUser() {
+ Object object = LoginContextHelper.getUserFromCtx();
+ if (object instanceof Account) {
+ return (Account) object;
+ }
+ return null;
+ }
+
+ public List getAccountByKeyword(String keyword) {
+ if (StringUtils.isBlank(keyword)) {
+ return null;
+ }
+ return this.accountManager.query(keyword);
+ }
+
+ public Account getByUserNo(String userNo) {
+ return this.accountManager.getByUserNo(userNo);
+ }
+
+ public Account getWithPrivateByUserNo(String userNo) {
+ return this.accountManager.getWithPrivateByUserNo(userNo);
+ }
+
+ public Integer create(Account account) {
+ account.setWorkNo(account.getAccount());
+ account.setRealName(account.getAccount());
+ account.setNickName(account.getAccount());
+ if (account == null
+ || com.antgroup.openspg.common.util.StringUtils.isBlank(account.getWorkNo())) {
+ return 0;
+ }
+ String salt = this.accountManager.createSalt();
+ account.setSalt(salt);
+ account.setPassword(getSha256HexPassword(account.getPassword(), salt));
+ Long stamp = Long.valueOf(System.currentTimeMillis());
+ String str = account.getWorkNo() + salt + stamp;
+ String token = this.accountManager.createToken(str);
+ account.setToken(token);
+ return this.accountManager.create(account);
+ }
+
+ public Integer updatePassword(Account account) {
+ LoginCacheHelper.removeLocalLoginAccount(account.getWorkNo());
+ return this.accountManager.updatePassword(account);
+ }
+
+ public Integer deleteAccount(String workNo) {
+ LoginCacheHelper.removeLocalLoginAccount(workNo);
+ return this.accountManager.deleteAccount(workNo);
+ }
+
+ public Paged getAccountList(String account, Integer page, Integer size) {
+ return this.accountManager.getAccountList(account, page, size);
+ }
+
+ public String getSha256HexPassword(String password, String salt) {
+ return this.accountManager.getSha256HexPassword(password, salt);
+ }
+
+ public Account getCurrentAccount(Cookie[] cookies) throws IOException {
+ Account account;
+ String iamToken = getCookieValue(cookies, "OPEN_SPG_TOKEN");
+ if (com.antgroup.openspg.common.util.StringUtils.isBlank(iamToken)) {
+ return null;
+ }
+ String openSpgToken = AESUtils.decryptWithCTR(iamToken, "open_spg_token_secret");
+ if (!openSpgToken.contains(":")) {
+ return null;
+ }
+ String workNo = openSpgToken.split(":")[0];
+ if (StringUtil.isNotBlank(openSpgToken)
+ && (account = (Account) LoginCacheHelper.getLocalLoginAccount(workNo)) != null) {
+ return account;
+ }
+ String accessKey = openSpgToken.split(":")[1];
+ Account account2 = getWithPrivateByUserNo(workNo);
+ if (account2 == null) {
+ return null;
+ }
+ boolean isSuper = this.permissionManager.isSuper(account2.getWorkNo());
+ if (com.antgroup.openspg.common.util.StringUtils.equals(account2.getPassword(), accessKey)
+ || isSuper) {
+ account2.setPassword((String) null);
+ account2.setToken((String) null);
+ LoginCacheHelper.putLocalLoginAccount(account2.getWorkNo(), account2);
+ return account2;
+ }
+ return null;
+ }
+
+ public boolean login(Account account, HttpServletResponse response) {
+ Account accountInfo = getWithPrivateByUserNo(account.getAccount());
+ if (accountInfo == null) {
+ throw new IllegalParamsException("user or password error", new Object[0]);
+ }
+ String passwordSalt = getSha256HexPassword(account.getPassword(), accountInfo.getSalt());
+ if (!com.antgroup.openspg.common.util.StringUtils.equals(
+ passwordSalt, accountInfo.getPassword())) {
+ throw new IllegalParamsException("user or password error", new Object[0]);
+ }
+ String openSpgToken =
+ AESUtils.encryptWithCTR(
+ account.getAccount() + ":" + account.getPassword(), "open_spg_token_secret");
+ Cookie cookie = new Cookie("OPEN_SPG_TOKEN", openSpgToken);
+ cookie.setMaxAge(43200);
+ cookie.setPath("/");
+ cookie.setHttpOnly(true);
+ response.addCookie(cookie);
+ boolean isSuper = this.permissionManager.isSuper(accountInfo.getWorkNo());
+ boolean isPass = true;
+ if (accountInfo.getGmtCreate().getTime() == accountInfo.getGmtModified().getTime() && isSuper) {
+ isPass = false;
+ }
+ account.setPassword((String) null);
+ account.setToken((String) null);
+ LoginCacheHelper.putLocalLoginAccount(accountInfo.getWorkNo(), accountInfo);
+ return isPass;
+ }
+
+ public String logout(String workNo, String redirectUrl) {
+ return redirectUrl + "/#/login";
+ }
+
+ public int updateUserConfig(Account account, Cookie[] cookies) {
+ account.setUseCurrentLanguage(AccountConvertor.getUseCurrentLanguage(account.getConfig()));
+ LoginCacheHelper.putLocalLoginAccount(account.getWorkNo(), account);
+ return this.accountManager.updateUserConfig(account.getWorkNo(), account.getConfig());
+ }
+
+ private String getCookieValue(Cookie[] cookies, String key) {
+ if (cookies != null && com.antgroup.openspg.common.util.StringUtils.isNotBlank(key)) {
+ for (Cookie cookie : cookies) {
+ if (key.equalsIgnoreCase(cookie.getName())) {
+ return cookie.getValue();
+ }
+ }
+ return null;
+ }
+ return null;
+ }
+}
diff --git a/app/api/http-server/pom.xml b/app/api/http-server/pom.xml
new file mode 100644
index 000000000..6bfbbfda1
--- /dev/null
+++ b/app/api/http-server/pom.xml
@@ -0,0 +1,69 @@
+
+
+
+ 4.0.0
+
+ com.antgroup.openspg.app
+ app-parent
+ 0.0.1-SNAPSHOT
+ ../../pom.xml
+
+
+ app-api-http-server
+
+
+
+ com.antgroup.openspg.app
+ app-common-util
+
+
+ com.antgroup.openspg.app
+ app-biz-builder
+
+
+ com.antgroup.openspg.app
+ app-biz-common
+
+
+ com.antgroup.openspg.app
+ app-biz-reasoner
+
+
+ com.antgroup.openspg.app
+ app-biz-schema
+
+
+ com.antgroup.openspg.app
+ app-api-facade
+
+
+ com.antgroup.openspg.server
+ api-http-server
+
+
+ com.antgroup.openspg.server
+ biz-schema
+
+
+ com.antgroup.openspg.app
+ app-core-reasoner-model
+
+
+
+ org.springframework
+ spring-web
+
+
+
diff --git a/app/api/http-server/scalastyle-config.xml b/app/api/http-server/scalastyle-config.xml
new file mode 100644
index 000000000..a30c23f15
--- /dev/null
+++ b/app/api/http-server/scalastyle-config.xml
@@ -0,0 +1,459 @@
+
+
+
+
+
+ Scalastyle standard configuration
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ true
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ARROW, EQUALS, ELSE, TRY, CATCH, FINALLY, LARROW, RARROW
+
+
+
+
+
+ ARROW, EQUALS, COMMA, COLON, IF, ELSE, DO, WHILE, FOR, MATCH, TRY, CATCH, FINALLY, LARROW, RARROW
+
+
+
+
+
+
+
+
+
+
+ ^FunSuite[A-Za-z]*$
+
+ Tests must extend org.apache.spark.SparkFunSuite instead.
+
+
+
+
+
+ ^println$
+
+
+
+
+
+
+ spark(.sqlContext)?.sparkContext.hadoopConfiguration
+
+
+
+
+
+
+ @VisibleForTesting
+
+
+
+
+
+
+ Runtime\.getRuntime\.addShutdownHook
+
+
+
+
+
+
+ mutable\.SynchronizedBuffer
+
+
+
+
+
+
+ Class\.forName
+
+
+
+
+
+
+ Await\.result
+
+
+
+
+
+
+ Await\.ready
+
+
+
+
+
+
+ (\.toUpperCase|\.toLowerCase)(?!(\(|\(Locale.ROOT\)))
+
+
+
+
+
+
+ throw new \w+Error\(
+
+
+
+
+
+
+
+ JavaConversions
+
+ Instead of importing implicits in scala.collection.JavaConversions._, import
+ scala.collection.JavaConverters._ and use .asScala / .asJava methods
+
+
+
+
+
+ org\.apache\.commons\.lang\.
+
+ Use Commons Lang 3 classes (package org.apache.commons.lang3.*) instead
+ of Commons Lang 2 (package org.apache.commons.lang.*)
+
+
+
+
+
+ FileSystem.get\([a-zA-Z_$][a-zA-Z_$0-9]*\)
+
+
+
+
+
+
+ extractOpt
+
+ Use jsonOption(x).map(.extract[T]) instead of .extractOpt[T], as the latter
+ is slower.
+
+
+
+
+
+ java,scala,3rdParty,kgreasoner
+ javax?\..*
+ scala\..*
+ (?!com\.antfin\.aikg\.kgreasoner\.).*
+ com\.antfin\.aikg\.kgreasoner\..*
+
+
+
+
+
+ COMMA
+
+
+
+
+
+
+ \)\{
+
+
+
+
+
+
+ (?m)^(\s*)/[*][*].*$(\r|)\n^\1 [*]
+
+ Use Javadoc style indentation for multiline comments
+
+
+
+
+ case[^\n>]*=>\s*\{
+
+ Omit braces in case clauses.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 800>
+
+
+
+
+
+
+ 30
+
+
+
+
+
+
+ 10
+
+
+
+
+
+
+ 50
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -1,0,1,2,3
+
+
+
+
+
+ Objects.toStringHelper
+
+ Avoid using Object.toStringHelper. Use ToStringBuilder instead.
+
+
diff --git a/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/BaseController.java b/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/BaseController.java
new file mode 100644
index 000000000..f8261daf3
--- /dev/null
+++ b/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/BaseController.java
@@ -0,0 +1,17 @@
+package com.antgroup.openspgapp.api.http.server;
+
+import com.antgroup.openspg.server.api.http.client.account.AccountService;
+import com.antgroup.openspg.server.common.model.account.Account;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.RestController;
+
+@RestController
+/* loaded from: com.antgroup.openspgapp-api-http-server-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/api/http/server/BaseController.class */
+public class BaseController {
+
+ @Autowired public AccountService accountService;
+
+ public Account getLoginAccount() {
+ return this.accountService.getLoginUser();
+ }
+}
diff --git a/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/account/AccountController.java b/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/account/AccountController.java
new file mode 100644
index 000000000..20aefa7e1
--- /dev/null
+++ b/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/account/AccountController.java
@@ -0,0 +1,309 @@
+package com.antgroup.openspgapp.api.http.server.account;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.antgroup.openspg.common.util.StringUtils;
+import com.antgroup.openspg.common.util.enums.LanguageEnum;
+import com.antgroup.openspg.common.util.exception.SpgException;
+import com.antgroup.openspg.common.util.exception.message.SpgMessageEnum;
+import com.antgroup.openspg.server.api.facade.Paged;
+import com.antgroup.openspg.server.api.http.server.HttpBizCallback;
+import com.antgroup.openspg.server.api.http.server.HttpBizTemplate;
+import com.antgroup.openspg.server.api.http.server.HttpResult;
+import com.antgroup.openspg.server.biz.common.PermissionManager;
+import com.antgroup.openspg.server.biz.common.util.AssertUtils;
+import com.antgroup.openspg.server.common.model.account.Account;
+import com.antgroup.openspg.server.common.model.exception.IllegalParamsException;
+import com.antgroup.openspgapp.api.http.server.BaseController;
+import com.antgroup.openspgapp.common.util.utils.LoginCacheHelper;
+import com.antgroup.openspgapp.common.util.utils.LoginContextHelper;
+import java.io.IOException;
+import java.util.List;
+import java.util.regex.Pattern;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.bind.annotation.RestController;
+
+@RequestMapping({"v1/accounts"})
+@RestController
+/* loaded from: com.antgroup.openspgapp-api-http-server-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/api/http/server/account/AccountController.class */
+public class AccountController extends BaseController {
+
+ @Autowired private PermissionManager permissionManager;
+ private static final Pattern ACCOUNT_PATTERN = Pattern.compile("^[a-zA-Z0-9_]{6,20}$");
+
+ @GetMapping({"/"})
+ @ResponseBody
+ public HttpResult getAccount() {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.1
+ public void check() {}
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Account action() {
+ Account account = AccountController.this.getLoginAccount();
+ if (null == account || StringUtils.isBlank(account.getWorkNo())) {
+ AssertUtils.assertParamStringIsNotBlank("account", (String) null);
+ }
+ return account;
+ }
+ });
+ }
+
+ @GetMapping({"/{queryStr}"})
+ @ResponseBody
+ public HttpResult> fuzzySearchAccounts(@PathVariable final String queryStr) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback>() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.2
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("queryStr", queryStr);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public List action() {
+ return AccountController.this.accountService.getAccountByKeyword(queryStr);
+ }
+ });
+ }
+
+ @GetMapping({"/list"})
+ public HttpResult> getAccountList(
+ final String account, final Integer page, final Integer size) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback>() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.3
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("page", page);
+ AssertUtils.assertParamObjectIsNotNull("size", size);
+ AssertUtils.assertParamIsTrue("page > 0", page.intValue() > 0);
+ AssertUtils.assertParamIsTrue("size > 0", size.intValue() > 0);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Paged action() {
+ return AccountController.this.accountService.getAccountList(account, page, size);
+ }
+ });
+ }
+
+ @PostMapping
+ @ResponseBody
+ public HttpResult create(@RequestBody final Account request) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.4
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("account", request);
+ AssertUtils.assertParamStringIsNotBlank("account", request.getAccount());
+ AssertUtils.assertParamStringIsNotBlank("password", request.getPassword());
+ if (AccountController.ACCOUNT_PATTERN.matcher(request.getAccount()).matches()) {
+ AccountController.this.assertCurrentUserIsSuper();
+ Account account =
+ AccountController.this.accountService.getByUserNo(request.getAccount());
+ if (account != null) {
+ throw new IllegalParamsException("workNo already exists", new Object[0]);
+ }
+ return;
+ }
+ throw new IllegalParamsException(
+ "account length is 6-20, only support letters,numbers and underscores",
+ new Object[0]);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Integer action() {
+ return AccountController.this.accountService.create(request);
+ }
+ });
+ }
+
+ @PostMapping({"/updatePassword"})
+ @ResponseBody
+ public HttpResult updatePassword(@RequestBody final Account request) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.5
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("account", request);
+ if (StringUtils.isBlank(request.getWorkNo())) {
+ request.setWorkNo(AccountController.this.getLoginAccount().getWorkNo());
+ }
+ AssertUtils.assertParamStringIsNotBlank("password", request.getPassword());
+ AssertUtils.assertParamStringIsNotBlank(
+ "confirmPassword", request.getConfirmPassword());
+ if (!StringUtils.equals(request.getPassword(), request.getConfirmPassword())) {
+ throw new IllegalParamsException("Inconsistent password input", new Object[0]);
+ }
+ Account account =
+ AccountController.this.accountService.getWithPrivateByUserNo(request.getWorkNo());
+ if (account == null) {
+ throw new IllegalParamsException("account not exist", new Object[0]);
+ }
+ String password =
+ AccountController.this.accountService.getSha256HexPassword(
+ request.getPassword(), account.getSalt());
+ if (!StringUtils.equals(password, account.getPassword())) {
+ AccountController.this.assertCurrentUserIsSuper();
+ return;
+ }
+ throw new IllegalParamsException(
+ "The new password cannot be the same as the old password", new Object[0]);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Integer action() {
+ return AccountController.this.accountService.updatePassword(request);
+ }
+ });
+ }
+
+ @DeleteMapping({"/{workNo}"})
+ @ResponseBody
+ public HttpResult delete(@PathVariable final String workNo) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.6
+ public void check() {
+ AssertUtils.assertParamStringIsNotBlank("workNo", workNo);
+ AccountController.this.assertCurrentUserIsSuper();
+ if (AccountController.this.permissionManager.isSuper(workNo)) {
+ throw new IllegalParamsException(
+ "super administrator cannot be deleted", new Object[0]);
+ }
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Integer action() {
+ return AccountController.this.accountService.deleteAccount(workNo);
+ }
+ });
+ }
+
+ @GetMapping({"/getAccountByWorkNo"})
+ public HttpResult getAccountByWorkNo(final String workNo) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.7
+ public void check() {
+ AssertUtils.assertParamStringIsNotBlank("workNo", workNo);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Account action() {
+ return AccountController.this.accountService.getByUserNo(workNo);
+ }
+ });
+ }
+
+ /* JADX INFO: Access modifiers changed from: private */
+ public void assertCurrentUserIsSuper() {
+ String userNo = getLoginAccount().getWorkNo();
+ if (!this.permissionManager.isSuper(userNo)) {
+ throw new IllegalParamsException("only super administrator operation", new Object[0]);
+ }
+ }
+
+ @PostMapping({"/login"})
+ public HttpResult login(
+ final HttpServletRequest request,
+ final HttpServletResponse response,
+ @RequestBody final Account account) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.8
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("account", account);
+ AssertUtils.assertParamStringIsNotBlank("account", account.getAccount());
+ AssertUtils.assertParamStringIsNotBlank("password", account.getPassword());
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Boolean action() {
+ AccountController.this.cleanLoginInfo(request, response, account.getAccount());
+ return Boolean.valueOf(AccountController.this.accountService.login(account, response));
+ }
+ });
+ }
+
+ @GetMapping({"/logout"})
+ public HttpResult logout(
+ final HttpServletRequest request,
+ final HttpServletResponse response,
+ final String redirectUrl) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.9
+ public void check() {}
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public String action() {
+ String workNo = AccountController.this.getLoginAccount().getWorkNo();
+ AccountController.this.cleanLoginInfo(request, response, workNo);
+ return AccountController.this.accountService.logout(workNo, redirectUrl);
+ }
+ });
+ }
+
+ @PostMapping({"/updateUserConfig"})
+ @ResponseBody
+ public HttpResult updateUserConfig(
+ @RequestBody final Account account, final HttpServletRequest request) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.account.AccountController.10
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("account", account);
+ AssertUtils.assertParamStringIsNotBlank("config", account.getConfig());
+ JSONObject configJSON = JSON.parseObject(account.getConfig());
+ String useCurrentLanguage = configJSON.getString("useCurrentLanguage");
+ if (StringUtils.isNotBlank(useCurrentLanguage)
+ && LanguageEnum.getByCode(useCurrentLanguage) == null) {
+ throw new IllegalParamsException("language is not supported", new Object[0]);
+ }
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Integer action() {
+ try {
+ Account accountCache =
+ AccountController.this.accountService.getCurrentAccount(request.getCookies());
+ AssertUtils.assertParamObjectIsNotNull("account", accountCache);
+ accountCache.setConfig(account.getConfig());
+ return Integer.valueOf(
+ AccountController.this.accountService.updateUserConfig(
+ accountCache, request.getCookies()));
+ } catch (IOException e) {
+ throw new SpgException(e, SpgMessageEnum.LOGIN_USER_NOT_LOGIN);
+ }
+ }
+ });
+ }
+
+ /* JADX INFO: Access modifiers changed from: private */
+ public void cleanLoginInfo(
+ HttpServletRequest request, HttpServletResponse response, String workNo) {
+ LoginContextHelper.clearUserInCtx();
+ LoginCacheHelper.removeLocalLoginAccount(workNo);
+ Cookie[] cookies = request.getCookies();
+ if (ObjectUtils.isEmpty(cookies)) {
+ return;
+ }
+ for (Cookie cookie : cookies) {
+ cookie.setMaxAge(0);
+ cookie.setPath("/");
+ response.addCookie(cookie);
+ }
+ }
+}
diff --git a/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/builder/BuilderJobController.java b/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/builder/BuilderJobController.java
new file mode 100644
index 000000000..3351c6c4a
--- /dev/null
+++ b/app/api/http-server/src/main/java/com/antgroup/openspgapp/api/http/server/builder/BuilderJobController.java
@@ -0,0 +1,1000 @@
+package com.antgroup.openspgapp.api.http.server.builder;
+
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.fastjson.TypeReference;
+import com.alibaba.fastjson.parser.Feature;
+import com.alibaba.fastjson.serializer.SerializerFeature;
+import com.antgroup.openspg.builder.core.runtime.BuilderContext;
+import com.antgroup.openspg.builder.model.pipeline.Pipeline;
+import com.antgroup.openspg.builder.model.pipeline.PipelineUtils;
+import com.antgroup.openspg.builder.model.pipeline.config.Neo4jSinkNodeConfig;
+import com.antgroup.openspg.builder.model.record.ChunkRecord;
+import com.antgroup.openspg.builder.model.record.RecordAlterOperationEnum;
+import com.antgroup.openspg.builder.model.record.SubGraphRecord;
+import com.antgroup.openspg.builder.runner.local.physical.sink.impl.Neo4jSinkWriter;
+import com.antgroup.openspg.cloudext.interfaces.objectstorage.ObjectStorageClient;
+import com.antgroup.openspg.cloudext.interfaces.objectstorage.ObjectStorageClientDriverManager;
+import com.antgroup.openspg.common.util.CommonUtils;
+import com.antgroup.openspg.common.util.pemja.PemjaUtils;
+import com.antgroup.openspg.common.util.pemja.model.PemjaConfig;
+import com.antgroup.openspg.core.schema.model.type.BasicTypeEnum;
+import com.antgroup.openspg.core.schema.model.type.SPGTypeEnum;
+import com.antgroup.openspg.server.api.facade.Paged;
+import com.antgroup.openspg.server.api.http.server.HttpBizCallback;
+import com.antgroup.openspg.server.api.http.server.HttpBizTemplate;
+import com.antgroup.openspg.server.api.http.server.HttpResult;
+import com.antgroup.openspg.server.biz.common.ProjectManager;
+import com.antgroup.openspg.server.biz.common.util.AssertUtils;
+import com.antgroup.openspg.server.common.model.account.Account;
+import com.antgroup.openspg.server.common.model.bulider.BuilderJob;
+import com.antgroup.openspg.server.common.model.datasource.DataSource;
+import com.antgroup.openspg.server.common.model.exception.IllegalParamsException;
+import com.antgroup.openspg.server.common.model.project.Project;
+import com.antgroup.openspg.server.common.model.scheduler.SchedulerEnum;
+import com.antgroup.openspg.server.common.service.config.DefaultValue;
+import com.antgroup.openspg.server.common.service.datasource.meta.DataSourceMeta;
+import com.antgroup.openspg.server.common.service.datasource.meta.client.CloudDataSource;
+import com.antgroup.openspg.server.core.scheduler.model.query.SchedulerInstanceQuery;
+import com.antgroup.openspg.server.core.scheduler.model.query.SchedulerTaskQuery;
+import com.antgroup.openspg.server.core.scheduler.model.service.SchedulerInstance;
+import com.antgroup.openspg.server.core.scheduler.model.service.SchedulerJob;
+import com.antgroup.openspg.server.core.scheduler.model.service.SchedulerTask;
+import com.antgroup.openspg.server.core.scheduler.service.api.SchedulerService;
+import com.antgroup.openspg.server.core.scheduler.service.metadata.SchedulerTaskService;
+import com.antgroup.openspgapp.api.http.server.BaseController;
+import com.antgroup.openspgapp.biz.builder.BuilderJobManager;
+import com.antgroup.openspgapp.biz.reasoner.TaskManager;
+import com.antgroup.openspgapp.biz.schema.AppSchemaManager;
+import com.antgroup.openspgapp.biz.schema.dto.EntityTypeDTO;
+import com.antgroup.openspgapp.biz.schema.dto.ProjectSchemaDTO;
+import com.antgroup.openspgapp.biz.schema.dto.PropertyDTO;
+import com.antgroup.openspgapp.biz.schema.dto.RelationTypeDTO;
+import com.antgroup.openspgapp.common.util.enums.BuilderJobStatus;
+import com.antgroup.openspgapp.common.util.enums.BuilderJobType;
+import com.antgroup.openspgapp.core.reasoner.model.SubGraph;
+import com.antgroup.openspgapp.core.reasoner.model.task.Task;
+import com.antgroup.openspgapp.core.reasoner.model.task.result.Edge;
+import com.antgroup.openspgapp.core.reasoner.model.task.result.Node;
+import com.antgroup.openspgapp.core.reasoner.service.utils.Utils;
+import com.antgroup.openspgapp.server.api.facade.dto.Page;
+import com.antgroup.openspgapp.server.api.facade.dto.builder.BuilderJobSubGraphRequest;
+import com.antgroup.openspgapp.server.api.facade.dto.builder.WriterGraphRequest;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.common.collect.Lists;
+import java.io.File;
+import java.util.Collection;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import org.apache.commons.collections4.MapUtils;
+import org.apache.commons.io.FilenameUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.apache.commons.lang3.time.DateUtils;
+import org.apache.http.HttpEntity;
+import org.apache.http.client.methods.CloseableHttpResponse;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.impl.client.CloseableHttpClient;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.util.EntityUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.core.io.Resource;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.util.UriComponents;
+import org.springframework.web.util.UriComponentsBuilder;
+
+@RequestMapping({"/public/v1/builder/job"})
+@Controller
+/* loaded from: com.antgroup.openspgapp-api-http-server-0.0.1-SNAPSHOT.jar:com/antgroup/openspgapp/api/http/server/builder/BuilderJobController.class */
+public class BuilderJobController extends BaseController {
+ private static final Logger log = LoggerFactory.getLogger(BuilderJobController.class);
+ private static final String YU_QUE_REPOS = "/api/v2/repos/%s/%s/docs/%s";
+
+ @Autowired private BuilderJobManager builderJobManager;
+
+ @Autowired private TaskManager taskManager;
+
+ @Autowired private AppSchemaManager appSchemaManager;
+
+ @Autowired private DefaultValue value;
+
+ @Autowired private ProjectManager projectManager;
+
+ @Autowired private SchedulerService schedulerService;
+
+ @Autowired private SchedulerTaskService schedulerTaskService;
+
+ @Autowired private DataSourceMeta dataSourceMeta;
+
+ @RequestMapping(
+ value = {"/get"},
+ method = {RequestMethod.GET})
+ @ResponseBody
+ public HttpResult getById(final Long id) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.1
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("id", id);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public BuilderJob action() {
+ return BuilderJobController.this.builderJobManager.queryById(id);
+ }
+ });
+ }
+
+ @RequestMapping(
+ value = {"/list"},
+ method = {RequestMethod.GET})
+ @ResponseBody
+ public HttpResult>> list(
+ final Long projectId,
+ final String createUser,
+ final String keyword,
+ final Long start,
+ final Long limit) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback>>() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.2
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("start", start);
+ AssertUtils.assertParamObjectIsNotNull("limit", limit);
+ if (null == projectId
+ && StringUtils.isBlank(createUser)
+ && StringUtils.isBlank(keyword)) {
+ throw new IllegalParamsException(
+ "projectId and createUser and sessionId are all null", new Object[0]);
+ }
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Page> action() {
+ Page page = new Page(limit, start);
+ Paged data =
+ BuilderJobController.this.builderJobManager.query(
+ projectId,
+ createUser,
+ keyword,
+ Integer.valueOf(start.intValue()),
+ Integer.valueOf(limit.intValue()));
+ page.setData(data.getResults());
+ page.setTotal(data.getTotal());
+ return page;
+ }
+ });
+ }
+
+ @RequestMapping(
+ value = {"/submit"},
+ method = {RequestMethod.POST})
+ @ResponseBody
+ public HttpResult submit(@RequestBody final BuilderJob job) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.3
+ public void check() {
+ Project project =
+ BuilderJobController.this.projectManager.queryById(job.getProjectId());
+ JSONObject projectConfig = JSONObject.parseObject(project.getConfig());
+ Utils.checkVectorizer(BuilderJobController.this.value, projectConfig);
+ AssertUtils.assertParamObjectIsNotNull("BuilderJob", job);
+ AssertUtils.assertParamObjectIsNotNull("jobName", job.getJobName());
+ if (StringUtils.isNotBlank(job.getPipeline())) {
+ JSON.parseObject(job.getPipeline(), Pipeline.class);
+ }
+ String extension = job.getExtension();
+ JSONObject extractConfig = JSON.parseObject(extension).getJSONObject("extractConfig");
+ Utils.checkLLM(BuilderJobController.this.value, extractConfig);
+ if (SchedulerEnum.LifeCycle.PERIOD.name().equals(job.getLifeCycle())) {
+ String cron = StringUtils.isBlank(job.getCron()) ? "0 0 0 * * ?" : job.getCron();
+ job.setCron(cron);
+ AssertUtils.assertParamIsTrue("cron is Day Level", CommonUtils.isDayLevelCron(cron));
+ }
+ if ("odps".equalsIgnoreCase(job.getDataSourceType())) {
+ BuilderJobController.this.checkOdps(job);
+ }
+ if (BuilderJobType.YUQUE_EXTRACT.name().equalsIgnoreCase(job.getType())) {
+ JSONObject config = JSON.parseObject(extension).getJSONObject("yuqueConfig");
+ String yuQueUrl = config.getString("yuQueUrl");
+ AssertUtils.assertParamObjectIsNotNull("yuQueUrl", yuQueUrl);
+ String yuQueToken = config.getString("yuQueToken");
+ AssertUtils.assertParamObjectIsNotNull("yuQueToken", yuQueToken);
+ String[] paths = BuilderJobController.parseURL(yuQueUrl);
+ String url =
+ String.format(
+ BuilderJobController.this.value.getYuQueApiUrl()
+ + BuilderJobController.YU_QUE_REPOS,
+ paths[0],
+ paths[1],
+ paths[2]);
+ BuilderJobController.getYuqueApiData(yuQueToken, url);
+ job.setFileUrl(url);
+ } else if (StringUtils.isNotBlank(job.getFileUrl())) {
+ UriComponents uri = UriComponentsBuilder.fromUriString(job.getFileUrl()).build();
+ String fileExtension = FilenameUtils.getExtension(uri.getPath()).toLowerCase();
+ AssertUtils.assertParamIsTrue(
+ "file extension need .csv、.md、.txt、.json、.pdf、.doc、.docx ",
+ "csv".equals(fileExtension)
+ || "md".equals(fileExtension)
+ || "txt".equals(fileExtension)
+ || "json".equals(fileExtension)
+ || "pdf".equals(fileExtension)
+ || "doc".equals(fileExtension)
+ || "docx".equals(fileExtension));
+ }
+ if (job.getId() != null) {
+ BuilderJob old = BuilderJobController.this.builderJobManager.queryById(job.getId());
+ AssertUtils.assertParamObjectIsNotNull("query by id", old);
+ BuilderJobStatus status = BuilderJobStatus.valueOf(old.getStatus());
+ AssertUtils.assertParamIsTrue(
+ "Status is FINISH and cannot be edited", !BuilderJobStatus.FINISH.equals(status));
+ }
+ if (StringUtils.isBlank(job.getFileUrl())) {
+ job.setFileUrl(job.getJobName());
+ }
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public BuilderJob action() {
+ BuilderJob updateJob;
+ job.setGmtModified(new Date());
+ job.setStatus(BuilderJobStatus.RUNNING.name());
+ job.setVersion("V3");
+ if (StringUtils.isBlank(job.getPipeline())) {
+ Pipeline pipeline = PipelineUtils.getKagDefaultPipeline(job);
+ job.setPipeline(
+ JSON.toJSONString(
+ pipeline, new SerializerFeature[] {SerializerFeature.WriteClassName}));
+ }
+ if (job.getId() != null) {
+ BuilderJob old = BuilderJobController.this.builderJobManager.queryById(job.getId());
+ if (old.getTaskId() != null) {
+ BuilderJobController.this.schedulerService.deleteJob(
+ Long.valueOf(old.getTaskId().longValue()));
+ }
+ Account account = BuilderJobController.this.getLoginAccount();
+ String user = account != null ? account.getAccount() : "system";
+ job.setModifyUser(user);
+ BuilderJobController.this.builderJobManager.update(job);
+ updateJob = job;
+ } else {
+ job.setGmtCreate(new Date());
+ if (StringUtils.isBlank(job.getCreateUser())) {
+ Account account2 = BuilderJobController.this.getLoginAccount();
+ String user2 = account2 != null ? account2.getAccount() : "system";
+ job.setCreateUser(user2);
+ }
+ job.setModifyUser(job.getCreateUser());
+ if (StringUtils.isBlank(job.getType())) {
+ job.setType(BuilderJobType.FILE_EXTRACT.name());
+ }
+ if (StringUtils.isBlank(job.getComputingConf())) {
+ job.setComputingConf("{}");
+ }
+ if (StringUtils.isBlank(job.getDependence())) {
+ job.setDependence(SchedulerEnum.Dependence.INDEPENDENT.name());
+ }
+ updateJob = BuilderJobController.this.builderJobManager.submit(job);
+ }
+ SchedulerJob job2 = BuilderJobController.this.createSchedulerJob(updateJob);
+ BuilderJob taskJob = new BuilderJob();
+ taskJob.setId(updateJob.getId());
+ taskJob.setTaskId(job2.getId());
+ BuilderJobController.this.builderJobManager.update(taskJob);
+ return updateJob;
+ }
+ });
+ }
+
+ /* JADX INFO: Access modifiers changed from: private */
+ public void checkOdps(BuilderJob job) {
+ JSONObject extension = JSON.parseObject(job.getExtension());
+ JSONObject dataSourceConfig = extension.getJSONObject("dataSourceConfig");
+ DataSource dataSource =
+ (DataSource) JSON.parseObject(dataSourceConfig.getString("dataSource"), DataSource.class);
+ AssertUtils.assertParamObjectIsNotNull("odps dataSource", dataSource);
+ String project = dataSourceConfig.getString("database");
+ AssertUtils.assertParamObjectIsNotNull("odps project", project);
+ String table = dataSourceConfig.getString("table");
+ AssertUtils.assertParamObjectIsNotNull("odps table", table);
+ String partition = dataSourceConfig.getString("partition");
+ AssertUtils.assertParamObjectIsNotNull("odps partition", partition);
+ AssertUtils.assertParamIsTrue("partition contain *", !partition.contains("*"));
+ CloudDataSource source = CloudDataSource.toCloud(dataSource);
+ String dataSourceId = project + "." + table;
+ try {
+ boolean isPartitionTable =
+ this.dataSourceMeta.isPartitionTable(source, project, table).booleanValue();
+ if (!isPartitionTable) {
+ long recordCount =
+ this.dataSourceMeta
+ .getRecordCount(source, dataSourceId, partition, (String) null)
+ .longValue();
+ AssertUtils.assertParamIsTrue("odps table data size is not 0", recordCount > 0);
+ return;
+ }
+ if (SchedulerEnum.LifeCycle.ONCE.name().equals(job.getLifeCycle())) {
+ AssertUtils.assertParamIsTrue(
+ "odps partition exists",
+ this.dataSourceMeta
+ .hasPartition(source, dataSourceId, partition, (String) null)
+ .booleanValue());
+ long recordCount2 =
+ this.dataSourceMeta
+ .getRecordCount(source, dataSourceId, partition, (String) null)
+ .longValue();
+ AssertUtils.assertParamIsTrue("odps partition table data size is not 0", recordCount2 > 0);
+ }
+ if (SchedulerEnum.LifeCycle.PERIOD.name().equals(job.getLifeCycle())) {
+ AssertUtils.assertParamIsTrue(
+ "period job partition must contain $", partition.contains("$"));
+ Date preDate =
+ CommonUtils.getPreviousValidTime(job.getCron(), DateUtils.addDays(new Date(), -1));
+ String bizDate = CommonUtils.replacePartition(partition, preDate);
+ boolean hasPartition =
+ this.dataSourceMeta
+ .hasPartition(source, dataSourceId, partition, bizDate)
+ .booleanValue();
+ if (!hasPartition) {
+ bizDate =
+ CommonUtils.replacePartition(
+ partition, CommonUtils.getPreviousValidTime(job.getCron(), preDate));
+ hasPartition =
+ this.dataSourceMeta
+ .hasPartition(source, dataSourceId, partition, bizDate)
+ .booleanValue();
+ AssertUtils.assertParamIsTrue("period job odps previous partition exists", hasPartition);
+ }
+ if (hasPartition) {
+ this.dataSourceMeta.getRecordCount(source, dataSourceId, partition, bizDate);
+ }
+ }
+ } catch (Exception e) {
+ String message = ExceptionUtils.getStackTrace(e);
+ if (message.indexOf("Authorization Failed [4021]") > 0) {
+ new RuntimeException(
+ String.format(
+ "No %s table download permissions. stack trace:%s", project, e.getMessage()));
+ return;
+ }
+ if (message.indexOf("Authorization Failed [4002]") > 0) {
+ new RuntimeException(
+ String.format(
+ "No %s project read permission. Please add the ODPS account as a project member. stack trace:%s",
+ project, e.getMessage()));
+ return;
+ }
+ if (message.indexOf("Authorization Failed [4019]") > 0) {
+ new RuntimeException(
+ String.format(
+ "No %s table read permission. stack trace:%s", dataSourceId, e.getMessage()));
+ } else if (message.indexOf("Table not found") > 0) {
+ new RuntimeException(
+ String.format("%s table does not exist. stack trace:%s", dataSourceId, e.getMessage()));
+ } else {
+ new RuntimeException(
+ String.format("odps permission check exception. stack trace:%s", e.getMessage()));
+ }
+ }
+ }
+
+ public static String[] parseURL(String url) {
+ UriComponents uri = UriComponentsBuilder.fromUriString(url).build();
+ String path = uri.getPath();
+ String[] pathSegments = path.split("/");
+ String segment = pathSegments.length > 1 ? pathSegments[1] : "";
+ String segment1 = pathSegments.length > 2 ? pathSegments[2] : "";
+ String segment2 = pathSegments.length > 3 ? pathSegments[3] : "";
+ return new String[] {segment, segment1, segment2};
+ }
+
+ /* JADX INFO: Access modifiers changed from: private */
+ public SchedulerJob createSchedulerJob(BuilderJob taskJob) {
+ SchedulerJob job = new SchedulerJob();
+ job.setProjectId(taskJob.getProjectId());
+ job.setName(taskJob.getJobName());
+ job.setCreateUser(taskJob.getCreateUser());
+ job.setModifyUser(taskJob.getModifyUser());
+ job.setLifeCycle(SchedulerEnum.LifeCycle.valueOf(taskJob.getLifeCycle()));
+ job.setSchedulerCron(taskJob.getCron());
+ String extension = taskJob.getExtension();
+ JSONObject datasourceConfig = JSON.parseObject(extension).getJSONObject("dataSourceConfig");
+ Boolean structure =
+ (Boolean)
+ (datasourceConfig == null ? new JSONObject() : datasourceConfig)
+ .getOrDefault("structure", Boolean.FALSE);
+ JSONObject conf = JSON.parseObject(taskJob.getComputingConf());
+ String type = (String) conf.getOrDefault("computingType", "local");
+ String builderType = conf.getString("builderType");
+ SchedulerEnum.TranslateType translateType = SchedulerEnum.TranslateType.KAG_BUILDER;
+ if (!"local".equals(type)) {
+ translateType = SchedulerEnum.TranslateType.KAG_COMMAND_BUILDER;
+ } else if ("kag".equals(builderType)
+ || SchedulerEnum.LifeCycle.REAL_TIME.name().equalsIgnoreCase(taskJob.getLifeCycle())) {
+ translateType = SchedulerEnum.TranslateType.KAG_ENTIRETY_BUILDER;
+ } else if (structure.booleanValue()) {
+ translateType = SchedulerEnum.TranslateType.KAG_STRUCTURE_BUILDER;
+ }
+ job.setTranslateType(translateType);
+ job.setStatus(SchedulerEnum.Status.ENABLE);
+ job.setDependence(SchedulerEnum.Dependence.valueOf(taskJob.getDependence()));
+ job.setInvokerId(taskJob.getId().toString());
+ return this.schedulerService.submitJob(job);
+ }
+
+ @RequestMapping(
+ value = {"/delete"},
+ method = {RequestMethod.GET})
+ @ResponseBody
+ public HttpResult delete(final Long id) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.4
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("id", id);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Boolean action() {
+ BuilderJob job = BuilderJobController.this.builderJobManager.queryById(id);
+ if (job == null) {
+ return true;
+ }
+ BuilderJobStatus status = BuilderJobStatus.valueOf(job.getStatus());
+ if (BuilderJobStatus.FINISH.equals(status)) {
+ SubGraph graph = BuilderJobController.this.getSubGraph(job);
+ BuilderJobController.this.writerGraph(
+ new WriterGraphRequest(
+ graph, RecordAlterOperationEnum.DELETE.name(), job.getProjectId()));
+ }
+ if ("V3".equals(job.getVersion()) && job.getTaskId() != null) {
+ ObjectStorageClient objectStorageClient =
+ ObjectStorageClientDriverManager.getClient(
+ BuilderJobController.this.value.getObjectStorageUrl());
+ SchedulerInstanceQuery query = new SchedulerInstanceQuery();
+ query.setJobId(job.getTaskId());
+ List instances =
+ BuilderJobController.this.schedulerService.searchInstances(query).getResults();
+ for (SchedulerInstance instance : instances) {
+ String key =
+ CommonUtils.getInstanceStorageFileKey(
+ instance.getProjectId(), instance.getId());
+ objectStorageClient.removeDirectory(
+ BuilderJobController.this.value.getBuilderBucketName(), key);
+ }
+ BuilderJobController.this.schedulerService.deleteJob(job.getTaskId());
+ }
+ BuilderJobController.this.builderJobManager.delete(id);
+ return true;
+ }
+ });
+ }
+
+ /* JADX INFO: Access modifiers changed from: private */
+ public SubGraph getSubGraph(BuilderJob job) {
+ SubGraph graph = new SubGraph();
+ if ("V3".equals(job.getVersion())) {
+ SchedulerTaskQuery query = new SchedulerTaskQuery();
+ query.setJobId(job.getTaskId());
+ List tasks = this.schedulerTaskService.query(query).getResults();
+ List resultNodes = Lists.newArrayList();
+ List resultEdges = Lists.newArrayList();
+ ObjectStorageClient objectStorageClient =
+ ObjectStorageClientDriverManager.getClient(this.value.getObjectStorageUrl());
+ tasks.forEach(
+ schedulerTask -> {
+ if ("kagWriterAsyncTask".equalsIgnoreCase(schedulerTask.getType())
+ && StringUtils.isNotBlank(schedulerTask.getOutput())) {
+ try {
+ String data =
+ objectStorageClient.getString(
+ this.value.getBuilderBucketName(), schedulerTask.getOutput());
+ List subGraphs =
+ (List)
+ JSON.parseObject(
+ data,
+ new TypeReference>() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.5
+ },
+ new Feature[0]);
+ subGraphs.forEach(
+ subGraphRecord -> {
+ resultNodes.addAll(
+ (Collection)
+ JSON.parseObject(
+ JSON.toJSONString(subGraphRecord.getResultNodes()),
+ new TypeReference>() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.6
+ },
+ new Feature[0]));
+ resultEdges.addAll(
+ (Collection)
+ JSON.parseObject(
+ JSON.toJSONString(subGraphRecord.getResultEdges()),
+ new TypeReference>() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.7
+ },
+ new Feature[0]));
+ });
+ } catch (Exception e) {
+ log.error("get subGraphs Exception id:" + job.getId(), e);
+ }
+ }
+ });
+ graph.setResultNodes(resultNodes);
+ graph.setResultEdges(resultEdges);
+ } else {
+ Task task = this.taskManager.query(job.getTaskId());
+ graph.setResultNodes(task.getResultNodes());
+ graph.setResultEdges(task.getResultEdges());
+ }
+ return graph;
+ }
+
+ @RequestMapping(
+ value = {"/delete/subgraph"},
+ method = {RequestMethod.GET})
+ @ResponseBody
+ public HttpResult deleteSubgraph(final Long id) {
+ return HttpBizTemplate.execute2(
+ new HttpBizCallback() { // from class:
+ // com.antgroup.openspgapp.api.http.server.builder.BuilderJobController.8
+ public void check() {
+ AssertUtils.assertParamObjectIsNotNull("id", id);
+ }
+
+ /* renamed from: action, reason: merged with bridge method [inline-methods] */
+ public Boolean action() {
+ BuilderJob job = BuilderJobController.this.builderJobManager.queryById(id);
+ if (job != null) {
+ SubGraph graph = BuilderJobController.this.getSubGraph(job);
+ BuilderJobController.this.writerGraph(
+ new WriterGraphRequest(
+ graph, RecordAlterOperationEnum.DELETE.name(), job.getProjectId()));
+ BuilderJob taskJob = new BuilderJob();
+ taskJob.setId(id);
+ taskJob.setStatus(BuilderJobStatus.PENDING.name());
+ BuilderJobController.this.builderJobManager.update(taskJob);
+ return true;
+ }
+ return true;
+ }
+ });
+ }
+
+ @RequestMapping(
+ value = {"/download"},
+ method = {RequestMethod.GET})
+ public ResponseEntity download(String fileUrl) {
+ AssertUtils.assertParamObjectIsNotNull("fileUrl", fileUrl);
+ File file = new File(fileUrl);
+ HttpHeaders headers = new HttpHeaders();
+ headers.add("Content-Disposition", "attachment; filename=" + file.getName());
+ headers.add("Cache-Control", "no-cache, no-store, must-revalidate");
+ headers.add("Pragma", "no-cache");
+ headers.add("Expires", "0");
+ return ResponseEntity.ok()
+ .headers(headers)
+ .contentLength(file.length())
+ .contentType(MediaType.APPLICATION_OCTET_STREAM)
+ .body(new FileSystemResource(fileUrl));
+ }
+
+ @RequestMapping(
+ value = {"/writer/subgraph"},
+ method = {RequestMethod.POST})
+ @ResponseBody
+ public HttpResult