| | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import com.kidgrow.common.constant.CommonConstant; |
| | | import com.kidgrow.common.constant.SecurityConstants; |
| | | import com.kidgrow.common.model.ResultBody; |
| | | import com.kidgrow.common.model.SysOrganization; |
| | | import com.kidgrow.common.model.SysUser; |
| | | import com.kidgrow.common.utils.AddrUtil; |
| | |
| | | List<SysOrganization> organizations = (List<SysOrganization>)user.getOrganizations(); |
| | | //如果有组织架构 |
| | | if(organizations!=null && organizations.size()==2){ |
| | | if(organizations.get(0)!=null){ |
| | | ctx.addZuulRequestHeader(SecurityConstants.USER_ORG_ID_HEADER,String.valueOf(organizations.get(0).getId())); |
| | | ctx.addZuulRequestHeader(SecurityConstants.USER_ORG_NAME_HEADER, URLEncoder.encode(organizations.get(0).getOrgName(),"UTF-8")); |
| | | tenantId=String.valueOf(organizations.get(0).getId()); |
| | | }else{ |
| | | return ResultBody.failed("您的组织,已经被禁用,请联系管理员"); |
| | | } |
| | | if(organizations.get(1)!=null){ |
| | | ctx.addZuulRequestHeader(SecurityConstants.USER_DEP_ID_HEADER,String.valueOf(organizations.get(1).getId())); |
| | | ctx.addZuulRequestHeader(SecurityConstants.USER_DEP_NAME_HEADER,URLEncoder.encode(organizations.get(1).getOrgName(),"UTF-8")); |
| | | tenantId=String.valueOf(organizations.get(0).getId()); |
| | | }else { |
| | | return ResultBody.failed("您组织部门或者科室,已经被禁用,请联系管理员"); |
| | | } |
| | | } |
| | | // log.error("用户ID写入Header成功,用户ID为:"+String.valueOf(user.getId())); |
| | | } |