Explorar o código

切换学校客户端登录修改

wangliang %!s(int64=2) %!d(string=hai) anos
pai
achega
0412bd7fdd

+ 4 - 1
distributed-print/src/main/java/com/qmth/distributed/print/api/ClientController.java

@@ -11,6 +11,7 @@ import com.qmth.distributed.print.business.bean.dto.*;
 import com.qmth.distributed.print.business.bean.params.ClientLoginParam;
 import com.qmth.distributed.print.business.service.ClientService;
 import com.qmth.teachcloud.common.bean.dto.SchoolDto;
+import com.qmth.teachcloud.common.bean.result.LoginClientResult;
 import com.qmth.teachcloud.common.bean.result.LoginResult;
 import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.entity.BasicSchool;
@@ -88,7 +89,8 @@ public class ClientController {
         // 是否有客户端权限
         clientService.checkPrivilege(sysUser.getId());
 
-        return ResultUtil.ok(teachcloudCommonService.login(login.getPassword(), sysUser, AppSourceEnum.SYSTEM));
+        LoginResult loginResult = teachcloudCommonService.login(login.getPassword(), sysUser, AppSourceEnum.SYSTEM);
+        return ResultUtil.ok(new LoginClientResult(sysUser, loginResult));
     }
 
     /**
@@ -491,6 +493,7 @@ public class ClientController {
 
     /**
      * 学校查询
+     *
      * @return
      */
     @ApiOperation(value = "查询")

+ 314 - 0
teachcloud-common/src/main/java/com/qmth/teachcloud/common/bean/result/LoginClientResult.java

