瀏覽代碼

feat:统一社会信用代码查询企业相关

zhangxinlei1996 3 年之前
父節點
當前提交
6e5e4a2c16

+ 28 - 0
api/internal/handler/getstatusbycodehandler.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 GetStatusByCodeHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.GetStatusByCodeReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewGetStatusByCodeLogic(r.Context(), svcCtx)
+		resp, err := l.GetStatusByCode(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

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

@@ -52,6 +52,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/userCenter/ent/update",
 				Handler: UpdateEntHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/userCenter/ent/getStatusByCode",
+				Handler: GetStatusByCodeHandler(serverCtx),
+			},
 		},
 	)
 }

+ 42 - 0
api/internal/logic/getstatusbycodelogic.go

@@ -0,0 +1,42 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/api/internal/types"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/entity"
+	"bp.jydev.jianyu360.cn/BaseService/userCenter/rpc/pb"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type GetStatusByCodeLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewGetStatusByCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStatusByCodeLogic {
+	return &GetStatusByCodeLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *GetStatusByCodeLogic) GetStatusByCode(req *types.GetStatusByCodeReq) (resp *types.GetStatusByCodeResp, err error) {
+	// todo: add your logic here and delete this line
+	res, err := entity.UserCenterRpc.GetStatusByCode(l.ctx, &pb.GetStatusByCodeReq{
+		Code:  req.Code,
+		Phone: req.Phone,
+	})
+	return &types.GetStatusByCodeResp{
+		Error_code: res.ErrorCode,
+		Error_msg:  res.ErrorMsg,
+		Data: &types.GetStatus{
+			AuthStatus: res.Data.AuthStatus,
+			IsInEnt:    res.Data.IsInEnt,
+		},
+	}, err
+}

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

@@ -169,3 +169,19 @@ type UpdateEntReq struct {
 	EntId      int64 `json:"entId"`      //企业id
 	UpdateType int64 `json:"updateType"` //1-冻结  2-解冻
 }
+
+type GetStatusByCodeReq struct {
+	Code  string `json:"code"`
+	Phone string `json:"phone"`
+}
+
+type GetStatusByCodeResp struct {
+	Error_code int64      `json:"error_code"`
+	Error_msg  string     `json:"error_msg"`
+	Data       *GetStatus `json:"data"`
+}
+
+type GetStatus struct {
+	AuthStatus int64 `json:"authStatus"`
+	IsInEnt    bool  `json:"isInEnt"`
+}

+ 20 - 0
api/userCenter.api

@@ -180,6 +180,24 @@ type (
 		EntId      int64 `json:"entId"`      //企业id
 		UpdateType int64 `json:"updateType"` //1-冻结  2-解冻
 	}
