|
@@ -46,6 +46,28 @@ func winnerStandarData(db string, query map[string]interface{}) {
|
|
|
}
|
|
|
data := comHisMegerNewData(winner, "winner", []map[string]interface{}{v})
|
|
|
if data != nil {
|
|
|
+ province, city, district := "", "", ""
|
|
|
+ province = qu.ObjToString(data["province"])
|
|
|
+ if province == "" { //省份为空,buyer优先提取区域信息再company_address
|
|
|
+ province, city, district = GetProvinceCityDistrict([]string{winner}) //先buyer
|
|
|
+ if province == "" { //再address
|
|
|
+ if address := qu.ObjToString(data["company_address"]); address != "" {
|
|
|
+ province, city, district = GetProvinceCityDistrict([]string{address})
|
|
|
+ }
|
|
|
+ }
|
|
|
+ data["province"] = province
|
|
|
+ data["city"] = city
|
|
|
+ data["district"] = district
|
|
|
+ }
|
|
|
+ //提取固话和手机号
|
|
|
+ contactArr := []interface{}{}
|
|
|
+ contactArr = append(contactArr, v)
|
|
|
+ latestFixedPhone, latestMobilePhone, timesFixedPhone, timesMobilePhone := getPhone(contactArr)
|
|
|
+ data["latestfixedphone"] = latestFixedPhone
|
|
|
+ data["latestmobilephone"] = latestMobilePhone
|
|
|
+ data["fixedphone"] = timesFixedPhone
|
|
|
+ data["mobilephone"] = timesMobilePhone
|
|
|
+ data["institute_type"] = "企业"
|
|
|
_id := MongoTo.Save(winnerent, data)
|
|
|
redis.PutRedis("winner", winnerbd, winner, _id.(primitive.ObjectID).Hex(), -1)
|
|
|
savetoerr = false
|
|
@@ -54,16 +76,20 @@ func winnerStandarData(db string, query map[string]interface{}) {
|
|
|
if savetoerr {
|
|
|
t := MongoTo.FindOne(winnererr, map[string]interface{}{"name": winner})
|
|
|
if len(t) < 1 {
|
|
|
+ province, city, district := GetProvinceCityDistrict([]string{winner})
|
|
|
MongoTo.Save(winnererr, map[string]interface{}{
|
|
|
"name": winner,
|
|
|
"topscopeclass": comRepTopscopeclass(topscopeclass),
|
|
|
"check": comMarkdata(winner, "winner"),
|
|
|
"updatetime": time.Now().Unix(),
|
|
|
+ "province": province,
|
|
|
+ "city": city,
|
|
|
+ "district": district,
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
} else { //更新标准库
|
|
|
- if winnerperson != "" || winnertel != "" {
|
|
|
+ if winnerperson != "" && winnertel != "" {
|
|
|
v := map[string]interface{}{
|
|
|
"contact_person": winnerperson,
|
|
|
"phone": winnertel,
|
|
@@ -74,7 +100,7 @@ func winnerStandarData(db string, query map[string]interface{}) {
|
|
|
MongoTo.UpdateById(winnerent, entid,
|
|
|
map[string]interface{}{
|
|
|
"$set": data,
|
|
|
- "$push": map[string]interface{}{"contact": v},
|
|
|
+ //"$push": map[string]interface{}{"contact": v},
|
|
|
},
|
|
|
)
|
|
|
}
|
|
@@ -231,29 +257,48 @@ func winStandarHistory(db string) {
|
|
|
|
|
|
//企业数据整合(已有标注信息)
|
|
|
func winMegerIndustry(id string, ps map[string]interface{}) map[string]interface{} {
|
|
|
- tmp := MongoEnt.FindById(winnerent, id, bson.M{"industry": 1})
|
|
|
+ tmp := MongoEnt.FindById(winnerent, id, bson.M{"industry": 1, "contact": 1})
|
|
|
if len(tmp) < 1 {
|
|
|
return nil
|
|
|
}
|
|
|
data := map[string]interface{}{}
|
|
|
- industry := tmp["industry"].(primitive.A)
|
|
|
- tmpindustry := map[string]bool{}
|
|
|
- for _, v := range industry {
|
|
|
- tt := qu.ObjToString(v)
|
|
|
- tmpindustry[tt] = true
|
|
|
- }
|
|
|
- if topscopeclass, ok := ps["topscopeclass"].([]interface{}); ok {
|
|
|
- for _, v := range topscopeclass {
|
|
|
+ industry,ok := tmp["industry"].(primitive.A)
|
|
|
+ if ok{
|
|
|
+ tmpindustry := map[string]bool{}
|
|
|
+ for _, v := range industry {
|
|
|
tt := qu.ObjToString(v)
|
|
|
tmpindustry[tt] = true
|
|
|
}
|
|
|
+ if topscopeclass, ok := ps["topscopeclass"].([]interface{}); ok {
|
|
|
+ for _, v := range topscopeclass {
|
|
|
+ tt := qu.ObjToString(v)
|
|
|
+ tmpindustry[tt] = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ newindustry := []interface{}{}
|
|
|
+ for k, _ := range tmpindustry {
|
|
|
+ newindustry = append(newindustry, k)
|
|
|
+ }
|
|
|
+ data["industry"] = newindustry
|
|
|
}
|
|
|
- newindustry := []interface{}{}
|
|
|
- for k, _ := range tmpindustry {
|
|
|
- newindustry = append(newindustry, k)
|
|
|
- }
|
|
|
- data["industry"] = newindustry
|
|
|
data["updatetime"] = time.Now().Unix()
|
|
|
+ //contact
|
|
|
+ contact := tmp["contact"].(primitive.A)
|
|
|
+ contact = append(contact, ps)
|
|
|
+ //bid_contact
|
|
|
+ bid_contacts,contacts := bid_contact(contact)
|
|
|
+ if len(bid_contacts) > 0 {
|
|
|
+ data["bid_contact"] = bid_contacts
|
|
|
+ }
|
|
|
+ //sort 200
|
|
|
+ contact = contacts
|
|
|
+ data["contact"] = contact
|
|
|
+ //提取固话和手机号
|
|
|
+ latestFixedPhone, latestMobilePhone, timesFixedPhone, timesMobilePhone := getPhone(contact)
|
|
|
+ data["latestfixedphone"] = latestFixedPhone
|
|
|
+ data["latestmobilephone"] = latestMobilePhone
|
|
|
+ data["fixedphone"] = timesFixedPhone
|
|
|
+ data["mobilephone"] = timesMobilePhone
|
|
|
return data
|
|
|
}
|
|
|
|