diff --git a/backend-main/backend-data/src/main/java/cn/wustlinghang/wusthelper/data/dao/mapper/StudentMapper.java b/backend-main/backend-data/src/main/java/wusthelper/data/dao/mapper/StudentMapper.java similarity index 61% rename from backend-main/backend-data/src/main/java/cn/wustlinghang/wusthelper/data/dao/mapper/StudentMapper.java rename to backend-main/backend-data/src/main/java/wusthelper/data/dao/mapper/StudentMapper.java index 4752f6b..78569c1 100644 --- a/backend-main/backend-data/src/main/java/cn/wustlinghang/wusthelper/data/dao/mapper/StudentMapper.java +++ b/backend-main/backend-data/src/main/java/wusthelper/data/dao/mapper/StudentMapper.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.data.dao.mapper; +package wusthelper.data.dao.mapper; -import cn.wustlinghang.wusthelper.data.entity.Student; +import wusthelper.data.entity.Student; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.apache.ibatis.annotations.Mapper; diff --git a/backend-main/backend-data/src/main/java/cn/wustlinghang/wusthelper/data/entity/Student.java b/backend-main/backend-data/src/main/java/wusthelper/data/entity/Student.java similarity index 88% rename from backend-main/backend-data/src/main/java/cn/wustlinghang/wusthelper/data/entity/Student.java rename to backend-main/backend-data/src/main/java/wusthelper/data/entity/Student.java index ea5f7da..a5bd300 100644 --- a/backend-main/backend-data/src/main/java/cn/wustlinghang/wusthelper/data/entity/Student.java +++ b/backend-main/backend-data/src/main/java/wusthelper/data/entity/Student.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.data.entity; +package wusthelper.data.entity; import lombok.Data; @@ -24,6 +24,11 @@ public class Student { */ private String jwcPwd; + /** + * 图书馆密码(本科生教务处密码与图书馆密码一致) + */ + private String libPwd; + /** * 物理实验系统密码 */ diff --git a/backend-main/backend-web/pom.xml b/backend-main/backend-web/pom.xml index f1d5644..694d298 100644 --- a/backend-main/backend-web/pom.xml +++ b/backend-main/backend-web/pom.xml @@ -19,6 +19,9 @@ 4.0.2 4.0.3 + + 1.0.6 + 4.4.0 @@ -43,6 +46,20 @@ backend-data ${revision} + + + + com.github.yitter + yitter-idgenerator + ${idgen.version} + + + + com.auth0 + java-jwt + ${java-jwt.version} + + diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/api/v2/undergrade/UndergradController.java b/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/api/v2/undergrade/UndergradController.java deleted file mode 100644 index b8ab30c..0000000 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/api/v2/undergrade/UndergradController.java +++ /dev/null @@ -1,23 +0,0 @@ -package cn.wustlinghang.wusthelper.web.api.v2.undergrade; - -import cn.wustlinghang.wusthelper.web.service.campus.undergrad.UndergradCookieService; -import cn.wustlinghang.wusthelper.web.response.Response; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/jwc") -public class UndergradController { - private final UndergradCookieService undergradCookieService; - - public UndergradController(UndergradCookieService undergradCookieService) { - this.undergradCookieService = undergradCookieService; - } - - @PostMapping("/login") - public Response login() { - String cookie = undergradCookieService.getLoginCookie("202118194039", "-96387ee"); - return Response.success(cookie); - } -} \ No newline at end of file diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/StudentInfoService.java b/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/StudentInfoService.java deleted file mode 100644 index b7d5bdb..0000000 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/StudentInfoService.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; - -import cn.wustlinghang.wusthelper.web.rpc.undergrad.StudentInfoRemote; -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.service.cookie.CookieManager; -import cn.wustlinghang.mywust.data.global.StudentInfo; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; -import org.springframework.stereotype.Service; - -@Service -public class StudentInfoService { - private final StudentInfoRemote studentInfoRemote; - private final CookieManager cookieManager; - - public StudentInfoService(StudentInfoRemote studentInfoRemote, CookieManager cookieManager) { - this.studentInfoRemote = studentInfoRemote; - this.cookieManager = cookieManager; - } - - public StudentInfo getStudentInfo(String user) { - String cookie = cookieManager.getCookie(user, CookieType.UNDERGRAD); - var response = studentInfoRemote.get(cookie); - if (response.code() != RpcCommonResponseCode.SUCCESS.getCode()) { - return null; - } - - // todo 异步存用户课表,异常判断等等 - return response.data(); - } -} diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/UndergradCookieService.java b/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/UndergradCookieService.java deleted file mode 100644 index ebaf2c2..0000000 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/UndergradCookieService.java +++ /dev/null @@ -1,21 +0,0 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; - -import cn.wustlinghang.wusthelper.web.rpc.undergrad.CookieRemote; -import org.springframework.stereotype.Service; - -@Service -public class UndergradCookieService { - private final CookieRemote cookieRemote; - - public UndergradCookieService(CookieRemote cookieRemote) { - this.cookieRemote = cookieRemote; - } - - public String getLoginCookie(String username, String password) { - return cookieRemote.login(username, password).data(); - } - - public Boolean checkCookie(String cookie) { - return cookieRemote.verify(cookie).data(); - } -} diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/cookie/CookieManager.java b/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/cookie/CookieManager.java deleted file mode 100644 index 79a40ab..0000000 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/cookie/CookieManager.java +++ /dev/null @@ -1,62 +0,0 @@ -package cn.wustlinghang.wusthelper.web.service.cookie; - -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.service.campus.undergrad.UndergradCookieService; -import com.github.benmanes.caffeine.cache.Cache; -import com.github.benmanes.caffeine.cache.Caffeine; -import org.springframework.context.annotation.Scope; -import org.springframework.stereotype.Service; - -import java.util.concurrent.TimeUnit; - -@Service -@Scope("singleton") -public class CookieManager { - private static final Cache cookiePool = Caffeine.newBuilder() - .expireAfterWrite(2, TimeUnit.HOURS) - .initialCapacity(256) - .maximumSize(2048) - .build(); - - private final UndergradCookieService undergradCookieService; - - public CookieManager(UndergradCookieService undergradCookieService) { - this.undergradCookieService = undergradCookieService; - } - - public String getCookie(String username, CookieType cookieType) { - return getCookie(username, cookieType, false); - } - - public String getCookie(String username, CookieType cookieType, boolean forceRefresh) { - String cacheKey = String.format("%s:%d", username, cookieType.getCode()); - String cookie = cookiePool.getIfPresent(cacheKey); - - boolean valid = cookie != null && checkCookie(cookie, cookieType) && !forceRefresh; - if (valid) { - return cookie; - } - - cookie = this.refreshCookie(username, cookieType); - cookiePool.put(cacheKey, cookie); - - return cookie; - } - - public boolean checkCookie(String cookie, CookieType cookieType) { - return switch (cookieType) { - case UNDERGRAD -> undergradCookieService.checkCookie(cookie); - case GRADUATE -> undergradCookieService.checkCookie(cookie); - default -> false; - }; - } - - public String refreshCookie(String username, CookieType cookieType) { - String password = ""; - return switch (cookieType) { - case UNDERGRAD -> undergradCookieService.getLoginCookie(username, password); - case GRADUATE -> undergradCookieService.getLoginCookie(username, password); - default -> null; - }; - } -} \ No newline at end of file diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/WebBackendMain.java b/backend-main/backend-web/src/main/java/wusthelper/WebBackendMain.java similarity index 96% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/WebBackendMain.java rename to backend-main/backend-web/src/main/java/wusthelper/WebBackendMain.java index 9d08b80..aa37ac8 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/WebBackendMain.java +++ b/backend-main/backend-web/src/main/java/wusthelper/WebBackendMain.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper; +package wusthelper; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.SpringApplication; diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/api/Health.java b/backend-main/backend-web/src/main/java/wusthelper/web/api/Health.java similarity index 85% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/api/Health.java rename to backend-main/backend-web/src/main/java/wusthelper/web/api/Health.java index fc811f2..7c2cfec 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/api/Health.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/api/Health.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.web.api; +package wusthelper.web.api; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/Token.java b/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/Token.java new file mode 100644 index 0000000..0f1772f --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/Token.java @@ -0,0 +1,81 @@ +package wusthelper.web.api.v2; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.exceptions.JWTVerificationException; +import lombok.extern.slf4j.Slf4j; + +import java.time.Duration; +import java.util.Date; + +@Slf4j +public class Token { + + private final static String SECRET = "LingHangStudio.WustHelper"; + + private final static long EXPIRE_SCD = Duration.ofDays(3).toSeconds(); + + private static final Algorithm jwtAlgorithm = Algorithm.HMAC256(SECRET); + + /** + * 签发Token + * + * @return + */ + public static String signToken(Long uid, String studentNumber) { + try { + Date now = new Date(); + Date expireAt = new Date(now.getTime() + EXPIRE_SCD); + + return JWT.create() + .withClaim("StuId", uid.toString()) + .withClaim("StuNum", studentNumber) + .withIssuedAt(now) + .withExpiresAt(expireAt) + .sign(jwtAlgorithm); + } catch (Exception e) { + log.error("[{}]:Token签发工具类>签发Token异常, 空指针异常: uid={},studentNumber={}", + Thread.currentThread().getStackTrace()[1].getMethodName(), + uid, studentNumber); + throw new RuntimeException("[JwtUtil.signToken()]"); + } + } + + /** + * 校验Token + * + * @param token + * @return + */ + public static boolean verifyToken(String token) { + try { + JWT.require(jwtAlgorithm) + .build() + .verify(token); + } catch (JWTVerificationException e) { + return false; + } + + return true; + } + + /** + * Token 负载StuId + * + * @param token + * @return + */ + public static String getUid(String token) { + return JWT.decode(token).getClaim("StuId").asString(); + } + + /** + * Token 负载StuNum + * + * @param token + * @return + */ + public static String getStudentNumber(String token) { + return JWT.decode(token).getClaim("StuNum").asString(); + } +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/undergrade/UndergradController.java b/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/undergrade/UndergradController.java new file mode 100644 index 0000000..06249ae --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/undergrade/UndergradController.java @@ -0,0 +1,5 @@ +package wusthelper.web.api.v2.undergrade; + +public class UndergradController { + +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/undergrade/UndergradLoginController.java b/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/undergrade/UndergradLoginController.java new file mode 100644 index 0000000..6541eb6 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/api/v2/undergrade/UndergradLoginController.java @@ -0,0 +1,30 @@ +package wusthelper.web.api.v2.undergrade; + +import org.springframework.web.bind.annotation.*; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.web.api.v2.Token; +import wusthelper.web.response.Response; +import wusthelper.web.service.campus.GeneralUserService; +import wusthelper.web.service.campus.undergrad.UndergradCookieService; + +@RestController +@RequestMapping("/jwc") +public class UndergradLoginController { + private final GeneralUserService generalUserService; + + public UndergradLoginController(GeneralUserService generalUserService) { + this.generalUserService = generalUserService; + } + + @PostMapping("/login") + public Response login(@RequestParam(value = "username") String username, + @RequestParam(value = "jwcPwd") String password, + @RequestHeader(name = "Platform", required = false) String platform) { + + var user = generalUserService.login(username, password, GeneralUserService.UserType.Undergrad); + + String token = Token.signToken(user.getId(), user.getStuNum()); + + return Response.success(token); + } +} \ No newline at end of file diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/configure/CaffeineCacheConfigure.java b/backend-main/backend-web/src/main/java/wusthelper/web/configure/CaffeineCacheConfigure.java similarity index 95% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/configure/CaffeineCacheConfigure.java rename to backend-main/backend-web/src/main/java/wusthelper/web/configure/CaffeineCacheConfigure.java index a514e6c..13ff776 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/configure/CaffeineCacheConfigure.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/configure/CaffeineCacheConfigure.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.web.configure; +package wusthelper.web.configure; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.Caffeine; diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/configure/GlobalConfigureItems.java b/backend-main/backend-web/src/main/java/wusthelper/web/configure/GlobalConfigureItems.java new file mode 100644 index 0000000..b596c81 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/configure/GlobalConfigureItems.java @@ -0,0 +1,12 @@ +package wusthelper.web.configure; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Data +@Component +@ConfigurationProperties("wusthelper") +public class GlobalConfigureItems { + private String passwordEncodeKey; +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/configure/PasswordCodecConfigure.java b/backend-main/backend-web/src/main/java/wusthelper/web/configure/PasswordCodecConfigure.java new file mode 100644 index 0000000..ffa25f9 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/configure/PasswordCodecConfigure.java @@ -0,0 +1,21 @@ +package wusthelper.web.configure; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import wusthelper.web.util.PasswordCodec; + +@Configuration +public class PasswordCodecConfigure { + private final GlobalConfigureItems globalConfigureItems; + + public PasswordCodecConfigure(GlobalConfigureItems globalConfigureItems) { + this.globalConfigureItems = globalConfigureItems; + } + + @Bean + public PasswordCodec passwordCodec() { + String key = globalConfigureItems.getPasswordEncodeKey(); + + return new PasswordCodec(key); + } +} diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/entity/CookieType.java b/backend-main/backend-web/src/main/java/wusthelper/web/data/entity/CookieType.java similarity index 77% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/entity/CookieType.java rename to backend-main/backend-web/src/main/java/wusthelper/web/data/entity/CookieType.java index ea3889b..05ffaf8 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/entity/CookieType.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/data/entity/CookieType.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.web.entity; +package wusthelper.web.data.entity; import java.util.StringJoiner; public enum CookieType { - UNDERGRAD(0, "本科生"), - GRADUATE(1, "研究生"), - LIBRARY(2, "图书馆"), - PHYSICS(3, "物理实验"),; + Undergrad(0, "本科生"), + Graduate(1, "研究生"), + Library(2, "图书馆"), + Physics(3, "物理实验"),; private final int code; diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/rpc/graduate/GraduateCookieRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/graduate/GraduateCookieRemote.java new file mode 100644 index 0000000..78ff569 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/graduate/GraduateCookieRemote.java @@ -0,0 +1,18 @@ +package wusthelper.web.rpc.graduate; + +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; +import wusthelper.internal.rpc.response.RpcResponseDto; + +@FeignClient(name = "wusthelper.graduate", contextId = "cookie") +public interface GraduateCookieRemote { + String COOKIE_ROOT_PATH = "/cookie"; + + @GetMapping(COOKIE_ROOT_PATH) + RpcResponseDto login(@RequestParam("username") String username, + @RequestParam("password") String password); + + @GetMapping(COOKIE_ROOT_PATH + "/verify") + RpcResponseDto verify(@RequestParam("cookie") String cookie); +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/rpc/graduate/GraduateStudentInfoRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/graduate/GraduateStudentInfoRemote.java new file mode 100644 index 0000000..ef7ca87 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/graduate/GraduateStudentInfoRemote.java @@ -0,0 +1,23 @@ +package wusthelper.web.rpc.graduate; + +import cn.wustlinghang.mywust.data.global.StudentInfo; +import jakarta.validation.constraints.NotNull; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import wusthelper.internal.rpc.response.RpcResponseDto; + +@FeignClient(name = "wusthelper.graduate", contextId = "studentInfo") +public interface GraduateStudentInfoRemote { + String ROOT_PATH = "/student_info"; + + @GetMapping(ROOT_PATH) + RpcResponseDto get(@RequestParam("cookie") String cookie); + + @GetMapping(ROOT_PATH + "/agent") + RpcResponseDto agent(@RequestParam("cookie") @NotNull String cookie); + + @PostMapping(ROOT_PATH + "/parse") + RpcResponseDto parse(String html); +} diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CourseTableRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/CourseTableRemote.java similarity index 88% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CourseTableRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/CourseTableRemote.java index 085529c..e843b71 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CourseTableRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/CourseTableRemote.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; import cn.wustlinghang.mywust.data.global.Course; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import jakarta.validation.constraints.NotNull; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CreditStatusRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/CreditStatusRemote.java similarity index 85% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CreditStatusRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/CreditStatusRemote.java index 54cefb7..deac101 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CreditStatusRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/CreditStatusRemote.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import jakarta.validation.constraints.NotNull; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/ExamDelayApplicationRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/ExamDelayApplicationRemote.java similarity index 90% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/ExamDelayApplicationRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/ExamDelayApplicationRemote.java index 4ca5bb6..d2e81ab 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/ExamDelayApplicationRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/ExamDelayApplicationRemote.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import jakarta.validation.constraints.NotNull; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/ScoreRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/ScoreRemote.java similarity index 86% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/ScoreRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/ScoreRemote.java index cb12a47..81cdd79 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/ScoreRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/ScoreRemote.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; import cn.wustlinghang.mywust.data.global.Score; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import jakarta.validation.constraints.NotNull; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/TrainingPlanRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/TrainingPlanRemote.java similarity index 85% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/TrainingPlanRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/TrainingPlanRemote.java index 661b9b0..864cd18 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/TrainingPlanRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/TrainingPlanRemote.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import jakarta.validation.constraints.NotNull; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CookieRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/UndergradCookieRemote.java similarity index 79% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CookieRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/UndergradCookieRemote.java index 9be83db..ce2a191 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/CookieRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/UndergradCookieRemote.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; @FeignClient(name = "wusthelper.undergrad", contextId = "cookie") -public interface CookieRemote { +public interface UndergradCookieRemote { String COOKIE_ROOT_PATH = "/cookie"; @GetMapping(COOKIE_ROOT_PATH) diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/StudentInfoRemote.java b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/UndergradStudentInfoRemote.java similarity index 82% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/StudentInfoRemote.java rename to backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/UndergradStudentInfoRemote.java index 1f3f37f..aa12eaf 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/rpc/undergrad/StudentInfoRemote.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/rpc/undergrad/UndergradStudentInfoRemote.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.web.rpc.undergrad; +package wusthelper.web.rpc.undergrad; import cn.wustlinghang.mywust.data.global.StudentInfo; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcResponseDto; import jakarta.validation.constraints.NotNull; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.GetMapping; @@ -9,7 +9,7 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; @FeignClient(name = "wusthelper.undergrad", contextId = "studentInfo") -public interface StudentInfoRemote { +public interface UndergradStudentInfoRemote { String ROOT_PATH = "/student_info"; @GetMapping(ROOT_PATH) diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/GeneralUserService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/GeneralUserService.java new file mode 100644 index 0000000..2c6afb8 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/GeneralUserService.java @@ -0,0 +1,116 @@ +package wusthelper.web.service.campus; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.yitter.idgen.YitIdHelper; +import org.springframework.stereotype.Service; +import wusthelper.code.ServiceCode; +import wusthelper.data.dao.mapper.StudentMapper; +import wusthelper.data.entity.Student; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.graduate.GraduateStudentInfoRemote; +import wusthelper.web.rpc.undergrad.UndergradStudentInfoRemote; +import wusthelper.web.service.campus.graduate.GraduateCookieService; +import wusthelper.web.service.campus.undergrad.UndergradCookieService; +import wusthelper.web.service.cookie.CookieManager; +import wusthelper.web.util.Converter; +import wusthelper.web.util.PasswordCodec; + +/** + * 通用的用户信息服务,包括登录和(已存储的)用户信息获取等,同时自动存入新用户信息 + */ +@Service +public class GeneralUserService { + private final StudentMapper studentMapper; + private final PasswordCodec passwordCodec; + + private final UndergradCookieService undergradCookieService; + private final GraduateCookieService graduateCookieService; + + private final GraduateStudentInfoRemote graduateStudentInfoRemote; + private final UndergradStudentInfoRemote undergradStudentInfoRemote; + + + public GeneralUserService(StudentMapper studentMapper, + PasswordCodec passwordCodec, + + UndergradCookieService undergradCookieService, + GraduateCookieService graduateCookieService, + + GraduateStudentInfoRemote graduateStudentInfoRemote, + UndergradStudentInfoRemote undergradStudentInfoRemote) { + + this.studentMapper = studentMapper; + this.passwordCodec = passwordCodec; + + this.undergradCookieService = undergradCookieService; + this.graduateCookieService = graduateCookieService; + + this.graduateStudentInfoRemote = graduateStudentInfoRemote; + this.undergradStudentInfoRemote = undergradStudentInfoRemote; + } + + public enum UserType {Undergrad, Graduate} + + /** + * 登录验证并获取用户信息,同时自动存库 + * + * @param username 用户名(即学号) + * @param password 密码(明文原文) + * @param userType 用户类型,现在有本科生和研究生 + * @return 用户信息 + */ + public Student login(String username, String password, UserType userType) { + var cookie = switch (userType) { + case Undergrad -> undergradCookieService.getLoginCookie(username, password); + case Graduate -> graduateCookieService.getLoginCookie(username, password); + }; + + var cookieType = switch (userType) { + case Undergrad -> CookieType.Undergrad; + case Graduate -> CookieType.Graduate; + }; + + // 保存cookie,并获取用户信息并存库(基本的操作,非异步,信息获取失败意味登陆失败) + CookieManager.store(username, cookie, cookieType); + return this.saveOrUpdateUser(username, cookie, password, userType); + } + + private Student saveOrUpdateUser(String username, String cookie, String password, UserType userType) { + var rpcResp = switch (userType) { + case Undergrad -> undergradStudentInfoRemote.get(cookie); + case Graduate -> graduateStudentInfoRemote.get(cookie); + }; + + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); + } + + var studentInfo = rpcResp.data(); + var student = Converter.convert(studentInfo); + if (student.getStuNum() == null) { + student.setStuNum(username); + } + + var query = new QueryWrapper() + .eq("stu_num", username) + .eq("deleted", 0); + + // (按学号)检查用户信息是否已经存在数据库中,已存在则更新,否则新增信息 + var studentExists = studentMapper.exists(query); + if (studentExists) { + studentMapper.update(student, query); + } else { + student.setId(YitIdHelper.nextId()); + var encrypted = passwordCodec.encode(password); + student.setJwcPwd(encrypted); + if (userType == UserType.Undergrad) { + student.setLibPwd(encrypted); + } + + studentMapper.insert(student); + } + + return student; + } +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/graduate/GraduateCookieService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/graduate/GraduateCookieService.java new file mode 100644 index 0000000..51241bd --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/graduate/GraduateCookieService.java @@ -0,0 +1,28 @@ +package wusthelper.web.service.campus.graduate; + +import org.springframework.stereotype.Service; +import wusthelper.code.ServiceCode; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.graduate.GraduateCookieRemote; + +@Service +public class GraduateCookieService { + private final GraduateCookieRemote graduateCookieRemote; + + public GraduateCookieService(GraduateCookieRemote graduateCookieRemote) { + this.graduateCookieRemote = graduateCookieRemote; + } + + public String getLoginCookie(String username, String password) throws ServiceException { + var rpcResp = graduateCookieRemote.login(username, password); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); + } + + return rpcResp.data(); + } + + public Boolean checkCookie(String cookie) { + return graduateCookieRemote.verify(cookie).data(); + } +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/graduate/GraduateStudentInfoService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/graduate/GraduateStudentInfoService.java new file mode 100644 index 0000000..788dacb --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/graduate/GraduateStudentInfoService.java @@ -0,0 +1,46 @@ +package wusthelper.web.service.campus.graduate; + +import cn.wustlinghang.mywust.data.global.StudentInfo; +import org.springframework.stereotype.Service; +import wusthelper.code.ServiceCode; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.graduate.GraduateStudentInfoRemote; +import wusthelper.web.service.cookie.CookieManager; +import wusthelper.web.service.student.StudentService; + +@Service +public class GraduateStudentInfoService { + private final GraduateStudentInfoRemote graduateStudentInfoRemote; + + private final CookieManager cookieManager; + + private final StudentService studentService; + + public GraduateStudentInfoService(GraduateStudentInfoRemote graduateStudentInfoRemote, + CookieManager cookieManager, + StudentService studentService) { + + this.graduateStudentInfoRemote = graduateStudentInfoRemote; + this.cookieManager = cookieManager; + this.studentService = studentService; + } + + public StudentInfo getStudentInfo(String user) { + String cookie = cookieManager.getCookie(user, CookieType.Graduate); + + return getStudentInfo(user, cookie); + } + + public StudentInfo getStudentInfo(String user, String cookie) { + var response = graduateStudentInfoRemote.get(cookie); + if (response.code() != ServiceCode.Ok) { + ServiceException.of(response.code()); + } + + var studentInfo = response.data(); + + studentService.saveOrUpdateUserAsync(user, studentInfo); + return studentInfo; + } +} \ No newline at end of file diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/CourseTableService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/CourseTableService.java similarity index 54% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/CourseTableService.java rename to backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/CourseTableService.java index 3ddcea9..dc7b782 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/CourseTableService.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/CourseTableService.java @@ -1,10 +1,12 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; +package wusthelper.web.service.campus.undergrad; -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.rpc.undergrad.CourseTableRemote; -import cn.wustlinghang.wusthelper.web.service.cookie.CookieManager; +import wusthelper.code.ServiceCode; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.CourseTableRemote; +import wusthelper.web.service.cookie.CookieManager; import cn.wustlinghang.mywust.data.global.Course; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import org.springframework.stereotype.Service; import java.util.List; @@ -21,13 +23,13 @@ public class CourseTableService { } public List getCourseTable(String user, String term) { - String cookie = cookieManager.getCookie(user, CookieType.UNDERGRAD); - var coursesResponse = courseTableRemote.get(cookie, term); - if (coursesResponse.code() != RpcCommonResponseCode.SUCCESS.getCode()) { - return null; + String cookie = cookieManager.getCookie(user, CookieType.Undergrad); + var rpcResp = courseTableRemote.get(cookie, term); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); } // todo 异步存用户课表,异常判断等等 - return coursesResponse.data(); + return rpcResp.data(); } } diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/CreditStatusService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/CreditStatusService.java similarity index 52% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/CreditStatusService.java rename to backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/CreditStatusService.java index 5107b3a..ef12c49 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/CreditStatusService.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/CreditStatusService.java @@ -1,9 +1,11 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; +package wusthelper.web.service.campus.undergrad; -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.rpc.undergrad.CreditStatusRemote; -import cn.wustlinghang.wusthelper.web.service.cookie.CookieManager; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.code.ServiceCode; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.CreditStatusRemote; +import wusthelper.web.service.cookie.CookieManager; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import org.springframework.stereotype.Service; @Service @@ -17,13 +19,13 @@ public class CreditStatusService { } public String getCreditStatus(String user) { - String cookie = cookieManager.getCookie(user, CookieType.UNDERGRAD); - var response = creditStatusRemote.get(cookie); - if (response.code() != RpcCommonResponseCode.SUCCESS.getCode()) { - return null; + String cookie = cookieManager.getCookie(user, CookieType.Undergrad); + var rpcResp = creditStatusRemote.get(cookie); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); } // todo 异步存用户课表,异常判断等等 - return response.data(); + return rpcResp.data(); } } diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/ExamDelayApplicationService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/ExamDelayApplicationService.java similarity index 58% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/ExamDelayApplicationService.java rename to backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/ExamDelayApplicationService.java index e3777dd..9aa46f7 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/ExamDelayApplicationService.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/ExamDelayApplicationService.java @@ -1,10 +1,12 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; +package wusthelper.web.service.campus.undergrad; -import cn.wustlinghang.wusthelper.web.rpc.undergrad.ExamDelayApplicationRemote; -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.service.cookie.CookieManager; +import wusthelper.code.ServiceCode; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.ExamDelayApplicationRemote; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.service.cookie.CookieManager; import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import org.springframework.stereotype.Service; @Service @@ -19,13 +21,13 @@ public class ExamDelayApplicationService { } public ExamDelayApplication getExamDelayApplication(String user, String term, String activityId) { - String cookie = cookieManager.getCookie(user, CookieType.UNDERGRAD); - var response = examDelayApplicationRemote.get(cookie, term, activityId); - if (response.code() != RpcCommonResponseCode.SUCCESS.getCode()) { - return null; + String cookie = cookieManager.getCookie(user, CookieType.Undergrad); + var rpcResp = examDelayApplicationRemote.get(cookie, term, activityId); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); } // todo 异步存用户课表,异常判断等等 - return response.data(); + return rpcResp.data(); } } diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/ScoreService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/ScoreService.java similarity index 53% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/ScoreService.java rename to backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/ScoreService.java index f40fdb6..44368b5 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/ScoreService.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/ScoreService.java @@ -1,10 +1,12 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; +package wusthelper.web.service.campus.undergrad; -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.rpc.undergrad.ScoreRemote; -import cn.wustlinghang.wusthelper.web.service.cookie.CookieManager; +import wusthelper.code.ServiceCode; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.ScoreRemote; +import wusthelper.web.service.cookie.CookieManager; import cn.wustlinghang.mywust.data.global.Score; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import org.springframework.stereotype.Service; import java.util.List; @@ -20,13 +22,13 @@ public class ScoreService { } public List getScore(String user) { - String cookie = cookieManager.getCookie(user, CookieType.UNDERGRAD); - var response = scoreRemote.get(cookie); - if (response.code() != RpcCommonResponseCode.SUCCESS.getCode()) { - return null; + String cookie = cookieManager.getCookie(user, CookieType.Undergrad); + var rpcResp = scoreRemote.get(cookie); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); } // todo 异步存用户课表,异常判断等等 - return response.data(); + return rpcResp.data(); } } diff --git a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/TrainingPlanService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/TrainingPlanService.java similarity index 52% rename from backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/TrainingPlanService.java rename to backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/TrainingPlanService.java index 80fe47c..5afc444 100644 --- a/backend-main/backend-web/src/main/java/cn/wustlinghang/wusthelper/web/service/campus/undergrad/TrainingPlanService.java +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/TrainingPlanService.java @@ -1,9 +1,11 @@ -package cn.wustlinghang.wusthelper.web.service.campus.undergrad; +package wusthelper.web.service.campus.undergrad; -import cn.wustlinghang.wusthelper.web.rpc.undergrad.TrainingPlanRemote; -import cn.wustlinghang.wusthelper.web.entity.CookieType; -import cn.wustlinghang.wusthelper.web.service.cookie.CookieManager; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.code.ServiceCode; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.TrainingPlanRemote; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.service.cookie.CookieManager; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import org.springframework.stereotype.Service; @Service @@ -17,13 +19,13 @@ public class TrainingPlanService { } public String getTrainingPlan(String user) { - String cookie = cookieManager.getCookie(user, CookieType.UNDERGRAD); - var response = trainingPlanRemote.get(cookie); - if (response.code() != RpcCommonResponseCode.SUCCESS.getCode()) { - return null; + String cookie = cookieManager.getCookie(user, CookieType.Undergrad); + var rpcResp = trainingPlanRemote.get(cookie); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); } // todo 异步存用户课表,异常判断等等 - return response.data(); + return rpcResp.data(); } } diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/UndergradCookieService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/UndergradCookieService.java new file mode 100644 index 0000000..836ea20 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/UndergradCookieService.java @@ -0,0 +1,29 @@ +package wusthelper.web.service.campus.undergrad; + +import org.springframework.stereotype.Service; +import wusthelper.code.ServiceCode; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.UndergradCookieRemote; + +@Service +public class UndergradCookieService { + + private final UndergradCookieRemote undergradCookieRemote; + + public UndergradCookieService(UndergradCookieRemote undergradCookieRemote) { + this.undergradCookieRemote = undergradCookieRemote; + } + + public String getLoginCookie(String username, String password) throws ServiceException { + var rpcResp = undergradCookieRemote.login(username, password); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); + } + + return rpcResp.data(); + } + + public Boolean checkCookie(String cookie) { + return undergradCookieRemote.verify(cookie).data(); + } +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/UndergradStudentInfoService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/UndergradStudentInfoService.java new file mode 100644 index 0000000..3fe1a76 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/campus/undergrad/UndergradStudentInfoService.java @@ -0,0 +1,48 @@ +package wusthelper.web.service.campus.undergrad; + +import cn.wustlinghang.mywust.data.global.StudentInfo; +import org.springframework.stereotype.Service; +import wusthelper.code.ServiceCode; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.rpc.undergrad.UndergradStudentInfoRemote; +import wusthelper.web.service.cookie.CookieManager; +import wusthelper.web.service.student.StudentService; +import wusthelper.web.util.PasswordCodec; + +@Service +public class UndergradStudentInfoService { + + private final UndergradStudentInfoRemote undergradStudentInfoRemote; + + private final CookieManager cookieManager; + + private final StudentService studentService; + + public UndergradStudentInfoService(UndergradStudentInfoRemote undergradStudentInfoRemote, + CookieManager cookieManager, + StudentService studentService) { + + this.undergradStudentInfoRemote = undergradStudentInfoRemote; + this.cookieManager = cookieManager; + this.studentService = studentService; + } + + public StudentInfo getStudentInfo(String user) { + String cookie = cookieManager.getCookie(user, CookieType.Undergrad); + + return getStudentInfo(user, cookie); + } + + public StudentInfo getStudentInfo(String user, String cookie) { + var rpcResp = undergradStudentInfoRemote.get(cookie); + if (rpcResp.code() != ServiceCode.Ok) { + ServiceException.of(rpcResp.code()); + } + + var studentInfo = rpcResp.data(); + + studentService.saveOrUpdateUserAsync(user, studentInfo); + return studentInfo; + } +} \ No newline at end of file diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/cookie/CookieManager.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/cookie/CookieManager.java new file mode 100644 index 0000000..1a2f22e --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/cookie/CookieManager.java @@ -0,0 +1,100 @@ +package wusthelper.web.service.cookie; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import wusthelper.code.ServiceCode; +import wusthelper.data.dao.mapper.StudentMapper; +import wusthelper.data.entity.Student; +import wusthelper.web.data.entity.CookieType; +import wusthelper.web.exception.ServiceException; +import wusthelper.web.service.campus.graduate.GraduateCookieService; +import wusthelper.web.service.campus.undergrad.UndergradCookieService; +import com.github.benmanes.caffeine.cache.Cache; +import com.github.benmanes.caffeine.cache.Caffeine; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Service; + +import java.util.concurrent.TimeUnit; + +@Service +@Scope("singleton") +public class CookieManager { + private static final Cache cookiePool = Caffeine.newBuilder() + .expireAfterWrite(2, TimeUnit.HOURS) + .initialCapacity(256) + .maximumSize(2048) + .build(); + + private final UndergradCookieService undergradCookieService; + private final GraduateCookieService graduateCookieService; + + private final StudentMapper studentMapper; + + public CookieManager(UndergradCookieService undergradCookieService, + GraduateCookieService graduateCookieService, + StudentMapper studentMapper) { + + this.undergradCookieService = undergradCookieService; + this.graduateCookieService = graduateCookieService; + + this.studentMapper = studentMapper; + } + + public String getCookie(String username, CookieType cookieType) { + return getCookie(username, cookieType, false); + } + + public String getCookie(String username, CookieType cookieType, boolean forceRefresh) { + String cacheKey = String.format("%s:%d", username, cookieType.getCode()); + String cookie = cookiePool.getIfPresent(cacheKey); + + boolean valid = cookie != null && checkCookie(cookie, cookieType) && !forceRefresh; + if (valid) { + return cookie; + } + + cookie = this.refreshCookie(username, cookieType); + cookiePool.put(cacheKey, cookie); + + return cookie; + } + + public static void store(String username, String cookie, CookieType cookieType) { + String cacheKey = String.format("%s:%d", username, cookieType.getCode()); + cookiePool.put(cacheKey, cookie); + } + + public boolean checkCookie(String cookie, CookieType cookieType) { + return switch (cookieType) { + case Undergrad -> undergradCookieService.checkCookie(cookie); + case Graduate -> graduateCookieService.checkCookie(cookie); + default -> false; + }; + } + + public String refreshCookie(String username, CookieType cookieType) { + var student = studentMapper.selectOne(new QueryWrapper() + .eq("stuNum", username) + .eq("deleted", 0) + ); + + if (student == null) { + ServiceException.of(ServiceCode.UserNotExists); + } + + String password = switch (cookieType) { + case Undergrad, Graduate -> student.getJwcPwd(); + case Library -> student.getLibPwd(); + case Physics -> student.getWlsyPwd(); + }; + + if (password == null) { + ServiceException.of(ServiceCode.ParamWrong); + } + + return switch (cookieType) { + case Undergrad -> undergradCookieService.getLoginCookie(username, password); + case Graduate -> graduateCookieService.getLoginCookie(username, password); + default -> null; + }; + } +} \ No newline at end of file diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/service/student/StudentService.java b/backend-main/backend-web/src/main/java/wusthelper/web/service/student/StudentService.java new file mode 100644 index 0000000..bed0eb3 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/service/student/StudentService.java @@ -0,0 +1,46 @@ +package wusthelper.web.service.student; + +import cn.wustlinghang.mywust.data.global.StudentInfo; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.github.yitter.idgen.YitIdHelper; +import org.springframework.scheduling.annotation.Async; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.stereotype.Service; +import wusthelper.data.dao.mapper.StudentMapper; +import wusthelper.data.entity.Student; +import wusthelper.web.util.Converter; + +import java.util.concurrent.CompletableFuture; + +@Service +@EnableAsync +public class StudentService { + private final StudentMapper studentMapper; + + public StudentService(StudentMapper studentMapper) { + this.studentMapper = studentMapper; + } + + @Async + public CompletableFuture saveOrUpdateUserAsync(String username, StudentInfo studentInfo) { + var student = Converter.convert(studentInfo); + if (student.getStuNum() == null) { + student.setStuNum(username); + } + + var query = new QueryWrapper() + .eq("stuNum", username) + .eq("deleted", 0); + + // (按学号)检查用户信息是否已经存在数据库中,已存在则更新,否则新增信息 + var studentExists = studentMapper.exists(query); + if (studentExists) { + studentMapper.update(student, query); + } else { + student.setId(YitIdHelper.nextId()); + studentMapper.insert(student); + } + + return CompletableFuture.completedFuture(student); + } +} diff --git a/backend-main/backend-web/src/main/java/wusthelper/web/util/Converter.java b/backend-main/backend-web/src/main/java/wusthelper/web/util/Converter.java new file mode 100644 index 0000000..8ca6834 --- /dev/null +++ b/backend-main/backend-web/src/main/java/wusthelper/web/util/Converter.java @@ -0,0 +1,29 @@ +package wusthelper.web.util; + +import cn.wustlinghang.mywust.data.global.StudentInfo; +import wusthelper.data.entity.Student; + +public class Converter { + public static Student convert(StudentInfo studentInfo) { + Student student = new Student(); +// student.setId(); + student.setStuNum(studentInfo.getStudentNumber()); + student.setStuName(studentInfo.getName()); +// student.setJwcPwd(); +// student.setWlsyPwd(); +// student.setCollegeId(); +// student.setMajorId(); +// student.setClassId(); + student.setBirthday(studentInfo.getBirthday()); + student.setSex(studentInfo.getSex()); + student.setNation(studentInfo.getNationality()); + student.setNativePlace(studentInfo.getHometown()); +// student.setNickName(); +// student.setPhone(); +// student.setEmail(); +// student.setQqNum(); +// student.setWechatNum(); +// student.setPlatform(); + return student; + } +} diff --git a/backend-main/backend-web/src/test/java/cn/wustlinghang/wusthelper/StudentTest.java b/backend-main/backend-web/src/test/java/wusthelper/StudentTest.java similarity index 88% rename from backend-main/backend-web/src/test/java/cn/wustlinghang/wusthelper/StudentTest.java rename to backend-main/backend-web/src/test/java/wusthelper/StudentTest.java index c4cca6a..eefd81d 100644 --- a/backend-main/backend-web/src/test/java/cn/wustlinghang/wusthelper/StudentTest.java +++ b/backend-main/backend-web/src/test/java/wusthelper/StudentTest.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper; +package wusthelper; -import cn.wustlinghang.wusthelper.data.dao.mapper.StudentMapper; +import wusthelper.data.dao.mapper.StudentMapper; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.springframework.beans.factory.annotation.Autowired; diff --git a/backend-main/backend-web/src/test/java/cn/wustlinghang/wusthelper/TestMain.java b/backend-main/backend-web/src/test/java/wusthelper/TestMain.java similarity index 55% rename from backend-main/backend-web/src/test/java/cn/wustlinghang/wusthelper/TestMain.java rename to backend-main/backend-web/src/test/java/wusthelper/TestMain.java index 8c45b48..b31d62c 100644 --- a/backend-main/backend-web/src/test/java/cn/wustlinghang/wusthelper/TestMain.java +++ b/backend-main/backend-web/src/test/java/wusthelper/TestMain.java @@ -1,29 +1,48 @@ -package cn.wustlinghang.wusthelper; +package wusthelper; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mybatis.spring.annotation.MapperScan; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.test.context.SpringBootTest; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.test.context.TestPropertySource; import org.springframework.test.context.junit.jupiter.SpringExtension; +import wusthelper.web.api.v2.Token; +@Slf4j @EnableAsync @Configuration @EnableScheduling @ExtendWith(SpringExtension.class) -@EnableFeignClients(basePackages = {"cn.wustlinghang.wusthelper.web.rpc"}) +@EnableFeignClients(basePackages = {"wusthelper.web.rpc"}) @TestPropertySource(properties = { "spring.config.location=classpath:application-test.yml" }) @SpringBootApplication(scanBasePackages = { // 指定springboot的bean扫描路径,有新增请及时更新 - "cn.wustlinghang.wusthelper.data", - "cn.wustlinghang.wusthelper.web", + "wusthelper.data", + "wusthelper.web", }) @MapperScan("cn.wustlinghang.wusthelper.data.dao.mapper") public class TestMain { + @Test + public void jwtTest() { + String token = Token.signToken(1233487L, "202118194039"); + log.info(token); + } + + public static void main(String[] args) { + String token = Token.signToken(1233487L, "202118194039"); + boolean valid = Token.verifyToken(token); + var uid = Token.getUid(token); + var studentNumber = Token.getStudentNumber(token); + log.info(token); + log.info("{}", valid); + log.info(uid); + log.info(studentNumber); + } } diff --git a/common/pom.xml b/common/pom.xml index 46b923c..0b887c4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -15,6 +15,25 @@ 17 17 UTF-8 + + 2.15.2 + + + com.fasterxml.jackson.core + jackson-annotations + ${jackson-annotations.version} + + + + + cn.hutool + hutool-crypto + + + cn.hutool + hutool-core + + \ No newline at end of file diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/response/RpcCommonResponseCode.java b/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/response/RpcCommonResponseCode.java deleted file mode 100644 index 45a9f4e..0000000 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/response/RpcCommonResponseCode.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Class created by lensfrex. - */ - -package cn.wustlinghang.wusthelper.internal.rpc.response; - -public enum RpcCommonResponseCode { - SUCCESS(20000, "成功"), - REQUEST_TOO_FAST(20001, "技能冷却中..."), - INVALID_REQUEST(30000, "非法请求"), - PARAM_WRONG(30001, "参数错误"), - PERMISSION_DENIED(40000, "权限不足"), - TOKEN_EXPIRED(40001, "token过期"), - TOKEN_INVALID(40002, "token无效"), - SERVER_INTERNAL_ERROR(50000, "服务器内部错误"), - API_NOT_IMPLEMENT(0, "接口未实现"),; - - private final int code; - - private final String message; - - RpcCommonResponseCode(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } -} \ No newline at end of file diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/web/response/ResponseCode.java b/common/src/main/java/cn/wustlinghang/wusthelper/web/response/ResponseCode.java deleted file mode 100644 index a9fa7f2..0000000 --- a/common/src/main/java/cn/wustlinghang/wusthelper/web/response/ResponseCode.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Class created by lensfrex. - */ - -package cn.wustlinghang.wusthelper.web.response; - -public enum ResponseCode { - SUCCESS(0, "成功"), - SERVER_INTERNAL_ERROR(-2, "服务器内部错误"), - API_NOT_IMPLEMENT(-1, "接口未实现"); - - private final int code; - - private final String message; - - ResponseCode(int code, String message) { - this.code = code; - this.message = message; - } - - public int getCode() { - return code; - } - - public String getMessage() { - return message; - } -} \ No newline at end of file diff --git a/common/src/main/java/wusthelper/code/ServiceCode.java b/common/src/main/java/wusthelper/code/ServiceCode.java new file mode 100644 index 0000000..22998cd --- /dev/null +++ b/common/src/main/java/wusthelper/code/ServiceCode.java @@ -0,0 +1,147 @@ +package wusthelper.code; + +import java.util.HashMap; +import java.util.Map; + +public class ServiceCode { + public static final int Ok = 0; // ok + public static final int ServerInternalError = -2; // 服务器内部错误 + public static final int ApiNotImplement = -1; // 接口未实现 + + // 所有模块共用 + public static final int Unknown = 10_000; // 未知错误 + public static final int RequestInvalid = 10_001; // 请求无效 + public static final int ParamWrong = 10_002; // 请求无效 + public static final int CookieInvalid = 10_003; // 提供的cookie无效 + public static final int NetworkError = 10_004; // 网络错误 + public static final int RpcError = 10_005; // 上游RPC错误 + public static final int ParseError = 10_006; // 解析错误 + + // 主模块 + public static final int UserNotExists = 20_001; // 用户不存在 + + // 本科生 + public static final int UndergradUserNotExists = 30_001; // 本科生:用户不存在 + public static final int UndergradUserBanned = 30_002; // 本科生:封号 + public static final int UndergradUserDisabled = 30_003; // 本科生:用户账号禁用 + public static final int UndergradPasswordNeedModify = 30_004; // 本科生:用户密码需要更改 + public static final int UndergradBannedInExclusiveTime = 30_005; // 本科生:专属选课时间段账号被禁用(--> _ --) + public static final int UndergradNeedEvaluate = 30_006; // 本科生:需要评教 + + // 研究生 + public static final int GraduatePasswordWrong = 40_001; // 研究生:密码错误 + public static final int GraduateCaptchaWrong = 40_002; // 研究生:验证码错误 + + // 图书馆 + public static final int LibraryUserNotExists = 50_001; // 图书馆:用户不存在 + public static final int LibraryUserBanned = 50_002; // 图书馆:封号 + public static final int LibraryUserDisabled = 50_003; // 图书馆:用户账号禁用 + public static final int LibraryPasswordNeedModify = 50_004; // 图书馆:用户密码需要更改 + + // 物理实验 + public static final int PhysicsPasswordWrong = 60_001; // 物理实验:用户不存在 + public static final int PhysicsUserNotCurrentTerm = 60_002; // 物理实验:用户不在当前学期 + + private static final Map text = new HashMap<>(128); + + // 错误码文案 + static { + text.put(Ok, "ok"); + text.put(ServerInternalError, "服务器内部错误"); + text.put(ApiNotImplement, "接口未实现"); + + // 主模块 + text.put(UserNotExists, "用户不存在"); + + // 所有模块共用 + text.put(Unknown, "未知错误"); + text.put(RequestInvalid, "请求无效"); + text.put(CookieInvalid, "提供的cookie无效"); + text.put(NetworkError, "网络错误"); + text.put(RpcError, "上游RPC错误"); + text.put(ParseError, "解析错误"); + + // 本科生 + text.put(UndergradUserNotExists, "本科生:用户不存在"); + text.put(UndergradUserBanned, "本科生:封号"); + text.put(UndergradUserDisabled, "本科生:用户账号禁用"); + text.put(UndergradPasswordNeedModify, "本科生:用户密码需要更改"); + text.put(UndergradBannedInExclusiveTime, "本科生:专属选课时间段账号被禁用(--> _ --)"); + text.put(UndergradNeedEvaluate, "本科生:需要评教"); + + // 研究生 + text.put(GraduatePasswordWrong, "研究生:密码错误"); + text.put(GraduateCaptchaWrong, "研究生:验证码错误"); + + // 图书馆 + text.put(LibraryUserNotExists, "图书馆:用户不存在"); + text.put(LibraryUserBanned, "图书馆:封号"); + text.put(LibraryUserDisabled, "图书馆:用户账号禁用"); + text.put(LibraryPasswordNeedModify, "图书馆:用户密码需要更改"); + + // 物理实验 + text.put(PhysicsPasswordWrong, "物理实验:用户不存在"); + text.put(PhysicsUserNotCurrentTerm, "物理实验:用户不在当前学期"); + } + + private final int code; + + private final String description; + + ServiceCode(int code, String description) { + this.code = code; + this.description = description; + } + + ServiceCode(int code) { + this(code, getDescribe(code)); + } + + public int getCode() { + return code; + } + + public String getDescription() { + return description; + } + + public static String getDescribe(int code) { + return text.get(code); + } + + public static ServiceCode of(int code) { + return new ServiceCode(code); + } +// +// public static class Code { +// // 所有模块共用 +// public static final ErrorCode Unknown = ErrorCode.of(10_000); // 未知错误 +// public static final ErrorCode RequestInvalid = ErrorCode.of(10_001); // 请求无效 +// public static final ErrorCode CookieInvalid = ErrorCode.of(10_002); // 提供的cookie无效 +// public static final ErrorCode NetworkError = ErrorCode.of(10_003); // 网络错误 +// public static final ErrorCode RpcError = ErrorCode.of(10_004); // 上游RPC错误 +// public static final ErrorCode ParseError = ErrorCode.of(10_005); // 解析错误 +// +// // 本科生 +// public static final ErrorCode UndergradUserNotExists = ErrorCode.of(20_001); // 本科生:用户不存在 +// public static final ErrorCode UndergradUserBanned = ErrorCode.of(20_002); // 本科生:封号 +// public static final ErrorCode UndergradUserDisabled = ErrorCode.of(20_003); // 本科生:用户账号禁用 +// public static final ErrorCode UndergradPasswordNeedModify = ErrorCode.of(20_004); // 本科生:用户密码需要更改 +// public static final ErrorCode UndergradBannedInExclusiveTime = ErrorCode.of(20_005); // 本科生:专属选课时间段账号被禁用(--> _ --) +// public static final ErrorCode UndergradNeedEvaluate = ErrorCode.of(20_006); // 本科生:需要评教 +// +// // 研究生 +// public static final ErrorCode GraduatePasswordWrong = ErrorCode.of(30_001); // 研究生:密码错误 +// public static final ErrorCode GraduateCaptchaWrong = ErrorCode.of(30_002); // 研究生:验证码错误 +// +// // 图书馆 +// public static final ErrorCode LibraryUserNotExists = ErrorCode.of(40_001); // 图书馆:用户不存在 +// public static final ErrorCode LibraryUserBanned = ErrorCode.of(40_002); // 图书馆:封号 +// public static final ErrorCode LibraryUserDisabled = ErrorCode.of(40_003); // 图书馆:用户账号禁用 +// public static final ErrorCode LibraryPasswordNeedModify = ErrorCode.of(40_004); // 图书馆:用户密码需要更改 +// +// // 物理实验 +// public static final ErrorCode PhysicsPasswordWrong = ErrorCode.of(50_001); // 物理实验:用户不存在 +// public static final ErrorCode PhysicsUserNotCurrentTerm = ErrorCode.of(50_002); // 物理实验:用户不在当前学期 +// } +} diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/GraduateRpcException.java b/common/src/main/java/wusthelper/internal/rpc/exception/GraduateRpcException.java similarity index 91% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/GraduateRpcException.java rename to common/src/main/java/wusthelper/internal/rpc/exception/GraduateRpcException.java index a8518b4..d4389e9 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/GraduateRpcException.java +++ b/common/src/main/java/wusthelper/internal/rpc/exception/GraduateRpcException.java @@ -1,14 +1,13 @@ -package cn.wustlinghang.wusthelper.internal.rpc.exception; +package wusthelper.internal.rpc.exception; import java.util.StringJoiner; public class GraduateRpcException extends RpcException { - public static final int UNDERGRAD_MODULE = 1; public GraduateRpcException(TypeCode typeCode, SubModuleCode subModuleCode, ErrorCode errorCode) { - super(UNDERGRAD_MODULE, + super(GRADUATE_MODULE, typeCode.ordinal(), subModuleCode.ordinal() * 100 + errorCode.ordinal(), new StringJoiner("/") diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/LibraryRpcException.java b/common/src/main/java/wusthelper/internal/rpc/exception/LibraryRpcException.java similarity index 94% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/LibraryRpcException.java rename to common/src/main/java/wusthelper/internal/rpc/exception/LibraryRpcException.java index 9b1c3a4..bbb13b2 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/LibraryRpcException.java +++ b/common/src/main/java/wusthelper/internal/rpc/exception/LibraryRpcException.java @@ -1,9 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.rpc.exception; +package wusthelper.internal.rpc.exception; import java.util.StringJoiner; public class LibraryRpcException extends RpcException { - public static final int LIBRARY_MODULE = 3; public LibraryRpcException(TypeCode typeCode, SubModuleCode subModuleCode, diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/PhysicsRpcException.java b/common/src/main/java/wusthelper/internal/rpc/exception/PhysicsRpcException.java similarity index 93% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/PhysicsRpcException.java rename to common/src/main/java/wusthelper/internal/rpc/exception/PhysicsRpcException.java index 826e30c..7fd4b41 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/PhysicsRpcException.java +++ b/common/src/main/java/wusthelper/internal/rpc/exception/PhysicsRpcException.java @@ -1,10 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.rpc.exception; +package wusthelper.internal.rpc.exception; import java.util.StringJoiner; public class PhysicsRpcException extends RpcException { - public static final int PHYSICS_MODULE = 4; - public PhysicsRpcException(TypeCode typeCode, SubModuleCode subModuleCode, ErrorCode errorCode) { diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/RpcException.java b/common/src/main/java/wusthelper/internal/rpc/exception/RpcException.java similarity index 73% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/RpcException.java rename to common/src/main/java/wusthelper/internal/rpc/exception/RpcException.java index 62742fe..d135c4a 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/RpcException.java +++ b/common/src/main/java/wusthelper/internal/rpc/exception/RpcException.java @@ -1,8 +1,13 @@ -package cn.wustlinghang.wusthelper.internal.rpc.exception; +package wusthelper.internal.rpc.exception; -public class RpcException extends RuntimeException { +public abstract class RpcException extends RuntimeException { protected final int code; + public static final int UNDERGRAD_MODULE = 1; + public static final int GRADUATE_MODULE = 2; + public static final int LIBRARY_MODULE = 3; + public static final int PHYSICS_MODULE = 4; + private static final int MODULE_CODE_OFFSET = 100_0000; private static final int TYPE_CODE_OFFSET = 1_0000; @@ -28,7 +33,7 @@ public class RpcException extends RuntimeException { } public static RpcException ApiNotImplement() { - return new RpcException(-1, "接口未实现"); + return new RpcException(-1, "接口未实现") {}; } public static int toIntCode(int module, int type, int exceptionCode) { diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/UndergradRpcException.java b/common/src/main/java/wusthelper/internal/rpc/exception/UndergradRpcException.java similarity index 93% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/UndergradRpcException.java rename to common/src/main/java/wusthelper/internal/rpc/exception/UndergradRpcException.java index b48e091..ca9572a 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/exception/UndergradRpcException.java +++ b/common/src/main/java/wusthelper/internal/rpc/exception/UndergradRpcException.java @@ -1,10 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.rpc.exception; +package wusthelper.internal.rpc.exception; import java.util.StringJoiner; public class UndergradRpcException extends RpcException { - public static final int UNDERGRAD_MODULE = 1; - public UndergradRpcException(TypeCode typeCode, SubModuleCode subModuleCode, ErrorCode errorCode) { @@ -54,9 +52,6 @@ public class UndergradRpcException extends RpcException { NETWORK_ERROR, PARSE_ERROR, - // 需要评教 - NEED_EVALUATE, - AUTH_PASSWORD_WRONG, // 用户不存在 AUTH_USER_NOT_EXISTS, @@ -68,6 +63,9 @@ public class UndergradRpcException extends RpcException { AUTH_NEED_CHANGE_PASSWORD, // 专属选课时间段账号被禁用(--> _ --) AUTH_BANNED_IN_EXCLUSIVE_TIME, - AUTH_UNKNOWN_ERROR + AUTH_UNKNOWN_ERROR, + + // 需要评教 + NEED_EVALUATE, } } diff --git a/common/src/main/java/wusthelper/internal/rpc/response/RpcCommonResponseCode.java b/common/src/main/java/wusthelper/internal/rpc/response/RpcCommonResponseCode.java new file mode 100644 index 0000000..60ab70b --- /dev/null +++ b/common/src/main/java/wusthelper/internal/rpc/response/RpcCommonResponseCode.java @@ -0,0 +1,31 @@ +/* + * Class created by lensfrex. + */ + +package wusthelper.internal.rpc.response; + +public enum RpcCommonResponseCode { + Success(20000, "成功"), + ParamWrong(30001, "参数错误"), + ServerInternalError(50000, "服务器内部错误"), + ApiNotImplement(0, "接口未实现"), + + ; + + private final int code; + + private final String message; + + RpcCommonResponseCode(int code, String message) { + this.code = code; + this.message = message; + } + + public int getCode() { + return code; + } + + public String getMessage() { + return message; + } +} \ No newline at end of file diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/response/RpcResponseDto.java b/common/src/main/java/wusthelper/internal/rpc/response/RpcResponseDto.java similarity index 53% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/response/RpcResponseDto.java rename to common/src/main/java/wusthelper/internal/rpc/response/RpcResponseDto.java index f5bb2d7..da1c47d 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/response/RpcResponseDto.java +++ b/common/src/main/java/wusthelper/internal/rpc/response/RpcResponseDto.java @@ -1,8 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.rpc.response; +package wusthelper.internal.rpc.response; -public record RpcResponseDto(int code, String msg, T data) { +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonInclude(JsonInclude.Include.NON_NULL) +public record RpcResponseDto(int code, T data) { public static RpcResponseDto success(T data) { - return new RpcResponseDto<>(RpcCommonResponseCode.SUCCESS.getCode(), "ok", data); + return new RpcResponseDto<>(RpcCommonResponseCode.Success.getCode(), data); } public static RpcResponseDto success() { @@ -10,7 +13,7 @@ public record RpcResponseDto(int code, String msg, T data) { } public static RpcResponseDto error(int code, String message) { - return new RpcResponseDto<>(code, message, null); + return new RpcResponseDto<>(code, null); } public static RpcResponseDto error(RpcCommonResponseCode code) { diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/util/EnumUtil.java b/common/src/main/java/wusthelper/internal/rpc/util/EnumUtil.java similarity index 73% rename from common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/util/EnumUtil.java rename to common/src/main/java/wusthelper/internal/rpc/util/EnumUtil.java index 129cf4b..70d9230 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/util/EnumUtil.java +++ b/common/src/main/java/wusthelper/internal/rpc/util/EnumUtil.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.rpc.util; +package wusthelper.internal.rpc.util; public class EnumUtil { public static > boolean equal(int value, Enum e) { diff --git a/common/src/main/java/wusthelper/web/exception/ServiceException.java b/common/src/main/java/wusthelper/web/exception/ServiceException.java new file mode 100644 index 0000000..2409a56 --- /dev/null +++ b/common/src/main/java/wusthelper/web/exception/ServiceException.java @@ -0,0 +1,43 @@ +package wusthelper.web.exception; + +import wusthelper.code.ServiceCode; + +public class ServiceException extends RuntimeException { + private final int code; + + public ServiceException(ServiceCode code) { + this(code, code.getDescription()); + } + + public ServiceException(ServiceCode code, String message) { + super(message); + this.code = code.getCode(); + } + + public ServiceException(int code) { + this(code, ServiceCode.getDescribe(code)); + } + + public ServiceException(int code, String message) { + super(message); + this.code = code; + } + + public ServiceCode getCode() { + return ServiceCode.of(code); + } + + public int getCodeValue() { + return code; + } + + /** + * 直接按错误码抛出异常 + * + * @param code 错误码 + * @throws ServiceException . + */ + public static void of(int code) throws ServiceException { + throw new ServiceException(code); + } +} diff --git a/common/src/main/java/cn/wustlinghang/wusthelper/web/response/Response.java b/common/src/main/java/wusthelper/web/response/Response.java similarity index 51% rename from common/src/main/java/cn/wustlinghang/wusthelper/web/response/Response.java rename to common/src/main/java/wusthelper/web/response/Response.java index 74bb514..c7bcaa5 100644 --- a/common/src/main/java/cn/wustlinghang/wusthelper/web/response/Response.java +++ b/common/src/main/java/wusthelper/web/response/Response.java @@ -1,6 +1,9 @@ -package cn.wustlinghang.wusthelper.web.response; +package wusthelper.web.response; +import com.fasterxml.jackson.annotation.JsonInclude; +import wusthelper.code.ServiceCode; + /** * 通用的响应 * @@ -9,9 +12,10 @@ package cn.wustlinghang.wusthelper.web.response; * @param data 响应数据 * @param data的类型 */ +@JsonInclude(JsonInclude.Include.NON_NULL) public record Response(int code, String msg, T data) { public static Response success(T data) { - return new Response<>(ResponseCode.SUCCESS.getCode(), "ok", data); + return new Response<>(0, "ok", data); } public static Response success() { @@ -22,7 +26,11 @@ public record Response(int code, String msg, T data) { return new Response<>(code, message, null); } - public static Response error(ResponseCode code) { - return error(code.getCode(), code.getMessage()); + public static Response error(int code) { + return error(code, ServiceCode.getDescribe(code)); + } + + public static Response error(ServiceCode code) { + return error(code.getCode(), code.getDescription()); } } \ No newline at end of file diff --git a/common/src/main/java/wusthelper/web/response/V2ErrorCodeConverter.java b/common/src/main/java/wusthelper/web/response/V2ErrorCodeConverter.java new file mode 100644 index 0000000..3b1c5cc --- /dev/null +++ b/common/src/main/java/wusthelper/web/response/V2ErrorCodeConverter.java @@ -0,0 +1,4 @@ +package wusthelper.web.response; + +public class V2ErrorCodeConverter { +} diff --git a/common/src/main/java/wusthelper/web/util/PasswordCodec.java b/common/src/main/java/wusthelper/web/util/PasswordCodec.java new file mode 100644 index 0000000..f23a447 --- /dev/null +++ b/common/src/main/java/wusthelper/web/util/PasswordCodec.java @@ -0,0 +1,73 @@ +package wusthelper.web.util; + +import cn.hutool.core.util.HexUtil; +import cn.hutool.crypto.Mode; +import cn.hutool.crypto.Padding; +import cn.hutool.crypto.symmetric.AES; +import cn.hutool.crypto.symmetric.SymmetricCrypto; + +import java.nio.charset.StandardCharsets; +import java.util.StringJoiner; + +/** + * 密码编解码器, + * 用aes加密而不是常规密码存储使用的hash摘要,是因为有获取明文密码的需求,毕竟登录进系统还是要明文密码的, + * 日后如果将数据获取转到客户端上进行,可以改为bcrypt存储 + */ +public class PasswordCodec { + + private final SymmetricCrypto aes; + + public PasswordCodec(String key) { + byte[] keyBytes = normalization(key); + this.aes = new AES(Mode.ECB, Padding.PKCS5Padding, keyBytes); + } + + public PasswordCodec(byte[] key) { + this.aes = new AES(Mode.ECB, Padding.PKCS5Padding, key); + } + + private static byte[] normalization(String key) { + if (key.length() < 16) { + StringJoiner sj = new StringJoiner(key); + for (int i = 0; i < 16 - key.length(); i++) { + sj.add("a"); + } + key = sj.toString(); + } else if (key.length() > 16) { + key = key.substring(15); + } + + return key.getBytes(StandardCharsets.UTF_8); + } + + public String encode(String raw) { + if (raw == null) { + return null; + } + + byte[] data = aes.encrypt(raw.getBytes(StandardCharsets.UTF_8)); + return HexUtil.encodeHexStr(data); + } + + public String decode(String encodedHex) { + if (encodedHex == null) { + return null; + } + + byte[] data = aes.decrypt(HexUtil.decodeHex(encodedHex)); + return new String(data); + } +// +// public static PasswordUtil getInstance(String key) { +// if (instance == null) { +// synchronized (PasswordUtil.class) { +// if (instance == null) { +// instance = new PasswordUtil(key); +// } +// } +// } +// +// return instance; +// } +} diff --git a/external-library/mywust b/external-library/mywust index 736dc78..367ddbb 160000 --- a/external-library/mywust +++ b/external-library/mywust @@ -1 +1 @@ -Subproject commit 736dc78d1b9e64124474cee98c5db6e8212fa096 +Subproject commit 367ddbb930b50cadbb56bd97acee05d721b9427b diff --git a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/FrpConsulRegister.java b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/FrpConsulRegister.java similarity index 89% rename from external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/FrpConsulRegister.java rename to external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/FrpConsulRegister.java index b44a455..e9502bb 100644 --- a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/FrpConsulRegister.java +++ b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/FrpConsulRegister.java @@ -1,13 +1,13 @@ -package cn.wustlinghang.wusthelper.internal.rpc; +package wusthelper.internal.rpc; import cn.hutool.core.thread.ThreadUtil; import cn.hutool.core.util.RandomUtil; import cn.wustlinghang.mywust.network.Requester; -import cn.wustlinghang.wusthelper.internal.rpc.client.ConsulClient; -import cn.wustlinghang.wusthelper.internal.rpc.client.FrpcClient; -import cn.wustlinghang.wusthelper.internal.rpc.config.FrpConfig; -import cn.wustlinghang.wusthelper.internal.rpc.config.RegisterConfig; -import cn.wustlinghang.wusthelper.internal.rpc.entity.RegisterRequestBody; +import wusthelper.internal.rpc.client.ConsulClient; +import wusthelper.internal.rpc.client.FrpcClient; +import wusthelper.internal.rpc.config.FrpConfig; +import wusthelper.internal.rpc.config.RegisterConfig; +import wusthelper.internal.rpc.entity.RegisterRequestBody; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; diff --git a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/client/ConsulClient.java b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/client/ConsulClient.java similarity index 92% rename from external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/client/ConsulClient.java rename to external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/client/ConsulClient.java index a1f7540..27ea1e8 100644 --- a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/client/ConsulClient.java +++ b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/client/ConsulClient.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.rpc.client; +package wusthelper.internal.rpc.client; import cn.wustlinghang.mywust.network.Requester; import cn.wustlinghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.request.RequestFactory; -import cn.wustlinghang.wusthelper.internal.rpc.config.RegisterConfig; -import cn.wustlinghang.wusthelper.internal.rpc.entity.RegisterRequestBody; +import wusthelper.internal.rpc.config.RegisterConfig; +import wusthelper.internal.rpc.entity.RegisterRequestBody; import com.fasterxml.jackson.databind.ObjectMapper; import com.google.common.collect.Lists; import lombok.extern.slf4j.Slf4j; diff --git a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/client/FrpcClient.java b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/client/FrpcClient.java similarity index 96% rename from external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/client/FrpcClient.java rename to external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/client/FrpcClient.java index eb1126b..695b839 100644 --- a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/client/FrpcClient.java +++ b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/client/FrpcClient.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.rpc.client; +package wusthelper.internal.rpc.client; import cn.hutool.core.codec.Base64; import cn.wustlinghang.mywust.network.entitys.HttpResponse; import cn.wustlinghang.mywust.network.request.RequestFactory; import cn.wustlinghang.mywust.network.Requester; -import cn.wustlinghang.wusthelper.internal.rpc.config.FrpConfig; +import wusthelper.internal.rpc.config.FrpConfig; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.MissingNode; diff --git a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/config/FrpConfig.java b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/config/FrpConfig.java similarity index 78% rename from external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/config/FrpConfig.java rename to external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/config/FrpConfig.java index 139e194..fb1ef8b 100644 --- a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/config/FrpConfig.java +++ b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/config/FrpConfig.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.rpc.config; +package wusthelper.internal.rpc.config; import lombok.Builder; import lombok.Data; diff --git a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/config/RegisterConfig.java b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/config/RegisterConfig.java similarity index 80% rename from external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/config/RegisterConfig.java rename to external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/config/RegisterConfig.java index 20ca09f..88e6aba 100644 --- a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/config/RegisterConfig.java +++ b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/config/RegisterConfig.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.rpc.config; +package wusthelper.internal.rpc.config; import lombok.Builder; import lombok.Data; diff --git a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/entity/RegisterRequestBody.java b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/entity/RegisterRequestBody.java similarity index 83% rename from external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/entity/RegisterRequestBody.java rename to external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/entity/RegisterRequestBody.java index 94ee17f..739fbd1 100644 --- a/external-library/rpc-frp-consul/src/main/java/cn/wustlinghang/wusthelper/internal/rpc/entity/RegisterRequestBody.java +++ b/external-library/rpc-frp-consul/src/main/java/wusthelper/internal/rpc/entity/RegisterRequestBody.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.rpc.entity; +package wusthelper.internal.rpc.entity; import lombok.Builder; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/Main.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/Main.java similarity index 81% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/Main.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/Main.java index 16bd2d9..f694c82 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/Main.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/Main.java @@ -1,10 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.graduate; +package wusthelper.internal.graduate; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; import jakarta.inject.Singleton; import lombok.extern.slf4j.Slf4j; -import org.eclipse.microprofile.config.inject.ConfigProperties; import org.eclipse.microprofile.config.inject.ConfigProperty; @Slf4j diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/CookieApi.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/CookieApi.java similarity index 78% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/CookieApi.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/CookieApi.java index 954d987..879a98c 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/CookieApi.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/CookieApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1; +package wusthelper.internal.graduate.api.http.v1; -import cn.wustlinghang.wusthelper.internal.physics.services.LoginService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.graduate.services.LoginService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/CourseTableApi.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/CourseTableApi.java similarity index 82% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/CourseTableApi.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/CourseTableApi.java index 63eb736..12db4b8 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/CourseTableApi.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/CourseTableApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1; +package wusthelper.internal.graduate.api.http.v1; import cn.wustlinghang.mywust.data.global.Course; -import cn.wustlinghang.wusthelper.internal.graduate.services.CourseTableService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.graduate.services.CourseTableService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/ScoreApi.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/ScoreApi.java similarity index 82% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/ScoreApi.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/ScoreApi.java index f1e002c..ab8577c 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/ScoreApi.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/ScoreApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1; +package wusthelper.internal.graduate.api.http.v1; import cn.wustlinghang.mywust.data.global.Score; -import cn.wustlinghang.wusthelper.internal.graduate.services.ScoreService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.graduate.services.ScoreService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/StudentInfoApi.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/StudentInfoApi.java similarity index 82% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/StudentInfoApi.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/StudentInfoApi.java index a2df199..7422f3e 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/StudentInfoApi.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/StudentInfoApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.graduate.api.http.v1; import cn.wustlinghang.mywust.data.global.StudentInfo; -import cn.wustlinghang.wusthelper.internal.undergrad.services.StudentInfoService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.graduate.services.StudentInfoService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/TrainingPlanApi.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/TrainingPlanApi.java similarity index 81% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/TrainingPlanApi.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/TrainingPlanApi.java index aaa65c0..9d2701d 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/TrainingPlanApi.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/TrainingPlanApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1; +package wusthelper.internal.graduate.api.http.v1; -import cn.wustlinghang.wusthelper.internal.graduate.services.TrainingPlanService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.graduate.services.TrainingPlanService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/BaseExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/BaseExceptionHandler.java similarity index 85% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/BaseExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/BaseExceptionHandler.java index 1fd3a96..2f819b8 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/BaseExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/BaseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.core.MediaType; @@ -29,7 +29,7 @@ public abstract class BaseExceptionHandler { try { response = objectMapper.writeValueAsString(RpcResponseDto.error(code, msg)); } catch (JsonProcessingException e) { - response = RpcResponseDto.error(RpcCommonResponseCode.SERVER_INTERNAL_ERROR); + response = RpcResponseDto.error(RpcCommonResponseCode.ServerInternalError); } return Response.status(status) diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/DefaultExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/DefaultExceptionHandler.java similarity index 70% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/DefaultExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/DefaultExceptionHandler.java index fda3bc2..7805e7f 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/DefaultExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/DefaultExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -13,7 +13,7 @@ public class DefaultExceptionHandler extends BaseExceptionHandler implements Exc public Response toResponse(Exception e) { log.error("未知异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "DefaultExceptionHandler" ); diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/IOExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/IOExceptionHandler.java similarity index 70% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/IOExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/IOExceptionHandler.java index f7d7574..4318d53 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/IOExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/IOExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -15,7 +15,7 @@ public class IOExceptionHandler extends BaseExceptionHandler implements Exceptio public Response toResponse(IOException e) { log.error("IO异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "IOExceptionHandler" ); diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/ParseExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/ParseExceptionHandler.java similarity index 72% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/ParseExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/ParseExceptionHandler.java index 119bebd..b5dc85d 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/ParseExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/ParseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -14,7 +14,7 @@ public class ParseExceptionHandler extends BaseExceptionHandler implements Excep public Response toResponse(ParseException e) { log.error("解析异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "ParseExceptionHandler" ); diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/RpcExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/RpcExceptionHandler.java similarity index 75% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/RpcExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/RpcExceptionHandler.java index 50bc5ae..fa85aa2 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/RpcExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/RpcExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/ValidationExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/ValidationExceptionHandler.java similarity index 73% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/ValidationExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/ValidationExceptionHandler.java index 950be29..bd6b741 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/ValidationExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/ValidationExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.validation.ValidationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; @@ -14,7 +14,7 @@ public class ValidationExceptionHandler extends BaseExceptionHandler @Override public Response toResponse(ValidationException e) { return super.toResponse( - RpcCommonResponseCode.PARAM_WRONG, + RpcCommonResponseCode.ParamWrong, "参数错误:" + e.toString(), "ValidationExceptionHandler" ); diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/WebApplicationExceptionHandler.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/WebApplicationExceptionHandler.java similarity index 75% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/WebApplicationExceptionHandler.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/WebApplicationExceptionHandler.java index 1a21a32..f40c02e 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/WebApplicationExceptionHandler.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/handler/WebApplicationExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.graduate.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; @@ -14,7 +14,7 @@ public class WebApplicationExceptionHandler extends BaseExceptionHandler impleme return super.toResponse( e.getResponse().getStatus(), RpcException.toIntCode( - GraduateRpcException.UNDERGRAD_MODULE, + GraduateRpcException.GRADUATE_MODULE, GraduateRpcException.SubModuleCode.COMMON.ordinal(), GraduateRpcException.TypeCode.OTHER_EXCEPTION.ordinal() * 100 + GraduateRpcException.ErrorCode.REQUEST_INVALID.ordinal() diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/interceptor/ResponseWrapperInterceptor.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/interceptor/ResponseWrapperInterceptor.java similarity index 83% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/interceptor/ResponseWrapperInterceptor.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/interceptor/ResponseWrapperInterceptor.java index ace0416..4626215 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/interceptor/ResponseWrapperInterceptor.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/api/http/v1/interceptor/ResponseWrapperInterceptor.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.interceptor; +package wusthelper.internal.graduate.api.http.v1.interceptor; -import cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler.BaseExceptionHandler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.graduate.api.http.v1.handler.BaseExceptionHandler; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.HttpHeaders; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/JacksonBean.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/JacksonBean.java similarity index 72% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/JacksonBean.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/JacksonBean.java index 3eafad3..ed0344f 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/JacksonBean.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/JacksonBean.java @@ -1,8 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.bean; +package wusthelper.internal.graduate.bean; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Singleton; public class JacksonBean { @ApplicationScoped diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/MywustParserBeans.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/MywustParserBeans.java similarity index 94% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/MywustParserBeans.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/MywustParserBeans.java index b63bce4..0adbd56 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/MywustParserBeans.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/MywustParserBeans.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.graduate.bean; +package wusthelper.internal.graduate.bean; import cn.wustlinghang.mywust.core.parser.graduate.GraduateCourseTableParser; import cn.wustlinghang.mywust.core.parser.graduate.GraduateScoreParser; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/MywustRequestAgentBeans.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/MywustRequestAgentBeans.java similarity index 97% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/MywustRequestAgentBeans.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/MywustRequestAgentBeans.java index e7a173d..3f30686 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/MywustRequestAgentBeans.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/bean/MywustRequestAgentBeans.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.graduate.bean; +package wusthelper.internal.graduate.bean; import cn.wustlinghang.mywust.core.request.service.auth.GraduateLogin; import cn.wustlinghang.mywust.core.request.service.captcha.solver.DdddOcrCaptchaSolver; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/Register.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/Register.java similarity index 78% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/Register.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/Register.java index 5ec5286..8868de6 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/Register.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/Register.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.physics.rpc; +package wusthelper.internal.graduate.rpc; import cn.wustlinghang.mywust.network.Requester; -import cn.wustlinghang.wusthelper.internal.physics.rpc.config.RpcConfig; -import cn.wustlinghang.wusthelper.internal.rpc.FrpConsulRegister; -import cn.wustlinghang.wusthelper.internal.rpc.config.FrpConfig; -import cn.wustlinghang.wusthelper.internal.rpc.config.RegisterConfig; +import wusthelper.internal.graduate.rpc.config.RpcConfig; +import wusthelper.internal.rpc.FrpConsulRegister; +import wusthelper.internal.rpc.config.FrpConfig; +import wusthelper.internal.rpc.config.RegisterConfig; import com.fasterxml.jackson.databind.ObjectMapper; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/config/RpcConfig.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/config/RpcConfig.java similarity index 93% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/config/RpcConfig.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/config/RpcConfig.java index 17f085b..8820f43 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/config/RpcConfig.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/config/RpcConfig.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.physics.rpc.config; +package wusthelper.internal.graduate.rpc.config; import jakarta.inject.Singleton; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/health/HealthCheck.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/health/HealthCheck.java similarity index 83% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/health/HealthCheck.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/health/HealthCheck.java index 75f2e5f..202f03d 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/rpc/health/HealthCheck.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/rpc/health/HealthCheck.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.physics.rpc.health; +package wusthelper.internal.graduate.rpc.health; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/BaseService.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/BaseService.java similarity index 89% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/BaseService.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/BaseService.java index e1a4f2d..42fc710 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/BaseService.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/BaseService.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.services; +package wusthelper.internal.graduate.services; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/CourseTableService.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/CourseTableService.java similarity index 91% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/CourseTableService.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/CourseTableService.java index 75f1cad..ab40ec2 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/CourseTableService.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/CourseTableService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.graduate.services; +package wusthelper.internal.graduate.services; import cn.wustlinghang.mywust.core.parser.graduate.GraduateCourseTableParser; import cn.wustlinghang.mywust.core.request.service.graduate.GraduateCourseTableApiService; import cn.wustlinghang.mywust.data.global.Course; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/LoginService.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/LoginService.java similarity index 95% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/LoginService.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/LoginService.java index 42e4cdf..fa13edd 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/LoginService.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/LoginService.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.graduate.services; +package wusthelper.internal.graduate.services; import cn.wustlinghang.mywust.core.request.service.auth.GraduateLogin; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; import jakarta.enterprise.context.ApplicationScoped; import lombok.extern.slf4j.Slf4j; import org.eclipse.microprofile.config.inject.ConfigProperty; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/ScoreService.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/ScoreService.java similarity index 90% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/ScoreService.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/ScoreService.java index efe438e..3764501 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/ScoreService.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/ScoreService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.graduate.services; +package wusthelper.internal.graduate.services; import cn.wustlinghang.mywust.core.parser.graduate.GraduateScoreParser; import cn.wustlinghang.mywust.core.request.service.graduate.GraduateScoreApiService; import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/StudentInfoService.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/StudentInfoService.java similarity index 91% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/StudentInfoService.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/StudentInfoService.java index e5edc94..0855918 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/StudentInfoService.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/StudentInfoService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.graduate.services; +package wusthelper.internal.graduate.services; import cn.wustlinghang.mywust.core.parser.graduate.GraduateStudentInfoPageParser; import cn.wustlinghang.mywust.core.request.service.graduate.GraduateStudentInfoApiService; import cn.wustlinghang.mywust.data.global.StudentInfo; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/TrainingPlanService.java b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/TrainingPlanService.java similarity index 90% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/TrainingPlanService.java rename to sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/TrainingPlanService.java index 4730f5e..accc2fc 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/services/TrainingPlanService.java +++ b/sub-services/graduate/src/main/java/wusthelper/internal/graduate/services/TrainingPlanService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.graduate.services; +package wusthelper.internal.graduate.services; import cn.wustlinghang.mywust.core.parser.graduate.GraduateTrainingPlanPageParser; import cn.wustlinghang.mywust.core.request.service.graduate.GraduateTrainingPlanApiService; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.GraduateRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.GraduateRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/Main.java b/sub-services/library/src/main/java/wusthelper/internal/library/Main.java similarity index 84% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/Main.java rename to sub-services/library/src/main/java/wusthelper/internal/library/Main.java index f1f0816..98af10d 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/Main.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/Main.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.library; +package wusthelper.internal.library; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookCoverImageApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookCoverImageApi.java similarity index 84% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookCoverImageApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookCoverImageApi.java index 05b7f13..a4c8a1a 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookCoverImageApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookCoverImageApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; -import cn.wustlinghang.wusthelper.internal.library.services.BookCoverImageUrlService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.BookCoverImageUrlService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookDetailApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookDetailApi.java similarity index 78% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookDetailApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookDetailApi.java index 17e1ca8..1cb8ee4 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookDetailApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookDetailApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; import cn.wustlinghang.mywust.data.library.parsed.BookDetail; -import cn.wustlinghang.wusthelper.internal.library.services.BookDetailService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.BookDetailService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookHoldingApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookHoldingApi.java similarity index 79% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookHoldingApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookHoldingApi.java index b80739e..29999b1 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/BookHoldingApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/BookHoldingApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; import cn.wustlinghang.mywust.data.library.parsed.BookHolding; -import cn.wustlinghang.wusthelper.internal.library.services.BookHoldingService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.BookHoldingService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/CookieApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/CookieApi.java similarity index 78% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/CookieApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/CookieApi.java index 1cd512c..558b771 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/CookieApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/CookieApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; -import cn.wustlinghang.wusthelper.internal.library.services.LoginService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.LoginService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/CurrentLoanApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/CurrentLoanApi.java similarity index 86% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/CurrentLoanApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/CurrentLoanApi.java index b1f1481..681d10a 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/CurrentLoanApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/CurrentLoanApi.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.CurrentLoanBook; -import cn.wustlinghang.wusthelper.internal.library.services.CurrentLoanService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.CurrentLoanService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/LoanHistoryApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/LoanHistoryApi.java similarity index 86% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/LoanHistoryApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/LoanHistoryApi.java index abcd31f..173625a 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/LoanHistoryApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/LoanHistoryApi.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.HistoryLoanBook; -import cn.wustlinghang.wusthelper.internal.library.services.LoanHistoryService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.LoanHistoryService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/OverdueSoonApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/OverdueSoonApi.java similarity index 86% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/OverdueSoonApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/OverdueSoonApi.java index 9b2eb34..b9c54f1 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/OverdueSoonApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/OverdueSoonApi.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.BaseLoanBook; -import cn.wustlinghang.wusthelper.internal.library.services.OverdueSoonService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.OverdueSoonService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/SearchApi.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/SearchApi.java similarity index 85% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/SearchApi.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/SearchApi.java index b86104a..a49d621 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/SearchApi.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/SearchApi.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1; +package wusthelper.internal.library.api.http.v1; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.BookSearchResult; -import cn.wustlinghang.wusthelper.internal.library.services.SearchService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.library.services.SearchService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/BaseExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/BaseExceptionHandler.java similarity index 85% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/BaseExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/BaseExceptionHandler.java index 8512daa..2f104cd 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/BaseExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/BaseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.core.MediaType; @@ -29,7 +29,7 @@ public abstract class BaseExceptionHandler { try { response = objectMapper.writeValueAsString(RpcResponseDto.error(code, msg)); } catch (JsonProcessingException e) { - response = RpcResponseDto.error(RpcCommonResponseCode.SERVER_INTERNAL_ERROR); + response = RpcResponseDto.error(RpcCommonResponseCode.ServerInternalError); } return Response.status(status) diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/DefaultExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/DefaultExceptionHandler.java similarity index 70% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/DefaultExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/DefaultExceptionHandler.java index 759bd61..800acb0 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/DefaultExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/DefaultExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -13,7 +13,7 @@ public class DefaultExceptionHandler extends BaseExceptionHandler implements Exc public Response toResponse(Exception e) { log.error("未知异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "DefaultExceptionHandler" ); diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/IOExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/IOExceptionHandler.java similarity index 70% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/IOExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/IOExceptionHandler.java index 940d1ba..732c50c 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/IOExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/IOExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -15,7 +15,7 @@ public class IOExceptionHandler extends BaseExceptionHandler implements Exceptio public Response toResponse(IOException e) { log.error("IO异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "IOExceptionHandler" ); diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/ParseExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/ParseExceptionHandler.java similarity index 72% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/ParseExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/ParseExceptionHandler.java index 90369a0..31e9433 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/ParseExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/ParseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -14,7 +14,7 @@ public class ParseExceptionHandler extends BaseExceptionHandler implements Excep public Response toResponse(ParseException e) { log.error("解析异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "ParseExceptionHandler" ); diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/RpcExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/RpcExceptionHandler.java similarity index 75% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/RpcExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/RpcExceptionHandler.java index 80f4da5..ba0c70a 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/RpcExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/RpcExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/ValidationExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/ValidationExceptionHandler.java similarity index 73% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/ValidationExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/ValidationExceptionHandler.java index b369ac8..e73b3cf 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/ValidationExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/ValidationExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.validation.ValidationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; @@ -14,7 +14,7 @@ public class ValidationExceptionHandler extends BaseExceptionHandler @Override public Response toResponse(ValidationException e) { return super.toResponse( - RpcCommonResponseCode.PARAM_WRONG, + RpcCommonResponseCode.ParamWrong, "参数错误:" + e.toString(), "ValidationExceptionHandler" ); diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/WebApplicationExceptionHandler.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/WebApplicationExceptionHandler.java similarity index 80% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/WebApplicationExceptionHandler.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/WebApplicationExceptionHandler.java index f89b0a4..f25d346 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/handler/WebApplicationExceptionHandler.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/handler/WebApplicationExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler; +package wusthelper.internal.library.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/interceptor/ResponseWrapperInterceptor.java b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/interceptor/ResponseWrapperInterceptor.java similarity index 83% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/interceptor/ResponseWrapperInterceptor.java rename to sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/interceptor/ResponseWrapperInterceptor.java index 8386491..d38d965 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/api/http/v1/interceptor/ResponseWrapperInterceptor.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/api/http/v1/interceptor/ResponseWrapperInterceptor.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.api.http.v1.interceptor; +package wusthelper.internal.library.api.http.v1.interceptor; -import cn.wustlinghang.wusthelper.internal.library.api.http.v1.handler.BaseExceptionHandler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.library.api.http.v1.handler.BaseExceptionHandler; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.HttpHeaders; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/JacksonBean.java b/sub-services/library/src/main/java/wusthelper/internal/library/bean/JacksonBean.java similarity index 72% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/JacksonBean.java rename to sub-services/library/src/main/java/wusthelper/internal/library/bean/JacksonBean.java index f49d315..694e42f 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/JacksonBean.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/bean/JacksonBean.java @@ -1,8 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.bean; +package wusthelper.internal.library.bean; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Singleton; public class JacksonBean { @ApplicationScoped diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/MywustRequestAgentBeans.java b/sub-services/library/src/main/java/wusthelper/internal/library/bean/MywustRequestAgentBeans.java similarity index 97% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/MywustRequestAgentBeans.java rename to sub-services/library/src/main/java/wusthelper/internal/library/bean/MywustRequestAgentBeans.java index c2132c5..deac813 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/bean/MywustRequestAgentBeans.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/bean/MywustRequestAgentBeans.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.library.bean; +package wusthelper.internal.library.bean; import cn.wustlinghang.mywust.core.request.service.auth.LibraryLogin; import cn.wustlinghang.mywust.core.request.service.library.*; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/Register.java b/sub-services/library/src/main/java/wusthelper/internal/library/rpc/Register.java similarity index 78% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/Register.java rename to sub-services/library/src/main/java/wusthelper/internal/library/rpc/Register.java index e16c456..840749a 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/Register.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/rpc/Register.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.library.rpc; +package wusthelper.internal.library.rpc; import cn.wustlinghang.mywust.network.Requester; -import cn.wustlinghang.wusthelper.internal.library.rpc.config.RpcConfig; -import cn.wustlinghang.wusthelper.internal.rpc.FrpConsulRegister; -import cn.wustlinghang.wusthelper.internal.rpc.config.FrpConfig; -import cn.wustlinghang.wusthelper.internal.rpc.config.RegisterConfig; +import wusthelper.internal.library.rpc.config.RpcConfig; +import wusthelper.internal.rpc.FrpConsulRegister; +import wusthelper.internal.rpc.config.FrpConfig; +import wusthelper.internal.rpc.config.RegisterConfig; import com.fasterxml.jackson.databind.ObjectMapper; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/config/RpcConfig.java b/sub-services/library/src/main/java/wusthelper/internal/library/rpc/config/RpcConfig.java similarity index 93% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/config/RpcConfig.java rename to sub-services/library/src/main/java/wusthelper/internal/library/rpc/config/RpcConfig.java index 6a74767..07c1c6e 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/config/RpcConfig.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/rpc/config/RpcConfig.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.library.rpc.config; +package wusthelper.internal.library.rpc.config; import jakarta.inject.Singleton; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/health/HealthCheck.java b/sub-services/library/src/main/java/wusthelper/internal/library/rpc/health/HealthCheck.java similarity index 83% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/health/HealthCheck.java rename to sub-services/library/src/main/java/wusthelper/internal/library/rpc/health/HealthCheck.java index c981f40..a7f4c71 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/rpc/health/HealthCheck.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/rpc/health/HealthCheck.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.library.rpc.health; +package wusthelper.internal.library.rpc.health; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BaseService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/BaseService.java similarity index 89% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BaseService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/BaseService.java index dc0a8ae..5912fd5 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BaseService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/BaseService.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookCoverImageUrlService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/BookCoverImageUrlService.java similarity index 88% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookCoverImageUrlService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/BookCoverImageUrlService.java index f737a12..be6ba27 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookCoverImageUrlService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/BookCoverImageUrlService.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.BookCoverImageUrlApiService; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookDetailService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/BookDetailService.java similarity index 83% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookDetailService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/BookDetailService.java index 609b5b6..cbe271b 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookDetailService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/BookDetailService.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.BookDetailApiService; import cn.wustlinghang.mywust.data.library.parsed.BookDetail; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookHoldingService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/BookHoldingService.java similarity index 87% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookHoldingService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/BookHoldingService.java index 46ea3a4..6e65ff1 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/BookHoldingService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/BookHoldingService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.BookHoldingApiService; import cn.wustlinghang.mywust.data.library.parsed.BookHolding; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/CurrentLoanService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/CurrentLoanService.java similarity index 88% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/CurrentLoanService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/CurrentLoanService.java index a4682e2..216430a 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/CurrentLoanService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/CurrentLoanService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.CurrentLoanApiService; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.CurrentLoanBook; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoanHistoryService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/LoanHistoryService.java similarity index 88% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoanHistoryService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/LoanHistoryService.java index 0dbe1f3..7c274a2 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoanHistoryService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/LoanHistoryService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.LoanHistoryApiService; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.HistoryLoanBook; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import lombok.extern.slf4j.Slf4j; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoginService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/LoginService.java similarity index 95% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoginService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/LoginService.java index 6b299d8..1f12caf 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/LoginService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/LoginService.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.auth.LibraryLogin; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; import jakarta.enterprise.context.ApplicationScoped; import lombok.extern.slf4j.Slf4j; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/OverdueSoonService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/OverdueSoonService.java similarity index 88% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/OverdueSoonService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/OverdueSoonService.java index e57211f..3b8a9bd 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/OverdueSoonService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/OverdueSoonService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.OverdueSoonApiService; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.BaseLoanBook; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/SearchService.java b/sub-services/library/src/main/java/wusthelper/internal/library/services/SearchService.java similarity index 87% rename from sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/SearchService.java rename to sub-services/library/src/main/java/wusthelper/internal/library/services/SearchService.java index e607bb0..a24d2cc 100644 --- a/sub-services/library/src/main/java/cn/wustlinghang/wusthelper/internal/library/services/SearchService.java +++ b/sub-services/library/src/main/java/wusthelper/internal/library/services/SearchService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.library.services; +package wusthelper.internal.library.services; import cn.wustlinghang.mywust.core.request.service.library.SearchApiService; import cn.wustlinghang.mywust.data.library.PagingResult; import cn.wustlinghang.mywust.data.library.origin.BookSearchResult; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.LibraryRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.LibraryRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/Main.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/Main.java similarity index 84% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/Main.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/Main.java index 5af4f12..14f43b7 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/Main.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/Main.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.physics; +package wusthelper.internal.physics; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/CookieApi.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/CookieApi.java similarity index 78% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/CookieApi.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/CookieApi.java index 2d064d8..5fe8b41 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/CookieApi.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/CookieApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1; +package wusthelper.internal.physics.api.http.v1; -import cn.wustlinghang.wusthelper.internal.graduate.services.LoginService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.physics.services.LoginService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/CourseTableApi.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/CourseTableApi.java similarity index 82% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/CourseTableApi.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/CourseTableApi.java index d307055..7a2045d 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/CourseTableApi.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/CourseTableApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1; +package wusthelper.internal.physics.api.http.v1; import cn.wustlinghang.mywust.data.physics.PhysicsCourse; -import cn.wustlinghang.wusthelper.internal.physics.services.CourseTableService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.physics.services.CourseTableService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/ScoreApi.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/ScoreApi.java similarity index 84% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/ScoreApi.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/ScoreApi.java index 977625d..ff076c4 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/ScoreApi.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/ScoreApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1; +package wusthelper.internal.physics.api.http.v1; import cn.wustlinghang.mywust.data.global.Score; -import cn.wustlinghang.wusthelper.internal.physics.services.ScoreService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.physics.services.ScoreService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/BaseExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/BaseExceptionHandler.java similarity index 85% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/BaseExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/BaseExceptionHandler.java index d6e1948..6354878 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/BaseExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/BaseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.core.MediaType; @@ -29,7 +29,7 @@ public abstract class BaseExceptionHandler { try { response = objectMapper.writeValueAsString(RpcResponseDto.error(code, msg)); } catch (JsonProcessingException e) { - response = RpcResponseDto.error(RpcCommonResponseCode.SERVER_INTERNAL_ERROR); + response = RpcResponseDto.error(RpcCommonResponseCode.ServerInternalError); } return Response.status(status) diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/DefaultExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/DefaultExceptionHandler.java similarity index 69% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/DefaultExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/DefaultExceptionHandler.java index c667399..842c610 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/DefaultExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/DefaultExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -13,7 +13,7 @@ public class DefaultExceptionHandler extends BaseExceptionHandler implements Exc public Response toResponse(Exception e) { log.error("未知异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "DefaultExceptionHandler" ); diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/IOExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/IOExceptionHandler.java similarity index 70% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/IOExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/IOExceptionHandler.java index 97a22ba..7200407 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/IOExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/IOExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -15,7 +15,7 @@ public class IOExceptionHandler extends BaseExceptionHandler implements Exceptio public Response toResponse(IOException e) { log.error("IO异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "IOExceptionHandler" ); diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/ParseExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/ParseExceptionHandler.java similarity index 72% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/ParseExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/ParseExceptionHandler.java index bfaaba5..f09688e 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/ParseExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/ParseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -14,7 +14,7 @@ public class ParseExceptionHandler extends BaseExceptionHandler implements Excep public Response toResponse(ParseException e) { log.error("解析异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "ParseExceptionHandler" ); diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/RpcExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/RpcExceptionHandler.java similarity index 74% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/RpcExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/RpcExceptionHandler.java index 0c7783c..2c91200 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/RpcExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/RpcExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/ValidationExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/ValidationExceptionHandler.java similarity index 73% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/ValidationExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/ValidationExceptionHandler.java index 70b1cbe..f032722 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/handler/ValidationExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/ValidationExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.validation.ValidationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; @@ -14,7 +14,7 @@ public class ValidationExceptionHandler extends BaseExceptionHandler @Override public Response toResponse(ValidationException e) { return super.toResponse( - RpcCommonResponseCode.PARAM_WRONG, + RpcCommonResponseCode.ParamWrong, "参数错误:" + e.toString(), "ValidationExceptionHandler" ); diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/WebApplicationExceptionHandler.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/WebApplicationExceptionHandler.java similarity index 80% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/WebApplicationExceptionHandler.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/WebApplicationExceptionHandler.java index ca91465..871b60e 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/api/http/v1/handler/WebApplicationExceptionHandler.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/handler/WebApplicationExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.api.http.v1.handler; +package wusthelper.internal.physics.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.PhysicsRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.PhysicsRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/interceptor/ResponseWrapperInterceptor.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/interceptor/ResponseWrapperInterceptor.java similarity index 83% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/interceptor/ResponseWrapperInterceptor.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/interceptor/ResponseWrapperInterceptor.java index 0a96082..2734555 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/interceptor/ResponseWrapperInterceptor.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/api/http/v1/interceptor/ResponseWrapperInterceptor.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.interceptor; +package wusthelper.internal.physics.api.http.v1.interceptor; -import cn.wustlinghang.wusthelper.internal.graduate.api.http.v1.handler.BaseExceptionHandler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.physics.api.http.v1.handler.BaseExceptionHandler; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.HttpHeaders; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/JacksonBean.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/bean/JacksonBean.java similarity index 72% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/JacksonBean.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/bean/JacksonBean.java index d8b06f9..f5223cd 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/bean/JacksonBean.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/bean/JacksonBean.java @@ -1,8 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.graduate.bean; +package wusthelper.internal.physics.bean; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Singleton; public class JacksonBean { @ApplicationScoped diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/MywustParserBeans.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/bean/MywustParserBeans.java similarity index 73% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/MywustParserBeans.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/bean/MywustParserBeans.java index f817f0c..2ac0686 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/MywustParserBeans.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/bean/MywustParserBeans.java @@ -1,9 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.bean; +package wusthelper.internal.physics.bean; import cn.wustlinghang.mywust.core.parser.physics.PhysicsCoursePageParser; import cn.wustlinghang.mywust.core.parser.physics.PhysicsScorePageParser; -import cn.wustlinghang.mywust.core.parser.undergraduate.*; -import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Singleton; public class MywustParserBeans { diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/MywustRequestAgentBeans.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/bean/MywustRequestAgentBeans.java similarity index 96% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/MywustRequestAgentBeans.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/bean/MywustRequestAgentBeans.java index 9070c5f..abc1ca4 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/bean/MywustRequestAgentBeans.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/bean/MywustRequestAgentBeans.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.physics.bean; +package wusthelper.internal.physics.bean; import cn.wustlinghang.mywust.core.request.service.auth.PhysicsLogin; import cn.wustlinghang.mywust.core.request.service.physics.PhysicsCourseApiService; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/Register.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/Register.java similarity index 78% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/Register.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/Register.java index 85924d1..55dbb36 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/Register.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/Register.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.graduate.rpc; +package wusthelper.internal.physics.rpc; import cn.wustlinghang.mywust.network.Requester; -import cn.wustlinghang.wusthelper.internal.graduate.rpc.config.RpcConfig; -import cn.wustlinghang.wusthelper.internal.rpc.FrpConsulRegister; -import cn.wustlinghang.wusthelper.internal.rpc.config.FrpConfig; -import cn.wustlinghang.wusthelper.internal.rpc.config.RegisterConfig; +import wusthelper.internal.physics.rpc.config.RpcConfig; +import wusthelper.internal.rpc.FrpConsulRegister; +import wusthelper.internal.rpc.config.FrpConfig; +import wusthelper.internal.rpc.config.RegisterConfig; import com.fasterxml.jackson.databind.ObjectMapper; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/config/RpcConfig.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/config/RpcConfig.java similarity index 92% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/config/RpcConfig.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/config/RpcConfig.java index fe61fd3..e27c383 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/config/RpcConfig.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/config/RpcConfig.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.graduate.rpc.config; +package wusthelper.internal.physics.rpc.config; import jakarta.inject.Singleton; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/health/HealthCheck.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/health/HealthCheck.java similarity index 82% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/health/HealthCheck.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/health/HealthCheck.java index 4c2e8b9..fca3055 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/rpc/health/HealthCheck.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/rpc/health/HealthCheck.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.graduate.rpc.health; +package wusthelper.internal.physics.rpc.health; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/BaseService.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/BaseService.java similarity index 89% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/BaseService.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/services/BaseService.java index 1b442e6..614b592 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/BaseService.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/BaseService.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.physics.services; +package wusthelper.internal.physics.services; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.PhysicsRpcException; +import wusthelper.internal.rpc.exception.PhysicsRpcException; import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/CourseTableService.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/CourseTableService.java similarity index 90% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/CourseTableService.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/services/CourseTableService.java index ff10945..b561cdf 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/CourseTableService.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/CourseTableService.java @@ -1,12 +1,12 @@ -package cn.wustlinghang.wusthelper.internal.physics.services; +package wusthelper.internal.physics.services; import cn.wustlinghang.mywust.core.parser.physics.PhysicsCoursePageParser; import cn.wustlinghang.mywust.core.request.service.physics.PhysicsCourseApiService; import cn.wustlinghang.mywust.data.physics.PhysicsCourse; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.PhysicsRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.PhysicsRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/LoginService.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/LoginService.java similarity index 95% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/LoginService.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/services/LoginService.java index 1bb88d5..80ac51b 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/LoginService.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/LoginService.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.physics.services; +package wusthelper.internal.physics.services; import cn.wustlinghang.mywust.core.request.service.auth.PhysicsLogin; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.PhysicsRpcException; +import wusthelper.internal.rpc.exception.PhysicsRpcException; import jakarta.enterprise.context.ApplicationScoped; import lombok.extern.slf4j.Slf4j; diff --git a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/ScoreService.java b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/ScoreService.java similarity index 93% rename from sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/ScoreService.java rename to sub-services/physics/src/main/java/wusthelper/internal/physics/services/ScoreService.java index 48dc416..aec37b5 100644 --- a/sub-services/physics/src/main/java/cn/wustlinghang/wusthelper/internal/physics/services/ScoreService.java +++ b/sub-services/physics/src/main/java/wusthelper/internal/physics/services/ScoreService.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.physics.services; +package wusthelper.internal.physics.services; import cn.wustlinghang.mywust.core.parser.physics.PhysicsScorePageParser; import cn.wustlinghang.mywust.core.request.service.physics.PhysicsScoreApiService; @@ -6,8 +6,8 @@ import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.exception.ParseException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.PhysicsRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.PhysicsRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CookieApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CookieApi.java similarity index 78% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CookieApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CookieApi.java index 2c85b5a..d16aefe 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CookieApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CookieApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; -import cn.wustlinghang.wusthelper.internal.undergrad.services.LoginService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.LoginService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CourseTableApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CourseTableApi.java similarity index 84% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CourseTableApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CourseTableApi.java index 90cd196..4f4383d 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CourseTableApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CourseTableApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; import cn.wustlinghang.mywust.data.global.Course; -import cn.wustlinghang.wusthelper.internal.undergrad.services.CourseTableService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.CourseTableService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CreditStatusApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CreditStatusApi.java similarity index 81% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CreditStatusApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CreditStatusApi.java index 64caabe..9bfe60d 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/CreditStatusApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/CreditStatusApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; -import cn.wustlinghang.wusthelper.internal.undergrad.services.CreditStatusService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.CreditStatusService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ExamActivitiesApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ExamActivitiesApi.java similarity index 82% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ExamActivitiesApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ExamActivitiesApi.java index f82c377..3563eef 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ExamActivitiesApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ExamActivitiesApi.java @@ -1,9 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradExamDelayApiService; -import cn.wustlinghang.mywust.data.global.Score; -import cn.wustlinghang.wusthelper.internal.undergrad.services.ExamActivitiesService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.ExamActivitiesService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ExamDelayApplicationApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ExamDelayApplicationApi.java similarity index 86% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ExamDelayApplicationApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ExamDelayApplicationApi.java index e4aadb4..03fd11d 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ExamDelayApplicationApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ExamDelayApplicationApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication; -import cn.wustlinghang.wusthelper.internal.undergrad.services.ExamDelayApplicationService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.ExamDelayApplicationService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ScoreApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ScoreApi.java similarity index 82% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ScoreApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ScoreApi.java index b90c812..6cbff8f 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/ScoreApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/ScoreApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; import cn.wustlinghang.mywust.data.global.Score; -import cn.wustlinghang.wusthelper.internal.undergrad.services.ScoreService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.ScoreService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/StudentInfoApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/StudentInfoApi.java similarity index 82% rename from sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/StudentInfoApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/StudentInfoApi.java index 83acf6b..107bd62 100644 --- a/sub-services/graduate/src/main/java/cn/wustlinghang/wusthelper/internal/graduate/api/http/v1/StudentInfoApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/StudentInfoApi.java @@ -1,8 +1,8 @@ -package cn.wustlinghang.wusthelper.internal.graduate.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; import cn.wustlinghang.mywust.data.global.StudentInfo; -import cn.wustlinghang.wusthelper.internal.graduate.services.StudentInfoService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.StudentInfoService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/TrainingPlanApi.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/TrainingPlanApi.java similarity index 81% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/TrainingPlanApi.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/TrainingPlanApi.java index 2a26864..ea206cf 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/TrainingPlanApi.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/TrainingPlanApi.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1; +package wusthelper.internal.undergrad.api.http.v1; -import cn.wustlinghang.wusthelper.internal.undergrad.services.TrainingPlanService; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.undergrad.services.TrainingPlanService; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import jakarta.validation.constraints.NotNull; import jakarta.ws.rs.GET; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/BaseExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/BaseExceptionHandler.java similarity index 85% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/BaseExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/BaseExceptionHandler.java index 250bde6..823e6b7 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/BaseExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/BaseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.core.MediaType; @@ -29,7 +29,7 @@ public abstract class BaseExceptionHandler { try { response = objectMapper.writeValueAsString(RpcResponseDto.error(code, msg)); } catch (JsonProcessingException e) { - response = RpcResponseDto.error(RpcCommonResponseCode.SERVER_INTERNAL_ERROR); + response = RpcResponseDto.error(RpcCommonResponseCode.ServerInternalError); } return Response.status(status) diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/DefaultExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/DefaultExceptionHandler.java similarity index 69% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/DefaultExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/DefaultExceptionHandler.java index e0fc42a..fab3e88 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/DefaultExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/DefaultExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -13,7 +13,7 @@ public class DefaultExceptionHandler extends BaseExceptionHandler implements Exc public Response toResponse(Exception e) { log.error("未知异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "DefaultExceptionHandler" ); diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/IOExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/IOExceptionHandler.java similarity index 70% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/IOExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/IOExceptionHandler.java index e06d817..290a815 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/IOExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/IOExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -15,7 +15,7 @@ public class IOExceptionHandler extends BaseExceptionHandler implements Exceptio public Response toResponse(IOException e) { log.error("IO异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "IOExceptionHandler" ); diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/ParseExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/ParseExceptionHandler.java similarity index 72% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/ParseExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/ParseExceptionHandler.java index b503159..67be536 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/ParseExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/ParseExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; import cn.wustlinghang.mywust.exception.ParseException; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; @@ -14,7 +14,7 @@ public class ParseExceptionHandler extends BaseExceptionHandler implements Excep public Response toResponse(ParseException e) { log.error("解析异常:", e); return super.toResponse( - RpcCommonResponseCode.SERVER_INTERNAL_ERROR, + RpcCommonResponseCode.ServerInternalError, e.toString(), "ParseExceptionHandler" ); diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/RpcExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/RpcExceptionHandler.java similarity index 74% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/RpcExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/RpcExceptionHandler.java index 995a542..eeae286 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/RpcExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/RpcExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; import jakarta.ws.rs.ext.Provider; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/ValidationExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/ValidationExceptionHandler.java similarity index 73% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/ValidationExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/ValidationExceptionHandler.java index 098707c..0a79a3c 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/ValidationExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/ValidationExceptionHandler.java @@ -1,6 +1,6 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcCommonResponseCode; +import wusthelper.internal.rpc.response.RpcCommonResponseCode; import jakarta.validation.ValidationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; @@ -14,7 +14,7 @@ public class ValidationExceptionHandler extends BaseExceptionHandler @Override public Response toResponse(ValidationException e) { return super.toResponse( - RpcCommonResponseCode.PARAM_WRONG, + RpcCommonResponseCode.ParamWrong, "参数错误:" + e.toString(), "ValidationExceptionHandler" ); diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/WebApplicationExceptionHandler.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/WebApplicationExceptionHandler.java similarity index 80% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/WebApplicationExceptionHandler.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/WebApplicationExceptionHandler.java index 7ace25e..0e94280 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/handler/WebApplicationExceptionHandler.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/handler/WebApplicationExceptionHandler.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler; +package wusthelper.internal.undergrad.api.http.v1.handler; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.Response; import jakarta.ws.rs.ext.ExceptionMapper; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/interceptor/ResponseWrapperInterceptor.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/interceptor/ResponseWrapperInterceptor.java similarity index 83% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/interceptor/ResponseWrapperInterceptor.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/interceptor/ResponseWrapperInterceptor.java index 4c46e22..7203f84 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/api/http/v1/interceptor/ResponseWrapperInterceptor.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/api/http/v1/interceptor/ResponseWrapperInterceptor.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.interceptor; +package wusthelper.internal.undergrad.api.http.v1.interceptor; -import cn.wustlinghang.wusthelper.internal.undergrad.api.http.v1.handler.BaseExceptionHandler; -import cn.wustlinghang.wusthelper.internal.rpc.response.RpcResponseDto; +import wusthelper.internal.undergrad.api.http.v1.handler.BaseExceptionHandler; +import wusthelper.internal.rpc.response.RpcResponseDto; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.ws.rs.WebApplicationException; import jakarta.ws.rs.core.HttpHeaders; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/JacksonBean.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/JacksonBean.java similarity index 72% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/JacksonBean.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/JacksonBean.java index c95e91d..9671787 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/JacksonBean.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/JacksonBean.java @@ -1,8 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.bean; +package wusthelper.internal.undergrad.bean; import com.fasterxml.jackson.databind.ObjectMapper; import jakarta.enterprise.context.ApplicationScoped; -import jakarta.inject.Singleton; public class JacksonBean { @ApplicationScoped diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/MywustParserBeans.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/MywustParserBeans.java similarity index 94% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/MywustParserBeans.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/MywustParserBeans.java index a9fbc00..f8650ea 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/MywustParserBeans.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/MywustParserBeans.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.bean; +package wusthelper.internal.undergrad.bean; import cn.wustlinghang.mywust.core.parser.undergraduate.*; import jakarta.enterprise.context.ApplicationScoped; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/MywustRequestAgentBeans.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/MywustRequestAgentBeans.java similarity index 97% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/MywustRequestAgentBeans.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/MywustRequestAgentBeans.java index b959e45..b9b78f6 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/bean/MywustRequestAgentBeans.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/bean/MywustRequestAgentBeans.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.bean; +package wusthelper.internal.undergrad.bean; import cn.wustlinghang.mywust.core.request.service.auth.UndergraduateLogin; import cn.wustlinghang.mywust.core.request.service.undergraduate.*; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/Register.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/Register.java similarity index 75% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/Register.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/Register.java index 4a8492e..ae0d263 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/Register.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/Register.java @@ -1,16 +1,15 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.rpc; +package wusthelper.internal.undergrad.rpc; import cn.wustlinghang.mywust.network.Requester; -import cn.wustlinghang.wusthelper.internal.rpc.FrpConsulRegister; -import cn.wustlinghang.wusthelper.internal.rpc.config.FrpConfig; -import cn.wustlinghang.wusthelper.internal.rpc.config.RegisterConfig; -import cn.wustlinghang.wusthelper.internal.undergrad.rpc.config.RpcConfig; +import wusthelper.internal.rpc.FrpConsulRegister; +import wusthelper.internal.rpc.config.FrpConfig; +import wusthelper.internal.rpc.config.RegisterConfig; +import wusthelper.internal.undergrad.rpc.config.RpcConfig; import com.fasterxml.jackson.databind.ObjectMapper; import io.quarkus.runtime.Startup; import jakarta.annotation.PostConstruct; import jakarta.enterprise.context.ApplicationScoped; import lombok.extern.slf4j.Slf4j; -import org.eclipse.microprofile.config.inject.ConfigProperty; @Slf4j @Startup diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/config/RpcConfig.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/config/RpcConfig.java similarity index 92% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/config/RpcConfig.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/config/RpcConfig.java index ef8fc9a..71867e2 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/config/RpcConfig.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/config/RpcConfig.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.rpc.config; +package wusthelper.internal.undergrad.rpc.config; import jakarta.inject.Singleton; import jakarta.ws.rs.DefaultValue; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/health/HealthCheck.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/health/HealthCheck.java similarity index 82% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/health/HealthCheck.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/health/HealthCheck.java index 44eb0c1..8394a2e 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/rpc/health/HealthCheck.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/rpc/health/HealthCheck.java @@ -1,4 +1,4 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.rpc.health; +package wusthelper.internal.undergrad.rpc.health; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/BaseService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/BaseService.java similarity index 89% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/BaseService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/BaseService.java index c487b11..365f44a 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/BaseService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/BaseService.java @@ -1,7 +1,7 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; import lombok.extern.slf4j.Slf4j; @Slf4j diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/CourseTableService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/CourseTableService.java similarity index 91% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/CourseTableService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/CourseTableService.java index ba3dee6..eb0ee22 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/CourseTableService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/CourseTableService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradCourseTableParser; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradCourseTableApiService; import cn.wustlinghang.mywust.data.global.Course; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/CreditStatusService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/CreditStatusService.java similarity index 90% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/CreditStatusService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/CreditStatusService.java index 0efae3a..7354f04 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/CreditStatusService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/CreditStatusService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradCreditStatusParser; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradCreditStatusApiService; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ExamActivitiesService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ExamActivitiesService.java similarity index 84% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ExamActivitiesService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ExamActivitiesService.java index 98193a7..3b00f7f 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ExamActivitiesService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ExamActivitiesService.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradExamDelayApiService; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ExamDelayApplicationService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ExamDelayApplicationService.java similarity index 90% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ExamDelayApplicationService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ExamDelayApplicationService.java index 0c67167..7d72446 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ExamDelayApplicationService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ExamDelayApplicationService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradExamDelayParser; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradExamDelayApiService; import cn.wustlinghang.mywust.data.undergrad.ExamDelayApplication; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/LoginService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/LoginService.java similarity index 95% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/LoginService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/LoginService.java index e97adba..b9b3980 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/LoginService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/LoginService.java @@ -1,9 +1,9 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.request.service.auth.UndergraduateLogin; import cn.wustlinghang.mywust.exception.ApiException; import cn.wustlinghang.mywust.network.RequestClientOption; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; import jakarta.enterprise.context.ApplicationScoped; import lombok.extern.slf4j.Slf4j; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ScoreService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ScoreService.java similarity index 90% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ScoreService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ScoreService.java index ec0f261..12a0a8a 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/ScoreService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/ScoreService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradScoreParser; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradScoreApiService; import cn.wustlinghang.mywust.data.global.Score; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/StudentInfoService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/StudentInfoService.java similarity index 90% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/StudentInfoService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/StudentInfoService.java index ca7a605..4ec1396 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/StudentInfoService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/StudentInfoService.java @@ -1,11 +1,11 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradStudentInfoPageParser; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradStudentInfoApiService; import cn.wustlinghang.mywust.data.global.StudentInfo; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException; diff --git a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/TrainingPlanService.java b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/TrainingPlanService.java similarity index 89% rename from sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/TrainingPlanService.java rename to sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/TrainingPlanService.java index 8dfb0e1..6786bce 100644 --- a/sub-services/undergrad/src/main/java/cn/wustlinghang/wusthelper/internal/undergrad/services/TrainingPlanService.java +++ b/sub-services/undergrad/src/main/java/wusthelper/internal/undergrad/services/TrainingPlanService.java @@ -1,10 +1,10 @@ -package cn.wustlinghang.wusthelper.internal.undergrad.services; +package wusthelper.internal.undergrad.services; import cn.wustlinghang.mywust.core.parser.undergraduate.UndergradTrainingPlanPageParser; import cn.wustlinghang.mywust.core.request.service.undergraduate.UndergradTrainingPlanApiService; import cn.wustlinghang.mywust.exception.ApiException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.UndergradRpcException; -import cn.wustlinghang.wusthelper.internal.rpc.exception.RpcException; +import wusthelper.internal.rpc.exception.UndergradRpcException; +import wusthelper.internal.rpc.exception.RpcException; import jakarta.enterprise.context.ApplicationScoped; import java.io.IOException;