ref: 重新修改包名以及groupId

main
lensfrex 1 year ago
parent e4473af4d7
commit bf828e3418
Signed by: lensfrex
GPG Key ID: 0F69A0A2FBEE98A0
  1. 2
      README.md
  2. 2
      mywust-common/pom.xml
  3. 3
      mywust-common/src/main/java/cn/wustlinghang/mywust/captcha/SolvedImageCaptcha.java
  4. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/captcha/UnsolvedImageCaptcha.java
  5. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/Building.java
  6. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/Campus.java
  7. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/Classroom.java
  8. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/College.java
  9. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/Course.java
  10. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/Score.java
  11. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/global/StudentInfo.java
  12. 4
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/physics/PhysicsCourse.java
  13. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/data/undergrad/ExamDelayApplication.java
  14. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/exception/ApiException.java
  15. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/exception/BasicException.java
  16. 2
      mywust-common/src/main/java/cn/wustlinghang/mywust/exception/ParseException.java
  17. 8
      mywust-core/pom.xml
  18. 7
      mywust-core/src/main/java/cn/linghang/mywust/core/parser/Parser.java
  19. 9
      mywust-core/src/main/java/cn/linghang/mywust/core/request/service/captcha/solver/CaptchaSolver.java
  20. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/api/ConstantParams.java
  21. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/api/GraduateUrls.java
  22. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/api/LibraryUrls.java
  23. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/api/PhysicsSystemUrls.java
  24. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/api/UndergradUrls.java
  25. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/api/UnionAuthUrls.java
  26. 6
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/HuangjiahuClassroomNameParser.java
  27. 7
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/Parser.java
  28. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/graduate/GraduateCourseTableParser.java
  29. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/graduate/GraduateScoreParser.java
  30. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/graduate/GraduateStudentInfoPageParser.java
  31. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/graduate/GraduateTrainingPlanPageParser.java
  32. 12
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/physics/PhysicsCoursePageParser.java
  33. 6
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/physics/PhysicsIndexPageParser.java
  34. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/physics/PhysicsScoreListPageParser.java
  35. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/physics/PhysicsScorePageParser.java
  36. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradCourseTableParser.java
  37. 6
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradCreditStatusIndexParser.java
  38. 6
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradCreditStatusParser.java
  39. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradExamDelayParser.java
  40. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradScoreParser.java
  41. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradStudentInfoPageParser.java
  42. 6
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/UndergradTrainingPlanPageParser.java
  43. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/global/GlobalCourseTableParser.java
  44. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/global/UndergradAllCourseScheduleParser.java
  45. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/parser/undergraduate/global/UndergradTeacherCourseParser.java
  46. 4
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/RequestFactory.java
  47. 10
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/auth/UnionAuthRequestFactory.java
  48. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/graduate/GraduateRequestFactory.java
  49. 11
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/library/LibraryRequestFactory.java
  50. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/library/request/SearchRequest.java
  51. 12
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/physics/PhysicsSystemRequestFactory.java
  52. 15
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/undergrade/BkjxRequestFactory.java
  53. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/factory/undergrade/global/BkjxAllCourseRequestFactory.java
  54. 29
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/auth/GraduateLogin.java
  55. 20
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/auth/LibraryLogin.java
  56. 20
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/auth/PhysicsLogin.java
  57. 22
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/auth/UndergraduateLogin.java
  58. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/auth/UnionLogin.java
  59. 9
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/captcha/solver/CaptchaSolver.java
  60. 18
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/captcha/solver/DdddOcrCaptchaSolver.java
  61. 22
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/captcha/solver/LinghangOcrServiceCaptchaSolver.java
  62. 18
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/graduate/GraduateApiServiceBase.java
  63. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/graduate/GraduateCourseTableApiService.java
  64. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/graduate/GraduateScoreApiService.java
  65. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/graduate/GraduateStudentInfoApiService.java
  66. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/graduate/GraduateTrainingPlanApiService.java
  67. 12
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/library/LibraryApiService.java
  68. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/library/LibraryApiServiceBase.java
  69. 8
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/physics/PhysicsApiServiceBase.java
  70. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/physics/PhysicsCourseApiService.java
  71. 22
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/physics/PhysicsScoreApiService.java
  72. 20
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradApiServiceBase.java
  73. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradCourseTableApiService.java
  74. 20
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradCreditStatusApiService.java
  75. 14
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradExamDelayApiService.java
  76. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradScoreApiService.java
  77. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradStudentInfoApiService.java
  78. 16
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/UndergradTrainingPlanApiService.java
  79. 18
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/global/UndergradAllCourseScheduleApiService.java
  80. 24
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/global/UndergradBuildingIdApiService.java
  81. 18
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/global/UndergradClassroomCourseApiService.java
  82. 18
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/request/service/undergraduate/global/UndergradTeacherCourseApiService.java
  83. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/util/BkjxUtil.java
  84. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/util/JsoupUtil.java
  85. 2
      mywust-core/src/main/java/cn/wustlinghang/mywust/core/util/PageFormExtractor.java
  86. 2
      mywust-network-httpclient/pom.xml
  87. 6
      mywust-network-okhttp/pom.xml
  88. 2
      mywust-network-okhttp/src/main/java/cn/wustlinghang/mywust/network/okhttp/RedirectInterceptor.java
  89. 14
      mywust-network-okhttp/src/main/java/cn/wustlinghang/mywust/network/okhttp/SimpleOkhttpRequester.java
  90. 2
      mywust-network-okhttp/src/main/java/cn/wustlinghang/mywust/network/okhttp/TrustAllCert.java
  91. 4
      mywust-network/pom.xml
  92. 18
      mywust-network/src/main/java/cn/wustlinghang/mywust/network/RequestClientOption.java
  93. 6
      mywust-network/src/main/java/cn/wustlinghang/mywust/network/Requester.java
  94. 6
      mywust-network/src/main/java/cn/wustlinghang/mywust/network/entitys/FormBodyBuilder.java
  95. 2
      mywust-network/src/main/java/cn/wustlinghang/mywust/network/entitys/HttpRequest.java
  96. 9
      mywust-network/src/main/java/cn/wustlinghang/mywust/network/entitys/HttpResponse.java
  97. 6
      mywust-test/pom.xml
  98. 2
      mywust-util/pom.xml
  99. 274
      mywust-util/src/main/java/cn/wustlinghang/mywust/util/PasswordEncoder.java
  100. 2
      mywust-util/src/main/java/cn/wustlinghang/mywust/util/RepeatableComparator.java
  101. Some files were not shown because too many files have changed in this diff Show More

