New file |
| | |
| | | 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; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @ClassName AccountRequest |
| | | * @Description TODO |
| | | * @Author 陈凯裕 |
| | | * @Date 2021/3/13 17:23 |
| | | * @Version TODO |
| | | **/ |
| | | @Data |
| | | public class AccountInsertForm implements Serializable{ |
| | | |
| | | |
| | | private String account; |
| | | |
| | | |
| | | private String password; |
| | | |
| | | |
| | | private String userName; |
| | | |
| | | |
| | | private String email; |
| | | |
| | | |
| | | private String mobile; |
| | | |
| | | |
| | | private String wechat; |
| | | |
| | | |
| | | private String createTime; |
| | | |
| | | |
| | | private String updateTime; |
| | | |
| | | |
| | | private List<String> roleIds; |
| | | |
| | | public boolean valid() { |
| | | if ( |
| | | ObjectUtils.isEmpty(account) || |
| | | ObjectUtils.isEmpty(password) || |
| | | ObjectUtils.isEmpty(email) || |
| | | ObjectUtils.isEmpty(mobile) || |
| | | ObjectUtils.isEmpty(userName) |
| | | ) |
| | | 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; |
| | | } |
| | | } |