Browse Source

feat:获取企业用户信息

zhangxinlei1996 3 years ago
parent
commit
6b80bfb008

+ 28 - 0
api/internal/handler/getentuserinfohandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/logic"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func GetEntUserInfoHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.EntUserReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewGetEntUserInfoLogic(r.Context(), svcCtx)
+		resp, err := l.GetEntUserInfo(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

+ 5 - 0
api/internal/handler/routes.go

@@ -62,6 +62,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/userCenter/user/getUserInfo",
 				Handler: GetUserInfoHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/userCenter/ent/userInfo",
+				Handler: GetEntUserInfoHandler(serverCtx),
+			},
 		},
 	)
 }

+ 56 - 0
api/internal/logic/getentuserinfologic.go

@@ -0,0 +1,56 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetEntUserInfoLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetEntUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEntUserInfoLogic {
+	return &GetEntUserInfoLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *GetEntUserInfoLogic) GetEntUserInfo(req *types.EntUserReq) (resp *types.Resp, err error) {
+	// todo: add your logic here and delete this line
+	resp = &types.Resp{Data: nil}
+	res, err := entity.UserCenterRpc.GetEntUserInfo(l.ctx, &pb.EntUserReq{
+		AppId:     req.AppId,
+		EntUserId: req.EntUserId,
+	})
+	if res == nil {
+		resp = &types.Resp{Data: nil, Error_msg: "暂无数据", Error_code: -1}
+		return
+	}
+	if res.ErrorMsg != "" {
+		resp.Error_msg = res.ErrorMsg
+		resp.Error_code = -1
+		l.Error(fmt.Sprintf("%+v", req), res.ErrorMsg)
+	} else {
+		data := map[string]interface{}{
+			"name":     res.Data.Name,
+			"phone":    res.Data.Phone,
+			"deptName": res.Data.DeptName,
+			"mail":     res.Data.Mail,
+		}
+		resp.Data = data
+	}
+	return
+}

+ 5 - 0
api/internal/types/types.go

@@ -194,3 +194,8 @@ type UserReq struct {
 	BaseUserId int64  `json:"baseUserId,optional"`
 	Types      string `json:"types,optional"` //类型,不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
 }
+
+type EntUserReq struct {
+	AppId     string `header:"appId,default=10000"`
+	EntUserId int64  `json:"entUserId"`
+}

+ 7 - 0
api/userCenter.api

@@ -207,6 +207,11 @@ type (
 		BaseUserId int64  `json:"baseUserId,optional"`
 		Types      string `json:"types,optional"` //类型,不传按默认规则获取 m大会员 e商机管理 v超级订阅 f免费订阅
 	}
+
+	EntUserReq {
+		AppId     string `header:"appId,default=10000"`
+		EntUserId int64  `json:"entUserId"`
+	}
 )
 
 service userCenter-api {
@@ -230,4 +235,6 @@ service userCenter-api {
 	post /userCenter/ent/getStatusByCode(GetStatusByCodeReq)returns(GetStatusByCodeResp)
 	@handler GetUserInfo
 	post /userCenter/user/getUserInfo(UserReq)returns(resp)
+	@handler GetEntUserInfo
+	post  /userCenter/ent/userInfo(EntUserReq)returns(resp)
 }

+ 2 - 0
entity/ent.go

@@ -850,3 +850,5 @@ func GetEntDistribute(mgo mongodb.MongodbSim, entId int64) map[string]*EntDistri
 	}
 	return entDis
 }
+
+

+ 31 - 0
entity/entUser.go

@@ -0,0 +1,31 @@
+package entity
+
+import (
+	"app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mysql"
+)
+
+type EntUserInfo struct {
+	AppId     string
+	EntUserId int64
+	Mysql     *mysql.Mysql
+}
+type User struct {
+	Name      string //员工姓名
+	Mail      string //邮箱
+	Phone     string //手机号
+	Dept_name string //部门名称
+}
+
+//获取员工信息
+func (this *EntUserInfo) GetEntUserInfo() (*User, string) {
+	data := this.Mysql.SelectBySql(`SELECT a.name,a.phone,a.mail,c.name AS dept_name FROM entniche_user a 
+		INNER JOIN entniche_department_user b ON (a.id=? AND a.id=b.user_id) 
+		INNER JOIN entniche_department c ON (b.dept_id=c.id)`, this.EntUserId)
+	if data == nil || len(*data) == 0 {
+		return nil, "暂无数据"
+	}
+	users, _ := common.JsonUnmarshal(data, &[]*User{}).(*[]*User)
+
+	return (*users)[0], ""
+}

