grs
yjxx 1 month ago
parent b320b3e34c
commit ba7d5d8709

@ -1,19 +1,20 @@
package jty.expressdistributionsystem.DTO;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.Data;
@Data
public class UserLoginByAccountDTO {
@NotBlank(message = "账号不能为空")
@Pattern(regexp = "^(?!\\s)([A-Za-z0-9]{1,10})$")
@Pattern(regexp = "^(?!\\s)([A-Za-z0-9]{1,10})$", message = "账号长度在1-10位之间")
private String account;
@NotBlank(message = "密码不能为空")
@Pattern(regexp = "^.+$")
@Pattern(regexp = "^.+$", message = "密码不能为空")
private String password;
@NotBlank(message = "请选择你的登录任务")
@NotNull
private Integer mark;
}

@ -30,22 +30,22 @@ public class User implements Serializable {
@TableField("account")
@NotBlank(message = "账号不能为空")
@Pattern(regexp = "^(?!\\s)([A-Za-z0-9]{1,10})$")
@Pattern(regexp = "^(?!\\s)([A-Za-z0-9]{1,10})$", message = "账号长度在1-10位之间")
private String account;
@TableField("phone")
@NotBlank(message = "手机号不能为空")
@Pattern(regexp = "^1[3-9]\\d{9}$")
@Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号有误")
private String phone;
@TableField("password")
@NotBlank(message = "密码不能为空")
@Pattern(regexp = "^.+$")
@Pattern(regexp = "^.+$", message = "密码不能为空")
private String password;
@TableField("identity")
@NotBlank(message = "身份证不能为空")
@Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\\d{3}(\\d|X|x)$")
@Pattern(regexp = "^[1-9]\\d{5}(18|19|20)\\d{2}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\\d{3}(\\d|X|x)$", message = "身份证有误")
private String identity;
@TableField("mark")

@ -0,0 +1,15 @@
package jty.expressdistributionsystem.interceptors;
import jty.expressdistributionsystem.entity.Result;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(Exception.class)
public Result handleException(Exception e){
e.printStackTrace();
return new Result(500, StringUtils.hasLength(e.getMessage()) ? e.getMessage() : "操作失败", "");
}
}
Loading…
Cancel
Save