@@ -0,0 +1,314 @@
+package com.qmth.teachcloud.common.bean.result;
+
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
+import com.qmth.teachcloud.common.entity.BasicSchool;
+import com.qmth.teachcloud.common.entity.SysOrg;
+import com.qmth.teachcloud.common.entity.SysUser;
+import com.qmth.teachcloud.common.enums.AppSourceEnum;
+import com.qmth.teachcloud.common.util.ServletUtil;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @Description: 登录返回result
+ * @Param:
+ * @return:
+ * @Author: wangliang
+ * @Date: 2021/3/25
+ */
+public class LoginClientResult implements Serializable {
+
+    @JsonSerialize(using = ToStringSerializer.class)
+    @ApiModelProperty(value = "主键")
+    Long id;
+
+    @ApiModelProperty(value = "登录名")
+    String loginName;
+
+    @ApiModelProperty(value = "姓名")
+    String realName;
+
+    @ApiModelProperty(value = "会话id")
+    String sessionId;
+
+    @ApiModelProperty(value = "访问令牌")
+    String accessToken;
+
+    @ApiModelProperty(value = "学校信息")
+    SchoolNativeBean schoolInfo;
+
+    @ApiModelProperty(value = "机构信息")
+    OrgNativeBean orgInfo;
+
+    @ApiModelProperty(name = "角色集合")
+    private Set<String> roleList;
+
+    @ApiModelProperty(name = "服务器时间戳")
+    private long time;
+
+    @ApiModelProperty(value = "应用来源")
+    AppSourceEnum appSource;
+
+    @ApiModelProperty(value = "密码修改次数")
+    Integer pwdCount;
+
+    @ApiModelProperty(value = "用户登录验证拦截信息")
+    private UserLoginCheckResult userLoginCheckResult;
+
+    @ApiModelProperty(name = "角色来源")
+    List<RoleResult> roleSource;
+
+    @ApiModelProperty(name = "返回url")
+    String returnUrl;
+
+    public String getReturnUrl() {
+        return returnUrl;
+    }
+
+    public void setReturnUrl(String returnUrl) {
+        this.returnUrl = returnUrl;
+    }
+
+    public LoginClientResult() {
+
+    }
+
+    public LoginClientResult(SysUser sysUser, LoginResult loginResult) {
+        this.id = sysUser.getId();
+        ServletUtil.setRequestId(Arrays.asList(id));
+        this.loginName = sysUser.getLoginName();
+        this.realName = sysUser.getRealName();
+        this.sessionId = loginResult.getSessionId();
+        this.accessToken = loginResult.getAccessToken();
+        this.roleList = loginResult.getRoleList();
+        this.appSource = loginResult.getAppSource();
+        this.pwdCount = sysUser.getPwdCount();
+        this.roleSource = loginResult.getRoleSource();
+        LoginResult.SchoolNativeBean schoolNativeBean = loginResult.getSchoolInfo().get(0);
+        this.schoolInfo = new SchoolNativeBean(schoolNativeBean.getId(), schoolNativeBean.getCode(), schoolNativeBean.getName());
+        LoginResult.OrgNativeBean orgNativeBean = loginResult.getOrgInfo();
+        this.orgInfo = new OrgNativeBean(orgNativeBean.getId(), orgNativeBean.getCode(), orgNativeBean.getName());
+        this.time = loginResult.getTime();
+        this.userLoginCheckResult = loginResult.getUserLoginCheckResult();
+        this.returnUrl = loginResult.returnUrl;
+    }
+
+    public List<RoleResult> getRoleSource() {
+        return roleSource;
+    }
+
+    public void setRoleSource(List<RoleResult> roleSource) {
+        this.roleSource = roleSource;
+    }
+
+    public AppSourceEnum getAppSource() {
+        return appSource;
+    }
+
+    public void setAppSource(AppSourceEnum appSource) {
+        this.appSource = appSource;
+    }
+
+    public Set<String> getRoleList() {
+        return roleList;
+    }
+
+    public void setRoleList(Set<String> roleList) {
+        this.roleList = roleList;
+    }
+
+    public OrgNativeBean getOrgInfo() {
+        return orgInfo;
+    }
+
+    public void setOrgInfo(OrgNativeBean orgInfo) {
+        this.orgInfo = orgInfo;
+    }
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getLoginName() {
+        return loginName;
+    }
+
+    public void setLoginName(String loginName) {
+        this.loginName = loginName;
+    }
+
+    public String getRealName() {
+        return realName;
+    }
+
+    public void setRealName(String realName) {
+        this.realName = realName;
+    }
+
+    public String getSessionId() {
+        return sessionId;
+    }
+
+    public void setSessionId(String sessionId) {
+        this.sessionId = sessionId;
+    }
+
+    public String getAccessToken() {
+        return accessToken;
+    }
+
+    public void setAccessToken(String accessToken) {
+        this.accessToken = accessToken;
+    }
+
+    public long getTime() {
+        return time;
+    }
+
+    public void setTime(long time) {
+        this.time = time;
+    }
+
+    public Integer getPwdCount() {
+        return pwdCount;
+    }
+
+    public void setPwdCount(Integer pwdCount) {
+        this.pwdCount = pwdCount;
+    }
+
+    public UserLoginCheckResult getUserLoginCheckResult() {
+        return userLoginCheckResult;
+    }
+
+    public void setUserLoginCheckResult(UserLoginCheckResult userLoginCheckResult) {
+        this.userLoginCheckResult = userLoginCheckResult;
+    }
+
+    public SchoolNativeBean getSchoolInfo() {
+        return schoolInfo;
+    }
+
+    public void setSchoolInfo(SchoolNativeBean schoolInfo) {
+        this.schoolInfo = schoolInfo;
+    }
+
+    public class SchoolNativeBean implements Serializable {
+
+        @ApiModelProperty(value = "id")
+        @JsonSerialize(using = ToStringSerializer.class)
+        Long id;
+
+        @ApiModelProperty(value = "代码")
+        String code;
+
+        @ApiModelProperty(value = "名称")
+        String name;
+
+        public SchoolNativeBean() {
+
+        }
+
+        public SchoolNativeBean(BasicSchool tbSchool) {
+            this.id = tbSchool.getId();
+            this.code = tbSchool.getCode();
+            this.name = tbSchool.getName();
+            schoolInfo = this;
+        }
+
+        public SchoolNativeBean(Long id, String code, String name) {
+            this.id = id;
+            this.code = code;
+            this.name = name;
+            schoolInfo = this;
+        }
+
+        public Long getId() {
+            return id;
+        }
+
+        public void setId(Long id) {
+            this.id = id;
+        }
+
+        public String getCode() {
+            return code;
+        }
+
+        public void setCode(String code) {
+            this.code = code;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+
+    public class OrgNativeBean implements Serializable {
+
+        @ApiModelProperty(value = "id")
+        @JsonSerialize(using = ToStringSerializer.class)
+        Long id;
+
+        @ApiModelProperty(value = "代码")
+        String code;
+
+        @ApiModelProperty(value = "名称")
+        String name;
+
+        public OrgNativeBean() {
+
+        }
+
+        public OrgNativeBean(SysOrg org) {
+            this.id = org.getId();
+            this.code = org.getCode();
+            this.name = org.getName();
+            orgInfo = this;
+        }
+
+        public OrgNativeBean(Long id, String code, String name) {
+            this.id = id;
+            this.code = code;
+            this.name = name;
+            orgInfo = this;
+        }
+
+        public Long getId() {
+            return id;
+        }
+
+        public void setId(Long id) {
+            this.id = id;
+        }
+
+        public String getCode() {
+            return code;
+        }
+
+        public void setCode(String code) {
+            this.code = code;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public void setName(String name) {
+            this.name = name;
+        }
+    }
+}