WH01243 2 gadi atpakaļ
revīzija
72958b15cd

+ 15 - 0
entity/db.go

@@ -0,0 +1,15 @@
+package entity
+
+type Mysql struct {
+	GlobalCommonData *MysqlStruct `json:"globalCommonData,omitempty"`
+}
+
+//mysql
+type MysqlStruct struct {
+	DbName       string `json:"dbName"`
+	Address      string `json:"address"`
+	UserName     string `json:"userName"`
+	Password     string `json:"password"`
+	MaxOpenConns int    `json:"maxOpenConns"`
+	MaxIdleConns int    `json:"maxIdleConns"`
+}

+ 9 - 0
entity/logx.go

@@ -0,0 +1,9 @@
+package entity
+
+//日志信息
+type Logc struct {
+	Mode     string
+	Path     string
+	Level    []string
+	KeepDays int
+}

+ 18 - 0
go.mod

@@ -0,0 +1,18 @@
+module bp.jydev.jianyu360.cn/BaseService/jyCodeService
+
+go 1.16
+
+require (
+	app.yhyue.com/moapp/jybase v0.0.0-20220617085837-48c1bf245c2f
+	github.com/go-sql-driver/mysql v1.6.0
+	github.com/kr/pretty v0.3.0 // indirect
+	github.com/mattn/go-colorable v0.1.13 // indirect
+	github.com/zeromicro/go-zero v1.4.0
+	golang.org/x/crypto v0.0.0-20220829220503-c86fa9a7ed90 // indirect
+	golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
+	golang.org/x/sys v0.0.0-20220829200755-d48e67d00261 // indirect
+	golang.org/x/term v0.0.0-20220722155259-a9ba230a4035 // indirect
+	google.golang.org/appengine v1.6.7 // indirect
+	google.golang.org/grpc v1.48.0
+	google.golang.org/protobuf v1.28.1
+)

+ 27 - 0
rpc/codeservice/codeService.proto

@@ -0,0 +1,27 @@
+syntax = "proto3";
+
+package codeservice;
+option go_package = "./codeservice";
+
+message Request {
+}
+
+message Response {
+  int64           ErrorCode = 1;  // 响应代码
+  string          ErrorMsg = 2;   // 响应信息
+  TypeStruct      Data = 3;//数据
+
+}
+//返回数据
+message  TypeStruct{
+  map<string,string> Area = 1;
+  map<string,string> City = 2;
+  map<string,string> Subtype = 3;
+  map<string,string> Buyerclass = 4;
+  map<string,string> Subscopeclass = 5;
+}
+
+
+service CodeService {
+  rpc CodeTransformation(Request) returns(Response);
+}

+ 40 - 0
rpc/codeservice/codeservice.go

@@ -0,0 +1,40 @@
+package main
+
+import (
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
+	"flag"
+	"fmt"
+
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/config"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/server"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/svc"
+
+	"github.com/zeromicro/go-zero/core/conf"
+	"github.com/zeromicro/go-zero/core/service"
+	"github.com/zeromicro/go-zero/zrpc"
+	"google.golang.org/grpc"
+	"google.golang.org/grpc/reflection"
+)
+
+var configFile = flag.String("f", "etc/codeservice.yaml", "the config file")
+
+func main() {
+	flag.Parse()
+
+	var c config.Config
+	conf.MustLoad(*configFile, &c)
+	ctx := svc.NewServiceContext(c)
+	svr := server.NewCodeServiceServer(ctx)
+
+	s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) {
+		codeservice.RegisterCodeServiceServer(grpcServer, svr)
+
+		if c.Mode == service.DevMode || c.Mode == service.TestMode {
+			reflection.Register(grpcServer)
+		}
+	})
+	defer s.Stop()
+
+	fmt.Printf("Starting rpc server at %s...\n", c.ListenOn)
+	s.Start()
+}

+ 366 - 0
rpc/codeservice/codeservice/codeService.pb.go

