main
lensfrex 1 year ago
parent 4777fc11eb
commit 26aaad57cc
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 14
      backend-main/web/pom.xml
  2. 7
      common/src/main/java/cn/wustlinghang/wusthelper/rpc/util/EnumUtil.java
  3. 93
      sub-services/graduate/.flattened-pom.xml
  4. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/CookieApi.java
  5. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/CourseTableApi.java
  6. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/ScoreApi.java
  7. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/StudentInfoApi.java
  8. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/TrainingPlanApi.java
  9. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/BaseExceptionHandler.java
  10. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/DefaultExceptionHandler.java
  11. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/IOExceptionHandler.java
  12. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/ParseExceptionHandler.java
  13. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/RpcExceptionHandler.java
  14. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/ValidationExceptionHandler.java
  15. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/handler/WebApplicationExceptionHandler.java
  16. 4
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/interceptor/ResponseWrapperInterceptor.java
  17. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/exception/GraduateRpcException.java
  18. 2
      sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/LoginService.java
  19. 93
      sub-services/library/.flattened-pom.xml
  20. 29
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/BookCoverImageApi.java
  21. 21
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/BookDetailApi.java
  22. 4
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/CookieApi.java
  23. 25
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/CurrentLoanApi.java
  24. 26
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/LoanHistoryApi.java
  25. 48
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/OverdueSoonApi.java
  26. 50
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/SearchApi.java
  27. 2
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/BaseExceptionHandler.java
  28. 2
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/DefaultExceptionHandler.java
  29. 2
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/IOExceptionHandler.java
  30. 2
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/ParseExceptionHandler.java
  31. 2
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/RpcExceptionHandler.java
  32. 2
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/ValidationExceptionHandler.java
  33. 12
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/handler/WebApplicationExceptionHandler.java
  34. 4
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/interceptor/ResponseWrapperInterceptor.java
  35. 48
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/json/ExamActivitiesApi.java
  36. 52
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/json/ExamDelayApplicationApi.java
  37. 36
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/MywustParserBeans.java
  38. 35
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/MywustRequestAgentBeans.java
  39. 22
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/exception/LibraryRpcException.java
  40. 70
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoginService.java
  41. 131
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/ParseService.java
  42. 151
      sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/RequestAgentService.java
  43. 93
      sub-services/physics/.flattened-pom.xml
  44. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/CookieApi.java
  45. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/CourseTableApi.java
  46. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/ScoreApi.java
  47. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/BaseExceptionHandler.java
  48. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/DefaultExceptionHandler.java
  49. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/IOExceptionHandler.java
  50. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/ParseExceptionHandler.java
  51. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/RpcExceptionHandler.java
  52. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/ValidationExceptionHandler.java
  53. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/handler/WebApplicationExceptionHandler.java
  54. 4
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/interceptor/ResponseWrapperInterceptor.java
  55. 2
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/exception/PhysicsRpcException.java
  56. 4
      sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/LoginService.java
  57. 93
      sub-services/undergrad/.flattened-pom.xml
  58. 4
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/CookieApi.java
  59. 5
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/CourseTableApi.java
  60. 6
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/CreditStatusApi.java
  61. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/ExamActivitiesApi.java
  62. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/ExamDelayApplicationApi.java
  63. 5
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/ScoreApi.java
  64. 6
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/StudentInfoApi.java
  65. 6
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/TrainingPlanApi.java
  66. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/BaseExceptionHandler.java
  67. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/DefaultExceptionHandler.java
  68. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/IOExceptionHandler.java
  69. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/ParseExceptionHandler.java
  70. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/RpcExceptionHandler.java
  71. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/ValidationExceptionHandler.java
  72. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/handler/WebApplicationExceptionHandler.java
  73. 4
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/interceptor/ResponseWrapperInterceptor.java
  74. 50
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/json/StudentInfoApi.java
  75. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/exception/UndergradRpcException.java
  76. 2
      sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/LoginService.java

