diff --git a/api/supplier/supplier.pb.go b/api/supplier/supplier.pb.go new file mode 100644 index 0000000..2507a2f --- /dev/null +++ b/api/supplier/supplier.pb.go @@ -0,0 +1,2209 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.36.7 +// protoc v6.32.0 +// source: api/supplier/supplier.proto + +package supplier + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" + unsafe "unsafe" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type GetImportRecordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Uuid string `protobuf:"bytes,1,opt,name=uuid,proto3" json:"uuid"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetImportRecordRequest) Reset() { + *x = GetImportRecordRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetImportRecordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetImportRecordRequest) ProtoMessage() {} + +func (x *GetImportRecordRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[0] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetImportRecordRequest.ProtoReflect.Descriptor instead. +func (*GetImportRecordRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{0} +} + +func (x *GetImportRecordRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +type GetImportRecordResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + SuccessNum uint64 `protobuf:"varint,1,opt,name=successNum,proto3" json:"successNum"` + FailNum uint64 `protobuf:"varint,2,opt,name=failNum,proto3" json:"failNum"` + DeriveUrl string `protobuf:"bytes,3,opt,name=deriveUrl,proto3" json:"deriveUrl"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetImportRecordResponse) Reset() { + *x = GetImportRecordResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetImportRecordResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetImportRecordResponse) ProtoMessage() {} + +func (x *GetImportRecordResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[1] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetImportRecordResponse.ProtoReflect.Descriptor instead. +func (*GetImportRecordResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{1} +} + +func (x *GetImportRecordResponse) GetSuccessNum() uint64 { + if x != nil { + return x.SuccessNum + } + return 0 +} + +func (x *GetImportRecordResponse) GetFailNum() uint64 { + if x != nil { + return x.FailNum + } + return 0 +} + +func (x *GetImportRecordResponse) GetDeriveUrl() string { + if x != nil { + return x.DeriveUrl + } + return "" +} + +type CreateImportRecordRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + SupplierCodes []string `protobuf:"bytes,1,rep,name=supplierCodes,proto3" json:"supplierCodes"` + Status uint64 `protobuf:"varint,2,opt,name=status,proto3" json:"status"` + UserId uint64 `protobuf:"varint,3,opt,name=userId,proto3" json:"userId"` + ToLeadUrl string `protobuf:"bytes,4,opt,name=toLeadUrl,proto3" json:"toLeadUrl"` + DeriveUrl string `protobuf:"bytes,5,opt,name=deriveUrl,proto3" json:"deriveUrl"` + Uuid string `protobuf:"bytes,6,opt,name=uuid,proto3" json:"uuid"` + SuccessNum uint64 `protobuf:"varint,7,opt,name=successNum,proto3" json:"successNum"` + FailNum uint64 `protobuf:"varint,8,opt,name=failNum,proto3" json:"failNum"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateImportRecordRequest) Reset() { + *x = CreateImportRecordRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateImportRecordRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateImportRecordRequest) ProtoMessage() {} + +func (x *CreateImportRecordRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[2] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateImportRecordRequest.ProtoReflect.Descriptor instead. +func (*CreateImportRecordRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{2} +} + +func (x *CreateImportRecordRequest) GetSupplierCodes() []string { + if x != nil { + return x.SupplierCodes + } + return nil +} + +func (x *CreateImportRecordRequest) GetStatus() uint64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *CreateImportRecordRequest) GetUserId() uint64 { + if x != nil { + return x.UserId + } + return 0 +} + +func (x *CreateImportRecordRequest) GetToLeadUrl() string { + if x != nil { + return x.ToLeadUrl + } + return "" +} + +func (x *CreateImportRecordRequest) GetDeriveUrl() string { + if x != nil { + return x.DeriveUrl + } + return "" +} + +func (x *CreateImportRecordRequest) GetUuid() string { + if x != nil { + return x.Uuid + } + return "" +} + +func (x *CreateImportRecordRequest) GetSuccessNum() uint64 { + if x != nil { + return x.SuccessNum + } + return 0 +} + +func (x *CreateImportRecordRequest) GetFailNum() uint64 { + if x != nil { + return x.FailNum + } + return 0 +} + +type CreateImportRecordResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateImportRecordResponse) Reset() { + *x = CreateImportRecordResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateImportRecordResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateImportRecordResponse) ProtoMessage() {} + +func (x *CreateImportRecordResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[3] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateImportRecordResponse.ProtoReflect.Descriptor instead. +func (*CreateImportRecordResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{3} +} + +func (x *CreateImportRecordResponse) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type GetCountryRegionListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Data []*CountryRegion `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` + Page uint64 `protobuf:"varint,2,opt,name=page,proto3" json:"page"` + PageSize uint64 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize"` + Total uint64 `protobuf:"varint,4,opt,name=total,proto3" json:"total"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCountryRegionListResponse) Reset() { + *x = GetCountryRegionListResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCountryRegionListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCountryRegionListResponse) ProtoMessage() {} + +func (x *GetCountryRegionListResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[4] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCountryRegionListResponse.ProtoReflect.Descriptor instead. +func (*GetCountryRegionListResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{4} +} + +func (x *GetCountryRegionListResponse) GetData() []*CountryRegion { + if x != nil { + return x.Data + } + return nil +} + +func (x *GetCountryRegionListResponse) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetCountryRegionListResponse) GetPageSize() uint64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetCountryRegionListResponse) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +type CountryRegion struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + NameEN string `protobuf:"bytes,2,opt,name=nameEN,proto3" json:"nameEN"` + NameCN string `protobuf:"bytes,3,opt,name=nameCN,proto3" json:"nameCN"` + Code string `protobuf:"bytes,4,opt,name=code,proto3" json:"code"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CountryRegion) Reset() { + *x = CountryRegion{} + mi := &file_api_supplier_supplier_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CountryRegion) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CountryRegion) ProtoMessage() {} + +func (x *CountryRegion) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[5] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CountryRegion.ProtoReflect.Descriptor instead. +func (*CountryRegion) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{5} +} + +func (x *CountryRegion) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CountryRegion) GetNameEN() string { + if x != nil { + return x.NameEN + } + return "" +} + +func (x *CountryRegion) GetNameCN() string { + if x != nil { + return x.NameCN + } + return "" +} + +func (x *CountryRegion) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type GetCountryRegionInfoRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + ZhAndCode string `protobuf:"bytes,1,opt,name=zhAndCode,proto3" json:"zhAndCode"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCountryRegionInfoRequest) Reset() { + *x = GetCountryRegionInfoRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCountryRegionInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCountryRegionInfoRequest) ProtoMessage() {} + +func (x *GetCountryRegionInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCountryRegionInfoRequest.ProtoReflect.Descriptor instead. +func (*GetCountryRegionInfoRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{6} +} + +func (x *GetCountryRegionInfoRequest) GetZhAndCode() string { + if x != nil { + return x.ZhAndCode + } + return "" +} + +type GetCountryRegionListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Page uint64 `protobuf:"varint,1,opt,name=page,proto3" json:"page"` + PageSize uint64 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"` + NameEN string `protobuf:"bytes,3,opt,name=nameEN,proto3" json:"nameEN"` + NameCN string `protobuf:"bytes,4,opt,name=nameCN,proto3" json:"nameCN"` + Code string `protobuf:"bytes,5,opt,name=code,proto3" json:"code"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetCountryRegionListRequest) Reset() { + *x = GetCountryRegionListRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetCountryRegionListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetCountryRegionListRequest) ProtoMessage() {} + +func (x *GetCountryRegionListRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[7] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetCountryRegionListRequest.ProtoReflect.Descriptor instead. +func (*GetCountryRegionListRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{7} +} + +func (x *GetCountryRegionListRequest) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetCountryRegionListRequest) GetPageSize() uint64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetCountryRegionListRequest) GetNameEN() string { + if x != nil { + return x.NameEN + } + return "" +} + +func (x *GetCountryRegionListRequest) GetNameCN() string { + if x != nil { + return x.NameCN + } + return "" +} + +func (x *GetCountryRegionListRequest) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +type OrganizeDictionary struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *OrganizeDictionary) Reset() { + *x = OrganizeDictionary{} + mi := &file_api_supplier_supplier_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *OrganizeDictionary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OrganizeDictionary) ProtoMessage() {} + +func (x *OrganizeDictionary) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[8] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use OrganizeDictionary.ProtoReflect.Descriptor instead. +func (*OrganizeDictionary) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{8} +} + +func (x *OrganizeDictionary) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *OrganizeDictionary) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetOrganizeDictionaryListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Data []*OrganizeDictionary `protobuf:"bytes,1,rep,name=data,proto3" json:"data"` + Page uint64 `protobuf:"varint,2,opt,name=page,proto3" json:"page"` + PageSize uint64 `protobuf:"varint,3,opt,name=pageSize,proto3" json:"pageSize"` + Total uint64 `protobuf:"varint,4,opt,name=total,proto3" json:"total"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetOrganizeDictionaryListResponse) Reset() { + *x = GetOrganizeDictionaryListResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetOrganizeDictionaryListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizeDictionaryListResponse) ProtoMessage() {} + +func (x *GetOrganizeDictionaryListResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[9] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizeDictionaryListResponse.ProtoReflect.Descriptor instead. +func (*GetOrganizeDictionaryListResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{9} +} + +func (x *GetOrganizeDictionaryListResponse) GetData() []*OrganizeDictionary { + if x != nil { + return x.Data + } + return nil +} + +func (x *GetOrganizeDictionaryListResponse) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetOrganizeDictionaryListResponse) GetPageSize() uint64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetOrganizeDictionaryListResponse) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +type CreateOrganizeDictionaryRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateOrganizeDictionaryRequest) Reset() { + *x = CreateOrganizeDictionaryRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateOrganizeDictionaryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOrganizeDictionaryRequest) ProtoMessage() {} + +func (x *CreateOrganizeDictionaryRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[10] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateOrganizeDictionaryRequest.ProtoReflect.Descriptor instead. +func (*CreateOrganizeDictionaryRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{10} +} + +func (x *CreateOrganizeDictionaryRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CreateOrganizeDictionaryResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateOrganizeDictionaryResponse) Reset() { + *x = CreateOrganizeDictionaryResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateOrganizeDictionaryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOrganizeDictionaryResponse) ProtoMessage() {} + +func (x *CreateOrganizeDictionaryResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[11] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateOrganizeDictionaryResponse.ProtoReflect.Descriptor instead. +func (*CreateOrganizeDictionaryResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{11} +} + +func (x *CreateOrganizeDictionaryResponse) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +type GetOrganizeDictionaryListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Page uint64 `protobuf:"varint,1,opt,name=page,proto3" json:"page"` + PageSize uint64 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetOrganizeDictionaryListRequest) Reset() { + *x = GetOrganizeDictionaryListRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetOrganizeDictionaryListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOrganizeDictionaryListRequest) ProtoMessage() {} + +func (x *GetOrganizeDictionaryListRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[12] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetOrganizeDictionaryListRequest.ProtoReflect.Descriptor instead. +func (*GetOrganizeDictionaryListRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{12} +} + +func (x *GetOrganizeDictionaryListRequest) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetOrganizeDictionaryListRequest) GetPageSize() uint64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetOrganizeDictionaryListRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type GetSupplierListRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Page uint64 `protobuf:"varint,1,opt,name=page,proto3" json:"page"` + PageSize uint64 `protobuf:"varint,2,opt,name=pageSize,proto3" json:"pageSize"` + OwningEntityId uint64 `protobuf:"varint,3,opt,name=owningEntityId,proto3" json:"owningEntityId"` + SupplierUniqueCode string `protobuf:"bytes,4,opt,name=supplierUniqueCode,proto3" json:"supplierUniqueCode"` + LegalName string `protobuf:"bytes,5,opt,name=legalName,proto3" json:"legalName"` + LocalName string `protobuf:"bytes,6,opt,name=localName,proto3" json:"localName"` + AbbreviationName string `protobuf:"bytes,7,opt,name=abbreviationName,proto3" json:"abbreviationName"` + CountryOrRegionId uint64 `protobuf:"varint,8,opt,name=countryOrRegionId,proto3" json:"countryOrRegionId"` + CompanyRegistrationNumber string `protobuf:"bytes,9,opt,name=companyRegistrationNumber,proto3" json:"companyRegistrationNumber"` + SupplierType string `protobuf:"bytes,10,opt,name=supplierType,proto3" json:"supplierType"` + ApprovalStatus string `protobuf:"bytes,11,opt,name=approvalStatus,proto3" json:"approvalStatus"` + ApprovalDateStart string `protobuf:"bytes,12,opt,name=approvalDateStart,proto3" json:"approvalDateStart"` + ApprovalDateEnd string `protobuf:"bytes,13,opt,name=approvalDateEnd,proto3" json:"approvalDateEnd"` + LastReviewDateStart string `protobuf:"bytes,14,opt,name=lastReviewDateStart,proto3" json:"lastReviewDateStart"` + LastReviewDateEnd string `protobuf:"bytes,15,opt,name=lastReviewDateEnd,proto3" json:"lastReviewDateEnd"` + LegalEntityType string `protobuf:"bytes,16,opt,name=legalEntityType,proto3" json:"legalEntityType"` + SanctionsCountryScreeningResult string `protobuf:"bytes,17,opt,name=sanctionsCountryScreeningResult,proto3" json:"sanctionsCountryScreeningResult"` + KeyFinancial string `protobuf:"bytes,18,opt,name=keyFinancial,proto3" json:"keyFinancial"` + CompanyAddress string `protobuf:"bytes,19,opt,name=companyAddress,proto3" json:"companyAddress"` + PrimaryContact string `protobuf:"bytes,20,opt,name=primaryContact,proto3" json:"primaryContact"` + DataOwnerDepartment string `protobuf:"bytes,21,opt,name=dataOwnerDepartment,proto3" json:"dataOwnerDepartment"` + BasicCompanyInformation string `protobuf:"bytes,22,opt,name=basicCompanyInformation,proto3" json:"basicCompanyInformation"` + Status uint64 `protobuf:"varint,23,opt,name=status,proto3" json:"status"` + UpdateStart string `protobuf:"bytes,24,opt,name=updateStart,proto3" json:"updateStart"` + UpdateEnd string `protobuf:"bytes,25,opt,name=updateEnd,proto3" json:"updateEnd"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSupplierListRequest) Reset() { + *x = GetSupplierListRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSupplierListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSupplierListRequest) ProtoMessage() {} + +func (x *GetSupplierListRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[13] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSupplierListRequest.ProtoReflect.Descriptor instead. +func (*GetSupplierListRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{13} +} + +func (x *GetSupplierListRequest) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetSupplierListRequest) GetPageSize() uint64 { + if x != nil { + return x.PageSize + } + return 0 +} + +func (x *GetSupplierListRequest) GetOwningEntityId() uint64 { + if x != nil { + return x.OwningEntityId + } + return 0 +} + +func (x *GetSupplierListRequest) GetSupplierUniqueCode() string { + if x != nil { + return x.SupplierUniqueCode + } + return "" +} + +func (x *GetSupplierListRequest) GetLegalName() string { + if x != nil { + return x.LegalName + } + return "" +} + +func (x *GetSupplierListRequest) GetLocalName() string { + if x != nil { + return x.LocalName + } + return "" +} + +func (x *GetSupplierListRequest) GetAbbreviationName() string { + if x != nil { + return x.AbbreviationName + } + return "" +} + +func (x *GetSupplierListRequest) GetCountryOrRegionId() uint64 { + if x != nil { + return x.CountryOrRegionId + } + return 0 +} + +func (x *GetSupplierListRequest) GetCompanyRegistrationNumber() string { + if x != nil { + return x.CompanyRegistrationNumber + } + return "" +} + +func (x *GetSupplierListRequest) GetSupplierType() string { + if x != nil { + return x.SupplierType + } + return "" +} + +func (x *GetSupplierListRequest) GetApprovalStatus() string { + if x != nil { + return x.ApprovalStatus + } + return "" +} + +func (x *GetSupplierListRequest) GetApprovalDateStart() string { + if x != nil { + return x.ApprovalDateStart + } + return "" +} + +func (x *GetSupplierListRequest) GetApprovalDateEnd() string { + if x != nil { + return x.ApprovalDateEnd + } + return "" +} + +func (x *GetSupplierListRequest) GetLastReviewDateStart() string { + if x != nil { + return x.LastReviewDateStart + } + return "" +} + +func (x *GetSupplierListRequest) GetLastReviewDateEnd() string { + if x != nil { + return x.LastReviewDateEnd + } + return "" +} + +func (x *GetSupplierListRequest) GetLegalEntityType() string { + if x != nil { + return x.LegalEntityType + } + return "" +} + +func (x *GetSupplierListRequest) GetSanctionsCountryScreeningResult() string { + if x != nil { + return x.SanctionsCountryScreeningResult + } + return "" +} + +func (x *GetSupplierListRequest) GetKeyFinancial() string { + if x != nil { + return x.KeyFinancial + } + return "" +} + +func (x *GetSupplierListRequest) GetCompanyAddress() string { + if x != nil { + return x.CompanyAddress + } + return "" +} + +func (x *GetSupplierListRequest) GetPrimaryContact() string { + if x != nil { + return x.PrimaryContact + } + return "" +} + +func (x *GetSupplierListRequest) GetDataOwnerDepartment() string { + if x != nil { + return x.DataOwnerDepartment + } + return "" +} + +func (x *GetSupplierListRequest) GetBasicCompanyInformation() string { + if x != nil { + return x.BasicCompanyInformation + } + return "" +} + +func (x *GetSupplierListRequest) GetStatus() uint64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *GetSupplierListRequest) GetUpdateStart() string { + if x != nil { + return x.UpdateStart + } + return "" +} + +func (x *GetSupplierListRequest) GetUpdateEnd() string { + if x != nil { + return x.UpdateEnd + } + return "" +} + +type GetSupplierListResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Total uint64 `protobuf:"varint,1,opt,name=total,proto3" json:"total"` + Data []*SupplierInfo `protobuf:"bytes,2,rep,name=data,proto3" json:"data"` + Page uint64 `protobuf:"varint,3,opt,name=page,proto3" json:"page"` + PageSize uint64 `protobuf:"varint,4,opt,name=pageSize,proto3" json:"pageSize"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSupplierListResponse) Reset() { + *x = GetSupplierListResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSupplierListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSupplierListResponse) ProtoMessage() {} + +func (x *GetSupplierListResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[14] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSupplierListResponse.ProtoReflect.Descriptor instead. +func (*GetSupplierListResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{14} +} + +func (x *GetSupplierListResponse) GetTotal() uint64 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *GetSupplierListResponse) GetData() []*SupplierInfo { + if x != nil { + return x.Data + } + return nil +} + +func (x *GetSupplierListResponse) GetPage() uint64 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *GetSupplierListResponse) GetPageSize() uint64 { + if x != nil { + return x.PageSize + } + return 0 +} + +type SupplierInfo struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + OwningEntityId uint64 `protobuf:"varint,2,opt,name=owningEntityId,proto3" json:"owningEntityId"` + LegalName string `protobuf:"bytes,3,opt,name=legalName,proto3" json:"legalName"` + LocalName string `protobuf:"bytes,4,opt,name=localName,proto3" json:"localName"` + AbbreviationName string `protobuf:"bytes,5,opt,name=abbreviationName,proto3" json:"abbreviationName"` + CountryOrRegionId uint64 `protobuf:"varint,6,opt,name=countryOrRegionId,proto3" json:"countryOrRegionId"` + CompanyRegistrationNumber string `protobuf:"bytes,7,opt,name=companyRegistrationNumber,proto3" json:"companyRegistrationNumber"` + SupplierType string `protobuf:"bytes,8,opt,name=supplierType,proto3" json:"supplierType"` + ApprovalStatus string `protobuf:"bytes,9,opt,name=approvalStatus,proto3" json:"approvalStatus"` + ApprovalDate string `protobuf:"bytes,10,opt,name=approvalDate,proto3" json:"approvalDate"` + LastReviewDate string `protobuf:"bytes,11,opt,name=lastReviewDate,proto3" json:"lastReviewDate"` + LegalEntityType string `protobuf:"bytes,12,opt,name=legalEntityType,proto3" json:"legalEntityType"` + SanctionsCountryScreeningResult string `protobuf:"bytes,13,opt,name=sanctionsCountryScreeningResult,proto3" json:"sanctionsCountryScreeningResult"` + KeyFinancial string `protobuf:"bytes,14,opt,name=keyFinancial,proto3" json:"keyFinancial"` + CompanyAddress string `protobuf:"bytes,15,opt,name=companyAddress,proto3" json:"companyAddress"` + PrimaryContact string `protobuf:"bytes,16,opt,name=primaryContact,proto3" json:"primaryContact"` + DataOwnerDepartment string `protobuf:"bytes,17,opt,name=dataOwnerDepartment,proto3" json:"dataOwnerDepartment"` + BasicCompanyInformation string `protobuf:"bytes,18,opt,name=basicCompanyInformation,proto3" json:"basicCompanyInformation"` + LinkAddress string `protobuf:"bytes,19,opt,name=linkAddress,proto3" json:"linkAddress"` + SupplementaryText string `protobuf:"bytes,20,opt,name=supplementaryText,proto3" json:"supplementaryText"` + Attachments []*Attachment `protobuf:"bytes,21,rep,name=attachments,proto3" json:"attachments"` + Status uint64 `protobuf:"varint,22,opt,name=status,proto3" json:"status"` + CreatedAt string `protobuf:"bytes,23,opt,name=createdAt,proto3" json:"createdAt"` + UpdatedAt string `protobuf:"bytes,24,opt,name=updatedAt,proto3" json:"updatedAt"` + SupplierUniqueCode string `protobuf:"bytes,25,opt,name=supplierUniqueCode,proto3" json:"supplierUniqueCode"` + OwningEntityName string `protobuf:"bytes,26,opt,name=owningEntityName,proto3" json:"owningEntityName"` + CountryOrRegionCode string `protobuf:"bytes,27,opt,name=countryOrRegionCode,proto3" json:"countryOrRegionCode"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *SupplierInfo) Reset() { + *x = SupplierInfo{} + mi := &file_api_supplier_supplier_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *SupplierInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupplierInfo) ProtoMessage() {} + +func (x *SupplierInfo) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[15] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use SupplierInfo.ProtoReflect.Descriptor instead. +func (*SupplierInfo) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{15} +} + +func (x *SupplierInfo) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *SupplierInfo) GetOwningEntityId() uint64 { + if x != nil { + return x.OwningEntityId + } + return 0 +} + +func (x *SupplierInfo) GetLegalName() string { + if x != nil { + return x.LegalName + } + return "" +} + +func (x *SupplierInfo) GetLocalName() string { + if x != nil { + return x.LocalName + } + return "" +} + +func (x *SupplierInfo) GetAbbreviationName() string { + if x != nil { + return x.AbbreviationName + } + return "" +} + +func (x *SupplierInfo) GetCountryOrRegionId() uint64 { + if x != nil { + return x.CountryOrRegionId + } + return 0 +} + +func (x *SupplierInfo) GetCompanyRegistrationNumber() string { + if x != nil { + return x.CompanyRegistrationNumber + } + return "" +} + +func (x *SupplierInfo) GetSupplierType() string { + if x != nil { + return x.SupplierType + } + return "" +} + +func (x *SupplierInfo) GetApprovalStatus() string { + if x != nil { + return x.ApprovalStatus + } + return "" +} + +func (x *SupplierInfo) GetApprovalDate() string { + if x != nil { + return x.ApprovalDate + } + return "" +} + +func (x *SupplierInfo) GetLastReviewDate() string { + if x != nil { + return x.LastReviewDate + } + return "" +} + +func (x *SupplierInfo) GetLegalEntityType() string { + if x != nil { + return x.LegalEntityType + } + return "" +} + +func (x *SupplierInfo) GetSanctionsCountryScreeningResult() string { + if x != nil { + return x.SanctionsCountryScreeningResult + } + return "" +} + +func (x *SupplierInfo) GetKeyFinancial() string { + if x != nil { + return x.KeyFinancial + } + return "" +} + +func (x *SupplierInfo) GetCompanyAddress() string { + if x != nil { + return x.CompanyAddress + } + return "" +} + +func (x *SupplierInfo) GetPrimaryContact() string { + if x != nil { + return x.PrimaryContact + } + return "" +} + +func (x *SupplierInfo) GetDataOwnerDepartment() string { + if x != nil { + return x.DataOwnerDepartment + } + return "" +} + +func (x *SupplierInfo) GetBasicCompanyInformation() string { + if x != nil { + return x.BasicCompanyInformation + } + return "" +} + +func (x *SupplierInfo) GetLinkAddress() string { + if x != nil { + return x.LinkAddress + } + return "" +} + +func (x *SupplierInfo) GetSupplementaryText() string { + if x != nil { + return x.SupplementaryText + } + return "" +} + +func (x *SupplierInfo) GetAttachments() []*Attachment { + if x != nil { + return x.Attachments + } + return nil +} + +func (x *SupplierInfo) GetStatus() uint64 { + if x != nil { + return x.Status + } + return 0 +} + +func (x *SupplierInfo) GetCreatedAt() string { + if x != nil { + return x.CreatedAt + } + return "" +} + +func (x *SupplierInfo) GetUpdatedAt() string { + if x != nil { + return x.UpdatedAt + } + return "" +} + +func (x *SupplierInfo) GetSupplierUniqueCode() string { + if x != nil { + return x.SupplierUniqueCode + } + return "" +} + +func (x *SupplierInfo) GetOwningEntityName() string { + if x != nil { + return x.OwningEntityName + } + return "" +} + +func (x *SupplierInfo) GetCountryOrRegionCode() string { + if x != nil { + return x.CountryOrRegionCode + } + return "" +} + +type UpdateSupplierRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + OwningEntityId uint64 `protobuf:"varint,2,opt,name=owningEntityId,proto3" json:"owningEntityId"` + LegalName string `protobuf:"bytes,3,opt,name=legalName,proto3" json:"legalName"` + LocalName string `protobuf:"bytes,4,opt,name=localName,proto3" json:"localName"` + AbbreviationName string `protobuf:"bytes,5,opt,name=abbreviationName,proto3" json:"abbreviationName"` + CountryOrRegionId uint64 `protobuf:"varint,6,opt,name=countryOrRegionId,proto3" json:"countryOrRegionId"` + CompanyRegistrationNumber string `protobuf:"bytes,7,opt,name=companyRegistrationNumber,proto3" json:"companyRegistrationNumber"` + SupplierType string `protobuf:"bytes,8,opt,name=supplierType,proto3" json:"supplierType"` + ApprovalStatus string `protobuf:"bytes,9,opt,name=approvalStatus,proto3" json:"approvalStatus"` + ApprovalDate string `protobuf:"bytes,10,opt,name=approvalDate,proto3" json:"approvalDate"` + LastReviewDate string `protobuf:"bytes,11,opt,name=lastReviewDate,proto3" json:"lastReviewDate"` + LegalEntityType string `protobuf:"bytes,12,opt,name=legalEntityType,proto3" json:"legalEntityType"` + SanctionsCountryScreeningResult string `protobuf:"bytes,13,opt,name=sanctionsCountryScreeningResult,proto3" json:"sanctionsCountryScreeningResult"` + KeyFinancial string `protobuf:"bytes,14,opt,name=keyFinancial,proto3" json:"keyFinancial"` + CompanyAddress string `protobuf:"bytes,15,opt,name=companyAddress,proto3" json:"companyAddress"` + PrimaryContact string `protobuf:"bytes,16,opt,name=primaryContact,proto3" json:"primaryContact"` + DataOwnerDepartment string `protobuf:"bytes,17,opt,name=dataOwnerDepartment,proto3" json:"dataOwnerDepartment"` + BasicCompanyInformation string `protobuf:"bytes,18,opt,name=basicCompanyInformation,proto3" json:"basicCompanyInformation"` + LinkAddress string `protobuf:"bytes,19,opt,name=linkAddress,proto3" json:"linkAddress"` + SupplementaryText string `protobuf:"bytes,20,opt,name=supplementaryText,proto3" json:"supplementaryText"` + Attachments []*Attachment `protobuf:"bytes,21,rep,name=attachments,proto3" json:"attachments"` + Status uint64 `protobuf:"varint,22,opt,name=status,proto3" json:"status"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateSupplierRequest) Reset() { + *x = UpdateSupplierRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateSupplierRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateSupplierRequest) ProtoMessage() {} + +func (x *UpdateSupplierRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[16] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateSupplierRequest.ProtoReflect.Descriptor instead. +func (*UpdateSupplierRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{16} +} + +func (x *UpdateSupplierRequest) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *UpdateSupplierRequest) GetOwningEntityId() uint64 { + if x != nil { + return x.OwningEntityId + } + return 0 +} + +func (x *UpdateSupplierRequest) GetLegalName() string { + if x != nil { + return x.LegalName + } + return "" +} + +func (x *UpdateSupplierRequest) GetLocalName() string { + if x != nil { + return x.LocalName + } + return "" +} + +func (x *UpdateSupplierRequest) GetAbbreviationName() string { + if x != nil { + return x.AbbreviationName + } + return "" +} + +func (x *UpdateSupplierRequest) GetCountryOrRegionId() uint64 { + if x != nil { + return x.CountryOrRegionId + } + return 0 +} + +func (x *UpdateSupplierRequest) GetCompanyRegistrationNumber() string { + if x != nil { + return x.CompanyRegistrationNumber + } + return "" +} + +func (x *UpdateSupplierRequest) GetSupplierType() string { + if x != nil { + return x.SupplierType + } + return "" +} + +func (x *UpdateSupplierRequest) GetApprovalStatus() string { + if x != nil { + return x.ApprovalStatus + } + return "" +} + +func (x *UpdateSupplierRequest) GetApprovalDate() string { + if x != nil { + return x.ApprovalDate + } + return "" +} + +func (x *UpdateSupplierRequest) GetLastReviewDate() string { + if x != nil { + return x.LastReviewDate + } + return "" +} + +func (x *UpdateSupplierRequest) GetLegalEntityType() string { + if x != nil { + return x.LegalEntityType + } + return "" +} + +func (x *UpdateSupplierRequest) GetSanctionsCountryScreeningResult() string { + if x != nil { + return x.SanctionsCountryScreeningResult + } + return "" +} + +func (x *UpdateSupplierRequest) GetKeyFinancial() string { + if x != nil { + return x.KeyFinancial + } + return "" +} + +func (x *UpdateSupplierRequest) GetCompanyAddress() string { + if x != nil { + return x.CompanyAddress + } + return "" +} + +func (x *UpdateSupplierRequest) GetPrimaryContact() string { + if x != nil { + return x.PrimaryContact + } + return "" +} + +func (x *UpdateSupplierRequest) GetDataOwnerDepartment() string { + if x != nil { + return x.DataOwnerDepartment + } + return "" +} + +func (x *UpdateSupplierRequest) GetBasicCompanyInformation() string { + if x != nil { + return x.BasicCompanyInformation + } + return "" +} + +func (x *UpdateSupplierRequest) GetLinkAddress() string { + if x != nil { + return x.LinkAddress + } + return "" +} + +func (x *UpdateSupplierRequest) GetSupplementaryText() string { + if x != nil { + return x.SupplementaryText + } + return "" +} + +func (x *UpdateSupplierRequest) GetAttachments() []*Attachment { + if x != nil { + return x.Attachments + } + return nil +} + +func (x *UpdateSupplierRequest) GetStatus() uint64 { + if x != nil { + return x.Status + } + return 0 +} + +type CreateSupplierRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + OwningEntityId uint64 `protobuf:"varint,1,opt,name=owningEntityId,proto3" json:"owningEntityId"` + LegalName string `protobuf:"bytes,2,opt,name=legalName,proto3" json:"legalName"` + LocalName string `protobuf:"bytes,3,opt,name=localName,proto3" json:"localName"` + AbbreviationName string `protobuf:"bytes,4,opt,name=abbreviationName,proto3" json:"abbreviationName"` + CountryOrRegionId uint64 `protobuf:"varint,5,opt,name=countryOrRegionId,proto3" json:"countryOrRegionId"` + CompanyRegistrationNumber string `protobuf:"bytes,6,opt,name=companyRegistrationNumber,proto3" json:"companyRegistrationNumber"` + SupplierType string `protobuf:"bytes,7,opt,name=supplierType,proto3" json:"supplierType"` + ApprovalStatus string `protobuf:"bytes,8,opt,name=approvalStatus,proto3" json:"approvalStatus"` + ApprovalDate string `protobuf:"bytes,9,opt,name=approvalDate,proto3" json:"approvalDate"` + LastReviewDate string `protobuf:"bytes,10,opt,name=lastReviewDate,proto3" json:"lastReviewDate"` + LegalEntityType string `protobuf:"bytes,11,opt,name=legalEntityType,proto3" json:"legalEntityType"` + SanctionsCountryScreeningResult string `protobuf:"bytes,12,opt,name=sanctionsCountryScreeningResult,proto3" json:"sanctionsCountryScreeningResult"` + KeyFinancial string `protobuf:"bytes,13,opt,name=keyFinancial,proto3" json:"keyFinancial"` + CompanyAddress string `protobuf:"bytes,14,opt,name=companyAddress,proto3" json:"companyAddress"` + PrimaryContact string `protobuf:"bytes,15,opt,name=primaryContact,proto3" json:"primaryContact"` + DataOwnerDepartment string `protobuf:"bytes,16,opt,name=dataOwnerDepartment,proto3" json:"dataOwnerDepartment"` + BasicCompanyInformation string `protobuf:"bytes,17,opt,name=basicCompanyInformation,proto3" json:"basicCompanyInformation"` + LinkAddress string `protobuf:"bytes,18,opt,name=linkAddress,proto3" json:"linkAddress"` + SupplementaryText string `protobuf:"bytes,19,opt,name=supplementaryText,proto3" json:"supplementaryText"` + Attachments []*Attachment `protobuf:"bytes,20,rep,name=attachments,proto3" json:"attachments"` + Status uint64 `protobuf:"varint,21,opt,name=status,proto3" json:"status"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSupplierRequest) Reset() { + *x = CreateSupplierRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[17] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSupplierRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSupplierRequest) ProtoMessage() {} + +func (x *CreateSupplierRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[17] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSupplierRequest.ProtoReflect.Descriptor instead. +func (*CreateSupplierRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{17} +} + +func (x *CreateSupplierRequest) GetOwningEntityId() uint64 { + if x != nil { + return x.OwningEntityId + } + return 0 +} + +func (x *CreateSupplierRequest) GetLegalName() string { + if x != nil { + return x.LegalName + } + return "" +} + +func (x *CreateSupplierRequest) GetLocalName() string { + if x != nil { + return x.LocalName + } + return "" +} + +func (x *CreateSupplierRequest) GetAbbreviationName() string { + if x != nil { + return x.AbbreviationName + } + return "" +} + +func (x *CreateSupplierRequest) GetCountryOrRegionId() uint64 { + if x != nil { + return x.CountryOrRegionId + } + return 0 +} + +func (x *CreateSupplierRequest) GetCompanyRegistrationNumber() string { + if x != nil { + return x.CompanyRegistrationNumber + } + return "" +} + +func (x *CreateSupplierRequest) GetSupplierType() string { + if x != nil { + return x.SupplierType + } + return "" +} + +func (x *CreateSupplierRequest) GetApprovalStatus() string { + if x != nil { + return x.ApprovalStatus + } + return "" +} + +func (x *CreateSupplierRequest) GetApprovalDate() string { + if x != nil { + return x.ApprovalDate + } + return "" +} + +func (x *CreateSupplierRequest) GetLastReviewDate() string { + if x != nil { + return x.LastReviewDate + } + return "" +} + +func (x *CreateSupplierRequest) GetLegalEntityType() string { + if x != nil { + return x.LegalEntityType + } + return "" +} + +func (x *CreateSupplierRequest) GetSanctionsCountryScreeningResult() string { + if x != nil { + return x.SanctionsCountryScreeningResult + } + return "" +} + +func (x *CreateSupplierRequest) GetKeyFinancial() string { + if x != nil { + return x.KeyFinancial + } + return "" +} + +func (x *CreateSupplierRequest) GetCompanyAddress() string { + if x != nil { + return x.CompanyAddress + } + return "" +} + +func (x *CreateSupplierRequest) GetPrimaryContact() string { + if x != nil { + return x.PrimaryContact + } + return "" +} + +func (x *CreateSupplierRequest) GetDataOwnerDepartment() string { + if x != nil { + return x.DataOwnerDepartment + } + return "" +} + +func (x *CreateSupplierRequest) GetBasicCompanyInformation() string { + if x != nil { + return x.BasicCompanyInformation + } + return "" +} + +func (x *CreateSupplierRequest) GetLinkAddress() string { + if x != nil { + return x.LinkAddress + } + return "" +} + +func (x *CreateSupplierRequest) GetSupplementaryText() string { + if x != nil { + return x.SupplementaryText + } + return "" +} + +func (x *CreateSupplierRequest) GetAttachments() []*Attachment { + if x != nil { + return x.Attachments + } + return nil +} + +func (x *CreateSupplierRequest) GetStatus() uint64 { + if x != nil { + return x.Status + } + return 0 +} + +type Attachment struct { + state protoimpl.MessageState `protogen:"open.v1"` + Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *Attachment) Reset() { + *x = Attachment{} + mi := &file_api_supplier_supplier_proto_msgTypes[18] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *Attachment) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Attachment) ProtoMessage() {} + +func (x *Attachment) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[18] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Attachment.ProtoReflect.Descriptor instead. +func (*Attachment) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{18} +} + +func (x *Attachment) GetUrl() string { + if x != nil { + return x.Url + } + return "" +} + +func (x *Attachment) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *Attachment) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type CreateSupplierResponse struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + SupplierCode string `protobuf:"bytes,2,opt,name=supplierCode,proto3" json:"supplierCode"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *CreateSupplierResponse) Reset() { + *x = CreateSupplierResponse{} + mi := &file_api_supplier_supplier_proto_msgTypes[19] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *CreateSupplierResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateSupplierResponse) ProtoMessage() {} + +func (x *CreateSupplierResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[19] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateSupplierResponse.ProtoReflect.Descriptor instead. +func (*CreateSupplierResponse) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{19} +} + +func (x *CreateSupplierResponse) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *CreateSupplierResponse) GetSupplierCode() string { + if x != nil { + return x.SupplierCode + } + return "" +} + +type GetSupplierRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *GetSupplierRequest) Reset() { + *x = GetSupplierRequest{} + mi := &file_api_supplier_supplier_proto_msgTypes[20] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *GetSupplierRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSupplierRequest) ProtoMessage() {} + +func (x *GetSupplierRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_supplier_supplier_proto_msgTypes[20] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetSupplierRequest.ProtoReflect.Descriptor instead. +func (*GetSupplierRequest) Descriptor() ([]byte, []int) { + return file_api_supplier_supplier_proto_rawDescGZIP(), []int{20} +} + +func (x *GetSupplierRequest) GetId() uint64 { + if x != nil { + return x.Id + } + return 0 +} + +var File_api_supplier_supplier_proto protoreflect.FileDescriptor + +const file_api_supplier_supplier_proto_rawDesc = "" + + "\n" + + "\x1bapi/supplier/supplier.proto\x12\bsupplier\",\n" + + "\x16GetImportRecordRequest\x12\x12\n" + + "\x04uuid\x18\x01 \x01(\tR\x04uuid\"q\n" + + "\x17GetImportRecordResponse\x12\x1e\n" + + "\n" + + "successNum\x18\x01 \x01(\x04R\n" + + "successNum\x12\x18\n" + + "\afailNum\x18\x02 \x01(\x04R\afailNum\x12\x1c\n" + + "\tderiveUrl\x18\x03 \x01(\tR\tderiveUrl\"\xfb\x01\n" + + "\x19CreateImportRecordRequest\x12$\n" + + "\rsupplierCodes\x18\x01 \x03(\tR\rsupplierCodes\x12\x16\n" + + "\x06status\x18\x02 \x01(\x04R\x06status\x12\x16\n" + + "\x06userId\x18\x03 \x01(\x04R\x06userId\x12\x1c\n" + + "\ttoLeadUrl\x18\x04 \x01(\tR\ttoLeadUrl\x12\x1c\n" + + "\tderiveUrl\x18\x05 \x01(\tR\tderiveUrl\x12\x12\n" + + "\x04uuid\x18\x06 \x01(\tR\x04uuid\x12\x1e\n" + + "\n" + + "successNum\x18\a \x01(\x04R\n" + + "successNum\x12\x18\n" + + "\afailNum\x18\b \x01(\x04R\afailNum\",\n" + + "\x1aCreateImportRecordResponse\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\"\x91\x01\n" + + "\x1cGetCountryRegionListResponse\x12+\n" + + "\x04data\x18\x01 \x03(\v2\x17.supplier.CountryRegionR\x04data\x12\x12\n" + + "\x04page\x18\x02 \x01(\x04R\x04page\x12\x1a\n" + + "\bpageSize\x18\x03 \x01(\x04R\bpageSize\x12\x14\n" + + "\x05total\x18\x04 \x01(\x04R\x05total\"c\n" + + "\rCountryRegion\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12\x16\n" + + "\x06nameEN\x18\x02 \x01(\tR\x06nameEN\x12\x16\n" + + "\x06nameCN\x18\x03 \x01(\tR\x06nameCN\x12\x12\n" + + "\x04code\x18\x04 \x01(\tR\x04code\";\n" + + "\x1bGetCountryRegionInfoRequest\x12\x1c\n" + + "\tzhAndCode\x18\x01 \x01(\tR\tzhAndCode\"\x91\x01\n" + + "\x1bGetCountryRegionListRequest\x12\x12\n" + + "\x04page\x18\x01 \x01(\x04R\x04page\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x04R\bpageSize\x12\x16\n" + + "\x06nameEN\x18\x03 \x01(\tR\x06nameEN\x12\x16\n" + + "\x06nameCN\x18\x04 \x01(\tR\x06nameCN\x12\x12\n" + + "\x04code\x18\x05 \x01(\tR\x04code\"8\n" + + "\x12OrganizeDictionary\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12\x12\n" + + "\x04name\x18\x02 \x01(\tR\x04name\"\x9b\x01\n" + + "!GetOrganizeDictionaryListResponse\x120\n" + + "\x04data\x18\x01 \x03(\v2\x1c.supplier.OrganizeDictionaryR\x04data\x12\x12\n" + + "\x04page\x18\x02 \x01(\x04R\x04page\x12\x1a\n" + + "\bpageSize\x18\x03 \x01(\x04R\bpageSize\x12\x14\n" + + "\x05total\x18\x04 \x01(\x04R\x05total\"5\n" + + "\x1fCreateOrganizeDictionaryRequest\x12\x12\n" + + "\x04name\x18\x01 \x01(\tR\x04name\"2\n" + + " CreateOrganizeDictionaryResponse\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\"f\n" + + " GetOrganizeDictionaryListRequest\x12\x12\n" + + "\x04page\x18\x01 \x01(\x04R\x04page\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x04R\bpageSize\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\"\xa4\b\n" + + "\x16GetSupplierListRequest\x12\x12\n" + + "\x04page\x18\x01 \x01(\x04R\x04page\x12\x1a\n" + + "\bpageSize\x18\x02 \x01(\x04R\bpageSize\x12&\n" + + "\x0eowningEntityId\x18\x03 \x01(\x04R\x0eowningEntityId\x12.\n" + + "\x12supplierUniqueCode\x18\x04 \x01(\tR\x12supplierUniqueCode\x12\x1c\n" + + "\tlegalName\x18\x05 \x01(\tR\tlegalName\x12\x1c\n" + + "\tlocalName\x18\x06 \x01(\tR\tlocalName\x12*\n" + + "\x10abbreviationName\x18\a \x01(\tR\x10abbreviationName\x12,\n" + + "\x11countryOrRegionId\x18\b \x01(\x04R\x11countryOrRegionId\x12<\n" + + "\x19companyRegistrationNumber\x18\t \x01(\tR\x19companyRegistrationNumber\x12\"\n" + + "\fsupplierType\x18\n" + + " \x01(\tR\fsupplierType\x12&\n" + + "\x0eapprovalStatus\x18\v \x01(\tR\x0eapprovalStatus\x12,\n" + + "\x11approvalDateStart\x18\f \x01(\tR\x11approvalDateStart\x12(\n" + + "\x0fapprovalDateEnd\x18\r \x01(\tR\x0fapprovalDateEnd\x120\n" + + "\x13lastReviewDateStart\x18\x0e \x01(\tR\x13lastReviewDateStart\x12,\n" + + "\x11lastReviewDateEnd\x18\x0f \x01(\tR\x11lastReviewDateEnd\x12(\n" + + "\x0flegalEntityType\x18\x10 \x01(\tR\x0flegalEntityType\x12H\n" + + "\x1fsanctionsCountryScreeningResult\x18\x11 \x01(\tR\x1fsanctionsCountryScreeningResult\x12\"\n" + + "\fkeyFinancial\x18\x12 \x01(\tR\fkeyFinancial\x12&\n" + + "\x0ecompanyAddress\x18\x13 \x01(\tR\x0ecompanyAddress\x12&\n" + + "\x0eprimaryContact\x18\x14 \x01(\tR\x0eprimaryContact\x120\n" + + "\x13dataOwnerDepartment\x18\x15 \x01(\tR\x13dataOwnerDepartment\x128\n" + + "\x17basicCompanyInformation\x18\x16 \x01(\tR\x17basicCompanyInformation\x12\x16\n" + + "\x06status\x18\x17 \x01(\x04R\x06status\x12 \n" + + "\vupdateStart\x18\x18 \x01(\tR\vupdateStart\x12\x1c\n" + + "\tupdateEnd\x18\x19 \x01(\tR\tupdateEnd\"\x8b\x01\n" + + "\x17GetSupplierListResponse\x12\x14\n" + + "\x05total\x18\x01 \x01(\x04R\x05total\x12*\n" + + "\x04data\x18\x02 \x03(\v2\x16.supplier.SupplierInfoR\x04data\x12\x12\n" + + "\x04page\x18\x03 \x01(\x04R\x04page\x12\x1a\n" + + "\bpageSize\x18\x04 \x01(\x04R\bpageSize\"\xf0\b\n" + + "\fSupplierInfo\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12&\n" + + "\x0eowningEntityId\x18\x02 \x01(\x04R\x0eowningEntityId\x12\x1c\n" + + "\tlegalName\x18\x03 \x01(\tR\tlegalName\x12\x1c\n" + + "\tlocalName\x18\x04 \x01(\tR\tlocalName\x12*\n" + + "\x10abbreviationName\x18\x05 \x01(\tR\x10abbreviationName\x12,\n" + + "\x11countryOrRegionId\x18\x06 \x01(\x04R\x11countryOrRegionId\x12<\n" + + "\x19companyRegistrationNumber\x18\a \x01(\tR\x19companyRegistrationNumber\x12\"\n" + + "\fsupplierType\x18\b \x01(\tR\fsupplierType\x12&\n" + + "\x0eapprovalStatus\x18\t \x01(\tR\x0eapprovalStatus\x12\"\n" + + "\fapprovalDate\x18\n" + + " \x01(\tR\fapprovalDate\x12&\n" + + "\x0elastReviewDate\x18\v \x01(\tR\x0elastReviewDate\x12(\n" + + "\x0flegalEntityType\x18\f \x01(\tR\x0flegalEntityType\x12H\n" + + "\x1fsanctionsCountryScreeningResult\x18\r \x01(\tR\x1fsanctionsCountryScreeningResult\x12\"\n" + + "\fkeyFinancial\x18\x0e \x01(\tR\fkeyFinancial\x12&\n" + + "\x0ecompanyAddress\x18\x0f \x01(\tR\x0ecompanyAddress\x12&\n" + + "\x0eprimaryContact\x18\x10 \x01(\tR\x0eprimaryContact\x120\n" + + "\x13dataOwnerDepartment\x18\x11 \x01(\tR\x13dataOwnerDepartment\x128\n" + + "\x17basicCompanyInformation\x18\x12 \x01(\tR\x17basicCompanyInformation\x12 \n" + + "\vlinkAddress\x18\x13 \x01(\tR\vlinkAddress\x12,\n" + + "\x11supplementaryText\x18\x14 \x01(\tR\x11supplementaryText\x126\n" + + "\vattachments\x18\x15 \x03(\v2\x14.supplier.attachmentR\vattachments\x12\x16\n" + + "\x06status\x18\x16 \x01(\x04R\x06status\x12\x1c\n" + + "\tcreatedAt\x18\x17 \x01(\tR\tcreatedAt\x12\x1c\n" + + "\tupdatedAt\x18\x18 \x01(\tR\tupdatedAt\x12.\n" + + "\x12supplierUniqueCode\x18\x19 \x01(\tR\x12supplierUniqueCode\x12*\n" + + "\x10owningEntityName\x18\x1a \x01(\tR\x10owningEntityName\x120\n" + + "\x13countryOrRegionCode\x18\x1b \x01(\tR\x13countryOrRegionCode\"\xaf\a\n" + + "\x15UpdateSupplierRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12&\n" + + "\x0eowningEntityId\x18\x02 \x01(\x04R\x0eowningEntityId\x12\x1c\n" + + "\tlegalName\x18\x03 \x01(\tR\tlegalName\x12\x1c\n" + + "\tlocalName\x18\x04 \x01(\tR\tlocalName\x12*\n" + + "\x10abbreviationName\x18\x05 \x01(\tR\x10abbreviationName\x12,\n" + + "\x11countryOrRegionId\x18\x06 \x01(\x04R\x11countryOrRegionId\x12<\n" + + "\x19companyRegistrationNumber\x18\a \x01(\tR\x19companyRegistrationNumber\x12\"\n" + + "\fsupplierType\x18\b \x01(\tR\fsupplierType\x12&\n" + + "\x0eapprovalStatus\x18\t \x01(\tR\x0eapprovalStatus\x12\"\n" + + "\fapprovalDate\x18\n" + + " \x01(\tR\fapprovalDate\x12&\n" + + "\x0elastReviewDate\x18\v \x01(\tR\x0elastReviewDate\x12(\n" + + "\x0flegalEntityType\x18\f \x01(\tR\x0flegalEntityType\x12H\n" + + "\x1fsanctionsCountryScreeningResult\x18\r \x01(\tR\x1fsanctionsCountryScreeningResult\x12\"\n" + + "\fkeyFinancial\x18\x0e \x01(\tR\fkeyFinancial\x12&\n" + + "\x0ecompanyAddress\x18\x0f \x01(\tR\x0ecompanyAddress\x12&\n" + + "\x0eprimaryContact\x18\x10 \x01(\tR\x0eprimaryContact\x120\n" + + "\x13dataOwnerDepartment\x18\x11 \x01(\tR\x13dataOwnerDepartment\x128\n" + + "\x17basicCompanyInformation\x18\x12 \x01(\tR\x17basicCompanyInformation\x12 \n" + + "\vlinkAddress\x18\x13 \x01(\tR\vlinkAddress\x12,\n" + + "\x11supplementaryText\x18\x14 \x01(\tR\x11supplementaryText\x126\n" + + "\vattachments\x18\x15 \x03(\v2\x14.supplier.attachmentR\vattachments\x12\x16\n" + + "\x06status\x18\x16 \x01(\x04R\x06status\"\x9f\a\n" + + "\x15CreateSupplierRequest\x12&\n" + + "\x0eowningEntityId\x18\x01 \x01(\x04R\x0eowningEntityId\x12\x1c\n" + + "\tlegalName\x18\x02 \x01(\tR\tlegalName\x12\x1c\n" + + "\tlocalName\x18\x03 \x01(\tR\tlocalName\x12*\n" + + "\x10abbreviationName\x18\x04 \x01(\tR\x10abbreviationName\x12,\n" + + "\x11countryOrRegionId\x18\x05 \x01(\x04R\x11countryOrRegionId\x12<\n" + + "\x19companyRegistrationNumber\x18\x06 \x01(\tR\x19companyRegistrationNumber\x12\"\n" + + "\fsupplierType\x18\a \x01(\tR\fsupplierType\x12&\n" + + "\x0eapprovalStatus\x18\b \x01(\tR\x0eapprovalStatus\x12\"\n" + + "\fapprovalDate\x18\t \x01(\tR\fapprovalDate\x12&\n" + + "\x0elastReviewDate\x18\n" + + " \x01(\tR\x0elastReviewDate\x12(\n" + + "\x0flegalEntityType\x18\v \x01(\tR\x0flegalEntityType\x12H\n" + + "\x1fsanctionsCountryScreeningResult\x18\f \x01(\tR\x1fsanctionsCountryScreeningResult\x12\"\n" + + "\fkeyFinancial\x18\r \x01(\tR\fkeyFinancial\x12&\n" + + "\x0ecompanyAddress\x18\x0e \x01(\tR\x0ecompanyAddress\x12&\n" + + "\x0eprimaryContact\x18\x0f \x01(\tR\x0eprimaryContact\x120\n" + + "\x13dataOwnerDepartment\x18\x10 \x01(\tR\x13dataOwnerDepartment\x128\n" + + "\x17basicCompanyInformation\x18\x11 \x01(\tR\x17basicCompanyInformation\x12 \n" + + "\vlinkAddress\x18\x12 \x01(\tR\vlinkAddress\x12,\n" + + "\x11supplementaryText\x18\x13 \x01(\tR\x11supplementaryText\x126\n" + + "\vattachments\x18\x14 \x03(\v2\x14.supplier.attachmentR\vattachments\x12\x16\n" + + "\x06status\x18\x15 \x01(\x04R\x06status\"F\n" + + "\n" + + "attachment\x12\x10\n" + + "\x03url\x18\x01 \x01(\tR\x03url\x12\x12\n" + + "\x04type\x18\x02 \x01(\tR\x04type\x12\x12\n" + + "\x04name\x18\x03 \x01(\tR\x04name\"L\n" + + "\x16CreateSupplierResponse\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id\x12\"\n" + + "\fsupplierCode\x18\x02 \x01(\tR\fsupplierCode\"$\n" + + "\x12GetSupplierRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\x04R\x02id2\xbb\b\n" + + "\bSupplier\x12N\n" + + "\vGetSupplier\x12\x1c.supplier.GetSupplierRequest\x1a\x1f.supplier.UpdateSupplierRequest\"\x00\x12U\n" + + "\x0eCreateSupplier\x12\x1f.supplier.CreateSupplierRequest\x1a .supplier.CreateSupplierResponse\"\x00\x12U\n" + + "\x0eUpdateSupplier\x12\x1f.supplier.UpdateSupplierRequest\x1a .supplier.CreateSupplierResponse\"\x00\x12X\n" + + "\x0fGetSupplierList\x12 .supplier.GetSupplierListRequest\x1a!.supplier.GetSupplierListResponse\"\x00\x12s\n" + + "\x18CreateOrganizeDictionary\x12).supplier.CreateOrganizeDictionaryRequest\x1a*.supplier.CreateOrganizeDictionaryResponse\"\x00\x12v\n" + + "\x19GetOrganizeDictionaryList\x12*.supplier.GetOrganizeDictionaryListRequest\x1a+.supplier.GetOrganizeDictionaryListResponse\"\x00\x12f\n" + + "\x19GetOrganizeDictionaryInfo\x12).supplier.CreateOrganizeDictionaryRequest\x1a\x1c.supplier.OrganizeDictionary\"\x00\x12g\n" + + "\x14GetCountryRegionList\x12%.supplier.GetCountryRegionListRequest\x1a&.supplier.GetCountryRegionListResponse\"\x00\x12X\n" + + "\x14GetCountryRegionInfo\x12%.supplier.GetCountryRegionInfoRequest\x1a\x17.supplier.CountryRegion\"\x00\x12a\n" + + "\x12CreateImportRecord\x12#.supplier.CreateImportRecordRequest\x1a$.supplier.CreateImportRecordResponse\"\x00\x12\\\n" + + "\x13GetImportRecordInfo\x12 .supplier.GetImportRecordRequest\x1a!.supplier.GetImportRecordResponse\"\x00B\rZ\v./;supplierb\x06proto3" + +var ( + file_api_supplier_supplier_proto_rawDescOnce sync.Once + file_api_supplier_supplier_proto_rawDescData []byte +) + +func file_api_supplier_supplier_proto_rawDescGZIP() []byte { + file_api_supplier_supplier_proto_rawDescOnce.Do(func() { + file_api_supplier_supplier_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_api_supplier_supplier_proto_rawDesc), len(file_api_supplier_supplier_proto_rawDesc))) + }) + return file_api_supplier_supplier_proto_rawDescData +} + +var file_api_supplier_supplier_proto_msgTypes = make([]protoimpl.MessageInfo, 21) +var file_api_supplier_supplier_proto_goTypes = []any{ + (*GetImportRecordRequest)(nil), // 0: supplier.GetImportRecordRequest + (*GetImportRecordResponse)(nil), // 1: supplier.GetImportRecordResponse + (*CreateImportRecordRequest)(nil), // 2: supplier.CreateImportRecordRequest + (*CreateImportRecordResponse)(nil), // 3: supplier.CreateImportRecordResponse + (*GetCountryRegionListResponse)(nil), // 4: supplier.GetCountryRegionListResponse + (*CountryRegion)(nil), // 5: supplier.CountryRegion + (*GetCountryRegionInfoRequest)(nil), // 6: supplier.GetCountryRegionInfoRequest + (*GetCountryRegionListRequest)(nil), // 7: supplier.GetCountryRegionListRequest + (*OrganizeDictionary)(nil), // 8: supplier.OrganizeDictionary + (*GetOrganizeDictionaryListResponse)(nil), // 9: supplier.GetOrganizeDictionaryListResponse + (*CreateOrganizeDictionaryRequest)(nil), // 10: supplier.CreateOrganizeDictionaryRequest + (*CreateOrganizeDictionaryResponse)(nil), // 11: supplier.CreateOrganizeDictionaryResponse + (*GetOrganizeDictionaryListRequest)(nil), // 12: supplier.GetOrganizeDictionaryListRequest + (*GetSupplierListRequest)(nil), // 13: supplier.GetSupplierListRequest + (*GetSupplierListResponse)(nil), // 14: supplier.GetSupplierListResponse + (*SupplierInfo)(nil), // 15: supplier.SupplierInfo + (*UpdateSupplierRequest)(nil), // 16: supplier.UpdateSupplierRequest + (*CreateSupplierRequest)(nil), // 17: supplier.CreateSupplierRequest + (*Attachment)(nil), // 18: supplier.attachment + (*CreateSupplierResponse)(nil), // 19: supplier.CreateSupplierResponse + (*GetSupplierRequest)(nil), // 20: supplier.GetSupplierRequest +} +var file_api_supplier_supplier_proto_depIdxs = []int32{ + 5, // 0: supplier.GetCountryRegionListResponse.data:type_name -> supplier.CountryRegion + 8, // 1: supplier.GetOrganizeDictionaryListResponse.data:type_name -> supplier.OrganizeDictionary + 15, // 2: supplier.GetSupplierListResponse.data:type_name -> supplier.SupplierInfo + 18, // 3: supplier.SupplierInfo.attachments:type_name -> supplier.attachment + 18, // 4: supplier.UpdateSupplierRequest.attachments:type_name -> supplier.attachment + 18, // 5: supplier.CreateSupplierRequest.attachments:type_name -> supplier.attachment + 20, // 6: supplier.Supplier.GetSupplier:input_type -> supplier.GetSupplierRequest + 17, // 7: supplier.Supplier.CreateSupplier:input_type -> supplier.CreateSupplierRequest + 16, // 8: supplier.Supplier.UpdateSupplier:input_type -> supplier.UpdateSupplierRequest + 13, // 9: supplier.Supplier.GetSupplierList:input_type -> supplier.GetSupplierListRequest + 10, // 10: supplier.Supplier.CreateOrganizeDictionary:input_type -> supplier.CreateOrganizeDictionaryRequest + 12, // 11: supplier.Supplier.GetOrganizeDictionaryList:input_type -> supplier.GetOrganizeDictionaryListRequest + 10, // 12: supplier.Supplier.GetOrganizeDictionaryInfo:input_type -> supplier.CreateOrganizeDictionaryRequest + 7, // 13: supplier.Supplier.GetCountryRegionList:input_type -> supplier.GetCountryRegionListRequest + 6, // 14: supplier.Supplier.GetCountryRegionInfo:input_type -> supplier.GetCountryRegionInfoRequest + 2, // 15: supplier.Supplier.CreateImportRecord:input_type -> supplier.CreateImportRecordRequest + 0, // 16: supplier.Supplier.GetImportRecordInfo:input_type -> supplier.GetImportRecordRequest + 16, // 17: supplier.Supplier.GetSupplier:output_type -> supplier.UpdateSupplierRequest + 19, // 18: supplier.Supplier.CreateSupplier:output_type -> supplier.CreateSupplierResponse + 19, // 19: supplier.Supplier.UpdateSupplier:output_type -> supplier.CreateSupplierResponse + 14, // 20: supplier.Supplier.GetSupplierList:output_type -> supplier.GetSupplierListResponse + 11, // 21: supplier.Supplier.CreateOrganizeDictionary:output_type -> supplier.CreateOrganizeDictionaryResponse + 9, // 22: supplier.Supplier.GetOrganizeDictionaryList:output_type -> supplier.GetOrganizeDictionaryListResponse + 8, // 23: supplier.Supplier.GetOrganizeDictionaryInfo:output_type -> supplier.OrganizeDictionary + 4, // 24: supplier.Supplier.GetCountryRegionList:output_type -> supplier.GetCountryRegionListResponse + 5, // 25: supplier.Supplier.GetCountryRegionInfo:output_type -> supplier.CountryRegion + 3, // 26: supplier.Supplier.CreateImportRecord:output_type -> supplier.CreateImportRecordResponse + 1, // 27: supplier.Supplier.GetImportRecordInfo:output_type -> supplier.GetImportRecordResponse + 17, // [17:28] is the sub-list for method output_type + 6, // [6:17] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name +} + +func init() { file_api_supplier_supplier_proto_init() } +func file_api_supplier_supplier_proto_init() { + if File_api_supplier_supplier_proto != nil { + return + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: unsafe.Slice(unsafe.StringData(file_api_supplier_supplier_proto_rawDesc), len(file_api_supplier_supplier_proto_rawDesc)), + NumEnums: 0, + NumMessages: 21, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_supplier_supplier_proto_goTypes, + DependencyIndexes: file_api_supplier_supplier_proto_depIdxs, + MessageInfos: file_api_supplier_supplier_proto_msgTypes, + }.Build() + File_api_supplier_supplier_proto = out.File + file_api_supplier_supplier_proto_goTypes = nil + file_api_supplier_supplier_proto_depIdxs = nil +} diff --git a/api/supplier/supplier.proto b/api/supplier/supplier.proto new file mode 100644 index 0000000..4b40851 --- /dev/null +++ b/api/supplier/supplier.proto @@ -0,0 +1,208 @@ +syntax = "proto3"; +package supplier; + +option go_package = "./;supplier"; + +// FiEE供应商微服务 +service Supplier { + //供应商curd + rpc GetSupplier(GetSupplierRequest) returns (UpdateSupplierRequest) {} + rpc CreateSupplier(CreateSupplierRequest) returns (CreateSupplierResponse) {} + rpc UpdateSupplier(UpdateSupplierRequest) returns (CreateSupplierResponse) {} + rpc GetSupplierList(GetSupplierListRequest) returns (GetSupplierListResponse) {} + //组织字典 + rpc CreateOrganizeDictionary(CreateOrganizeDictionaryRequest) returns (CreateOrganizeDictionaryResponse) {} + rpc GetOrganizeDictionaryList(GetOrganizeDictionaryListRequest) returns (GetOrganizeDictionaryListResponse) {} + rpc GetOrganizeDictionaryInfo(CreateOrganizeDictionaryRequest) returns (OrganizeDictionary) {} + //国家组织 + rpc GetCountryRegionList(GetCountryRegionListRequest) returns (GetCountryRegionListResponse) {} + rpc GetCountryRegionInfo(GetCountryRegionInfoRequest) returns (CountryRegion) {} + //导入 + rpc CreateImportRecord(CreateImportRecordRequest) returns (CreateImportRecordResponse) {} + rpc GetImportRecordInfo(GetImportRecordRequest) returns (GetImportRecordResponse) {} +} +message GetImportRecordRequest{ + string uuid = 1; +} +message GetImportRecordResponse{ + uint64 successNum = 1; + uint64 failNum = 2; + string deriveUrl = 3; +} +message CreateImportRecordRequest{ + repeated string supplierCodes = 1; + uint64 status = 2; + uint64 userId = 3; + string toLeadUrl = 4; + string deriveUrl = 5; + string uuid = 6; + uint64 successNum = 7; + uint64 failNum = 8; +} +message CreateImportRecordResponse{ + uint64 id = 1; +} +message GetCountryRegionListResponse{ + repeated CountryRegion data = 1; + uint64 page = 2; + uint64 pageSize = 3; + uint64 total = 4; +} +message CountryRegion{ + uint64 id = 1; + string nameEN = 2; + string nameCN = 3; + string code = 4; +} +message GetCountryRegionInfoRequest{ + string zhAndCode = 1; +} +message GetCountryRegionListRequest{ + uint64 page = 1; + uint64 pageSize = 2; + string nameEN = 3; + string nameCN = 4; + string code = 5; +} +message OrganizeDictionary{ + uint64 id = 1; + string name = 2; +} +message GetOrganizeDictionaryListResponse{ + repeated OrganizeDictionary data = 1; + uint64 page = 2; + uint64 pageSize = 3; + uint64 total = 4; +} +message CreateOrganizeDictionaryRequest{ + string name = 1; +} +message CreateOrganizeDictionaryResponse{ + uint64 id = 1; +} +message GetOrganizeDictionaryListRequest{ + uint64 page = 1; + uint64 pageSize = 2; + string name = 3; +} +message GetSupplierListRequest{ + uint64 page = 1; + uint64 pageSize = 2; + uint64 owningEntityId = 3; + string supplierUniqueCode = 4; + string legalName =5; + string localName = 6; + string abbreviationName =7; + uint64 countryOrRegionId = 8; + string companyRegistrationNumber =9; + string supplierType =10; + string approvalStatus = 11; + string approvalDateStart = 12; + string approvalDateEnd = 13; + string lastReviewDateStart = 14; + string lastReviewDateEnd = 15; + string legalEntityType = 16; + string sanctionsCountryScreeningResult = 17; + string keyFinancial = 18; + string companyAddress = 19; + string primaryContact = 20; + string dataOwnerDepartment = 21; + string basicCompanyInformation = 22; + uint64 status = 23; + string updateStart = 24; + string updateEnd = 25; +} +message GetSupplierListResponse{ + uint64 total = 1; + repeated SupplierInfo data = 2; + uint64 page = 3; + uint64 pageSize = 4; +} +message SupplierInfo{ + uint64 id = 1; + uint64 owningEntityId = 2; + string legalName = 3; + string localName = 4; + string abbreviationName = 5; + uint64 countryOrRegionId = 6; + string companyRegistrationNumber = 7; + string supplierType = 8; + string approvalStatus = 9; + string approvalDate = 10; + string lastReviewDate = 11; + string legalEntityType = 12; + string sanctionsCountryScreeningResult = 13; + string keyFinancial = 14; + string companyAddress = 15; + string primaryContact = 16; + string dataOwnerDepartment = 17; + string basicCompanyInformation = 18; + string linkAddress = 19; + string supplementaryText = 20; + repeated attachment attachments = 21; + uint64 status = 22; + string createdAt = 23; + string updatedAt = 24; + string supplierUniqueCode = 25; + string owningEntityName = 26; + string countryOrRegionCode = 27; +} +message UpdateSupplierRequest{ + uint64 id = 1; + uint64 owningEntityId = 2; + string legalName = 3; + string localName = 4; + string abbreviationName = 5; + uint64 countryOrRegionId = 6; + string companyRegistrationNumber = 7; + string supplierType = 8; + string approvalStatus = 9; + string approvalDate = 10; + string lastReviewDate = 11; + string legalEntityType = 12; + string sanctionsCountryScreeningResult = 13; + string keyFinancial = 14; + string companyAddress = 15; + string primaryContact = 16; + string dataOwnerDepartment = 17; + string basicCompanyInformation = 18; + string linkAddress = 19; + string supplementaryText = 20; + repeated attachment attachments = 21; + uint64 status = 22; +} +message CreateSupplierRequest{ + uint64 owningEntityId = 1; + string legalName = 2; + string localName = 3; + string abbreviationName = 4; + uint64 countryOrRegionId = 5; + string companyRegistrationNumber = 6; + string supplierType = 7; + string approvalStatus = 8; + string approvalDate = 9; + string lastReviewDate = 10; + string legalEntityType = 11; + string sanctionsCountryScreeningResult = 12; + string keyFinancial = 13; + string companyAddress = 14; + string primaryContact = 15; + string dataOwnerDepartment = 16; + string basicCompanyInformation = 17; + string linkAddress = 18; + string supplementaryText = 19; + repeated attachment attachments = 20; + uint64 status = 21; +} +message attachment{ + string url = 1; + string type = 2; + string name = 3; +} +message CreateSupplierResponse{ + uint64 id = 1; + string supplierCode = 2; +} +message GetSupplierRequest{ + uint64 id = 1; +} diff --git a/api/supplier/supplier.validator.pb.go b/api/supplier/supplier.validator.pb.go new file mode 100644 index 0000000..12a318a --- /dev/null +++ b/api/supplier/supplier.validator.pb.go @@ -0,0 +1,122 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: api/supplier/supplier.proto + +package supplier + +import ( + fmt "fmt" + math "math" + proto "github.com/golang/protobuf/proto" + github_com_mwitkow_go_proto_validators "github.com/mwitkow/go-proto-validators" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +func (this *GetImportRecordRequest) Validate() error { + return nil +} +func (this *GetImportRecordResponse) Validate() error { + return nil +} +func (this *CreateImportRecordRequest) Validate() error { + return nil +} +func (this *CreateImportRecordResponse) Validate() error { + return nil +} +func (this *GetCountryRegionListResponse) Validate() error { + for _, item := range this.Data { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Data", err) + } + } + } + return nil +} +func (this *CountryRegion) Validate() error { + return nil +} +func (this *GetCountryRegionInfoRequest) Validate() error { + return nil +} +func (this *GetCountryRegionListRequest) Validate() error { + return nil +} +func (this *OrganizeDictionary) Validate() error { + return nil +} +func (this *GetOrganizeDictionaryListResponse) Validate() error { + for _, item := range this.Data { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Data", err) + } + } + } + return nil +} +func (this *CreateOrganizeDictionaryRequest) Validate() error { + return nil +} +func (this *CreateOrganizeDictionaryResponse) Validate() error { + return nil +} +func (this *GetOrganizeDictionaryListRequest) Validate() error { + return nil +} +func (this *GetSupplierListRequest) Validate() error { + return nil +} +func (this *GetSupplierListResponse) Validate() error { + for _, item := range this.Data { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Data", err) + } + } + } + return nil +} +func (this *SupplierInfo) Validate() error { + for _, item := range this.Attachments { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Attachments", err) + } + } + } + return nil +} +func (this *UpdateSupplierRequest) Validate() error { + for _, item := range this.Attachments { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Attachments", err) + } + } + } + return nil +} +func (this *CreateSupplierRequest) Validate() error { + for _, item := range this.Attachments { + if item != nil { + if err := github_com_mwitkow_go_proto_validators.CallValidatorIfExists(item); err != nil { + return github_com_mwitkow_go_proto_validators.FieldError("Attachments", err) + } + } + } + return nil +} +func (this *Attachment) Validate() error { + return nil +} +func (this *CreateSupplierResponse) Validate() error { + return nil +} +func (this *GetSupplierRequest) Validate() error { + return nil +} diff --git a/api/supplier/supplier_triple.pb.go b/api/supplier/supplier_triple.pb.go new file mode 100644 index 0000000..c4aa33a --- /dev/null +++ b/api/supplier/supplier_triple.pb.go @@ -0,0 +1,605 @@ +// Code generated by protoc-gen-go-triple. DO NOT EDIT. +// versions: +// - protoc-gen-go-triple v1.0.5 +// - protoc v6.32.0 +// source: api/supplier/supplier.proto + +package supplier + +import ( + context "context" + protocol "dubbo.apache.org/dubbo-go/v3/protocol" + dubbo3 "dubbo.apache.org/dubbo-go/v3/protocol/dubbo3" + invocation "dubbo.apache.org/dubbo-go/v3/protocol/invocation" + grpc_go "github.com/dubbogo/grpc-go" + codes "github.com/dubbogo/grpc-go/codes" + metadata "github.com/dubbogo/grpc-go/metadata" + status "github.com/dubbogo/grpc-go/status" + common "github.com/dubbogo/triple/pkg/common" + constant "github.com/dubbogo/triple/pkg/common/constant" + triple "github.com/dubbogo/triple/pkg/triple" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc_go.SupportPackageIsVersion7 + +// SupplierClient is the client API for Supplier 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. +type SupplierClient interface { + // 供应商curd + GetSupplier(ctx context.Context, in *GetSupplierRequest, opts ...grpc_go.CallOption) (*UpdateSupplierRequest, common.ErrorWithAttachment) + CreateSupplier(ctx context.Context, in *CreateSupplierRequest, opts ...grpc_go.CallOption) (*CreateSupplierResponse, common.ErrorWithAttachment) + UpdateSupplier(ctx context.Context, in *UpdateSupplierRequest, opts ...grpc_go.CallOption) (*CreateSupplierResponse, common.ErrorWithAttachment) + GetSupplierList(ctx context.Context, in *GetSupplierListRequest, opts ...grpc_go.CallOption) (*GetSupplierListResponse, common.ErrorWithAttachment) + // 组织字典 + CreateOrganizeDictionary(ctx context.Context, in *CreateOrganizeDictionaryRequest, opts ...grpc_go.CallOption) (*CreateOrganizeDictionaryResponse, common.ErrorWithAttachment) + GetOrganizeDictionaryList(ctx context.Context, in *GetOrganizeDictionaryListRequest, opts ...grpc_go.CallOption) (*GetOrganizeDictionaryListResponse, common.ErrorWithAttachment) + GetOrganizeDictionaryInfo(ctx context.Context, in *CreateOrganizeDictionaryRequest, opts ...grpc_go.CallOption) (*OrganizeDictionary, common.ErrorWithAttachment) + // 国家组织 + GetCountryRegionList(ctx context.Context, in *GetCountryRegionListRequest, opts ...grpc_go.CallOption) (*GetCountryRegionListResponse, common.ErrorWithAttachment) + GetCountryRegionInfo(ctx context.Context, in *GetCountryRegionInfoRequest, opts ...grpc_go.CallOption) (*CountryRegion, common.ErrorWithAttachment) + // 导入 + CreateImportRecord(ctx context.Context, in *CreateImportRecordRequest, opts ...grpc_go.CallOption) (*CreateImportRecordResponse, common.ErrorWithAttachment) + GetImportRecordInfo(ctx context.Context, in *GetImportRecordRequest, opts ...grpc_go.CallOption) (*GetImportRecordResponse, common.ErrorWithAttachment) +} + +type supplierClient struct { + cc *triple.TripleConn +} + +type SupplierClientImpl struct { + GetSupplier func(ctx context.Context, in *GetSupplierRequest) (*UpdateSupplierRequest, error) + CreateSupplier func(ctx context.Context, in *CreateSupplierRequest) (*CreateSupplierResponse, error) + UpdateSupplier func(ctx context.Context, in *UpdateSupplierRequest) (*CreateSupplierResponse, error) + GetSupplierList func(ctx context.Context, in *GetSupplierListRequest) (*GetSupplierListResponse, error) + CreateOrganizeDictionary func(ctx context.Context, in *CreateOrganizeDictionaryRequest) (*CreateOrganizeDictionaryResponse, error) + GetOrganizeDictionaryList func(ctx context.Context, in *GetOrganizeDictionaryListRequest) (*GetOrganizeDictionaryListResponse, error) + GetOrganizeDictionaryInfo func(ctx context.Context, in *CreateOrganizeDictionaryRequest) (*OrganizeDictionary, error) + GetCountryRegionList func(ctx context.Context, in *GetCountryRegionListRequest) (*GetCountryRegionListResponse, error) + GetCountryRegionInfo func(ctx context.Context, in *GetCountryRegionInfoRequest) (*CountryRegion, error) + CreateImportRecord func(ctx context.Context, in *CreateImportRecordRequest) (*CreateImportRecordResponse, error) + GetImportRecordInfo func(ctx context.Context, in *GetImportRecordRequest) (*GetImportRecordResponse, error) +} + +func (c *SupplierClientImpl) GetDubboStub(cc *triple.TripleConn) SupplierClient { + return NewSupplierClient(cc) +} + +func (c *SupplierClientImpl) XXX_InterfaceName() string { + return "supplier.Supplier" +} + +func NewSupplierClient(cc *triple.TripleConn) SupplierClient { + return &supplierClient{cc} +} + +func (c *supplierClient) GetSupplier(ctx context.Context, in *GetSupplierRequest, opts ...grpc_go.CallOption) (*UpdateSupplierRequest, common.ErrorWithAttachment) { + out := new(UpdateSupplierRequest) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetSupplier", in, out) +} + +func (c *supplierClient) CreateSupplier(ctx context.Context, in *CreateSupplierRequest, opts ...grpc_go.CallOption) (*CreateSupplierResponse, common.ErrorWithAttachment) { + out := new(CreateSupplierResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateSupplier", in, out) +} + +func (c *supplierClient) UpdateSupplier(ctx context.Context, in *UpdateSupplierRequest, opts ...grpc_go.CallOption) (*CreateSupplierResponse, common.ErrorWithAttachment) { + out := new(CreateSupplierResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/UpdateSupplier", in, out) +} + +func (c *supplierClient) GetSupplierList(ctx context.Context, in *GetSupplierListRequest, opts ...grpc_go.CallOption) (*GetSupplierListResponse, common.ErrorWithAttachment) { + out := new(GetSupplierListResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetSupplierList", in, out) +} + +func (c *supplierClient) CreateOrganizeDictionary(ctx context.Context, in *CreateOrganizeDictionaryRequest, opts ...grpc_go.CallOption) (*CreateOrganizeDictionaryResponse, common.ErrorWithAttachment) { + out := new(CreateOrganizeDictionaryResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateOrganizeDictionary", in, out) +} + +func (c *supplierClient) GetOrganizeDictionaryList(ctx context.Context, in *GetOrganizeDictionaryListRequest, opts ...grpc_go.CallOption) (*GetOrganizeDictionaryListResponse, common.ErrorWithAttachment) { + out := new(GetOrganizeDictionaryListResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetOrganizeDictionaryList", in, out) +} + +func (c *supplierClient) GetOrganizeDictionaryInfo(ctx context.Context, in *CreateOrganizeDictionaryRequest, opts ...grpc_go.CallOption) (*OrganizeDictionary, common.ErrorWithAttachment) { + out := new(OrganizeDictionary) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetOrganizeDictionaryInfo", in, out) +} + +func (c *supplierClient) GetCountryRegionList(ctx context.Context, in *GetCountryRegionListRequest, opts ...grpc_go.CallOption) (*GetCountryRegionListResponse, common.ErrorWithAttachment) { + out := new(GetCountryRegionListResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetCountryRegionList", in, out) +} + +func (c *supplierClient) GetCountryRegionInfo(ctx context.Context, in *GetCountryRegionInfoRequest, opts ...grpc_go.CallOption) (*CountryRegion, common.ErrorWithAttachment) { + out := new(CountryRegion) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetCountryRegionInfo", in, out) +} + +func (c *supplierClient) CreateImportRecord(ctx context.Context, in *CreateImportRecordRequest, opts ...grpc_go.CallOption) (*CreateImportRecordResponse, common.ErrorWithAttachment) { + out := new(CreateImportRecordResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/CreateImportRecord", in, out) +} + +func (c *supplierClient) GetImportRecordInfo(ctx context.Context, in *GetImportRecordRequest, opts ...grpc_go.CallOption) (*GetImportRecordResponse, common.ErrorWithAttachment) { + out := new(GetImportRecordResponse) + interfaceKey := ctx.Value(constant.InterfaceKey).(string) + return out, c.cc.Invoke(ctx, "/"+interfaceKey+"/GetImportRecordInfo", in, out) +} + +// SupplierServer is the server API for Supplier service. +// All implementations must embed UnimplementedSupplierServer +// for forward compatibility +type SupplierServer interface { + // 供应商curd + GetSupplier(context.Context, *GetSupplierRequest) (*UpdateSupplierRequest, error) + CreateSupplier(context.Context, *CreateSupplierRequest) (*CreateSupplierResponse, error) + UpdateSupplier(context.Context, *UpdateSupplierRequest) (*CreateSupplierResponse, error) + GetSupplierList(context.Context, *GetSupplierListRequest) (*GetSupplierListResponse, error) + // 组织字典 + CreateOrganizeDictionary(context.Context, *CreateOrganizeDictionaryRequest) (*CreateOrganizeDictionaryResponse, error) + GetOrganizeDictionaryList(context.Context, *GetOrganizeDictionaryListRequest) (*GetOrganizeDictionaryListResponse, error) + GetOrganizeDictionaryInfo(context.Context, *CreateOrganizeDictionaryRequest) (*OrganizeDictionary, error) + // 国家组织 + GetCountryRegionList(context.Context, *GetCountryRegionListRequest) (*GetCountryRegionListResponse, error) + GetCountryRegionInfo(context.Context, *GetCountryRegionInfoRequest) (*CountryRegion, error) + // 导入 + CreateImportRecord(context.Context, *CreateImportRecordRequest) (*CreateImportRecordResponse, error) + GetImportRecordInfo(context.Context, *GetImportRecordRequest) (*GetImportRecordResponse, error) + mustEmbedUnimplementedSupplierServer() +} + +// UnimplementedSupplierServer must be embedded to have forward compatible implementations. +type UnimplementedSupplierServer struct { + proxyImpl protocol.Invoker +} + +func (UnimplementedSupplierServer) GetSupplier(context.Context, *GetSupplierRequest) (*UpdateSupplierRequest, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSupplier not implemented") +} +func (UnimplementedSupplierServer) CreateSupplier(context.Context, *CreateSupplierRequest) (*CreateSupplierResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateSupplier not implemented") +} +func (UnimplementedSupplierServer) UpdateSupplier(context.Context, *UpdateSupplierRequest) (*CreateSupplierResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateSupplier not implemented") +} +func (UnimplementedSupplierServer) GetSupplierList(context.Context, *GetSupplierListRequest) (*GetSupplierListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSupplierList not implemented") +} +func (UnimplementedSupplierServer) CreateOrganizeDictionary(context.Context, *CreateOrganizeDictionaryRequest) (*CreateOrganizeDictionaryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateOrganizeDictionary not implemented") +} +func (UnimplementedSupplierServer) GetOrganizeDictionaryList(context.Context, *GetOrganizeDictionaryListRequest) (*GetOrganizeDictionaryListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOrganizeDictionaryList not implemented") +} +func (UnimplementedSupplierServer) GetOrganizeDictionaryInfo(context.Context, *CreateOrganizeDictionaryRequest) (*OrganizeDictionary, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOrganizeDictionaryInfo not implemented") +} +func (UnimplementedSupplierServer) GetCountryRegionList(context.Context, *GetCountryRegionListRequest) (*GetCountryRegionListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCountryRegionList not implemented") +} +func (UnimplementedSupplierServer) GetCountryRegionInfo(context.Context, *GetCountryRegionInfoRequest) (*CountryRegion, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetCountryRegionInfo not implemented") +} +func (UnimplementedSupplierServer) CreateImportRecord(context.Context, *CreateImportRecordRequest) (*CreateImportRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateImportRecord not implemented") +} +func (UnimplementedSupplierServer) GetImportRecordInfo(context.Context, *GetImportRecordRequest) (*GetImportRecordResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetImportRecordInfo not implemented") +} +func (s *UnimplementedSupplierServer) XXX_SetProxyImpl(impl protocol.Invoker) { + s.proxyImpl = impl +} + +func (s *UnimplementedSupplierServer) XXX_GetProxyImpl() protocol.Invoker { + return s.proxyImpl +} + +func (s *UnimplementedSupplierServer) XXX_ServiceDesc() *grpc_go.ServiceDesc { + return &Supplier_ServiceDesc +} +func (s *UnimplementedSupplierServer) XXX_InterfaceName() string { + return "supplier.Supplier" +} + +func (UnimplementedSupplierServer) mustEmbedUnimplementedSupplierServer() {} + +// UnsafeSupplierServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to SupplierServer will +// result in compilation errors. +type UnsafeSupplierServer interface { + mustEmbedUnimplementedSupplierServer() +} + +func RegisterSupplierServer(s grpc_go.ServiceRegistrar, srv SupplierServer) { + s.RegisterService(&Supplier_ServiceDesc, srv) +} + +func _Supplier_GetSupplier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSupplierRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetSupplier", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_CreateSupplier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateSupplierRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("CreateSupplier", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_UpdateSupplier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateSupplierRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("UpdateSupplier", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_GetSupplierList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSupplierListRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetSupplierList", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_CreateOrganizeDictionary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOrganizeDictionaryRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("CreateOrganizeDictionary", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_GetOrganizeDictionaryList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOrganizeDictionaryListRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetOrganizeDictionaryList", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_GetOrganizeDictionaryInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOrganizeDictionaryRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetOrganizeDictionaryInfo", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_GetCountryRegionList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCountryRegionListRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetCountryRegionList", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_GetCountryRegionInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(GetCountryRegionInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetCountryRegionInfo", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_CreateImportRecord_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateImportRecordRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("CreateImportRecord", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +func _Supplier_GetImportRecordInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc_go.UnaryServerInterceptor) (interface{}, error) { + in := new(GetImportRecordRequest) + if err := dec(in); err != nil { + return nil, err + } + base := srv.(dubbo3.Dubbo3GrpcService) + args := []interface{}{} + args = append(args, in) + md, _ := metadata.FromIncomingContext(ctx) + invAttachment := make(map[string]interface{}, len(md)) + for k, v := range md { + invAttachment[k] = v + } + invo := invocation.NewRPCInvocation("GetImportRecordInfo", args, invAttachment) + if interceptor == nil { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + info := &grpc_go.UnaryServerInfo{ + Server: srv, + FullMethod: ctx.Value("XXX_TRIPLE_GO_INTERFACE_NAME").(string), + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + result := base.XXX_GetProxyImpl().Invoke(ctx, invo) + return result, result.Error() + } + return interceptor(ctx, in, info, handler) +} + +// Supplier_ServiceDesc is the grpc_go.ServiceDesc for Supplier service. +// It's only intended for direct use with grpc_go.RegisterService, +// and not to be introspected or modified (even as a copy) +var Supplier_ServiceDesc = grpc_go.ServiceDesc{ + ServiceName: "supplier.Supplier", + HandlerType: (*SupplierServer)(nil), + Methods: []grpc_go.MethodDesc{ + { + MethodName: "GetSupplier", + Handler: _Supplier_GetSupplier_Handler, + }, + { + MethodName: "CreateSupplier", + Handler: _Supplier_CreateSupplier_Handler, + }, + { + MethodName: "UpdateSupplier", + Handler: _Supplier_UpdateSupplier_Handler, + }, + { + MethodName: "GetSupplierList", + Handler: _Supplier_GetSupplierList_Handler, + }, + { + MethodName: "CreateOrganizeDictionary", + Handler: _Supplier_CreateOrganizeDictionary_Handler, + }, + { + MethodName: "GetOrganizeDictionaryList", + Handler: _Supplier_GetOrganizeDictionaryList_Handler, + }, + { + MethodName: "GetOrganizeDictionaryInfo", + Handler: _Supplier_GetOrganizeDictionaryInfo_Handler, + }, + { + MethodName: "GetCountryRegionList", + Handler: _Supplier_GetCountryRegionList_Handler, + }, + { + MethodName: "GetCountryRegionInfo", + Handler: _Supplier_GetCountryRegionInfo_Handler, + }, + { + MethodName: "CreateImportRecord", + Handler: _Supplier_CreateImportRecord_Handler, + }, + { + MethodName: "GetImportRecordInfo", + Handler: _Supplier_GetImportRecordInfo_Handler, + }, + }, + Streams: []grpc_go.StreamDesc{}, + Metadata: "api/supplier/supplier.proto", +} diff --git a/cmd/app.go b/cmd/app.go index 96456f0..ac88aa3 100644 --- a/cmd/app.go +++ b/cmd/app.go @@ -20,7 +20,6 @@ package main import ( "fmt" "fonchain-fiee/cmd/config" - "fonchain-fiee/pkg/cache" "fonchain-fiee/pkg/common" cronpkg "fonchain-fiee/pkg/cron" "fonchain-fiee/pkg/logger" @@ -50,14 +49,14 @@ func bootstrap() (err error) { logger.LogInit(config.AppConfig) ////redis - redisConfig := cache.RedisConfig{ - RedisDB: configEnv.Redis.RedisDB, - RedisAddr: configEnv.Redis.RedisAddr, - RedisPw: configEnv.Redis.RedisPW, - RedisDbName: configEnv.Redis.RedisDBNAme, - } + //redisConfig := cache.RedisConfig{ + // RedisDB: configEnv.Redis.RedisDB, + // RedisAddr: configEnv.Redis.RedisAddr, + // RedisPw: configEnv.Redis.RedisPW, + // RedisDbName: configEnv.Redis.RedisDBNAme, + //} - cache.LoadRedis(redisConfig) + //cache.LoadRedis(redisConfig) common.Init() if configEnv.System.CronOpen { fmt.Println("启动定时任务管理器...") diff --git a/conf/dubbogo.yaml b/conf/dubbogo.yaml index 23a50bc..6bdf3c7 100644 --- a/conf/dubbogo.yaml +++ b/conf/dubbogo.yaml @@ -54,6 +54,9 @@ dubbo: FieeCronClientImpl: protocol: tri interface: com.fontree.microservices.fiee.cron + SupplierClientImpl: + protocol: tri + interface: com.fontree.microservices.common.supplier logger: zap-config: level: error # 日志级别 diff --git a/docs/dev/dubbogo.yaml b/docs/dev/dubbogo.yaml index f8acc62..5a14b4d 100644 --- a/docs/dev/dubbogo.yaml +++ b/docs/dev/dubbogo.yaml @@ -61,6 +61,9 @@ dubbo: methods: - name: SecurityScan timeout: 120000 + SupplierClientImpl: + protocol: tri + interface: com.fontree.microservices.common.supplier logger: zap-config: level: error # 日志级别 diff --git a/docs/prod/dubbogo.yaml b/docs/prod/dubbogo.yaml index 5f3284a..0e0f25f 100644 --- a/docs/prod/dubbogo.yaml +++ b/docs/prod/dubbogo.yaml @@ -63,6 +63,9 @@ dubbo: methods: - name: SecurityScan timeout: 120000 + SupplierClientImpl: + protocol: tri + interface: com.fontree.microservices.common.supplier logger: zap-config: level: error # 日志级别 diff --git a/docs/test/dubbogo.yaml b/docs/test/dubbogo.yaml index 617d9a5..769e9ad 100644 --- a/docs/test/dubbogo.yaml +++ b/docs/test/dubbogo.yaml @@ -61,6 +61,9 @@ dubbo: methods: - name: SecurityScan timeout: 120000 + SupplierClientImpl: + protocol: tri + interface: com.fontree.microservices.common.supplier logger: zap-config: level: error # 日志级别 diff --git a/pkg/logic/supplier.go b/pkg/logic/supplier.go new file mode 100644 index 0000000..3ecc504 --- /dev/null +++ b/pkg/logic/supplier.go @@ -0,0 +1,178 @@ +package logic + +import ( + "crypto/sha256" + "errors" + "fmt" + "strconv" + "strings" + "time" + + "github.com/tealeg/xlsx" +) + +type SupplierLogic struct { + OwningEntityName string `json:"owningEntityName"` + LegalName string `json:"legalName"` + LocalName string `json:"localName"` + AbbreviationName string `json:"abbreviationName"` + CountryOrRegionName string `json:"countryOrRegionName"` + CompanyRegistrationNumber string `json:"companyRegistrationNumber"` + SupplierType string `json:"supplierType"` + ApprovalStatus string `json:"approvalStatus"` + ApprovalDate string `json:"approvalDate"` + LastReviewDate string `json:"lastReviewDate"` + LegalEntityType string `json:"legalEntityType"` + SanctionsCountryScreeningResult string `json:"sanctionsCountryScreeningResult"` + KeyFinancial string `json:"keyFinancial"` + CompanyAddress string `json:"companyAddress"` + PrimaryContact string `json:"primaryContact"` + DataOwnerDepartment string `json:"dataOwnerDepartment"` + BasicCompanyInformation string `json:"basicCompanyInformation"` + SupplementaryText string `json:"supplementaryText"` +} +type ErrSupplierRes struct { + ID int `json:"id"` + LegalName string `json:"legalName"` + Remark string `json:"remark"` +} + +func ImportSupplier(filePath string) ([]*SupplierLogic, error) { + xlFile, err := xlsx.OpenFile(filePath) + if err != nil { + return nil, err + } + //开辟除表头外的行数的数组内存 + //遍历sheet + for sheetIndex, sheet := range xlFile.Sheets { + var resourceArr []map[int]string + //遍历每一行 + //for rowIndex, row := range sheet.Rows { + for _, row := range sheet.Rows { + //开辟除表头外的行数的数组内存 + objMap := make(map[int]string) + + //if len(row.Cells) <= 0 || row.Cells[0].String() == "" { + // continue + //} + for cellIndex, cell := range row.Cells { + text := cell.String() + //如果是每一行的第一个单元格 + objMap[cellIndex] = text + } + resourceArr = append(resourceArr, objMap) + } + if len(resourceArr) >= 2 { + suppliers, err := getListFromRaw(resourceArr) + if err != nil { + return nil, errors.New(fmt.Sprintf("页码:%d,文件读取错误信息%s", sheetIndex+1, err.Error())) + } + if len(suppliers) > 0 { + return suppliers, nil + } + } + break + } + + return nil, nil +} +func getListFromRaw(list []map[int]string) ([]*SupplierLogic, error) { + var entrusts []*SupplierLogic + kkMap := map[string]string{ + "*使用组织/Owning Entity": "owningEntityName", + "*供应商法定全称/Legal Name": "legalName", + "供应商本地名称(如有)/Local Name (if applicable)": "localName", + "供应商简称(如有)/Abbreviation/Trade Name (if applicable)": "abbreviationName", + "*所在国家或地区/Country or Region": "countryOrRegionName", + "*公司注册编号/Company Registration Number": "companyRegistrationNumber", + "*供应商类型/Supplier Type": "supplierType", + "*准入状态/Approval Status": "approvalStatus", + "准入日期/Approval Date": "approvalDate", + "法律实体形式/Legal Entity Type": "legalEntityType", + "制裁与高风险国家筛查结果/Sanctions & High-Risk Country Screening Result": "sanctionsCountryScreeningResult", + "关键财务与付款信息/Key Financial & Payment Information": "keyFinancial", + "公司地址/Company Address": "companyAddress", + "主要联系人、职位及联系方式/Primary Contact, Position&Details": "primaryContact", + "数据维护部门&人员/Data Owner Department/Personnel": "dataOwnerDepartment", + "公司信息概要/Summary of Basic Company Information": "basicCompanyInformation", + "其他补充信息/Other Supplementary Information": "supplementaryText", + } + keyMap := list[0] + for index, tt := range list { + if index == 0 { + continue + } + temp := &SupplierLogic{} + for i, r := range tt { + t := strings.TrimSpace(r) + if _, ok := keyMap[i]; !ok { + continue + } + keyString := strings.TrimSpace(keyMap[i]) + if _, ok := kkMap[keyString]; !ok { + fmt.Println(fmt.Sprintf("行数:%d字段信息(%s)没有匹配,请以模版为准", i, keyString)) + continue + } + switch kkMap[keyString] { + case "owningEntityName": + temp.OwningEntityName = t + case "legalName": + temp.LegalName = t + case "localName": + temp.LocalName = t + case "abbreviationName": + temp.AbbreviationName = t + case "countryOrRegionName": + temp.CountryOrRegionName = t + case "companyRegistrationNumber": + temp.CompanyRegistrationNumber = t + case "supplierType": + temp.SupplierType = t + case "approvalStatus": + temp.ApprovalStatus = t + case "approvalDate": + temp.ApprovalDate = ParseExcelDate(t) + //temp.ApprovalDate = t + case "legalEntityType": + temp.LegalEntityType = t + case "sanctionsCountryScreeningResult": + temp.SanctionsCountryScreeningResult = t + case "keyFinancial": + temp.KeyFinancial = t + case "companyAddress": + temp.CompanyAddress = t + case "primaryContact": + temp.PrimaryContact = t + case "dataOwnerDepartment": + temp.DataOwnerDepartment = t + case "basicCompanyInformation": + temp.BasicCompanyInformation = t + case "supplementaryText": + temp.SupplementaryText = t + + } + } + entrusts = append(entrusts, temp) + } + sha256.New() + return entrusts, nil +} +func ParseExcelDate(v string) string { + if v == "" { + return "" + } + + // 非数字,直接认为是 yyyy-mm-dd + if _, err := strconv.ParseFloat(v, 64); err != nil { + t, err := time.Parse("2006-01-02", v) + if err != nil { + return "" + } + return t.Format("2006-01-02") + } + + // Excel 序列号 + f, _ := strconv.ParseFloat(v, 64) + base := time.Date(1899, 12, 30, 0, 0, 0, 0, time.Local) + return base.AddDate(0, 0, int(f)).Format("2006-01-02") +} diff --git a/pkg/router/router.go b/pkg/router/router.go index 0a4d9e0..f9573d9 100644 --- a/pkg/router/router.go +++ b/pkg/router/router.go @@ -58,6 +58,7 @@ func NewRouter() *gin.Engine { SecFilingRouter(privateGroup) app.MediaAppRouter(privateGroup) cronRouter(privateGroup) + SupplierRouter(privateGroup) { v1.POST("version", version.Version) //版本号公共 } diff --git a/pkg/router/supplier.go b/pkg/router/supplier.go new file mode 100644 index 0000000..3231de7 --- /dev/null +++ b/pkg/router/supplier.go @@ -0,0 +1,35 @@ +package router + +import ( + "fonchain-fiee/pkg/middleware" + "fonchain-fiee/pkg/service" + "fonchain-fiee/pkg/service/supplier" + + "github.com/gin-gonic/gin" +) + +func SupplierRouter(r *gin.RouterGroup) { + + supplierRoute := r.Group("supplier/web") + + supplierRoute.Use(middleware.CheckWebLogin(service.AccountProvider)) + { + supplierRoute.POST("info", supplier.GetSupplier) + supplierRoute.POST("create", supplier.CreateSupplier) + supplierRoute.POST("update", supplier.UpdateSupplier) + supplierRoute.POST("list", supplier.GetSupplierList) + } + { + supplierRoute.POST("dictionary/create", supplier.CreateOrganizeDictionary) + supplierRoute.POST("dictionary/list", supplier.GetOrganizeDictionaryList) + } + { + supplierRoute.POST("country-region/list", supplier.GetCountryRegionList) + } + { + supplierRoute.POST("import/record", supplier.CreateImportRecord) + supplierRoute.POST("import/info", supplier.GetImportRecordInfo) + supplierRoute.POST("export/list", supplier.GetExportList) + } + +} diff --git a/pkg/service/asChat/handler.go b/pkg/service/asChat/handler.go index ee0ba9d..1bdf042 100644 --- a/pkg/service/asChat/handler.go +++ b/pkg/service/asChat/handler.go @@ -47,7 +47,7 @@ func NewChatHandler() ChatHandler { c := ChatHandler{ cache: chatCache.ChatCache{NewMessageStatExpireAfter: 10 * time.Minute}, } - c.robot = robot.NewRobot(&c.cache) + //c.robot = robot.NewRobot(&c.cache) return c } diff --git a/pkg/service/init.go b/pkg/service/init.go index f39c4ee..da1b23b 100644 --- a/pkg/service/init.go +++ b/pkg/service/init.go @@ -14,6 +14,7 @@ import ( "fonchain-fiee/api/payment" "fonchain-fiee/api/pressreleases" "fonchain-fiee/api/secFilings" + "fonchain-fiee/api/supplier" pkConfig "fonchain-fiee/pkg/config" "os" @@ -35,20 +36,22 @@ var PressReleasesProvider = new(pressreleases.PressReleasesClientImpl) var SecFilingProvider = new(secFilings.SecFilingsClientImpl) var AyrshareProvider = new(aryshare.AyrshareClientImpl) var CronProvider = new(cron.CronClientImpl) +var SupplierProvider = new(supplier.SupplierClientImpl) func init() { - config.SetConsumerService(BundleProvider) - config.SetConsumerService(OrderProvider) + //config.SetConsumerService(BundleProvider) + //config.SetConsumerService(OrderProvider) config.SetConsumerService(AccountProvider) - config.SetConsumerService(PaymentProvider) - config.SetConsumerService(AccountFieeProvider) - config.SetConsumerService(CastProvider) - config.SetConsumerService(FilesProvider) - config.SetConsumerService(GovernanceProvider) - config.SetConsumerService(PressReleasesProvider) - config.SetConsumerService(SecFilingProvider) - config.SetConsumerService(AyrshareProvider) - config.SetConsumerService(CronProvider) + //config.SetConsumerService(PaymentProvider) + //config.SetConsumerService(AccountFieeProvider) + //config.SetConsumerService(CastProvider) + //config.SetConsumerService(FilesProvider) + //config.SetConsumerService(GovernanceProvider) + //config.SetConsumerService(PressReleasesProvider) + //config.SetConsumerService(SecFilingProvider) + //config.SetConsumerService(AyrshareProvider) + //config.SetConsumerService(CronProvider) + config.SetConsumerService(SupplierProvider) if err := config.Load(); err != nil { panic(err) diff --git a/pkg/service/supplier/supplier.go b/pkg/service/supplier/supplier.go new file mode 100644 index 0000000..09eeec4 --- /dev/null +++ b/pkg/service/supplier/supplier.go @@ -0,0 +1,391 @@ +package supplier + +import ( + "errors" + "fmt" + "fonchain-fiee/api/supplier" + "fonchain-fiee/pkg/logic" + "fonchain-fiee/pkg/model/login" + "fonchain-fiee/pkg/service" + "fonchain-fiee/pkg/service/upload" + "fonchain-fiee/pkg/utils" + "fonchain-fiee/pkg/utils/excel" + "os" + "time" + + "github.com/gin-gonic/gin" + "github.com/gin-gonic/gin/binding" + "github.com/google/uuid" +) + +func GetSupplier(c *gin.Context) { + req := &supplier.GetSupplierRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.GetSupplier(c, req) + if err != nil { + service.Error(c, err) + return + } + + service.Success(c, res) + return +} +func CreateSupplier(c *gin.Context) { + req := &supplier.CreateSupplierRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.CreateSupplier(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func UpdateSupplier(c *gin.Context) { + req := &supplier.UpdateSupplierRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + info, err := service.SupplierProvider.GetSupplier(c, &supplier.GetSupplierRequest{Id: req.Id}) + if err != nil { + service.Error(c, err) + return + } + if info.Status == 3 { + service.Error(c, errors.New("审核中不可修改")) //todo 修改:审核中并且存在审核人 不可修改 + return + } + if req.Status != 1 && req.Status != 2 { + service.Error(c, errors.New("审批状态错误")) //todo 只允许前端暂存或提交审核申请 + } + res, err := service.SupplierProvider.UpdateSupplier(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func GetSupplierList(c *gin.Context) { + req := &supplier.GetSupplierListRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.GetSupplierList(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func CreateOrganizeDictionary(c *gin.Context) { + req := &supplier.CreateOrganizeDictionaryRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.CreateOrganizeDictionary(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func GetOrganizeDictionaryList(c *gin.Context) { + req := &supplier.GetOrganizeDictionaryListRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.GetOrganizeDictionaryList(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func GetCountryRegionList(c *gin.Context) { + req := &supplier.GetCountryRegionListRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.GetCountryRegionList(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func CreateImportRecord(c *gin.Context) { + file, err := c.FormFile("file") + if err != nil { + service.Error(c, err) + } + safeFilename := fmt.Sprintf("%d", time.Now().Unix()) + "_" + file.Filename + userInfo := login.GetUserInfoFromC(c) + fileDir := fmt.Sprintf("/fiee/supplier/%s/%s_%s", time.Now().Format("2006-01-02"), userInfo.Name, safeFilename) + // 保存上传的文件到本地 + if err = c.SaveUploadedFile(file, safeFilename); err != nil { + service.Error(c, err) + return + } + defer func() { + if err := os.Remove(safeFilename); err != nil { + // 处理删除文件失败的情况 + fmt.Println("Failed to delete file:", err) + } + }() + inputUrl, err := upload.PutBosWithName(safeFilename, false, fileDir) + if err != nil { + service.Error(c, err) + return + } + supplierList, err := logic.ImportSupplier(safeFilename) + if err != nil { + service.Error(c, err) + return + } + if len(supplierList) == 0 { + service.Error(c, errors.New("导入数据为空")) + return + } + uuid, _ := uuid.NewUUID() + var SuccessNum uint64 + var SupplierCodes []string + var ErrSupplierRes []*logic.ErrSupplierRes + for idx, i := range supplierList { + rowNum := idx + 1 + if i.OwningEntityName == "" || i.LegalName == "" || i.CountryOrRegionName == "" || i.CompanyRegistrationNumber == "" || i.SupplierType == "" || i.ApprovalStatus == "" { + ErrSupplierRes = append(ErrSupplierRes, &logic.ErrSupplierRes{ + ID: rowNum, + LegalName: i.LegalName, + Remark: "必填项存在空值", + }) + continue + } + OwningEntityRes, _ := service.SupplierProvider.GetOrganizeDictionaryInfo(c, &supplier.CreateOrganizeDictionaryRequest{Name: i.OwningEntityName}) + if OwningEntityRes == nil || OwningEntityRes.Id == 0 { + ErrSupplierRes = append(ErrSupplierRes, &logic.ErrSupplierRes{ + ID: rowNum, + LegalName: i.LegalName, + Remark: "所属组织不存在", + }) + continue + } + countryRegionRes, _ := service.SupplierProvider.GetCountryRegionInfo(c, &supplier.GetCountryRegionInfoRequest{ZhAndCode: i.CountryOrRegionName}) + if countryRegionRes == nil || countryRegionRes.Id == 0 { + ErrSupplierRes = append(ErrSupplierRes, &logic.ErrSupplierRes{ + ID: rowNum, + LegalName: i.LegalName, + Remark: "所属国家或地区不存在", + }) + continue + } + var LastReviewDate string + if i.ApprovalDate != "" { + t, err := time.Parse("2006-01-02", i.ApprovalDate) + if err != nil { + LastReviewDate = "" + i.ApprovalDate = "" + } else { + LastReviewDate = t.AddDate(1, 0, 0).Format("2006-01-02") + } + } + createRes, err := service.SupplierProvider.CreateSupplier(c, &supplier.CreateSupplierRequest{ + OwningEntityId: OwningEntityRes.Id, + LegalName: i.LegalName, + LocalName: i.LocalName, + AbbreviationName: i.AbbreviationName, + CountryOrRegionId: countryRegionRes.Id, + CompanyRegistrationNumber: i.CompanyRegistrationNumber, + SupplierType: i.SupplierType, + ApprovalStatus: i.ApprovalStatus, + ApprovalDate: i.ApprovalDate, + LastReviewDate: LastReviewDate, + LegalEntityType: i.LegalEntityType, + SanctionsCountryScreeningResult: i.SanctionsCountryScreeningResult, + KeyFinancial: i.KeyFinancial, + CompanyAddress: i.CompanyAddress, + PrimaryContact: i.PrimaryContact, + DataOwnerDepartment: i.DataOwnerDepartment, + BasicCompanyInformation: i.BasicCompanyInformation, + SupplementaryText: i.SupplementaryText, + Status: 1, + }) + if err != nil { + ErrSupplierRes = append(ErrSupplierRes, &logic.ErrSupplierRes{ + ID: rowNum, + LegalName: i.LegalName, + Remark: err.Error(), + }) + continue + } else { + SupplierCodes = append(SupplierCodes, createRes.SupplierCode) + SuccessNum++ + } + + } + status := 2 + outUrl := "" + if len(ErrSupplierRes) == 0 { + status = 1 + } else { + var sheet1Columns = []string{"行数", "供应商法定全称", "错误信息"} + var sheet1 = excel.NewSheet("Sheet1", ErrSupplierRes, sheet1Columns) + ex, err := excel.NewExcelCreatorFromTemplate("./mistake.xlsx", "./supplier/excel/", "", sheet1) + ex.UseOption(excel.OptionFileNameSuffixWithUnixTime) + path, _, err := ex.WriteToFile() + outUrl, err = upload.PutBos(path, "", false) + if err != nil { + service.Error(c, err) + return + } + defer func() { + os.RemoveAll("./supplier") + }() + } + req := &supplier.CreateImportRecordRequest{ + SupplierCodes: SupplierCodes, + Status: uint64(status), + UserId: userInfo.ID, + ToLeadUrl: inputUrl, + DeriveUrl: outUrl, + Uuid: uuid.String(), + SuccessNum: SuccessNum, + FailNum: uint64(len(ErrSupplierRes)), + } + _, err = service.SupplierProvider.CreateImportRecord(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, req) + return +} + +func GetImportRecordInfo(c *gin.Context) { + req := &supplier.GetImportRecordRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + res, err := service.SupplierProvider.GetImportRecordInfo(c, req) + if err != nil { + service.Error(c, err) + return + } + service.Success(c, res) + return +} + +func GetExportList(c *gin.Context) { + req := &supplier.GetSupplierListRequest{} + if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil { + service.Error(c, err) + return + } + infoRes, err := service.SupplierProvider.GetSupplierList(c, req) + if err != nil { + service.Error(c, err) + return + } + // 定义标题列表 + titleList := []string{ + "状态/State", "使用组织/Owning Entity", "供应商唯一编码/SupplierUnique Code", "供应商法定全称(英文)/LegalName (English)", "供应商本地名称(如有)/LocalName (if applicable)", + "所在国家或地区/Country or Region", "公司注册编号/Company RegistrationNumber", "供应商类型/Supplier Type", "准入状态/Approval Status", "准入日期/ApprovalDate", + "法律实体形式/Legal Entity Type", "制裁与高风险国家筛查结果/Sanctions & High-RiskCountry Screening Result", "关键财务与付款信息/Key Financial & Payment Information", + "公司地址/Company Address", "主要联系人、职位及联系方式/Primary Contact,Position&Details", "数据维护部门&人员/Data Owner Department/Personnel", "最后更新日期/Last Updated Date", + "公司信息概要/Summary of Basic Company Information", + } + // 定义数据结构 + type DataInfo struct { + Status string + OwningEntity string + SupplierUniqueCode string + LegalName string + LocalName string + CountryOrRegion string + CompanyRegistrationNumber string + SupplierType string + ApprovalStatus string + ApprovalDate string + LegalEntityType string + SanctionsCountryScreeningResult string + KeyFinancial string + CompanyAddress string + PrimaryContact string + DataOwnerDepartment string + UpdatedAt string + BasicCompanyInformation string + } + // 创建员工ID到DataInfo的映射 + dataMap := make(map[string]*DataInfo) + statusMap := map[uint64]string{ + 1: "草稿", + 2: "审核中", + 3: "已驳回", + 4: "已成功", + } + for _, info := range infoRes.Data { + dataMap[info.SupplierUniqueCode] = &DataInfo{ + Status: statusMap[info.Status], + OwningEntity: info.OwningEntityName, + SupplierUniqueCode: info.SupplierUniqueCode, + LegalName: info.LegalName, + LocalName: info.LocalName, + CountryOrRegion: info.CountryOrRegionCode, + CompanyRegistrationNumber: info.CompanyRegistrationNumber, + SupplierType: info.SupplierType, + ApprovalStatus: info.ApprovalStatus, + ApprovalDate: info.ApprovalDate, + LegalEntityType: info.LegalEntityType, + SanctionsCountryScreeningResult: info.SanctionsCountryScreeningResult, + KeyFinancial: info.KeyFinancial, + CompanyAddress: info.CompanyAddress, + PrimaryContact: info.PrimaryContact, + DataOwnerDepartment: info.DataOwnerDepartment, + UpdatedAt: info.UpdatedAt, + BasicCompanyInformation: info.BasicCompanyInformation, + } + } + // 生成最终数据列表 + var dataList []interface{} + for _, data := range dataMap { + dataList = append(dataList, &[]any{ + data.Status, data.OwningEntity, data.SupplierUniqueCode, data.LegalName, data.LocalName, + data.CountryOrRegion, data.CompanyRegistrationNumber, data.SupplierType, data.ApprovalStatus, data.ApprovalDate, + data.LegalEntityType, data.SanctionsCountryScreeningResult, data.KeyFinancial, data.CompanyAddress, data.PrimaryContact, + data.DataOwnerDepartment, data.UpdatedAt, data.BasicCompanyInformation, + }) + } + + // 生成Excel文件 + content, err := utils.ToExcelByType(titleList, dataList, "slice", "") + if err != nil { + service.Error(c, err) + return + } + + // 返回Excel文件 + utils.ResponseXls(c, content, "供应商库") + return +} diff --git a/pkg/service/upload/upload.go b/pkg/service/upload/upload.go index a15b8dd..2117072 100644 --- a/pkg/service/upload/upload.go +++ b/pkg/service/upload/upload.go @@ -12,14 +12,14 @@ import ( "fonchain-fiee/pkg/model" "fonchain-fiee/pkg/service" "fonchain-fiee/pkg/utils" + "io" + + cmdConf "fonchain-fiee/cmd/config" "github.com/disintegration/imaging" "github.com/fonchain_enterprise/utils/objstorage" "github.com/gin-gonic/gin" uuid "github.com/satori/go.uuid" - "io" - ffmpeg "github.com/u2takey/ffmpeg-go" - "go.uber.org/zap" "io/ioutil" "mime/multipart" "net/url" @@ -28,6 +28,9 @@ import ( "path/filepath" "strconv" "strings" + + ffmpeg "github.com/u2takey/ffmpeg-go" + "go.uber.org/zap" ) const ( @@ -216,7 +219,7 @@ func quickBos(file *multipart.FileHeader, mediaType string, mask string, source return } } - var objectName string = fmt.Sprintf("%s/%s/%s", config.ConfigData.Oss.BaseDir, config.Env, filePath) + var objectName string = fmt.Sprintf("%s/%s/%s", config.ConfigData.Oss.BaseDir, cmdConf.AppConfig.System.AppMode, filePath) BOSClient, _ := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint)) _, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes) if err != nil { @@ -266,7 +269,8 @@ func BaiduCheckImage(imageByte []byte) (err error) { return nil } func PutBos(filePath string, mediaType string, needRemove bool) (url string, err error) { - BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint)) + //BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint)) + BOSClient, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint) if err != nil { fmt.Println("=== PutBos NewOss err ", err) //logger.Errorf("PutBos NewOss err ", err) @@ -290,8 +294,9 @@ func PutBos(filePath string, mediaType string, needRemove bool) (url string, err } } filePath = strings.Replace(filePath, model.MediaPath, "", 1) - var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, config.Env, filePath) - _, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes) + var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, cmdConf.AppConfig.System.AppMode, filePath) + //_, err = BOSClient.PutObjectFromBytes(os.Getenv(config.ConfigData.Oss.BucketName), objectName, fileBytes) + _, err = BOSClient.PutObjectFromBytes(config.ConfigData.Oss.BucketName, objectName, fileBytes) if err != nil { fmt.Println("=== PutBos PutObject err ", err) //logger.Errorf("PutBos PutObject err %+v", err.Error()) @@ -299,7 +304,8 @@ func PutBos(filePath string, mediaType string, needRemove bool) (url string, err return } //url = fmt.Sprintf("%s%s%s/%s", config.BosHttp, config.BosBucketName, config.BosUrl, objectName) - url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName) + //url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName) + url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName) return } func GetSnapshot(videoPath, snapshotPath string, frameNum int) (snapshotName string, err error) { @@ -347,3 +353,30 @@ func getEnvDir(cloudStoreSubPath string) (ep string) { ep, _ = url.JoinPath("fiee", cloudStoreSubPath) return ep } +func PutBosWithName(filePath string, needRemove bool, ossPath string) (url string, err error) { + //BOSClient, err := objstorage.NewOSS(os.Getenv(config.ConfigData.Oss.AccessKeyId), os.Getenv(config.ConfigData.Oss.AccessKeySecret), os.Getenv(config.ConfigData.Oss.Endpoint)) + BOSClient, err := objstorage.NewOSS(config.ConfigData.Oss.AccessKeyId, config.ConfigData.Oss.AccessKeySecret, config.ConfigData.Oss.Endpoint) + if err != nil { + //logger.Errorf("PutBosWithName err1 ", err) + err = errors.New(e.GetMsg(e.ErrorUploadBos)) + return + } + if ossPath == "" { + ossPath = filePath[1:] + } + var objectName string = fmt.Sprintf("%s/%s%s", config.ConfigData.Oss.BaseDir, cmdConf.AppConfig.System.AppMode, ossPath) + //_, err = BOSClient.PutObject(os.Getenv(config.ConfigData.Oss.BucketName), objectName, filePath) + _, err = BOSClient.PutObject(config.ConfigData.Oss.BucketName, objectName, filePath) + if err != nil { + //logger.Errorf("PutBosWithName err2 ", err) + err = errors.New(e.GetMsg(e.ErrorUploadBos)) + return + } + //删除本地文件 + if needRemove { + _ = os.Remove(filePath) + } + //url = fmt.Sprintf("%s/%s", os.Getenv(config.ConfigData.Oss.CdnHost), objectName) + url = fmt.Sprintf("%s/%s", config.ConfigData.Oss.CdnHost, objectName) + return +} diff --git a/pkg/utils/excel/excelInter.go b/pkg/utils/excel/excelInter.go new file mode 100644 index 0000000..99f6d81 --- /dev/null +++ b/pkg/utils/excel/excelInter.go @@ -0,0 +1,381 @@ +// Package excel ----------------------------- +// @file : templateInter.go +// @author : JJXu +// @contact : wavingbear@163.com +// @time : 2022/7/23 15:34 +// ------------------------------------------- +package excel + +import ( + "bytes" + "errors" + "fmt" + "io" + "log" + "os" + "path/filepath" + "reflect" + "sync" + + "github.com/tealeg/xlsx" + "github.com/xuri/excelize/v2" +) + +var ( + ErrSheetNotExist = errors.New("sheet does not exist") + ErrSheetDataFormatNotSupport = errors.New("sheet data format not support") + //ErrSheetNameNotInTemplate = errors.New("sheet name not in emailTemplate") +) + +// ====================================================================================================================== +// +// Sheet define +type HeaderRow struct { + RowNum int //行号 + Values []string +} + +// 抽象工作簿 +type Sheet interface { + GetData() any //数据,支持struct、[]struct、[]*struct三种类型 + SheetName() string //表名称 + SheetHeaders() []string //表头名称,没有则跳过插入表头的步骤 + GetJsonFiledList() []string //指定字段的排列顺序,默认按照结构体中的顺序排列(表头与数据没有关联,使用这个指定字段插入顺序) +} + +// 实例化工作簿,使用模板生成excel的话用这个 +func NewTemplateSheet(sheetName string, datas any) Sheet { + return &newSheetDefine{ + Datas: datas, + Name: sheetName, + } +} + +// 实例化工作簿,不通过模板生成excel的话用这个 +func NewSheet(sheetName string, datas any, headers []string, jsonFiledList ...[]string) Sheet { + st := &newSheetDefine{ + Datas: datas, + Name: sheetName, + Headers: headers, + } + if jsonFiledList != nil { + st.JsonFiledList = jsonFiledList[0] + } + return st +} + +// 定义一个能够通用的工作簿结构,此结构必须遵循Sheet接口规范 +type newSheetDefine struct { + Datas any + Name string + Headers []string + JsonFiledList []string +} + +func (s *newSheetDefine) GetData() any { + return s.Datas +} +func (s *newSheetDefine) SheetName() string { + return s.Name +} +func (s *newSheetDefine) SheetHeaders() []string { + return s.Headers +} +func (s *newSheetDefine) GetJsonFiledList() []string { + return s.JsonFiledList +} + +//====================================================================================================================== +// Sheet define + +// WriteToExcel 通过模板文件写入数据并另存为 +// param fileName : 文件名 +// param filesSuffix : 文件后缀名生成函数 +// param fileRoot : 导出目录 +// param templatePath : 模板文件路径 +// param sheets : Sheet类型的数据,类型为[]Sheet +// return path : 文件路径 +// return exfileName : 导出后的文件名 +// return err +func WriteToExcel(fileName string, fileRoot string, templatePath string, sheets ...Sheet) (path string, exFileName string, err error) { + var exc *Excel + exc, err = NewExcelCreatorFromTemplate(fileName, fileRoot, templatePath, sheets...) + if err != nil { + return + } + exc.UseOption(OptionFileNameSuffixWithUnixTime) + return exc.WriteToFile() +} + +// ReadDataFromExcel 从excel文件读取数据 +func ReadDataFromExcel(filepath string, sheetName string, handler func(rowIndex int, rows []string)) error { + ex := Excel{OriginFilePath: filepath} + return ex.ReadSheetData(sheetName, handler) +} + +// ReadDataFromBytes 从io口读取数据,用户http上传的附件 +func ReadDataFromBytes(file io.Reader, sheetName string, handler func(rowIndex int, row []string)) error { + exce, err := excelize.OpenReader(file) + if err != nil { + return err + } + var ex = Excel{ex: exce} + return ex.ReadSheetData(sheetName, handler) +} + +// 读取模板并创建工作表生成器 +func NewExcelCreatorFromTemplate(fileName string, fileRoot string, templatePath string, sheets ...Sheet) (exc *Excel, err error) { + exc = &Excel{ + SaveRoot: fileRoot, + SaveName: fileName, + OriginFilePath: templatePath, + rwLock: sync.RWMutex{}, + } + if sheets != nil { + err = exc.AddSheets(sheets...) + if err != nil { + return + } + } + return exc, nil +} + +// 新建文件并创建工作表生成器 +func NewExcelCreatorWithNewFile(fileName string, fileRoot string, sheets ...Sheet) (exc *Excel, err error) { + return NewExcelCreatorFromTemplate(fileName, fileRoot, "", sheets...) +} + +type Excel struct { + ex *excelize.File + SaveRoot string + SaveName string + OriginFilePath string + Sheets map[string]Sheet + rwLock sync.RWMutex + Opts []Option + After []Option +} + +// UseOption 使用可选项 +func (s *Excel) UseOption(opts ...Option) { + if opts != nil { + s.Opts = append(s.Opts, opts...) + } +} +func (s *Excel) AfterAddData(after ...Option) { + if after != nil { + s.After = append(s.After, after...) + } +} + +// 添加工作簿 +// 注意如果添加相同的工作簿,之前的会被覆盖 +func (s *Excel) AddSheets(sheets ...Sheet) (err error) { + if s.Sheets == nil { + s.Sheets = make(map[string]Sheet, 0) + } + for _, sheet := range sheets { + var sheetName = sheet.SheetName() + s.Sheets[sheetName] = sheet + } + return +} + +// 删除工作簿 +func (s *Excel) DeleteSheets(sheetName string) error { + if s.Sheets == nil { + return nil + } else if s.Sheets[sheetName] != nil { + delete(s.Sheets, sheetName) + } else { + return ErrSheetNotExist + } + return nil +} + +// 读取工作簿 +func (s *Excel) ReadSheetData(sheetName string, handler func(rowIndex int, row []string)) (err error) { + if s.ex == nil { + s.ex, err = excelize.OpenFile(s.OriginFilePath) + if err != nil { + return + } + } + datas, err := s.ex.GetRows(sheetName) + for i, row := range datas { + handler(i, row) + } + return nil +} + +// 写入到文件 +func (s *Excel) WriteToFile() (path string, fileName string, err error) { + if s.ex == nil { + if s.OriginFilePath == "" { + s.ex = excelize.NewFile() + } else { + s.ex, err = excelize.OpenFile(s.OriginFilePath) + if err != nil { + return + } + } + } + if s.Opts != nil { + for _, opt := range s.Opts { + opt(s) + } + } + //插入数据 + for sheetName, st := range s.Sheets { + //添加表头,没有定义则不插入 + if st.SheetHeaders() != nil { + for i, c := range st.SheetHeaders() { + err = s.ex.SetCellValue(sheetName, GetCellIndex(1, i+1), c) + if err != nil { + fmt.Println(err.Error()) + return + } + } + headerStyleID, errs := s.ex.NewStyle(NewDefaultHeaderStyle()) + if errs != nil { + fmt.Println(errs) + err = errs + return + } + //表头设置为默认样式,边框加粗、字体加粗 + if err = s.ex.SetCellStyle(st.SheetName(), "A1", GetCellIndex(1, len(st.SheetHeaders())), headerStyleID); err != nil { + return + } + } + //添加数据 + var firstRow = s.getFirstEmptyRowIndex(s.ex, sheetName) + var SheetData = reflect.ValueOf(st.GetData()) + var SheetType = reflect.TypeOf(st.GetData()) + writerFunc, exists := writerMap[SheetData.Kind()] + if exists { + err = writerFunc(s, st, SheetData, SheetType, firstRow) + } else { + return "", "", ErrSheetDataFormatNotSupport + } + } + if s.After != nil { + for _, after := range s.After { + after(s) + } + } + //检测并生成目录 + _ = os.MkdirAll(s.SaveRoot, os.ModePerm) + //保存 + path = filepath.ToSlash(filepath.Join(s.SaveRoot, s.SaveName)) + fileName = s.SaveName + s.rwLock.Lock() + if err = s.ex.SaveAs(path); err != nil { + log.Println(fmt.Sprintf("save file error :%v", err)) + s.rwLock.Unlock() + return + } + s.rwLock.Unlock() + return +} + +// getJsonFieldList 获取json字段列表 +func (s *Excel) getJsonFieldList(sheetType reflect.Type) (tagList []string) { + t := sheetType.Elem() + if t.Kind() == reflect.Ptr { + t = t.Elem() + if t.Kind() != reflect.Struct { + return + } + } + for i := 0; i < t.NumField(); i++ { + var tag = t.Field(i).Tag.Get("json") + if tag != "" { + tagList = append(tagList, tag) + } + } + return +} + +// dataToMap 数据转字典 +func (s *Excel) dataToMap(sheet reflect.Value, sheetType reflect.Type) (dataMap map[string]any) { + dataMap = make(map[string]any) + t := sheetType.Elem() + //指针类型结构体拿真实的对象 + if t.Kind() == reflect.Ptr { + t = t.Elem() + sheet = sheet.Elem() + } + for i := 0; i < t.NumField(); i++ { + var tag = t.Field(i).Tag.Get("json") + if tag != "" { + dataMap[t.Field(i).Tag.Get("json")] = sheet.Field(i).Interface() + } + } + return dataMap +} + +// getFirstEmptyRowIndex 获取首个空行的索引位置 +func (s *Excel) getFirstEmptyRowIndex(ex *excelize.File, sheetName string) (index int) { + rows, err := ex.GetRows(sheetName) + if err != nil { + return 1 + } + return len(rows) +} + +func ToExcel(titleList []string, dataList []interface{}) (content io.ReadSeeker) { + // 生成一个新的文件 + file := xlsx.NewFile() + // 添加sheet页 + sheet, _ := file.AddSheet("Sheet1") + // 插入表头 + titleRow := sheet.AddRow() + for _, v := range titleList { + cell := titleRow.AddCell() + cell.Value = v + } + // 插入内容 + for _, v := range dataList { + row := sheet.AddRow() + row.WriteStruct(v, -1) + } + + var buffer bytes.Buffer + _ = file.Write(&buffer) + file.Save("1.xlsx") + content = bytes.NewReader(buffer.Bytes()) + return +} + +// 自动设置单元格宽度 +func (s *Excel) autoResetCellWidth(sheetObj Sheet) { + // 获取最大字符宽度 + maxWidths := make(map[int]int) + var sheetData = reflect.ValueOf(sheetObj.GetData()) + var rowLen = 1 + var columnLen = len(sheetObj.GetJsonFiledList()) + if sheetData.Kind() == reflect.Slice { + rowLen = sheetData.Len() + } + limitWidth := 90 + for col := 1; col <= columnLen; col++ { + var maxWidth int + for row := 0; row < rowLen; row++ { + value, _ := s.ex.GetCellValue(sheetObj.SheetName(), GetCellIndex(row+1, col)) + width := len(value) + if width > limitWidth { + width = limitWidth + } + if width > maxWidth { + maxWidth = width + } + } + maxWidths[col] = maxWidth + } + + // 设置列宽度 + for col, width := range maxWidths { + colChar := GetColumnIndex(col) + s.ex.SetColWidth(sheetObj.SheetName(), colChar, colChar, float64(width+2)) + } +} diff --git a/pkg/utils/excel/options.go b/pkg/utils/excel/options.go new file mode 100644 index 0000000..69a5cd3 --- /dev/null +++ b/pkg/utils/excel/options.go @@ -0,0 +1,52 @@ +// Package excel ----------------------------- +// @file : options.go +// @author : JJXu +// @contact : wavingBear@163.com +// @time : 2022/12/19 12:41:40 +// ------------------------------------------- +package excel + +import ( + "fmt" + "path/filepath" + "strings" + "time" +) + +type Option func(excel *Excel) + +// func AddSaveFileSuffixWithUnixTime(excel *Excel) { +// excel.SaveName +// fmt.Sprintf("%v", time.Now().Unix()) +// } +// +// 时间戳作为文件后缀 +func OptionFileNameSuffixWithUnixTime(excel *Excel) { + ext := filepath.Ext(excel.SaveName) + name := strings.Split(excel.SaveName, ext)[0] + excel.SaveName = fmt.Sprintf("%s_%v%s", name, time.Now().Unix(), ext) +} + +// 为第一行添加表头 +func AfterAddHeader1(sheet Sheet, text string) func(excel *Excel) { + return func(excel *Excel) { + err := excel.ex.InsertRows(sheet.SheetName(), 1, 1) + if err != nil { + panic(err) + } + err = excel.ex.SetCellValue(sheet.SheetName(), GetCellIndex(1, 1), text) + if err != nil { + panic(err) + } + headerStyleID, errs := excel.ex.NewStyle(NewHeaderOneStyle()) + if errs != nil { + fmt.Println(errs) + err = errs + return + } + //表头设置为默认样式,边框加粗、字体加粗 + _ = excel.ex.SetCellStyle(sheet.SheetName(), "A1", GetCellIndex(1, len(sheet.SheetHeaders())), headerStyleID) + _ = excel.ex.MergeCell(sheet.SheetName(), "A1", GetCellIndex(1, len(sheet.SheetHeaders()))) + + } +} diff --git a/pkg/utils/excel/style.go b/pkg/utils/excel/style.go new file mode 100644 index 0000000..e0829db --- /dev/null +++ b/pkg/utils/excel/style.go @@ -0,0 +1,54 @@ +// Package excel ----------------------------- +// @file : style.go +// @author : JJXu +// @contact : wavingbear@163.com +// @time : 2023/9/1 13:50 +// ------------------------------------------- +package excel + +import ( + "github.com/xuri/excelize/v2" +) + +func NewDefaultHeaderStyle() *excelize.Style { + return &excelize.Style{ + Border: []excelize.Border{ + {Type: "left", Color: "000000", Style: 2}, + {Type: "top", Color: "000000", Style: 2}, + {Type: "bottom", Color: "000000", Style: 2}, + {Type: "right", Color: "000000", Style: 2}, + }, + Font: &excelize.Font{Bold: true, Size: 12}, + Alignment: &excelize.Alignment{ + Horizontal: "center", + }, + } +} +func NewDefaultDataStyle() *excelize.Style { + return &excelize.Style{ + Border: []excelize.Border{ + {Type: "left", Color: "000000", Style: 1}, + {Type: "bottom", Color: "000000", Style: 1}, + {Type: "right", Color: "000000", Style: 1}, + }, + Font: &excelize.Font{Size: 12}, + Alignment: &excelize.Alignment{ + Horizontal: "left", + }, + } +} + +func NewHeaderOneStyle() *excelize.Style { + return &excelize.Style{ + Border: []excelize.Border{ + {Type: "left", Color: "000000", Style: 2}, + {Type: "top", Color: "000000", Style: 2}, + {Type: "bottom", Color: "000000", Style: 2}, + {Type: "right", Color: "000000", Style: 2}, + }, + Font: &excelize.Font{Bold: true, Size: 14}, + Alignment: &excelize.Alignment{ + Horizontal: "center", + }, + } +} diff --git a/pkg/utils/excel/utils.go b/pkg/utils/excel/utils.go new file mode 100644 index 0000000..a9ee91a --- /dev/null +++ b/pkg/utils/excel/utils.go @@ -0,0 +1,41 @@ +// Package utils ----------------------------- +// @file : excelHelper.go +// @author : JJXu +// @contact : wavingbear@163.com +// @time : 2022/6/9 13:41 +// ------------------------------------------- +package excel + +import ( + "fmt" + "strconv" +) + +// 行列坐标值转换为excel的坐标。注意row和columnCount的初始值都是1 +func GetCellIndex(row int, columnCount int) string { + var column = GetColumnIndex(columnCount) + return fmt.Sprintf("%s%d", column, row) +} + +// 获取excel的列索引 +var columnIndices = []string{"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"} + +func GetColumnIndex(num int) string { + num-- + var column = columnIndices[num%26] + for num = num / 26; num > 0; num = num / 26 { + column = columnIndices[(num-1)%26] + column + num-- + } + return column +} + +func Int[T int | uint | uint8 | uint32 | uint64 | int32 | int64](value string) T { + v, _ := strconv.Atoi(value) + return T(v) +} + +func Float[T float64 | float32](value string) T { + v, _ := strconv.ParseFloat(value, 64) + return T(v) +} diff --git a/pkg/utils/excel/writer.go b/pkg/utils/excel/writer.go new file mode 100644 index 0000000..0e053d7 --- /dev/null +++ b/pkg/utils/excel/writer.go @@ -0,0 +1,81 @@ +// Package excel ----------------------------- +// @file : writer.go +// @author : JJXu +// @contact : wavingbear@163.com +// @time : 2023/9/1 14:11 +// ------------------------------------------- +package excel + +import ( + "errors" + "fmt" + "reflect" +) + +var writerMap = map[reflect.Kind]func(exc *Excel, sheetObj Sheet, SheetData reflect.Value, SheetType reflect.Type, firstRow int) error{ + reflect.Slice: sliceWriter, + reflect.Struct: structWriter, +} + +func RegisterWriter(dataKind reflect.Kind, function func(exc *Excel, sheetObj Sheet, SheetData reflect.Value, SheetType reflect.Type, firstRow int) error) error { + if _, exists := writerMap[dataKind]; exists { + return errors.New(fmt.Sprintf("dataKind: %v has existed", dataKind)) + } + writerMap[dataKind] = function + return nil +} + +func sliceWriter(exc *Excel, sheetObj Sheet, SheetData reflect.Value, SheetDataType reflect.Type, firstRow int) error { + var cellNameList = sheetObj.GetJsonFiledList() + if cellNameList == nil { + cellNameList = exc.getJsonFieldList(SheetDataType) + } + var rowLen = SheetData.Len() + for i := 0; i < rowLen; i++ { + var dataMap = exc.dataToMap(SheetData.Index(i), SheetDataType) + for column, v := range cellNameList { + var axis = GetCellIndex(i+firstRow+1, column+1) + err := exc.ex.SetCellValue(sheetObj.SheetName(), axis, dataMap[v]) + if err != nil { + return err + } + } + } + //设置数据格式 + dataStyleID, errs := exc.ex.NewStyle(NewDefaultDataStyle()) + if errs != nil { + return errs + } + if err := exc.ex.SetCellStyle(sheetObj.SheetName(), GetCellIndex(firstRow+1, 1), GetCellIndex(rowLen+1, len(sheetObj.SheetHeaders())), dataStyleID); err != nil { + return err + } + //设置默认列宽 + //exc.ex.SetColWidth(sheetObj.SheetName(), GetColumnIndex(1), GetColumnIndex(len(sheetObj.SheetHeaders())), 12.0) + exc.autoResetCellWidth(sheetObj) + return nil +} + +func structWriter(exc *Excel, sheetObj Sheet, SheetData reflect.Value, SheetType reflect.Type, firstRow int) error { + var cellNameList = exc.getJsonFieldList(SheetType) + var dataMap = exc.dataToMap(SheetData, SheetType) + for column, v := range cellNameList { + var axis = GetCellIndex(firstRow+1, column+1) + err := exc.ex.SetCellValue(sheetObj.SheetName(), axis, dataMap[v]) + if err != nil { + fmt.Println(err.Error()) + return err + } + } + //设置数据格式 + dataStyleID, err := exc.ex.NewStyle(NewDefaultDataStyle()) + if err != nil { + return err + } + if err = exc.ex.SetCellStyle(sheetObj.SheetName(), GetCellIndex(firstRow, 1), GetCellIndex(firstRow+1, len(sheetObj.SheetHeaders())), dataStyleID); err != nil { + return err + } + //设置默认列宽 + //exc.ex.SetColWidth(sheetObj.SheetName(), GetColumnIndex(1), GetColumnIndex(len(sheetObj.SheetHeaders())), 12.0) + exc.autoResetCellWidth(sheetObj) + return nil +}