From d666793c93e91026e129f00bae414217690635ae Mon Sep 17 00:00:00 2001 From: jinpengyong <jpy123456> Date: Thu, 27 May 2021 13:20:34 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev_ --- screen-manage/src/main/java/com/moral/api/pojo/form/account/AccountUpdateForm.java | 52 +++++++++++++++++++++++++++++++++++++--------------- 1 files changed, 37 insertions(+), 15 deletions(-) diff --git a/screen-manage/src/main/java/com/moral/api/pojo/form/account/AccountUpdateForm.java b/screen-manage/src/main/java/com/moral/api/pojo/form/account/AccountUpdateForm.java index 82df8bf..ae3cfe8 100644 --- a/screen-manage/src/main/java/com/moral/api/pojo/form/account/AccountUpdateForm.java +++ b/screen-manage/src/main/java/com/moral/api/pojo/form/account/AccountUpdateForm.java @@ -1,9 +1,10 @@ package com.moral.api.pojo.form.account; -import com.moral.api.pojo.dto.account.AccountInsertDTO; -import com.moral.api.pojo.dto.account.AccountUpdateDTO; +import com.moral.api.entity.ManageAccount; +import com.moral.api.pojo.dto.account.AccountDTO; import com.moral.constant.ResponseCodeEnum; import com.moral.util.AESUtils; +import com.moral.util.MD5Utils; import com.moral.util.RegexUtils; import lombok.Data; import org.springframework.util.ObjectUtils; @@ -35,22 +36,30 @@ private List<Integer> roleIds; public boolean valid() { - if(ObjectUtils.isEmpty(accountId)) + if (ObjectUtils.isEmpty(accountId)) return false; - if( - ObjectUtils.isEmpty(userName)&& - ObjectUtils.isEmpty(password)&& - ObjectUtils.isEmpty(email)&& - ObjectUtils.isEmpty(mobile)&& - ObjectUtils.isEmpty(wechat)&& - ObjectUtils.isEmpty(roleIds) + if ( + ObjectUtils.isEmpty(userName) && + ObjectUtils.isEmpty(password) && + ObjectUtils.isEmpty(email) && + ObjectUtils.isEmpty(mobile) && + ObjectUtils.isEmpty(wechat) && + null == roleIds ) return false; return true; } - public AccountUpdateDTO paramValid() { - AccountUpdateDTO dto = new AccountUpdateDTO(); + public AccountDTO paramValid() { + AccountDTO dto = new AccountDTO(); + //��������������������������� + if(!ObjectUtils.isEmpty(userName)){ + if(!RegexUtils.checkChinese(userName)||userName.contains(" ")){ + dto.setCode(ResponseCodeEnum.USERNAME_INVALID.getCode()); + dto.setMsg(ResponseCodeEnum.USERNAME_INVALID.getMsg()); + return dto; + } + } //��������������������������������� if (!ObjectUtils.isEmpty(mobile)) { if (!RegexUtils.checkMobile(mobile)) { @@ -68,16 +77,29 @@ } } //������������������������������ - if (!ObjectUtils.isEmpty(password)){ - if(!RegexUtils.checkPassword(AESUtils.decrypt(password))){ + if (!ObjectUtils.isEmpty(password)) { + if (!RegexUtils.checkPassword(AESUtils.decrypt(password))) { dto.setCode(ResponseCodeEnum.PASSWORD_INVALID.getCode()); dto.setMsg(ResponseCodeEnum.PASSWORD_INVALID.getMsg()); return dto; } } - dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); + dto.setCode(ResponseCodeEnum.SUCCESS.getCode()); dto.setMsg(ResponseCodeEnum.SUCCESS.getMsg()); return dto; } + public ManageAccount formConvertEntity() { + ManageAccount manageAccount = new ManageAccount(); + manageAccount.setId(accountId); + if (!ObjectUtils.isEmpty(password)) + manageAccount.setPassword(MD5Utils.saltMD5(AESUtils.decrypt(password))); + manageAccount.setUserName(userName); + manageAccount.setEmail(email); + manageAccount.setMobile(mobile); + manageAccount.setWechat(wechat); + return manageAccount; + } + + } -- Gitblit v1.8.0