From 657182c7989dc77b69bb3f9adaf6c75b6466ff95 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Wed, 09 Jun 2021 10:31:35 +0800
Subject: [PATCH] screen-manage                  编辑账号接口删除分配角色功能,分配角色功能变为单独接口

---
 screen-manage/src/main/java/com/moral/api/pojo/form/account/AccountUpdateForm.java |   52 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 16 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..238e94d 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;
@@ -32,25 +33,31 @@
 
     private String wechat;
 
-    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)
                 )
             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 +75,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