xuzhiheng 1 éve
szülő
commit
55c6c111f0

+ 19 - 0
api/biService.api

@@ -52,6 +52,23 @@ type (
 		PositionId int64  `header:"positionId,optional"`
 		Pcbh       string `json:"pcbh"`
 	}
+
+	ClueAddReq {
+		Phone            string `json:"phone"`
+		Username         string `json:"username"`
+		Source           string `json:"source"`
+		Status999        string `json:"status999"`
+		Owner            string `json:"owner"`
+		EmpNo            string `json:"empNo"`
+		Company          string `json:"company"`
+		IsPolicymaker    string `json:"isPolicymaker"`
+		BelongToIndustry string `json:"belongToIndustry"`
+		Job              string `json:"job"`
+		CustomerNeeds    string `json:"customerNeeds"`
+		BelongTo         string `json:"belongTo"`
+		WantGoods        string `json:"wantGoods"`
+		CustomerBudget   string `json:"customerBudget"`
+	}
 )
 
 service biService-api {
@@ -69,4 +86,6 @@ service biService-api {
 	post /biService/distributeClue (DistributeClueReq) returns (resp)
 	@handler ClueImport
 	post /biService/clueImport (ClueImportReq) returns (resp)
+	@handler ClueAdd
+	post /biService/ClueAdd (ClueAddReq) returns (resp)
 }

+ 28 - 0
api/internal/handler/clueaddhandler.go

@@ -0,0 +1,28 @@
+package handler
+
+import (
+	"net/http"
+
+	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/logic"
+	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
+	"github.com/zeromicro/go-zero/rest/httpx"
+)
+
+func ClueAddHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ClueAddReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewClueAddLogic(r.Context(), svcCtx)
+		resp, err := l.ClueAdd(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

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

@@ -47,6 +47,11 @@ func RegisterHandlers(server *rest.Server, serverCtx *svc.ServiceContext) {
 				Path:    "/biService/clueImport",
 				Handler: ClueImportHandler(serverCtx),
 			},
+			{
+				Method:  http.MethodPost,
+				Path:    "/biService/ClueAdd",
+				Handler: ClueAddHandler(serverCtx),
+			},
 		},
 	)
 }

+ 45 - 0
api/internal/logic/clueaddlogic.go

@@ -0,0 +1,45 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/biService/api/internal/types"
+	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ClueAddLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewClueAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClueAddLogic {
+	return &ClueAddLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ClueAddLogic) ClueAdd(req *types.ClueAddReq) (resp *types.Resp, err error) {
+	// todo: add your logic here and delete this line
+	res, err := l.svcCtx.BiServiceRpc.ClueAdd(l.ctx, &biservice.ClueAddReq{
+		Phone:            req.Phone,
+		Username:         req.Username,
+		Source:           req.Source,
+		Status999:        req.Status999,
+		Owner:            req.Owner,
+		EmpNo:            req.EmpNo,
+		Company:          req.Company,
+		IsPolicymaker:    req.IsPolicymaker,
+		BelongToIndustry: req.BelongToIndustry,
+		Job:              req.Job,
+		CustomerNeeds:    req.CustomerNeeds,
+		BelongTo:         req.BelongTo,
+		WantGoods:        req.WantGoods,
+		CustomerBudget:   req.CustomerBudget,
+	})
+	return &types.Resp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: res.Data}, err
+}

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

@@ -52,3 +52,20 @@ type ClueImportReq struct {
 	PositionId int64  `header:"positionId,optional"`
 	Pcbh       string `json:"pcbh"`
 }
+
+type ClueAddReq struct {
+	Phone            string `json:"phone"`
+	Username         string `json:"username"`
+	Source           string `json:"source"`
+	Status999        string `json:"status999"`
+	Owner            string `json:"owner"`
+	EmpNo            string `json:"empNo"`
+	Company          string `json:"company"`
+	IsPolicymaker    string `json:"isPolicymaker"`
+	BelongToIndustry string `json:"belongToIndustry"`
+	Job              string `json:"job"`
+	CustomerNeeds    string `json:"customerNeeds"`
+	BelongTo         string `json:"belongTo"`
+	WantGoods        string `json:"wantGoods"`
+	CustomerBudget   string `json:"customerBudget"`
+}

