xuzhiheng 1 жил өмнө
parent
commit
81a57f6577

+ 2 - 0
api/biService.api

@@ -88,4 +88,6 @@ service biService-api {
 	post /biService/clueImport (ClueImportReq) returns (resp)
 	@handler ClueAdd
 	post /biService/ClueAdd (ClueAddReq) returns (resp)
+	@handler ClueImportTl
+	post /biService/clueImportTt (ClueImportReq) returns (resp)
 }

+ 28 - 0
api/internal/handler/clueimporttlhandler.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 ClueImportTlHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
+	return func(w http.ResponseWriter, r *http.Request) {
+		var req types.ClueImportReq
+		if err := httpx.Parse(r, &req); err != nil {
+			httpx.Error(w, err)
+			return
+		}
+
+		l := logic.NewClueImportTlLogic(r.Context(), svcCtx)
+		resp, err := l.ClueImportTl(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

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

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

+ 32 - 0
api/internal/logic/clueimporttllogic.go

@@ -0,0 +1,32 @@
+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 ClueImportTlLogic struct {
+	logx.Logger
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+}
+
+func NewClueImportTlLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClueImportTlLogic {
+	return &ClueImportTlLogic{
+		Logger: logx.WithContext(ctx),
+		ctx:    ctx,
+		svcCtx: svcCtx,
+	}
+}
+
+func (l *ClueImportTlLogic) ClueImportTl(req *types.ClueImportReq) (resp *types.Resp, err error) {
+	// todo: add your logic here and delete this line
+	res, err := l.svcCtx.BiServiceRpc.ClueImportTt(l.ctx, &biservice.ClueImportReq{
+		Pcbh: req.Pcbh,
+	})
+	return &types.Resp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: res.Data}, err
+}

+ 31 - 15
entity/entity.go

@@ -18,20 +18,23 @@ import (
 )
 
 var (
-	JyMysql        *mysql.Mysql
-	JyDocMysql     *mysql.Mysql
-	JyBiMysql      *mysql.Mysql
-	JyTidb         *mysql.Mysql
-	JyBiTidb       *mysql.Mysql
-	CallTidb       *mysql.Mysql
-	Mgo            *mongodb.MongodbSim
-	Es             elastic.Es
-	AreaCode       = map[string]string{}
-	Hlyj           *HlyjS
-	DataLock       = sync.Mutex{}
-	DistributeLock = sync.Mutex{}
-	ClueImportLock = sync.Mutex{}
-	CodeTrail      = map[string]string{
+	JyMysql          *mysql.Mysql
+	JyDocMysql       *mysql.Mysql
+	JyBiMysql        *mysql.Mysql
+	JyTidb           *mysql.Mysql
+	JyBiTidb         *mysql.Mysql
+	CallTidb         *mysql.Mysql
+	BiService        *mysql.Mysql
+	Mgo              *mongodb.MongodbSim
+	Bidding          *mongodb.MongodbSim
+	Es               elastic.Es
+	AreaCode         = map[string]string{}
+	Hlyj             *HlyjS
+	DataLock         = sync.Mutex{}
+	DistributeLock   = sync.Mutex{}
+	ClueImportLock   = sync.Mutex{}
+	ClueImportTtLock = sync.Mutex{}
+	CodeTrail        = map[string]string{
 		"00": "无意向客户",
 		"01": "商机线索",
 		"02": "空号停机",
@@ -57,7 +60,7 @@ type HlyjS struct {
 type Handler struct {
 }
 
-func InitMysql(n, x, y, z, s, m *mysql.Mysql) {
+func InitMysql(n, x, y, z, s, m, a *mysql.Mysql) {
 	JyMysql = &mysql.Mysql{
 		Address:      n.Address,
 		UserName:     n.UserName,
@@ -112,6 +115,15 @@ func InitMysql(n, x, y, z, s, m *mysql.Mysql) {
 		MaxIdleConns: m.MaxIdleConns,
 	}
 	CallTidb.Init()
+	BiService = &mysql.Mysql{
+		Address:      a.Address,
+		UserName:     a.UserName,
+		PassWord:     a.PassWord,
+		DBName:       a.DBName,
+		MaxOpenConns: a.MaxOpenConns,
+		MaxIdleConns: a.MaxIdleConns,
+	}
+	BiService.Init()
 	logx.Info("初始化mysql")
 }
 
@@ -119,6 +131,10 @@ func InitMongo(addr, db string, size int) {
 	Mgo = mongodb.NewMgo(addr, db, size)
 }
 
+func InitBiddingMgo(addr, db, user, pwd string, size int) {
+	Bidding = mongodb.NewMgoWithUser(addr, db, user, pwd, size)
+}
+
 func InitEs(version, address, userName, password string, size int) {
 	Es = elastic.NewEs(version, address, size, userName, password)
 }

+ 1 - 0
rpc/biService.proto

@@ -126,4 +126,5 @@ service BiService {
 	rpc distributeClue (DistributeClueReq) returns (AddProjectResp); //批量分配
 	rpc clueImport (ClueImportReq) returns (ClueImportResp); //线索导入
 	rpc clueAdd (ClueAddReq) returns (AddProjectResp); //合力亿捷新增线索
+	rpc clueImportTt (ClueImportReq) returns (ClueImportResp); //线索导入tt
 }

+ 2 - 1
rpc/biservice.go

@@ -27,8 +27,9 @@ 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, c.Mysql.CallTidb)
+	entity.InitMysql(c.Mysql.JianYu, c.Mysql.JyDoc, c.Mysql.Bi, c.Mysql.Tidb, c.Mysql.BiTidb, c.Mysql.CallTidb, c.Mysql.BiService)
 	entity.InitMongo(c.Mongo.Qfw.MongodbAddr, c.Mongo.Qfw.DbName, c.Mongo.Qfw.Size)
+	entity.InitBiddingMgo(c.Mongo.Bidding.MongodbAddr, c.Mongo.Bidding.DbName, c.Mongo.Bidding.UserName, c.Mongo.Bidding.Password, c.Mongo.Bidding.Size)
 	entity.InitEs(c.Es.Version, c.Es.Address, c.Es.UserName, c.Es.Password, c.Es.DbSize)
 	entity.InitArea()
 	entity.InitRedis(c.RedisAddress)

+ 6 - 0
rpc/biservice/biservice.go

@@ -39,6 +39,7 @@ type (
 		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)
+		ClueImportTt(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error)
 	}
 
 	defaultBiService struct {
@@ -91,3 +92,8 @@ func (m *defaultBiService) ClueAdd(ctx context.Context, in *ClueAddReq, opts ...
 	client := pb.NewBiServiceClient(m.cli.Conn())
 	return client.ClueAdd(ctx, in, opts...)
 }
+
+func (m *defaultBiService) ClueImportTt(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error) {
+	client := pb.NewBiServiceClient(m.cli.Conn())
+	return client.ClueImportTt(ctx, in, opts...)
+}

+ 7 - 0
rpc/etc/biservice.yaml

@@ -55,6 +55,13 @@ Mysql:
     PassWord: "Xzh#20221122K"
     MaxOpenConns: 5
     MaxIdleConns: 5
+  BiService:
+    DBName: bi_service
+    Address: 192.168.3.217:4000
+    UserName: root
+    PassWord: "=PDT49#80Z!RVv52_z"
+    MaxOpenConns: 5
+    MaxIdleConns: 5
 Mongo:
   Qfw:
     MongodbAddr: 192.168.3.206:27080

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

@@ -11,12 +11,13 @@ 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
-		CallTidb *mysql.Mysql
+		JianYu    *mysql.Mysql
+		JyDoc     *mysql.Mysql
+		Bi        *mysql.Mysql
+		Tidb      *mysql.Mysql
+		BiTidb    *mysql.Mysql
+		CallTidb  *mysql.Mysql
+		BiService *mysql.Mysql
 	}
 	Mongo struct {
 		Qfw struct {
@@ -24,6 +25,13 @@ type Config struct {
 			Size        int
 			DbName      string
 		}
+		Bidding struct {
+			MongodbAddr string
+			Size        int
+			DbName      string
+			UserName    string
+			Password    string
+		}
 	}
 	Es struct {
 		Address  string

+ 30 - 0
rpc/internal/logic/clueimportttlogic.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 ClueImportTtLogic struct {
+	ctx    context.Context
+	svcCtx *svc.ServiceContext
+	logx.Logger
+}
+
+func NewClueImportTtLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ClueImportTtLogic {
+	return &ClueImportTtLogic{
+		ctx:    ctx,
+		svcCtx: svcCtx,
+		Logger: logx.WithContext(ctx),
+	}
+}
+
+func (l *ClueImportTtLogic) ClueImportTt(in *pb.ClueImportReq) (*pb.ClueImportResp, error) {
+	// todo: add your logic here and delete this line
+
+	return service.ClueImportTt(in), nil
+}

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

@@ -61,3 +61,8 @@ func (s *BiServiceServer) ClueAdd(ctx context.Context, in *pb.ClueAddReq) (*pb.A
 	l := logic.NewClueAddLogic(ctx, s.svcCtx)
 	return l.ClueAdd(in)
 }
+
+func (s *BiServiceServer) ClueImportTt(ctx context.Context, in *pb.ClueImportReq) (*pb.ClueImportResp, error) {
+	l := logic.NewClueImportTtLogic(ctx, s.svcCtx)
+	return l.ClueImportTt(in)
+}

+ 18 - 13
rpc/pb/biService.pb.go

@@ -1328,7 +1328,7 @@ var file_biService_proto_rawDesc = []byte{
 	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,
+	0x32, 0x9d, 0x03, 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,
@@ -1350,8 +1350,11 @@ var file_biService_proto_rawDesc = []byte{
 	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,
+	0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12,
+	0x2f, 0x0a, 0x0c, 0x63, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x54, 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,
 }
 
 var (
@@ -1398,16 +1401,18 @@ var file_biService_proto_depIdxs = []int32{
 	10, // 9: BiService.distributeClue:input_type -> DistributeClueReq
 	12, // 10: BiService.clueImport:input_type -> ClueImportReq
 	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
+	12, // 12: BiService.clueImportTt:input_type -> ClueImportReq
+	1,  // 13: BiService.myDataAsset:output_type -> MyDataAssetResp
+	4,  // 14: BiService.addProject:output_type -> AddProjectResp
+	6,  // 15: BiService.getInfoId:output_type -> GetInfoIdResp
+	4,  // 16: BiService.drawClue:output_type -> AddProjectResp
+	9,  // 17: BiService.Call:output_type -> Resp
+	4,  // 18: BiService.distributeClue:output_type -> AddProjectResp
+	13, // 19: BiService.clueImport:output_type -> ClueImportResp
+	4,  // 20: BiService.clueAdd:output_type -> AddProjectResp
+	13, // 21: BiService.clueImportTt:output_type -> ClueImportResp
+	13, // [13:22] is the sub-list for method output_type
+	4,  // [4:13] 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

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

@@ -27,6 +27,7 @@ const (
 	BiService_DistributeClue_FullMethodName = "/BiService/distributeClue"
 	BiService_ClueImport_FullMethodName     = "/BiService/clueImport"
 	BiService_ClueAdd_FullMethodName        = "/BiService/clueAdd"
+	BiService_ClueImportTt_FullMethodName   = "/BiService/clueImportTt"
 )
 
 // BiServiceClient is the client API for BiService service.
@@ -41,6 +42,7 @@ type BiServiceClient interface {
 	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)
+	ClueImportTt(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error)
 }
 
 type biServiceClient struct {
@@ -123,6 +125,15 @@ func (c *biServiceClient) ClueAdd(ctx context.Context, in *ClueAddReq, opts ...g
 	return out, nil
 }
 
+func (c *biServiceClient) ClueImportTt(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error) {
+	out := new(ClueImportResp)
+	err := c.cc.Invoke(ctx, BiService_ClueImportTt_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
@@ -135,6 +146,7 @@ type BiServiceServer interface {
 	DistributeClue(context.Context, *DistributeClueReq) (*AddProjectResp, error)
 	ClueImport(context.Context, *ClueImportReq) (*ClueImportResp, error)
 	ClueAdd(context.Context, *ClueAddReq) (*AddProjectResp, error)
+	ClueImportTt(context.Context, *ClueImportReq) (*ClueImportResp, error)
 	mustEmbedUnimplementedBiServiceServer()
 }
 
@@ -166,6 +178,9 @@ func (UnimplementedBiServiceServer) ClueImport(context.Context, *ClueImportReq)
 func (UnimplementedBiServiceServer) ClueAdd(context.Context, *ClueAddReq) (*AddProjectResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method ClueAdd not implemented")
 }
+func (UnimplementedBiServiceServer) ClueImportTt(context.Context, *ClueImportReq) (*ClueImportResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ClueImportTt not implemented")
+}
 func (UnimplementedBiServiceServer) mustEmbedUnimplementedBiServiceServer() {}
 
 // UnsafeBiServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -323,6 +338,24 @@ func _BiService_ClueAdd_Handler(srv interface{}, ctx context.Context, dec func(i
 	return interceptor(ctx, in, info, handler)
 }
 
+func _BiService_ClueImportTt_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(ClueImportReq)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(BiServiceServer).ClueImportTt(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: BiService_ClueImportTt_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BiServiceServer).ClueImportTt(ctx, req.(*ClueImportReq))
+	}
+	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)
@@ -362,6 +395,10 @@ var BiService_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "clueAdd",
 			Handler:    _BiService_ClueAdd_Handler,
 		},
+		{
+			MethodName: "clueImportTt",
+			Handler:    _BiService_ClueImportTt_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "biService.proto",

+ 70 - 0
service/clue.go

@@ -11,9 +11,12 @@ import (
 	"net/http"
 	"net/url"
 	"regexp"
+	"strings"
 	"sync"
 	"time"
 
+	"app.yhyue.com/moapp/jybase/mongodb"
+
 	"app.yhyue.com/moapp/jybase/date"
 
 	common "app.yhyue.com/moapp/jybase/common"
@@ -21,6 +24,73 @@ import (
 	"bp.jydev.jianyu360.cn/BaseService/biService/rpc/biservice"
 )
 
+const (
+	competitors = "www.chinabidding.cn,www.yingcaicheng.com,cg.zbj.com,www.chinabidding.cn,bid.cyc-fund.com.cn,www.zbytb.com"
+)
+
+func ClueImportTt(this *biservice.ClueImportReq) *biservice.ClueImportResp {
+	result, status := ClueImportTtSync(this)
+	return &biservice.ClueImportResp{
+		ErrorCode: 0,
+		Data: &biservice.ClueImport{
+			Status: int64(status),
+			Result: result,
+		},
+	}
+}
+
+func ClueImportTtSync(this *biservice.ClueImportReq) (string, int) {
+	if ClueImportTtLock.TryLock() {
+		defer ClueImportTtLock.Unlock()
+		result, status, counts := "导入成功", 1, 0
+		data := JyBiTidb.Find("customer_data_temp", map[string]interface{}{"import_pc": this.Pcbh}, "", "", -1, -1)
+		if data != nil && len(*data) > 0 {
+			for _, v := range *data {
+				v["isCompetitors"] = "否"
+				details := ""
+				id := common.ObjToString(v["id"])
+				href := common.ObjToString(v["href"])
+				biddingData, ok := Bidding.FindOne("bidding", map[string]interface{}{"_id": mongodb.StringTOBsonId(id)})
+				if ok && biddingData != nil && len(*biddingData) > 0 {
+					details = common.ObjToString((*biddingData)["detail"])
+					v["details"] = details
+				}
+				for _, vv := range strings.Split(competitors, ",") {
+					if strings.Contains(href, vv) {
+						v["isCompetitors"] = "是"
+					}
+				}
+				dataId := JyTidb.Insert("customer_data_ttzl", v)
+				if dataId > 0 {
+					JyTidb.Insert("customer_data_ttzl_gl", map[string]interface{}{"msg_id": dataId, "info_id": id, "details": details, "isHistory": "否"})
+					delete(v, "isCompetitors")
+					ok := Es.Save("ttbid", "ttbid", v)
+					if ok {
+						counts++
+						log.Println("es存入成功", id)
+					} else {
+						log.Println("es存入失败!!", id)
+					}
+				} else {
+					log.Println("tidb存入失败!!", id)
+				}
+			}
+		}
+		JyBiTidb.Update("customer_data_import_record", map[string]interface{}{"import_pc": this.Pcbh}, map[string]interface{}{
+			"import_end_time": time.Now().Format(date.Date_Full_Layout),
+			"import_count":    counts,
+			"import_res":      result,
+		})
+		return result, status
+	} else {
+		JyBiTidb.Update("customer_data_import_record", map[string]interface{}{"import_pc": this.Pcbh}, map[string]interface{}{
+			"import_end_time": time.Now().Format(date.Date_Full_Layout),
+			"import_res":      "导入失败,有正在进行的导入任务",
+		})
+		return "有正在进行的导入任务", 2
+	}
+}
+
 func ClueAdd(this *biservice.ClueAddReq, col string) *biservice.AddProjectResp {
 	status := 1
 	nowTime := time.Now().Format(date.Date_Full_Layout)