+ 46 - 0
rpc/internal/logic/getentuserinfologic.go

@@ -0,0 +1,46 @@
+package logic
+
+import (
+	"context"
+	"fmt"
+	"log"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetEntUserInfoLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetEntUserInfoLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetEntUserInfoLogic {
+	return &GetEntUserInfoLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 根据企业员工id获取员工的信息
+func (l *GetEntUserInfoLogic) GetEntUserInfo(in *pb.EntUserReq) (*pb.EntUserResp, error) {
+	/// todo: add your logic here and delete this line
+	resp := &pb.EntUserResp{}
+	ret, msg := Entservice.GetEntUserInfo(in)
+	if msg != "" {
+		l.Error(fmt.Sprintf("%+v", in), msg)
+		resp.ErrorMsg = msg
+		resp.ErrorCode = -1
+	} else {
+		resp.Data = &pb.EntUser{
+			Name:     ret.Name,
+			Phone:    ret.Phone,
+			Mail:     ret.Mail,
+			DeptName: ret.Dept_name,
+		}
+	}
+	return resp, nil
+}

+ 6 - 0
rpc/internal/server/usercenterserver.go

@@ -81,3 +81,9 @@ func (s *UserCenterServer) GetUserInfo(ctx context.Context, in *pb.UserReq) (*pb
 	l := logic.NewGetUserInfoLogic(ctx, s.svcCtx)
 	return l.GetUserInfo(in)
 }
+
+// 根据企业员工id获取员工的信息
+func (s *UserCenterServer) GetEntUserInfo(ctx context.Context, in *pb.EntUserReq) (*pb.EntUserResp, error) {
+	l := logic.NewGetEntUserInfoLogic(ctx, s.svcCtx)
+	return l.GetEntUserInfo(in)
+}

+ 298 - 47
rpc/pb/userCenter.pb.go

@@ -2209,6 +2209,195 @@ func (x *UserReq) GetEntUserId() int64 {
 	return 0
 }
 
+type EntUserReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	AppId     string `protobuf:"bytes,1,opt,name=appId,proto3" json:"appId,omitempty"`
+	EntUserId int64  `protobuf:"varint,2,opt,name=entUserId,proto3" json:"entUserId,omitempty"`
+}
+
+func (x *EntUserReq) Reset() {
+	*x = EntUserReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userCenter_proto_msgTypes[27]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *EntUserReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EntUserReq) ProtoMessage() {}
+
+func (x *EntUserReq) ProtoReflect() protoreflect.Message {
+	mi := &file_userCenter_proto_msgTypes[27]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use EntUserReq.ProtoReflect.Descriptor instead.
+func (*EntUserReq) Descriptor() ([]byte, []int) {
+	return file_userCenter_proto_rawDescGZIP(), []int{27}
+}
+
+func (x *EntUserReq) GetAppId() string {
+	if x != nil {
+		return x.AppId
+	}
+	return ""
+}
+
+func (x *EntUserReq) GetEntUserId() int64 {
+	if x != nil {
+		return x.EntUserId
+	}
+	return 0
+}
+
+type EntUserResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	ErrorCode int64    `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
+	ErrorMsg  string   `protobuf:"bytes,2,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"`
+	Data      *EntUser `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
+}
+
+func (x *EntUserResp) Reset() {
+	*x = EntUserResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userCenter_proto_msgTypes[28]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *EntUserResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EntUserResp) ProtoMessage() {}
+
+func (x *EntUserResp) ProtoReflect() protoreflect.Message {
+	mi := &file_userCenter_proto_msgTypes[28]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use EntUserResp.ProtoReflect.Descriptor instead.
+func (*EntUserResp) Descriptor() ([]byte, []int) {
+	return file_userCenter_proto_rawDescGZIP(), []int{28}
+}
+
+func (x *EntUserResp) GetErrorCode() int64 {
+	if x != nil {
+		return x.ErrorCode
+	}
+	return 0
+}
+
+func (x *EntUserResp) GetErrorMsg() string {
+	if x != nil {
+		return x.ErrorMsg
+	}
+	return ""
+}
+
+func (x *EntUserResp) GetData() *EntUser {
+	if x != nil {
+		return x.Data
+	}
+	return nil
+}
+
+type EntUser struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Name     string `protobuf:"bytes,1,opt,name=Name,proto3" json:"Name,omitempty"`         //员工名册
+	Phone    string `protobuf:"bytes,2,opt,name=phone,proto3" json:"phone,omitempty"`       //员工手机号
+	Mail     string `protobuf:"bytes,3,opt,name=mail,proto3" json:"mail,omitempty"`         //邮箱
+	DeptName string `protobuf:"bytes,4,opt,name=deptName,proto3" json:"deptName,omitempty"` //部门名称
+}
+
+func (x *EntUser) Reset() {
+	*x = EntUser{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userCenter_proto_msgTypes[29]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *EntUser) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*EntUser) ProtoMessage() {}
+
+func (x *EntUser) ProtoReflect() protoreflect.Message {
+	mi := &file_userCenter_proto_msgTypes[29]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use EntUser.ProtoReflect.Descriptor instead.
+func (*EntUser) Descriptor() ([]byte, []int) {
+	return file_userCenter_proto_rawDescGZIP(), []int{29}
+}
+
+func (x *EntUser) GetName() string {
+	if x != nil {
+		return x.Name
+	}
+	return ""
+}
+
+func (x *EntUser) GetPhone() string {
+	if x != nil {
+		return x.Phone
+	}
+	return ""
+}
+
+func (x *EntUser) GetMail() string {
+	if x != nil {
+		return x.Mail
+	}
+	return ""
+}
+
+func (x *EntUser) GetDeptName() string {
+	if x != nil {
+		return x.DeptName
+	}
+	return ""
+}
+
 type ExamineResp_ExamineData struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -2220,7 +2409,7 @@ type ExamineResp_ExamineData struct {
 func (x *ExamineResp_ExamineData) Reset() {
 	*x = ExamineResp_ExamineData{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_userCenter_proto_msgTypes[27]
+		mi := &file_userCenter_proto_msgTypes[30]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2233,7 +2422,7 @@ func (x *ExamineResp_ExamineData) String() string {
 func (*ExamineResp_ExamineData) ProtoMessage() {}
 
 func (x *ExamineResp_ExamineData) ProtoReflect() protoreflect.Message {
-	mi := &file_userCenter_proto_msgTypes[27]
+	mi := &file_userCenter_proto_msgTypes[30]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2268,7 +2457,7 @@ type CheckEntRespCheckData struct {
 func (x *CheckEntRespCheckData) Reset() {
 	*x = CheckEntRespCheckData{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_userCenter_proto_msgTypes[28]
+		mi := &file_userCenter_proto_msgTypes[31]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2281,7 +2470,7 @@ func (x *CheckEntRespCheckData) String() string {
 func (*CheckEntRespCheckData) ProtoMessage() {}
 
 func (x *CheckEntRespCheckData) ProtoReflect() protoreflect.Message {
-	mi := &file_userCenter_proto_msgTypes[28]
+	mi := &file_userCenter_proto_msgTypes[31]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2323,7 +2512,7 @@ type GetStatusByCodeResp_GetStatusByCode struct {
 func (x *GetStatusByCodeResp_GetStatusByCode) Reset() {
 	*x = GetStatusByCodeResp_GetStatusByCode{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_userCenter_proto_msgTypes[29]
+		mi := &file_userCenter_proto_msgTypes[32]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -2336,7 +2525,7 @@ func (x *GetStatusByCodeResp_GetStatusByCode) String() string {
 func (*GetStatusByCodeResp_GetStatusByCode) ProtoMessage() {}
 
 func (x *GetStatusByCodeResp_GetStatusByCode) ProtoReflect() protoreflect.Message {
-	mi := &file_userCenter_proto_msgTypes[29]
+	mi := &file_userCenter_proto_msgTypes[32]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -2675,7 +2864,24 @@ var file_userCenter_proto_rawDesc = []byte{
 	0x70, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01,
 	0x28, 0x03, 0x52, 0x05, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x6e, 0x74,
 	0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x6e,
-	0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x32, 0xbe, 0x03, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72,
+	0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x40, 0x0a, 0x0a, 0x45, 0x6e, 0x74, 0x55, 0x73,
+	0x65, 0x72, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x70, 0x70, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x65,
+	0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09,
+	0x65, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x22, 0x67, 0x0a, 0x0b, 0x45, 0x6e, 0x74,
+	0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a, 0x65, 0x72, 0x72, 0x6f,
+	0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x72,
+	0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72,
+	0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f,
+	0x72, 0x4d, 0x73, 0x67, 0x12, 0x1c, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x0b, 0x32, 0x08, 0x2e, 0x45, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x64, 0x61,
+	0x74, 0x61, 0x22, 0x63, 0x0a, 0x07, 0x45, 0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x12, 0x12, 0x0a,
+	0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d,
+	0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6d, 0x61, 0x69, 0x6c, 0x18,
+	0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6d, 0x61, 0x69, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x64,
+	0x65, 0x70, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64,
+	0x65, 0x70, 0x74, 0x4e, 0x61, 0x6d, 0x65, 0x32, 0xeb, 0x03, 0x0a, 0x0a, 0x55, 0x73, 0x65, 0x72,
 	0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x12, 0x24, 0x0a, 0x07, 0x45, 0x6e, 0x74, 0x41, 0x75, 0x74,
 	0x68, 0x12, 0x0b, 0x2e, 0x45, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x71, 0x1a, 0x0c,
 	0x2e, 0x45, 0x6e, 0x74, 0x41, 0x75, 0x74, 0x68, 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x0a,
@@ -2703,8 +2909,11 @@ var file_userCenter_proto_rawDesc = []byte{
 	0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65,
 	0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x0b, 0x47, 0x65, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49,
 	0x6e, 0x66, 0x6f, 0x12, 0x08, 0x2e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x09, 0x2e,
-	0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62,
-	0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x0a, 0x0e, 0x47, 0x65, 0x74, 0x45,
+	0x6e, 0x74, 0x55, 0x73, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0b, 0x2e, 0x45, 0x6e, 0x74,
+	0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x6e, 0x74, 0x55, 0x73, 0x65,
+	0x72, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -2719,7 +2928,7 @@ func file_userCenter_proto_rawDescGZIP() []byte {
 	return file_userCenter_proto_rawDescData
 }
 
-var file_userCenter_proto_msgTypes = make([]protoimpl.MessageInfo, 31)
+var file_userCenter_proto_msgTypes = make([]protoimpl.MessageInfo, 34)
 var file_userCenter_proto_goTypes = []interface{}{
 	(*EntAuthReq)(nil),                          // 0: EntAuthReq
 	(*EntAuthResp)(nil),                         // 1: EntAuthResp
@@ -2748,51 +2957,57 @@ var file_userCenter_proto_goTypes = []interface{}{
 	(*Items)(nil),                               // 24: Items
 	(*Keys)(nil),                                // 25: Keys
 	(*UserReq)(nil),                             // 26: UserReq
-	(*ExamineResp_ExamineData)(nil),             // 27: ExamineResp.ExamineData
-	(*CheckEntRespCheckData)(nil),               // 28: CheckEntResp.checkData
-	(*GetStatusByCodeResp_GetStatusByCode)(nil), // 29: GetStatusByCodeResp.GetStatusByCode
-	nil, // 30: Subscribe.AreaEntry
+	(*EntUserReq)(nil),                          // 27: EntUserReq
+	(*EntUserResp)(nil),                         // 28: EntUserResp
+	(*EntUser)(nil),                             // 29: EntUser
+	(*ExamineResp_ExamineData)(nil),             // 30: ExamineResp.ExamineData
+	(*CheckEntRespCheckData)(nil),               // 31: CheckEntResp.checkData
+	(*GetStatusByCodeResp_GetStatusByCode)(nil), // 32: GetStatusByCodeResp.GetStatusByCode
+	nil, // 33: Subscribe.AreaEntry
 }
 var file_userCenter_proto_depIdxs = []int32{
 	2,  // 0: EntAuthResp.data:type_name -> EntAuthData
-	27, // 1: ExamineResp.data:type_name -> ExamineResp.ExamineData
+	30, // 1: ExamineResp.data:type_name -> ExamineResp.ExamineData
 	7,  // 2: EntListResp.data:type_name -> EntData
 	8,  // 3: EntData.list:type_name -> EntList
 	11, // 4: ExamineListResp.data:type_name -> ExamineListData
 	12, // 5: ExamineListData.list:type_name -> ExamineList
-	28, // 6: CheckEntResp.data:type_name -> CheckEntResp.checkData
+	31, // 6: CheckEntResp.data:type_name -> CheckEntResp.checkData
 	16, // 7: EntInfoResp.data:type_name -> EntInfoData
-	29, // 8: GetStatusByCodeResp.data:type_name -> GetStatusByCodeResp.GetStatusByCode
+	32, // 8: GetStatusByCodeResp.data:type_name -> GetStatusByCodeResp.GetStatusByCode
 	22, // 9: UserInfo.data:type_name -> Subscribe
-	30, // 10: Subscribe.area:type_name -> Subscribe.AreaEntry
+	33, // 10: Subscribe.area:type_name -> Subscribe.AreaEntry
 	24, // 11: Subscribe.items:type_name -> Items
 	25, // 12: Items.a_key:type_name -> Keys
-	23, // 13: Subscribe.AreaEntry.value:type_name -> List
-	0,  // 14: UserCenter.EntAuth:input_type -> EntAuthReq
-	3,  // 15: UserCenter.EntExamine:input_type -> ExamineReq
-	5,  // 16: UserCenter.EntList:input_type -> EntListReq
-	9,  // 17: UserCenter.ExamineList:input_type -> ExamineListReq
-	13, // 18: UserCenter.CheckEnt:input_type -> CheckEntReq
-	13, // 19: UserCenter.EntInfo:input_type -> CheckEntReq
-	17, // 20: UserCenter.EntUpdate:input_type -> EntUpdateReq
-	18, // 21: UserCenter.ExamineInfo:input_type -> CheckExamineReq
-	19, // 22: UserCenter.GetStatusByCode:input_type -> GetStatusByCodeReq
-	26, // 23: UserCenter.GetUserInfo:input_type -> UserReq
-	1,  // 24: UserCenter.EntAuth:output_type -> EntAuthResp
-	4,  // 25: UserCenter.EntExamine:output_type -> ExamineResp
-	6,  // 26: UserCenter.EntList:output_type -> EntListResp
-	10, // 27: UserCenter.ExamineList:output_type -> ExamineListResp
-	14, // 28: UserCenter.CheckEnt:output_type -> CheckEntResp
-	15, // 29: UserCenter.EntInfo:output_type -> EntInfoResp
-	4,  // 30: UserCenter.EntUpdate:output_type -> ExamineResp
-	15, // 31: UserCenter.ExamineInfo:output_type -> EntInfoResp
-	20, // 32: UserCenter.GetStatusByCode:output_type -> GetStatusByCodeResp
-	21, // 33: UserCenter.GetUserInfo:output_type -> UserInfo
-	24, // [24:34] is the sub-list for method output_type
-	14, // [14:24] is the sub-list for method input_type
-	14, // [14:14] is the sub-list for extension type_name
-	14, // [14:14] is the sub-list for extension extendee
-	0,  // [0:14] is the sub-list for field type_name
+	29, // 13: EntUserResp.data:type_name -> EntUser
+	23, // 14: Subscribe.AreaEntry.value:type_name -> List
+	0,  // 15: UserCenter.EntAuth:input_type -> EntAuthReq
+	3,  // 16: UserCenter.EntExamine:input_type -> ExamineReq
+	5,  // 17: UserCenter.EntList:input_type -> EntListReq
+	9,  // 18: UserCenter.ExamineList:input_type -> ExamineListReq
+	13, // 19: UserCenter.CheckEnt:input_type -> CheckEntReq
+	13, // 20: UserCenter.EntInfo:input_type -> CheckEntReq
+	17, // 21: UserCenter.EntUpdate:input_type -> EntUpdateReq
+	18, // 22: UserCenter.ExamineInfo:input_type -> CheckExamineReq
+	19, // 23: UserCenter.GetStatusByCode:input_type -> GetStatusByCodeReq
+	26, // 24: UserCenter.GetUserInfo:input_type -> UserReq
+	27, // 25: UserCenter.GetEntUserInfo:input_type -> EntUserReq
+	1,  // 26: UserCenter.EntAuth:output_type -> EntAuthResp
+	4,  // 27: UserCenter.EntExamine:output_type -> ExamineResp
+	6,  // 28: UserCenter.EntList:output_type -> EntListResp
+	10, // 29: UserCenter.ExamineList:output_type -> ExamineListResp
+	14, // 30: UserCenter.CheckEnt:output_type -> CheckEntResp
+	15, // 31: UserCenter.EntInfo:output_type -> EntInfoResp
+	4,  // 32: UserCenter.EntUpdate:output_type -> ExamineResp
+	15, // 33: UserCenter.ExamineInfo:output_type -> EntInfoResp
+	20, // 34: UserCenter.GetStatusByCode:output_type -> GetStatusByCodeResp
+	21, // 35: UserCenter.GetUserInfo:output_type -> UserInfo
+	28, // 36: UserCenter.GetEntUserInfo:output_type -> EntUserResp
+	26, // [26:37] is the sub-list for method output_type
+	15, // [15:26] is the sub-list for method input_type
+	15, // [15:15] is the sub-list for extension type_name
+	15, // [15:15] is the sub-list for extension extendee
+	0,  // [0:15] is the sub-list for field type_name
 }
 
 func init() { file_userCenter_proto_init() }
@@ -3126,7 +3341,7 @@ func file_userCenter_proto_init() {
 			}
 		}
 		file_userCenter_proto_msgTypes[27].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*ExamineResp_ExamineData); i {
+			switch v := v.(*EntUserReq); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3138,7 +3353,7 @@ func file_userCenter_proto_init() {
 			}
 		}
 		file_userCenter_proto_msgTypes[28].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*CheckEntRespCheckData); i {
+			switch v := v.(*EntUserResp); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -3150,6 +3365,42 @@ func file_userCenter_proto_init() {
 			}
 		}
 		file_userCenter_proto_msgTypes[29].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*EntUser); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userCenter_proto_msgTypes[30].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*ExamineResp_ExamineData); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userCenter_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*CheckEntRespCheckData); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userCenter_proto_msgTypes[32].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*GetStatusByCodeResp_GetStatusByCode); i {
 			case 0:
 				return &v.state
@@ -3168,7 +3419,7 @@ func file_userCenter_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_userCenter_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   31,
+			NumMessages:   34,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 38 - 0
rpc/pb/userCenter_grpc.pb.go

@@ -42,6 +42,8 @@ type UserCenterClient interface {
 	GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error)
 	//获取客户信息
 	GetUserInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserInfo, error)
+	//根据企业员工id获取员工的信息
+	GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error)
 }
 
 type userCenterClient struct {
@@ -142,6 +144,15 @@ func (c *userCenterClient) GetUserInfo(ctx context.Context, in *UserReq, opts ..
 	return out, nil
 }
 
+func (c *userCenterClient) GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error) {
+	out := new(EntUserResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/GetEntUserInfo", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // UserCenterServer is the server API for UserCenter service.
 // All implementations must embed UnimplementedUserCenterServer
 // for forward compatibility
@@ -166,6 +177,8 @@ type UserCenterServer interface {
 	GetStatusByCode(context.Context, *GetStatusByCodeReq) (*GetStatusByCodeResp, error)
 	//获取客户信息
 	GetUserInfo(context.Context, *UserReq) (*UserInfo, error)
+	//根据企业员工id获取员工的信息
+	GetEntUserInfo(context.Context, *EntUserReq) (*EntUserResp, error)
 	mustEmbedUnimplementedUserCenterServer()
 }
 
@@ -203,6 +216,9 @@ func (UnimplementedUserCenterServer) GetStatusByCode(context.Context, *GetStatus
 func (UnimplementedUserCenterServer) GetUserInfo(context.Context, *UserReq) (*UserInfo, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
 }
+func (UnimplementedUserCenterServer) GetEntUserInfo(context.Context, *EntUserReq) (*EntUserResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetEntUserInfo not implemented")
+}
 func (UnimplementedUserCenterServer) mustEmbedUnimplementedUserCenterServer() {}
 
 // UnsafeUserCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -396,6 +412,24 @@ func _UserCenter_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec f
 	return interceptor(ctx, in, info, handler)
 }
 
+func _UserCenter_GetEntUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(EntUserReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserCenterServer).GetEntUserInfo(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/GetEntUserInfo",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).GetEntUserInfo(ctx, req.(*EntUserReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // UserCenter_ServiceDesc is the grpc.ServiceDesc for UserCenter service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -443,6 +477,10 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetUserInfo",
 			Handler:    _UserCenter_GetUserInfo_Handler,
 		},
+		{
+			MethodName: "GetEntUserInfo",
+			Handler:    _UserCenter_GetEntUserInfo_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "userCenter.proto",

+ 13 - 0
rpc/test/ent_test.go

@@ -215,3 +215,16 @@ func Test_UserInfo(t *testing.T) {
 	log.Println("err ", err)
 	log.Println("res:", res)
 }
+
+// go test -v -run Test_EntUserInfo
+func Test_EntUserInfo(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
+	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &pb.EntUserReq{
+		EntUserId: 4254,
+	}
+
+	res, err := FileSystem.GetEntUserInfo(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}

+ 20 - 0
rpc/userCenter.proto

@@ -251,6 +251,24 @@ message UserReq{
 	int64 entUserId =6;
 }
 
+message EntUserReq{
+	string appId =1;
+	int64 entUserId =2;
+}
+
+message EntUserResp{
+	int64 error_code = 1;
+	string error_msg = 2;
+	EntUser data=3;
+}
+
+message EntUser{
+	string Name =1; //员工名册
+	string phone =2;//员工手机号
+	string mail =3;//邮箱
+	string deptName =4;//部门名称
+}
+
 service UserCenter {
 	//企业认证
 	rpc EntAuth (EntAuthReq) returns (EntAuthResp);
@@ -272,4 +290,6 @@ service UserCenter {
 	rpc GetStatusByCode(GetStatusByCodeReq) returns(GetStatusByCodeResp);
 	//获取客户信息
 	rpc GetUserInfo(UserReq) returns(UserInfo);
+	//根据企业员工id获取员工的信息
+	rpc GetEntUserInfo(EntUserReq) returns(EntUserResp);
 }

+ 11 - 0
rpc/usercenter/usercenter.go

@@ -27,6 +27,9 @@ type (
 	EntListReq                          = pb.EntListReq
 	EntListResp                         = pb.EntListResp
 	EntUpdateReq                        = pb.EntUpdateReq
+	EntUser                             = pb.EntUser
+	EntUserReq                          = pb.EntUserReq
+	EntUserResp                         = pb.EntUserResp
 	ExamineList                         = pb.ExamineList
 	ExamineListData                     = pb.ExamineListData
 	ExamineListReq                      = pb.ExamineListReq
@@ -65,6 +68,8 @@ type (
 		GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error)
 		// 获取客户信息
 		GetUserInfo(ctx context.Context, in *UserReq, opts ...grpc.CallOption) (*UserInfo, error)
+		// 根据企业员工id获取员工的信息
+		GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error)
 	}
 
 	defaultUserCenter struct {
@@ -137,3 +142,9 @@ func (m *defaultUserCenter) GetUserInfo(ctx context.Context, in *UserReq, opts .
 	client := pb.NewUserCenterClient(m.cli.Conn())
 	return client.GetUserInfo(ctx, in, opts...)
 }
+
+// 根据企业员工id获取员工的信息
+func (m *defaultUserCenter) GetEntUserInfo(ctx context.Context, in *EntUserReq, opts ...grpc.CallOption) (*EntUserResp, error) {
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.GetEntUserInfo(ctx, in, opts...)
+}

+ 9 - 0
service/entService.go

@@ -321,3 +321,12 @@ func (this *EntService) GetStatusByCode(data *userCenter.GetStatusByCodeReq) (in
 	}
 	return info.GetStatusByCode()
 }
+
+//根据entid 获取员工 信息
+func (this *EntService) GetEntUserInfo(data *userCenter.EntUserReq) (*entity.User, string) {
+	info := &entity.EntUserInfo{
+		Mysql:     entity.Mysql,
+		EntUserId: data.EntUserId,
+	}
+	return info.GetEntUserInfo()
+}