|
@@ -1,6 +1,7 @@
|
|
|
package history
|
|
|
|
|
|
import (
|
|
|
+ "fmt"
|
|
|
"log"
|
|
|
"os"
|
|
|
qu "qfw/util"
|
|
@@ -446,7 +447,7 @@ func MergeField(str1, str2 string) string {
|
|
|
}
|
|
|
|
|
|
//补充信息并保存
|
|
|
-func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, historyId string) {
|
|
|
+func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, historyId, appid string) bool {
|
|
|
if IsSearchHosp { //医院信息
|
|
|
SearchHospInfo(tmp)
|
|
|
}
|
|
@@ -463,7 +464,28 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
|
|
|
if bidopentime, ok := tmp["bidopentime"].(float64); ok && bidopentime > 0 {
|
|
|
tmp["bidopentime"] = qu.Int64All(bidopentime)
|
|
|
}
|
|
|
+ //
|
|
|
+ if ProjectAppidMap[appid] {
|
|
|
+ projectId := GetProjectId(id)
|
|
|
+ if projectId != "" {
|
|
|
+ projectIds := strings.Split(projectId, ",")
|
|
|
+ tmp["projectId"] = projectId
|
|
|
+ isOk := true
|
|
|
+ for _, v := range projectIds {
|
|
|
+ if _, ok := projectIdMap.Load(v); ok {
|
|
|
+ isOk = false
|
|
|
+ } else {
|
|
|
+ projectIdMap.Store(v, true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if !isOk {
|
|
|
+ MgoSave.Save(SaveCollProject, tmp)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
MgoSaveCache <- tmp
|
|
|
+ return true
|
|
|
}
|
|
|
|
|
|
//查询第三方医院等级信息和招标客户的社会征信代码
|
|
@@ -541,8 +563,8 @@ func SearchEnterpriseInfo(tmp map[string]interface{}) {
|
|
|
}
|
|
|
//从最新年报中获取 中标单位联系电话、中标单位邮箱
|
|
|
if annual_reports, ok := data["annual_reports"].(primitive.A); ok && len(annual_reports) > 0 {
|
|
|
- anreport:=Sort_year_report(annual_reports)
|
|
|
- if len(anreport)>0{
|
|
|
+ anreport := Sort_year_report(annual_reports)
|
|
|
+ if len(anreport) > 0 {
|
|
|
if email := qu.ObjToString(anreport["company_email"]); email != "" {
|
|
|
tmp["company_email"] = email
|
|
|
}
|
|
@@ -853,3 +875,45 @@ func PathExists(path string) (bool, error) {
|
|
|
}
|
|
|
return false, err
|
|
|
}
|
|
|
+
|
|
|
+func GetProjectId(id string) string {
|
|
|
+ query := `{"query": {"bool": {"must": [{"term": {"projectset.ids": "%s"}}],"must_not": [],"should": []}}}`
|
|
|
+ querys := fmt.Sprintf(query, id)
|
|
|
+ projectId := ""
|
|
|
+ projectIdArr := []string{}
|
|
|
+ data := Es.Get("projectset", "projectset", querys)
|
|
|
+ if data != nil && *data != nil && len(*data) > 0 {
|
|
|
+ for _, v := range *data {
|
|
|
+ projectIdArr = append(projectIdArr, qu.ObjToString(v["_id"]))
|
|
|
+
|
|
|
+ }
|
|
|
+ projectId = strings.Join(projectIdArr, ",")
|
|
|
+ log.Println("projectId", projectId)
|
|
|
+ }
|
|
|
+ return projectId
|
|
|
+}
|
|
|
+
|
|
|
+func InitProjectId() {
|
|
|
+ session := MgoSave.GetMgoConn()
|
|
|
+ count := 0
|
|
|
+ defer func() {
|
|
|
+ MgoSave.DestoryMongoConn(session)
|
|
|
+ log.Printf("本次共取到%d个projectId\n", count)
|
|
|
+ }()
|
|
|
+ save := Sysconfig["save"].(map[string]interface{})
|
|
|
+ query := map[string]interface{}{"appid": Sysconfig["project_appid"]}
|
|
|
+ field := map[string]interface{}{"projectId": 1}
|
|
|
+ iter := session.DB(qu.ObjToString(save["db"])).C(SaveColl).Find(query).Select(field).Sort("_id").Iter()
|
|
|
+ thisData := map[string]interface{}{}
|
|
|
+ for {
|
|
|
+ if !iter.Next(&thisData) {
|
|
|
+ break
|
|
|
+ }
|
|
|
+ projectId := qu.ObjToString(thisData["projectId"])
|
|
|
+ if projectId != "" {
|
|
|
+ projectIdMap.Store(projectId, true)
|
|
|
+ count++
|
|
|
+ }
|
|
|
+ thisData = map[string]interface{}{}
|
|
|
+ }
|
|
|
+}
|