+ 11 - 1
entity/entity.go

@@ -23,6 +23,7 @@ var (
 	JyBiMysql      *mysql.Mysql
 	JyTidb         *mysql.Mysql
 	JyBiTidb       *mysql.Mysql
+	CallTidb       *mysql.Mysql
 	Mgo            *mongodb.MongodbSim
 	Es             elastic.Es
 	AreaCode       = map[string]string{}
@@ -56,7 +57,7 @@ type HlyjS struct {
 type Handler struct {
 }
 
-func InitMysql(n, x, y, z, s *mysql.Mysql) {
+func InitMysql(n, x, y, z, s, m *mysql.Mysql) {
 	JyMysql = &mysql.Mysql{
 		Address:      n.Address,
 		UserName:     n.UserName,
@@ -102,6 +103,15 @@ func InitMysql(n, x, y, z, s *mysql.Mysql) {
 		MaxIdleConns: s.MaxIdleConns,
 	}
 	JyBiTidb.Init()
+	CallTidb = &mysql.Mysql{
+		Address:      m.Address,
+		UserName:     m.UserName,
+		PassWord:     m.PassWord,
+		DBName:       m.DBName,
+		MaxOpenConns: m.MaxOpenConns,
+		MaxIdleConns: m.MaxIdleConns,
+	}
+	CallTidb.Init()
 	logx.Info("初始化mysql")
 }
 

+ 18 - 0
rpc/biService.proto

@@ -100,6 +100,23 @@ message ClueImport {
 	string result = 2;
 }
 
+message ClueAddReq {
+	string phone = 1;
+	string username = 2;
+	string source = 3;
+	string status999 = 4;
+	string owner = 5;
+	string empNo = 6;
+	string company = 7;
+	string isPolicymaker = 8;
+	string belongToIndustry = 9;
+	string job = 10;
+	string customerNeeds = 11;
+	string belongTo = 12;
+	string wantGoods = 13;
+	string customerBudget = 14;
+}
+
 service BiService {
 	rpc myDataAsset (MyDataAssetReq) returns (MyDataAssetResp); //我的数据资产
 	rpc addProject (AddProjectReq) returns (AddProjectResp); //添加项目
@@ -108,4 +125,5 @@ service BiService {
 	rpc Call (CallReq) returns (Resp); //外呼集成
 	rpc distributeClue (DistributeClueReq) returns (AddProjectResp); //批量分配
 	rpc clueImport (ClueImportReq) returns (ClueImportResp); //线索导入
+	rpc clueAdd (ClueAddReq) returns (AddProjectResp); //合力亿捷新增线索
 }

+ 1 - 1
rpc/biservice.go

@@ -27,7 +27,7 @@ func main() {
 	conf.MustLoad(*configFile, &c)
 	ctx := svc.NewServiceContext(c)
 	srv := server.NewBiServiceServer(ctx)
-	entity.InitMysql(c.Mysql.JianYu, c.Mysql.JyDoc, c.Mysql.Bi, c.Mysql.Tidb, c.Mysql.BiTidb)
+	entity.InitMysql(c.Mysql.JianYu, c.Mysql.JyDoc, c.Mysql.Bi, c.Mysql.Tidb, c.Mysql.BiTidb, c.Mysql.CallTidb)
 	entity.InitMongo(c.Mongo.Qfw.MongodbAddr, c.Mongo.Qfw.DbName, c.Mongo.Qfw.Size)
 	entity.InitEs(c.Es.Version, c.Es.Address, c.Es.UserName, c.Es.Password, c.Es.DbSize)
 	entity.InitArea()

+ 7 - 0
rpc/biservice/biservice.go

@@ -17,6 +17,7 @@ type (
 	AddProjectReq     = pb.AddProjectReq
 	AddProjectResp    = pb.AddProjectResp
 	CallReq           = pb.CallReq
+	ClueAddReq        = pb.ClueAddReq
 	ClueImport        = pb.ClueImport
 	ClueImportReq     = pb.ClueImportReq
 	ClueImportResp    = pb.ClueImportResp
@@ -37,6 +38,7 @@ type (
 		Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Resp, error)
 		DistributeClue(ctx context.Context, in *DistributeClueReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 		ClueImport(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error)
+		ClueAdd(ctx context.Context, in *ClueAddReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 	}
 
 	defaultBiService struct {
@@ -84,3 +86,8 @@ func (m *defaultBiService) ClueImport(ctx context.Context, in *ClueImportReq, op
 	client := pb.NewBiServiceClient(m.cli.Conn())
 	return client.ClueImport(ctx, in, opts...)
 }
+
+func (m *defaultBiService) ClueAdd(ctx context.Context, in *ClueAddReq, opts ...grpc.CallOption) (*AddProjectResp, error) {
+	client := pb.NewBiServiceClient(m.cli.Conn())
+	return client.ClueAdd(ctx, in, opts...)
+}

+ 14 - 0
rpc/etc/biservice.yaml

@@ -41,6 +41,20 @@ Mysql:
     PassWord: "Xzh#20221122K"
     MaxOpenConns: 5
     MaxIdleConns: 5
+  BiTidb:
+    DBName: jianyu_subjectdb_test
+    Address: 192.168.3.149:4000
+    UserName: xuzhiheng
+    PassWord: "Xzh#20221122K"
+    MaxOpenConns: 5
+    MaxIdleConns: 5
+  CallTidb:
+    DBName: Call_Accounting
+    Address: 192.168.3.149:4000
+    UserName: xuzhiheng
+    PassWord: "Xzh#20221122K"
+    MaxOpenConns: 5
+    MaxIdleConns: 5
 Mongo:
   Qfw:
     MongodbAddr: 192.168.3.206:27080

+ 6 - 5
rpc/internal/config/config.go

@@ -11,11 +11,12 @@ type Config struct {
 	UserCenterRpc zrpc.RpcClientConf
 	Logx          logx.LogConf
 	Mysql         struct {
-		JianYu *mysql.Mysql
-		JyDoc  *mysql.Mysql
-		Bi     *mysql.Mysql
-		Tidb   *mysql.Mysql
-		BiTidb *mysql.Mysql
+		JianYu   *mysql.Mysql
+		JyDoc    *mysql.Mysql
+		Bi       *mysql.Mysql
+		Tidb     *mysql.Mysql
+		BiTidb   *mysql.Mysql
+		CallTidb *mysql.Mysql
 	}
 	Mongo struct {
 		Qfw struct {

+ 30 - 0
rpc/internal/logic/clueaddlogic.go

@@ -0,0 +1,30 @@
+package logic
+
+import (
+	"context"
+
+	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/internal/svc"
+	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/pb"
+	"bp.jydev.jianyu360.cn/BaseService/biService/service"
+	"github.com/zeromicro/go-zero/core/logx"
+)
+
+type ClueAddLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewClueAddLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClueAddLogic {
+	return &ClueAddLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *ClueAddLogic) ClueAdd(in *pb.ClueAddReq) (*pb.AddProjectResp, error) {
+	// todo: add your logic here and delete this line
+
+	return service.ClueAdd(in), nil
+}

+ 5 - 0
rpc/internal/server/biserviceserver.go

@@ -56,3 +56,8 @@ func (s *BiServiceServer) ClueImport(ctx context.Context, in *pb.ClueImportReq)
 	l := logic.NewClueImportLogic(ctx, s.svcCtx)
 	return l.ClueImport(in)
 }
+
+func (s *BiServiceServer) ClueAdd(ctx context.Context, in *pb.ClueAddReq) (*pb.AddProjectResp, error) {
+	l := logic.NewClueAddLogic(ctx, s.svcCtx)
+	return l.ClueAdd(in)
+}

+ 228 - 33
rpc/pb/biService.pb.go

@@ -1029,6 +1029,157 @@ func (x *ClueImport) GetResult() string {
 	return ""
 }
 
+type ClueAddReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Phone            string `protobuf:"bytes,1,opt,name=phone,proto3" json:"phone,omitempty"`
+	Username         string `protobuf:"bytes,2,opt,name=username,proto3" json:"username,omitempty"`
+	Source           string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"`
+	Status999        string `protobuf:"bytes,4,opt,name=status999,proto3" json:"status999,omitempty"`
+	Owner            string `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"`
+	EmpNo            string `protobuf:"bytes,6,opt,name=empNo,proto3" json:"empNo,omitempty"`
+	Company          string `protobuf:"bytes,7,opt,name=company,proto3" json:"company,omitempty"`
+	IsPolicymaker    string `protobuf:"bytes,8,opt,name=isPolicymaker,proto3" json:"isPolicymaker,omitempty"`
+	BelongToIndustry string `protobuf:"bytes,9,opt,name=belongToIndustry,proto3" json:"belongToIndustry,omitempty"`
+	Job              string `protobuf:"bytes,10,opt,name=job,proto3" json:"job,omitempty"`
+	CustomerNeeds    string `protobuf:"bytes,11,opt,name=customerNeeds,proto3" json:"customerNeeds,omitempty"`
+	BelongTo         string `protobuf:"bytes,12,opt,name=belongTo,proto3" json:"belongTo,omitempty"`
+	WantGoods        string `protobuf:"bytes,13,opt,name=wantGoods,proto3" json:"wantGoods,omitempty"`
+	CustomerBudget   string `protobuf:"bytes,14,opt,name=customerBudget,proto3" json:"customerBudget,omitempty"`
+}
+
+func (x *ClueAddReq) Reset() {
+	*x = ClueAddReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_biService_proto_msgTypes[15]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *ClueAddReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ClueAddReq) ProtoMessage() {}
+
+func (x *ClueAddReq) ProtoReflect() protoreflect.Message {
+	mi := &file_biService_proto_msgTypes[15]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use ClueAddReq.ProtoReflect.Descriptor instead.
+func (*ClueAddReq) Descriptor() ([]byte, []int) {
+	return file_biService_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *ClueAddReq) GetPhone() string {
+	if x != nil {
+		return x.Phone
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetUsername() string {
+	if x != nil {
+		return x.Username
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetSource() string {
+	if x != nil {
+		return x.Source
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetStatus999() string {
+	if x != nil {
+		return x.Status999
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetOwner() string {
+	if x != nil {
+		return x.Owner
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetEmpNo() string {
+	if x != nil {
+		return x.EmpNo
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetCompany() string {
+	if x != nil {
+		return x.Company
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetIsPolicymaker() string {
+	if x != nil {
+		return x.IsPolicymaker
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetBelongToIndustry() string {
+	if x != nil {
+		return x.BelongToIndustry
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetJob() string {
+	if x != nil {
+		return x.Job
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetCustomerNeeds() string {
+	if x != nil {
+		return x.CustomerNeeds
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetBelongTo() string {
+	if x != nil {
+		return x.BelongTo
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetWantGoods() string {
+	if x != nil {
+		return x.WantGoods
+	}
+	return ""
+}
+
+func (x *ClueAddReq) GetCustomerBudget() string {
+	if x != nil {
+		return x.CustomerBudget
+	}
+	return ""
+}
+
 var File_biService_proto protoreflect.FileDescriptor
 
 var file_biService_proto_rawDesc = []byte{
@@ -1150,28 +1301,57 @@ var file_biService_proto_rawDesc = []byte{
 	0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75,
 	0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
 	0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x32, 0xc3, 0x02, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65,
-	0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x30, 0x0a, 0x0b, 0x6d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41,
-	0x73, 0x73, 0x65, 0x74, 0x12, 0x0f, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73,
-	0x65, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10, 0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73,
-	0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x50, 0x72,
-	0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65,
-	0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65,
-	0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2b, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66,
-	0x6f, 0x49, 0x64, 0x12, 0x0e, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74,
-	0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52,
-	0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x08, 0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12,
-	0x0c, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e,
-	0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17,
-	0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12, 0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71,
-	0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x35, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x74, 0x72,
-	0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x2e, 0x44, 0x69, 0x73, 0x74,
-	0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e,
-	0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d,
-	0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x2e, 0x43,
-	0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x43,
-	0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a,
-	0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x22, 0xa6, 0x03, 0x0a, 0x0a, 0x43, 0x6c, 0x75, 0x65,
+	0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x18,
+	0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x1a, 0x0a, 0x08,
+	0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+	0x75, 0x73, 0x65, 0x72, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72,
+	0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+	0x12, 0x1c, 0x0a, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x39, 0x39, 0x39, 0x18, 0x04, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x09, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x39, 0x39, 0x39, 0x12, 0x14,
+	0x0a, 0x05, 0x6f, 0x77, 0x6e, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f,
+	0x77, 0x6e, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x6d, 0x70, 0x4e, 0x6f, 0x18, 0x06, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x6d, 0x70, 0x4e, 0x6f, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
+	0x6d, 0x70, 0x61, 0x6e, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6d,
+	0x70, 0x61, 0x6e, 0x79, 0x12, 0x24, 0x0a, 0x0d, 0x69, 0x73, 0x50, 0x6f, 0x6c, 0x69, 0x63, 0x79,
+	0x6d, 0x61, 0x6b, 0x65, 0x72, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x69, 0x73, 0x50,
+	0x6f, 0x6c, 0x69, 0x63, 0x79, 0x6d, 0x61, 0x6b, 0x65, 0x72, 0x12, 0x2a, 0x0a, 0x10, 0x62, 0x65,
+	0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x49, 0x6e, 0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x18, 0x09,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x49, 0x6e,
+	0x64, 0x75, 0x73, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6a, 0x6f, 0x62, 0x18, 0x0a, 0x20,
+	0x01, 0x28, 0x09, 0x52, 0x03, 0x6a, 0x6f, 0x62, 0x12, 0x24, 0x0a, 0x0d, 0x63, 0x75, 0x73, 0x74,
+	0x6f, 0x6d, 0x65, 0x72, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x0d, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x4e, 0x65, 0x65, 0x64, 0x73, 0x12, 0x1a,
+	0x0a, 0x08, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x08, 0x62, 0x65, 0x6c, 0x6f, 0x6e, 0x67, 0x54, 0x6f, 0x12, 0x1c, 0x0a, 0x09, 0x77, 0x61,
+	0x6e, 0x74, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x77,
+	0x61, 0x6e, 0x74, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x12, 0x26, 0x0a, 0x0e, 0x63, 0x75, 0x73, 0x74,
+	0x6f, 0x6d, 0x65, 0x72, 0x42, 0x75, 0x64, 0x67, 0x65, 0x74, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x09,
+	0x52, 0x0e, 0x63, 0x75, 0x73, 0x74, 0x6f, 0x6d, 0x65, 0x72, 0x42, 0x75, 0x64, 0x67, 0x65, 0x74,
+	0x32, 0xec, 0x02, 0x0a, 0x09, 0x42, 0x69, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x30,
+	0x0a, 0x0b, 0x6d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x12, 0x0f, 0x2e,
+	0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x10,
+	0x2e, 0x4d, 0x79, 0x44, 0x61, 0x74, 0x61, 0x41, 0x73, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x2d, 0x0a, 0x0a, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x0e,
+	0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f,
+	0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x2b, 0x0a, 0x09, 0x67, 0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x12, 0x0e, 0x2e, 0x41,
+	0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0e, 0x2e, 0x47,
+	0x65, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x29, 0x0a, 0x08,
+	0x64, 0x72, 0x61, 0x77, 0x43, 0x6c, 0x75, 0x65, 0x12, 0x0c, 0x2e, 0x44, 0x72, 0x61, 0x77, 0x43,
+	0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a,
+	0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x17, 0x0a, 0x04, 0x43, 0x61, 0x6c, 0x6c, 0x12,
+	0x08, 0x2e, 0x43, 0x61, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x1a, 0x05, 0x2e, 0x52, 0x65, 0x73, 0x70,
+	0x12, 0x35, 0x0a, 0x0e, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43, 0x6c,
+	0x75, 0x65, 0x12, 0x12, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x43,
+	0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a,
+	0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x65, 0x49,
+	0x6d, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x0e, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f,
+	0x72, 0x74, 0x52, 0x65, 0x71, 0x1a, 0x0f, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f,
+	0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x07, 0x63, 0x6c, 0x75, 0x65, 0x41, 0x64,
+	0x64, 0x12, 0x0b, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x41, 0x64, 0x64, 0x52, 0x65, 0x71, 0x1a, 0x0f,
+	0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x42,
+	0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -1186,7 +1366,7 @@ func file_biService_proto_rawDescGZIP() []byte {
 	return file_biService_proto_rawDescData
 }
 
-var file_biService_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
+var file_biService_proto_msgTypes = make([]protoimpl.MessageInfo, 16)
 var file_biService_proto_goTypes = []interface{}{
 	(*MyDataAssetReq)(nil),    // 0: MyDataAssetReq
 	(*MyDataAssetResp)(nil),   // 1: MyDataAssetResp
@@ -1203,6 +1383,7 @@ var file_biService_proto_goTypes = []interface{}{
 	(*ClueImportReq)(nil),     // 12: ClueImportReq
 	(*ClueImportResp)(nil),    // 13: ClueImportResp
 	(*ClueImport)(nil),        // 14: ClueImport
+	(*ClueAddReq)(nil),        // 15: ClueAddReq
 }
 var file_biService_proto_depIdxs = []int32{
 	2,  // 0: MyDataAssetResp.data:type_name -> MyDataAsset
@@ -1216,15 +1397,17 @@ var file_biService_proto_depIdxs = []int32{
 	8,  // 8: BiService.Call:input_type -> CallReq
 	10, // 9: BiService.distributeClue:input_type -> DistributeClueReq
 	12, // 10: BiService.clueImport:input_type -> ClueImportReq
-	1,  // 11: BiService.myDataAsset:output_type -> MyDataAssetResp
-	4,  // 12: BiService.addProject:output_type -> AddProjectResp
-	6,  // 13: BiService.getInfoId:output_type -> GetInfoIdResp
-	4,  // 14: BiService.drawClue:output_type -> AddProjectResp
-	9,  // 15: BiService.Call:output_type -> Resp
-	4,  // 16: BiService.distributeClue:output_type -> AddProjectResp
-	13, // 17: BiService.clueImport:output_type -> ClueImportResp
-	11, // [11:18] is the sub-list for method output_type
-	4,  // [4:11] is the sub-list for method input_type
+	15, // 11: BiService.clueAdd:input_type -> ClueAddReq
+	1,  // 12: BiService.myDataAsset:output_type -> MyDataAssetResp
+	4,  // 13: BiService.addProject:output_type -> AddProjectResp
+	6,  // 14: BiService.getInfoId:output_type -> GetInfoIdResp
+	4,  // 15: BiService.drawClue:output_type -> AddProjectResp
+	9,  // 16: BiService.Call:output_type -> Resp
+	4,  // 17: BiService.distributeClue:output_type -> AddProjectResp
+	13, // 18: BiService.clueImport:output_type -> ClueImportResp
+	4,  // 19: BiService.clueAdd:output_type -> AddProjectResp
+	12, // [12:20] is the sub-list for method output_type
+	4,  // [4:12] is the sub-list for method input_type
 	4,  // [4:4] is the sub-list for extension type_name
 	4,  // [4:4] is the sub-list for extension extendee
 	0,  // [0:4] is the sub-list for field type_name
@@ -1416,6 +1599,18 @@ func file_biService_proto_init() {
 				return nil
 			}
 		}
+		file_biService_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*ClueAddReq); 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{
@@ -1423,7 +1618,7 @@ func file_biService_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_biService_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   15,
+			NumMessages:   16,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

+ 37 - 0
rpc/pb/biService_grpc.pb.go

@@ -26,6 +26,7 @@ const (
 	BiService_Call_FullMethodName           = "/BiService/Call"
 	BiService_DistributeClue_FullMethodName = "/BiService/distributeClue"
 	BiService_ClueImport_FullMethodName     = "/BiService/clueImport"
+	BiService_ClueAdd_FullMethodName        = "/BiService/clueAdd"
 )
 
 // BiServiceClient is the client API for BiService service.
@@ -39,6 +40,7 @@ type BiServiceClient interface {
 	Call(ctx context.Context, in *CallReq, opts ...grpc.CallOption) (*Resp, error)
 	DistributeClue(ctx context.Context, in *DistributeClueReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 	ClueImport(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error)
+	ClueAdd(ctx context.Context, in *ClueAddReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 }
 
 type biServiceClient struct {
@@ -112,6 +114,15 @@ func (c *biServiceClient) ClueImport(ctx context.Context, in *ClueImportReq, opt
 	return out, nil
 }
 
+func (c *biServiceClient) ClueAdd(ctx context.Context, in *ClueAddReq, opts ...grpc.CallOption) (*AddProjectResp, error) {
+	out := new(AddProjectResp)
+	err := c.cc.Invoke(ctx, BiService_ClueAdd_FullMethodName, in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // BiServiceServer is the server API for BiService service.
 // All implementations must embed UnimplementedBiServiceServer
 // for forward compatibility
@@ -123,6 +134,7 @@ type BiServiceServer interface {
 	Call(context.Context, *CallReq) (*Resp, error)
 	DistributeClue(context.Context, *DistributeClueReq) (*AddProjectResp, error)
 	ClueImport(context.Context, *ClueImportReq) (*ClueImportResp, error)
+	ClueAdd(context.Context, *ClueAddReq) (*AddProjectResp, error)
 	mustEmbedUnimplementedBiServiceServer()
 }
 
@@ -151,6 +163,9 @@ func (UnimplementedBiServiceServer) DistributeClue(context.Context, *DistributeC
 func (UnimplementedBiServiceServer) ClueImport(context.Context, *ClueImportReq) (*ClueImportResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ClueImport not implemented")
 }
+func (UnimplementedBiServiceServer) ClueAdd(context.Context, *ClueAddReq) (*AddProjectResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ClueAdd not implemented")
+}
 func (UnimplementedBiServiceServer) mustEmbedUnimplementedBiServiceServer() {}
 
 // UnsafeBiServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -290,6 +305,24 @@ func _BiService_ClueImport_Handler(srv interface{}, ctx context.Context, dec fun
 	return interceptor(ctx, in, info, handler)
 }
 
+func _BiService_ClueAdd_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ClueAddReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BiServiceServer).ClueAdd(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: BiService_ClueAdd_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BiServiceServer).ClueAdd(ctx, req.(*ClueAddReq))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // BiService_ServiceDesc is the grpc.ServiceDesc for BiService service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -325,6 +358,10 @@ var BiService_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "clueImport",
 			Handler:    _BiService_ClueImport_Handler,
 		},
+		{
+			MethodName: "clueAdd",
+			Handler:    _BiService_ClueAdd_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "biService.proto",

+ 80 - 0
service/clue.go

@@ -2,9 +2,12 @@ package service
 
 import (
 	"database/sql"
+	"encoding/json"
 	"fmt"
+	"io/ioutil"
 	"log"
 	"math"
+	"net/http"
 	"regexp"
 	"sync"
 	"time"
@@ -16,6 +19,49 @@ import (
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
 )
 
+func ClueAdd(this *biservice.ClueAddReq) *biservice.AddProjectResp {
+	status := 1
+	nowTime := time.Now().Format(date.Date_Full_Layout)
+	saveMap := map[string]interface{}{
+		"unique_id":        this.Phone,
+		"phone":            this.Phone,
+		"username":         this.Username,
+		"source":           this.Source,
+		"status999":        this.Status999,
+		"owner":            this.Owner,
+		"empNo":            this.EmpNo,
+		"company":          this.Company,
+		"isPolicymaker":    this.IsPolicymaker,
+		"belongToIndustry": this.BelongToIndustry,
+		"job":              this.Job,
+		"customerNeeds":    this.CustomerNeeds,
+		"belongTo":         this.BelongTo,
+		"wantGoods":        this.WantGoods,
+		"customerBudget":   this.CustomerBudget,
+		"createTime":       nowTime,
+		"lastUpdateTime":   nowTime,
+	}
+	dataStr, _ := json.Marshal(&saveMap)
+	token := getToken()
+	url := `https://a1.7x24cc.com/commonInte?flag=1007&account=N000000029739&accessToken=` + token + `&json={"dbType":"0001","customerList":[` + string(dataStr) + `]}`
+	bs, err := doGet(url)
+	if err != nil {
+		status = -1
+		log.Println("调用接口失败")
+	} else {
+		resMap := common.StringToMap(string(bs))
+		if resMap["success"].(bool) {
+			CallTidb.Insert("customer", saveMap)
+		}
+	}
+	return &biservice.AddProjectResp{
+		ErrorCode: 0,
+		Data: &biservice.AddProject{
+			Status: int64(status),
+		},
+	}
+}
+
 func DistributeClue(this *biservice.DistributeClueReq) *biservice.AddProjectResp {
 	count, status := DistributeClueSync(this)
 	log.Println("分配数量 ", count)
@@ -28,6 +74,20 @@ func DistributeClue(this *biservice.DistributeClueReq) *biservice.AddProjectResp
 	}
 }
 
+func getToken() string {
+	url := "https://a1.7x24cc.com/accessToken?account=N000000029739&appid=w4w2ex0bnt1n61or&secret=3c8f7dd04d2c11edb786132b38c4d48a"
+	bs, err := doGet(url)
+	if err != nil {
+		log.Println("token生成失败", err)
+		return ""
+	}
+	tokenMap := common.StringToMap(string(bs))
+	if tokenMap["success"].(bool) {
+		return common.ObjToString(tokenMap["accessToken"])
+	}
+	return ""
+}
+
 func DistributeClueSync(this *biservice.DistributeClueReq) (int, int) {
 	if DistributeLock.TryLock() {
 		defer DistributeLock.Unlock()
@@ -874,3 +934,23 @@ func ClueImportSync(this *biservice.ClueImportReq) (string, int) {
 		return "有正在进行的导入任务", 2
 	}
 }
+
+func doGet(url string) ([]byte, error) {
+	req, err := http.NewRequest("GET", url, nil)
+	if err != nil {
+		return nil, err
+	}
+	resp, err := http.DefaultClient.Do(req)
+	if err != nil {
+		return nil, err
+	}
+	bs, err := ioutil.ReadAll(resp.Body)
+	if err != nil {
+		return nil, err
+	}
+	defer func() {
+		_ = resp.Body.Close()
+	}()
+	log.Println(url, "调用结果 ", string(bs))
+	return bs, nil
+}