@ -67,7 +67,7 @@ JDK版本:1.8及以上,推荐JDK 11及以上
```xml ```xml
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-core</artifactId> <artifactId>mywust-core</artifactId>
<version>0.0.1-fixed</version> <version>0.0.1-fixed</version>
</dependency> </dependency>

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -1,6 +1,5 @@
package cn.linghang.mywust.captcha; package cn.wustlinghang.mywust.captcha;
import lombok.Data;
import lombok.Getter; import lombok.Getter;
/** /**

@ -1,4 +1,4 @@
package cn.linghang.mywust.captcha; package cn.wustlinghang.mywust.captcha;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import java.util.StringJoiner; import java.util.StringJoiner;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import java.util.StringJoiner; import java.util.StringJoiner;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import java.util.StringJoiner; import java.util.StringJoiner;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.global; package cn.wustlinghang.mywust.data.global;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;

@ -1,6 +1,6 @@
package cn.linghang.mywust.data.physics; package cn.wustlinghang.mywust.data.physics;
import cn.linghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;

@ -1,4 +1,4 @@
package cn.linghang.mywust.data.undergrad; package cn.wustlinghang.mywust.data.undergrad;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;

@ -1,4 +1,4 @@
package cn.linghang.mywust.exception; package cn.wustlinghang.mywust.exception;
public class ApiException extends BasicException { public class ApiException extends BasicException {
private final Code code; private final Code code;

@ -1,4 +1,4 @@
package cn.linghang.mywust.exception; package cn.wustlinghang.mywust.exception;
public class BasicException extends Exception { public class BasicException extends Exception {
public BasicException() { public BasicException() {

@ -1,4 +1,4 @@
package cn.linghang.mywust.exception; package cn.wustlinghang.mywust.exception;
import java.util.StringJoiner; import java.util.StringJoiner;

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -12,13 +12,13 @@
<artifactId>mywust-core</artifactId> <artifactId>mywust-core</artifactId>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network</artifactId> <artifactId>mywust-network</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-util</artifactId> <artifactId>mywust-util</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
@ -37,7 +37,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-common</artifactId> <artifactId>mywust-common</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>compile</scope> <scope>compile</scope>

@ -1,7 +0,0 @@
package cn.linghang.mywust.core.parser;
import cn.linghang.mywust.exception.ParseException;
public interface Parser<T> {
public T parse(String html) throws ParseException;
}

@ -1,9 +0,0 @@
package cn.linghang.mywust.core.request.service.captcha.solver;
import cn.linghang.mywust.captcha.SolvedImageCaptcha;
import cn.linghang.mywust.captcha.UnsolvedImageCaptcha;
import cn.linghang.mywust.exception.ApiException;
public interface CaptchaSolver {
SolvedImageCaptcha solve(UnsolvedImageCaptcha unsolvedImageCaptcha) throws ApiException;
}

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.api; package cn.wustlinghang.mywust.core.api;
import java.util.Collections; import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.api; package cn.wustlinghang.mywust.core.api;
public class GraduateUrls { public class GraduateUrls {
public static final String GRADUATE_CAPTCHA_API = "http://59.68.177.189/pyxx/PageTemplate/NsoftPage/yzm/createyzm.aspx"; public static final String GRADUATE_CAPTCHA_API = "http://59.68.177.189/pyxx/PageTemplate/NsoftPage/yzm/createyzm.aspx";

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.api; package cn.wustlinghang.mywust.core.api;
public class LibraryUrls { public class LibraryUrls {
public static final String LIBRARY_SESSION_COOKIE_API = "https://libsys.wust.edu.cn/meta-local/opac/cas/rosetta?ticket=%s"; public static final String LIBRARY_SESSION_COOKIE_API = "https://libsys.wust.edu.cn/meta-local/opac/cas/rosetta?ticket=%s";

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.api; package cn.wustlinghang.mywust.core.api;
public class PhysicsSystemUrls { public class PhysicsSystemUrls {
public static final String PHYSICS_LOGIN_INDEX = "http://wlsy.wust.edu.cn/Page/BI/BI000.aspx"; public static final String PHYSICS_LOGIN_INDEX = "http://wlsy.wust.edu.cn/Page/BI/BI000.aspx";

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.api; package cn.wustlinghang.mywust.core.api;
import lombok.Getter; import lombok.Getter;

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.api; package cn.wustlinghang.mywust.core.api;
public class UnionAuthUrls { public class UnionAuthUrls {
/** /**

@ -1,7 +1,7 @@
package cn.linghang.mywust.core.parser; package cn.wustlinghang.mywust.core.parser;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.data.global.Classroom; import cn.wustlinghang.mywust.data.global.Classroom;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

@ -0,0 +1,7 @@
package cn.wustlinghang.mywust.core.parser;
import cn.wustlinghang.mywust.exception.ParseException;
public interface Parser<T> {
public T parse(String html) throws ParseException;
}

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.graduate; package cn.wustlinghang.mywust.core.parser.graduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.data.global.Classroom; import cn.wustlinghang.mywust.data.global.Classroom;
import cn.linghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.parser.graduate; package cn.wustlinghang.mywust.core.parser.graduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.graduate; package cn.wustlinghang.mywust.core.parser.graduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import cn.linghang.mywust.data.global.StudentInfo; import cn.wustlinghang.mywust.data.global.StudentInfo;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.parser.graduate; package cn.wustlinghang.mywust.core.parser.graduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

@ -1,10 +1,10 @@
package cn.linghang.mywust.core.parser.physics; package cn.wustlinghang.mywust.core.parser.physics;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.HuangjiahuClassroomNameParser; import cn.wustlinghang.mywust.core.parser.HuangjiahuClassroomNameParser;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.data.global.Classroom; import cn.wustlinghang.mywust.data.global.Classroom;
import cn.linghang.mywust.data.physics.PhysicsCourse; import cn.wustlinghang.mywust.data.physics.PhysicsCourse;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,7 +1,7 @@
package cn.linghang.mywust.core.parser.physics; package cn.wustlinghang.mywust.core.parser.physics;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.parser.physics; package cn.wustlinghang.mywust.core.parser.physics;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import lombok.Data; import lombok.Data;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.physics; package cn.wustlinghang.mywust.core.parser.physics;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import cn.linghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import cn.linghang.mywust.data.global.Classroom; import cn.wustlinghang.mywust.data.global.Classroom;
import cn.linghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,7 +1,7 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,7 +1,7 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import cn.linghang.mywust.data.undergrad.ExamDelayApplication; import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import cn.linghang.mywust.data.global.Score; import cn.wustlinghang.mywust.data.global.Score;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.core.util.JsoupUtil; import cn.wustlinghang.mywust.core.util.JsoupUtil;
import cn.linghang.mywust.data.global.StudentInfo; import cn.wustlinghang.mywust.data.global.StudentInfo;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;

@ -1,7 +1,7 @@
package cn.linghang.mywust.core.parser.undergraduate; package cn.wustlinghang.mywust.core.parser.undergraduate;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.parser.undergraduate.global; package cn.wustlinghang.mywust.core.parser.undergraduate.global;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.data.global.Classroom; import cn.wustlinghang.mywust.data.global.Classroom;
import cn.linghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.parser.undergraduate.global; package cn.wustlinghang.mywust.core.parser.undergraduate.global;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.parser.undergraduate.global; package cn.wustlinghang.mywust.core.parser.undergraduate.global;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.Parser; import cn.wustlinghang.mywust.core.parser.Parser;
import cn.linghang.mywust.data.global.Course; import cn.wustlinghang.mywust.data.global.Course;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;

@ -1,6 +1,6 @@
package cn.linghang.mywust.core.request.factory; package cn.wustlinghang.mywust.core.request.factory;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import java.net.URL; import java.net.URL;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

@ -1,9 +1,9 @@
package cn.linghang.mywust.core.request.factory.auth; package cn.wustlinghang.mywust.core.request.factory.auth;
import cn.linghang.mywust.core.api.UnionAuthUrls; import cn.wustlinghang.mywust.core.api.UnionAuthUrls;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.factory.graduate; package cn.wustlinghang.mywust.core.request.factory.graduate;
import cn.linghang.mywust.captcha.SolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.SolvedImageCaptcha;
import cn.linghang.mywust.core.api.GraduateUrls; import cn.wustlinghang.mywust.core.api.GraduateUrls;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.core.util.PageFormExtractor; import cn.wustlinghang.mywust.core.util.PageFormExtractor;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;

@ -1,10 +1,9 @@
package cn.linghang.mywust.core.request.factory.library; package cn.wustlinghang.mywust.core.request.factory.library;
import cn.hutool.core.util.URLUtil; import cn.wustlinghang.mywust.core.api.LibraryUrls;
import cn.linghang.mywust.core.api.LibraryUrls; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.library.request.SearchRequest;
import cn.linghang.mywust.core.request.factory.library.request.SearchRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpRequest;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.request.factory.library.request; package cn.wustlinghang.mywust.core.request.factory.library.request;
import lombok.Data; import lombok.Data;

@ -1,10 +1,10 @@
package cn.linghang.mywust.core.request.factory.physics; package cn.wustlinghang.mywust.core.request.factory.physics;
import cn.linghang.mywust.core.api.PhysicsSystemUrls; import cn.wustlinghang.mywust.core.api.PhysicsSystemUrls;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.core.util.PageFormExtractor; import cn.wustlinghang.mywust.core.util.PageFormExtractor;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;

@ -1,17 +1,16 @@
package cn.linghang.mywust.core.request.factory.undergrade; package cn.wustlinghang.mywust.core.request.factory.undergrade;
import cn.linghang.mywust.core.api.UndergradUrls; import cn.wustlinghang.mywust.core.api.UndergradUrls;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.data.global.Campus; import cn.wustlinghang.mywust.data.global.Campus;
import cn.linghang.mywust.network.entitys.FormBodyBuilder; import cn.wustlinghang.mywust.network.entitys.FormBodyBuilder;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.TreeMap;
public class BkjxRequestFactory extends RequestFactory { public class BkjxRequestFactory extends RequestFactory {
public static HttpRequest sessionCookieRequest(String serviceTicket) { public static HttpRequest sessionCookieRequest(String serviceTicket) {

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.factory.undergrade.global; package cn.wustlinghang.mywust.core.request.factory.undergrade.global;
import cn.linghang.mywust.core.api.ConstantParams; import cn.wustlinghang.mywust.core.api.ConstantParams;
import cn.linghang.mywust.core.api.UndergradUrls; import cn.wustlinghang.mywust.core.api.UndergradUrls;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.entitys.FormBodyBuilder; import cn.wustlinghang.mywust.network.entitys.FormBodyBuilder;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
public class BkjxAllCourseRequestFactory extends BkjxRequestFactory { public class BkjxAllCourseRequestFactory extends BkjxRequestFactory {
public static HttpRequest classroomCoursePageRequest(String cookies, String term, String timeMode, String collegeId, String campusId, String buildingId, String classroomName) { public static HttpRequest classroomCoursePageRequest(String cookies, String term, String timeMode, String collegeId, String campusId, String buildingId, String classroomName) {
@ -54,7 +54,7 @@ public class BkjxAllCourseRequestFactory extends BkjxRequestFactory {
.add("kbjcmsid", timeMode == null ? ConstantParams.DEFAULT_TIME_MODEL : timeMode) .add("kbjcmsid", timeMode == null ? ConstantParams.DEFAULT_TIME_MODEL : timeMode)
// 上课学院,虽然能获取到,但是不符合预期的功能,得到的结果是这个学院上的课,而不是这个学院开的课 // 上课学院,虽然能获取到,但是不符合预期的功能,得到的结果是这个学院上的课,而不是这个学院开的课
.add("skyx", "") .add("skyx", "")
// 开课学院应该在这里指定,但是直接用学院id是获取不到的,只能用学院下级的id来获取,相关参数详见cn.linghang.mywust.core.api.ConstantParams // 开课学院应该在这里指定,但是直接用学院id是获取不到的,只能用学院下级的id来获取,相关参数详见cn.wustlinghang.mywust.core.api.ConstantParams
.add("kkyx", subCollegeId) .add("kkyx", subCollegeId)
.add("kcmc", courseName) .add("kcmc", courseName)
.add("zzdKcSX", "") .add("zzdKcSX", "")

@ -1,16 +1,16 @@
package cn.linghang.mywust.core.request.service.auth; package cn.wustlinghang.mywust.core.request.service.auth;
import cn.linghang.mywust.captcha.SolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.SolvedImageCaptcha;
import cn.linghang.mywust.captcha.UnsolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.UnsolvedImageCaptcha;
import cn.linghang.mywust.core.api.GraduateUrls; import cn.wustlinghang.mywust.core.api.GraduateUrls;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.core.request.factory.graduate.GraduateRequestFactory; import cn.wustlinghang.mywust.core.request.factory.graduate.GraduateRequestFactory;
import cn.linghang.mywust.core.request.service.captcha.solver.CaptchaSolver; import cn.wustlinghang.mywust.core.request.service.captcha.solver.CaptchaSolver;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import javax.imageio.ImageIO; import javax.imageio.ImageIO;
import java.awt.*; import java.awt.*;
@ -49,7 +49,8 @@ public class GraduateLogin {
SolvedImageCaptcha solvedImageCaptcha = captchaSolver.solve(unsolvedImageCaptcha); SolvedImageCaptcha solvedImageCaptcha = captchaSolver.solve(unsolvedImageCaptcha);
// 进行登录 // 进行登录
HttpRequest loginRequest = GraduateRequestFactory.loginRequest(username, password, loginIndexResponse.getStringBody(), solvedImageCaptcha); String loginIndexHtml = loginIndexResponse.getStringBody();
HttpRequest loginRequest = GraduateRequestFactory.loginRequest(username, password, loginIndexHtml, solvedImageCaptcha);
HttpResponse loginResponse = requester.post(loginRequest, option); HttpResponse loginResponse = requester.post(loginRequest, option);
// 登陆成功,应该会是302跳转,不是的话多半是认证错误 // 登陆成功,应该会是302跳转,不是的话多半是认证错误

@ -1,13 +1,13 @@
package cn.linghang.mywust.core.request.service.auth; package cn.wustlinghang.mywust.core.request.service.auth;
import cn.linghang.mywust.core.api.LibraryUrls; import cn.wustlinghang.mywust.core.api.LibraryUrls;
import cn.linghang.mywust.core.api.UnionAuthUrls; import cn.wustlinghang.mywust.core.api.UnionAuthUrls;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.library.LibraryRequestFactory; import cn.wustlinghang.mywust.core.request.factory.library.LibraryRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;

@ -1,13 +1,13 @@
package cn.linghang.mywust.core.request.service.auth; package cn.wustlinghang.mywust.core.request.service.auth;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.physics.PhysicsIndexPageParser; import cn.wustlinghang.mywust.core.parser.physics.PhysicsIndexPageParser;
import cn.linghang.mywust.core.request.factory.physics.PhysicsSystemRequestFactory; import cn.wustlinghang.mywust.core.request.factory.physics.PhysicsSystemRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -55,7 +55,7 @@ public class PhysicsLogin {
String redirect = physicsIndexPageParser.parse(indexHtml); String redirect = physicsIndexPageParser.parse(indexHtml);
HttpRequest systemIndexRequest = PhysicsSystemRequestFactory.physicsSystemIndexRequest(redirect, loginCookies); HttpRequest systemIndexRequest = PhysicsSystemRequestFactory.physicsSystemIndexRequest(redirect, loginCookies);
requestClientOption.setFallowUrlRedirect(true); requestClientOption.setFollowUrlRedirect(true);
HttpResponse response = requester.get(systemIndexRequest, requestClientOption); HttpResponse response = requester.get(systemIndexRequest, requestClientOption);
if (response.getStatusCode() != HttpResponse.HTTP_OK) { if (response.getStatusCode() != HttpResponse.HTTP_OK) {
throw new ApiException(ApiException.Code.COOKIE_INVALID); throw new ApiException(ApiException.Code.COOKIE_INVALID);

@ -1,14 +1,14 @@
package cn.linghang.mywust.core.request.service.auth; package cn.wustlinghang.mywust.core.request.service.auth;
import cn.linghang.mywust.core.api.UndergradUrls; import cn.wustlinghang.mywust.core.api.UndergradUrls;
import cn.linghang.mywust.core.api.UnionAuthUrls; import cn.wustlinghang.mywust.core.api.UnionAuthUrls;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import cn.linghang.mywust.util.PasswordEncoder; import cn.wustlinghang.mywust.util.PasswordEncoder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

@ -1,12 +1,12 @@
package cn.linghang.mywust.core.request.service.auth; package cn.wustlinghang.mywust.core.request.service.auth;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.auth.UnionAuthRequestFactory; import cn.wustlinghang.mywust.core.request.factory.auth.UnionAuthRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import cn.linghang.mywust.util.PasswordEncoder; import cn.wustlinghang.mywust.util.PasswordEncoder;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;

@ -0,0 +1,9 @@
package cn.wustlinghang.mywust.core.request.service.captcha.solver;
import cn.wustlinghang.mywust.captcha.SolvedImageCaptcha;
import cn.wustlinghang.mywust.captcha.UnsolvedImageCaptcha;
import cn.wustlinghang.mywust.exception.ApiException;
public interface CaptchaSolver {
SolvedImageCaptcha solve(UnsolvedImageCaptcha unsolvedImageCaptcha) throws ApiException;
}

@ -1,12 +1,12 @@
package cn.linghang.mywust.core.request.service.captcha.solver; package cn.wustlinghang.mywust.core.request.service.captcha.solver;
import cn.linghang.mywust.captcha.SolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.SolvedImageCaptcha;
import cn.linghang.mywust.captcha.UnsolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.UnsolvedImageCaptcha;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Base64; import java.util.Base64;

@ -1,14 +1,14 @@
package cn.linghang.mywust.core.request.service.captcha.solver; package cn.wustlinghang.mywust.core.request.service.captcha.solver;
import cn.linghang.mywust.captcha.SolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.SolvedImageCaptcha;
import cn.linghang.mywust.captcha.UnsolvedImageCaptcha; import cn.wustlinghang.mywust.captcha.UnsolvedImageCaptcha;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.codec.binary.Base64; import org.apache.commons.codec.binary.Base64;

@ -1,12 +1,12 @@
package cn.linghang.mywust.core.request.service.graduate; package cn.wustlinghang.mywust.core.request.service.graduate;
import cn.linghang.mywust.core.api.GraduateUrls; import cn.wustlinghang.mywust.core.api.GraduateUrls;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.graduate; package cn.wustlinghang.mywust.core.request.service.graduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.graduate.GraduateRequestFactory; import cn.wustlinghang.mywust.core.request.factory.graduate.GraduateRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
@ -23,6 +23,6 @@ public class GraduateCourseTableApiService extends GraduateApiServiceBase {
HttpResponse response = requester.get(request, option); HttpResponse response = requester.get(request, option);
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
} }

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.graduate; package cn.wustlinghang.mywust.core.request.service.graduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.graduate.GraduateRequestFactory; import cn.wustlinghang.mywust.core.request.factory.graduate.GraduateRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
@ -22,6 +22,6 @@ public class GraduateScoreApiService extends GraduateApiServiceBase {
HttpResponse response = requester.get(request, option); HttpResponse response = requester.get(request, option);
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
} }

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.graduate; package cn.wustlinghang.mywust.core.request.service.graduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.graduate.GraduateRequestFactory; import cn.wustlinghang.mywust.core.request.factory.graduate.GraduateRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
@ -22,6 +22,6 @@ public class GraduateStudentInfoApiService extends GraduateApiServiceBase {
HttpResponse response = requester.get(request, option); HttpResponse response = requester.get(request, option);
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
} }

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.graduate; package cn.wustlinghang.mywust.core.request.service.graduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.graduate.GraduateRequestFactory; import cn.wustlinghang.mywust.core.request.factory.graduate.GraduateRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
@ -22,6 +22,6 @@ public class GraduateTrainingPlanApiService extends GraduateApiServiceBase {
HttpResponse response = requester.get(request, option); HttpResponse response = requester.get(request, option);
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
} }

@ -1,10 +1,10 @@
package cn.linghang.mywust.core.request.service.library; package cn.wustlinghang.mywust.core.request.service.library;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.library.LibraryRequestFactory; import cn.wustlinghang.mywust.core.request.factory.library.LibraryRequestFactory;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.request.service.library; package cn.wustlinghang.mywust.core.request.service.library;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
public abstract class LibraryApiServiceBase { public abstract class LibraryApiServiceBase {
protected final Requester requester; protected final Requester requester;

@ -1,8 +1,8 @@
package cn.linghang.mywust.core.request.service.physics; package cn.wustlinghang.mywust.core.request.service.physics;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
public abstract class PhysicsApiServiceBase { public abstract class PhysicsApiServiceBase {
protected final Requester requester; protected final Requester requester;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.physics; package cn.wustlinghang.mywust.core.request.service.physics;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.physics.PhysicsSystemRequestFactory; import cn.wustlinghang.mywust.core.request.factory.physics.PhysicsSystemRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
@ -15,7 +15,7 @@ public class PhysicsCourseApiService extends PhysicsApiServiceBase {
} }
public String getPage(String cookie, RequestClientOption requestClientOption) throws IOException, ApiException { public String getPage(String cookie, RequestClientOption requestClientOption) throws IOException, ApiException {
requestClientOption.setFallowUrlRedirect(false); requestClientOption.setFollowUrlRedirect(false);
// 直接请求真正的课表页 // 直接请求真正的课表页
HttpRequest coursePageRequest = PhysicsSystemRequestFactory.physicsCourseRequest(cookie); HttpRequest coursePageRequest = PhysicsSystemRequestFactory.physicsCourseRequest(cookie);

@ -1,14 +1,14 @@
package cn.linghang.mywust.core.request.service.physics; package cn.wustlinghang.mywust.core.request.service.physics;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.physics.PhysicsScoreListPageParser; import cn.wustlinghang.mywust.core.parser.physics.PhysicsScoreListPageParser;
import cn.linghang.mywust.core.request.factory.physics.PhysicsSystemRequestFactory; import cn.wustlinghang.mywust.core.request.factory.physics.PhysicsSystemRequestFactory;
import cn.linghang.mywust.core.util.PageFormExtractor; import cn.wustlinghang.mywust.core.util.PageFormExtractor;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

@ -1,13 +1,13 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.core.api.UndergradUrls; import cn.wustlinghang.mywust.core.api.UndergradUrls;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.RequestFactory; import cn.wustlinghang.mywust.core.request.factory.RequestFactory;
import cn.linghang.mywust.core.util.BkjxUtil; import cn.wustlinghang.mywust.core.util.BkjxUtil;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
@ -40,7 +40,7 @@ public class UndergradCourseTableApiService extends UndergradApiServiceBase {
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
public String getPage(String term, String cookies) throws IOException, ApiException { public String getPage(String term, String cookies) throws IOException, ApiException {

@ -1,13 +1,13 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.exception.ParseException;
import cn.linghang.mywust.core.parser.undergraduate.UndergradCreditStatusIndexParser; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradCreditStatusIndexParser;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
@ -32,7 +32,7 @@ public class UndergradScoreApiService extends UndergradApiServiceBase {
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
public String getPage(String cookies) throws IOException, ApiException { public String getPage(String cookies) throws IOException, ApiException {

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
@ -32,7 +32,7 @@ public class UndergradStudentInfoApiService extends UndergradApiServiceBase {
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
public String getPage(String cookies) throws IOException, ApiException { public String getPage(String cookies) throws IOException, ApiException {

@ -1,11 +1,11 @@
package cn.linghang.mywust.core.request.service.undergraduate; package cn.wustlinghang.mywust.core.request.service.undergraduate;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;
@ -32,7 +32,7 @@ public class UndergradTrainingPlanApiService extends UndergradApiServiceBase {
super.checkResponse(response); super.checkResponse(response);
return new String(response.getBody()); return response.getStringBody();
} }
public String getPage(String cookies) throws IOException, ApiException { public String getPage(String cookies) throws IOException, ApiException {

@ -1,12 +1,12 @@
package cn.linghang.mywust.core.request.service.undergraduate.global; package cn.wustlinghang.mywust.core.request.service.undergraduate.global;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.global.BkjxAllCourseRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.global.BkjxAllCourseRequestFactory;
import cn.linghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

@ -1,15 +1,15 @@
package cn.linghang.mywust.core.request.service.undergraduate.global; package cn.wustlinghang.mywust.core.request.service.undergraduate.global;
import cn.linghang.mywust.core.api.ConstantParams; import cn.wustlinghang.mywust.core.api.ConstantParams;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.BkjxRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.BkjxRequestFactory;
import cn.linghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase;
import cn.linghang.mywust.data.global.Building; import cn.wustlinghang.mywust.data.global.Building;
import cn.linghang.mywust.data.global.Campus; import cn.wustlinghang.mywust.data.global.Campus;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;

@ -1,12 +1,12 @@
package cn.linghang.mywust.core.request.service.undergraduate.global; package cn.wustlinghang.mywust.core.request.service.undergraduate.global;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.global.BkjxAllCourseRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.global.BkjxAllCourseRequestFactory;
import cn.linghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

@ -1,12 +1,12 @@
package cn.linghang.mywust.core.request.service.undergraduate.global; package cn.wustlinghang.mywust.core.request.service.undergraduate.global;
import cn.linghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ApiException;
import cn.linghang.mywust.core.request.factory.undergrade.global.BkjxAllCourseRequestFactory; import cn.wustlinghang.mywust.core.request.factory.undergrade.global.BkjxAllCourseRequestFactory;
import cn.linghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradApiServiceBase;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;
import java.util.Map; import java.util.Map;

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.util; package cn.wustlinghang.mywust.core.util;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.util; package cn.wustlinghang.mywust.core.util;
import org.jsoup.nodes.Element; import org.jsoup.nodes.Element;
import org.jsoup.select.Elements; import org.jsoup.select.Elements;

@ -1,4 +1,4 @@
package cn.linghang.mywust.core.util; package cn.wustlinghang.mywust.core.util;
import org.jsoup.Jsoup; import org.jsoup.Jsoup;
import org.jsoup.nodes.Document; import org.jsoup.nodes.Document;

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<artifactId>mywust-network-httpclient</artifactId> <artifactId>mywust-network-httpclient</artifactId>

@ -5,7 +5,7 @@
<parent> <parent>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -34,12 +34,12 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network</artifactId> <artifactId>mywust-network</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-util</artifactId> <artifactId>mywust-util</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>compile</scope> <scope>compile</scope>

@ -1,4 +1,4 @@
package cn.linghang.mywust.network.okhttp; package cn.wustlinghang.mywust.network.okhttp;
import okhttp3.Interceptor; import okhttp3.Interceptor;
import okhttp3.Response; import okhttp3.Response;

@ -1,10 +1,10 @@
package cn.linghang.mywust.network.okhttp; package cn.wustlinghang.mywust.network.okhttp;
import cn.linghang.mywust.network.RequestClientOption; import cn.wustlinghang.mywust.network.RequestClientOption;
import cn.linghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.Requester;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import okhttp3.*; import okhttp3.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -149,7 +149,7 @@ public class SimpleOkhttpRequester implements Requester {
builder.callTimeout(requestClientOption.getTimeout(), TimeUnit.SECONDS) builder.callTimeout(requestClientOption.getTimeout(), TimeUnit.SECONDS)
.readTimeout(requestClientOption.getTimeout(), TimeUnit.SECONDS) .readTimeout(requestClientOption.getTimeout(), TimeUnit.SECONDS)
.connectTimeout(requestClientOption.getTimeout(), TimeUnit.SECONDS) .connectTimeout(requestClientOption.getTimeout(), TimeUnit.SECONDS)
.followRedirects(requestClientOption.isFallowUrlRedirect()) .followRedirects(requestClientOption.isFollowUrlRedirect())
.addInterceptor(new RedirectInterceptor()); .addInterceptor(new RedirectInterceptor());
// 是否忽略SSL错误 // 是否忽略SSL错误

@ -1,4 +1,4 @@
package cn.linghang.mywust.network.okhttp; package cn.wustlinghang.mywust.network.okhttp;
import javax.net.ssl.*; import javax.net.ssl.*;
import java.security.KeyStore; import java.security.KeyStore;

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -19,7 +19,7 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-util</artifactId> <artifactId>mywust-util</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>compile</scope> <scope>compile</scope>

@ -1,4 +1,4 @@
package cn.linghang.mywust.network; package cn.wustlinghang.mywust.network;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
@ -7,7 +7,7 @@ import lombok.Data;
public class RequestClientOption { public class RequestClientOption {
private Proxy proxy; private Proxy proxy;
private long timeout; private long timeout;
private boolean fallowUrlRedirect; private boolean followUrlRedirect;
private boolean ignoreSSLError; private boolean ignoreSSLError;
@ -21,14 +21,14 @@ public class RequestClientOption {
public RequestClientOption() { public RequestClientOption() {
this.proxy = null; this.proxy = null;
this.timeout = 5; this.timeout = 5;
this.fallowUrlRedirect = false; this.followUrlRedirect = false;
this.ignoreSSLError = true; this.ignoreSSLError = true;
} }
public RequestClientOption(Proxy proxy, long timeout, boolean fallowUrlRedirect, boolean ignoreSSLError) { public RequestClientOption(Proxy proxy, long timeout, boolean followUrlRedirect, boolean ignoreSSLError) {
this.proxy = proxy; this.proxy = proxy;
this.timeout = timeout; this.timeout = timeout;
this.fallowUrlRedirect = fallowUrlRedirect; this.followUrlRedirect = followUrlRedirect;
this.ignoreSSLError = ignoreSSLError; this.ignoreSSLError = ignoreSSLError;
} }
@ -53,8 +53,8 @@ public class RequestClientOption {
} }
@Override @Override
public boolean isFallowUrlRedirect() { public boolean isFollowUrlRedirect() {
return super.isFallowUrlRedirect(); return super.isFollowUrlRedirect();
} }
@Override @Override
@ -64,7 +64,7 @@ public class RequestClientOption {
public void setTimeout(long timeout) {} public void setTimeout(long timeout) {}
@Override @Override
public void setFallowUrlRedirect(boolean fallowUrlRedirect) {} public void setFollowUrlRedirect(boolean followUrlRedirect) {}
} }
public static RequestClientOptionBuilder builder() { public static RequestClientOptionBuilder builder() {
@ -89,7 +89,7 @@ public class RequestClientOption {
} }
public RequestClientOptionBuilder fallowUrlRedirect(boolean fallowUrlRedirect) { public RequestClientOptionBuilder fallowUrlRedirect(boolean fallowUrlRedirect) {
requestClientOption.setFallowUrlRedirect(fallowUrlRedirect); requestClientOption.setFollowUrlRedirect(fallowUrlRedirect);
return this; return this;
} }

@ -1,7 +1,7 @@
package cn.linghang.mywust.network; package cn.wustlinghang.mywust.network;
import cn.linghang.mywust.network.entitys.HttpRequest; import cn.wustlinghang.mywust.network.entitys.HttpRequest;
import cn.linghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.entitys.HttpResponse;
import java.io.IOException; import java.io.IOException;

@ -1,7 +1,7 @@
package cn.linghang.mywust.network.entitys; package cn.wustlinghang.mywust.network.entitys;
import cn.linghang.mywust.util.RepeatableComparator; import cn.wustlinghang.mywust.util.RepeatableComparator;
import cn.linghang.mywust.util.StringUtil; import cn.wustlinghang.mywust.util.StringUtil;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;

@ -1,4 +1,4 @@
package cn.linghang.mywust.network.entitys; package cn.wustlinghang.mywust.network.entitys;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;

@ -1,10 +1,11 @@
package cn.linghang.mywust.network.entitys; package cn.wustlinghang.mywust.network.entitys;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Map; import java.util.Map;
@ -34,7 +35,11 @@ public class HttpResponse {
private byte[] body; private byte[] body;
public String getStringBody() { public String getStringBody() {
return new String(body); return new String(body, StandardCharsets.UTF_8);
}
public String getStringBody(Charset charsets) {
return new String(body, charsets);
} }
public void setBody(byte[] body) { public void setBody(byte[] body) {

@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
@ -14,13 +14,13 @@
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-core</artifactId> <artifactId>mywust-core</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<artifactId>mywust-network-okhttp</artifactId> <artifactId>mywust-network-okhttp</artifactId>
<version>${project.parent.version}</version> <version>${project.parent.version}</version>
<scope>test</scope> <scope>test</scope>

@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent> <parent>
<artifactId>mywust</artifactId> <artifactId>mywust</artifactId>
<groupId>cn.linghang</groupId> <groupId>cn.wustlinghang.mywust</groupId>
<version>${revision}</version> <version>${revision}</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>

@ -1,137 +1,137 @@
package cn.linghang.mywust.util; package cn.wustlinghang.mywust.util;
import org.apache.commons.codec.binary.Hex; import org.apache.commons.codec.binary.Hex;
import javax.crypto.BadPaddingException; import javax.crypto.BadPaddingException;
import javax.crypto.Cipher; import javax.crypto.Cipher;
import javax.crypto.IllegalBlockSizeException; import javax.crypto.IllegalBlockSizeException;
import javax.crypto.NoSuchPaddingException; import javax.crypto.NoSuchPaddingException;
import java.math.BigInteger; import java.math.BigInteger;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException; import java.security.InvalidKeyException;
import java.security.KeyFactory; import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPublicKey; import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException; import java.security.spec.InvalidKeySpecException;
import java.security.spec.RSAPublicKeySpec; import java.security.spec.RSAPublicKeySpec;
import static java.lang.Integer.parseInt; import static java.lang.Integer.parseInt;
/** /**
* <h>密码加密工具类</h> * <h>密码加密工具类</h>
* *
* <p>使用统一登陆的加密方法对密码进行加密的工具类</p> * <p>使用统一登陆的加密方法对密码进行加密的工具类</p>
* <p>研究发现统一认证登录对密码的加密方式只是简单的RSA NoPadding加密(虽然但是貌似私钥也放在前端了...)</p> * <p>研究发现统一认证登录对密码的加密方式只是简单的RSA NoPadding加密(虽然但是貌似私钥也放在前端了...)</p>
* <p>加密过程大概如下</p> * <p>加密过程大概如下</p>
* <p>- 通过modulus模数和exponent指数生成rsa公钥</p> * <p>- 通过modulus模数和exponent指数生成rsa公钥</p>
* <p>- 将明文反转后用上面生成的公钥进行RSA加密明文填充使用NoPadding填充0填充</p> * <p>- 将明文反转后用上面生成的公钥进行RSA加密明文填充使用NoPadding填充0填充</p>
* <p>- 将生成的字节数组转换成16进制字符串得到加密后的数据</p> * <p>- 将生成的字节数组转换成16进制字符串得到加密后的数据</p>
* <br> * <br>
* <p>希望不要再改登录方式了 [] </p> * <p>希望不要再改登录方式了 [] </p>
* *
* @author : lensfrex * @author : lensfrex
* @description : 使用统一登陆的加密方法对密码进行加密的工具类 * @description : 使用统一登陆的加密方法对密码进行加密的工具类
* @create : 2022-09-18 14:42:06 * @create : 2022-09-18 14:42:06
* @edit : 2022-10-14 14:42:06 * @edit : 2022-10-14 14:42:06
*/ */
public class PasswordEncoder { public class PasswordEncoder {
private static final String MODULUS = "b5eeb166e069920e80bebd1fea4829d3d1f3216f2aabe79b6c47a3c18dcee5fd22c2e7ac519cab59198ece036dcf289ea8201e2a0b9ded307f8fb704136eaeb670286f5ad44e691005ba9ea5af04ada5367cd724b5a26fdb5120cc95b6431604bd219c6b7d83a6f8f24b43918ea988a76f93c333aa5a20991493d4eb1117e7b1"; private static final String MODULUS = "b5eeb166e069920e80bebd1fea4829d3d1f3216f2aabe79b6c47a3c18dcee5fd22c2e7ac519cab59198ece036dcf289ea8201e2a0b9ded307f8fb704136eaeb670286f5ad44e691005ba9ea5af04ada5367cd724b5a26fdb5120cc95b6431604bd219c6b7d83a6f8f24b43918ea988a76f93c333aa5a20991493d4eb1117e7b1";
private static final String EXPONENT = "10001"; private static final String EXPONENT = "10001";
private static final RSAPublicKey PUBLIC_KEY = PasswordEncoder.generatePublicKey(); private static final RSAPublicKey PUBLIC_KEY = PasswordEncoder.generatePublicKey();
private static Cipher cipher; private static Cipher cipher;
// 单例加密/解密器 // 单例加密/解密器
static { static {
try { try {
cipher = Cipher.getInstance("RSA/ECB/NoPadding"); cipher = Cipher.getInstance("RSA/ECB/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE, PUBLIC_KEY); cipher.init(Cipher.ENCRYPT_MODE, PUBLIC_KEY);
} catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) { } catch (NoSuchAlgorithmException | NoSuchPaddingException | InvalidKeyException e) {
// 会报错的地方都是因为算法不正确,这里都是固定的值,出错了就是程序写错了,在测试的时候就应该发现的问题 // 会报错的地方都是因为算法不正确,这里都是固定的值,出错了就是程序写错了,在测试的时候就应该发现的问题
// 对于调用者不必处理这种异常,但是开发测试的时候应该要打日志来发现问题 // 对于调用者不必处理这种异常,但是开发测试的时候应该要打日志来发现问题
System.err.println("加密出错"); System.err.println("加密出错");
e.printStackTrace(); e.printStackTrace();
} }
} }
/** /**
* 按照统一登陆的加密方法加密密码 * 按照统一登陆的加密方法加密密码
* *
* @param password 密码明文 * @param password 密码明文
* @return 加密后的密码(小写) * @return 加密后的密码(小写)
*/ */
public static String encodePassword(String password) { public static String encodePassword(String password) {
try { try {
// 反转明文 // 反转明文
byte[] reversedTextData = new StringBuffer(password) byte[] reversedTextData = new StringBuffer(password)
.reverse() .reverse()
.toString() .toString()
.getBytes(StandardCharsets.UTF_8); .getBytes(StandardCharsets.UTF_8);
// 完成加密 // 完成加密
return Hex.encodeHexString(cipher.doFinal(reversedTextData)); return Hex.encodeHexString(cipher.doFinal(reversedTextData));
} catch (IllegalBlockSizeException | BadPaddingException e) { } catch (IllegalBlockSizeException | BadPaddingException e) {
// 会报错的地方都是因为算法不正确,这里都是固定的值,出错了就是程序写错了,在测试的时候就应该发现的问题 // 会报错的地方都是因为算法不正确,这里都是固定的值,出错了就是程序写错了,在测试的时候就应该发现的问题
// 对于调用者不必处理这种异常,但是开发测试的时候应该要打日志来发现问题 // 对于调用者不必处理这种异常,但是开发测试的时候应该要打日志来发现问题
System.err.println("加密出错"); System.err.println("加密出错");
e.printStackTrace(); e.printStackTrace();
} }
return ""; return "";
} }
/** /**
* 使用modulus模数和exponent指数生成rsa公钥 * 使用modulus模数和exponent指数生成rsa公钥
* *
* @return 公钥 * @return 公钥
*/ */
private static RSAPublicKey generatePublicKey() { private static RSAPublicKey generatePublicKey() {
try { try {
BigInteger mod = new BigInteger(PasswordEncoder.MODULUS, 16); BigInteger mod = new BigInteger(PasswordEncoder.MODULUS, 16);
BigInteger exp = new BigInteger(PasswordEncoder.EXPONENT, 16); BigInteger exp = new BigInteger(PasswordEncoder.EXPONENT, 16);
RSAPublicKeySpec keySpec = new RSAPublicKeySpec(mod, exp); RSAPublicKeySpec keySpec = new RSAPublicKeySpec(mod, exp);
return (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(keySpec); return (RSAPublicKey) KeyFactory.getInstance("RSA").generatePublic(keySpec);
} catch (NoSuchAlgorithmException | InvalidKeySpecException e) { } catch (NoSuchAlgorithmException | InvalidKeySpecException e) {
// 会报错的地方都是因为算法不正确,这里都是固定的值,出错了就是程序写错了,在测试的时候就应该发现的问题 // 会报错的地方都是因为算法不正确,这里都是固定的值,出错了就是程序写错了,在测试的时候就应该发现的问题
// 对于调用者不必处理这种异常,但是开发测试的时候应该要打日志来发现问题 // 对于调用者不必处理这种异常,但是开发测试的时候应该要打日志来发现问题
System.err.println("生成公钥出错"); System.err.println("生成公钥出错");
e.printStackTrace(); e.printStackTrace();
} }
return null; return null;
} }
/** /**
* <p>使用旧版登录页的方法加密密码bkjx系统直接登录</p> * <p>使用旧版登录页的方法加密密码bkjx系统直接登录</p>
* <p>是直接照搬官网js代码的只是经过了一点小修改没有具体研究是什么加密方式大概率可能是自创的性能可能会有点差</p> * <p>是直接照搬官网js代码的只是经过了一点小修改没有具体研究是什么加密方式大概率可能是自创的性能可能会有点差</p>
* *
* @param dataString 加密前置字符串 * @param dataString 加密前置字符串
* @param password 密码明文 * @param password 密码明文
* @return 加密后的密文 * @return 加密后的密文
*/ */
public static String legacyPassword(String username, String password, String dataString) { public static String legacyPassword(String username, String password, String dataString) {
String[] parts = dataString.split("#"); String[] parts = dataString.split("#");
StringBuilder scode = new StringBuilder(parts[0]); StringBuilder scode = new StringBuilder(parts[0]);
String sxh = parts[1]; String sxh = parts[1];
String code = username + "%%%" + password; String code = username + "%%%" + password;
StringBuilder encoded = new StringBuilder(); StringBuilder encoded = new StringBuilder();
for (int i = 0, codeLength = code.length(); i < codeLength; i++) { for (int i = 0, codeLength = code.length(); i < codeLength; i++) {
if (i < 20) { if (i < 20) {
int index = sxh.charAt(i) - 48; int index = sxh.charAt(i) - 48;
encoded.append(code.charAt(i)).append(scode, 0, index); encoded.append(code.charAt(i)).append(scode, 0, index);
scode.delete(0, index); scode.delete(0, index);
} else { } else {
encoded.append(code, i, codeLength); encoded.append(code, i, codeLength);
i = codeLength; i = codeLength;
} }
} }
return encoded.toString(); return encoded.toString();
} }
} }

@ -1,4 +1,4 @@
package cn.linghang.mywust.util; package cn.wustlinghang.mywust.util;
import java.util.Comparator; import java.util.Comparator;

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save