@ -15,6 +15,20 @@
<maven.compiler.source>17</maven.compiler.source> <maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target> <maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<springboot.version>3.1.1</springboot.version>
</properties> </properties>
<dependencyManagement>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${springboot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
</project> </project>

@ -0,0 +1,7 @@
package cn.wustlinghang.wusthelper.rpc.util;
public class EnumUtil {
public static <E extends Enum<E>> boolean equal(int value, Enum<E> e) {
return e.ordinal() == value;
}
}

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>graduate</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-core</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network-okhttp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>github</id>
<url>https://maven.pkg.github.com/LingHangStudio/mywust</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>3.1.3.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json; package cn.wustlinghang.wusthelper.internal.graduate.api.http;
import cn.wustlinghang.wusthelper.internal.graduate.services.LoginService; import cn.wustlinghang.wusthelper.internal.graduate.services.LoginService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json; package cn.wustlinghang.wusthelper.internal.graduate.api.http;
import cn.wustlinghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService; import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json; package cn.wustlinghang.wusthelper.internal.graduate.api.http;
import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService; import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json; package cn.wustlinghang.wusthelper.internal.graduate.api.http;
import cn.wustlinghang.mywust.data.global.StudentInfo; import cn.wustlinghang.mywust.data.global.StudentInfo;
import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService; import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json; package cn.wustlinghang.wusthelper.internal.graduate.api.http;
import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService; import cn.wustlinghang.wusthelper.internal.graduate.services.ParseService;
import cn.wustlinghang.wusthelper.internal.graduate.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.graduate.services.RequestAgentService;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.validation.ValidationException; import jakarta.validation.ValidationException;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.handler; package cn.wustlinghang.wusthelper.internal.graduate.api.http.handler;
import cn.wustlinghang.wusthelper.internal.graduate.exception.GraduateRpcException; import cn.wustlinghang.wusthelper.internal.graduate.exception.GraduateRpcException;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;

@ -1,6 +1,6 @@
package cn.wustlinghang.wusthelper.internal.graduate.api.json.interceptor; package cn.wustlinghang.wusthelper.internal.graduate.api.http.interceptor;
import cn.wustlinghang.wusthelper.internal.graduate.api.json.handler.BaseExceptionHandler; import cn.wustlinghang.wusthelper.internal.graduate.api.http.handler.BaseExceptionHandler;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.WebApplicationException;

@ -13,7 +13,7 @@ public class GraduateRpcException extends RpcException {
super(UNDERGRAD_MODULE, super(UNDERGRAD_MODULE,
typeCode.ordinal(), typeCode.ordinal(),
subModuleCode.ordinal() * 100 + errorCode.ordinal(), subModuleCode.ordinal() * 100 + errorCode.ordinal(),
new StringJoiner("-") new StringJoiner("/")
.add("GRADUATE") .add("GRADUATE")
.add(typeCode.name()) .add(typeCode.name())
.add(subModuleCode.name()) .add(subModuleCode.name())

@ -80,7 +80,7 @@ public class LoginService {
}; };
return new GraduateRpcException( return new GraduateRpcException(
GraduateRpcException.TypeCode.NETWORK_EXCEPTION, GraduateRpcException.TypeCode.AUTH_EXCEPTION,
GraduateRpcException.SubModuleCode.AUTH, GraduateRpcException.SubModuleCode.AUTH,
errorCode errorCode
); );

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>library</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-core</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network-okhttp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>github</id>
<url>https://maven.pkg.github.com/LingHangStudio/mywust</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>3.1.3.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>

@ -1,5 +1,6 @@
package cn.wustlinghang.wusthelper.internal.library.api.json; package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService; import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -10,36 +11,38 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
@Path("/credit_status") import java.util.List;
@Path("/cover_image")
@ApplicationScoped @ApplicationScoped
public class CreditStatusApi { public class BookCoverImageApi {
private final RequestAgentService agentService; private final RequestAgentService agentService;
private final ParseService parseService; private final ParseService parseService;
public CreditStatusApi(RequestAgentService agentService, public BookCoverImageApi(RequestAgentService agentService,
ParseService parseService) { ParseService parseService) {
this.agentService = agentService; this.agentService = agentService;
this.parseService = parseService; this.parseService = parseService;
} }
@GET @GET
@Path("/") @Path("/")
public String get(@QueryParam("cookie") @NotNull String cookie) public List<Score> get(@QueryParam("isbn") @NotNull String isbn)
throws RpcException { throws RpcException {
String html = this.agent(cookie); return this.parse(this.agent(isbn));
return this.parse(html);
} }
@GET @GET
@Path("/agent") @Path("/agent")
public String agent(@QueryParam("cookie") @NotNull String cookie) public String agent(@QueryParam("isbn") @NotNull String isbn)
throws RpcException { throws RpcException {
return agentService.getCreditStatus(cookie); return agentService.getBookCoverImageUrl(isbn);
} }
@POST @POST
@Path("/parse") @Path("/parse")
public String parse(String html) throws RpcException { public List<Score> parse(String html) throws RpcException {
return parseService.parseCreditStatus(html); // return parseService.parseScore(html);
return null;
} }
} }

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json; package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService; import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
@ -13,35 +13,36 @@ import jakarta.ws.rs.QueryParam;
import java.util.List; import java.util.List;
@Path("/score") @Path("/book_detail")
@ApplicationScoped @ApplicationScoped
public class ScoreApi { public class BookDetailApi {
private final RequestAgentService agentService; private final RequestAgentService agentService;
private final ParseService parseService; private final ParseService parseService;
public ScoreApi(RequestAgentService agentService, public BookDetailApi(RequestAgentService agentService,
ParseService parseService) { ParseService parseService) {
this.agentService = agentService; this.agentService = agentService;
this.parseService = parseService; this.parseService = parseService;
} }
@GET @GET
@Path("/") @Path("/")
public List<Score> get(@QueryParam("cookie") @NotNull String cookie) public List<Score> get(@QueryParam("isbn") @NotNull String isbn)
throws RpcException { throws RpcException {
return this.parse(this.agent(cookie)); return this.parse(this.agent(isbn));
} }
@GET @GET
@Path("/agent") @Path("/agent")
public String agent(@QueryParam("cookie") @NotNull String cookie) public String agent(@QueryParam("isbn") @NotNull String isbn)
throws RpcException { throws RpcException {
return agentService.getScore(cookie); return agentService.getBookCoverImageUrl(isbn);
} }
@POST @POST
@Path("/parse") @Path("/parse")
public List<Score> parse(String html) throws RpcException { public List<Score> parse(String html) throws RpcException {
return parseService.parseScore(html); // return parseService.parseScore(html);
return null;
} }
} }

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json; package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.wusthelper.internal.library.services.LoginService; import cn.wustlinghang.wusthelper.internal.library.services.LoginService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -19,7 +19,7 @@ public class CookieApi {
@Path("/") @Path("/")
public String login(@QueryParam("username") @NotNull String username, public String login(@QueryParam("username") @NotNull String username,
@QueryParam("password") @NotNull String password) throws RpcException { @QueryParam("password") @NotNull String password) throws RpcException {
return loginService.login(username, password, false); return loginService.login(username, password);
} }
@GET @GET

@ -1,6 +1,6 @@
package cn.wustlinghang.wusthelper.internal.library.api.json; package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService; import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -13,13 +13,13 @@ import jakarta.ws.rs.QueryParam;
import java.util.List; import java.util.List;
@Path("/course_table") @Path("/current_loan")
@ApplicationScoped @ApplicationScoped
public class CourseTableApi { public class CurrentLoanApi {
private final RequestAgentService agentService; private final RequestAgentService agentService;
private final ParseService parseService; private final ParseService parseService;
public CourseTableApi(RequestAgentService agentService, public CurrentLoanApi(RequestAgentService agentService,
ParseService parseService) { ParseService parseService) {
this.agentService = agentService; this.agentService = agentService;
this.parseService = parseService; this.parseService = parseService;
@ -27,23 +27,22 @@ public class CourseTableApi {
@GET @GET
@Path("/") @Path("/")
public List<Course> get(@QueryParam("cookie") @NotNull String cookie, public List<Score> get(@QueryParam("isbn") @NotNull String isbn)
@QueryParam("term") String term)
throws RpcException { throws RpcException {
return this.parse(this.agent(cookie, term)); return this.parse(this.agent(isbn));
} }
@GET @GET
@Path("/agent") @Path("/agent")
public String agent(@QueryParam("cookie") @NotNull String cookie, public String agent(@QueryParam("isbn") @NotNull String isbn)
@QueryParam("term") String term)
throws RpcException { throws RpcException {
return agentService.getCourseTable(cookie, term); return agentService.getBookCoverImageUrl(isbn);
} }
@POST @POST
@Path("/parse") @Path("/parse")
public List<Course> parse(String html) throws RpcException { public List<Score> parse(String html) throws RpcException {
return parseService.parseCourseTable(html); // return parseService.parseScore(html);
return null;
} }
} }

@ -1,5 +1,6 @@
package cn.wustlinghang.wusthelper.internal.library.api.json; package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService; import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -10,35 +11,38 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
@Path("/training_plan") import java.util.List;
@Path("/loan_history")
@ApplicationScoped @ApplicationScoped
public class TrainingPlanApi { public class LoanHistoryApi {
private final RequestAgentService agentService; private final RequestAgentService agentService;
private final ParseService parseService; private final ParseService parseService;
public TrainingPlanApi(RequestAgentService agentService, public LoanHistoryApi(RequestAgentService agentService,
ParseService parseService) { ParseService parseService) {
this.agentService = agentService; this.agentService = agentService;
this.parseService = parseService; this.parseService = parseService;
} }
@GET @GET
@Path("/") @Path("/")
public String get(@QueryParam("cookie") @NotNull String cookie) public List<Score> get(@QueryParam("isbn") @NotNull String isbn)
throws RpcException { throws RpcException {
return this.parse(this.agent(cookie)); return this.parse(this.agent(isbn));
} }
@GET @GET
@Path("/agent") @Path("/agent")
public String agent(@QueryParam("cookie") @NotNull String cookie) public String agent(@QueryParam("isbn") @NotNull String isbn)
throws RpcException { throws RpcException {
return agentService.getTrainingPlan(cookie); return agentService.getBookCoverImageUrl(isbn);
} }
@POST @POST
@Path("/parse") @Path("/parse")
public String parse(String html) throws RpcException { public List<Score> parse(String html) throws RpcException {
return parseService.parseTrainingPlan(html); // return parseService.parseScore(html);
return null;
} }
} }

@ -0,0 +1,48 @@
package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.util.List;
@Path("/overdue_soon")
@ApplicationScoped
public class OverdueSoonApi {
private final RequestAgentService agentService;
private final ParseService parseService;
public OverdueSoonApi(RequestAgentService agentService,
ParseService parseService) {
this.agentService = agentService;
this.parseService = parseService;
}
@GET
@Path("/")
public List<Score> get(@QueryParam("isbn") @NotNull String isbn)
throws RpcException {
return this.parse(this.agent(isbn));
}
@GET
@Path("/agent")
public String agent(@QueryParam("isbn") @NotNull String isbn)
throws RpcException {
return agentService.getBookCoverImageUrl(isbn);
}
@POST
@Path("/parse")
public List<Score> parse(String html) throws RpcException {
// return parseService.parseScore(html);
return null;
}
}

@ -0,0 +1,50 @@
package cn.wustlinghang.wusthelper.internal.library.api.http;
import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.util.List;
@Path("/search")
@ApplicationScoped
public class SearchApi {
private final RequestAgentService agentService;
private final ParseService parseService;
public SearchApi(RequestAgentService agentService,
ParseService parseService) {
this.agentService = agentService;
this.parseService = parseService;
}
@GET
@Path("/")
public List<Score> get(@QueryParam("isbn") @NotNull String isbn)
throws RpcException {
return this.parse(this.agent(isbn));
}
@GET
@Path("/agent")
public String agent(@QueryParam("keyword") @NotNull String keyword,
@QueryParam("page") @NotNull int page,
@QueryParam("page_size") @NotNull int pageSize)
throws RpcException {
return agentService.search(keyword, page, pageSize);
}
@POST
@Path("/parse")
public List<Score> parse(String html) throws RpcException {
// return parseService.parseScore(html);
return null;
}
}

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.validation.ValidationException; import jakarta.validation.ValidationException;

@ -1,6 +1,6 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.library.api.http.handler;
import cn.wustlinghang.wusthelper.internal.library.exception.UndergradRpcException; import cn.wustlinghang.wusthelper.internal.library.exception.LibraryRpcException;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.WebApplicationException;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;
@ -14,10 +14,10 @@ public class WebApplicationExceptionHandler extends BaseExceptionHandler impleme
return super.toResponse( return super.toResponse(
e.getResponse().getStatus(), e.getResponse().getStatus(),
RpcException.toIntCode( RpcException.toIntCode(
UndergradRpcException.UNDERGRAD_MODULE, LibraryRpcException.LIBRARY_MODULE,
UndergradRpcException.SubModuleCode.COMMON.ordinal(), LibraryRpcException.SubModuleCode.COMMON.ordinal(),
UndergradRpcException.TypeCode.OTHER_EXCEPTION.ordinal() * 100 LibraryRpcException.TypeCode.OTHER_EXCEPTION.ordinal() * 100
+ UndergradRpcException.ErrorCode.REQUEST_INVALID.ordinal() + LibraryRpcException.ErrorCode.REQUEST_INVALID.ordinal()
), ),
e.getMessage(), e.getMessage(),
"WebApplicationExceptionHandler" "WebApplicationExceptionHandler"

@ -1,6 +1,6 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.interceptor; package cn.wustlinghang.wusthelper.internal.library.api.http.interceptor;
import cn.wustlinghang.wusthelper.internal.physics.api.json.handler.BaseExceptionHandler; import cn.wustlinghang.wusthelper.internal.library.api.http.handler.BaseExceptionHandler;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.WebApplicationException;

@ -1,48 +0,0 @@
package cn.wustlinghang.wusthelper.internal.library.api.json;
import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradExamDelayApiService;
import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.util.List;
@Path("/exam_activities")
@ApplicationScoped
public class ExamActivitiesApi {
private final RequestAgentService agentService;
public ExamActivitiesApi(RequestAgentService agentService) {
this.agentService = agentService;
}
@GET
@Path("/")
public UndergradExamDelayApiService.ExamActivity[] get(
@QueryParam("cookie") @NotNull String cookie,
@QueryParam("term") @NotNull String term)
throws RpcException {
return this.agent(cookie, term);
}
@GET
@Path("/agent")
public UndergradExamDelayApiService.ExamActivity[] agent(
@QueryParam("cookie") @NotNull String cookie,
@QueryParam("term") @NotNull String term)
throws RpcException {
return agentService.getExamActivities(cookie, term);
}
@POST
@Path("/parse")
public List<Score> parse(String html) throws RpcException {
throw RpcException.ApiNotImplement();
}
}

@ -1,52 +0,0 @@
package cn.wustlinghang.wusthelper.internal.library.api.json;
import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.util.List;
@Path("/exam_delay_application")
@ApplicationScoped
public class ExamDelayApplicationApi {
private final RequestAgentService agentService;
private final ParseService parseService;
public ExamDelayApplicationApi(RequestAgentService agentService,
ParseService parseService) {
this.agentService = agentService;
this.parseService = parseService;
}
@GET
@Path("/")
public List<ExamDelayApplication> get(
@QueryParam("cookie") @NotNull String cookie,
@QueryParam("term") @NotNull String term,
@QueryParam("activity_id") @NotNull String activityId)
throws RpcException {
return this.parse(this.agent(cookie, term, activityId));
}
@GET
@Path("/agent")
public String agent(@QueryParam("cookie") @NotNull String cookie,
@QueryParam("term") @NotNull String term,
@QueryParam("activity_id") @NotNull String activityId)
throws RpcException {
return agentService.getExamDelayApplications(cookie, term, activityId);
}
@POST
@Path("/parse")
public List<ExamDelayApplication> parse(String html) throws RpcException {
return parseService.parseExamDelayApplications(html);
}
}

@ -1,36 +0,0 @@
package cn.wustlinghang.wusthelper.internal.library.bean;
import cn.wustlinghang.mywust.core.parser.undergraduate.*;
import jakarta.enterprise.context.ApplicationScoped;
public class MywustParserBeans {
@ApplicationScoped
public UndergradCourseTableParser undergradCourseTableParser() {
return new UndergradCourseTableParser();
}
@ApplicationScoped
public UndergradScoreParser undergradScoreParser() {
return new UndergradScoreParser();
}
@ApplicationScoped
public UndergradStudentInfoPageParser undergradStudentInfoPageParser() {
return new UndergradStudentInfoPageParser();
}
@ApplicationScoped
public UndergradTrainingPlanPageParser undergradTrainingPlanPageParser() {
return new UndergradTrainingPlanPageParser();
}
@ApplicationScoped
public UndergradCreditStatusParser undergradCreditStatusParser() {
return new UndergradCreditStatusParser();
}
@ApplicationScoped
public UndergradExamDelayParser undergradExamDelayParser() {
return new UndergradExamDelayParser();
}
}

@ -1,6 +1,8 @@
package cn.wustlinghang.wusthelper.internal.library.bean; package cn.wustlinghang.wusthelper.internal.library.bean;
import cn.wustlinghang.mywust.core.request.service.auth.LibraryLogin;
import cn.wustlinghang.mywust.core.request.service.auth.UndergraduateLogin; import cn.wustlinghang.mywust.core.request.service.auth.UndergraduateLogin;
import cn.wustlinghang.mywust.core.request.service.library.LibraryApiService;
import cn.wustlinghang.mywust.core.request.service.undergraduate.*; import cn.wustlinghang.mywust.core.request.service.undergraduate.*;
import cn.wustlinghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.wustlinghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
@ -27,37 +29,12 @@ public class MywustRequestAgentBeans {
} }
@Singleton @Singleton
public UndergraduateLogin undergraduateLogin(Requester requester) { public LibraryLogin libraryLogin(Requester requester) {
return new UndergraduateLogin(requester); return new LibraryLogin(requester);
} }
@Singleton @Singleton
public UndergradCourseTableApiService undergradCourseTableApiService(Requester requester) { public LibraryApiService libraryApiService(Requester requester) {
return new UndergradCourseTableApiService(requester); return new LibraryApiService(requester);
}
@Singleton
public UndergradScoreApiService undergradScoreApiService(Requester requester) {
return new UndergradScoreApiService(requester);
}
@Singleton
public UndergradStudentInfoApiService undergradStudentInfoApiService(Requester requester) {
return new UndergradStudentInfoApiService(requester);
}
@Singleton
public UndergradTrainingPlanApiService undergradTrainingPlanApiService(Requester requester) {
return new UndergradTrainingPlanApiService(requester);
}
@Singleton
public UndergradCreditStatusApiService undergradCreditStatusApiService(Requester requester) {
return new UndergradCreditStatusApiService(requester);
}
@Singleton
public UndergradExamDelayApiService undergradExamDelayApiService(Requester requester) {
return new UndergradExamDelayApiService(requester);
} }
} }

@ -4,17 +4,17 @@ import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import java.util.StringJoiner; import java.util.StringJoiner;
public class UndergradRpcException extends RpcException { public class LibraryRpcException extends RpcException {
public static final int UNDERGRAD_MODULE = 1; public static final int LIBRARY_MODULE = 3;
public UndergradRpcException(TypeCode typeCode, public LibraryRpcException(TypeCode typeCode,
SubModuleCode subModuleCode, SubModuleCode subModuleCode,
ErrorCode errorCode) { ErrorCode errorCode) {
super(UNDERGRAD_MODULE, super(LIBRARY_MODULE,
typeCode.ordinal(), typeCode.ordinal(),
subModuleCode.ordinal() * 100 + errorCode.ordinal(), subModuleCode.ordinal() * 100 + errorCode.ordinal(),
new StringJoiner("-") new StringJoiner("/")
.add("UNDERGRAD") .add("LIBRARY")
.add(typeCode.name()) .add(typeCode.name())
.add(subModuleCode.name()) .add(subModuleCode.name())
.add(errorCode.name()) .add(errorCode.name())
@ -42,8 +42,7 @@ public class UndergradRpcException extends RpcException {
* 子模块编码 * 子模块编码
*/ */
public enum SubModuleCode { public enum SubModuleCode {
COMMON, AUTH, COURSE_TABLE, CREDIT_STATUS, SCORE, COMMON, AUTH, PUBLIC_API, PERSONAL_API
STUDENT_INFO, TRAINING_PLAN, EXAM_ACTIVITIES, EXAM_DELAY_APPLICATION
} }
/** /**
@ -56,9 +55,6 @@ public class UndergradRpcException extends RpcException {
NETWORK_ERROR, NETWORK_ERROR,
PARSE_ERROR, PARSE_ERROR,
// 需要评教
NEED_EVALUATE,
AUTH_PASSWORD_WRONG, AUTH_PASSWORD_WRONG,
// 用户不存在 // 用户不存在
AUTH_USER_NOT_EXISTS, AUTH_USER_NOT_EXISTS,

@ -1,9 +1,9 @@
package cn.wustlinghang.wusthelper.internal.library.services; package cn.wustlinghang.wusthelper.internal.library.services;
import cn.wustlinghang.mywust.core.request.service.auth.UndergraduateLogin; import cn.wustlinghang.mywust.core.request.service.auth.LibraryLogin;
import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.wustlinghang.wusthelper.internal.library.exception.UndergradRpcException; import cn.wustlinghang.wusthelper.internal.library.exception.LibraryRpcException;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -13,65 +13,61 @@ import java.io.IOException;
@ApplicationScoped @ApplicationScoped
public class LoginService { public class LoginService {
private final RequestClientOption option; private final RequestClientOption option;
private final UndergraduateLogin undergraduateLogin; private final LibraryLogin libraryLogin;
public LoginService(RequestClientOption option, public LoginService(RequestClientOption option,
UndergraduateLogin undergraduateLogin) { LibraryLogin libraryLogin) {
this.option = option; this.option = option;
this.undergraduateLogin = undergraduateLogin; this.libraryLogin = libraryLogin;
} }
public String login(String username, String password, boolean legacy) throws UndergradRpcException { public String login(String username, String password) throws LibraryRpcException {
try { try {
if (legacy) { return libraryLogin.getLoginCookie(username, password, option);
return undergraduateLogin.getLoginCookieLegacy(username, password, option);
} else {
return undergraduateLogin.getLoginCookie(username, password, option);
}
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e); throw wrapApiException(e);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.AUTH, LibraryRpcException.SubModuleCode.AUTH,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
public boolean verify(String cookie) throws UndergradRpcException { public boolean verify(String cookie) throws LibraryRpcException {
try { try {
return !undergraduateLogin.checkCookiesFail(cookie); return libraryLogin.checkCookie(cookie, option);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.AUTH, LibraryRpcException.SubModuleCode.AUTH,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
private UndergradRpcException wrapApiException(ApiException e) { private LibraryRpcException wrapApiException(ApiException e) {
UndergradRpcException.ErrorCode errorCode = switch (e.getCode()) { LibraryRpcException.ErrorCode errorCode = switch (e.getCode()) {
case NETWORK_EXCEPTION -> UndergradRpcException.ErrorCode.NETWORK_ERROR; case NETWORK_EXCEPTION -> LibraryRpcException.ErrorCode.NETWORK_ERROR;
case UNI_LOGIN_PASSWORD_WRONG -> UndergradRpcException.ErrorCode.AUTH_PASSWORD_WRONG; case UNI_LOGIN_PASSWORD_WRONG -> LibraryRpcException.ErrorCode.AUTH_PASSWORD_WRONG;
case UNI_LOGIN_USER_NOT_EXISTS -> UndergradRpcException.ErrorCode.AUTH_USER_NOT_EXISTS; case UNI_LOGIN_USER_NOT_EXISTS -> LibraryRpcException.ErrorCode.AUTH_USER_NOT_EXISTS;
case UNI_LOGIN_USER_BANNED -> UndergradRpcException.ErrorCode.AUTH_USER_BANNED; case UNI_LOGIN_USER_BANNED -> LibraryRpcException.ErrorCode.AUTH_USER_BANNED;
case UNI_LOGIN_USER_DISABLED -> UndergradRpcException.ErrorCode.AUTH_USER_DISABLED; case UNI_LOGIN_USER_DISABLED -> LibraryRpcException.ErrorCode.AUTH_USER_DISABLED;
case UNI_LOGIN_NEED_CHANGE_PASSWORD -> UndergradRpcException.ErrorCode.AUTH_NEED_CHANGE_PASSWORD; case UNI_LOGIN_NEED_CHANGE_PASSWORD -> LibraryRpcException.ErrorCode.AUTH_NEED_CHANGE_PASSWORD;
case UNI_LOGIN_USER_NOT_ONLY -> UndergradRpcException.ErrorCode.AUTH_UNKNOWN_ERROR; case UNI_LOGIN_USER_NOT_ONLY -> LibraryRpcException.ErrorCode.AUTH_UNKNOWN_ERROR;
case UNI_LOGIN_NO_REGISTER -> UndergradRpcException.ErrorCode.AUTH_UNKNOWN_ERROR; case UNI_LOGIN_NO_REGISTER -> LibraryRpcException.ErrorCode.AUTH_UNKNOWN_ERROR;
case UNI_LOGIN_NEED_TFA -> UndergradRpcException.ErrorCode.AUTH_UNKNOWN_ERROR; case UNI_LOGIN_NEED_TFA -> LibraryRpcException.ErrorCode.AUTH_UNKNOWN_ERROR;
default -> { default -> {
log.error("本科生:登录代理请求异常,异常未处理"); log.error("图书馆:登录代理请求异常,异常未处理");
log.error("异常:", e); log.error("异常:", e);
yield UndergradRpcException.ErrorCode.AUTH_UNKNOWN_ERROR; yield LibraryRpcException.ErrorCode.AUTH_UNKNOWN_ERROR;
} }
}; };
return new UndergradRpcException( return new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.AUTH_EXCEPTION,
UndergradRpcException.SubModuleCode.AUTH, LibraryRpcException.SubModuleCode.AUTH,
errorCode errorCode
); );
} }

@ -1,131 +0,0 @@
package cn.wustlinghang.wusthelper.internal.library.services;
import cn.wustlinghang.mywust.core.parser.undergraduate.*;
import cn.wustlinghang.mywust.data.global.Course;
import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.mywust.data.global.StudentInfo;
import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication;
import cn.wustlinghang.wusthelper.internal.library.exception.UndergradRpcException;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped;
import java.util.List;
@ApplicationScoped
public class ParseService {
private final UndergradCourseTableParser courseTableParser;
private final UndergradScoreParser scoreParser;
private final UndergradStudentInfoPageParser studentInfoPageParser;
private final UndergradTrainingPlanPageParser trainingPlanPageParser;
private final UndergradCreditStatusParser creditStatusParser;
private final UndergradExamDelayParser examDelayParser;
public ParseService(UndergradCourseTableParser courseTableParser,
UndergradScoreParser scoreParser,
UndergradStudentInfoPageParser studentInfoPageParser,
UndergradTrainingPlanPageParser trainingPlanPageParser,
UndergradCreditStatusParser creditStatusParser,
UndergradExamDelayParser examDelayParser) {
this.courseTableParser = courseTableParser;
this.scoreParser = scoreParser;
this.studentInfoPageParser = studentInfoPageParser;
this.trainingPlanPageParser = trainingPlanPageParser;
this.creditStatusParser = creditStatusParser;
this.examDelayParser = examDelayParser;
}
public List<Course> parseCourseTable(String data) throws UndergradRpcException {
try {
if (data.contains("评教")) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.COURSE_TABLE,
UndergradRpcException.ErrorCode.NEED_EVALUATE
);
}
return courseTableParser.parse(data);
} catch (UndergradRpcException e) {
throw e;
} catch (Exception e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.COURSE_TABLE,
UndergradRpcException.ErrorCode.PARSE_ERROR
);
}
}
public List<Score> parseScore(String data) throws RpcException {
try {
if (data.contains("评教")) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.SCORE,
UndergradRpcException.ErrorCode.NEED_EVALUATE
);
}
return scoreParser.parse(data);
} catch (UndergradRpcException e) {
throw e;
} catch (Exception e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.SCORE,
UndergradRpcException.ErrorCode.PARSE_ERROR
);
}
}
public StudentInfo parseStudentInfo(String data) throws RpcException {
try {
return studentInfoPageParser.parse(data);
} catch (Exception e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.STUDENT_INFO,
UndergradRpcException.ErrorCode.PARSE_ERROR
);
}
}
public String parseTrainingPlan(String data) throws RpcException {
try {
return trainingPlanPageParser.parse(data);
} catch (Exception e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.TRAINING_PLAN,
UndergradRpcException.ErrorCode.PARSE_ERROR
);
}
}
public String parseCreditStatus(String data) throws RpcException {
try {
return creditStatusParser.parse(data);
} catch (Exception e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.CREDIT_STATUS,
UndergradRpcException.ErrorCode.PARSE_ERROR
);
}
}
public List<ExamDelayApplication> parseExamDelayApplications(String data) throws RpcException {
try {
return examDelayParser.parse(data);
} catch (Exception e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.PARSE_EXCEPTION,
UndergradRpcException.SubModuleCode.EXAM_DELAY_APPLICATION,
UndergradRpcException.ErrorCode.PARSE_ERROR
);
}
}
}

@ -1,9 +1,9 @@
package cn.wustlinghang.wusthelper.internal.library.services; package cn.wustlinghang.wusthelper.internal.library.services;
import cn.wustlinghang.mywust.core.request.service.undergraduate.*; import cn.wustlinghang.mywust.core.request.service.library.LibraryApiService;
import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.wustlinghang.wusthelper.internal.library.exception.UndergradRpcException; import cn.wustlinghang.wusthelper.internal.library.exception.LibraryRpcException;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -13,152 +13,115 @@ import java.io.IOException;
@Slf4j @Slf4j
@ApplicationScoped @ApplicationScoped
public class RequestAgentService { public class RequestAgentService {
private final UndergradCourseTableApiService courseTableApiService; private final LibraryApiService libraryApiService;
private final UndergradScoreApiService scoreApiService;
private final UndergradStudentInfoApiService studentInfoApiService;
private final UndergradTrainingPlanApiService trainingPlanApiService;
private final UndergradCreditStatusApiService creditStatusApiService;
private final UndergradExamDelayApiService examDelayApiService;
private final RequestClientOption requestClientOption; public RequestAgentService(LibraryApiService libraryApiService) {
this.libraryApiService = libraryApiService;
public RequestAgentService(UndergradCourseTableApiService courseTableApiService,
UndergradScoreApiService scoreApiService,
UndergradStudentInfoApiService studentInfoApiService,
UndergradTrainingPlanApiService trainingPlanApiService,
UndergradCreditStatusApiService creditStatusApiService,
UndergradExamDelayApiService examDelayApiService,
RequestClientOption requestClientOption) {
this.courseTableApiService = courseTableApiService;
this.scoreApiService = scoreApiService;
this.studentInfoApiService = studentInfoApiService;
this.trainingPlanApiService = trainingPlanApiService;
this.creditStatusApiService = creditStatusApiService;
this.examDelayApiService = examDelayApiService;
this.requestClientOption = requestClientOption;
}
public String getStudentInfoPage(String cookie) throws RpcException {
try {
return studentInfoApiService.getPage(cookie);
} catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.STUDENT_INFO);
} catch (IOException e) {
throw new UndergradRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.STUDENT_INFO,
UndergradRpcException.ErrorCode.NETWORK_ERROR
);
}
} }
public String getCourseTable(String cookie, String term) throws RpcException { public String getBookCoverImageUrl(String isbn) throws RpcException {
try { try {
return courseTableApiService.getPage(term, cookie); return libraryApiService.getBookCoverImageUrl(isbn);
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.COURSE_TABLE); throw wrapApiException(e, LibraryRpcException.SubModuleCode.PUBLIC_API);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.COURSE_TABLE, LibraryRpcException.SubModuleCode.PUBLIC_API,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
public String getScore(String cookie) throws RpcException { public String getBookDetail(String bookId) throws RpcException {
try { try {
return scoreApiService.getPage(cookie); return libraryApiService.getBookDetail(bookId);
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.SCORE); throw wrapApiException(e, LibraryRpcException.SubModuleCode.PUBLIC_API);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.SCORE, LibraryRpcException.SubModuleCode.PUBLIC_API,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
public String getTrainingPlan(String cookie) throws RpcException { public String getCurrentLoan(String cookie) throws RpcException {
try { try {
return trainingPlanApiService.getPage(cookie); return libraryApiService.getCurrentLoan(cookie);
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.TRAINING_PLAN); throw wrapApiException(e, LibraryRpcException.SubModuleCode.PERSONAL_API);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.TRAINING_PLAN, LibraryRpcException.SubModuleCode.PERSONAL_API,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
public String getCreditStatus(String cookie) throws RpcException { public String search(String keyword, int page, int pageSize) throws RpcException {
try { try {
return creditStatusApiService.getPage(cookie, requestClientOption, false); return libraryApiService.search(keyword, page, pageSize);
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.CREDIT_STATUS); throw wrapApiException(e, LibraryRpcException.SubModuleCode.PUBLIC_API);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.CREDIT_STATUS, LibraryRpcException.SubModuleCode.PUBLIC_API,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
public UndergradExamDelayApiService.ExamActivity[] getExamActivities(String cookie, String term) public String getLoanHistory(String cookie) throws RpcException {
throws RpcException {
try { try {
return examDelayApiService.getActivities(term, cookie); return libraryApiService.getLoanHistory(cookie);
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.EXAM_ACTIVITIES); throw wrapApiException(e, LibraryRpcException.SubModuleCode.PERSONAL_API);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.EXAM_ACTIVITIES, LibraryRpcException.SubModuleCode.PERSONAL_API,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
public String getExamDelayApplications(String cookie, String term, String activityId) public String getOverdueSoon(String cookie) throws RpcException {
throws RpcException {
try { try {
return examDelayApiService.getPage(term, activityId, cookie); return libraryApiService.getOverdueSoon(cookie);
} catch (ApiException e) { } catch (ApiException e) {
throw wrapApiException(e, UndergradRpcException.SubModuleCode.EXAM_DELAY_APPLICATION); throw wrapApiException(e, LibraryRpcException.SubModuleCode.PERSONAL_API);
} catch (IOException e) { } catch (IOException e) {
throw new UndergradRpcException( throw new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
UndergradRpcException.SubModuleCode.EXAM_DELAY_APPLICATION, LibraryRpcException.SubModuleCode.PERSONAL_API,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
} }
} }
private UndergradRpcException wrapApiException(ApiException e, UndergradRpcException.SubModuleCode subModuleCode) { private LibraryRpcException wrapApiException(ApiException e, LibraryRpcException.SubModuleCode subModuleCode) {
return switch (e.getCode()) { return switch (e.getCode()) {
case NETWORK_EXCEPTION -> new UndergradRpcException( case NETWORK_EXCEPTION -> new LibraryRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, LibraryRpcException.TypeCode.NETWORK_EXCEPTION,
subModuleCode, subModuleCode,
UndergradRpcException.ErrorCode.NETWORK_ERROR LibraryRpcException.ErrorCode.NETWORK_ERROR
); );
case COOKIE_INVALID -> new UndergradRpcException( case COOKIE_INVALID -> new LibraryRpcException(
UndergradRpcException.TypeCode.AUTH_EXCEPTION, LibraryRpcException.TypeCode.AUTH_EXCEPTION,
subModuleCode, subModuleCode,
UndergradRpcException.ErrorCode.COOKIE_INVALID LibraryRpcException.ErrorCode.COOKIE_INVALID
); );
default -> { default -> {
log.error("本科生:{}代理请求异常,异常未处理", subModuleCode.name()); log.error("本科生:{}代理请求异常,异常未处理", subModuleCode.name());
log.error("异常:", e); log.error("异常:", e);
yield new UndergradRpcException( yield new LibraryRpcException(
UndergradRpcException.TypeCode.AUTH_EXCEPTION, LibraryRpcException.TypeCode.AUTH_EXCEPTION,
subModuleCode, subModuleCode,
UndergradRpcException.ErrorCode.COOKIE_INVALID LibraryRpcException.ErrorCode.COOKIE_INVALID
); );
} }
}; };

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>physics</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-core</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network-okhttp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>github</id>
<url>https://maven.pkg.github.com/LingHangStudio/mywust</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>3.1.3.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json; package cn.wustlinghang.wusthelper.internal.physics.api.http;
import cn.wustlinghang.wusthelper.internal.physics.services.LoginService; import cn.wustlinghang.wusthelper.internal.physics.services.LoginService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json; package cn.wustlinghang.wusthelper.internal.physics.api.http;
import cn.wustlinghang.mywust.data.physics.PhysicsCourse; import cn.wustlinghang.mywust.data.physics.PhysicsCourse;
import cn.wustlinghang.wusthelper.internal.physics.services.ParseService; import cn.wustlinghang.wusthelper.internal.physics.services.ParseService;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json; package cn.wustlinghang.wusthelper.internal.physics.api.http;
import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.wusthelper.internal.physics.services.ParseService; import cn.wustlinghang.wusthelper.internal.physics.services.ParseService;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.validation.ValidationException; import jakarta.validation.ValidationException;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.physics.api.json.handler; package cn.wustlinghang.wusthelper.internal.physics.api.http.handler;
import cn.wustlinghang.wusthelper.internal.physics.exception.PhysicsRpcException; import cn.wustlinghang.wusthelper.internal.physics.exception.PhysicsRpcException;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;

@ -1,6 +1,6 @@
package cn.wustlinghang.wusthelper.internal.library.api.json.interceptor; package cn.wustlinghang.wusthelper.internal.physics.api.http.interceptor;
import cn.wustlinghang.wusthelper.internal.library.api.json.handler.BaseExceptionHandler; import cn.wustlinghang.wusthelper.internal.physics.api.http.handler.BaseExceptionHandler;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.WebApplicationException;

@ -13,7 +13,7 @@ public class PhysicsRpcException extends RpcException {
super(PHYSICS_MODULE, super(PHYSICS_MODULE,
typeCode.ordinal(), typeCode.ordinal(),
subModuleCode.ordinal() * 100 + errorCode.ordinal(), subModuleCode.ordinal() * 100 + errorCode.ordinal(),
new StringJoiner("-") new StringJoiner("/")
.add("PHYSICS") .add("PHYSICS")
.add(typeCode.name()) .add(typeCode.name())
.add(subModuleCode.name()) .add(subModuleCode.name())

@ -37,7 +37,7 @@ public class LoginService {
} catch (ParseException e) { } catch (ParseException e) {
log.error("物理实验:登录时出现页面参数解析问题", e); log.error("物理实验:登录时出现页面参数解析问题", e);
throw new PhysicsRpcException( throw new PhysicsRpcException(
PhysicsRpcException.TypeCode.NETWORK_EXCEPTION, PhysicsRpcException.TypeCode.PARSE_EXCEPTION,
PhysicsRpcException.SubModuleCode.AUTH, PhysicsRpcException.SubModuleCode.AUTH,
PhysicsRpcException.ErrorCode.AUTH_UNKNOWN_ERROR PhysicsRpcException.ErrorCode.AUTH_UNKNOWN_ERROR
); );
@ -69,7 +69,7 @@ public class LoginService {
}; };
return new PhysicsRpcException( return new PhysicsRpcException(
PhysicsRpcException.TypeCode.NETWORK_EXCEPTION, PhysicsRpcException.TypeCode.AUTH_EXCEPTION,
PhysicsRpcException.SubModuleCode.AUTH, PhysicsRpcException.SubModuleCode.AUTH,
errorCode errorCode
); );

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>undergrad</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive-jackson</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-validator</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-reactive</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<version>3.1.3.Final</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-core</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network-okhttp</artifactId>
<version>0.0.2-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>cn.wustlinghang.wusthelper</groupId>
<artifactId>common</artifactId>
<version>0.0.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>2.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.3.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.26</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>central</id>
<url>https://repo1.maven.org/maven2</url>
</repository>
<repository>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>github</id>
<url>https://maven.pkg.github.com/LingHangStudio/mywust</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>io.quarkus.platform</groupId>
<artifactId>quarkus-maven-plugin</artifactId>
<version>3.1.3.Final</version>
<extensions>true</extensions>
</plugin>
</plugins>
</build>
</project>

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.wusthelper.internal.undergrad.services.LoginService; import cn.wustlinghang.wusthelper.internal.undergrad.services.LoginService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -7,8 +7,6 @@ import jakarta.ws.rs.GET;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import java.io.IOException;
@Path("/cookie") @Path("/cookie")
public class CookieApi { public class CookieApi {
private final LoginService loginService; private final LoginService loginService;

@ -1,8 +1,6 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService; import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;
import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -13,7 +11,6 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import java.io.IOException;
import java.util.List; import java.util.List;
@Path("/course_table") @Path("/course_table")

@ -1,7 +1,5 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService; import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;
import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -12,8 +10,6 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import java.io.IOException;
@Path("/credit_status") @Path("/credit_status")
@ApplicationScoped @ApplicationScoped
public class CreditStatusApi { public class CreditStatusApi {

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradExamDelayApiService; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradExamDelayApiService;
import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication; import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication;
import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService; import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;

@ -1,8 +1,6 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService; import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;
import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -13,7 +11,6 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import java.io.IOException;
import java.util.List; import java.util.List;
@Path("/score") @Path("/score")

@ -1,8 +1,8 @@
package cn.wustlinghang.wusthelper.internal.library.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.data.global.StudentInfo; import cn.wustlinghang.mywust.data.global.StudentInfo;
import cn.wustlinghang.wusthelper.internal.library.services.ParseService; import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;
import cn.wustlinghang.wusthelper.internal.library.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped; import jakarta.enterprise.context.ApplicationScoped;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;

@ -1,7 +1,5 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json; package cn.wustlinghang.wusthelper.internal.undergrad.api.http;
import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService; import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;
import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService; import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
@ -12,8 +10,6 @@ import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path; import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam; import jakarta.ws.rs.QueryParam;
import java.io.IOException;
@Path("/training_plan") @Path("/training_plan")
@ApplicationScoped @ApplicationScoped
public class TrainingPlanApi { public class TrainingPlanApi {

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.ws.rs.core.Response; import jakarta.ws.rs.core.Response;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.wusthelper.rpc.response.ResponseCode; import cn.wustlinghang.wusthelper.rpc.response.ResponseCode;
import jakarta.validation.ValidationException; import jakarta.validation.ValidationException;

@ -1,4 +1,4 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler;
import cn.wustlinghang.wusthelper.internal.undergrad.exception.UndergradRpcException; import cn.wustlinghang.wusthelper.internal.undergrad.exception.UndergradRpcException;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException; import cn.wustlinghang.wusthelper.rpc.exception.RpcException;

@ -1,6 +1,6 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json.interceptor; package cn.wustlinghang.wusthelper.internal.undergrad.api.http.interceptor;
import cn.wustlinghang.wusthelper.internal.undergrad.api.json.handler.BaseExceptionHandler; import cn.wustlinghang.wusthelper.internal.undergrad.api.http.handler.BaseExceptionHandler;
import cn.wustlinghang.wusthelper.rpc.response.RpcResponse; import cn.wustlinghang.wusthelper.rpc.response.RpcResponse;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.WebApplicationException;

@ -1,50 +0,0 @@
package cn.wustlinghang.wusthelper.internal.undergrad.api.json;
import cn.wustlinghang.mywust.data.global.StudentInfo;
import cn.wustlinghang.mywust.exception.ApiException;
import cn.wustlinghang.mywust.exception.ParseException;
import cn.wustlinghang.wusthelper.internal.undergrad.exception.UndergradRpcException;
import cn.wustlinghang.wusthelper.internal.undergrad.services.ParseService;
import cn.wustlinghang.wusthelper.internal.undergrad.services.RequestAgentService;
import cn.wustlinghang.wusthelper.rpc.exception.RpcException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.validation.constraints.NotNull;
import jakarta.ws.rs.GET;
import jakarta.ws.rs.POST;
import jakarta.ws.rs.Path;
import jakarta.ws.rs.QueryParam;
import java.io.IOException;
@Path("/student_info")
@ApplicationScoped
public class StudentInfoApi {
private final RequestAgentService agentService;
private final ParseService parseService;
public StudentInfoApi(RequestAgentService agentService,
ParseService parseService) {
this.agentService = agentService;
this.parseService = parseService;
}
@GET
@Path("/")
public StudentInfo get(@QueryParam("cookie") @NotNull String cookie)
throws RpcException {
return this.parse(this.agent(cookie));
}
@GET
@Path("/agent")
public String agent(@QueryParam("cookie") @NotNull String cookie)
throws RpcException {
return agentService.getStudentInfoPage(cookie);
}
@POST
@Path("/parse")
public StudentInfo parse(String html) throws RpcException {
return parseService.parseStudentInfo(html);
}
}

@ -13,7 +13,7 @@ public class UndergradRpcException extends RpcException {
super(UNDERGRAD_MODULE, super(UNDERGRAD_MODULE,
typeCode.ordinal(), typeCode.ordinal(),
subModuleCode.ordinal() * 100 + errorCode.ordinal(), subModuleCode.ordinal() * 100 + errorCode.ordinal(),
new StringJoiner("-") new StringJoiner("/")
.add("UNDERGRAD") .add("UNDERGRAD")
.add(typeCode.name()) .add(typeCode.name())
.add(subModuleCode.name()) .add(subModuleCode.name())

@ -70,7 +70,7 @@ public class LoginService {
}; };
return new UndergradRpcException( return new UndergradRpcException(
UndergradRpcException.TypeCode.NETWORK_EXCEPTION, UndergradRpcException.TypeCode.AUTH_EXCEPTION,
UndergradRpcException.SubModuleCode.AUTH, UndergradRpcException.SubModuleCode.AUTH,
errorCode errorCode
); );

Loading…
Cancel
Save