|
@@ -159,6 +159,8 @@ func (p *ProjectTask) clearMem() {
|
|
clearNum := 0
|
|
clearNum := 0
|
|
for k, v := range p.AllIdsMap {
|
|
for k, v := range p.AllIdsMap {
|
|
if p.currentTime-v.P.LastTime > p.validTime {
|
|
if p.currentTime-v.P.LastTime > p.validTime {
|
|
|
|
+ log.Println(p.currentTime)
|
|
|
|
+ log.Println(k)
|
|
clearNum++
|
|
clearNum++
|
|
//删除id的map
|
|
//删除id的map
|
|
delete(p.AllIdsMap, k)
|
|
delete(p.AllIdsMap, k)
|
|
@@ -213,7 +215,7 @@ func (p *ProjectTask) clearMem() {
|
|
p.mapHrefLock.Unlock()
|
|
p.mapHrefLock.Unlock()
|
|
p.AllIdsMapLock.Unlock()
|
|
p.AllIdsMapLock.Unlock()
|
|
p.findLock.Unlock()
|
|
p.findLock.Unlock()
|
|
- log.Println("清除完成:", clearNum, len(p.AllIdsMap), len(p.mapPn), len(p.mapPc), len(p.mapPb))
|
|
|
|
|
|
+ log.Println("清除完成:", clearNum, len(p.AllIdsMap), len(p.mapPn), len(p.mapPc), len(p.mapPb), len(p.mapHref))
|
|
} else {
|
|
} else {
|
|
p.clearContimes++
|
|
p.clearContimes++
|
|
}
|
|
}
|
|
@@ -288,7 +290,7 @@ func (p *ProjectTask) taskZl(udpInfo map[string]interface{}) {
|
|
if q == nil {
|
|
if q == nil {
|
|
q = map[string]interface{}{
|
|
q = map[string]interface{}{
|
|
"_id": map[string]interface{}{
|
|
"_id": map[string]interface{}{
|
|
- "$gte": StringTOBsonId(gtid),
|
|
|
|
|
|
+ "$gt": StringTOBsonId(gtid),
|
|
"$lte": StringTOBsonId(lteid),
|
|
"$lte": StringTOBsonId(lteid),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
@@ -390,12 +392,14 @@ func (p *ProjectTask) enter(db, coll string, q map[string]interface{}) {
|
|
}()
|
|
}()
|
|
if util.IntAll(tmp["repeat"]) == 0 {
|
|
if util.IntAll(tmp["repeat"]) == 0 {
|
|
p.fillInPlace(tmp)
|
|
p.fillInPlace(tmp)
|
|
|
|
+ info := ParseInfo(tmp)
|
|
|
|
+ p.currentTime = info.Publishtime
|
|
if p.currentType == "updateInfo" {
|
|
if p.currentType == "updateInfo" {
|
|
//招标信息更改合并
|
|
//招标信息更改合并
|
|
- p.updateJudge(tmp)
|
|
|
|
|
|
+ p.updateJudge(tmp, info)
|
|
}else {
|
|
}else {
|
|
//普通合并
|
|
//普通合并
|
|
- p.CommonMerge(tmp)
|
|
|
|
|
|
+ p.CommonMerge(tmp, info)
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
//信息错误,进行更新
|
|
//信息错误,进行更新
|
|
@@ -408,9 +412,9 @@ func (p *ProjectTask) enter(db, coll string, q map[string]interface{}) {
|
|
|
|
|
|
}()
|
|
}()
|
|
ms := sess.DB(db).C(coll).Find(q).Sort("publishtime")
|
|
ms := sess.DB(db).C(coll).Find(q).Sort("publishtime")
|
|
- if Sysconfig["hints"] != nil {
|
|
|
|
- ms.Hint(Sysconfig["hints"])
|
|
|
|
- }
|
|
|
|
|
|
+ //if Sysconfig["hints"] != nil {
|
|
|
|
+ // ms.Hint(Sysconfig["hints"])
|
|
|
|
+ //}
|
|
query := ms.Iter()
|
|
query := ms.Iter()
|
|
//
|
|
//
|
|
var lastid interface{}
|
|
var lastid interface{}
|
|
@@ -459,8 +463,7 @@ var (
|
|
StrOrNum2 = regexp.MustCompile("^[0-9_-]+$|^[a-zA-Z_-]+$")
|
|
StrOrNum2 = regexp.MustCompile("^[0-9_-]+$|^[a-zA-Z_-]+$")
|
|
)
|
|
)
|
|
|
|
|
|
-func (p *ProjectTask) CommonMerge(tmp map[string]interface{}) {
|
|
|
|
- info := ParseInfo(tmp)
|
|
|
|
|
|
+func (p *ProjectTask) CommonMerge(tmp map[string]interface{}, info *Info) {
|
|
if info != nil && !((info.pnbval == 1 && info.Buyer != "") || info.pnbval == 0) {
|
|
if info != nil && !((info.pnbval == 1 && info.Buyer != "") || info.pnbval == 0) {
|
|
if jsonData, ok := tmp["jsondata"].(map[string]interface{}); ok {
|
|
if jsonData, ok := tmp["jsondata"].(map[string]interface{}); ok {
|
|
if jsonData != nil && jsonData["projecthref"] != nil {
|
|
if jsonData != nil && jsonData["projecthref"] != nil {
|
|
@@ -483,12 +486,10 @@ func (p *ProjectTask) CommonMerge(tmp map[string]interface{}) {
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
//项目合并
|
|
//项目合并
|
|
- p.currentTime = info.Publishtime
|
|
|
|
p.startProjectMerge(info, tmp)
|
|
p.startProjectMerge(info, tmp)
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
//项目合并
|
|
//项目合并
|
|
- p.currentTime = info.Publishtime
|
|
|
|
p.startProjectMerge(info, tmp)
|
|
p.startProjectMerge(info, tmp)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -508,6 +509,10 @@ func ParseInfo(tmp map[string]interface{}) (info *Info) {
|
|
thisinfo.Subscopeclass = []string{}
|
|
thisinfo.Subscopeclass = []string{}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if thisinfo.Publishtime == 0 {
|
|
|
|
+ thisinfo.Publishtime = thisinfo.Comeintime
|
|
|
|
+ }
|
|
|
|
+
|
|
//从标题中查找项目编号
|
|
//从标题中查找项目编号
|
|
res := titleGetPc.FindStringSubmatch(thisinfo.Title)
|
|
res := titleGetPc.FindStringSubmatch(thisinfo.Title)
|
|
if len(res) > 1 && len(res[1]) > 6 && thisinfo.ProjectCode != res[1] && !numCheckPc.MatchString(res[1]) && !_zimureg1.MatchString(res[1]) {
|
|
if len(res) > 1 && len(res[1]) > 6 && thisinfo.ProjectCode != res[1] && !numCheckPc.MatchString(res[1]) && !_zimureg1.MatchString(res[1]) {
|
|
@@ -584,10 +589,9 @@ func ParseInfo(tmp map[string]interface{}) (info *Info) {
|
|
return thisinfo
|
|
return thisinfo
|
|
}
|
|
}
|
|
|
|
|
|
-func (p *ProjectTask) updateJudge(tmp map[string]interface{}) {
|
|
|
|
|
|
+func (p *ProjectTask) updateJudge(tmp map[string]interface{}, info *Info) {
|
|
index := -1
|
|
index := -1
|
|
pInfoId := ""
|
|
pInfoId := ""
|
|
- info := ParseInfo(tmp)
|
|
|
|
p.AllIdsMapLock.Lock()
|
|
p.AllIdsMapLock.Lock()
|
|
F:
|
|
F:
|
|
for k, ID := range p.AllIdsMap {
|
|
for k, ID := range p.AllIdsMap {
|
|
@@ -614,7 +618,7 @@ func (p *ProjectTask) updateJudge(tmp map[string]interface{}) {
|
|
|
|
|
|
//projecthref字段
|
|
//projecthref字段
|
|
jsonData := tmp["jsondata"].(map[string]interface{})
|
|
jsonData := tmp["jsondata"].(map[string]interface{})
|
|
- if jsonData != nil && jsonData["projecthref"] != "" {
|
|
|
|
|
|
+ if jsonData != nil && jsonData["projecthref"] != nil {
|
|
proHref := jsonData["projecthref"].(string)
|
|
proHref := jsonData["projecthref"].(string)
|
|
tmp["projecthref"] = proHref
|
|
tmp["projecthref"] = proHref
|
|
p.mapHrefLock.Lock()
|
|
p.mapHrefLock.Lock()
|