Просмотр исходного кода

Merge branch 'dev/v1.0.7' of BaseService/biService into feature/v1.0.7

xuzhiheng 2 лет назад
Родитель
Сommit
bade1c5d51

+ 7 - 0
api/biService.api

@@ -45,6 +45,11 @@ type (
 		ClueIdList []int64                  `json:"clueIdList"`
 		Datas      []map[string]interface{} `json:"datas"`
 		PositionId int64                    `header:"positionId,optional"`
+		IsTask     int64                    `json:"isTask"`
+	}
+
+	ClueImportReq {
+		Pcbh string `json:"pcbh"`
 	}
 )
 
@@ -61,4 +66,6 @@ service biService-api {
 	post /biService/call (callReq) returns (resp)	//拨打电话
 	@handler DistributeClue
 	post /biService/distributeClue (DistributeClueReq) returns (resp)
+	@handler ClueImport
+	post /biService/clueImport (ClueImportReq) returns (resp)
 }

+ 28 - 0
api/internal/handler/clueimporthandler.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 ClueImportHandler(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.NewClueImportLogic(r.Context(), svcCtx)
+		resp, err := l.ClueImport(&req)
+		if err != nil {
+			httpx.Error(w, err)
+		} else {
+			httpx.OkJson(w, resp)
+		}
+	}
+}

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

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

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

+ 1 - 0
api/internal/logic/distributecluelogic.go

@@ -44,6 +44,7 @@ func (l *DistributeClueLogic) DistributeClue(req *types.DistributeClueReq) (resp
 		ClueIdList: req.ClueIdList,
 		PositionId: req.PositionId,
 		Datas:      datas,
+		IsTask:     req.IsTask,
 	})
 	return &types.Resp{Error_code: res.ErrorCode, Error_msg: res.ErrorMsg, Data: res.Data}, err
 }

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

@@ -45,4 +45,9 @@ type DistributeClueReq struct {
 	ClueIdList []int64                  `json:"clueIdList"`
 	Datas      []map[string]interface{} `json:"datas"`
 	PositionId int64                    `header:"positionId,optional"`
+	IsTask     int64                    `json:"isTask"`
+}
+
+type ClueImportReq struct {
+	Pcbh string `json:"pcbh"`
 }

+ 1 - 0
entity/entity.go

