From 2c953876eab1622e2598a3d1ab92ae29e1d88fe5 Mon Sep 17 00:00:00 2001 From: kaiyu <404897439@qq.com> Date: Thu, 18 Mar 2021 11:24:33 +0800 Subject: [PATCH] API项目: 更改全局异常处理器中的返回码常量 COMMON: 更改常量类和response枚举 --- screen-manage/src/main/java/com/moral/api/pojo/form/AccountInsertForm.java | 36 ++++++++++++++++++++++++++++++++++++ 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/screen-manage/src/main/java/com/moral/api/pojo/form/AccountInsertForm.java b/screen-manage/src/main/java/com/moral/api/pojo/form/AccountInsertForm.java index d4f1f96..f5b1810 100644 --- a/screen-manage/src/main/java/com/moral/api/pojo/form/AccountInsertForm.java +++ b/screen-manage/src/main/java/com/moral/api/pojo/form/AccountInsertForm.java @@ -1,6 +1,11 @@ package com.moral.api.pojo.form; +import com.moral.api.pojo.dto.account.AccountInsertDTO; +import com.moral.constant.ResponseCodeEnum; +import com.moral.util.AESUtils; +import com.moral.util.RegexUtils; import lombok.Data; +import org.springframework.beans.factory.annotation.Value; import org.springframework.util.ObjectUtils; import java.io.Serializable; @@ -54,4 +59,35 @@ return false; return true; } + + public AccountInsertDTO paramValid(){ + AccountInsertDTO dto = new AccountInsertDTO(); + //��������������������������������� + if(!RegexUtils.checkAccount(account)){ + dto.setCode(ResponseCodeEnum.ACCOUNT_INVALID.getCode()); + dto.setMsg(ResponseCodeEnum.ACCOUNT_INVALID.getMsg()); + return dto; + } + //������������������������������ + if(!RegexUtils.checkPassword(AESUtils.decrypt(password))){ + dto.setCode(ResponseCodeEnum.PASSWORD_INVALID.getCode()); + dto.setMsg(ResponseCodeEnum.PASSWORD_INVALID.getMsg()); + return dto; + } + //��������������������������������� + if(!RegexUtils.checkMobile(mobile)){ + dto.setCode(ResponseCodeEnum.MOBILE_INVALID.getCode()); + dto.setMsg(ResponseCodeEnum.MOBILE_INVALID.getMsg()); + return dto; + } + //������������������������������ + if(!RegexUtils.checkEmail(email)){ + dto.setCode(ResponseCodeEnum.EMAIL_INVALID.getCode()); + dto.setMsg(ResponseCodeEnum.EMAIL_INVALID.getMsg()); + return dto; + } + dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); + dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); + return dto; + } } -- Gitblit v1.8.0