Ver Fonte

新增每日一题test6

weirdoheheelf há 5 anos atrás
pai
commit
4b896f9b61

+ 137 - 137
seecoder-portal-common/src/main/java/cn/seecoder/seecoderportalcommon/vo/UserVO.java

@@ -1,137 +1,137 @@
-package cn.seecoder.seecoderportalcommon.vo;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-import java.time.OffsetDateTime;
-
-/**
- * @author Kunduin
- */
-public class UserVO {
-    private Long id;
-
-    @Size(max = 64)
-    @NotBlank
-    private String phone;
-
-    @Size(max = 65)
-    @Pattern(regexp = "[\\w\\d]*", message = "用户名只包含英文或数字")
-    private String username;
-
-    @Size(max = 64)
-    private String name;
-
-    @Size(max = 512)
-    private String email;
-
-    @Size(max = 512)
-    private String photo;
-
-    @NotNull
-    private UserRole role = UserRole.STUDENT;
-
-    @Size(max = 512)
-    private String signature = "无";
-
-    private OffsetDateTime createdTime;
-
-    private Boolean isValid = true;
-
-    public Long getId() {
-        return id;
-    }
-
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    public String getPhone() {
-        return phone;
-    }
-
-    public void setPhone(String phone) {
-        this.phone = phone;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getEmail() {
-        return email;
-    }
-
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    public String getPhoto() {
-        return photo;
-    }
-
-    public void setPhoto(String photo) {
-        this.photo = photo;
-    }
-
-    public UserRole getRole() {
-        return role;
-    }
-
-    public void setRole(UserRole role) {
-        this.role = role;
-    }
-
-    public String getSignature() {
-        return signature;
-    }
-
-    public void setSignature(String signature) {
-        this.signature = signature;
-    }
-
-    public OffsetDateTime getCreatedTime() {
-        return createdTime;
-    }
-
-    public void setCreatedTime(OffsetDateTime createdTime) {
-        this.createdTime = createdTime;
-    }
-
-    public Boolean getValid() {
-        return isValid;
-    }
-
-    public void setValid(Boolean valid) {
-        isValid = valid;
-    }
-
-    public String getUsername() {
-        return username;
-    }
-
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    @Override
-    public String toString() {
-        return "UserVO{" +
-                "id=" + id +
-                ", phone='" + phone + '\'' +
-                ", username='" + username + '\'' +
-                ", name='" + name + '\'' +
-                ", email='" + email + '\'' +
-                ", photo='" + photo + '\'' +
-                ", role=" + role +
-                ", signature='" + signature + '\'' +
-                ", createdTime=" + createdTime +
-                ", isValid=" + isValid +
-                '}';
-    }
-}
+package cn.seecoder.seecoderportalcommon.vo;
+
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotNull;
+import javax.validation.constraints.Pattern;
+import javax.validation.constraints.Size;
+import java.time.OffsetDateTime;
+
+/**
+ * @author Kunduin
+ */
+public class UserVO {
+    private Long id;
+
+    @Size(max = 64)
+    @NotBlank
+    private String phone;
+
+    @Size(max = 64)
+    @Pattern(regexp = "[\\w\\d]*", message = "用户名只包含英文或数字")
+    private String username;
+
+    @Size(max = 64)
+    private String name;
+
+    @Size(max = 512)
+    private String email;
+
+    @Size(max = 512)
+    private String photo;
+
+    @NotNull
+    private UserRole role = UserRole.STUDENT;
+
+    @Size(max = 512)
+    private String signature = "无";
+
+    private OffsetDateTime createdTime;
+
+    private Boolean isValid = true;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getPhone() {
+        return phone;
+    }
+
+    public void setPhone(String phone) {
+        this.phone = phone;
+    }
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getPhoto() {
+        return photo;
+    }
+
+    public void setPhoto(String photo) {
+        this.photo = photo;
+    }
+
+    public UserRole getRole() {
+        return role;
+    }
+
+    public void setRole(UserRole role) {
+        this.role = role;
+    }
+
+    public String getSignature() {
+        return signature;
+    }
+
+    public void setSignature(String signature) {
+        this.signature = signature;
+    }
+
+    public OffsetDateTime getCreatedTime() {
+        return createdTime;
+    }
+
+    public void setCreatedTime(OffsetDateTime createdTime) {
+        this.createdTime = createdTime;
+    }
+
+    public Boolean getValid() {
+        return isValid;
+    }
+
+    public void setValid(Boolean valid) {
+        isValid = valid;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    @Override
+    public String toString() {
+        return "UserVO{" +
+                "id=" + id +
+                ", phone='" + phone + '\'' +
+                ", username='" + username + '\'' +
+                ", name='" + name + '\'' +
+                ", email='" + email + '\'' +
+                ", photo='" + photo + '\'' +
+                ", role=" + role +
+                ", signature='" + signature + '\'' +
+                ", createdTime=" + createdTime +
+                ", isValid=" + isValid +
+                '}';
+    }
+}

+ 1 - 2
seecoder-portal-server/src/main/java/cn/seecoder/seecoderportalserver/service/UserService.java

@@ -91,12 +91,11 @@ public class UserService {
                     throw CustomErrorException.phoneAlreadyExist();
                 });
         User user = userMapper.userVOToUser(userVO);
-        //System.out.println(user.getId()+user.getName()+user.getEmail()+user.getPhone());
         String encodedPassword = passwordEncoder.encode(password);
         System.out.println(encodedPassword);
         user.setPassword(encodedPassword);
         System.out.println(1);
-        System.out.println(user.getUsername());
+        System.out.println(userVO.getUsername());
         userRepository.save(user);
         Optional<User> resultUser=userRepository.findByPhone(user.getPhone());
         System.out.println(2);