|
@@ -0,0 +1,116 @@
|
|
|
+/*
|
|
|
+ * *************************************************
|
|
|
+ * Copyright (c) 2018 QMTH. All Rights Reserved.
|
|
|
+ * Created by Deason on 2018-11-16 16:01:07.
|
|
|
+ * *************************************************
|
|
|
+ */
|
|
|
+
|
|
|
+package cn.com.qmth.examcloud.core.print.api.bean;
|
|
|
+
|
|
|
+import cn.com.qmth.examcloud.commons.web.security.bean.Role;
|
|
|
+import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
+import cn.com.qmth.examcloud.commons.web.security.enums.RoleMeta;
|
|
|
+import cn.com.qmth.examcloud.core.print.service.bean.common.OrgInfo;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用户信息
|
|
|
+ *
|
|
|
+ * @author: fengdesheng
|
|
|
+ * @since: 2018/11/16
|
|
|
+ */
|
|
|
+public class UserInfo {
|
|
|
+ /**
|
|
|
+ * 用户ID
|
|
|
+ */
|
|
|
+ private Long userId;
|
|
|
+ /**
|
|
|
+ * 用户名称
|
|
|
+ */
|
|
|
+ private String userName;
|
|
|
+ /**
|
|
|
+ * 学校机构ID
|
|
|
+ */
|
|
|
+ private Long orgId;
|
|
|
+ /**
|
|
|
+ * 学校机构名称
|
|
|
+ */
|
|
|
+ private String orgName;
|
|
|
+ /**
|
|
|
+ * 是否为项目经理
|
|
|
+ */
|
|
|
+ private boolean isPM;
|
|
|
+ /**
|
|
|
+ * 是否为印刷供应商
|
|
|
+ */
|
|
|
+ private boolean isSupplier;
|
|
|
+ /**
|
|
|
+ * 是否为学校用户
|
|
|
+ */
|
|
|
+ private boolean isSchoolUser;
|
|
|
+ /**
|
|
|
+ * 是否为负责人
|
|
|
+ */
|
|
|
+ private boolean isLeader;
|
|
|
+
|
|
|
+ public UserInfo(User user) {
|
|
|
+ this.userId = user.getUserId();
|
|
|
+ this.userName = user.getDisplayName();
|
|
|
+ this.orgId = user.getRootOrgId();
|
|
|
+ this.orgName = user.getRootOrgName();
|
|
|
+
|
|
|
+ //角色类型
|
|
|
+ List<Role> roles = user.getRoleList();
|
|
|
+ if (roles != null && !roles.isEmpty()) {
|
|
|
+ for (Role role : roles) {
|
|
|
+ if (RoleMeta.PROJECT_MANAGER.name().equals(role.getRoleCode())) {
|
|
|
+ this.isPM = true;
|
|
|
+ } else if (RoleMeta.PRINT_SUPPLIER.name().equals(role.getRoleCode())) {
|
|
|
+ this.isSupplier = true;
|
|
|
+ } else if (RoleMeta.PRINTER.name().equals(role.getRoleCode())) {
|
|
|
+ this.isSchoolUser = true;
|
|
|
+ } else {
|
|
|
+ this.isLeader = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public OrgInfo getOrgInfo() {
|
|
|
+ return new OrgInfo(orgId, orgName);
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isPM() {
|
|
|
+ return isPM;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isSupplier() {
|
|
|
+ return isSupplier;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isSchoolUser() {
|
|
|
+ return isSchoolUser;
|
|
|
+ }
|
|
|
+
|
|
|
+ public boolean isLeader() {
|
|
|
+ return isLeader;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getUserId() {
|
|
|
+ return userId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getUserName() {
|
|
|
+ return userName;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Long getOrgId() {
|
|
|
+ return orgId;
|
|
|
+ }
|
|
|
+
|
|
|
+ public String getOrgName() {
|
|
|
+ return orgName;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|