From bc244ad2ce2cdab4934742506334d38b14de1eea Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期一, 05 二月 2024 17:18:25 +0800 Subject: [PATCH] 增加更改和删除销售明细grpc接口 --- proto/crm_aps/server.go | 45 +++++ constvar/salesDetails.go | 4 proto/crm_aps.proto | 14 + proto/crm_aps/crm_aps_grpc.pb.go | 74 +++++++++ proto/crm_aps/crm_aps.pb.go | 337 +++++++++++++++++++++++++++++++++++++----- 5 files changed, 433 insertions(+), 41 deletions(-) diff --git a/constvar/salesDetails.go b/constvar/salesDetails.go index b36d534..85902ec 100644 --- a/constvar/salesDetails.go +++ b/constvar/salesDetails.go @@ -18,3 +18,7 @@ OverOutbound //鍑哄簱瀹屾垚 OverCLose //宸插叧闂� ) + +func (s SalesDetailsStatus) Valid() bool { + return s == WaitConfirmed || s == WaitOutbound || s == OverOutbound || s == OverCLose +} diff --git a/proto/crm_aps.proto b/proto/crm_aps.proto index dd37019..1676907 100644 --- a/proto/crm_aps.proto +++ b/proto/crm_aps.proto @@ -8,6 +8,8 @@ rpc GetCrmSalesDetailsList(GetCrmSalesDetailsListRequest) returns(GetCrmSalesDetailsListResponse) {} rpc SendSalesDetailsAndProjectToCrm(SendSalesDetailsAndProjectToCrmRequest) returns(SendSalesDetailsAndProjectToCrmResponse) {} rpc GetClientList(GetClientListRequest) returns(GetClientListResponse) {} + rpc UpdateSalesDetail(UpdateSalesDetailRequest) returns(UpdateSalesDetailResponse) {} + rpc RemoveSalesDetail(RemoveSalesDetailRequest) returns(RemoveSalesDetailRequest) {} } //-----------------------------------------------------GetApsProjectList-------------------------------------- @@ -100,3 +102,15 @@ } +message UpdateSalesDetailRequest { + string number = 1;//閿�鍞槑缁嗗崟鍙� + int32 status = 2;//鐘舵�� +} + +message UpdateSalesDetailResponse {} + +message RemoveSalesDetailRequest { + string number = 1;//閿�鍞槑缁嗗崟鍙� +} + +message RemoveSalesDetailResponse {} \ No newline at end of file diff --git a/proto/crm_aps/crm_aps.pb.go b/proto/crm_aps/crm_aps.pb.go index 9d3dbc9..dec896d 100644 --- a/proto/crm_aps/crm_aps.pb.go +++ b/proto/crm_aps/crm_aps.pb.go @@ -851,6 +851,184 @@ return "" } +type UpdateSalesDetailRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` //閿�鍞槑缁嗗崟鍙� + Status int32 `protobuf:"varint,2,opt,name=status,proto3" json:"status,omitempty"` //鐘舵�� +} + +func (x *UpdateSalesDetailRequest) Reset() { + *x = UpdateSalesDetailRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSalesDetailRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSalesDetailRequest) ProtoMessage() {} + +func (x *UpdateSalesDetailRequest) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[14] + 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 UpdateSalesDetailRequest.ProtoReflect.Descriptor instead. +func (*UpdateSalesDetailRequest) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{14} +} + +func (x *UpdateSalesDetailRequest) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +func (x *UpdateSalesDetailRequest) GetStatus() int32 { + if x != nil { + return x.Status + } + return 0 +} + +type UpdateSalesDetailResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateSalesDetailResponse) Reset() { + *x = UpdateSalesDetailResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateSalesDetailResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSalesDetailResponse) ProtoMessage() {} + +func (x *UpdateSalesDetailResponse) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[15] + 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 UpdateSalesDetailResponse.ProtoReflect.Descriptor instead. +func (*UpdateSalesDetailResponse) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{15} +} + +type RemoveSalesDetailRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number string `protobuf:"bytes,1,opt,name=number,proto3" json:"number,omitempty"` //閿�鍞槑缁嗗崟鍙� +} + +func (x *RemoveSalesDetailRequest) Reset() { + *x = RemoveSalesDetailRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveSalesDetailRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveSalesDetailRequest) ProtoMessage() {} + +func (x *RemoveSalesDetailRequest) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[16] + 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 RemoveSalesDetailRequest.ProtoReflect.Descriptor instead. +func (*RemoveSalesDetailRequest) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{16} +} + +func (x *RemoveSalesDetailRequest) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +type RemoveSalesDetailResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *RemoveSalesDetailResponse) Reset() { + *x = RemoveSalesDetailResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_crm_aps_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *RemoveSalesDetailResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*RemoveSalesDetailResponse) ProtoMessage() {} + +func (x *RemoveSalesDetailResponse) ProtoReflect() protoreflect.Message { + mi := &file_crm_aps_proto_msgTypes[17] + 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 RemoveSalesDetailResponse.ProtoReflect.Descriptor instead. +func (*RemoveSalesDetailResponse) Descriptor() ([]byte, []int) { + return file_crm_aps_proto_rawDescGZIP(), []int{17} +} + var File_crm_aps_proto protoreflect.FileDescriptor var file_crm_aps_proto_rawDesc = []byte{ @@ -948,39 +1126,60 @@ 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, 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, + 0x6d, 0x65, 0x22, 0x4a, 0x0a, 0x18, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, + 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 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, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x1b, + 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x0a, 0x18, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 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, 0x22, + 0x1b, 0x0a, 0x19, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, + 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x85, 0x05, 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, 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, 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, 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, + 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, 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, 0x12, 0x4c, 0x0a, 0x11, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x19, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4b, 0x0a, 0x11, 0x52, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x12, 0x19, 0x2e, 0x52, + 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, + 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x22, 0x00, 0x42, 0x0b, 0x5a, 0x09, 0x2e, 0x2f, 0x63, 0x72, 0x6d, 0x5f, 0x61, 0x70, + 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -995,7 +1194,7 @@ return file_crm_aps_proto_rawDescData } -var file_crm_aps_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_crm_aps_proto_msgTypes = make([]protoimpl.MessageInfo, 18) var file_crm_aps_proto_goTypes = []interface{}{ (*GetApsProjectListRequest)(nil), // 0: GetApsProjectListRequest (*ApsProject)(nil), // 1: ApsProject @@ -1011,6 +1210,10 @@ (*GetClientListRequest)(nil), // 11: GetClientListRequest (*GetClientListResponse)(nil), // 12: GetClientListResponse (*Client)(nil), // 13: Client + (*UpdateSalesDetailRequest)(nil), // 14: UpdateSalesDetailRequest + (*UpdateSalesDetailResponse)(nil), // 15: UpdateSalesDetailResponse + (*RemoveSalesDetailRequest)(nil), // 16: RemoveSalesDetailRequest + (*RemoveSalesDetailResponse)(nil), // 17: RemoveSalesDetailResponse } var file_crm_aps_proto_depIdxs = []int32{ 1, // 0: GetApsProjectListResponse.List:type_name -> ApsProject @@ -1022,13 +1225,17 @@ 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 + 14, // 9: CrmAndApsGrpcService.UpdateSalesDetail:input_type -> UpdateSalesDetailRequest + 16, // 10: CrmAndApsGrpcService.RemoveSalesDetail:input_type -> RemoveSalesDetailRequest + 2, // 11: CrmAndApsGrpcService.GetApsProjectList:output_type -> GetApsProjectListResponse + 5, // 12: CrmAndApsGrpcService.SendSalesDetailsToApsProject:output_type -> SendSalesDetailsToApsProjectResponse + 8, // 13: CrmAndApsGrpcService.GetCrmSalesDetailsList:output_type -> GetCrmSalesDetailsListResponse + 10, // 14: CrmAndApsGrpcService.SendSalesDetailsAndProjectToCrm:output_type -> SendSalesDetailsAndProjectToCrmResponse + 12, // 15: CrmAndApsGrpcService.GetClientList:output_type -> GetClientListResponse + 15, // 16: CrmAndApsGrpcService.UpdateSalesDetail:output_type -> UpdateSalesDetailResponse + 16, // 17: CrmAndApsGrpcService.RemoveSalesDetail:output_type -> RemoveSalesDetailRequest + 11, // [11:18] is the sub-list for method output_type + 4, // [4:11] 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 @@ -1208,6 +1415,54 @@ return nil } } + file_crm_aps_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSalesDetailRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_crm_aps_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateSalesDetailResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_crm_aps_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveSalesDetailRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_crm_aps_proto_msgTypes[17].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*RemoveSalesDetailResponse); 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{ @@ -1215,7 +1470,7 @@ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_crm_aps_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 18, 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 6f11483..718cf76 100644 --- a/proto/crm_aps/crm_aps_grpc.pb.go +++ b/proto/crm_aps/crm_aps_grpc.pb.go @@ -24,6 +24,8 @@ CrmAndApsGrpcService_GetCrmSalesDetailsList_FullMethodName = "/CrmAndApsGrpcService/GetCrmSalesDetailsList" CrmAndApsGrpcService_SendSalesDetailsAndProjectToCrm_FullMethodName = "/CrmAndApsGrpcService/SendSalesDetailsAndProjectToCrm" CrmAndApsGrpcService_GetClientList_FullMethodName = "/CrmAndApsGrpcService/GetClientList" + CrmAndApsGrpcService_UpdateSalesDetail_FullMethodName = "/CrmAndApsGrpcService/UpdateSalesDetail" + CrmAndApsGrpcService_RemoveSalesDetail_FullMethodName = "/CrmAndApsGrpcService/RemoveSalesDetail" ) // CrmAndApsGrpcServiceClient is the client API for CrmAndApsGrpcService service. @@ -35,6 +37,8 @@ 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) + UpdateSalesDetail(ctx context.Context, in *UpdateSalesDetailRequest, opts ...grpc.CallOption) (*UpdateSalesDetailResponse, error) + RemoveSalesDetail(ctx context.Context, in *RemoveSalesDetailRequest, opts ...grpc.CallOption) (*RemoveSalesDetailRequest, error) } type crmAndApsGrpcServiceClient struct { @@ -90,6 +94,24 @@ return out, nil } +func (c *crmAndApsGrpcServiceClient) UpdateSalesDetail(ctx context.Context, in *UpdateSalesDetailRequest, opts ...grpc.CallOption) (*UpdateSalesDetailResponse, error) { + out := new(UpdateSalesDetailResponse) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_UpdateSalesDetail_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *crmAndApsGrpcServiceClient) RemoveSalesDetail(ctx context.Context, in *RemoveSalesDetailRequest, opts ...grpc.CallOption) (*RemoveSalesDetailRequest, error) { + out := new(RemoveSalesDetailRequest) + err := c.cc.Invoke(ctx, CrmAndApsGrpcService_RemoveSalesDetail_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // CrmAndApsGrpcServiceServer is the server API for CrmAndApsGrpcService service. // All implementations must embed UnimplementedCrmAndApsGrpcServiceServer // for forward compatibility @@ -99,6 +121,8 @@ GetCrmSalesDetailsList(context.Context, *GetCrmSalesDetailsListRequest) (*GetCrmSalesDetailsListResponse, error) SendSalesDetailsAndProjectToCrm(context.Context, *SendSalesDetailsAndProjectToCrmRequest) (*SendSalesDetailsAndProjectToCrmResponse, error) GetClientList(context.Context, *GetClientListRequest) (*GetClientListResponse, error) + UpdateSalesDetail(context.Context, *UpdateSalesDetailRequest) (*UpdateSalesDetailResponse, error) + RemoveSalesDetail(context.Context, *RemoveSalesDetailRequest) (*RemoveSalesDetailRequest, error) mustEmbedUnimplementedCrmAndApsGrpcServiceServer() } @@ -120,6 +144,12 @@ } func (UnimplementedCrmAndApsGrpcServiceServer) GetClientList(context.Context, *GetClientListRequest) (*GetClientListResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetClientList not implemented") +} +func (UnimplementedCrmAndApsGrpcServiceServer) UpdateSalesDetail(context.Context, *UpdateSalesDetailRequest) (*UpdateSalesDetailResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSalesDetail not implemented") +} +func (UnimplementedCrmAndApsGrpcServiceServer) RemoveSalesDetail(context.Context, *RemoveSalesDetailRequest) (*RemoveSalesDetailRequest, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveSalesDetail not implemented") } func (UnimplementedCrmAndApsGrpcServiceServer) mustEmbedUnimplementedCrmAndApsGrpcServiceServer() {} @@ -224,6 +254,42 @@ return interceptor(ctx, in, info, handler) } +func _CrmAndApsGrpcService_UpdateSalesDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateSalesDetailRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CrmAndApsGrpcServiceServer).UpdateSalesDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CrmAndApsGrpcService_UpdateSalesDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CrmAndApsGrpcServiceServer).UpdateSalesDetail(ctx, req.(*UpdateSalesDetailRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _CrmAndApsGrpcService_RemoveSalesDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(RemoveSalesDetailRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(CrmAndApsGrpcServiceServer).RemoveSalesDetail(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: CrmAndApsGrpcService_RemoveSalesDetail_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(CrmAndApsGrpcServiceServer).RemoveSalesDetail(ctx, req.(*RemoveSalesDetailRequest)) + } + return interceptor(ctx, in, info, handler) +} + // CrmAndApsGrpcService_ServiceDesc is the grpc.ServiceDesc for CrmAndApsGrpcService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -251,6 +317,14 @@ MethodName: "GetClientList", Handler: _CrmAndApsGrpcService_GetClientList_Handler, }, + { + MethodName: "UpdateSalesDetail", + Handler: _CrmAndApsGrpcService_UpdateSalesDetail_Handler, + }, + { + MethodName: "RemoveSalesDetail", + Handler: _CrmAndApsGrpcService_RemoveSalesDetail_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "crm_aps.proto", diff --git a/proto/crm_aps/server.go b/proto/crm_aps/server.go index 9f58fac..1a45676 100644 --- a/proto/crm_aps/server.go +++ b/proto/crm_aps/server.go @@ -11,6 +11,7 @@ "errors" "fmt" "github.com/shopspring/decimal" + "gorm.io/gorm" ) type Server struct { @@ -166,3 +167,47 @@ } return resp, nil } +func (s *Server) UpdateSalesDetail(ctx context.Context, req *UpdateSalesDetailRequest) (*UpdateSalesDetailResponse, error) { + if req.Number == "" { + return nil, errors.New("閿�鍞槑缁嗙紪鍙蜂负绌�") + } + if req.Status == 0 { + return nil, errors.New("閿�鍞槑缁嗙姸鎬佷负绌�") + } + + status := constvar.SalesDetailsStatus(int(req.Status)) + if !status.Valid() { + return nil, errors.New("閿�鍞槑缁嗙姸鎬佷笉姝g‘") + } + + salesDetail, err := model.NewSalesDetailsSearch().SetNumber(req.Number).First() + if err == gorm.ErrRecordNotFound { + return nil, errors.New("閿�鍞槑缁嗕笉瀛樺湪") + } + + salesDetail.Status = status + err = model.NewSalesDetailsSearch().Update(salesDetail) + if err != nil { + return nil, errors.New("鏇存敼CRM閿�鍞槑缁嗗け璐�") + } + + return &UpdateSalesDetailResponse{}, nil +} + +func (s *Server) RemoveSalesDetail(ctx context.Context, req *RemoveSalesDetailRequest) (*RemoveSalesDetailRequest, error) { + if req.Number == "" { + return nil, errors.New("閿�鍞槑缁嗙紪鍙蜂负绌�") + } + + _, err := model.NewSalesDetailsSearch().SetNumber(req.Number).First() + if err == gorm.ErrRecordNotFound { + return nil, errors.New("閿�鍞槑缁嗕笉瀛樺湪") + } + + err = model.NewSalesDetailsSearch().SetNumber(req.Number).Delete() + if err == gorm.ErrRecordNotFound { + return nil, errors.New("閿�鍞槑缁嗗垹闄ゅけ璐�") + } + + return &RemoveSalesDetailRequest{}, nil +} -- Gitblit v1.8.0