init
This commit is contained in:
@@ -4,13 +4,16 @@ import java.nio.ByteBuffer;
|
||||
|
||||
import com.alipay.sofa.jraft.Closure;
|
||||
import com.alipay.sofa.jraft.entity.Task;
|
||||
import com.google.gson.JsonObject;
|
||||
|
||||
import com.yuandian.dataflow.Server;
|
||||
import com.yuandian.dataflow.entity.Response;
|
||||
import com.yuandian.dataflow.statemachine.RaftClosure;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.apache.commons.lang.ObjectUtils.Null;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.ratis.thirdparty.org.checkerframework.common.reflection.qual.GetMethod;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
@@ -22,14 +25,16 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.alipay.sofa.jraft.Node;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
public class TaskLog {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(TaskLog.class);
|
||||
// private static final Logger log = LoggerFactory.getLogger(TaskLog.class);
|
||||
private static Node node = Server.GetNode();
|
||||
|
||||
@GetMapping(path = "/test")
|
||||
public ResponseEntity<String> greeting() {
|
||||
public ResponseEntity<Response> Processing(@RequestBody int status) {
|
||||
|
||||
Task task = new Task();
|
||||
|
||||
@@ -37,7 +42,7 @@ public class TaskLog {
|
||||
|
||||
|
||||
|
||||
LOG.error(node.toString());
|
||||
log.error(node.toString());
|
||||
|
||||
|
||||
|
||||
@@ -49,9 +54,18 @@ public class TaskLog {
|
||||
|
||||
|
||||
|
||||
JsonObject response = new JsonObject();
|
||||
response.addProperty("status", "success");
|
||||
response.addProperty("apply", "hello");
|
||||
return new ResponseEntity<String>(response.toString(), HttpStatus.OK);
|
||||
Response response = new Response();
|
||||
response.code = HttpStatus.OK;
|
||||
response.message = HttpStatus.OK.toString();
|
||||
return new ResponseEntity<Response>(response, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/test2")
|
||||
public ResponseEntity<Response> MongodbTest(@RequestBody int status) {
|
||||
|
||||
|
||||
|
||||
Response response = new Response();
|
||||
return new ResponseEntity<Response>(response, HttpStatus.OK);
|
||||
}
|
||||
}
|
||||
|
||||
48
src/main/java/com/yuandian/dataflow/entity/Doc.java
Normal file
48
src/main/java/com/yuandian/dataflow/entity/Doc.java
Normal file
@@ -0,0 +1,48 @@
|
||||
package com.yuandian.dataflow.entity;
|
||||
|
||||
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.bson.Document;
|
||||
import org.bson.codecs.pojo.annotations.BsonCreator;
|
||||
import org.bson.codecs.pojo.annotations.BsonDiscriminator;
|
||||
import org.bson.codecs.pojo.annotations.BsonProperty;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.util.JSONPObject;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
|
||||
|
||||
@BsonDiscriminator
|
||||
@Getter
|
||||
@Setter
|
||||
public final class Doc extends Document {
|
||||
|
||||
|
||||
|
||||
@JsonProperty("code")
|
||||
@BsonProperty("code")
|
||||
public int Code ;
|
||||
|
||||
@JsonProperty("ts")
|
||||
@BsonProperty("ts")
|
||||
public LocalDateTime TS;
|
||||
|
||||
@JsonProperty("desc")
|
||||
@BsonProperty("desc")
|
||||
public String Desc;
|
||||
|
||||
@JsonProperty("data")
|
||||
@BsonProperty("data")
|
||||
public Document Data;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
21
src/main/java/com/yuandian/dataflow/entity/Response.java
Normal file
21
src/main/java/com/yuandian/dataflow/entity/Response.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.yuandian.dataflow.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class Response {
|
||||
@JsonProperty("code")
|
||||
public HttpStatus code;
|
||||
@JsonProperty("message")
|
||||
public String message ;
|
||||
@JsonProperty("data")
|
||||
public Object data ;
|
||||
|
||||
|
||||
}
|
||||
@@ -1 +1,4 @@
|
||||
server.port=3440
|
||||
server.port=3440
|
||||
|
||||
|
||||
|
||||
|
||||
13
src/main/resources/logback.xml
Normal file
13
src/main/resources/logback.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<configuration>
|
||||
<appender name="CONSOLE"
|
||||
class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>
|
||||
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n
|
||||
</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
<root level="INFO">
|
||||
<appender-ref ref="CONSOLE" />
|
||||
</root>
|
||||
</configuration>
|
||||
Reference in New Issue
Block a user