更换用户注册机制,微调部分接口,新增coltroller类以及部分实体类

main
lensfrex 2 years ago
parent 9b92a98749
commit ee0dd0f05b
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 20
      API-Document.md
  2. 25
      pom.xml
  3. 4
      src/main/java/net/lensfrex/dscape/dao/PatientDataDao.java
  4. 2
      src/main/java/net/lensfrex/dscape/dao/mappers/PatientDataMapper.java
  5. 3
      src/main/java/net/lensfrex/dscape/domain/PatientData.java
  6. 48
      src/main/java/net/lensfrex/dscape/domain/response/Response.java
  7. 36
      src/main/java/net/lensfrex/dscape/domain/response/data/admin/CreateUserResponse.java
  8. 62
      src/main/java/net/lensfrex/dscape/domain/response/data/admin/UserRegisterApplicationResponseData.java
  9. 87
      src/main/java/net/lensfrex/dscape/domain/response/data/compute/ComputeHistoryReponseData.java
  10. 36
      src/main/java/net/lensfrex/dscape/domain/response/data/compute/ComputeStatusQueryResponse.java
  11. 26
      src/main/java/net/lensfrex/dscape/domain/response/data/compute/ComputeTaskResponseData.java
  12. 66
      src/main/java/net/lensfrex/dscape/domain/response/data/user/LoginResponseData.java
  13. 26
      src/main/java/net/lensfrex/dscape/domain/response/data/user/RegisterResponseData.java
  14. 19
      src/main/java/net/lensfrex/dscape/web/controllers/Error.java
  15. 23
      src/main/java/net/lensfrex/dscape/web/controllers/Index.java
  16. 24
      src/main/java/net/lensfrex/dscape/web/controllers/compute/Compute.java
  17. 26
      src/main/java/net/lensfrex/dscape/web/controllers/history/History.java
  18. 34
      src/main/java/net/lensfrex/dscape/web/controllers/user/User.java
  19. 37
      src/main/java/net/lensfrex/dscape/web/controllers/user/admin/Admin.java

@ -491,7 +491,7 @@
### 管理员获取待审批注册用户 ### 管理员获取待审批注册用户
- URL路径:`/user/admin/application/query?offset={offset}&limit={limit}&page={page}` - URL路径:`/user/admin/application/list?offset={offset}&limit={limit}&page={page}`
- 方法:`GET` - 方法:`GET`
- 请求参数: - 请求参数:
@ -528,20 +528,16 @@
"data" : [ "data" : [
{ {
"id": 64888, "id": 64888,
"pid": 2333, "uid": "9a6d777c-997d-a7e5-35f4-8471b7582ac0",
"ctdna": 209, "name": "lensfrex2",
"cpg": 5, "ip": "127.0.0.1",
"hcc": true,
"hcc_infer": true,
"time": "2022-07-10 08:00:00" "time": "2022-07-10 08:00:00"
}, },
{ {
"id": 648888, "id": 64889,
"pid": 23333, "uid": "9a6d777c-997d-a7e5-35f4-8471b7582ac1",
"ctdna": 209, "name": "lensfrex2",
"cpg": 5, "ip": "127.0.0.1",
"hcc": true,
"hcc_infer": true,
"time": "2022-07-10 08:00:00" "time": "2022-07-10 08:00:00"
}, },
// ... // ...

@ -32,6 +32,18 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jetty</artifactId>
<scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
@ -63,6 +75,19 @@
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
</dependency> </dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency> <dependency>
<groupId>commons-cli</groupId> <groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId> <artifactId>commons-cli</artifactId>

@ -1,9 +1,9 @@
/* /*
* Coded by lensfrex. * Class created by lensfrex.
*/ */
/* /*
* Coded by lensfrex. * Class created by lensfrex.
*/ */
package net.lensfrex.dscape.dao; package net.lensfrex.dscape.dao;

@ -1,5 +1,5 @@
/* /*
* Coded by lensfrex. * Class created by lensfrex.
*/ */
package net.lensfrex.dscape.dao.mappers; package net.lensfrex.dscape.dao.mappers;

@ -1,7 +1,10 @@
package net.lensfrex.dscape.domain; package net.lensfrex.dscape.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date; import java.util.Date;
@TableName("patient_data")
public class PatientData { public class PatientData {
/** /**

@ -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, "服务器内部错误....");
}
}

@ -11,25 +11,8 @@ import javax.annotation.Resource;
@RestController @RestController
public class Index { public class Index {
@RequestMapping("/")
@Resource public String index() {
private UserBasicMapper userBasicMapper; return "Wow~~~~~~~~~~~~~~~~~~~~~~";
@RequestMapping(value = "/", method = RequestMethod.GET)
public String returnIndexMessage() {
System.out.println("------test------");
// List<UserBasic> userBasicList = userBasicMapper.selectList(null);
UserBasic userBasic = new UserBasic();
userBasic.setUserName("lensfrex");
userBasic.setPassword("passwd");
userBasic.setUid("uid");
userBasic.setRole(UserRole.ADMIN);
System.out.println(userBasicMapper.insert(userBasic));
return "ヾ( ̄▽ ̄)";
} }
} }

@ -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…
Cancel
Save