From 10c218463b376967e07a9c28de565ef741a0a308 Mon Sep 17 00:00:00 2001
From: kaiyu <404897439@qq.com>
Date: Wed, 17 Mar 2021 17:26:24 +0800
Subject: [PATCH] Common模块: 修改用户不存在常量名 修改ResultMessage中使用的常量 manage模块: 账号的增删改查进行修改
---
screen-manage/src/main/java/com/moral/api/pojo/vo/account/AccountInsertVO.java | 96 ++++++++++++++----------------------------------
1 files changed, 28 insertions(+), 68 deletions(-)
diff --git a/screen-manage/src/main/java/com/moral/api/pojo/vo/account/AccountInsertVO.java b/screen-manage/src/main/java/com/moral/api/pojo/vo/account/AccountInsertVO.java
index 8cc4d31..7c4e4cf 100644
--- a/screen-manage/src/main/java/com/moral/api/pojo/vo/account/AccountInsertVO.java
+++ b/screen-manage/src/main/java/com/moral/api/pojo/vo/account/AccountInsertVO.java
@@ -3,7 +3,9 @@
import com.fasterxml.jackson.annotation.JsonInclude;
import com.moral.api.entity.ManageRole;
import com.moral.api.pojo.dto.account.AccountInsertDTO;
+import com.moral.constant.ResponseCodeEnum;
import lombok.Data;
+import org.springframework.util.ObjectUtils;
import java.util.ArrayList;
import java.util.List;
@@ -18,79 +20,37 @@
@Data
@JsonInclude(JsonInclude.Include.NON_EMPTY)
public class AccountInsertVO extends AccountVO {
- /*
- * ������������
- * */
- public static final String SUCCESS = "0";
-
- /*
- * ���������������������������
- * */
- public static final String ACCOUNT_LENGTH_INVALID = "-1";
-
- /*
- * ���������������������������
- * */
- public static final String PASSWORD_LENGTH_INVALID = "-2";
-
- /*
- * ������������������������
- * */
- public static final String MOBILE_INVALID = "-3";
-
- /*
- * ���������������������
- * */
- public static final String EMAIL_INVALID = "-4";
-
- /*
- * ���������������������
- * */
- public static final String ACCOUNT_EXIST = "-5";
-
- /*
- * ���������������������������
- * */
- public static final String ACCOUNT_EXIST_SPECIAL_CHAR = "-6";
-
- /*
- * ������������������������
- * */
- public static final String PASSWORD_EXIST_SPECIAL_CHAR = "-7";
-
-
/**
- * @Description: ������������������������������������
- * @Param: [dto]
- * @return: com.moral.api.pojo.vo.account.AccountVO
- * @Author: ���������
- * @Date: 2021/3/15
- */
- public static AccountInsertVO convert(AccountInsertDTO dto){
+ * @Description: ������������������������������������
+ * @Param: [dto]
+ * @return: com.moral.api.pojo.vo.account.AccountVO
+ * @Author: ���������
+ * @Date: 2021/3/15
+ */
+ public static AccountInsertVO convert(AccountInsertDTO dto) {
+ if (dto.getCode() != ResponseCodeEnum.SUCCESS.getCode())
+ return null;
+
AccountInsertVO vo = new AccountInsertVO();
- if(dto.getCode()== AccountInsertDTO.SUCCESS){
- Integer id = dto.getAccount().getId();
- String userName = dto.getAccount().getUserName();
- String email = dto.getAccount().getEmail();
- String mobile = dto.getAccount().getMobile();
- String wechat = dto.getAccount().getWechat();
-
- //������������������������
- List<ManageRole> roles = dto.getRoles();
- List<String> roleNames = new ArrayList<>();
- roles.forEach(role->roleNames.add(role.getName()));
-
- vo.setId(id);
- vo.setUserName(userName);
- vo.setEmail(email);
- vo.setMobile(mobile);
- vo.setWechat(wechat);
- vo.setRoleNames(roleNames);
+ Integer id = dto.getAccount().getId();
+ String userName = dto.getAccount().getUserName();
+ String email = dto.getAccount().getEmail();
+ String mobile = dto.getAccount().getMobile();
+ String wechat = dto.getAccount().getWechat();
+ //������������������������
+ List<ManageRole> roles = dto.getRoles();
+ List<String> roleNames = new ArrayList<>();
+ if (!ObjectUtils.isEmpty(roles)) {
+ roles.forEach(role -> roleNames.add(role.getName()));
}
+ vo.setId(id);
+ vo.setUserName(userName);
+ vo.setEmail(email);
+ vo.setMobile(mobile);
+ vo.setWechat(wechat);
+ vo.setRoleNames(roleNames);
- String code = dto.getCode();
- vo.setCode(code);
return vo;
}
--
Gitblit v1.8.0