@@ -29,6 +29,7 @@ var (
 	Hlyj           *HlyjS
 	DataLock       = sync.Mutex{}
 	DistributeLock = sync.Mutex{}
+	ClueImportLock = sync.Mutex{}
 	CodeTrail      = map[string]string{
 		"00": "无意向客户",
 		"01": "商机线索",

+ 19 - 2
rpc/biService.proto

@@ -65,7 +65,7 @@ message CallReq {
 message Resp {
 	int64 error_code = 1;
 	string error_msg = 2;
-	string data =3;
+	string data = 3;
 }
 
 message DistributeClueReq {
@@ -73,6 +73,7 @@ message DistributeClueReq {
 	repeated int64 clueIdList = 2;
 	repeated DistributeDatas datas = 3;
 	int64 positionId = 4;
+	int64 isTask = 5;
 }
 
 message DistributeDatas {
@@ -83,11 +84,27 @@ message DistributeDatas {
 	int64 distributedCount = 5;
 }
 
+message ClueImportReq {
+	string pcbh = 1;
+}
+
+message ClueImportResp {
+	int64 error_code = 1;
+	string error_msg = 2;
+	ClueImport data = 3;
+}
+
+message ClueImport {
+	int64 status = 1;
+	string result = 2;
+}
+
 service BiService {
 	rpc myDataAsset (MyDataAssetReq) returns (MyDataAssetResp); //我的数据资产
 	rpc addProject (AddProjectReq) returns (AddProjectResp); //添加项目
 	rpc getInfoId (AddProjectReq) returns (GetInfoIdResp); //获取添加过项目的信息id
 	rpc drawClue (DrawClueReq) returns (AddProjectResp); //领取线索
 	rpc Call (CallReq) returns (Resp); //外呼集成
-	rpc distributeClue (DistributeClueReq) returns (AddProjectResp);
+	rpc distributeClue (DistributeClueReq) returns (AddProjectResp); //批量分配
+	rpc clueImport (ClueImportReq) returns (ClueImportResp); //线索导入
 }

+ 9 - 0
rpc/biservice/biservice.go

@@ -17,6 +17,9 @@ type (
 	AddProjectReq     = pb.AddProjectReq
 	AddProjectResp    = pb.AddProjectResp
 	CallReq           = pb.CallReq
+	ClueImport        = pb.ClueImport
+	ClueImportReq     = pb.ClueImportReq
+	ClueImportResp    = pb.ClueImportResp
 	DistributeClueReq = pb.DistributeClueReq
 	DistributeDatas   = pb.DistributeDatas
 	DrawClueReq       = pb.DrawClueReq
@@ -33,6 +36,7 @@ type (
 		DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 		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)
 	}
 
 	defaultBiService struct {
@@ -75,3 +79,8 @@ func (m *defaultBiService) DistributeClue(ctx context.Context, in *DistributeClu
 	client := pb.NewBiServiceClient(m.cli.Conn())
 	return client.DistributeClue(ctx, in, opts...)
 }
+
+func (m *defaultBiService) ClueImport(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error) {
+	client := pb.NewBiServiceClient(m.cli.Conn())
+	return client.ClueImport(ctx, in, opts...)
+}

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

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

@@ -51,3 +51,8 @@ func (s *BiServiceServer) DistributeClue(ctx context.Context, in *pb.DistributeC
 	l := logic.NewDistributeClueLogic(ctx, s.svcCtx)
 	return l.DistributeClue(in)
 }
+
+func (s *BiServiceServer) ClueImport(ctx context.Context, in *pb.ClueImportReq) (*pb.ClueImportResp, error) {
+	l := logic.NewClueImportLogic(ctx, s.svcCtx)
+	return l.ClueImport(in)
+}

+ 283 - 51
rpc/pb/biService.pb.go

@@ -707,6 +707,7 @@ type DistributeClueReq struct {
 	ClueIdList []int64            `protobuf:"varint,2,rep,packed,name=clueIdList,proto3" json:"clueIdList,omitempty"`
 	Datas      []*DistributeDatas `protobuf:"bytes,3,rep,name=datas,proto3" json:"datas,omitempty"`
 	PositionId int64              `protobuf:"varint,4,opt,name=positionId,proto3" json:"positionId,omitempty"`
+	IsTask     int64              `protobuf:"varint,5,opt,name=isTask,proto3" json:"isTask,omitempty"`
 }
 
 func (x *DistributeClueReq) Reset() {
@@ -769,6 +770,13 @@ func (x *DistributeClueReq) GetPositionId() int64 {
 	return 0
 }
 
+func (x *DistributeClueReq) GetIsTask() int64 {
+	if x != nil {
+		return x.IsTask
+	}
+	return 0
+}
+
 type DistributeDatas struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -848,6 +856,171 @@ func (x *DistributeDatas) GetDistributedCount() int64 {
 	return 0
 }
 
+type ClueImportReq struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Pcbh string `protobuf:"bytes,1,opt,name=pcbh,proto3" json:"pcbh,omitempty"`
+}
+
+func (x *ClueImportReq) Reset() {
+	*x = ClueImportReq{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_biService_proto_msgTypes[12]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *ClueImportReq) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ClueImportReq) ProtoMessage() {}
+
+func (x *ClueImportReq) ProtoReflect() protoreflect.Message {
+	mi := &file_biService_proto_msgTypes[12]
+	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 ClueImportReq.ProtoReflect.Descriptor instead.
+func (*ClueImportReq) Descriptor() ([]byte, []int) {
+	return file_biService_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *ClueImportReq) GetPcbh() string {
+	if x != nil {
+		return x.Pcbh
+	}
+	return ""
+}
+
+type ClueImportResp struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	ErrorCode int64       `protobuf:"varint,1,opt,name=error_code,json=errorCode,proto3" json:"error_code,omitempty"`
+	ErrorMsg  string      `protobuf:"bytes,2,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"`
+	Data      *ClueImport `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
+}
+
+func (x *ClueImportResp) Reset() {
+	*x = ClueImportResp{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_biService_proto_msgTypes[13]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *ClueImportResp) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ClueImportResp) ProtoMessage() {}
+
+func (x *ClueImportResp) ProtoReflect() protoreflect.Message {
+	mi := &file_biService_proto_msgTypes[13]
+	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 ClueImportResp.ProtoReflect.Descriptor instead.
+func (*ClueImportResp) Descriptor() ([]byte, []int) {
+	return file_biService_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *ClueImportResp) GetErrorCode() int64 {
+	if x != nil {
+		return x.ErrorCode
+	}
+	return 0
+}
+
+func (x *ClueImportResp) GetErrorMsg() string {
+	if x != nil {
+		return x.ErrorMsg
+	}
+	return ""
+}
+
+func (x *ClueImportResp) GetData() *ClueImport {
+	if x != nil {
+		return x.Data
+	}
+	return nil
+}
+
+type ClueImport struct {
+	state         protoimpl.MessageState
+	sizeCache     protoimpl.SizeCache
+	unknownFields protoimpl.UnknownFields
+
+	Status int64  `protobuf:"varint,1,opt,name=status,proto3" json:"status,omitempty"`
+	Result string `protobuf:"bytes,2,opt,name=result,proto3" json:"result,omitempty"`
+}
+
+func (x *ClueImport) Reset() {
+	*x = ClueImport{}
+	if protoimpl.UnsafeEnabled {
+		mi := &file_biService_proto_msgTypes[14]
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		ms.StoreMessageInfo(mi)
+	}
+}
+
+func (x *ClueImport) String() string {
+	return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ClueImport) ProtoMessage() {}
+
+func (x *ClueImport) ProtoReflect() protoreflect.Message {
+	mi := &file_biService_proto_msgTypes[14]
+	if protoimpl.UnsafeEnabled && x != nil {
+		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+		if ms.LoadMessageInfo() == nil {
+			ms.StoreMessageInfo(mi)
+		}
+		return ms
+	}
+	return mi.MessageOf(x)
+}
+
+// Deprecated: Use ClueImport.ProtoReflect.Descriptor instead.
+func (*ClueImport) Descriptor() ([]byte, []int) {
+	return file_biService_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *ClueImport) GetStatus() int64 {
+	if x != nil {
+		return x.Status
+	}
+	return 0
+}
+
+func (x *ClueImport) GetResult() string {
+	if x != nil {
+		return x.Result
+	}
+	return ""
+}
+
 var File_biService_proto protoreflect.FileDescriptor
 
 var file_biService_proto_rawDesc = []byte{
@@ -931,7 +1104,7 @@ var file_biService_proto_rawDesc = []byte{
 	0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20,
 	0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x12, 0x0a,
 	0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74,
-	0x61, 0x22, 0x99, 0x01, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
+	0x61, 0x22, 0xb1, 0x01, 0x0a, 0x11, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
 	0x43, 0x6c, 0x75, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6c, 0x75, 0x65, 0x43,
 	0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6c, 0x75, 0x65,
 	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6c, 0x75, 0x65, 0x49, 0x64, 0x4c,
@@ -940,38 +1113,55 @@ var file_biService_proto_rawDesc = []byte{
 	0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74,
 	0x65, 0x44, 0x61, 0x74, 0x61, 0x73, 0x52, 0x05, 0x64, 0x61, 0x74, 0x61, 0x73, 0x12, 0x1e, 0x0a,
 	0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x04, 0x20, 0x01, 0x28,
-	0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0xbd, 0x01,
-	0x0a, 0x0f, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61,
-	0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
-	0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f,
-	0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74,
-	0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1e, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f,
-	0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c,
-	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x10, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c,
-	0x65, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52,
+	0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x16, 0x0a,
+	0x06, 0x69, 0x73, 0x54, 0x61, 0x73, 0x6b, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x69,
+	0x73, 0x54, 0x61, 0x73, 0x6b, 0x22, 0xbd, 0x01, 0x0a, 0x0f, 0x44, 0x69, 0x73, 0x74, 0x72, 0x69,
+	0x62, 0x75, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
+	0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1e, 0x0a,
+	0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
+	0x03, 0x52, 0x0a, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x12, 0x1e, 0x0a,
+	0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28,
+	0x09, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a,
 	0x10, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e,
-	0x74, 0x12, 0x2a, 0x0a, 0x10, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
-	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x10, 0x64, 0x69, 0x73,
-	0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x94, 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, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x33,
+	0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x10, 0x75, 0x6e, 0x63, 0x6f, 0x6d, 0x70, 0x6c,
+	0x65, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x2a, 0x0a, 0x10, 0x64, 0x69, 0x73,
+	0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x05, 0x20,
+	0x01, 0x28, 0x03, 0x52, 0x10, 0x64, 0x69, 0x73, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x64,
+	0x43, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x23, 0x0a, 0x0d, 0x43, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70,
+	0x6f, 0x72, 0x74, 0x52, 0x65, 0x71, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x63, 0x62, 0x68, 0x18, 0x01,
+	0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x63, 0x62, 0x68, 0x22, 0x6d, 0x0a, 0x0e, 0x43, 0x6c,
+	0x75, 0x65, 0x49, 0x6d, 0x70, 0x6f, 0x72, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x0a,
+	0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03,
+	0x52, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x65,
+	0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+	0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x1f, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
+	0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x43, 0x6c, 0x75, 0x65, 0x49, 0x6d, 0x70,
+	0x6f, 0x72, 0x74, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3c, 0x0a, 0x0a, 0x43, 0x6c, 0x75,
+	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,
 }
 
 var (
@@ -986,7 +1176,7 @@ func file_biService_proto_rawDescGZIP() []byte {
 	return file_biService_proto_rawDescData
 }
 
-var file_biService_proto_msgTypes = make([]protoimpl.MessageInfo, 12)
+var file_biService_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
 var file_biService_proto_goTypes = []interface{}{
 	(*MyDataAssetReq)(nil),    // 0: MyDataAssetReq
 	(*MyDataAssetResp)(nil),   // 1: MyDataAssetResp
@@ -1000,28 +1190,34 @@ var file_biService_proto_goTypes = []interface{}{
 	(*Resp)(nil),              // 9: Resp
 	(*DistributeClueReq)(nil), // 10: DistributeClueReq
 	(*DistributeDatas)(nil),   // 11: DistributeDatas
+	(*ClueImportReq)(nil),     // 12: ClueImportReq
+	(*ClueImportResp)(nil),    // 13: ClueImportResp
+	(*ClueImport)(nil),        // 14: ClueImport
 }
 var file_biService_proto_depIdxs = []int32{
 	2,  // 0: MyDataAssetResp.data:type_name -> MyDataAsset
 	5,  // 1: AddProjectResp.data:type_name -> AddProject
 	11, // 2: DistributeClueReq.datas:type_name -> DistributeDatas
-	0,  // 3: BiService.myDataAsset:input_type -> MyDataAssetReq
-	3,  // 4: BiService.addProject:input_type -> AddProjectReq
-	3,  // 5: BiService.getInfoId:input_type -> AddProjectReq
-	7,  // 6: BiService.drawClue:input_type -> DrawClueReq
-	8,  // 7: BiService.Call:input_type -> CallReq
-	10, // 8: BiService.distributeClue:input_type -> DistributeClueReq
-	1,  // 9: BiService.myDataAsset:output_type -> MyDataAssetResp
-	4,  // 10: BiService.addProject:output_type -> AddProjectResp
-	6,  // 11: BiService.getInfoId:output_type -> GetInfoIdResp
-	4,  // 12: BiService.drawClue:output_type -> AddProjectResp
-	9,  // 13: BiService.Call:output_type -> Resp
-	4,  // 14: BiService.distributeClue:output_type -> AddProjectResp
-	9,  // [9:15] is the sub-list for method output_type
-	3,  // [3:9] is the sub-list for method input_type
-	3,  // [3:3] is the sub-list for extension type_name
-	3,  // [3:3] is the sub-list for extension extendee
-	0,  // [0:3] is the sub-list for field type_name
+	14, // 3: ClueImportResp.data:type_name -> ClueImport
+	0,  // 4: BiService.myDataAsset:input_type -> MyDataAssetReq
+	3,  // 5: BiService.addProject:input_type -> AddProjectReq
+	3,  // 6: BiService.getInfoId:input_type -> AddProjectReq
+	7,  // 7: BiService.drawClue:input_type -> DrawClueReq
+	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
+	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
 }
 
 func init() { file_biService_proto_init() }
@@ -1174,6 +1370,42 @@ func file_biService_proto_init() {
 				return nil
 			}
 		}
+		file_biService_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*ClueImportReq); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_biService_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*ClueImportResp); i {
+			case 0:
+				return &v.state
+			case 1:
+				return &v.sizeCache
+			case 2:
+				return &v.unknownFields
+			default:
+				return nil
+			}
+		}
+		file_biService_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+			switch v := v.(*ClueImport); 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{
@@ -1181,7 +1413,7 @@ func file_biService_proto_init() {
 			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
 			RawDescriptor: file_biService_proto_rawDesc,
 			NumEnums:      0,
-			NumMessages:   12,
+			NumMessages:   15,
 			NumExtensions: 0,
 			NumServices:   1,
 		},

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

@@ -25,6 +25,7 @@ const (
 	BiService_DrawClue_FullMethodName       = "/BiService/drawClue"
 	BiService_Call_FullMethodName           = "/BiService/Call"
 	BiService_DistributeClue_FullMethodName = "/BiService/distributeClue"
+	BiService_ClueImport_FullMethodName     = "/BiService/clueImport"
 )
 
 // BiServiceClient is the client API for BiService service.
@@ -37,6 +38,7 @@ type BiServiceClient interface {
 	DrawClue(ctx context.Context, in *DrawClueReq, opts ...grpc.CallOption) (*AddProjectResp, error)
 	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)
 }
 
 type biServiceClient struct {
@@ -101,6 +103,15 @@ func (c *biServiceClient) DistributeClue(ctx context.Context, in *DistributeClue
 	return out, nil
 }
 
+func (c *biServiceClient) ClueImport(ctx context.Context, in *ClueImportReq, opts ...grpc.CallOption) (*ClueImportResp, error) {
+	out := new(ClueImportResp)
+	err := c.cc.Invoke(ctx, BiService_ClueImport_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
@@ -111,6 +122,7 @@ type BiServiceServer interface {
 	DrawClue(context.Context, *DrawClueReq) (*AddProjectResp, error)
 	Call(context.Context, *CallReq) (*Resp, error)
 	DistributeClue(context.Context, *DistributeClueReq) (*AddProjectResp, error)
+	ClueImport(context.Context, *ClueImportReq) (*ClueImportResp, error)
 	mustEmbedUnimplementedBiServiceServer()
 }
 
@@ -136,6 +148,9 @@ func (UnimplementedBiServiceServer) Call(context.Context, *CallReq) (*Resp, erro
 func (UnimplementedBiServiceServer) DistributeClue(context.Context, *DistributeClueReq) (*AddProjectResp, error) {
 	return nil, status.Errorf(codes.Unimplemented, "method DistributeClue not implemented")
 }
+func (UnimplementedBiServiceServer) ClueImport(context.Context, *ClueImportReq) (*ClueImportResp, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method ClueImport not implemented")
+}
 func (UnimplementedBiServiceServer) mustEmbedUnimplementedBiServiceServer() {}
 
 // UnsafeBiServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -257,6 +272,24 @@ func _BiService_DistributeClue_Handler(srv interface{}, ctx context.Context, dec
 	return interceptor(ctx, in, info, handler)
 }
 
+func _BiService_ClueImport_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).ClueImport(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: BiService_ClueImport_FullMethodName,
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(BiServiceServer).ClueImport(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)
@@ -288,6 +321,10 @@ var BiService_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "distributeClue",
 			Handler:    _BiService_DistributeClue_Handler,
 		},
+		{
+			MethodName: "clueImport",
+			Handler:    _BiService_ClueImport_Handler,
+		},
 	},
 	Streams:  []grpc.StreamDesc{},
 	Metadata: "biService.proto",

+ 144 - 3
service/clue.go

@@ -2,8 +2,10 @@ package service
 
 import (
 	"database/sql"
+	"fmt"
 	"log"
 	"math"
+	"regexp"
 	"sync"
 	"time"
 
@@ -15,7 +17,6 @@ import (
 )
 
 func DistributeClue(this *biservice.DistributeClueReq) *biservice.AddProjectResp {
-
 	count, status := DistributeClueSync(this)
 	log.Println("分配数量 ", count)
 	return &biservice.AddProjectResp{
@@ -44,7 +45,7 @@ func DistributeClueSync(this *biservice.DistributeClueReq) (int, int) {
 			if distributedCount > 0 {
 				distributedArr := this.ClueIdList[count : count+distributedCount]
 				count += distributedCount
-				DistributeClueMore(saleMap, distributedArr, seatNumber, data.Name, data.PositionId, this.PositionId)
+				DistributeClueMore(saleMap, distributedArr, seatNumber, data.Name, data.PositionId, this.PositionId, this.IsTask)
 			}
 		}
 		return count, 1
@@ -53,7 +54,7 @@ func DistributeClueSync(this *biservice.DistributeClueReq) (int, int) {
 	}
 }
 
-func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedArr []int64, seatNumber, name string, positionId, thispositionId int64) {
+func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedArr []int64, seatNumber, name string, positionId, thispositionId, isTask int64) {
 	wg := new(sync.WaitGroup)
 	ch := make(chan bool, 20)
 	for _, v := range distributedArr {
@@ -94,6 +95,13 @@ func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedAr
 						"trail_time":           nil,
 						// "comeinsource_open":    nil,
 					}
+					if isTask == int64(1) {
+						updateClue["is_task"] = 1
+						updateClue["task_time"] = nowTime
+						updateClue["tasktime"] = nowTime
+						updateClue["taskstatus"] = 0
+						updateClue["tasksource"] = "主动分配客户"
+					}
 					ok := JyBiTidb.Update("dwd_f_crm_clue_info", map[string]interface{}{"id": v}, updateClue)
 					// ok := JyBiTidb.Update("dwd_f_crm_private_sea", map[string]interface{}{"clue_id": v}, map[string]interface{}{
 					// 	"position_id":  positionId,
@@ -159,6 +167,13 @@ func DistributeClueMore(saleMap map[string]map[string]interface{}, distributedAr
 					if trailstatus != "08" {
 						updateClue["trailstatus"] = "01"
 					}
+					if isTask == int64(1) {
+						updateClue["is_task"] = 1
+						updateClue["task_time"] = nowTime
+						updateClue["tasktime"] = nowTime
+						updateClue["taskstatus"] = 0
+						updateClue["tasksource"] = "主动分配客户"
+					}
 					ok := JyBiTidb.Update("dwd_f_crm_clue_info", map[string]interface{}{"id": v}, updateClue)
 					// seaId := JyBiTidb.Insert("dwd_f_crm_private_sea", map[string]interface{}{
 					// 	"clue_id":      v,
@@ -434,3 +449,129 @@ func getSeatNumber(positionId int64) (seatNumber, name string) {
 	}
 	return
 }
+
+func ClueImport(this *biservice.ClueImportReq) *biservice.ClueImportResp {
+	result, status := ClueImportSync(this)
+	return &biservice.ClueImportResp{
+		ErrorCode: 0,
+		Data: &biservice.ClueImport{
+			Status: int64(status),
+			Result: result,
+		},
+	}
+}
+
+func ClueImportSync(this *biservice.ClueImportReq) (string, int) {
+	if ClueImportLock.TryLock() {
+		defer ClueImportLock.Unlock()
+		result, status, dataArr, countOpen, countAdd, countPrivate := "", 1, []map[string]interface{}{}, 0, 0, 0
+		phoneRegexp := regexp.MustCompile(`^1[0-9]{10}$`)
+		data := JyBiTidb.Find("dwd_f_crm_bulk_import", map[string]interface{}{"PCBH": this.Pcbh}, "", "", -1, -1)
+		if data != nil && len(*data) > 0 {
+			for k, v := range *data {
+				companyName := common.ObjToString(v["GSMC"])
+				name := common.ObjToString(v["XM"])
+				position := common.ObjToString(v["ZW"])
+				phone := common.ObjToString(v["LXFS"])
+				clueSource := common.ObjToString(v["XSXSLY"])
+				if companyName == "" {
+					companyName = phone
+				}
+				isOK, dataMap := false, map[string]interface{}{
+					"cluename": companyName,
+					"name":     name,
+					"phone":    phone,
+					"position": position,
+				}
+				if phone == "" {
+					result += "第" + fmt.Sprint(k+2) + "行,“联系方式为空”\n"
+				} else {
+					if !phoneRegexp.MatchString(phone) {
+						result += "第" + fmt.Sprint(k+2) + "行,“联系方式格式有误”\n"
+					} else {
+						userData := JyBiTidb.FindOne("dwd_f_userbase_baseinfo", map[string]interface{}{"phone": phone}, "", "")
+						if userData != nil && len(*userData) > 0 {
+							source := common.IntAll((*userData)["source"])
+							userId := common.ObjToString((*userData)["userid"])
+							uId := common.ObjToString((*userData)["uid"])
+							if source == 5 {
+								result += "第" + fmt.Sprint(k+2) + "行,“该线索已归属域外”\n"
+							} else {
+								isOK = true
+								dataMap["userId"] = userId
+								dataMap["uId"] = uId
+							}
+						}
+					}
+				}
+				if clueSource == "" {
+					result += "第" + fmt.Sprint(k+2) + "行,“销售线索来源为空”\n"
+				} else {
+					sourceData := JyBiTidb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"name": clueSource}, "", "")
+					if sourceData == nil || len(*sourceData) == 0 {
+						result += "第" + fmt.Sprint(k+2) + "行,“销售线索来源不存在”\n"
+					} else {
+						isOK = true
+						code := common.ObjToString((*sourceData)["code"])
+						pcode := common.ObjToString((*sourceData)["pcode"])
+						dataMap["top_cluetype"] = pcode
+						dataMap["sub_cluetype"] = code
+					}
+				}
+				if isOK {
+					dataArr = append(dataArr, dataMap)
+				}
+			}
+			nowTime := time.Now().Format(date.Date_Full_Layout)
+			if result != "" {
+				status = -1
+				JyBiTidb.Update("dwd_f_crm_bulk_import_record", map[string]interface{}{"PCBH": this.Pcbh}, map[string]interface{}{
+					"DRJSSJ": nowTime, //结束时间
+					"SBYY":   result,  //失败原因
+					"DRZT":   "导入失败",
+				})
+			} else {
+				for _, v := range dataArr {
+					clueData := JyBiTidb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"phone": v["phone"]}, "", "")
+					if clueData == nil || len(*clueData) == 0 {
+						countAdd++
+						JyBiTidb.Insert("dwd_f_crm_clue_info", map[string]interface{}{
+							"userid":       v["userId"],
+							"uid":          v["uId"],
+							"is_assign":    0,
+							"comeintime":   nowTime,
+							"createtime":   nowTime,
+							"updatetime":   nowTime,
+							"cluename":     v["cluename"],
+							"top_cluetype": v["top_cluetype"],
+							"sub_cluetype": v["sub_cluetype"],
+							"trailstatus":  "01",
+							"name":         v["name"],
+							"phone":        v["phone"],
+							"position":     v["position"],
+							"batch_import": this.Pcbh,
+						})
+					} else {
+						is_assign := common.IntAll((*clueData)["is_assign"])
+						if is_assign == 0 {
+							countOpen++
+						} else if is_assign == 1 {
+							countPrivate++
+						}
+					}
+				}
+				JyBiTidb.Update("dwd_f_crm_bulk_import_record", map[string]interface{}{"PCBH": this.Pcbh}, map[string]interface{}{
+					"DRJSSJ":    nowTime,      //结束时间
+					"ZJXST":     len(dataArr), //总计线索条数
+					"ZFXSSHXST": countPrivate, //私海重复条数
+					"ZFXSGHXST": countOpen,    //公海重复条数
+					"XZXST":     countAdd,     //新增条数
+					"DRZT":      "导入成功",
+				})
+			}
+		}
+		return result, status
+	} else {
+		return "有正在进行的导入任务", 2
+	}
+}