TRX 1 рік тому
батько
коміт
f4b97c62c3

+ 13 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/OrganizationUserModel.java

@@ -2,6 +2,7 @@ package com.zhongshu.card.client.model.org;
 
 import com.github.microservice.auth.security.type.AuthType;
 import com.zhongshu.card.client.model.base.SuperModel;
+import com.zhongshu.card.client.utils.type.OrganizationUserType;
 import com.zhongshu.card.client.utils.type.UserState;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.AllArgsConstructor;
@@ -58,6 +59,18 @@ public class OrganizationUserModel extends SuperModel {
     @Schema(description = "机构类型")
     private AuthType authType = AuthType.Enterprise;
 
+    @Schema(description = "用户在机构的类型")
+    private OrganizationUserType userType;
+
+    private String userTypeStr;
+
+    public String getUserTypeStr() {
+        if (userType != null) {
+            return userType.getRemark();
+        }
+        return "";
+    }
+
     @Schema(description = "角色信息")
     private List<RoleModel> roles = new ArrayList<>();
 

+ 4 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/model/org/OrganizationUserSearch.java

@@ -2,6 +2,7 @@ package com.zhongshu.card.client.model.org;
 
 import com.github.microservice.auth.security.type.AuthType;
 import com.zhongshu.card.client.model.base.SuperSearch;
+import com.zhongshu.card.client.utils.type.OrganizationUserType;
 import com.zhongshu.card.client.utils.type.UserState;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.Data;
@@ -36,4 +37,7 @@ public class OrganizationUserSearch extends SuperSearch {
 
     @Schema(description = "企业类型")
     private AuthType authType;
+
+    @Schema(description = "用户在机构的类型")
+    private OrganizationUserType userType;
 }

+ 22 - 0
FullCardClient/src/main/java/com/zhongshu/card/client/utils/type/OrganizationUserType.java

@@ -0,0 +1,22 @@
+package com.zhongshu.card.client.utils.type;
+
+import lombok.Getter;
+
+/**
+ * 用户在机构的 用户类型 (担任什么角色)
+ */
+public enum OrganizationUserType {
+
+    Student("学生"),
+    Teacher("老师"),
+    Common("普通"),
+    Manager("管理员"),
+    ;
+
+    @Getter
+    private String remark;
+
+    OrganizationUserType(String remark) {
+        this.remark = remark;
+    }
+}

+ 6 - 1
FullCardServer/src/main/java/com/zhongshu/card/server/core/dao/org/impl/OrganizationUserDaoImpl.java

@@ -48,11 +48,16 @@ public class OrganizationUserDaoImpl extends BaseImpl implements OrganizationUse
             criteria.and("oid").is(param.getOid());
         }
 
-        // 在这个构的状态,是否可用
+        // 在这个构的状态,是否可用
         if (param.getState() != null) {
             criteria.and("state").is(param.getState());
         }
 
+        // 用户在机构的类型
+        if (param.getUserType() != null) {
+            criteria.and("userType").is(param.getUserType());
+        }
+
         // 在机构里是否是管理员
         if (param.getIsAdmin() != null) {
             criteria.and("isAdmin").is(param.getIsAdmin());

+ 4 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/domain/org/OrganizationUser.java

@@ -1,6 +1,7 @@
 package com.zhongshu.card.server.core.domain.org;
 
 import com.github.microservice.auth.security.type.AuthType;
+import com.zhongshu.card.client.utils.type.OrganizationUserType;
 import com.zhongshu.card.client.utils.type.UserState;
 import com.zhongshu.card.server.core.domain.base.SuperMain;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -63,6 +64,9 @@ public class OrganizationUser extends SuperMain {
     @Schema(description = "机构类型")
     private AuthType authType = AuthType.Enterprise;
 
+    @Schema(description = "用户在机构的类型")
+    private OrganizationUserType userType;
+
     @Schema(description = "角色信息")
     @DBRef(lazy = true)
     private List<Role> roles = new ArrayList<>();

+ 2 - 0
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/OrganizationServiceImpl.java

@@ -18,6 +18,7 @@ import com.zhongshu.card.client.ret.ResultContent;
 import com.zhongshu.card.client.ret.ResultMessage;
 import com.zhongshu.card.client.service.org.OrganizationService;
 import com.zhongshu.card.client.utils.type.OrganizationState;
+import com.zhongshu.card.client.utils.type.OrganizationUserType;
 import com.zhongshu.card.client.utils.type.RoleType;
 import com.zhongshu.card.client.utils.type.UserState;
 import com.zhongshu.card.server.core.dao.org.*;
@@ -511,6 +512,7 @@ public class OrganizationServiceImpl extends SuperService implements Organizatio
             organizationUser.setState(UserState.Normal);
             organizationUser.setUserId(userAccount.getUserId());
             organizationUser.setAuthType(organization.getAuthType());
+            organizationUser.setUserType(OrganizationUserType.Manager);
             organizationUserDao.save(organizationUser);
 
             // 权限中心:用户和机构的关系

+ 2 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/org/UserAccountServiceImpl.java

@@ -14,10 +14,7 @@ import com.zhongshu.card.client.ret.ResultMessage;
 import com.zhongshu.card.client.service.org.DepartmentService;
 import com.zhongshu.card.client.service.org.OrganizationService;
 import com.zhongshu.card.client.service.org.UserAccountService;
-import com.zhongshu.card.client.utils.type.Sex;
-import com.zhongshu.card.client.utils.type.UserLoginType;
-import com.zhongshu.card.client.utils.type.UserState;
-import com.zhongshu.card.client.utils.type.UserType;
+import com.zhongshu.card.client.utils.type.*;
 import com.zhongshu.card.server.core.dao.org.*;
 import com.zhongshu.card.server.core.dataConfig.CardDefault;
 import com.zhongshu.card.server.core.domain.org.*;
@@ -164,6 +161,7 @@ public class UserAccountServiceImpl extends SuperService implements UserAccountS
             organizationUser.setIsAdmin(Boolean.FALSE);
             organizationUser.setAuthType(organizationUser.getAuthType());
             organizationUser.setCreateUserId(getCurrentUserId());
+            organizationUser.setUserType(OrganizationUserType.Common);
         } else {
             //权限中心: 删除以前的,这不存在的角色组
             List<Role> oldRoles = organizationUser.getRoles();