+
+	//根据统一社会信用代码查看企业状态入参
+	GetStatusByCodeReq {
+		Code  string `json:"code"`
+		Phone string `json:"phone"`
+	}
+
+	//根据统一社会信用代码查看企业状态出参
+	GetStatusByCodeResp {
+		Error_code int64      `json:"error_code"`
+		Error_msg  string     `json:"error_msg"`
+		Data       *GetStatus `json:"data"`
+	}
+
+	GetStatus {
+		AuthStatus int64 `json:"authStatus"`
+		IsInEnt    bool  `json:"isInEnt"`
+	}
 )
 
 service userCenter-api {
@@ -199,4 +217,6 @@ service userCenter-api {
 	post /userCenter/ent/examineInfo(ExamineInfoReq) returns(ExamineInfoResp)
 	@handler UpdateEnt
 	post /userCenter/ent/update(UpdateEntReq)returns(resp)
+	@handler GetStatusByCode
+	post /userCenter/ent/getStatusByCode(GetStatusByCodeReq)returns(GetStatusByCodeResp)
 }

+ 38 - 0
entity/ent.go

@@ -250,6 +250,9 @@ func (this *EntInfo) Update() bool {
 	if this.Code != "" {
 		m["code"] = this.Code
 	}
+	if this.Name != "" {
+		m["name"] = this.Name
+	}
 	return this.Mysql.ExecTx("更新企业", func(tx *sql.Tx) bool {
 		ok_1 := this.Mysql.UpdateByTx(tx, Entniche_info, map[string]interface{}{
 			"id": this.Id,
@@ -690,3 +693,38 @@ func TimeFormat(timestamp, format string) string {
 	i_timestamp, _ := strconv.Atoi(timestamp)
 	return time.Unix(int64(i_timestamp), 0).Format(format)
 }
+
+type GetStatusByCodeStruct struct {
+	Code  string
+	Phone string
+	Mysql *mysql.Mysql
+}
+
+//
+func (this *GetStatusByCodeStruct) GetStatusByCode() (int, bool, string) {
+	isin := false
+	authStatus := 0
+	if this.Code == "" {
+		return authStatus, isin, "参数错误"
+	}
+	if r := this.Mysql.SelectBySql(`select id,auth_status,frozen_status,audit_status from entniche_info where code =?`, this.Code); r != nil && len(*r) > 0 {
+		for _, v := range *r {
+			//记录所有的统一社会信用代码相同的企业
+			entids := ""
+			id := common.Int64All(v["id"])
+			audit_status := common.Int64All(v["audit_status"])
+			authStatus = common.IntAll(v["auth_status"])
+			if audit_status == 1 { //根据统一社会信用代码查看该企业正在审核中
+				authStatus = 3
+				return authStatus, isin, ""
+			}
+			entids += strconv.Itoa(int(id)) + ","
+			if entids != "" {
+				entids = entids[:len(entids)-1]
+			}
+			log.Println(entids, "=========")
+			isin = this.Mysql.CountBySql(`select count(1) from entniche_user where ent_id in(?) and phone =?`, entids, this.Phone) > 0
+		}
+	}
+	return authStatus, isin, ""
+}

+ 38 - 0
rpc/internal/logic/getstatusbycodelogic.go

@@ -0,0 +1,38 @@
+package logic
+
+import (
+	"context"
+
+	"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 GetStatusByCodeLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewGetStatusByCodeLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetStatusByCodeLogic {
+	return &GetStatusByCodeLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+// 根据统一社会信用代码查询企业状态
+func (l *GetStatusByCodeLogic) GetStatusByCode(in *pb.GetStatusByCodeReq) (*pb.GetStatusByCodeResp, error) {
+	// todo: add your logic here and delete this line
+	status, isIn, msg := Entservice.GetStatusByCode(in)
+	return &pb.GetStatusByCodeResp{
+		ErrorMsg:  msg,
+		ErrorCode: 0,
+		Data: &pb.GetStatusByCodeResp_GetStatusByCode{
+			AuthStatus: int64(status),
+			IsInEnt:    isIn,
+		},
+	}, nil
+}

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

@@ -69,3 +69,9 @@ func (s *UserCenterServer) ExamineInfo(ctx context.Context, in *pb.CheckExamineR
 	l := logic.NewExamineInfoLogic(ctx, s.svcCtx)
 	return l.ExamineInfo(in)
 }
+
+// 根据统一社会信用代码查询企业状态
+func (s *UserCenterServer) GetStatusByCode(ctx context.Context, in *pb.GetStatusByCodeReq) (*pb.GetStatusByCodeResp, error) {
+	l := logic.NewGetStatusByCodeLogic(ctx, s.svcCtx)
+	return l.GetStatusByCode(in)
+}

+ 311 - 75
rpc/pb/userCenter.pb.go

@@ -1613,6 +1613,124 @@ func (x *CheckExamineReq) GetExamineId() int64 {
 	return 0
 }
 
+type GetStatusByCodeReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Code  string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`   //统一社会信用代码
+	Phone string `protobuf:"bytes,2,opt,name=phone,proto3" json:"phone,omitempty"` //注册手机号
+}
+
+func (x *GetStatusByCodeReq) Reset() {
+	*x = GetStatusByCodeReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userCenter_proto_msgTypes[19]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *GetStatusByCodeReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetStatusByCodeReq) ProtoMessage() {}
+
+func (x *GetStatusByCodeReq) ProtoReflect() protoreflect.Message {
+	mi := &file_userCenter_proto_msgTypes[19]
+	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 GetStatusByCodeReq.ProtoReflect.Descriptor instead.
+func (*GetStatusByCodeReq) Descriptor() ([]byte, []int) {
+	return file_userCenter_proto_rawDescGZIP(), []int{19}
+}
+
+func (x *GetStatusByCodeReq) GetCode() string {
+	if x != nil {
+		return x.Code
+	}
+	return ""
+}
+
+func (x *GetStatusByCodeReq) GetPhone() string {
+	if x != nil {
+		return x.Phone
+	}
+	return ""
+}
+
+type GetStatusByCodeResp 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      *GetStatusByCodeResp_GetStatusByCode `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` //详情
+}
+
+func (x *GetStatusByCodeResp) Reset() {
+	*x = GetStatusByCodeResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userCenter_proto_msgTypes[20]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *GetStatusByCodeResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetStatusByCodeResp) ProtoMessage() {}
+
+func (x *GetStatusByCodeResp) ProtoReflect() protoreflect.Message {
+	mi := &file_userCenter_proto_msgTypes[20]
+	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 GetStatusByCodeResp.ProtoReflect.Descriptor instead.
+func (*GetStatusByCodeResp) Descriptor() ([]byte, []int) {
+	return file_userCenter_proto_rawDescGZIP(), []int{20}
+}
+
+func (x *GetStatusByCodeResp) GetErrorCode() int64 {
+	if x != nil {
+		return x.ErrorCode
+	}
+	return 0
+}
+
+func (x *GetStatusByCodeResp) GetErrorMsg() string {
+	if x != nil {
+		return x.ErrorMsg
+	}
+	return ""
+}
+
+func (x *GetStatusByCodeResp) GetData() *GetStatusByCodeResp_GetStatusByCode {
+	if x != nil {
+		return x.Data
+	}
+	return nil
+}
+
 type ExamineResp_ExamineData struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -1624,7 +1742,7 @@ type ExamineResp_ExamineData struct {
 func (x *ExamineResp_ExamineData) Reset() {
 	*x = ExamineResp_ExamineData{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_userCenter_proto_msgTypes[19]
+		mi := &file_userCenter_proto_msgTypes[21]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -1637,7 +1755,7 @@ func (x *ExamineResp_ExamineData) String() string {
 func (*ExamineResp_ExamineData) ProtoMessage() {}
 
 func (x *ExamineResp_ExamineData) ProtoReflect() protoreflect.Message {
-	mi := &file_userCenter_proto_msgTypes[19]
+	mi := &file_userCenter_proto_msgTypes[21]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -1672,7 +1790,7 @@ type CheckEntRespCheckData struct {
 func (x *CheckEntRespCheckData) Reset() {
 	*x = CheckEntRespCheckData{}
 	if protoimpl.UnsafeEnabled {
-		mi := &file_userCenter_proto_msgTypes[20]
+		mi := &file_userCenter_proto_msgTypes[22]
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		ms.StoreMessageInfo(mi)
 	}
@@ -1685,7 +1803,7 @@ func (x *CheckEntRespCheckData) String() string {
 func (*CheckEntRespCheckData) ProtoMessage() {}
 
 func (x *CheckEntRespCheckData) ProtoReflect() protoreflect.Message {
-	mi := &file_userCenter_proto_msgTypes[20]
+	mi := &file_userCenter_proto_msgTypes[22]
 	if protoimpl.UnsafeEnabled && x != nil {
 		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
 		if ms.LoadMessageInfo() == nil {
@@ -1715,6 +1833,61 @@ func (x *CheckEntRespCheckData) GetFrozenStatus() int64 {
 	return 0
 }
 
+type GetStatusByCodeResp_GetStatusByCode struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	AuthStatus int64 `protobuf:"varint,1,opt,name=authStatus,proto3" json:"authStatus,omitempty"` //企业是否认证 -1 未通过,0 未认证,1 已认证. -2 已到期 3待审核
+	IsInEnt    bool  `protobuf:"varint,2,opt,name=isInEnt,proto3" json:"isInEnt,omitempty"`       //是否在该企业内
+}
+
+func (x *GetStatusByCodeResp_GetStatusByCode) Reset() {
+	*x = GetStatusByCodeResp_GetStatusByCode{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_userCenter_proto_msgTypes[23]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *GetStatusByCodeResp_GetStatusByCode) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetStatusByCodeResp_GetStatusByCode) ProtoMessage() {}
+
+func (x *GetStatusByCodeResp_GetStatusByCode) ProtoReflect() protoreflect.Message {
+	mi := &file_userCenter_proto_msgTypes[23]
+	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 GetStatusByCodeResp_GetStatusByCode.ProtoReflect.Descriptor instead.
+func (*GetStatusByCodeResp_GetStatusByCode) Descriptor() ([]byte, []int) {
+	return file_userCenter_proto_rawDescGZIP(), []int{20, 0}
+}
+
+func (x *GetStatusByCodeResp_GetStatusByCode) GetAuthStatus() int64 {
+	if x != nil {
+		return x.AuthStatus
+	}
+	return 0
+}
+
+func (x *GetStatusByCodeResp_GetStatusByCode) GetIsInEnt() bool {
+	if x != nil {
+		return x.IsInEnt
+	}
+	return false
+}
+
 var File_userCenter_proto protoreflect.FileDescriptor
 
 var file_userCenter_proto_rawDesc = []byte{
@@ -1944,30 +2117,51 @@ var file_userCenter_proto_rawDesc = []byte{
 	0x74, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2f, 0x0a, 0x0f, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45,
 	0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x65, 0x78, 0x61,
 	0x6d, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x65, 0x78,
-	0x61, 0x6d, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x32, 0xdc, 0x02, 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,
-	0x45, 0x6e, 0x74, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x12, 0x0b, 0x2e, 0x45, 0x78, 0x61,
-	0x6d, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e,
-	0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x24, 0x0a, 0x07, 0x45, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74,
-	0x12, 0x0b, 0x2e, 0x45, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e,
-	0x45, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x0b, 0x45,
-	0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f, 0x2e, 0x45, 0x78, 0x61,
-	0x6d, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x45, 0x78,
-	0x61, 0x6d, 0x69, 0x6e, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a,
-	0x08, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x43, 0x68, 0x65, 0x63,
-	0x6b, 0x45, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45,
-	0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x07, 0x45, 0x6e, 0x74, 0x49, 0x6e, 0x66,
-	0x6f, 0x12, 0x0c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a,
-	0x0c, 0x2e, 0x45, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x28, 0x0a,
-	0x09, 0x45, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x2e, 0x45, 0x6e, 0x74,
-	0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x78, 0x61, 0x6d,
-	0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0b, 0x45, 0x78, 0x61, 0x6d, 0x69,
-	0x6e, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x78,
-	0x61, 0x6d, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x6e, 0x74, 0x49, 0x6e,
-	0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06,
-	0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x61, 0x6d, 0x69, 0x6e, 0x65, 0x49, 0x64, 0x22, 0x3e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x74,
+	0x61, 0x74, 0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a,
+	0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64,
+	0x65, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x22, 0xd8, 0x01, 0x0a, 0x13, 0x47, 0x65, 0x74, 0x53,
+	0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 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, 0x38, 0x0a, 0x04, 0x64,
+	0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x47, 0x65, 0x74, 0x53,
+	0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x2e,
+	0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52,
+	0x04, 0x64, 0x61, 0x74, 0x61, 0x1a, 0x4b, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74,
+	0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x61, 0x75, 0x74, 0x68,
+	0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x61, 0x75,
+	0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x69, 0x73, 0x49, 0x6e,
+	0x45, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x69, 0x73, 0x49, 0x6e, 0x45,
+	0x6e, 0x74, 0x32, 0x9a, 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, 0x45, 0x6e, 0x74, 0x45, 0x78,
+	0x61, 0x6d, 0x69, 0x6e, 0x65, 0x12, 0x0b, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x52,
+	0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x24, 0x0a, 0x07, 0x45, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0b, 0x2e, 0x45, 0x6e,
+	0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x6e, 0x74, 0x4c, 0x69,
+	0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x30, 0x0a, 0x0b, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e,
+	0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0f, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x4c,
+	0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65,
+	0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x08, 0x43, 0x68, 0x65, 0x63,
+	0x6b, 0x45, 0x6e, 0x74, 0x12, 0x0c, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x52,
+	0x65, 0x71, 0x1a, 0x0d, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x25, 0x0a, 0x07, 0x45, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0c, 0x2e, 0x43,
+	0x68, 0x65, 0x63, 0x6b, 0x45, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x6e, 0x74,
+	0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x12, 0x28, 0x0a, 0x09, 0x45, 0x6e, 0x74, 0x55,
+	0x70, 0x64, 0x61, 0x74, 0x65, 0x12, 0x0d, 0x2e, 0x45, 0x6e, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74,
+	0x65, 0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x52, 0x65,
+	0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0b, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65, 0x49, 0x6e, 0x66,
+	0x6f, 0x12, 0x10, 0x2e, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x45, 0x78, 0x61, 0x6d, 0x69, 0x6e, 0x65,
+	0x52, 0x65, 0x71, 0x1a, 0x0c, 0x2e, 0x45, 0x6e, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73,
+	0x70, 0x12, 0x3c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x79,
+	0x43, 0x6f, 0x64, 0x65, 0x12, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73,
+	0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x14, 0x2e, 0x47, 0x65, 0x74, 0x53,
+	0x74, 0x61, 0x74, 0x75, 0x73, 0x42, 0x79, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42,
+	0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1982,60 +2176,66 @@ func file_userCenter_proto_rawDescGZIP() []byte {
 	return file_userCenter_proto_rawDescData
 }
 
-var file_userCenter_proto_msgTypes = make([]protoimpl.MessageInfo, 21)
+var file_userCenter_proto_msgTypes = make([]protoimpl.MessageInfo, 24)
 var file_userCenter_proto_goTypes = []interface{}{
-	(*EntAuthReq)(nil),              // 0: EntAuthReq
-	(*EntAuthResp)(nil),             // 1: EntAuthResp
-	(*EntAuthData)(nil),             // 2: EntAuthData
-	(*ExamineReq)(nil),              // 3: ExamineReq
-	(*ExamineResp)(nil),             // 4: ExamineResp
-	(*EntListReq)(nil),              // 5: EntListReq
-	(*EntListResp)(nil),             // 6: EntListResp
-	(*EntData)(nil),                 // 7: EntData
-	(*EntList)(nil),                 // 8: EntList
-	(*ExamineListReq)(nil),          // 9: ExamineListReq
-	(*ExamineListResp)(nil),         // 10: ExamineListResp
-	(*ExamineListData)(nil),         // 11: ExamineListData
-	(*ExamineList)(nil),             // 12: ExamineList
-	(*CheckEntReq)(nil),             // 13: CheckEntReq
-	(*CheckEntResp)(nil),            // 14: CheckEntResp
-	(*EntInfoResp)(nil),             // 15: EntInfoResp
-	(*EntInfoData)(nil),             // 16: EntInfoData
-	(*EntUpdateReq)(nil),            // 17: EntUpdateReq
-	(*CheckExamineReq)(nil),         // 18: CheckExamineReq
-	(*ExamineResp_ExamineData)(nil), // 19: ExamineResp.ExamineData
-	(*CheckEntRespCheckData)(nil),   // 20: CheckEntResp.checkData
+	(*EntAuthReq)(nil),                          // 0: EntAuthReq
+	(*EntAuthResp)(nil),                         // 1: EntAuthResp
+	(*EntAuthData)(nil),                         // 2: EntAuthData
+	(*ExamineReq)(nil),                          // 3: ExamineReq
+	(*ExamineResp)(nil),                         // 4: ExamineResp
+	(*EntListReq)(nil),                          // 5: EntListReq
+	(*EntListResp)(nil),                         // 6: EntListResp
+	(*EntData)(nil),                             // 7: EntData
+	(*EntList)(nil),                             // 8: EntList
+	(*ExamineListReq)(nil),                      // 9: ExamineListReq
+	(*ExamineListResp)(nil),                     // 10: ExamineListResp
+	(*ExamineListData)(nil),                     // 11: ExamineListData
+	(*ExamineList)(nil),                         // 12: ExamineList
+	(*CheckEntReq)(nil),                         // 13: CheckEntReq
+	(*CheckEntResp)(nil),                        // 14: CheckEntResp
+	(*EntInfoResp)(nil),                         // 15: EntInfoResp
+	(*EntInfoData)(nil),                         // 16: EntInfoData
+	(*EntUpdateReq)(nil),                        // 17: EntUpdateReq
+	(*CheckExamineReq)(nil),                     // 18: CheckExamineReq
+	(*GetStatusByCodeReq)(nil),                  // 19: GetStatusByCodeReq
+	(*GetStatusByCodeResp)(nil),                 // 20: GetStatusByCodeResp
+	(*ExamineResp_ExamineData)(nil),             // 21: ExamineResp.ExamineData
+	(*CheckEntRespCheckData)(nil),               // 22: CheckEntResp.checkData
+	(*GetStatusByCodeResp_GetStatusByCode)(nil), // 23: GetStatusByCodeResp.GetStatusByCode
 }
 var file_userCenter_proto_depIdxs = []int32{
 	2,  // 0: EntAuthResp.data:type_name -> EntAuthData
-	19, // 1: ExamineResp.data:type_name -> ExamineResp.ExamineData
+	21, // 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
-	20, // 6: CheckEntResp.data:type_name -> CheckEntResp.checkData
+	22, // 6: CheckEntResp.data:type_name -> CheckEntResp.checkData
 	16, // 7: EntInfoResp.data:type_name -> EntInfoData
-	0,  // 8: UserCenter.EntAuth:input_type -> EntAuthReq
-	3,  // 9: UserCenter.EntExamine:input_type -> ExamineReq
-	5,  // 10: UserCenter.EntList:input_type -> EntListReq
-	9,  // 11: UserCenter.ExamineList:input_type -> ExamineListReq
-	13, // 12: UserCenter.CheckEnt:input_type -> CheckEntReq
-	13, // 13: UserCenter.EntInfo:input_type -> CheckEntReq
-	17, // 14: UserCenter.EntUpdate:input_type -> EntUpdateReq
-	18, // 15: UserCenter.ExamineInfo:input_type -> CheckExamineReq
-	1,  // 16: UserCenter.EntAuth:output_type -> EntAuthResp
-	4,  // 17: UserCenter.EntExamine:output_type -> ExamineResp
-	6,  // 18: UserCenter.EntList:output_type -> EntListResp
-	10, // 19: UserCenter.ExamineList:output_type -> ExamineListResp
-	14, // 20: UserCenter.CheckEnt:output_type -> CheckEntResp
-	15, // 21: UserCenter.EntInfo:output_type -> EntInfoResp
-	4,  // 22: UserCenter.EntUpdate:output_type -> ExamineResp
-	15, // 23: UserCenter.ExamineInfo:output_type -> EntInfoResp
-	16, // [16:24] is the sub-list for method output_type
-	8,  // [8:16] is the sub-list for method input_type
-	8,  // [8:8] is the sub-list for extension type_name
-	8,  // [8:8] is the sub-list for extension extendee
-	0,  // [0:8] is the sub-list for field type_name
+	23, // 8: GetStatusByCodeResp.data:type_name -> GetStatusByCodeResp.GetStatusByCode
+	0,  // 9: UserCenter.EntAuth:input_type -> EntAuthReq
+	3,  // 10: UserCenter.EntExamine:input_type -> ExamineReq
+	5,  // 11: UserCenter.EntList:input_type -> EntListReq
+	9,  // 12: UserCenter.ExamineList:input_type -> ExamineListReq
+	13, // 13: UserCenter.CheckEnt:input_type -> CheckEntReq
+	13, // 14: UserCenter.EntInfo:input_type -> CheckEntReq
+	17, // 15: UserCenter.EntUpdate:input_type -> EntUpdateReq
+	18, // 16: UserCenter.ExamineInfo:input_type -> CheckExamineReq
+	19, // 17: UserCenter.GetStatusByCode:input_type -> GetStatusByCodeReq
+	1,  // 18: UserCenter.EntAuth:output_type -> EntAuthResp
+	4,  // 19: UserCenter.EntExamine:output_type -> ExamineResp
+	6,  // 20: UserCenter.EntList:output_type -> EntListResp
+	10, // 21: UserCenter.ExamineList:output_type -> ExamineListResp
+	14, // 22: UserCenter.CheckEnt:output_type -> CheckEntResp
+	15, // 23: UserCenter.EntInfo:output_type -> EntInfoResp
+	4,  // 24: UserCenter.EntUpdate:output_type -> ExamineResp
+	15, // 25: UserCenter.ExamineInfo:output_type -> EntInfoResp
+	20, // 26: UserCenter.GetStatusByCode:output_type -> GetStatusByCodeResp
+	18, // [18:27] is the sub-list for method output_type
+	9,  // [9:18] is the sub-list for method input_type
+	9,  // [9:9] is the sub-list for extension type_name
+	9,  // [9:9] is the sub-list for extension extendee
+	0,  // [0:9] is the sub-list for field type_name
 }
 
 func init() { file_userCenter_proto_init() }
@@ -2273,7 +2473,7 @@ func file_userCenter_proto_init() {
 			}
 		}
 		file_userCenter_proto_msgTypes[19].Exporter = func(v interface{}, i int) interface{} {
-			switch v := v.(*ExamineResp_ExamineData); i {
+			switch v := v.(*GetStatusByCodeReq); i {
 			case 0:
 				return &v.state
 			case 1:
@@ -2285,6 +2485,30 @@ func file_userCenter_proto_init() {
 			}
 		}
 		file_userCenter_proto_msgTypes[20].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*GetStatusByCodeResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_userCenter_proto_msgTypes[21].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[22].Exporter = func(v interface{}, i int) interface{} {
 			switch v := v.(*CheckEntRespCheckData); i {
 			case 0:
 				return &v.state
@@ -2296,6 +2520,18 @@ func file_userCenter_proto_init() {
 				return nil
 			}
 		}
+		file_userCenter_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*GetStatusByCodeResp_GetStatusByCode); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
 	}
 	type x struct{}
 	out := protoimpl.TypeBuilder{
@@ -2303,7 +2539,7 @@ func file_userCenter_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_userCenter_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   21,
+			NumMessages:   24,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

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

@@ -38,6 +38,8 @@ type UserCenterClient interface {
 	EntUpdate(ctx context.Context, in *EntUpdateReq, opts ...grpc.CallOption) (*ExamineResp, error)
 	//查看审核详情
 	ExamineInfo(ctx context.Context, in *CheckExamineReq, opts ...grpc.CallOption) (*EntInfoResp, error)
+	//根据统一社会信用代码查询企业状态
+	GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error)
 }
 
 type userCenterClient struct {
@@ -120,6 +122,15 @@ func (c *userCenterClient) ExamineInfo(ctx context.Context, in *CheckExamineReq,
 	return out, nil
 }
 
+func (c *userCenterClient) GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error) {
+	out := new(GetStatusByCodeResp)
+	err := c.cc.Invoke(ctx, "/UserCenter/GetStatusByCode", 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
@@ -140,6 +151,8 @@ type UserCenterServer interface {
 	EntUpdate(context.Context, *EntUpdateReq) (*ExamineResp, error)
 	//查看审核详情
 	ExamineInfo(context.Context, *CheckExamineReq) (*EntInfoResp, error)
+	//根据统一社会信用代码查询企业状态
+	GetStatusByCode(context.Context, *GetStatusByCodeReq) (*GetStatusByCodeResp, error)
 	mustEmbedUnimplementedUserCenterServer()
 }
 
@@ -171,6 +184,9 @@ func (UnimplementedUserCenterServer) EntUpdate(context.Context, *EntUpdateReq) (
 func (UnimplementedUserCenterServer) ExamineInfo(context.Context, *CheckExamineReq) (*EntInfoResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ExamineInfo not implemented")
 }
+func (UnimplementedUserCenterServer) GetStatusByCode(context.Context, *GetStatusByCodeReq) (*GetStatusByCodeResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method GetStatusByCode not implemented")
+}
 func (UnimplementedUserCenterServer) mustEmbedUnimplementedUserCenterServer() {}
 
 // UnsafeUserCenterServer may be embedded to opt out of forward compatibility for this service.
@@ -328,6 +344,24 @@ func _UserCenter_ExamineInfo_Handler(srv interface{}, ctx context.Context, dec f
 	return interceptor(ctx, in, info, handler)
 }
 
+func _UserCenter_GetStatusByCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(GetStatusByCodeReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(UserCenterServer).GetStatusByCode(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/UserCenter/GetStatusByCode",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(UserCenterServer).GetStatusByCode(ctx, req.(*GetStatusByCodeReq))
+	}
+	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)
@@ -367,6 +401,10 @@ var UserCenter_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "ExamineInfo",
 			Handler:    _UserCenter_ExamineInfo_Handler,
 		},
+		{
+			MethodName: "GetStatusByCode",
+			Handler:    _UserCenter_GetStatusByCode_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "userCenter.proto",

+ 13 - 0
rpc/test/ent_test.go

@@ -31,6 +31,19 @@ func init() {
 	conf.MustLoad("usercenter.yaml", &c)
 }
 
+// go test -v -run Test_GetStatusByCode
+func Test_GetStatusByCode(t *testing.T) {
+	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)
+	FileSystem := usercenterclient.NewUserCenter(zrpc.MustNewClient(c.FileSystemConf))
+	req := &pb.GetStatusByCodeReq{
+		Code:  "91230881MA18Y5NM11",
+		Phone: "15225181827",
+	}
+	res, err := FileSystem.GetStatusByCode(ctx, req)
+	log.Println("err ", err)
+	log.Println("res:", res)
+}
+
 // go test -v -run Test_ExamineInfo
 func Test_ExamineInfo(t *testing.T) {
 	ctx, _ := context.WithTimeout(context.Background(), 2*time.Second)

+ 18 - 0
rpc/userCenter.proto

@@ -183,6 +183,22 @@ message CheckExamineReq{
 	int64 examineId =1;  //审核id
 }
 
+
+message GetStatusByCodeReq{
+	string code =1; //统一社会信用代码
+	string phone =2;//注册手机号
+}
+
+message GetStatusByCodeResp{
+	int64   error_code = 1;
+	string  error_msg = 2;
+	message GetStatusByCode {
+		int64 authStatus =1;//企业是否认证 -1 未通过,0 未认证,1 已认证. -2 已到期 3待审核
+		bool isInEnt =2; //是否在该企业内
+	}
+	GetStatusByCode data = 3; //详情
+}
+
 service UserCenter {
 	//企业认证
 	rpc EntAuth (EntAuthReq) returns (EntAuthResp);
@@ -200,4 +216,6 @@ service UserCenter {
 	rpc EntUpdate (EntUpdateReq) returns(ExamineResp);
 	//查看审核详情
 	rpc ExamineInfo(CheckExamineReq) returns (EntInfoResp);
+	//根据统一社会信用代码查询企业状态
+	rpc GetStatusByCode(GetStatusByCodeReq) returns(GetStatusByCodeResp);
 }

+ 32 - 21
rpc/usercenter/usercenter.go

@@ -13,27 +13,30 @@ import (
 )
 
 type (
-	CheckEntReq             = pb.CheckEntReq
-	CheckEntResp            = pb.CheckEntResp
-	CheckEntRespCheckData   = pb.CheckEntRespCheckData
-	CheckExamineReq         = pb.CheckExamineReq
-	EntAuthData             = pb.EntAuthData
-	EntAuthReq              = pb.EntAuthReq
-	EntAuthResp             = pb.EntAuthResp
-	EntData                 = pb.EntData
-	EntInfoData             = pb.EntInfoData
-	EntInfoResp             = pb.EntInfoResp
-	EntList                 = pb.EntList
-	EntListReq              = pb.EntListReq
-	EntListResp             = pb.EntListResp
-	EntUpdateReq            = pb.EntUpdateReq
-	ExamineList             = pb.ExamineList
-	ExamineListData         = pb.ExamineListData
-	ExamineListReq          = pb.ExamineListReq
-	ExamineListResp         = pb.ExamineListResp
-	ExamineReq              = pb.ExamineReq
-	ExamineResp             = pb.ExamineResp
-	ExamineResp_ExamineData = pb.ExamineResp_ExamineData
+	CheckEntReq                         = pb.CheckEntReq
+	CheckEntResp                        = pb.CheckEntResp
+	CheckEntRespCheckData               = pb.CheckEntRespCheckData
+	CheckExamineReq                     = pb.CheckExamineReq
+	EntAuthData                         = pb.EntAuthData
+	EntAuthReq                          = pb.EntAuthReq
+	EntAuthResp                         = pb.EntAuthResp
+	EntData                             = pb.EntData
+	EntInfoData                         = pb.EntInfoData
+	EntInfoResp                         = pb.EntInfoResp
+	EntList                             = pb.EntList
+	EntListReq                          = pb.EntListReq
+	EntListResp                         = pb.EntListResp
+	EntUpdateReq                        = pb.EntUpdateReq
+	ExamineList                         = pb.ExamineList
+	ExamineListData                     = pb.ExamineListData
+	ExamineListReq                      = pb.ExamineListReq
+	ExamineListResp                     = pb.ExamineListResp
+	ExamineReq                          = pb.ExamineReq
+	ExamineResp                         = pb.ExamineResp
+	ExamineResp_ExamineData             = pb.ExamineResp_ExamineData
+	GetStatusByCodeReq                  = pb.GetStatusByCodeReq
+	GetStatusByCodeResp                 = pb.GetStatusByCodeResp
+	GetStatusByCodeResp_GetStatusByCode = pb.GetStatusByCodeResp_GetStatusByCode
 
 	UserCenter interface {
 		// 企业认证
@@ -52,6 +55,8 @@ type (
 		EntUpdate(ctx context.Context, in *EntUpdateReq, opts ...grpc.CallOption) (*ExamineResp, error)
 		// 查看审核详情
 		ExamineInfo(ctx context.Context, in *CheckExamineReq, opts ...grpc.CallOption) (*EntInfoResp, error)
+		// 根据统一社会信用代码查询企业状态
+		GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error)
 	}
 
 	defaultUserCenter struct {
@@ -112,3 +117,9 @@ func (m *defaultUserCenter) ExamineInfo(ctx context.Context, in *CheckExamineReq
 	client := pb.NewUserCenterClient(m.cli.Conn())
 	return client.ExamineInfo(ctx, in, opts...)
 }
+
+// 根据统一社会信用代码查询企业状态
+func (m *defaultUserCenter) GetStatusByCode(ctx context.Context, in *GetStatusByCodeReq, opts ...grpc.CallOption) (*GetStatusByCodeResp, error) {
+	client := pb.NewUserCenterClient(m.cli.Conn())
+	return client.GetStatusByCode(ctx, in, opts...)
+}

+ 39 - 11
service/entService.go

@@ -1,6 +1,7 @@
 package service
 
 import (
+	"fmt"
 	"log"
 	"strconv"
 	"time"
@@ -58,27 +59,45 @@ func (this *EntService) CreateEnt(data *userCenter.EntAuthReq) (int64, string, i
 	r := entity.Mysql.SelectBySql(`select id,audit_status,auth_status,name,phone from entniche_info where code =?`, data.CreditCode)
 
 	if r != nil && len(*r) > 0 {
+		//记录所有的统一社会信用代码相同的企业
+		sameCode := map[int64]interface{}{}
 		for _, v := range *r {
 			id, _ := v["id"].(int64)
 			audit_status, _ := v["audit_status"].(int64)
 			auth_status, _ := v["auth_status"].(int64)
 			ent_name, _ := v["name"].(string)
 			// phone, _ := v["phone"].(string)
-			if audit_status == 1 {
+			if audit_status == 1 { //根据统一社会信用代码查看该企业正在审核中
 				return entity.ErrorCode, EXAMINEINGMSG, entity.ErrorCode, 0
 			}
-			if auth_status == 1 { //已认证
-				list := entity.Mysql.SelectBySql(`select * from entniche_user where ent_id =? and phone =?`, id, entinfo.Phone)
-				if len(*list) <= 0 {
-					return entity.ErrorCode, APPROVEDMSG, entity.ErrorCode, 0
+			if auth_status == 1 {
+				sameCode[id] = map[string]interface{}{
+					"name":        ent_name,
+					"authStatus":  auth_status,
+					"auditStatus": audit_status,
 				}
-				//
-				if ent_name != entinfo.Name { //企业名称不同、统一社会信用代码相同
-					return entity.ErrorCode, APPROVEDMSG, entity.ErrorCode, 0
+			}
+		}
+		if len(sameCode) > 0 {
+			entids := ""
+			i := 0
+			for k, _ := range sameCode {
+				//判断企业是否已认证
+				entids += fmt.Sprint(k)
+				if i != len(sameCode)-1 {
+					entids += ","
 				}
+				i++
 			}
-			entinfo.Id = int(id)
-			// entinfo.Phone = phone //更换注册人手机号为管理员手机号
+			//查看该用户是否在已认证的企业机构下,如果在机构下则可以重新发起认证(编辑)如果不在则提示已被认证
+			list := entity.Mysql.SelectBySql(`
+						SELECT a.ent_id,b.name FROM entniche_user a inner join  entniche_info b  
+						on a.ent_id = b.id WHERE  a.ent_id IN(?) AND a.phone = ?`, entids, entinfo.Phone)
+			if len(*list) <= 0 {
+				return entity.ErrorCode, APPROVEDMSG, entity.ErrorCode, 0
+			}
+			log.Println(fmt.Printf("查询到该统一社会信用代码存在%v个认证企业中,默认获取第一个企业进行认证,该企业企业id为%v", len(*list), (*list)[0]["ent_id"]))
+			entinfo.Id = common.IntAll((*list)[0]["ent_id"])
 			if entinfo.Update() {
 				return entity.SuccessCode, OKMSG, 1, int64(entinfo.Id)
 			}
@@ -99,7 +118,7 @@ func (this *EntService) CreateEnt(data *userCenter.EntAuthReq) (int64, string, i
 					return entity.SuccessCode, OKMSG, 1, entid
 				}
 			}
-			if audit_status == 1 {
+			if audit_status == 1 { //审核中
 				return entity.ErrorCode, EXAMINEINGMSG, entity.ErrorCode, 0
 			}
 			if auth_status == 1 { //已认证
@@ -295,3 +314,12 @@ func (this *EntService) ExamineInfo(data *userCenter.CheckExamineReq) (int64, st
 	}
 	return 0, "", entInfoData
 }
+
+func (this *EntService) GetStatusByCode(data *userCenter.GetStatusByCodeReq) (int, bool, string) {
+	info := &entity.GetStatusByCodeStruct{
+		Mysql: entity.Mysql,
+		Code:  data.Code,
+		Phone: data.Phone,
+	}
+	return info.GetStatusByCode()
+}