From 83b93221ab0616ef92c131113f044d192fbfd0fa Mon Sep 17 00:00:00 2001 From: zrh050423 <14331304+zrh050423@user.noreply.gitee.com> Date: Tue, 24 Dec 2024 12:24:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9C=80=E7=BB=88=E7=89=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../healthsystem/HealthSystemApplication.java | 4 +-- .../zrh/healthsystem/config/WebConfig.java | 4 +-- .../edu/zrh/healthsystem/entity/TalkInfo.java | 4 +-- .../healthsystem/entity/UserLoginInfo.java | 4 +-- .../zrh/healthsystem/entity/UserMainInfo.java | 4 +-- .../zrh/healthsystem/mapper/UserMapper.java | 4 +-- .../edu/zrh/healthsystem/model/Login.java | 4 +-- .../edu/zrh/healthsystem/model/Message.java | 4 +-- .../java/edu/zrh/healthsystem/model/Talk.java | 6 +++- .../java/edu/zrh/healthsystem/model/User.java | 4 +-- .../model/response/LoginResponse.java | 4 +-- .../model/response/ResultResponse.java | 7 ---- .../model/response/TalkResponse.java | 4 +-- .../repository/LoginRepository.java | 4 +-- .../healthsystem/service/LoginService.java | 34 +------------------ .../zrh/healthsystem/service/TalkService.java | 4 +-- 16 files changed, 19 insertions(+), 80 deletions(-) diff --git a/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java b/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java index c0fd6d3..93467eb 100644 --- a/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java +++ b/src/main/java/edu/zrh/healthsystem/HealthSystemApplication.java @@ -6,9 +6,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.data.jpa.repository.config.EnableJpaRepositories; -/** - * @author han - */ + @EnableJpaRepositories @SpringBootApplication public class HealthSystemApplication { diff --git a/src/main/java/edu/zrh/healthsystem/config/WebConfig.java b/src/main/java/edu/zrh/healthsystem/config/WebConfig.java index a4e24a8..2d9a8fa 100644 --- a/src/main/java/edu/zrh/healthsystem/config/WebConfig.java +++ b/src/main/java/edu/zrh/healthsystem/config/WebConfig.java @@ -5,9 +5,7 @@ import org.springframework.context.annotation.Configuration; import org.springframework.web.client.RestTemplate; import org.springframework.web.socket.server.standard.ServerEndpointExporter; -/** - * @author han - */ + @Configuration public class WebConfig { diff --git a/src/main/java/edu/zrh/healthsystem/entity/TalkInfo.java b/src/main/java/edu/zrh/healthsystem/entity/TalkInfo.java index 499ef41..bc1bcc9 100644 --- a/src/main/java/edu/zrh/healthsystem/entity/TalkInfo.java +++ b/src/main/java/edu/zrh/healthsystem/entity/TalkInfo.java @@ -2,9 +2,7 @@ package edu.zrh.healthsystem.entity; import jakarta.persistence.*; import lombok.Data; -/** - * @author han - */ + @Data @Entity @Table(name = "talk_info") diff --git a/src/main/java/edu/zrh/healthsystem/entity/UserLoginInfo.java b/src/main/java/edu/zrh/healthsystem/entity/UserLoginInfo.java index 0fdc05d..7640f73 100644 --- a/src/main/java/edu/zrh/healthsystem/entity/UserLoginInfo.java +++ b/src/main/java/edu/zrh/healthsystem/entity/UserLoginInfo.java @@ -2,9 +2,7 @@ package edu.zrh.healthsystem.entity; import jakarta.persistence.*; import lombok.Data; -/** - * @author han - */ + @Entity @Data @Table(name = "user_login") diff --git a/src/main/java/edu/zrh/healthsystem/entity/UserMainInfo.java b/src/main/java/edu/zrh/healthsystem/entity/UserMainInfo.java index 1e9f46e..2b3019b 100644 --- a/src/main/java/edu/zrh/healthsystem/entity/UserMainInfo.java +++ b/src/main/java/edu/zrh/healthsystem/entity/UserMainInfo.java @@ -1,9 +1,7 @@ package edu.zrh.healthsystem.entity; import jakarta.persistence.*; import lombok.Data; -/** - * @author han - */ + @Entity @Data @Table(name = "user_main") diff --git a/src/main/java/edu/zrh/healthsystem/mapper/UserMapper.java b/src/main/java/edu/zrh/healthsystem/mapper/UserMapper.java index 8e04ce7..f52d2be 100644 --- a/src/main/java/edu/zrh/healthsystem/mapper/UserMapper.java +++ b/src/main/java/edu/zrh/healthsystem/mapper/UserMapper.java @@ -12,9 +12,7 @@ import java.time.LocalDateTime; import java.util.List; -/** - * @author han - */ + @Mapper public interface UserMapper { diff --git a/src/main/java/edu/zrh/healthsystem/model/Login.java b/src/main/java/edu/zrh/healthsystem/model/Login.java index 85141e3..5a7c76c 100644 --- a/src/main/java/edu/zrh/healthsystem/model/Login.java +++ b/src/main/java/edu/zrh/healthsystem/model/Login.java @@ -2,9 +2,7 @@ package edu.zrh.healthsystem.model; import lombok.Data; -/** - * @author han - */ + @Data public class Login { private String username; diff --git a/src/main/java/edu/zrh/healthsystem/model/Message.java b/src/main/java/edu/zrh/healthsystem/model/Message.java index 3abc3ee..95d0ed4 100644 --- a/src/main/java/edu/zrh/healthsystem/model/Message.java +++ b/src/main/java/edu/zrh/healthsystem/model/Message.java @@ -2,9 +2,7 @@ package edu.zrh.healthsystem.model; import lombok.Data; -/** - * @author han - */ + public @Data class Message { private String from; private String text; diff --git a/src/main/java/edu/zrh/healthsystem/model/Talk.java b/src/main/java/edu/zrh/healthsystem/model/Talk.java index 643ef3e..edd99c8 100644 --- a/src/main/java/edu/zrh/healthsystem/model/Talk.java +++ b/src/main/java/edu/zrh/healthsystem/model/Talk.java @@ -6,10 +6,14 @@ import java.util.List; /** - * @author han + * + * 模型输入参数 */ public @Data class Talk { + //模型名称 private String model="glm4:latest"; + //模型输入 private String prompt; + //是否流式输出 private Boolean stream=false; } diff --git a/src/main/java/edu/zrh/healthsystem/model/User.java b/src/main/java/edu/zrh/healthsystem/model/User.java index 400b500..0e5e5f1 100644 --- a/src/main/java/edu/zrh/healthsystem/model/User.java +++ b/src/main/java/edu/zrh/healthsystem/model/User.java @@ -5,9 +5,7 @@ import lombok.Data; import java.time.LocalDateTime; -/** - * @author han - */ + @Data public class User { private Long id; diff --git a/src/main/java/edu/zrh/healthsystem/model/response/LoginResponse.java b/src/main/java/edu/zrh/healthsystem/model/response/LoginResponse.java index 19aeec6..d5f53e4 100644 --- a/src/main/java/edu/zrh/healthsystem/model/response/LoginResponse.java +++ b/src/main/java/edu/zrh/healthsystem/model/response/LoginResponse.java @@ -3,9 +3,7 @@ package edu.zrh.healthsystem.model.response; import lombok.AllArgsConstructor; import lombok.Data; -/** - * @author han - */ + @Data @AllArgsConstructor public class LoginResponse { diff --git a/src/main/java/edu/zrh/healthsystem/model/response/ResultResponse.java b/src/main/java/edu/zrh/healthsystem/model/response/ResultResponse.java index 4a857b8..2bba225 100644 --- a/src/main/java/edu/zrh/healthsystem/model/response/ResultResponse.java +++ b/src/main/java/edu/zrh/healthsystem/model/response/ResultResponse.java @@ -31,11 +31,4 @@ public class ResultResponse implements Serializable { return resultResponse; } - public static ResultResponse error(String msg) { - ResultResponse resultResponse = new ResultResponse(); - resultResponse.msg = msg; - resultResponse.code = 0; - return resultResponse; - } - } diff --git a/src/main/java/edu/zrh/healthsystem/model/response/TalkResponse.java b/src/main/java/edu/zrh/healthsystem/model/response/TalkResponse.java index 50bb59f..34f1f99 100644 --- a/src/main/java/edu/zrh/healthsystem/model/response/TalkResponse.java +++ b/src/main/java/edu/zrh/healthsystem/model/response/TalkResponse.java @@ -5,9 +5,7 @@ import lombok.Data; import java.util.Date; import java.util.List; -/** - * @author han - */ + public @Data class TalkResponse { private String model; private Date createdAt; diff --git a/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java b/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java index 3117ab2..7335700 100644 --- a/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java +++ b/src/main/java/edu/zrh/healthsystem/repository/LoginRepository.java @@ -4,9 +4,7 @@ import edu.zrh.healthsystem.entity.UserLoginInfo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; -/** - * @author han - */ + @Repository public interface LoginRepository extends JpaRepository { UserLoginInfo findByUsername(String username); diff --git a/src/main/java/edu/zrh/healthsystem/service/LoginService.java b/src/main/java/edu/zrh/healthsystem/service/LoginService.java index bb08b90..c614763 100644 --- a/src/main/java/edu/zrh/healthsystem/service/LoginService.java +++ b/src/main/java/edu/zrh/healthsystem/service/LoginService.java @@ -11,9 +11,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; -/** - * @author han - */ + @Service public class LoginService { @@ -59,38 +57,8 @@ public class LoginService { return result; } - /** - * 用户注册逻辑 - * @param login 用户注册信息 - * @return LoginResult 注册结果 - */ - public LoginResponse register(Login login) { - LoginResponse result = new LoginResponse(); - - // 假设我们先验证用户是否已经存在 - UserLoginInfo existingUser = loginRepository.findByUsername(login.getUsername()); - - if (existingUser != null) { - result.setCode(400); - result.setMessage("用户名已存在"); - } else { - UserLoginInfo newUser = new UserLoginInfo(); - newUser.setPwd(login.getPwd()); - newUser.setUsername(login.getUsername()); - newUser.setPermission("1"); - // 如果用户不存在,则可以进行注册(这里假设保存用户到数据库) - loginRepository.save(newUser); - result.setCode(200); - result.setMessage("注册成功"); - } - - return result; - } - /** * 生成 JWT Token - * @param id 用户的唯一标识(例如用户 ID) - * @return 生成的 JWT Token */ @Value("${jwt.secret-key}") private String SECRET_KEY; diff --git a/src/main/java/edu/zrh/healthsystem/service/TalkService.java b/src/main/java/edu/zrh/healthsystem/service/TalkService.java index cbb4284..00135e8 100644 --- a/src/main/java/edu/zrh/healthsystem/service/TalkService.java +++ b/src/main/java/edu/zrh/healthsystem/service/TalkService.java @@ -14,9 +14,7 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.List; -/** - * @author han - */ + @Service public class TalkService { private final RestTemplate restTemplate;