diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000000000000000000000000000000000000..a95575f55f63846f3fb539ae126beb0b4fef5edd --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000000000000000000000000000000000000..961cd4f406ed8f9b751068ca9a01b9de762e349f --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000000000000000000000000000000000000..d958f5dcb03fa93211d75c1c2ceebdae0de6a464 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,172 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1729731292150 + + + 1729731753929 + + + 1729733767035 + + + 1729756238756 + + + + + + + + + + \ No newline at end of file diff --git a/assess-common/pom.xml b/assess-common/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..a4e412439078cc770dc840685c1daa65c14039b3 --- /dev/null +++ b/assess-common/pom.xml @@ -0,0 +1,26 @@ + + + 4.0.0 + + org.example + qiniuyun1024 + 1.0-SNAPSHOT + + + assess-common + + + UTF-8 + UTF-8 + + + + + org.projectlombok + lombok + + + + \ No newline at end of file diff --git a/assess-common/src/main/java/com/common/dto/GithubUser.java b/assess-common/src/main/java/com/common/dto/GithubUser.java new file mode 100644 index 0000000000000000000000000000000000000000..0014dd6461532c0ab3ae1c1eadf98f4231e21995 --- /dev/null +++ b/assess-common/src/main/java/com/common/dto/GithubUser.java @@ -0,0 +1,59 @@ +package com.common.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description githubAPI获取对应用户的信息 + * @Author nomo + * @Date 2024/10/24 15:37 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data +@Builder +public class GithubUser { + + private String login; + private long id; + private String node_id; + private String avatar_url; + private String gravatar_id; + private String url; + private String html_url; + private String followers_url; + private String following_url; + private String gists_url; + private String starred_url; + private String subscriptions_url; + private String organizations_url; + private String repos_url; + private String events_url; + private String received_events_url; + private String type; + private String user_view_type; + private boolean site_admin; + private String name; + private String company; + private String blog; + private String location; + private String email; + private String hireable; + private String bio; + private String twitter_username; + private int public_repos; + private int public_gists; + private int followers; + private int following; + private String created_at; + private String updated_at; + private int private_gists; + private int total_private_repos; + private int owned_private_repos; + private long disk_usage; + private int collaborators; + private boolean two_factor_authentication; + private Plan plan; +} diff --git a/assess-common/src/main/java/com/common/dto/Plan.java b/assess-common/src/main/java/com/common/dto/Plan.java new file mode 100644 index 0000000000000000000000000000000000000000..a640242babd992762abb3a2d099259b553ae37a0 --- /dev/null +++ b/assess-common/src/main/java/com/common/dto/Plan.java @@ -0,0 +1,22 @@ +package com.common.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Description + * @Author nomo + * @Date 2024/10/24 15:38 + */ +@AllArgsConstructor +@NoArgsConstructor +@Data +@Builder +public class Plan { + private String name; + private long space; + private int collaborators; + private int private_repos; +} diff --git a/assess-web/pom.xml b/assess-web/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..2245d0d5a504a9a39d2794692e6ad7e772d1a948 --- /dev/null +++ b/assess-web/pom.xml @@ -0,0 +1,63 @@ + + + 4.0.0 + + org.example + qiniuyun1024 + 1.0-SNAPSHOT + + + assess-web + + + + org.springframework.boot + spring-boot-starter-web + + + org.projectlombok + lombok + + + com.google.guava + guava + + + cn.hutool + hutool-all + + + com.alibaba + fastjson + + + org.projectlombok + lombok + + + junit + junit + + + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + org.projectlombok + lombok + + + + + + + + \ No newline at end of file diff --git a/assess-web/src/main/java/com/web/controller/TestController.java b/assess-web/src/main/java/com/web/controller/TestController.java new file mode 100644 index 0000000000000000000000000000000000000000..a7c7c2f2989a5a358b55543728641fcc2b0bd62f --- /dev/null +++ b/assess-web/src/main/java/com/web/controller/TestController.java @@ -0,0 +1,62 @@ +package com.web.controller; + +import cn.hutool.http.HttpRequest; +import cn.hutool.http.HttpResponse; +import com.alibaba.fastjson.JSON; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * @Description + * @Author nomo + * @Date 2024/10/24 9:16 + */ +@RestController +@Slf4j +public class TestController { + + /* + * 测试SpringBoot + * */ + @RequestMapping("/test") + private String test() { + System.out.println("sout:777"); + log.info("999"); + return "666"; + } + + /* + * 测试GithubAPI接口 + * */ + @RequestMapping("/GithubUser") + private String githubTest(){ + //TODO: 输入GitHub 用户名 + String username = "nomop"; + + final String GITHUB_API_URL = "https://api.github.com/users/"; + final String TOKEN = "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"; + + // 构建完整的 URL + String url = GITHUB_API_URL + username; + + // 使用 Hutool 发起 GET 请求 + HttpResponse response = HttpRequest.get(url) + .header("Authorization", "token " + TOKEN) // 设置 GitHub Token 以避免限流 + .header("Accept", "application/vnd.github.v3+json") // 设置接受的数据格式 + .timeout(20000) // 设置超时时间(毫秒) + .execute(); + + + //TODO:包装成VO类 + + // 检查响应状态码 + if (response.getStatus() == 200) { + // 获取并输出返回的用户信息 + log.info(response.body()); + return "用户信息: " + response.body(); + } else { + return "请求失败,状态码: " + response.getStatus(); + } + } +} diff --git a/assess-web/src/main/java/test/Test.java b/assess-web/src/main/java/test/Test.java new file mode 100644 index 0000000000000000000000000000000000000000..89646b4ef94c74e264ae8d11d56921d6194f7584 --- /dev/null +++ b/assess-web/src/main/java/test/Test.java @@ -0,0 +1,46 @@ +package test; + +import cn.hutool.core.collection.CollUtil; +import com.alibaba.fastjson.JSON; +import com.google.common.base.Throwables; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; + +import java.util.Arrays; +import java.util.List; + +/** + * @Description 组件测试 + * @Author nomo + * @Date 2024/10/24 9:30 + */ +public class Test { + + public static void main(String[] args) { + + try { + LombokTest lombokTest1 = LombokTest.builder().id("1").name("好吃").build(); + LombokTest lombokTest2 = LombokTest.builder().id("2").name("好玩").build(); + List lombokTests = Arrays.asList(lombokTest1, lombokTest2); + if (CollUtil.isNotEmpty(lombokTests)) { + System.out.println(JSON.toJSONString(lombokTests)); + } + } catch (Exception e) { + System.out.println(Throwables.getStackTraceAsString(e)); + + } + } + + @AllArgsConstructor + @NoArgsConstructor + @Data + @Builder + public static class LombokTest{ + private String name; + private String id; + } + +} diff --git a/assess-web/target/classes/com/web/controller/TestController.class b/assess-web/target/classes/com/web/controller/TestController.class new file mode 100644 index 0000000000000000000000000000000000000000..809ab93fd58ddda3194427aba59327d4d831c345 Binary files /dev/null and b/assess-web/target/classes/com/web/controller/TestController.class differ diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000000000000000000000000000000000..e8077103583113bd47ba5b450966c570fd9f421b --- /dev/null +++ b/pom.xml @@ -0,0 +1,66 @@ + + + 4.0.0 + + org.example + qiniuyun1024 + 1.0-SNAPSHOT + pom + + + assess-web + assess-common + + + + + org.springframework.boot + spring-boot-starter-parent + 2.5.6 + + + + + UTF-8 + UTF-8 + + + + + + + + + + junit + junit + 4.13.2 + + + + + cn.hutool + hutool-all + 5.7.15 + + + + + com.google.guava + guava + 31.0.1-jre + + + + + com.alibaba + fastjson + 1.2.83 + + + + + + \ No newline at end of file