@@ -0,0 +1,366 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// 	protoc-gen-go v1.28.0
+// 	protoc        v3.15.1
+// source: codeService.proto
+
+package codeservice
+
+import (
+	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+	reflect "reflect"
+	sync "sync"
+)
+
+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 Request struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+}
+
+func (x *Request) Reset() {
+	*x = Request{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_codeService_proto_msgTypes[0]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *Request) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Request) ProtoMessage() {}
+
+func (x *Request) ProtoReflect() protoreflect.Message {
+	mi := &file_codeService_proto_msgTypes[0]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use Request.ProtoReflect.Descriptor instead.
+func (*Request) Descriptor() ([]byte, []int) {
+	return file_codeService_proto_rawDescGZIP(), []int{0}
+}
+
+type Response struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	ErrorCode int64       `protobuf:"varint,1,opt,name=ErrorCode,proto3" json:"ErrorCode,omitempty"` // 响应代码
+	ErrorMsg  string      `protobuf:"bytes,2,opt,name=ErrorMsg,proto3" json:"ErrorMsg,omitempty"`    // 响应信息
+	Data      *TypeStruct `protobuf:"bytes,3,opt,name=Data,proto3" json:"Data,omitempty"`            //数据
+}
+
+func (x *Response) Reset() {
+	*x = Response{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_codeService_proto_msgTypes[1]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *Response) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Response) ProtoMessage() {}
+
+func (x *Response) ProtoReflect() protoreflect.Message {
+	mi := &file_codeService_proto_msgTypes[1]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use Response.ProtoReflect.Descriptor instead.
+func (*Response) Descriptor() ([]byte, []int) {
+	return file_codeService_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *Response) GetErrorCode() int64 {
+	if x != nil {
+		return x.ErrorCode
+	}
+	return 0
+}
+
+func (x *Response) GetErrorMsg() string {
+	if x != nil {
+		return x.ErrorMsg
+	}
+	return ""
+}
+
+func (x *Response) GetData() *TypeStruct {
+	if x != nil {
+		return x.Data
+	}
+	return nil
+}
+
+//返回数据
+type TypeStruct struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Area          map[string]string `protobuf:"bytes,1,rep,name=Area,proto3" json:"Area,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	City          map[string]string `protobuf:"bytes,2,rep,name=City,proto3" json:"City,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	Subtype       map[string]string `protobuf:"bytes,3,rep,name=Subtype,proto3" json:"Subtype,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	Buyerclass    map[string]string `protobuf:"bytes,4,rep,name=Buyerclass,proto3" json:"Buyerclass,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+	Subscopeclass map[string]string `protobuf:"bytes,5,rep,name=Subscopeclass,proto3" json:"Subscopeclass,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"`
+}
+
+func (x *TypeStruct) Reset() {
+	*x = TypeStruct{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_codeService_proto_msgTypes[2]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *TypeStruct) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*TypeStruct) ProtoMessage() {}
+
+func (x *TypeStruct) ProtoReflect() protoreflect.Message {
+	mi := &file_codeService_proto_msgTypes[2]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use TypeStruct.ProtoReflect.Descriptor instead.
+func (*TypeStruct) Descriptor() ([]byte, []int) {
+	return file_codeService_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *TypeStruct) GetArea() map[string]string {
+	if x != nil {
+		return x.Area
+	}
+	return nil
+}
+
+func (x *TypeStruct) GetCity() map[string]string {
+	if x != nil {
+		return x.City
+	}
+	return nil
+}
+
+func (x *TypeStruct) GetSubtype() map[string]string {
+	if x != nil {
+		return x.Subtype
+	}
+	return nil
+}
+
+func (x *TypeStruct) GetBuyerclass() map[string]string {
+	if x != nil {
+		return x.Buyerclass
+	}
+	return nil
+}
+
+func (x *TypeStruct) GetSubscopeclass() map[string]string {
+	if x != nil {
+		return x.Subscopeclass
+	}
+	return nil
+}
+
+var File_codeService_proto protoreflect.FileDescriptor
+
+var file_codeService_proto_rawDesc = []byte{
+	0x0a, 0x11, 0x63, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
+	0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
+	0x22, 0x09, 0x0a, 0x07, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x71, 0x0a, 0x08, 0x52,
+	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72,
+	0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x45, 0x72, 0x72, 0x6f,
+	0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73,
+	0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73,
+	0x67, 0x12, 0x2b, 0x0a, 0x04, 0x44, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32,
+	0x17, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79,
+	0x70, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x04, 0x44, 0x61, 0x74, 0x61, 0x22, 0x84,
+	0x05, 0x0a, 0x0a, 0x54, 0x79, 0x70, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x12, 0x35, 0x0a,
+	0x04, 0x41, 0x72, 0x65, 0x61, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f,
+	0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x53, 0x74,
+	0x72, 0x75, 0x63, 0x74, 0x2e, 0x41, 0x72, 0x65, 0x61, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04,
+	0x41, 0x72, 0x65, 0x61, 0x12, 0x35, 0x0a, 0x04, 0x43, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03,
+	0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
+	0x2e, 0x54, 0x79, 0x70, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x43, 0x69, 0x74, 0x79,
+	0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x04, 0x43, 0x69, 0x74, 0x79, 0x12, 0x3e, 0x0a, 0x07, 0x53,
+	0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63,
+	0x6f, 0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x53,
+	0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x45, 0x6e, 0x74,
+	0x72, 0x79, 0x52, 0x07, 0x53, 0x75, 0x62, 0x74, 0x79, 0x70, 0x65, 0x12, 0x47, 0x0a, 0x0a, 0x42,
+	0x75, 0x79, 0x65, 0x72, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32,
+	0x27, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79,
+	0x70, 0x65, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x42, 0x75, 0x79, 0x65, 0x72, 0x63, 0x6c,
+	0x61, 0x73, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0a, 0x42, 0x75, 0x79, 0x65, 0x72, 0x63,
+	0x6c, 0x61, 0x73, 0x73, 0x12, 0x50, 0x0a, 0x0d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x6f, 0x70, 0x65,
+	0x63, 0x6c, 0x61, 0x73, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2a, 0x2e, 0x63, 0x6f,
+	0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x54, 0x79, 0x70, 0x65, 0x53, 0x74,
+	0x72, 0x75, 0x63, 0x74, 0x2e, 0x53, 0x75, 0x62, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x63, 0x6c, 0x61,
+	0x73, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0d, 0x53, 0x75, 0x62, 0x73, 0x63, 0x6f, 0x70,
+	0x65, 0x63, 0x6c, 0x61, 0x73, 0x73, 0x1a, 0x37, 0x0a, 0x09, 0x41, 0x72, 0x65, 0x61, 0x45, 0x6e,
+	0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a,
+	0x37, 0x0a, 0x09, 0x43, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03,
+	0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14,
+	0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76,
+	0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3a, 0x0a, 0x0c, 0x53, 0x75, 0x62, 0x74,
+	0x79, 0x70, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61,
+	0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65,
+	0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3d, 0x0a, 0x0f, 0x42, 0x75, 0x79, 0x65, 0x72, 0x63, 0x6c, 0x61,
+	0x73, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c,
+	0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a,
+	0x02, 0x38, 0x01, 0x1a, 0x40, 0x0a, 0x12, 0x53, 0x75, 0x62, 0x73, 0x63, 0x6f, 0x70, 0x65, 0x63,
+	0x6c, 0x61, 0x73, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79,
+	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76,
+	0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
+	0x65, 0x3a, 0x02, 0x38, 0x01, 0x32, 0x50, 0x0a, 0x0b, 0x43, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72,
+	0x76, 0x69, 0x63, 0x65, 0x12, 0x41, 0x0a, 0x12, 0x43, 0x6f, 0x64, 0x65, 0x54, 0x72, 0x61, 0x6e,
+	0x73, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x2e, 0x63, 0x6f, 0x64,
+	0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
+	0x1a, 0x15, 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x52,
+	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0f, 0x5a, 0x0d, 0x2e, 0x2f, 0x63, 0x6f, 0x64,
+	0x65, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+	file_codeService_proto_rawDescOnce sync.Once
+	file_codeService_proto_rawDescData = file_codeService_proto_rawDesc
+)
+
+func file_codeService_proto_rawDescGZIP() []byte {
+	file_codeService_proto_rawDescOnce.Do(func() {
+		file_codeService_proto_rawDescData = protoimpl.X.CompressGZIP(file_codeService_proto_rawDescData)
+	})
+	return file_codeService_proto_rawDescData
+}
+
+var file_codeService_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
+var file_codeService_proto_goTypes = []interface{}{
+	(*Request)(nil),    // 0: codeservice.Request
+	(*Response)(nil),   // 1: codeservice.Response
+	(*TypeStruct)(nil), // 2: codeservice.TypeStruct
+	nil,                // 3: codeservice.TypeStruct.AreaEntry
+	nil,                // 4: codeservice.TypeStruct.CityEntry
+	nil,                // 5: codeservice.TypeStruct.SubtypeEntry
+	nil,                // 6: codeservice.TypeStruct.BuyerclassEntry
+	nil,                // 7: codeservice.TypeStruct.SubscopeclassEntry
+}
+var file_codeService_proto_depIdxs = []int32{
+	2, // 0: codeservice.Response.Data:type_name -> codeservice.TypeStruct
+	3, // 1: codeservice.TypeStruct.Area:type_name -> codeservice.TypeStruct.AreaEntry
+	4, // 2: codeservice.TypeStruct.City:type_name -> codeservice.TypeStruct.CityEntry
+	5, // 3: codeservice.TypeStruct.Subtype:type_name -> codeservice.TypeStruct.SubtypeEntry
+	6, // 4: codeservice.TypeStruct.Buyerclass:type_name -> codeservice.TypeStruct.BuyerclassEntry
+	7, // 5: codeservice.TypeStruct.Subscopeclass:type_name -> codeservice.TypeStruct.SubscopeclassEntry
+	0, // 6: codeservice.CodeService.CodeTransformation:input_type -> codeservice.Request
+	1, // 7: codeservice.CodeService.CodeTransformation:output_type -> codeservice.Response
+	7, // [7:8] is the sub-list for method output_type
+	6, // [6:7] 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_codeService_proto_init() }
+func file_codeService_proto_init() {
+	if File_codeService_proto != nil {
+		return
+	}
+	if !protoimpl.UnsafeEnabled {
+		file_codeService_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*Request); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_codeService_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*Response); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_codeService_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*TypeStruct); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+	}
+	type x struct{}
+	out := protoimpl.TypeBuilder{
+		File: protoimpl.DescBuilder{
+			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+			RawDescriptor: file_codeService_proto_rawDesc,
+			NumEnums:      0,
+			NumMessages:   8,
+			NumExtensions: 0,
+			NumServices:   1,
+		},
+		GoTypes:           file_codeService_proto_goTypes,
+		DependencyIndexes: file_codeService_proto_depIdxs,
+		MessageInfos:      file_codeService_proto_msgTypes,
+	}.Build()
+	File_codeService_proto = out.File
+	file_codeService_proto_rawDesc = nil
+	file_codeService_proto_goTypes = nil
+	file_codeService_proto_depIdxs = nil
+}

+ 105 - 0
rpc/codeservice/codeservice/codeService_grpc.pb.go

@@ -0,0 +1,105 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.2.0
+// - protoc             v3.15.1
+// source: codeService.proto
+
+package codeservice
+
+import (
+	context "context"
+	grpc "google.golang.org/grpc"
+	codes "google.golang.org/grpc/codes"
+	status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+// CodeServiceClient is the client API for CodeService 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 CodeServiceClient interface {
+	CodeTransformation(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
+}
+
+type codeServiceClient struct {
+	cc grpc.ClientConnInterface
+}
+
+func NewCodeServiceClient(cc grpc.ClientConnInterface) CodeServiceClient {
+	return &codeServiceClient{cc}
+}
+
+func (c *codeServiceClient) CodeTransformation(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
+	out := new(Response)
+	err := c.cc.Invoke(ctx, "/codeservice.CodeService/CodeTransformation", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
+// CodeServiceServer is the server API for CodeService service.
+// All implementations must embed UnimplementedCodeServiceServer
+// for forward compatibility
+type CodeServiceServer interface {
+	CodeTransformation(context.Context, *Request) (*Response, error)
+	mustEmbedUnimplementedCodeServiceServer()
+}
+
+// UnimplementedCodeServiceServer must be embedded to have forward compatible implementations.
+type UnimplementedCodeServiceServer struct {
+}
+
+func (UnimplementedCodeServiceServer) CodeTransformation(context.Context, *Request) (*Response, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method CodeTransformation not implemented")
+}
+func (UnimplementedCodeServiceServer) mustEmbedUnimplementedCodeServiceServer() {}
+
+// UnsafeCodeServiceServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to CodeServiceServer will
+// result in compilation errors.
+type UnsafeCodeServiceServer interface {
+	mustEmbedUnimplementedCodeServiceServer()
+}
+
+func RegisterCodeServiceServer(s grpc.ServiceRegistrar, srv CodeServiceServer) {
+	s.RegisterService(&CodeService_ServiceDesc, srv)
+}
+
+func _CodeService_CodeTransformation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(Request)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(CodeServiceServer).CodeTransformation(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/codeservice.CodeService/CodeTransformation",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(CodeServiceServer).CodeTransformation(ctx, req.(*Request))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
+// CodeService_ServiceDesc is the grpc.ServiceDesc for CodeService service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var CodeService_ServiceDesc = grpc.ServiceDesc{
+	ServiceName: "codeservice.CodeService",
+	HandlerType: (*CodeServiceServer)(nil),
+	Methods: []grpc.MethodDesc{
+		{
+			MethodName: "CodeTransformation",
+			Handler:    _CodeService_CodeTransformation_Handler,
+		},
+	},
+	Streams:  []grpc.StreamDesc{},
+	Metadata: "codeService.proto",
+}

+ 32 - 0
rpc/codeservice/codeservice/codeservice.go

@@ -0,0 +1,32 @@
+// Code generated by goctl. DO NOT EDIT!
+// Source: codeService.proto
+
+package codeservice
+
+import (
+	"context"
+
+	"github.com/zeromicro/go-zero/zrpc"
+	"google.golang.org/grpc"
+)
+
+type (
+	CodeService interface {
+		CodeTransformation(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error)
+	}
+
+	defaultCodeService struct {
+		cli zrpc.Client
+	}
+)
+
+func NewCodeService(cli zrpc.Client) CodeService {
+	return &defaultCodeService{
+		cli: cli,
+	}
+}
+
+func (m *defaultCodeService) CodeTransformation(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) {
+	client := NewCodeServiceClient(m.cli.Conn())
+	return client.CodeTransformation(ctx, in, opts...)
+}

+ 6 - 0
rpc/codeservice/etc/codeservice.yaml

@@ -0,0 +1,6 @@
+Name: codeservice.rpc
+ListenOn: 127.0.0.1:8080
+Etcd:
+  Hosts:
+  - 127.0.0.1:2379
+  Key: codeservice.rpc

+ 45 - 0
rpc/codeservice/etc/db.yaml

@@ -0,0 +1,45 @@
+mysql:
+    main:
+        dbName: jianyu
+        address: 192.168.3.11:3366
+        userName: root
+        password: Topnet123
+        maxOpenConns: 5
+        maxIdleConns: 5
+    baseService:
+        dbName: base_service
+        address: 192.168.3.217:4000
+        userName: root
+        password: '=PDT49#80Z!RVv52_z'
+        maxOpenConns: 5
+        maxIdleConns: 5
+    globalCommonData:
+        dbName: global_common_data
+        address: 192.168.3.217:4000
+        userName: root
+        password: '=PDT49#80Z!RVv52_z'
+        maxOpenConns: 5
+        maxIdleConns: 5
+redis:
+    addr:
+        - other=192.168.3.206:1712
+        - push=192.168.3.206:1712
+        - pushcache_1=127.0.0.1:6379
+        - pushcache_2_a=127.0.0.1:6379
+        - pushcache_2_b=127.0.0.1:6379
+es:
+    addr: http://192.168.3.206:9800
+    size: 30
+mongo:
+    main:
+        dbName: qfw
+        size: 5
+        address: 192.168.3.206:27080
+    bidding:
+        address: 192.168.3.206:27001
+        size: 5
+        dbName: qfw_data
+        collection: bidding
+        collectionChange: bidding_back
+        userName: jyDevGroup
+        password: jy@DevGroup

+ 6 - 0
rpc/codeservice/etc/logs.yaml

@@ -0,0 +1,6 @@
+Mode: file
+Path: ./logs
+Level:
+  - info
+  - error
+KeepDays: 10

+ 37 - 0
rpc/codeservice/init/db.go

@@ -0,0 +1,37 @@
+/*
+初始数据库应用
+*/
+package init
+
+import (
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/entity"
+	"github.com/zeromicro/go-zero/core/logx"
+
+	"app.yhyue.com/moapp/jybase/mongodb"
+	"app.yhyue.com/moapp/jybase/mysql"
+)
+
+var (
+	MainMysql        *mysql.Mysql
+	BaseServiceMysql *mysql.Mysql
+	Mgo              mongodb.MongodbSim
+	MgoBidding       mongodb.MongodbSim
+	GlobalCommonData *mysql.Mysql
+)
+
+//
+func MysqlInit(mm *entity.Mysql) {
+	//初始化 mysql-GlobalCommonData
+	if mm.GlobalCommonData.Address != "" {
+		logx.Info("--初始化 推送 mysql--")
+		GlobalCommonData = &mysql.Mysql{
+			Address:      mm.GlobalCommonData.Address,
+			UserName:     mm.GlobalCommonData.UserName,
+			PassWord:     mm.GlobalCommonData.Password,
+			DBName:       mm.GlobalCommonData.DbName,
+			MaxOpenConns: mm.GlobalCommonData.MaxOpenConns,
+			MaxIdleConns: mm.GlobalCommonData.MaxIdleConns,
+		}
+		GlobalCommonData.Init()
+	}
+}

+ 48 - 0
rpc/codeservice/init/init.go

@@ -0,0 +1,48 @@
+package init
+
+import (
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/entity"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/config"
+	"flag"
+	_ "github.com/go-sql-driver/mysql"
+	"github.com/zeromicro/go-zero/core/conf"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+var configF = flag.String("cf", "etc/codeservice.yaml", "the config file")
+
+var C config.Config
+var err error
+
+//
+var dbFile = flag.String("df", "etc/db.yaml", "the db file")
+var DB config.Db
+
+//
+var logFile = flag.String("lf", "etc/logs.yaml", "the log file")
+var logc entity.Logc
+
+func init() {
+	//初始化数据库配置
+	conf.MustLoad(*dbFile, &DB)
+	//初始化基本配置
+	conf.MustLoad(*configF, &C)
+
+	//初始化msyql
+	MysqlInit(&DB.Mysql)
+	//初始化日志信息
+	conf.MustLoad(*logFile, &logc)
+	if len(logc.Level) > 0 {
+		for _, v := range logc.Level {
+			logx.MustSetup(logx.LogConf{
+				Mode:     logc.Mode,
+				Path:     logc.Path,
+				Level:    v,
+				KeepDays: logc.KeepDays,
+			})
+			logx.Info(v, "--日志记录")
+		}
+	}
+	//代码表初始化
+	//PushMapping.Init(GlobalCommonData)
+}

+ 91 - 0
rpc/codeservice/init/pushmapping.go

@@ -0,0 +1,91 @@
+package init
+
+import (
+	util "app.yhyue.com/moapp/jybase/common"
+	"app.yhyue.com/moapp/jybase/mysql"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
+	"fmt"
+	"log"
+)
+
+var PushMapping = &codeservice.TypeStruct{}
+
+const (
+	CODEAREA          = "code_area"
+	CODEBIDSCOPE      = "code_bidscope"
+	CODEBIDTOPSUBTYPE = "code_bidtopsubtype"
+	CODEBUYERCLASS    = "code_buyerclass"
+)
+
+func Init(Mysql *mysql.Mysql) {
+	//信息类型
+	infotype := Mysql.SelectBySql(fmt.Sprintf("select level,code,name from %s where level=2", CODEBIDTOPSUBTYPE))
+	Subtype := map[string]string{}
+	if infotype != nil && len(*infotype) > 0 {
+		for _, v := range *infotype {
+			code := util.ObjToString(v["code"])
+			name := util.ObjToString(v["name"])
+			Subtype[name] = code
+		}
+		if len(Subtype) == 0 {
+			log.Fatalln("PushMapping Subtype Init Error")
+		}
+		PushMapping.Subtype = Subtype
+	}
+	//采购单位行业
+	Buyerclass := map[string]string{}
+	buyerclass := Mysql.SelectBySql(fmt.Sprintf("select code,name from %s where level=1", CODEBUYERCLASS))
+	if buyerclass != nil && len(*buyerclass) > 0 {
+		for _, v := range *buyerclass {
+			code := util.ObjToString(v["code"])
+			name := util.ObjToString(v["name"])
+			Buyerclass[name] = code
+		}
+
+		if len(Buyerclass) == 0 {
+			log.Fatalln("PushMapping Buyerclass Init Error")
+		}
+		PushMapping.Buyerclass = Buyerclass
+	}
+
+	//公告类型处理
+	Subscopeclass := map[string]string{}
+	subscopeclass := Mysql.SelectBySql(fmt.Sprintf("select a.code, CONCAT(b.name,'_',a.name) as name  from %s a LEFT JOIN %s b on a.pcode=b.code where  a.level=2", CODEBIDSCOPE, CODEBIDSCOPE))
+	if subscopeclass != nil && len(*subscopeclass) > 0 {
+		for _, v := range *subscopeclass {
+			code := util.ObjToString(v["code"])
+			name := util.ObjToString(v["name"])
+			Subscopeclass[name] = code
+		}
+
+		if len(Subscopeclass) == 0 {
+			log.Fatalln("PushMapping subscopeclass Init Error")
+		}
+		PushMapping.Subtype = Subtype
+	}
+	//省份处理
+	Area := map[string]string{}
+	City := map[string]string{}
+	province := Mysql.SelectBySql(fmt.Sprintf("select code,area,city from %s where (district is null or district='')", CODEAREA))
+	if province != nil && len(*province) > 0 {
+		for _, v := range *province {
+			code := util.ObjToString(v["code"])
+			city := util.ObjToString(v["city"])
+			area := util.ObjToString(v["area"])
+			if city == "" {
+				Area[area] = code
+			} else {
+				City[city] = code
+			}
+		}
+		if len(Area) == 0 {
+			log.Fatalln("PushMapping Area Init Error")
+		}
+		if len(City) == 0 {
+			log.Fatalln("PushMapping City Init Error")
+		}
+		PushMapping.Area = Area
+		PushMapping.City = City
+	}
+
+}

+ 13 - 0
rpc/codeservice/internal/config/config.go

@@ -0,0 +1,13 @@
+package config
+
+import (
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/entity"
+	"github.com/zeromicro/go-zero/zrpc"
+)
+
+type Config struct {
+	zrpc.RpcServerConf
+}
+type Db struct {
+	Mysql entity.Mysql `json:"mysql"`
+}

+ 37 - 0
rpc/codeservice/internal/logic/codetransformationlogic.go

@@ -0,0 +1,37 @@
+package logic
+
+import (
+	IC "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/init"
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/svc"
+
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type CodeTransformationLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewCodeTransformationLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CodeTransformationLogic {
+	return &CodeTransformationLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *CodeTransformationLogic) CodeTransformation(in *codeservice.Request) (*codeservice.Response, error) {
+	// todo: add your logic here and delete this line
+	logx.Info("代码表获取")
+	logx.Info(IC.CODEAREA)
+	logx.Info("Area", IC.PushMapping.Area)
+	logx.Info("City", IC.PushMapping.City)
+	logx.Info("Buyerclass", IC.PushMapping.Buyerclass)
+	logx.Info("Subscopeclass", IC.PushMapping.Subscopeclass)
+	logx.Info("Subtype", IC.PushMapping.Subtype)
+	return &codeservice.Response{}, nil
+}

+ 28 - 0
rpc/codeservice/internal/server/codeserviceserver.go

@@ -0,0 +1,28 @@
+// Code generated by goctl. DO NOT EDIT!
+// Source: codeService.proto
+
+package server
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/codeservice"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/logic"
+	"bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/svc"
+)
+
+type CodeServiceServer struct {
+	svcCtx *svc.ServiceContext
+	codeservice.UnimplementedCodeServiceServer
+}
+
+func NewCodeServiceServer(svcCtx *svc.ServiceContext) *CodeServiceServer {
+	return &CodeServiceServer{
+		svcCtx: svcCtx,
+	}
+}
+
+func (s *CodeServiceServer) CodeTransformation(ctx context.Context, in *codeservice.Request) (*codeservice.Response, error) {
+	l := logic.NewCodeTransformationLogic(ctx, s.svcCtx)
+	return l.CodeTransformation(in)
+}

+ 13 - 0
rpc/codeservice/internal/svc/servicecontext.go

@@ -0,0 +1,13 @@
+package svc
+
+import "bp.jydev.jianyu360.cn/BaseService/jyCodeService/rpc/codeservice/internal/config"
+
+type ServiceContext struct {
+	Config config.Config
+}
+
+func NewServiceContext(c config.Config) *ServiceContext {
+	return &ServiceContext{
+		Config: c,
+	}
+}