From 90ebefc0ce4306bdc96f34ea9503ca986a59bbe7 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 31 一月 2024 14:12:00 +0800 Subject: [PATCH] 客户列表grpc接口 --- proto/crm_aps/server.go | 29 +++ api/v1/client.go | 6 proto/crm_aps.proto | 19 ++ proto/crm_aps/crm_aps_grpc.pb.go | 64 +++++++- proto/crm_aps/crm_aps.pb.go | 320 ++++++++++++++++++++++++++++++++++----- 5 files changed, 385 insertions(+), 53 deletions(-) diff --git a/api/v1/client.go b/api/v1/client.go index ff33fad..6caa2bf 100644 --- a/api/v1/client.go +++ b/api/v1/client.go @@ -193,8 +193,10 @@ // @Tags Client // @Summary 瀹㈡埛鍒楄〃 // @Produce application/json -// @Param object body request.GetClientList true "鍙傛暟" -// @Success 200 {object} contextx.Response{data=response.ClientResponse} +// +// @Param object body request.GetClientList true "鍙傛暟" +// @Success 200 {object} contextx.Response{data=response.ClientResponse} +// // @Router /api/client/list [post] func (cli *ClientApi) List(c *gin.Context) { var params request.GetClientList diff --git a/proto/crm_aps.proto b/proto/crm_aps.proto index f740c1c..dd37019 100644 --- a/proto/crm_aps.proto +++ b/proto/crm_aps.proto @@ -7,6 +7,7 @@ rpc SendSalesDetailsToApsProject(SendSalesDetailsToApsProjectRequest) returns(SendSalesDetailsToApsProjectResponse) {} rpc GetCrmSalesDetailsList(GetCrmSalesDetailsListRequest) returns(GetCrmSalesDetailsListResponse) {} rpc SendSalesDetailsAndProjectToCrm(SendSalesDetailsAndProjectToCrmRequest) returns(SendSalesDetailsAndProjectToCrmResponse) {} + rpc GetClientList(GetClientListRequest) returns(GetClientListResponse) {} } //-----------------------------------------------------GetApsProjectList-------------------------------------- @@ -80,4 +81,22 @@ } +//------------------------------------------------------------GetClientList----------------------------------- + +message GetClientListRequest{ + int64 page = 1; + int64 page_size = 2; + string keyword = 3; +} + +message GetClientListResponse{ + int64 total = 1; + repeated Client list = 2; +} + +message Client { + string number = 1; + string name = 2; +} + diff --git a/proto/crm_aps/crm_aps.pb.go b/proto/crm_aps/crm_aps.pb.go index dd584ea..9d3dbc9 100644 --- a/proto/crm_aps/crm_aps.pb.go +++ b/proto/crm_aps/crm_aps.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.26.0 -// protoc v4.24.0 +// protoc-gen-go v1.31.0 +// protoc v3.19.0 // source: crm_aps.proto package crm_aps @@ -678,6 +678,179 @@ return file_crm_aps_proto_rawDescGZIP(), []int{10} } +type GetClientListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Page int64 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + PageSize int64 `protobuf:"varint,2,opt,name=page_size,json=pageSize,proto3" json:"page_size,omitempty"` + Keyword string `protobuf:"bytes,3,opt,name=keyword,proto3" json:"keyword,omitempty"` +} + +func (x *GetClientListRequest) Reset() { + *x = GetClientListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetClientListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetClientListRequest) ProtoMessage() {} + +func (x *GetClientListRequest) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[11] + 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 GetClientListRequest.ProtoReflect.Descriptor instead. +func (*GetClientListRequest) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{11} +} + +func (x *GetClientListRequest) GetPage() int64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetClientListRequest) GetPageSize() int64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetClientListRequest) GetKeyword() string { + if x != nil { + return x.Keyword + } + return "" +} + +type GetClientListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Total int64 `protobuf:"varint,1,opt,name=total,proto3" json:"total,omitempty"` + List []*Client `protobuf:"bytes,2,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *GetClientListResponse) Reset() { + *x = GetClientListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetClientListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetClientListResponse) ProtoMessage() {} + +func (x *GetClientListResponse) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[12] + 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 GetClientListResponse.ProtoReflect.Descriptor instead. +func (*GetClientListResponse) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{12} +} + +func (x *GetClientListResponse) GetTotal() int64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *GetClientListResponse) GetList() []*Client { + if x != nil { + return x.List + } + return nil +} + +type Client struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *Client) Reset() { + *x = Client{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Client) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Client) ProtoMessage() {} + +func (x *Client) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[13] + 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 Client.ProtoReflect.Descriptor instead. +func (*Client) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{13} +} + +func (x *Client) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +func (x *Client) GetName() string { + if x != nil { + return x.Name + } + return "" +} + var File_crm_aps_proto protoreflect.FileDescriptor var file_crm_aps_proto_rawDesc = []byte{ @@ -760,35 +933,54 @@ 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x49, 0x64, 0x22, 0x29, 0x0a, 0x27, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x54, 0x6f, 0x43, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xa8, 0x03, - 0x0a, 0x14, 0x43, 0x72, 0x6d, 0x41, 0x6e, 0x64, 0x41, 0x70, 0x73, 0x47, 0x72, 0x70, 0x63, 0x53, - 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x41, 0x70, 0x73, - 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x19, 0x2e, 0x47, 0x65, + 0x54, 0x6f, 0x43, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x61, 0x0a, + 0x14, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x70, 0x61, 0x67, + 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x70, 0x61, + 0x67, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6b, 0x65, 0x79, 0x77, 0x6f, 0x72, 0x64, + 0x22, 0x4a, 0x0a, 0x15, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, + 0x1b, 0x0a, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x34, 0x0a, 0x06, + 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x32, 0xea, 0x03, 0x0a, 0x14, 0x43, 0x72, 0x6d, 0x41, 0x6e, 0x64, 0x41, 0x70, 0x73, + 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x11, 0x47, + 0x65, 0x74, 0x41, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, + 0x12, 0x19, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, + 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x47, 0x65, 0x74, 0x41, 0x70, 0x73, 0x50, - 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x1c, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, - 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x54, 0x6f, 0x41, 0x70, 0x73, 0x50, 0x72, 0x6f, - 0x6a, 0x65, 0x63, 0x74, 0x12, 0x24, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x54, 0x6f, 0x41, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, - 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x25, 0x2e, 0x53, 0x65, 0x6e, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x1c, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x54, 0x6f, 0x41, - 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6d, 0x53, 0x61, 0x6c, - 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x2e, - 0x47, 0x65, 0x74, 0x43, 0x72, 0x6d, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, - 0x47, 0x65, 0x74, 0x43, 0x72, 0x6d, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, - 0x6c, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, - 0x12, 0x76, 0x0a, 0x1f, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, + 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x24, 0x2e, 0x53, 0x65, 0x6e, 0x64, + 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x54, 0x6f, 0x41, 0x70, + 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x25, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, + 0x6c, 0x73, 0x54, 0x6f, 0x41, 0x70, 0x73, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, + 0x72, 0x6d, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4c, 0x69, + 0x73, 0x74, 0x12, 0x1e, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6d, 0x53, 0x61, 0x6c, 0x65, 0x73, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x72, 0x6d, 0x53, 0x61, 0x6c, 0x65, 0x73, + 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x76, 0x0a, 0x1f, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, + 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6a, + 0x65, 0x63, 0x74, 0x54, 0x6f, 0x43, 0x72, 0x6d, 0x12, 0x27, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, + 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x50, 0x72, + 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x43, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x28, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x6f, - 0x43, 0x72, 0x6d, 0x12, 0x27, 0x2e, 0x53, 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x41, 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, - 0x54, 0x6f, 0x43, 0x72, 0x6d, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x53, - 0x65, 0x6e, 0x64, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x41, - 0x6e, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x6f, 0x43, 0x72, 0x6d, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x63, 0x72, - 0x6d, 0x5f, 0x61, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x43, 0x72, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, + 0x0d, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x15, + 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x6c, 0x69, 0x65, 0x6e, + 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, + 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x63, 0x72, 0x6d, 0x5f, 0x61, 0x70, 0x73, 0x62, 0x06, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -803,7 +995,7 @@ return file_crm_aps_proto_rawDescData } -var file_crm_aps_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_crm_aps_proto_msgTypes = make([]protoimpl.MessageInfo, 14) var file_crm_aps_proto_goTypes = []interface{}{ (*GetApsProjectListRequest)(nil), // 0: GetApsProjectListRequest (*ApsProject)(nil), // 1: ApsProject @@ -816,24 +1008,30 @@ (*GetCrmSalesDetailsListResponse)(nil), // 8: GetCrmSalesDetailsListResponse (*SendSalesDetailsAndProjectToCrmRequest)(nil), // 9: SendSalesDetailsAndProjectToCrmRequest (*SendSalesDetailsAndProjectToCrmResponse)(nil), // 10: SendSalesDetailsAndProjectToCrmResponse + (*GetClientListRequest)(nil), // 11: GetClientListRequest + (*GetClientListResponse)(nil), // 12: GetClientListResponse + (*Client)(nil), // 13: Client } var file_crm_aps_proto_depIdxs = []int32{ 1, // 0: GetApsProjectListResponse.List:type_name -> ApsProject 3, // 1: SendSalesDetailsToApsProjectRequest.Products:type_name -> SalesDetailsProduct 7, // 2: GetCrmSalesDetailsListResponse.SalesDetails:type_name -> CrmSalesDetails - 0, // 3: CrmAndApsGrpcService.GetApsProjectList:input_type -> GetApsProjectListRequest - 4, // 4: CrmAndApsGrpcService.SendSalesDetailsToApsProject:input_type -> SendSalesDetailsToApsProjectRequest - 6, // 5: CrmAndApsGrpcService.GetCrmSalesDetailsList:input_type -> GetCrmSalesDetailsListRequest - 9, // 6: CrmAndApsGrpcService.SendSalesDetailsAndProjectToCrm:input_type -> SendSalesDetailsAndProjectToCrmRequest - 2, // 7: CrmAndApsGrpcService.GetApsProjectList:output_type -> GetApsProjectListResponse - 5, // 8: CrmAndApsGrpcService.SendSalesDetailsToApsProject:output_type -> SendSalesDetailsToApsProjectResponse - 8, // 9: CrmAndApsGrpcService.GetCrmSalesDetailsList:output_type -> GetCrmSalesDetailsListResponse - 10, // 10: CrmAndApsGrpcService.SendSalesDetailsAndProjectToCrm:output_type -> SendSalesDetailsAndProjectToCrmResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name + 13, // 3: GetClientListResponse.list:type_name -> Client + 0, // 4: CrmAndApsGrpcService.GetApsProjectList:input_type -> GetApsProjectListRequest + 4, // 5: CrmAndApsGrpcService.SendSalesDetailsToApsProject:input_type -> SendSalesDetailsToApsProjectRequest + 6, // 6: CrmAndApsGrpcService.GetCrmSalesDetailsList:input_type -> GetCrmSalesDetailsListRequest + 9, // 7: CrmAndApsGrpcService.SendSalesDetailsAndProjectToCrm:input_type -> SendSalesDetailsAndProjectToCrmRequest + 11, // 8: CrmAndApsGrpcService.GetClientList:input_type -> GetClientListRequest + 2, // 9: CrmAndApsGrpcService.GetApsProjectList:output_type -> GetApsProjectListResponse + 5, // 10: CrmAndApsGrpcService.SendSalesDetailsToApsProject:output_type -> SendSalesDetailsToApsProjectResponse + 8, // 11: CrmAndApsGrpcService.GetCrmSalesDetailsList:output_type -> GetCrmSalesDetailsListResponse + 10, // 12: CrmAndApsGrpcService.SendSalesDetailsAndProjectToCrm:output_type -> SendSalesDetailsAndProjectToCrmResponse + 12, // 13: CrmAndApsGrpcService.GetClientList:output_type -> GetClientListResponse + 9, // [9:14] is the sub-list for method output_type + 4, // [4:9] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_crm_aps_proto_init() } @@ -974,6 +1172,42 @@ return nil } } + file_crm_aps_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetClientListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_crm_aps_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetClientListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_crm_aps_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Client); 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{ @@ -981,7 +1215,7 @@ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_crm_aps_proto_rawDesc, NumEnums: 0, - NumMessages: 11, + NumMessages: 14, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/crm_aps/crm_aps_grpc.pb.go b/proto/crm_aps/crm_aps_grpc.pb.go index b5e0c95..6f11483 100644 --- a/proto/crm_aps/crm_aps_grpc.pb.go +++ b/proto/crm_aps/crm_aps_grpc.pb.go @@ -1,4 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v3.19.0 +// source: crm_aps.proto package crm_aps @@ -14,6 +18,14 @@ // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + CrmAndApsGrpcService_GetApsProjectList_FullMethodName = "/CrmAndApsGrpcService/GetApsProjectList" + CrmAndApsGrpcService_SendSalesDetailsToApsProject_FullMethodName = "/CrmAndApsGrpcService/SendSalesDetailsToApsProject" + CrmAndApsGrpcService_GetCrmSalesDetailsList_FullMethodName = "/CrmAndApsGrpcService/GetCrmSalesDetailsList" + CrmAndApsGrpcService_SendSalesDetailsAndProjectToCrm_FullMethodName = "/CrmAndApsGrpcService/SendSalesDetailsAndProjectToCrm" + CrmAndApsGrpcService_GetClientList_FullMethodName = "/CrmAndApsGrpcService/GetClientList" +) + // CrmAndApsGrpcServiceClient is the client API for CrmAndApsGrpcService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. @@ -22,6 +34,7 @@ SendSalesDetailsToApsProject(ctx context.Context, in *SendSalesDetailsToApsProjectRequest, opts ...grpc.CallOption) (*SendSalesDetailsToApsProjectResponse, error) GetCrmSalesDetailsList(ctx context.Context, in *GetCrmSalesDetailsListRequest, opts ...grpc.CallOption) (*GetCrmSalesDetailsListResponse, error) SendSalesDetailsAndProjectToCrm(ctx context.Context, in *SendSalesDetailsAndProjectToCrmRequest, opts ...grpc.CallOption) (*SendSalesDetailsAndProjectToCrmResponse, error) + GetClientList(ctx context.Context, in *GetClientListRequest, opts ...grpc.CallOption) (*GetClientListResponse, error) } type crmAndApsGrpcServiceClient struct { @@ -34,7 +47,7 @@ func (c *crmAndApsGrpcServiceClient) GetApsProjectList(ctx context.Context, in *GetApsProjectListRequest, opts ...grpc.CallOption) (*GetApsProjectListResponse, error) { out := new(GetApsProjectListResponse) - err := c.cc.Invoke(ctx, "/CrmAndApsGrpcService/GetApsProjectList", in, out, opts...) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_GetApsProjectList_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -43,7 +56,7 @@ func (c *crmAndApsGrpcServiceClient) SendSalesDetailsToApsProject(ctx context.Context, in *SendSalesDetailsToApsProjectRequest, opts ...grpc.CallOption) (*SendSalesDetailsToApsProjectResponse, error) { out := new(SendSalesDetailsToApsProjectResponse) - err := c.cc.Invoke(ctx, "/CrmAndApsGrpcService/SendSalesDetailsToApsProject", in, out, opts...) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_SendSalesDetailsToApsProject_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -52,7 +65,7 @@ func (c *crmAndApsGrpcServiceClient) GetCrmSalesDetailsList(ctx context.Context, in *GetCrmSalesDetailsListRequest, opts ...grpc.CallOption) (*GetCrmSalesDetailsListResponse, error) { out := new(GetCrmSalesDetailsListResponse) - err := c.cc.Invoke(ctx, "/CrmAndApsGrpcService/GetCrmSalesDetailsList", in, out, opts...) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_GetCrmSalesDetailsList_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -61,7 +74,16 @@ func (c *crmAndApsGrpcServiceClient) SendSalesDetailsAndProjectToCrm(ctx context.Context, in *SendSalesDetailsAndProjectToCrmRequest, opts ...grpc.CallOption) (*SendSalesDetailsAndProjectToCrmResponse, error) { out := new(SendSalesDetailsAndProjectToCrmResponse) - err := c.cc.Invoke(ctx, "/CrmAndApsGrpcService/SendSalesDetailsAndProjectToCrm", in, out, opts...) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_SendSalesDetailsAndProjectToCrm_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *crmAndApsGrpcServiceClient) GetClientList(ctx context.Context, in *GetClientListRequest, opts ...grpc.CallOption) (*GetClientListResponse, error) { + out := new(GetClientListResponse) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_GetClientList_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -76,6 +98,7 @@ SendSalesDetailsToApsProject(context.Context, *SendSalesDetailsToApsProjectRequest) (*SendSalesDetailsToApsProjectResponse, error) GetCrmSalesDetailsList(context.Context, *GetCrmSalesDetailsListRequest) (*GetCrmSalesDetailsListResponse, error) SendSalesDetailsAndProjectToCrm(context.Context, *SendSalesDetailsAndProjectToCrmRequest) (*SendSalesDetailsAndProjectToCrmResponse, error) + GetClientList(context.Context, *GetClientListRequest) (*GetClientListResponse, error) mustEmbedUnimplementedCrmAndApsGrpcServiceServer() } @@ -94,6 +117,9 @@ } func (UnimplementedCrmAndApsGrpcServiceServer) SendSalesDetailsAndProjectToCrm(context.Context, *SendSalesDetailsAndProjectToCrmRequest) (*SendSalesDetailsAndProjectToCrmResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method SendSalesDetailsAndProjectToCrm not implemented") +} +func (UnimplementedCrmAndApsGrpcServiceServer) GetClientList(context.Context, *GetClientListRequest) (*GetClientListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetClientList not implemented") } func (UnimplementedCrmAndApsGrpcServiceServer) mustEmbedUnimplementedCrmAndApsGrpcServiceServer() {} @@ -118,7 +144,7 @@ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/CrmAndApsGrpcService/GetApsProjectList", + FullMethod: CrmAndApsGrpcService_GetApsProjectList_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CrmAndApsGrpcServiceServer).GetApsProjectList(ctx, req.(*GetApsProjectListRequest)) @@ -136,7 +162,7 @@ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/CrmAndApsGrpcService/SendSalesDetailsToApsProject", + FullMethod: CrmAndApsGrpcService_SendSalesDetailsToApsProject_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CrmAndApsGrpcServiceServer).SendSalesDetailsToApsProject(ctx, req.(*SendSalesDetailsToApsProjectRequest)) @@ -154,7 +180,7 @@ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/CrmAndApsGrpcService/GetCrmSalesDetailsList", + FullMethod: CrmAndApsGrpcService_GetCrmSalesDetailsList_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CrmAndApsGrpcServiceServer).GetCrmSalesDetailsList(ctx, req.(*GetCrmSalesDetailsListRequest)) @@ -172,10 +198,28 @@ } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/CrmAndApsGrpcService/SendSalesDetailsAndProjectToCrm", + FullMethod: CrmAndApsGrpcService_SendSalesDetailsAndProjectToCrm_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CrmAndApsGrpcServiceServer).SendSalesDetailsAndProjectToCrm(ctx, req.(*SendSalesDetailsAndProjectToCrmRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CrmAndApsGrpcService_GetClientList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetClientListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CrmAndApsGrpcServiceServer).GetClientList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CrmAndApsGrpcService_GetClientList_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CrmAndApsGrpcServiceServer).GetClientList(ctx, req.(*GetClientListRequest)) } return interceptor(ctx, in, info, handler) } @@ -203,6 +247,10 @@ MethodName: "SendSalesDetailsAndProjectToCrm", Handler: _CrmAndApsGrpcService_SendSalesDetailsAndProjectToCrm_Handler, }, + { + MethodName: "GetClientList", + Handler: _CrmAndApsGrpcService_GetClientList_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "crm_aps.proto", diff --git a/proto/crm_aps/server.go b/proto/crm_aps/server.go index b626b02..d199c7b 100644 --- a/proto/crm_aps/server.go +++ b/proto/crm_aps/server.go @@ -4,8 +4,12 @@ "aps_crm/constvar" "aps_crm/model" "aps_crm/model/grpc_init" + "aps_crm/pkg/ecode" "aps_crm/proto/product_inventory" + "aps_crm/service" "context" + "errors" + "fmt" "github.com/shopspring/decimal" ) @@ -137,3 +141,28 @@ } return new(SendSalesDetailsAndProjectToCrmResponse), nil } + +func (s *Server) GetClientList(ctx context.Context, req *GetClientListRequest) (*GetClientListResponse, error) { + if req.Page <= 0 || req.PageSize == 0 { + return nil, errors.New("鍙傛暟閿欒") + } + clientService := new(service.ClientService) + params := map[string]interface{}{} + if req.Keyword != "" { + params["name"] = req.Keyword + } + clients, total, errCode := clientService.GetClientList(int(req.Page), int(req.PageSize), params) + if errCode != ecode.OK { + return nil, errors.New(fmt.Sprintf("鍐呴儴閿欒, code:%v", errCode)) + } + resp := new(GetClientListResponse) + resp.Total = total + resp.List = make([]*Client, 0, len(clients)) + for _, client := range clients { + resp.List = append(resp.List, &Client{ + Number: client.Number, + Name: client.Name, + }) + } + return resp, nil +} -- Gitblit v1.8.0