|
@@ -17,7 +17,7 @@ import (
|
|
|
)
|
|
|
|
|
|
func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
- userId, uId, positionId, source, cluename, phone, sourceCode, keyword, _ := common.ObjToString(data["user_id"]), "", "", "", "", "", "", []string{}, ""
|
|
|
+ userId, uId, positionId, source, cluename, phone, sourceCode, keyword, _ := gconv.String(data["user_id"]), "", "", "", "", "", "", []string{}, ""
|
|
|
role, industry, department, departments, position, name, top_cluetype, sub_cluetype, follow_project_area, level := "", "", "", "", "", "", "", "", "", ""
|
|
|
query, topname, subname, belong_to, sourceName, remark, sourceId := map[string]interface{}{}, "", "", "01", "", "", int64(0)
|
|
|
nowTime := time.Now().Format("2006-01-02 15:04:05")
|
|
@@ -26,35 +26,35 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
positionId = userId
|
|
|
userMapping := TiDb.FindOne("dwd_f_userbase_id_mapping", map[string]interface{}{"position_id": userId}, "", "")
|
|
|
if userMapping != nil && len(*userMapping) > 0 {
|
|
|
- userId = common.ObjToString((*userMapping)["userid"])
|
|
|
+ userId = gconv.String((*userMapping)["userid"])
|
|
|
}
|
|
|
}
|
|
|
query["userid"] = userId
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"]) //用户来源
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"]) //用户归属
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"]) //用户来源
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"]) //用户归属
|
|
|
}
|
|
|
- cluename = common.ObjToString(data["company_name"])
|
|
|
- phone = common.ObjToString(data["user_phone"])
|
|
|
+ cluename = gconv.String(data["company_name"])
|
|
|
+ phone = gconv.String(data["user_phone"])
|
|
|
} else if item == "message" {
|
|
|
userMapping := TiDb.FindOne("dwd_f_userbase_id_mapping", map[string]interface{}{"base_user_id": common.Int64All(data["own_id"])}, "", "")
|
|
|
if userMapping != nil && len(*userMapping) > 0 {
|
|
|
- userId = common.ObjToString((*userMapping)["userid"])
|
|
|
+ userId = gconv.String((*userMapping)["userid"])
|
|
|
positionId = fmt.Sprint((*userMapping)["position_id"])
|
|
|
}
|
|
|
query["userid"] = userId
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"])
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"])
|
|
|
- phone = common.ObjToString((*userInfo)["phone"])
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"])
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"])
|
|
|
+ phone = gconv.String((*userInfo)["phone"])
|
|
|
if phone != "" {
|
|
|
phoneMapping := TiDb.FindOne("dwd_f_crm_clue_info", map[string]interface{}{"phone": phone}, "", "")
|
|
|
if phoneMapping != nil && len(*phoneMapping) > 0 {
|
|
|
- cluename = common.ObjToString((*phoneMapping)["cluename"])
|
|
|
+ cluename = gconv.String((*phoneMapping)["cluename"])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -66,13 +66,13 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
}
|
|
|
userId = mongodb.BsonIdToSId(data["userid"])
|
|
|
//新用户没有uid、source要等5分钟
|
|
|
- cluename = common.ObjToString(data["company_name"])
|
|
|
- phone = common.ObjToString(data["phone"])
|
|
|
+ cluename = gconv.String(data["company_name"])
|
|
|
+ phone = gconv.String(data["phone"])
|
|
|
if phone != "" {
|
|
|
contactsData := TiDb.SelectBySql("select * from dwd_f_userbase_contacts where phone = ? and is_delete = 1", phone)
|
|
|
if contactsData != nil && len(*contactsData) > 0 {
|
|
|
- if common.ObjToString((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
- uId = common.ObjToString((*contactsData)[0]["baseinfo_id"])
|
|
|
+ if gconv.String((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
+ uId = gconv.String((*contactsData)[0]["baseinfo_id"])
|
|
|
query["uid"] = uId
|
|
|
} else {
|
|
|
query["userid"] = userId
|
|
@@ -83,14 +83,14 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
//createtimeStr := ""
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"])
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"])
|
|
|
- //s_sourceid = common.ObjToString((*userInfo)["s_sourceid"])
|
|
|
- //createtimeStr = common.ObjToString((*userInfo)["l_registedate"])
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"])
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"])
|
|
|
+ //s_sourceid = gconv.String((*userInfo)["s_sourceid"])
|
|
|
+ //createtimeStr = gconv.String((*userInfo)["l_registedate"])
|
|
|
}
|
|
|
if item == "xcxusers" {
|
|
|
- sourceCode = common.ObjToString(data["industry"])
|
|
|
+ sourceCode = gconv.String(data["industry"])
|
|
|
//t, _ := time.Parse("2006-01-02 15:04:05", createtimeStr)
|
|
|
if sourceCode == "" {
|
|
|
log.Println("留资没有source", phone)
|
|
@@ -116,44 +116,44 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
"userid": userId,
|
|
|
}, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- phone = common.ObjToString((*userInfo)["phone"])
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"])
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"])
|
|
|
+ phone = gconv.String((*userInfo)["phone"])
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"])
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"])
|
|
|
}
|
|
|
} else if item == "saleLeads" { //留资
|
|
|
//线索名称打印
|
|
|
- log.Println(1111, common.ObjToString(data["company"]))
|
|
|
- userId = common.ObjToString(data["userid"])
|
|
|
+ log.Println(1111, gconv.String(data["company"]))
|
|
|
+ userId = gconv.String(data["userid"])
|
|
|
if !mongodb.IsObjectIdHex(userId) {
|
|
|
positionId = userId
|
|
|
userMapping := TiDb.FindOne("dwd_f_userbase_id_mapping", map[string]interface{}{"position_id": userId}, "", "")
|
|
|
if userMapping != nil && len(*userMapping) > 0 {
|
|
|
- userId = common.ObjToString((*userMapping)["userid"])
|
|
|
- }
|
|
|
- }
|
|
|
- cluename = common.ObjToString(data["company"])
|
|
|
- phone = common.ObjToString(data["phone"])
|
|
|
- role = common.ObjToString(data["companyType"])
|
|
|
- industry = common.ObjToString(data["industry"])
|
|
|
- department = common.ObjToString(data["branch"])
|
|
|
- departments = common.ObjToString(data["department"])
|
|
|
- position = common.ObjToString(data["position"])
|
|
|
- name = common.ObjToString(data["name"])
|
|
|
- sourceCode = common.ObjToString(data["source"])
|
|
|
+ userId = gconv.String((*userMapping)["userid"])
|
|
|
+ }
|
|
|
+ }
|
|
|
+ cluename = gconv.String(data["company"])
|
|
|
+ phone = gconv.String(data["phone"])
|
|
|
+ role = gconv.String(data["companyType"])
|
|
|
+ industry = gconv.String(data["industry"])
|
|
|
+ department = gconv.String(data["branch"])
|
|
|
+ departments = gconv.String(data["department"])
|
|
|
+ position = gconv.String(data["position"])
|
|
|
+ name = gconv.String(data["name"])
|
|
|
+ sourceCode = gconv.String(data["source"])
|
|
|
if sourceCode == "" {
|
|
|
log.Println("留资没有source", phone)
|
|
|
return true, true, true
|
|
|
}
|
|
|
- remark = common.ObjToString(data["jyRemark"]) //荟聚线索备注
|
|
|
+ remark = gconv.String(data["jyRemark"]) //荟聚线索备注
|
|
|
keywordArr := data["keyword"]
|
|
|
if keywordArr != nil {
|
|
|
keyword = common.ObjArrToStringArr(data["keyword"].([]interface{}))
|
|
|
}
|
|
|
contactsData := TiDb.SelectBySql("select * from dwd_f_userbase_contacts where phone = ? and is_delete = 1", phone)
|
|
|
if contactsData != nil && len(*contactsData) > 0 {
|
|
|
- if common.ObjToString((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
- uId = common.ObjToString((*contactsData)[0]["baseinfo_id"])
|
|
|
+ if gconv.String((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
+ uId = gconv.String((*contactsData)[0]["baseinfo_id"])
|
|
|
query["uid"] = uId
|
|
|
} else {
|
|
|
query["userid"] = userId
|
|
@@ -164,11 +164,11 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
if userId != "" || uId != "" {
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"])
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"])
|
|
|
- userId = common.ObjToString((*userInfo)["userid"])
|
|
|
- //s_sourceid = common.ObjToString((*userInfo)["s_sourceid"])
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"])
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"])
|
|
|
+ userId = gconv.String((*userInfo)["userid"])
|
|
|
+ //s_sourceid = gconv.String((*userInfo)["s_sourceid"])
|
|
|
}
|
|
|
} else {
|
|
|
if sourceCode == "report_retention" || sourceCode == "marketing_retention" { //荟聚线索来源,不是剑鱼用户,需要等待用户归集
|
|
@@ -180,20 +180,20 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
}
|
|
|
}
|
|
|
} else if item == "eventReg" { //渠道
|
|
|
- userId = common.ObjToString(data["userid"])
|
|
|
- cluename = common.ObjToString(data["company"])
|
|
|
- phone = common.ObjToString(data["sign_phone"])
|
|
|
- role = common.ObjToString(data["company_type"])
|
|
|
- department = common.ObjToString(data["branch"])
|
|
|
- position = common.ObjToString(data["position"])
|
|
|
- name = common.ObjToString(data["sign_name"])
|
|
|
- sourceCode = common.ObjToString(data["source_code"])
|
|
|
- sourceName = common.ObjToString(data["source_name"])
|
|
|
+ userId = gconv.String(data["userid"])
|
|
|
+ cluename = gconv.String(data["company"])
|
|
|
+ phone = gconv.String(data["sign_phone"])
|
|
|
+ role = gconv.String(data["company_type"])
|
|
|
+ department = gconv.String(data["branch"])
|
|
|
+ position = gconv.String(data["position"])
|
|
|
+ name = gconv.String(data["sign_name"])
|
|
|
+ sourceCode = gconv.String(data["source_code"])
|
|
|
+ sourceName = gconv.String(data["source_name"])
|
|
|
log.Println(sourceName)
|
|
|
contactsData := TiDb.SelectBySql("select * from dwd_f_userbase_contacts where phone = ? and is_delete = 1", phone)
|
|
|
if contactsData != nil && len(*contactsData) > 0 {
|
|
|
- if common.ObjToString((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
- uId = common.ObjToString((*contactsData)[0]["baseinfo_id"])
|
|
|
+ if gconv.String((*contactsData)[0]["baseinfo_id"]) != "" {
|
|
|
+ uId = gconv.String((*contactsData)[0]["baseinfo_id"])
|
|
|
query["uid"] = uId
|
|
|
} else {
|
|
|
query["userid"] = userId
|
|
@@ -203,43 +203,58 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
}
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"])
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"])
|
|
|
- userId = common.ObjToString((*userInfo)["userid"])
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"])
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"])
|
|
|
+ userId = gconv.String((*userInfo)["userid"])
|
|
|
}
|
|
|
if role == "集成商" || role == "设计院" {
|
|
|
role = "其他-" + role
|
|
|
}
|
|
|
} else if item == "readClue" {
|
|
|
- userId = common.ObjToString(data["userId"])
|
|
|
+ userId = gconv.String(data["userId"])
|
|
|
query["userid"] = userId
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"])
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"])
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"])
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"])
|
|
|
}
|
|
|
- // cluename = common.ObjToString(data["companyName"])
|
|
|
- phone = common.ObjToString(data["phone"])
|
|
|
+ // cluename = gconv.String(data["companyName"])
|
|
|
+ phone = gconv.String(data["phone"])
|
|
|
sourceId = common.Int64All(data["sourceId"])
|
|
|
} else if item == "invite" {
|
|
|
query["userid"] = userId
|
|
|
userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
if userInfo != nil && len(*userInfo) > 0 {
|
|
|
- uId = common.ObjToString((*userInfo)["uid"])
|
|
|
- source = common.ObjToString((*userInfo)["source"]) //用户来源
|
|
|
- belong_to = common.ObjToString((*userInfo)["belong_to"]) //用户归属
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"]) //用户来源
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"]) //用户归属
|
|
|
} else {
|
|
|
log.Println("邀请用户,用户归集没数据", data)
|
|
|
return true, true, true
|
|
|
}
|
|
|
- cluename = common.ObjToString((*userInfo)["company_name"])
|
|
|
- phone = common.ObjToString((*userInfo)["phone"])
|
|
|
- sourceCode = common.ObjToString(data["sourceCode"])
|
|
|
+ cluename = gconv.String((*userInfo)["company_name"])
|
|
|
+ phone = gconv.String((*userInfo)["phone"])
|
|
|
+ sourceCode = gconv.String(data["sourceCode"])
|
|
|
+ } else if item == "activity" {
|
|
|
+ query["userid"] = userId
|
|
|
+ userInfo := TiDb.FindOne("dwd_f_userbase_baseinfo", query, "", "")
|
|
|
+ if userInfo != nil && len(*userInfo) > 0 {
|
|
|
+ uId = gconv.String((*userInfo)["uid"])
|
|
|
+ source = gconv.String((*userInfo)["source"]) //用户来源
|
|
|
+ belong_to = gconv.String((*userInfo)["belong_to"]) //用户归属
|
|
|
+ } else {
|
|
|
+ log.Println("邀请用户,用户归集没数据", data)
|
|
|
+ return true, true, true
|
|
|
+ }
|
|
|
+ cluename = gconv.String((*userInfo)["company_name"])
|
|
|
+ phone = gconv.String((*userInfo)["phone"])
|
|
|
+ sourceCode = gconv.String(data["sourceCode"])
|
|
|
+ log.Println(sourceCode)
|
|
|
}
|
|
|
log.Println(222, cluename)
|
|
|
- if cluename == "" && item != "message" && item != "orders" && item != "readClue" && item != "rebind" && item != "allocation" {
|
|
|
+ if cluename == "" && item != "message" && item != "orders" && item != "readClue" && item != "rebind" && item != "allocation" && item != "activity" {
|
|
|
cluename = phone //没有线索名,手机号代替
|
|
|
}
|
|
|
log.Println(333, cluename)
|
|
@@ -277,12 +292,12 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
saleLeadsData, ok := Mgo.Find("saleLeads", map[string]interface{}{"userid": qid}, map[string]interface{}{"_id": -1}, nil, false, 0, 1)
|
|
|
if ok && saleLeadsData != nil && len(*saleLeadsData) > 0 {
|
|
|
sdata := (*saleLeadsData)[0]
|
|
|
- role = common.ObjToString(sdata["companyType"])
|
|
|
- industry = common.ObjToString(sdata["industry"])
|
|
|
- department = common.ObjToString(sdata["branch"])
|
|
|
- departments = common.ObjToString(sdata["department"])
|
|
|
- position = common.ObjToString(sdata["position"])
|
|
|
- name = common.ObjToString(sdata["name"])
|
|
|
+ role = gconv.String(sdata["companyType"])
|
|
|
+ industry = gconv.String(sdata["industry"])
|
|
|
+ department = gconv.String(sdata["branch"])
|
|
|
+ departments = gconv.String(sdata["department"])
|
|
|
+ position = gconv.String(sdata["position"])
|
|
|
+ name = gconv.String(sdata["name"])
|
|
|
}
|
|
|
}
|
|
|
top_cluetype, sub_cluetype, level, topname, subname = getClueType(item, data, sourceCode, sourceId) //查留资来源名字
|
|
@@ -314,7 +329,7 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
cluename = ""
|
|
|
}
|
|
|
//已存在,走更新
|
|
|
- batch_import := common.ObjToString((*uCount)["batch_import"])
|
|
|
+ batch_import := gconv.String((*uCount)["batch_import"])
|
|
|
if batch_import != "" && item == "users" { //有导入批次号还是新用户,不执行
|
|
|
return true, true, true
|
|
|
}
|
|
@@ -341,14 +356,14 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
if item != "orders" && item != "users" { //新用户和订单之外的替换一下新的留资信息
|
|
|
BCPCID := common.GetRandom(32)
|
|
|
clueId := common.Int64All((*uCount)["id"])
|
|
|
- old_name := common.ObjToString((*uCount)["name"])
|
|
|
- old_position := common.ObjToString((*uCount)["position"])
|
|
|
- old_department := common.ObjToString((*uCount)["department"])
|
|
|
- old_follow_project_area := common.ObjToString((*uCount)["follow_project_area"])
|
|
|
- old_role := common.ObjToString((*uCount)["role"])
|
|
|
- old_cluename := common.ObjToString((*uCount)["cluename"])
|
|
|
- old_top_cluetype := common.ObjToString((*uCount)["top_cluetype"])
|
|
|
- old_sub_cluetype := common.ObjToString((*uCount)["sub_cluetype"])
|
|
|
+ old_name := gconv.String((*uCount)["name"])
|
|
|
+ old_position := gconv.String((*uCount)["position"])
|
|
|
+ old_department := gconv.String((*uCount)["department"])
|
|
|
+ old_follow_project_area := gconv.String((*uCount)["follow_project_area"])
|
|
|
+ old_role := gconv.String((*uCount)["role"])
|
|
|
+ old_cluename := gconv.String((*uCount)["cluename"])
|
|
|
+ old_top_cluetype := gconv.String((*uCount)["top_cluetype"])
|
|
|
+ old_sub_cluetype := gconv.String((*uCount)["sub_cluetype"])
|
|
|
label := gconv.Int64((*uCount)["label"])
|
|
|
trailstatusCode := gconv.String((*uCount)["trailstatus"])
|
|
|
clueUpdateData := map[string]interface{}{}
|
|
@@ -436,13 +451,13 @@ func FormatData(data map[string]interface{}, item string) (bool, bool, bool) {
|
|
|
if old_top_cluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_top_cluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_topname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_topname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if old_sub_cluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_sub_cluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_subname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_subname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if old_top_cluetype != top_cluetype && top_cluetype != "" {
|
|
@@ -716,8 +731,8 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
log.Println("工单线索修改前", data)
|
|
|
nowTime := time.Now().Format("2006-01-02 15:04:05")
|
|
|
nowTimes := time.Unix(time.Now().Unix()+3600*12, 0).Format("2006-01-02 15:04:05")
|
|
|
- trailstatus := common.ObjToString(data["trailstatus"]) //data都为原线索数据
|
|
|
- trailstatusTime := common.ObjToString(data["trailstatus_time"])
|
|
|
+ trailstatus := gconv.String(data["trailstatus"]) //data都为原线索数据
|
|
|
+ trailstatusTime := gconv.String(data["trailstatus_time"])
|
|
|
var trailstatusTimes time.Time
|
|
|
if trailstatusTime != "" {
|
|
|
trailstatusTimes, _ = time.ParseInLocation(date.Date_Full_Layout, trailstatusTime, time.Local)
|
|
@@ -725,24 +740,24 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
clueId := common.Int64All(data["id"])
|
|
|
is_assign := common.IntAll(data["is_assign"])
|
|
|
oldsaleName, oldTaskTime, taskTime, is_task, taskstatus := "", "", "", 0, 0
|
|
|
- old_position_id, old_seatNumber := common.Int64All(data["position_id"]), common.ObjToString(data["seatNumber"])
|
|
|
- oldTaskTime = common.ObjToString(data["tasktime"])
|
|
|
+ old_position_id, old_seatNumber := common.Int64All(data["position_id"]), gconv.String(data["seatNumber"])
|
|
|
+ oldTaskTime = gconv.String(data["tasktime"])
|
|
|
is_task = common.IntAll(data["is_task"])
|
|
|
taskstatus = common.IntAll(data["taskstatus"])
|
|
|
BCPCID := common.GetRandom(32)
|
|
|
- old_name := common.ObjToString(data["name"])
|
|
|
- old_position := common.ObjToString(data["position"])
|
|
|
- old_department := common.ObjToString(data["department"])
|
|
|
- old_follow_project_area := common.ObjToString(data["follow_project_area"])
|
|
|
- old_role := common.ObjToString(data["role"])
|
|
|
- old_cluename := common.ObjToString(data["cluename"])
|
|
|
- old_top_cluetype := common.ObjToString(data["top_cluetype"])
|
|
|
- old_sub_cluetype := common.ObjToString(data["sub_cluetype"])
|
|
|
+ old_name := gconv.String(data["name"])
|
|
|
+ old_position := gconv.String(data["position"])
|
|
|
+ old_department := gconv.String(data["department"])
|
|
|
+ old_follow_project_area := gconv.String(data["follow_project_area"])
|
|
|
+ old_role := gconv.String(data["role"])
|
|
|
+ old_cluename := gconv.String(data["cluename"])
|
|
|
+ old_top_cluetype := gconv.String(data["top_cluetype"])
|
|
|
+ old_sub_cluetype := gconv.String(data["sub_cluetype"])
|
|
|
label := gconv.Int64(data["label"])
|
|
|
old_topname, old_subname := "", ""
|
|
|
is_transfer := common.IntAll(data["is_transfer"])
|
|
|
if taskstatus == 1 || is_task == 0 {
|
|
|
- taskTime = common.ObjToString(common.If(item != "users", nowTime, nowTimes)) //任务时间,正常的是当前时间,新用户是当前时间+12个小时
|
|
|
+ taskTime = gconv.String(common.If(item != "users", nowTime, nowTimes)) //任务时间,正常的是当前时间,新用户是当前时间+12个小时
|
|
|
} else {
|
|
|
if is_task == 1 {
|
|
|
if oldTaskTime != "" { //以最新的任务时间为主
|
|
@@ -797,12 +812,12 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
"company_nature": isGroup,
|
|
|
"company_verification": isCommerce,
|
|
|
}
|
|
|
- old_remark := common.ObjToString(data["remark"])
|
|
|
+ old_remark := gconv.String(data["remark"])
|
|
|
if old_remark != "" {
|
|
|
remark = old_remark + ";" + remark //备注不能替换,只能往上拼接
|
|
|
}
|
|
|
clueUpdateData["remark"] = remark
|
|
|
- old_demand := common.ObjToString(data["customer_demand"])
|
|
|
+ old_demand := gconv.String(data["customer_demand"])
|
|
|
if demand != old_demand {
|
|
|
clueUpdateData["customer_demand"] = demand
|
|
|
}
|
|
@@ -834,7 +849,7 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
clueUpdateData["department"] = departments
|
|
|
department = departments
|
|
|
}
|
|
|
- business_scope := common.ObjToString(data["business_scope"])
|
|
|
+ business_scope := gconv.String(data["business_scope"])
|
|
|
keywords := ""
|
|
|
if len(keyword) > 0 && keyword[0] != "" {
|
|
|
keywords = strings.Join(keyword, ",")
|
|
@@ -848,7 +863,7 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
if old_position_id != 0 {
|
|
|
for _, v := range saleData {
|
|
|
if old_position_id == common.Int64All(v["position_id"]) {
|
|
|
- oldsaleName = common.ObjToString(v["name"])
|
|
|
+ oldsaleName = gconv.String(v["name"])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -898,7 +913,7 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
eData := TiDb.Find("dwd_f_crm_clue_change_record", map[string]interface{}{"clue_id": clueId, "change_type": "加入任务车"}, "", "", -1, -1)
|
|
|
if eData != nil && len(*eData) > 0 {
|
|
|
for _, e := range *eData {
|
|
|
- new_value := common.ObjToString(e["new_value"])
|
|
|
+ new_value := gconv.String(e["new_value"])
|
|
|
if strings.Contains(new_value, subname) {
|
|
|
is_ok = true
|
|
|
}
|
|
@@ -1108,7 +1123,7 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
cdata := TiDb.FindOne("dwd_f_csm_customer_info", map[string]interface{}{"clue_id": clueId}, "", "")
|
|
|
if cdata != nil && len(*cdata) > 0 {
|
|
|
kcpositionId := common.Int64All((*cdata)["position_id"])
|
|
|
- tasksource := common.ObjToString((*cdata)["tasksource"])
|
|
|
+ tasksource := gconv.String((*cdata)["tasksource"])
|
|
|
taskstatus := common.IntAll((*cdata)["taskstatus"])
|
|
|
updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
@@ -1154,13 +1169,13 @@ func WorkUpdateClue(data map[string]interface{}, saleData []map[string]interface
|
|
|
if old_top_cluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_top_cluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_topname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_topname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if old_sub_cluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_sub_cluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_subname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_subname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if item != "orders" {
|
|
@@ -1308,8 +1323,8 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
name = strings.ReplaceAll(name, " ", "")
|
|
|
nowTime := time.Now().Format("2006-01-02 15:04:05")
|
|
|
nowTimes := time.Unix(time.Now().Unix()+3600*12, 0).Format("2006-01-02 15:04:05")
|
|
|
- trailstatus := common.ObjToString(data["trailstatus"]) //data都为原线索数据
|
|
|
- trailstatusTime := common.ObjToString(data["trailstatus_time"])
|
|
|
+ trailstatus := gconv.String(data["trailstatus"]) //data都为原线索数据
|
|
|
+ trailstatusTime := gconv.String(data["trailstatus_time"])
|
|
|
var trailstatusTimes time.Time
|
|
|
if trailstatusTime != "" {
|
|
|
trailstatusTimes, _ = time.ParseInLocation(date.Date_Full_Layout, trailstatusTime, time.Local)
|
|
@@ -1317,25 +1332,25 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
clueId := common.Int64All(data["id"])
|
|
|
is_assign := common.IntAll(data["is_assign"])
|
|
|
oldsaleName, oldTaskTime, taskTime, is_task, taskstatus := "", "", "", 0, 0
|
|
|
- old_position_id, old_seatNumber := common.Int64All(data["position_id"]), common.ObjToString(data["seatNumber"])
|
|
|
- oldTaskTime = common.ObjToString(data["tasktime"])
|
|
|
+ old_position_id, old_seatNumber := common.Int64All(data["position_id"]), gconv.String(data["seatNumber"])
|
|
|
+ oldTaskTime = gconv.String(data["tasktime"])
|
|
|
is_task = common.IntAll(data["is_task"])
|
|
|
taskstatus = common.IntAll(data["taskstatus"])
|
|
|
BCPCID := common.GetRandom(32)
|
|
|
- old_name := common.ObjToString(data["name"])
|
|
|
- old_position := common.ObjToString(data["position"])
|
|
|
- old_department := common.ObjToString(data["department"])
|
|
|
- old_follow_project_area := common.ObjToString(data["follow_project_area"])
|
|
|
- old_role := common.ObjToString(data["role"])
|
|
|
- old_cluename := common.ObjToString(data["cluename"])
|
|
|
- old_top_cluetype := common.ObjToString(data["top_cluetype"])
|
|
|
- old_sub_cluetype := common.ObjToString(data["sub_cluetype"])
|
|
|
+ old_name := gconv.String(data["name"])
|
|
|
+ old_position := gconv.String(data["position"])
|
|
|
+ old_department := gconv.String(data["department"])
|
|
|
+ old_follow_project_area := gconv.String(data["follow_project_area"])
|
|
|
+ old_role := gconv.String(data["role"])
|
|
|
+ old_cluename := gconv.String(data["cluename"])
|
|
|
+ old_top_cluetype := gconv.String(data["top_cluetype"])
|
|
|
+ old_sub_cluetype := gconv.String(data["sub_cluetype"])
|
|
|
old_topname, old_subname := "", ""
|
|
|
is_transfer := common.IntAll(data["is_transfer"])
|
|
|
oldLabelChangeTime := gconv.String(data["labelChangeTime"])
|
|
|
label := gconv.Int64(data["label"])
|
|
|
if taskstatus == 1 || is_task == 0 {
|
|
|
- taskTime = common.ObjToString(common.If(item != "users", nowTime, nowTimes)) //任务时间,正常的是当前时间,新用户是当前时间+12个小时
|
|
|
+ taskTime = gconv.String(common.If(item != "users", nowTime, nowTimes)) //任务时间,正常的是当前时间,新用户是当前时间+12个小时
|
|
|
} else {
|
|
|
if is_task == 1 {
|
|
|
if oldTaskTime != "" { //以最新的任务时间为主
|
|
@@ -1390,7 +1405,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
"company_nature": isGroup,
|
|
|
"company_verification": isCommerce,
|
|
|
}
|
|
|
- old_remark := common.ObjToString(data["remark"])
|
|
|
+ old_remark := gconv.String(data["remark"])
|
|
|
if old_remark != "" {
|
|
|
remark = old_remark + ";" + remark //备注不能替换,只能往上拼接
|
|
|
}
|
|
@@ -1422,7 +1437,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
clueUpdateData["department"] = departments
|
|
|
department = departments
|
|
|
}
|
|
|
- business_scope := common.ObjToString(data["business_scope"])
|
|
|
+ business_scope := gconv.String(data["business_scope"])
|
|
|
keywords := ""
|
|
|
if len(keyword) > 0 && keyword[0] != "" {
|
|
|
keywords = strings.Join(keyword, ",")
|
|
@@ -1487,7 +1502,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
clueUpdateData["clue_level"] = nil
|
|
|
for _, v := range saleData {
|
|
|
if common.Int64All(data["position_id"]) == common.Int64All(v["position_id"]) {
|
|
|
- oldsaleName = common.ObjToString(v["name"])
|
|
|
+ oldsaleName = gconv.String(v["name"])
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1526,7 +1541,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
eData := TiDb.Find("dwd_f_crm_clue_change_record", map[string]interface{}{"clue_id": clueId, "change_type": "加入任务车"}, "", "", -1, -1)
|
|
|
if eData != nil && len(*eData) > 0 {
|
|
|
for _, e := range *eData {
|
|
|
- new_value := common.ObjToString(e["new_value"])
|
|
|
+ new_value := gconv.String(e["new_value"])
|
|
|
if strings.Contains(new_value, subname) {
|
|
|
is_ok = true
|
|
|
}
|
|
@@ -1733,7 +1748,7 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
cdata := TiDb.FindOne("dwd_f_csm_customer_info", map[string]interface{}{"clue_id": clueId}, "", "")
|
|
|
if cdata != nil && len(*cdata) > 0 {
|
|
|
kcpositionId := common.Int64All((*cdata)["position_id"])
|
|
|
- tasksource := common.ObjToString((*cdata)["tasksource"])
|
|
|
+ tasksource := gconv.String((*cdata)["tasksource"])
|
|
|
taskstatus := common.IntAll((*cdata)["taskstatus"])
|
|
|
updateId5 = TiDb.InsertByTx(tx, "dwd_f_crm_clue_change_record", map[string]interface{}{
|
|
|
"clue_id": clueId,
|
|
@@ -1779,13 +1794,13 @@ func UpdateClue(data map[string]interface{}, saleData []map[string]interface{},
|
|
|
if old_top_cluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_top_cluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_topname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_topname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if old_sub_cluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": old_sub_cluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_subname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_subname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if item != "orders" {
|
|
@@ -1986,13 +2001,13 @@ func clueInfoUpdate(data ClueMapEntity) bool {
|
|
|
if data.OldTopCluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": data.OldTopCluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_topname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_topname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if data.OldSubCluetype != "" {
|
|
|
pcodeData := TiDb.FindOne("dwd_d_crm_cluetype_code", map[string]interface{}{"code": data.OldSubCluetype}, "", "")
|
|
|
if pcodeData != nil && len(*pcodeData) > 0 {
|
|
|
- old_subname = common.ObjToString((*pcodeData)["name"])
|
|
|
+ old_subname = gconv.String((*pcodeData)["name"])
|
|
|
}
|
|
|
}
|
|
|
if data.Item != "orders" {
|