From 1e31e1f327b492e5971cee72c4c1fbaf15a160de Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Tue, 14 Mar 2023 10:51:11 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BD=BF=E7=94=A8=20Integer=20=E6=8E=A5?= =?UTF-8?q?=E6=94=B6=E5=89=8D=E7=AB=AF=E7=9A=84=E5=8F=82=E6=95=B0=EF=BC=8C?= =?UTF-8?q?=E8=80=8C=E4=B8=8D=E6=98=AF=E6=9E=9A=E4=B8=BE=E7=B1=BB=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../application/service/AccountManagementService.java | 8 +++++--- .../system/application/service/MenuManagementService.java | 7 ++++--- .../system/application/service/RoleManagementService.java | 5 +++-- .../application/service/command/CreateAccountCommand.java | 6 ++---- .../application/service/command/CreateMenuCommand.java | 3 +-- .../application/service/command/CreateRoleCommand.java | 3 +-- .../application/service/command/UpdateAccountCommand.java | 3 +-- .../application/service/command/UpdateMenuCommand.java | 3 +-- .../application/service/command/UpdateRoleCommand.java | 3 +-- 9 files changed, 19 insertions(+), 22 deletions(-) diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/AccountManagementService.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/AccountManagementService.java index 36050c3..d53a1ba 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/AccountManagementService.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/AccountManagementService.java @@ -26,8 +26,10 @@ import xyz.zhouxy.plusone.system.application.service.command.UpdateAccountComman import xyz.zhouxy.plusone.system.domain.model.account.Account; import xyz.zhouxy.plusone.system.domain.model.account.AccountInfo; import xyz.zhouxy.plusone.system.domain.model.account.AccountRepository; +import xyz.zhouxy.plusone.system.domain.model.account.AccountStatus; import xyz.zhouxy.plusone.system.domain.model.account.Email; import xyz.zhouxy.plusone.system.domain.model.account.MobilePhone; +import xyz.zhouxy.plusone.system.domain.model.account.Sex; import xyz.zhouxy.plusone.system.domain.model.account.Username; import xyz.zhouxy.plusone.util.AssertResult; @@ -67,12 +69,12 @@ public class AccountManagementService { mobilePhone, command.getPassword(), command.getPasswordConfirmation(), - command.getStatus(), + AccountStatus.of(command.getStatus()), command.getRoleRefs(), AccountInfo.builder() .nickname(command.getNickname()) .avatar(command.getAvatar()) - .sex(command.getSex()) + .sex(Sex.of(command.getSex())) .build(), adminAuthLogic.getLoginIdAsLong()); accountRepository.save(account); @@ -91,7 +93,7 @@ public class AccountManagementService { Assert.isTrue(Objects.equals(id, command.getId()), "参数错误: id 不匹配"); Account account = accountRepository.find(id) .orElseThrow(() -> new DataNotExistException("该账号不存在")); - account.setAccountInfo(command.getNickname(), command.getAvatar(), command.getSex()); + account.setAccountInfo(command.getNickname(), command.getAvatar(), Sex.of(command.getSex())); account.setUpdatedBy(adminAuthLogic.getLoginIdAsLong()); accountRepository.save(account); } diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/MenuManagementService.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/MenuManagementService.java index f7e5368..b8b07d4 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/MenuManagementService.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/MenuManagementService.java @@ -13,6 +13,7 @@ import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; +import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.domain.IWithOrderNumber; import xyz.zhouxy.plusone.exception.DataNotExistException; import xyz.zhouxy.plusone.system.application.exception.UnsupportedMenuTypeException; @@ -66,7 +67,7 @@ public class MenuManagementService { command.getIcon(), command.getHidden(), command.getOrderNumber(), - command.getStatus(), + EntityStatus.of(command.getStatus()), command.getRemarks()); } @@ -79,7 +80,7 @@ public class MenuManagementService { command.getIcon(), command.getHidden(), command.getOrderNumber(), - command.getStatus(), + EntityStatus.of(command.getStatus()), command.getComponent(), command.getResource(), command.getCache(), @@ -107,7 +108,7 @@ public class MenuManagementService { command.getIcon(), command.getHidden(), command.getOrderNumber(), - command.getStatus(), + EntityStatus.of(command.getStatus()), command.getComponent(), command.getResource(), command.getCache(), diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/RoleManagementService.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/RoleManagementService.java index 9d88826..75fb2c9 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/RoleManagementService.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/RoleManagementService.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.exception.DataNotExistException; import xyz.zhouxy.plusone.system.application.query.RoleQueries; import xyz.zhouxy.plusone.system.application.query.params.RoleQueryParams; @@ -54,7 +55,7 @@ public class RoleManagementService { Role roleToCreate = Role.newInstance( command.getName(), command.getIdentifier(), - command.getStatus(), + EntityStatus.of(command.getStatus()), command.getRemarks(), menuRefs, permissionRefs); @@ -67,7 +68,7 @@ public class RoleManagementService { roleToUpdate.update( command.getName(), command.getIdentifier(), - command.getStatus(), + EntityStatus.of(command.getStatus()), command.getRemarks(), Set.copyOf(_menuRepository.findByIdIn(command.getMenus())), Set.copyOf(_menuRepository.findPermissionsByIdIn(command.getPermissions()))); diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateAccountCommand.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateAccountCommand.java index be7f4fb..51c07cf 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateAccountCommand.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateAccountCommand.java @@ -12,8 +12,6 @@ import org.hibernate.validator.constraints.URL; import lombok.Data; import xyz.zhouxy.plusone.commons.constant.RegexConsts; import xyz.zhouxy.plusone.domain.ICommand; -import xyz.zhouxy.plusone.system.domain.model.account.AccountStatus; -import xyz.zhouxy.plusone.system.domain.model.account.Sex; /** * 创建账号命令 @@ -41,7 +39,7 @@ public class CreateAccountCommand implements ICommand { String passwordConfirmation; @NotNull - AccountStatus status; + Integer status; Set roleRefs; @@ -52,5 +50,5 @@ public class CreateAccountCommand implements ICommand { @URL String avatar; - Sex sex; + Integer sex; } diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateMenuCommand.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateMenuCommand.java index d319517..eeb469a 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateMenuCommand.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateMenuCommand.java @@ -5,7 +5,6 @@ import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; -import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.domain.ICommand; import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType; @@ -42,7 +41,7 @@ public class CreateMenuCommand implements ICommand { private Integer orderNumber; @NotNull - private EntityStatus status; + private Integer status; private String component; diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateRoleCommand.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateRoleCommand.java index b0fd176..b9408b8 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateRoleCommand.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/CreateRoleCommand.java @@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import lombok.Data; -import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.domain.ICommand; /** @@ -23,7 +22,7 @@ public class CreateRoleCommand implements ICommand { String identifier; @NotNull - EntityStatus status; + Integer status; String remarks; Set menus; diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateAccountCommand.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateAccountCommand.java index cbfd6a9..1e5ae31 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateAccountCommand.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateAccountCommand.java @@ -8,7 +8,6 @@ import org.hibernate.validator.constraints.URL; import lombok.Data; import xyz.zhouxy.plusone.commons.constant.RegexConsts; import xyz.zhouxy.plusone.domain.ICommand; -import xyz.zhouxy.plusone.system.domain.model.account.Sex; /** * 更新账号信息命令 @@ -27,5 +26,5 @@ public class UpdateAccountCommand implements ICommand { @URL String avatar; - Sex sex; + Integer sex; } diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateMenuCommand.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateMenuCommand.java index 2055d75..04d1d23 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateMenuCommand.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateMenuCommand.java @@ -5,7 +5,6 @@ import javax.validation.constraints.NotNull; import lombok.Getter; import lombok.Setter; -import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.domain.ICommand; import xyz.zhouxy.plusone.system.domain.model.menu.Menu.MenuType; @@ -46,7 +45,7 @@ public class UpdateMenuCommand implements ICommand { private Integer orderNumber; @NotNull - private EntityStatus status; + private Integer status; private String component; diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateRoleCommand.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateRoleCommand.java index 1f267d0..4a59be9 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateRoleCommand.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/UpdateRoleCommand.java @@ -6,7 +6,6 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; import lombok.Data; -import xyz.zhouxy.plusone.constant.EntityStatus; import xyz.zhouxy.plusone.domain.ICommand; /** @@ -27,7 +26,7 @@ public class UpdateRoleCommand implements ICommand { String identifier; @NotNull - EntityStatus status; + Integer status; @NotBlank String remarks;