|
@@ -619,7 +619,11 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
|
if tt.S_querycon == "1" { //id查询
|
|
|
if tt.S_query != "" {
|
|
|
//页面上配置了查询条件,直接使用,不再单独查询上次任务结束ID
|
|
|
-
|
|
|
+ if tt.LastId != "" && q["_id"] == nil {
|
|
|
+ q["_id"] = map[string]interface{}{
|
|
|
+ "$gt": u.StringTOBsonId(tt.LastId),
|
|
|
+ }
|
|
|
+ }
|
|
|
} else {
|
|
|
//临时修改查询id区间段
|
|
|
comeintime := time.Now().Unix() - 5*60
|
|
@@ -637,22 +641,25 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
|
}
|
|
|
if tt.LastId != "" && q["_id"] == nil {
|
|
|
sid := tt.LastId
|
|
|
- if eId <= sid || eId == "" {
|
|
|
- return
|
|
|
- }
|
|
|
q["_id"] = map[string]interface{}{
|
|
|
- "$gt": u.StringTOBsonId(sid),
|
|
|
- "$lte": u.StringTOBsonId(eId),
|
|
|
+ "$gt": u.StringTOBsonId(sid),
|
|
|
+ }
|
|
|
+
|
|
|
+ if eId != "" {
|
|
|
+ q["_id"] = map[string]interface{}{
|
|
|
+ "$gt": u.StringTOBsonId(sid),
|
|
|
+ "$lte": u.StringTOBsonId(eId),
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//按id查询,为了保证有新数据入库,每次休息2分钟
|
|
|
time.Sleep(time.Second * 60)
|
|
|
//测试环境q的赋值执行下述代码
|
|
|
- if tt.LastId != "" && q["_id"] == nil {
|
|
|
- q["_id"] = map[string]interface{}{
|
|
|
- "$gt": u.StringTOBsonId(tt.LastId),
|
|
|
- }
|
|
|
- }
|
|
|
+ //if tt.LastId != "" && q["_id"] == nil {
|
|
|
+ // q["_id"] = map[string]interface{}{
|
|
|
+ // "$gt": u.StringTOBsonId(tt.LastId),
|
|
|
+ // }
|
|
|
+ //}
|
|
|
}
|
|
|
|
|
|
} else { //时间查询
|
|
@@ -694,7 +701,7 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
|
for tmp := make(map[string]interface{}); extractquery.Next(&tmp); sum++ {
|
|
|
tid := tmp["_id"]
|
|
|
if !timespan && sum%2000 == 0 {
|
|
|
- log.Println("current:", sum)
|
|
|
+ log.Println("current:", sum, tt.S_name)
|
|
|
}
|
|
|
pool <- true
|
|
|
wg.Add(1)
|
|
@@ -752,12 +759,14 @@ func NewTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}) int {
|
|
|
SMap = NewClassificationRun(tt, tmp)
|
|
|
//一级分类时,符合结果中成交规则时
|
|
|
if SMap.Map["toptype"] == "招标" && SMap.Map["subtype"] != "单一" {
|
|
|
- if u.ChargeDetailResult(tmp["detail"].(string)) {
|
|
|
- SMap.Map["toptype"] = "结果"
|
|
|
- resa := ReSub(tt, tmp, "结果")
|
|
|
- subtype := resa.Map["subtype"]
|
|
|
- delete(SMap.Map, "subtype")
|
|
|
- SMap.Map["subtype"] = subtype
|
|
|
+ if _, ok := tmp["detail"]; ok {
|
|
|
+ if u.ChargeDetailResult(util.ObjToString(tmp["detail"])) {
|
|
|
+ SMap.Map["toptype"] = "结果"
|
|
|
+ resa := ReSub(tt, tmp, "结果")
|
|
|
+ subtype := resa.Map["subtype"]
|
|
|
+ delete(SMap.Map, "subtype")
|
|
|
+ SMap.Map["subtype"] = subtype
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
//一级分类是预告,但是标题含有招标计划,同时含有 预公告|预公示,变为 采购意向
|
|
@@ -1114,12 +1123,14 @@ func UdpTaskRunAll(tt *TTask, budp bool, mapInfo map[string]interface{}, stype s
|
|
|
SMap = NewClassificationRun(tt, result)
|
|
|
//一级分类时,符合结果中成交规则时
|
|
|
if SMap.Map["toptype"] == "招标" && SMap.Map["subtype"] != "单一" {
|
|
|
- if u.ChargeDetailResult(tmp["detail"].(string)) {
|
|
|
- SMap.Map["toptype"] = "结果"
|
|
|
- resa := ReSub(tt, tmp, "结果")
|
|
|
- subtype := resa.Map["subtype"]
|
|
|
- delete(SMap.Map, "subtype")
|
|
|
- SMap.Map["subtype"] = subtype
|
|
|
+ if _, ok := tmp["detail"]; ok {
|
|
|
+ if u.ChargeDetailResult(util.ObjToString(tmp["detail"])) {
|
|
|
+ SMap.Map["toptype"] = "结果"
|
|
|
+ resa := ReSub(tt, tmp, "结果")
|
|
|
+ subtype := resa.Map["subtype"]
|
|
|
+ delete(SMap.Map, "subtype")
|
|
|
+ SMap.Map["subtype"] = subtype
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1583,12 +1594,14 @@ func StartTask(t *TTask) {
|
|
|
if len(SMap.Map) > 0 {
|
|
|
//一级分类时,符合结果中成交规则时
|
|
|
if SMap.Map["toptype"] == "招标" && SMap.Map["subtype"] != "单一" {
|
|
|
- if u.ChargeDetailResult(tmp["detail"].(string)) {
|
|
|
- SMap.Map["toptype"] = "结果"
|
|
|
- resa := ReSub(t, tmp, "结果")
|
|
|
- subtype := resa.Map["subtype"]
|
|
|
- delete(SMap.Map, "subtype")
|
|
|
- SMap.Map["subtype"] = subtype
|
|
|
+ if _, ok := tmp["detail"]; ok {
|
|
|
+ if u.ChargeDetailResult(util.ObjToString(tmp["detail"])) {
|
|
|
+ SMap.Map["toptype"] = "结果"
|
|
|
+ resa := ReSub(t, tmp, "结果")
|
|
|
+ subtype := resa.Map["subtype"]
|
|
|
+ delete(SMap.Map, "subtype")
|
|
|
+ SMap.Map["subtype"] = subtype
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
update = append(update, map[string]interface{}{"$set": SMap.Map})
|