|
@@ -1,6 +1,7 @@
|
|
|
package history
|
|
|
|
|
|
import (
|
|
|
+ "encoding/json"
|
|
|
"fmt"
|
|
|
|
|
|
"log"
|
|
@@ -130,6 +131,24 @@ var FieldMap = map[string]interface{}{
|
|
|
"id": "唯一标识",
|
|
|
}
|
|
|
|
|
|
+type (
|
|
|
+ OwnerContact struct {
|
|
|
+ ContactData []ContactDataStruct `json:"contactData"`
|
|
|
+ }
|
|
|
+ ContactDataStruct struct {
|
|
|
+ CompanyName string `json:"companyName"`
|
|
|
+ Contact []ContactStruct `json:"contact"`
|
|
|
+ }
|
|
|
+ ContactStruct struct {
|
|
|
+ Name string `json:"name"`
|
|
|
+ Phone string `json:"phone"`
|
|
|
+ }
|
|
|
+ Contact struct {
|
|
|
+ ContactPerson string `json:"contact_person"`
|
|
|
+ Phone string `json:"phone"`
|
|
|
+ }
|
|
|
+)
|
|
|
+
|
|
|
// 加载排除词、附加词、关键词
|
|
|
func GetNotkeyAndKeyAddWord(list []map[string]interface{}, fieldMap map[string]interface{}, hasNotKey bool) (kws []*KeyWord, aws []*AddWord, nkws []*NotKeyWord, tagnames, buyerclasss []string) {
|
|
|
defer qu.Catch()
|
|
@@ -674,19 +693,6 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
|
|
|
} else {
|
|
|
tmp["projectId"] = ""
|
|
|
}
|
|
|
-
|
|
|
- //河南移动/盈峰科技
|
|
|
- /*if NeedProjectidAppidMap[appid] {
|
|
|
- projectId := GetProjectId(id)
|
|
|
- if projectId != "" {
|
|
|
- //projectIds := strings.Split(projectId, ",")
|
|
|
- //tmp["projectId"] = SE.EncodeString(projectId)
|
|
|
- tmp["projectId"] = projectId
|
|
|
- } else {
|
|
|
- tmp["projectId"] = ""
|
|
|
- }
|
|
|
- }*/
|
|
|
-
|
|
|
// 标识第一条数据是否拆过包
|
|
|
var isDis bool = false
|
|
|
if DisPackageAppidMap[appid] {
|
|
@@ -948,6 +954,95 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ if FilterOwnerMap[appid] {
|
|
|
+ SearchOwnerInfo(tmp)
|
|
|
+ owner := qu.ObjToString(tmp["owner"])
|
|
|
+ if owner != "" {
|
|
|
+ contactData := MgoEnps.FindOne("buyer_enterprise", bson.M{"buyer_name": owner})
|
|
|
+ if contactData != nil && len(contactData) > 0 {
|
|
|
+ if contactData["contact"] != nil {
|
|
|
+ contact := []Contact{}
|
|
|
+ contactB, _ := json.Marshal(contactData["contact"])
|
|
|
+ json.Unmarshal(contactB, &contact)
|
|
|
+ if len(contact) > 0 {
|
|
|
+ contactStructs := []ContactStruct{}
|
|
|
+ for _, v := range contact {
|
|
|
+ contactStruct := ContactStruct{
|
|
|
+ Name: v.ContactPerson,
|
|
|
+ Phone: v.Phone,
|
|
|
+ }
|
|
|
+ contactStructs = append(contactStructs, contactStruct)
|
|
|
+ }
|
|
|
+ if len(contactStructs) > 0 {
|
|
|
+ contactDataStruct := ContactDataStruct{
|
|
|
+ CompanyName: owner,
|
|
|
+ Contact: contactStructs,
|
|
|
+ }
|
|
|
+ contactDataStructs := []ContactDataStruct{contactDataStruct}
|
|
|
+ ownerContact := OwnerContact{
|
|
|
+ ContactData: contactDataStructs,
|
|
|
+ }
|
|
|
+ ownerByte, _ := json.Marshal(&ownerContact)
|
|
|
+ tmp["owner_contact"] = string(ownerByte)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // if partners, ok := contactData["contact"].([]interface{}); ok && len(partners) > 0 {
|
|
|
+ // log.Println("owner联系方式不为空", partners)
|
|
|
+ // contactStructs := []ContactStruct{}
|
|
|
+ // for _, partner := range partners {
|
|
|
+ // if p, oks := partner.(map[string]interface{}); oks {
|
|
|
+ // if contact_name := qu.ObjToString(p["contact_person"]); contact_name != "" {
|
|
|
+ // contactStruct := ContactStruct{
|
|
|
+ // Name: contact_name,
|
|
|
+ // Phone: qu.ObjToString(p["phone"]),
|
|
|
+ // }
|
|
|
+ // contactStructs = append(contactStructs, contactStruct)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if len(contactStructs) > 0 {
|
|
|
+ // contactDataStruct := ContactDataStruct{
|
|
|
+ // CompanyName: owner,
|
|
|
+ // Contact: contactStructs,
|
|
|
+ // }
|
|
|
+ // contactDataStructs := []ContactDataStruct{contactDataStruct}
|
|
|
+ // ownerContact := OwnerContact{
|
|
|
+ // ContactData: contactDataStructs,
|
|
|
+ // }
|
|
|
+ // ownerByte, _ := json.Marshal(&ownerContact)
|
|
|
+ // tmp["owner_contact"] = string(ownerByte)
|
|
|
+ // log.Println("owner联系方式owner_contact", string(ownerByte))
|
|
|
+ // }
|
|
|
+ // } else if partners, ok := contactData["contact"].([]map[string]interface{}); ok && len(partners) > 0 {
|
|
|
+ // log.Println("owner联系方式不为空222", partners)
|
|
|
+ // contactStructs := []ContactStruct{}
|
|
|
+ // for _, p := range partners {
|
|
|
+ // if contact_name := qu.ObjToString(p["contact_person"]); contact_name != "" {
|
|
|
+ // contactStruct := ContactStruct{
|
|
|
+ // Name: contact_name,
|
|
|
+ // Phone: qu.ObjToString(p["phone"]),
|
|
|
+ // }
|
|
|
+ // contactStructs = append(contactStructs, contactStruct)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if len(contactStructs) > 0 {
|
|
|
+ // contactDataStruct := ContactDataStruct{
|
|
|
+ // CompanyName: owner,
|
|
|
+ // Contact: contactStructs,
|
|
|
+ // }
|
|
|
+ // contactDataStructs := []ContactDataStruct{contactDataStruct}
|
|
|
+ // ownerContact := OwnerContact{
|
|
|
+ // ContactData: contactDataStructs,
|
|
|
+ // }
|
|
|
+ // ownerByte, _ := json.Marshal(&ownerContact)
|
|
|
+ // tmp["owner_contact"] = string(ownerByte)
|
|
|
+ // log.Println("owner联系方式owner_contact", string(ownerByte))
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
//导出中标单位联系方式
|
|
|
if i_contact == 1 {
|
|
|
var company = map[string]string{}
|
|
@@ -1093,6 +1188,61 @@ func SearchEnterpriseInfo(tmp map[string]interface{}) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+func SearchOwnerInfo(tmp map[string]interface{}) {
|
|
|
+ owner := qu.ObjToString(tmp["owner"])
|
|
|
+ if owner != "" {
|
|
|
+ data := MgoEnps.FindOne(EnpsColl, bson.M{"company_name": owner})
|
|
|
+ if data != nil && len(data) > 0 {
|
|
|
+ //注册省份
|
|
|
+ if company_area := qu.ObjToString(data["company_area"]); company_area != "" {
|
|
|
+ tmp["owner_company_area"] = company_area
|
|
|
+ }
|
|
|
+ //注册城市
|
|
|
+ if company_city := qu.ObjToString(data["company_city"]); company_city != "" {
|
|
|
+ tmp["owner_company_city"] = company_city
|
|
|
+ }
|
|
|
+ //注册区县
|
|
|
+ if company_district := qu.ObjToString(data["company_district"]); company_district != "" {
|
|
|
+ tmp["owner_company_district"] = company_district
|
|
|
+ }
|
|
|
+ //中标单位联系人
|
|
|
+ if legal_person := qu.ObjToString(data["legal_person"]); legal_person != "" {
|
|
|
+ tmp["owner_legal_person"] = legal_person
|
|
|
+ }
|
|
|
+ //中标单位的注册地址
|
|
|
+ if company_address := qu.ObjToString(data["company_address"]); company_address != "" {
|
|
|
+ tmp["owner_company_address"] = company_address
|
|
|
+ }
|
|
|
+ //注册资金"capital" : "324 万","capital" : 124.8,
|
|
|
+ if data["capital"] != nil {
|
|
|
+ tmp["owner_capital"] = qu.Float64All(data["capital"])
|
|
|
+ }
|
|
|
+ //注册时间"establish_date" : ISODate("1949-10-01T00:00:00.000+0000")
|
|
|
+ if establish_date := qu.ObjToString(data["establish_date"]); establish_date != "" {
|
|
|
+ tmp["owner_establish_date"] = establish_date
|
|
|
+ }
|
|
|
+ //经营范围
|
|
|
+ if business_scope := qu.ObjToString(data["business_scope"]); business_scope != "" {
|
|
|
+ tmp["owner_business_scope"] = business_scope
|
|
|
+ }
|
|
|
+ //中标单位的社会征信代码
|
|
|
+ if credit_no := qu.ObjToString(data["credit_no"]); credit_no != "" {
|
|
|
+ tmp["owner_winner_credit_no"] = credit_no
|
|
|
+ }
|
|
|
+ //股东名单
|
|
|
+ if stock_name := qu.ObjToString(data["stock_name"]); stock_name != "" {
|
|
|
+ tmp["owner_stock_name"] = stock_name
|
|
|
+ }
|
|
|
+ if email := qu.ObjToString(data["company_email"]); email != "" {
|
|
|
+ tmp["owner_company_email"] = email
|
|
|
+ }
|
|
|
+ if phone := qu.ObjToString(data["company_phone"]); phone != "" {
|
|
|
+ tmp["owner_company_phone"] = phone
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
func SearchEnterpriseInfos(tmp map[string]interface{}, s_winner string) {
|
|
|
winner := strings.Split(s_winner, ",")[0] //取第一个中标单位
|
|
|
data := MgoEnps.FindOne(EnpsColl, bson.M{"company_name": winner})
|