parent
9b92a98749
commit
ee0dd0f05b
@ -0,0 +1,48 @@ |
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response; |
||||
|
||||
//@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class Response<T> { |
||||
private final int code; |
||||
private final String message; |
||||
private final T data; |
||||
|
||||
public Response(int code, String message, T data) { |
||||
this.code = code; |
||||
this.message = message; |
||||
this.data = data; |
||||
} |
||||
|
||||
public int getCode() { |
||||
return code; |
||||
} |
||||
|
||||
public String getMessage() { |
||||
return message; |
||||
} |
||||
|
||||
public T getData() { |
||||
return data; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
final StringBuffer sb = new StringBuffer("Response{"); |
||||
sb.append("code=").append(code); |
||||
sb.append(", message='").append(message).append('\''); |
||||
sb.append(", data=").append(data); |
||||
sb.append('}'); |
||||
return sb.toString(); |
||||
} |
||||
|
||||
public static<T> Response<T> success(T data) { |
||||
return new Response<>(20000, "success", data); |
||||
} |
||||
|
||||
public static Response<Object> error(int code, String message) { |
||||
return new Response<>(code, message, null); |
||||
} |
||||
} |
@ -0,0 +1,36 @@ |
||||
|
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.admin; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.Expose; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class CreateUserResponse { |
||||
|
||||
@Expose |
||||
private long role; |
||||
@Expose |
||||
private String uid; |
||||
|
||||
public long getRole() { |
||||
return role; |
||||
} |
||||
|
||||
public void setRole(long role) { |
||||
this.role = role; |
||||
} |
||||
|
||||
public String getUid() { |
||||
return uid; |
||||
} |
||||
|
||||
public void setUid(String uid) { |
||||
this.uid = uid; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,62 @@ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.admin; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.Expose; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class UserRegisterApplicationResponseData { |
||||
|
||||
@Expose |
||||
private long id; |
||||
@Expose |
||||
private String ip; |
||||
@Expose |
||||
private String name; |
||||
@Expose |
||||
private String time; |
||||
@Expose |
||||
private String uid; |
||||
|
||||
public long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getIp() { |
||||
return ip; |
||||
} |
||||
|
||||
public void setIp(String ip) { |
||||
this.ip = ip; |
||||
} |
||||
|
||||
public String getName() { |
||||
return name; |
||||
} |
||||
|
||||
public void setName(String name) { |
||||
this.name = name; |
||||
} |
||||
|
||||
public String getTime() { |
||||
return time; |
||||
} |
||||
|
||||
public void setTime(String time) { |
||||
this.time = time; |
||||
} |
||||
|
||||
public String getUid() { |
||||
return uid; |
||||
} |
||||
|
||||
public void setUid(String uid) { |
||||
this.uid = uid; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,87 @@ |
||||
|
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.compute; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.Expose; |
||||
import com.google.gson.annotations.SerializedName; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class ComputeHistoryReponseData { |
||||
|
||||
@Expose |
||||
private long cpg; |
||||
@Expose |
||||
private long ctdna; |
||||
@Expose |
||||
private Boolean hcc; |
||||
@SerializedName("hcc_infer") |
||||
private Boolean hccInfer; |
||||
@Expose |
||||
private long id; |
||||
@Expose |
||||
private long pid; |
||||
@Expose |
||||
private String time; |
||||
|
||||
public long getCpg() { |
||||
return cpg; |
||||
} |
||||
|
||||
public void setCpg(long cpg) { |
||||
this.cpg = cpg; |
||||
} |
||||
|
||||
public long getCtdna() { |
||||
return ctdna; |
||||
} |
||||
|
||||
public void setCtdna(long ctdna) { |
||||
this.ctdna = ctdna; |
||||
} |
||||
|
||||
public Boolean getHcc() { |
||||
return hcc; |
||||
} |
||||
|
||||
public void setHcc(Boolean hcc) { |
||||
this.hcc = hcc; |
||||
} |
||||
|
||||
public Boolean getHccInfer() { |
||||
return hccInfer; |
||||
} |
||||
|
||||
public void setHccInfer(Boolean hccInfer) { |
||||
this.hccInfer = hccInfer; |
||||
} |
||||
|
||||
public long getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(long id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public long getPid() { |
||||
return pid; |
||||
} |
||||
|
||||
public void setPid(long pid) { |
||||
this.pid = pid; |
||||
} |
||||
|
||||
public String getTime() { |
||||
return time; |
||||
} |
||||
|
||||
public void setTime(String time) { |
||||
this.time = time; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,36 @@ |
||||
|
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.compute; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.Expose; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class ComputeStatusQueryResponse { |
||||
|
||||
@Expose |
||||
private String id; |
||||
@Expose |
||||
private int status; |
||||
|
||||
public String getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public int getStatus() { |
||||
return status; |
||||
} |
||||
|
||||
public void setStatus(int status) { |
||||
this.status = status; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
|
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.compute; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.Expose; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class ComputeTaskResponseData { |
||||
|
||||
@Expose |
||||
private String id; |
||||
|
||||
public String getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,66 @@ |
||||
|
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.user; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.SerializedName; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class LoginResponseData { |
||||
|
||||
@SerializedName("access_token") |
||||
private String mAccessToken; |
||||
@SerializedName("expired") |
||||
private long mExpired; |
||||
@SerializedName("refresh_token") |
||||
private String mRefreshToken; |
||||
@SerializedName("role") |
||||
private long mRole; |
||||
@SerializedName("uid") |
||||
private String mUid; |
||||
|
||||
public String getAccessToken() { |
||||
return mAccessToken; |
||||
} |
||||
|
||||
public void setAccessToken(String accessToken) { |
||||
mAccessToken = accessToken; |
||||
} |
||||
|
||||
public long getExpired() { |
||||
return mExpired; |
||||
} |
||||
|
||||
public void setExpired(long expired) { |
||||
mExpired = expired; |
||||
} |
||||
|
||||
public String getRefreshToken() { |
||||
return mRefreshToken; |
||||
} |
||||
|
||||
public void setRefreshToken(String refreshToken) { |
||||
mRefreshToken = refreshToken; |
||||
} |
||||
|
||||
public long getRole() { |
||||
return mRole; |
||||
} |
||||
|
||||
public void setRole(long role) { |
||||
mRole = role; |
||||
} |
||||
|
||||
public String getUid() { |
||||
return mUid; |
||||
} |
||||
|
||||
public void setUid(String uid) { |
||||
mUid = uid; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,26 @@ |
||||
|
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.domain.response.data.user; |
||||
|
||||
import javax.annotation.Generated; |
||||
import com.google.gson.annotations.Expose; |
||||
|
||||
@Generated("net.hexar.json2pojo") |
||||
@SuppressWarnings("unused") |
||||
public class RegisterResponseData { |
||||
|
||||
@Expose |
||||
private String uid; |
||||
|
||||
public String getUid() { |
||||
return uid; |
||||
} |
||||
|
||||
public void setUid(String uid) { |
||||
this.uid = uid; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,19 @@ |
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.web.controllers; |
||||
|
||||
import net.lensfrex.dscape.domain.response.Response; |
||||
import org.springframework.web.bind.annotation.ControllerAdvice; |
||||
import org.springframework.web.bind.annotation.ExceptionHandler; |
||||
|
||||
@ControllerAdvice |
||||
public class Error extends AbstractMethodError { |
||||
|
||||
@ExceptionHandler({ RuntimeException.class }) |
||||
public Response error() { |
||||
return Response.error(50000, "服务器内部错误...."); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,24 @@ |
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.web.controllers.compute; |
||||
|
||||
import net.lensfrex.dscape.domain.response.Response; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
@RestController |
||||
@RequestMapping("/compute") |
||||
public class Compute { |
||||
@GetMapping(value = "/status/{tid}", produces = "application/json") |
||||
public Response status(@PathVariable String tid, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@PostMapping(value = "/add", produces = "application/json") |
||||
public Response addComputeTask(@RequestBody String body, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
} |
@ -0,0 +1,26 @@ |
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.web.controllers.history; |
||||
|
||||
import net.lensfrex.dscape.domain.response.Response; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
@RestController |
||||
@RequestMapping("/history") |
||||
public class History { |
||||
|
||||
@GetMapping(value = "/list/{uid}", produces = "application/json") |
||||
public Response list(@PathVariable String uid, |
||||
@RequestParam int offset, @RequestParam int limit, @RequestParam int page, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@RequestMapping(value = "/delete/{rid}", method = {RequestMethod.DELETE, RequestMethod.GET}, produces = "application/json") |
||||
public Response delete(@PathVariable int rid, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
} |
@ -0,0 +1,34 @@ |
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.web.controllers.user; |
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||
import net.lensfrex.dscape.domain.response.Response; |
||||
import net.lensfrex.dscape.domain.response.data.user.LoginResponseData; |
||||
import net.lensfrex.dscape.domain.response.data.user.RegisterResponseData; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
@JsonSerialize(using = ToStringSerializer.class) |
||||
@RestController |
||||
@RequestMapping("/user") |
||||
public class User { |
||||
|
||||
@PostMapping(value = "/login" , produces = "application/json") |
||||
public Response login(@RequestBody String body) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@PostMapping(value = "/register", produces = "application/json") |
||||
public Response register(@RequestBody String body) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@PostMapping(value = "/modifyPassword/{uid}", produces = "application/json") |
||||
public Response modifyPassword(@RequestBody String body, @PathVariable String uid, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
} |
@ -0,0 +1,37 @@ |
||||
/* |
||||
* Class created by lensfrex. |
||||
*/ |
||||
|
||||
package net.lensfrex.dscape.web.controllers.user.admin; |
||||
|
||||
import net.lensfrex.dscape.domain.response.Response; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
@RestController |
||||
@RequestMapping("/user/admin") |
||||
public class Admin { |
||||
@PostMapping(value = "/add", produces = "application/json") |
||||
public Response addUser(@RequestBody String body, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@PostMapping(value = "/modifyStatus/{uid}", produces = "application/json") |
||||
public Response modifyStatus(@RequestBody String body, @PathVariable String uid, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@GetMapping(value = "/application/list", produces = "application/json") |
||||
public Response listApplication( |
||||
@RequestParam String offset, @RequestParam String limit, @RequestParam String page, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
|
||||
@PostMapping(value = "/application/deal/{uid}", produces = "application/json") |
||||
public Response dealApplication(@RequestBody String body, @PathVariable String uid, |
||||
@RequestHeader String token) { |
||||
return Response.error(0, "Not implement"); |
||||
} |
||||
} |
Loading…
Reference in new issue