|
@@ -1,14 +1,16 @@
|
|
|
package main
|
|
|
|
|
|
import (
|
|
|
- "github.com/donnie4w/go-logger/logger"
|
|
|
- "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
- "gopkg.in/mgo.v2/bson"
|
|
|
+ "fmt"
|
|
|
"log"
|
|
|
qu "qfw/util"
|
|
|
"regexp"
|
|
|
"strings"
|
|
|
"time"
|
|
|
+
|
|
|
+ "github.com/donnie4w/go-logger/logger"
|
|
|
+ "go.mongodb.org/mongo-driver/bson/primitive"
|
|
|
+ "gopkg.in/mgo.v2/bson"
|
|
|
)
|
|
|
|
|
|
var LetterCase = regexp.MustCompile("[A-Za-z]")
|
|
@@ -339,7 +341,7 @@ func RegMatch(fieldText map[string]interface{}, matchType []string, matchReg *Re
|
|
|
for n, arc := range ar.AndRegKid { //ar.AndRegKid若有值必不小于2
|
|
|
if indexArr := arc.CrVal.FindAllStringIndex(text, -1); len(indexArr) < 1 { //匹配失败(ar.AndRegKid中任意一个未匹配则失败)
|
|
|
break
|
|
|
- } else { //匹配成功,判断字母
|
|
|
+ } else { //匹配成功,判断字母
|
|
|
if arc.IsLetter && !CheckLetter(text, arc.CrVal, indexArr) { //reg有字母,判断是否是包含关系(AAAIBBB or AI)
|
|
|
break
|
|
|
}
|
|
@@ -438,7 +440,7 @@ func MergeField(str1, str2 string) string {
|
|
|
}
|
|
|
|
|
|
//补充信息并保存
|
|
|
-func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool) {
|
|
|
+func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, appid string) bool {
|
|
|
if IsSearchHosp { //医院信息
|
|
|
SearchHospInfo(tmp)
|
|
|
}
|
|
@@ -454,7 +456,21 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool) {
|
|
|
if bidopentime, ok := tmp["bidopentime"].(float64); ok && bidopentime > 0 {
|
|
|
tmp["bidopentime"] = qu.Int64All(bidopentime)
|
|
|
}
|
|
|
+ //
|
|
|
+ if appid == qu.ObjToString(Sysconfig["project_appid"]) {
|
|
|
+ projectId := GetProjectId(id)
|
|
|
+ if projectId != "" {
|
|
|
+ tmp["projectId"] = projectId
|
|
|
+ if _, ok := projectIdMap.Load(projectId); ok {
|
|
|
+ MgoSave.Save(SaveCollProject, tmp)
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ projectIdMap.Store(projectId, true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //
|
|
|
MgoSaveCache <- tmp
|
|
|
+ return true
|
|
|
}
|
|
|
|
|
|
//查询第三方医院等级信息和招标客户的社会征信代码
|
|
@@ -722,7 +738,7 @@ func RegMatchTest(fieldText map[string]interface{}, matchType []string, matchReg
|
|
|
qu.Debug("nnnn---", n, arc.CrVal, arc.IsLetter)
|
|
|
if indexArr := arc.CrVal.FindAllStringIndex(text, -1); len(indexArr) < 1 { //匹配失败(ar.AndRegKid中任意一个未匹配则失败)
|
|
|
break
|
|
|
- } else { //匹配成功,判断字母
|
|
|
+ } else { //匹配成功,判断字母
|
|
|
if arc.IsLetter && !CheckLetter(text, arc.CrVal, indexArr) { //reg有字母,判断是否是包含关系(AAAIBBB or AI)
|
|
|
break
|
|
|
}
|
|
@@ -758,3 +774,39 @@ func SkipData(tmp map[string]interface{}) bool {
|
|
|
}
|
|
|
return false
|
|
|
}
|
|
|
+
|
|
|
+func GetProjectId(id string) string {
|
|
|
+ query := `{"query": {"bool": {"must": [{"term": {"projectset.ids": "%s"}}],"must_not": [],"should": []}},"size": 1}`
|
|
|
+ querys := fmt.Sprintf(query, id)
|
|
|
+ projectId := ""
|
|
|
+ data := Es.Get("projectset", "projectset", querys)
|
|
|
+ if data != nil && *data != nil && len(*data) > 0 {
|
|
|
+ projectId = qu.ObjToString((*data)[0]["_id"])
|
|
|
+ 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{})
|
|
|
+ log.Println(Sysconfig["project_appid"])
|
|
|
+ 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"])
|
|
|
+ projectIdMap.Store(projectId, true)
|
|
|
+ count++
|
|
|
+ thisData = map[string]interface{}{}
|
|
|
+ }
|
|
|
+}
|