Переглянути джерело

更新 预测结果时间 逻辑

wcc 2 роки тому
батько
коміт
3e9e3bc8c0
1 змінених файлів з 33 додано та 6 видалено
  1. 33 6
      createEsIndex/bidding_es.go

+ 33 - 6
createEsIndex/bidding_es.go

@@ -8,7 +8,6 @@ import (
 	"encoding/json"
 	"esindex/config"
 	"esindex/oss"
-	"fmt"
 	"go.mongodb.org/mongo-driver/bson"
 	"go.uber.org/zap"
 	"reflect"
@@ -192,6 +191,13 @@ func biddingAllTask(mapInfo map[string]interface{}) {
 			index++
 			indexLock.Unlock()
 			newTmp, update := GetEsField(tmp, stype)
+			//针对中国政府采购网,单独处理
+			if util.ObjToString(tmp["site"]) == "中国政府采购网" {
+				objectType := MatchService(tmp)
+				if objectType != "" {
+					newTmp["object_type"] = objectType
+				}
+			}
 			newTmp["dataweight"] = 0 //索引数据新增 jy置顶字段
 			if len(update) > 0 {
 				updateBiddingPool <- []map[string]interface{}{{
@@ -479,19 +485,41 @@ func getFileText(tmp map[string]interface{}) (filetext string) {
 
 // 预测结果时间
 func YuceEndtime(tmp map[string]interface{}) {
-	flag := true
-	scope := []string{"服务采购_法律咨询", "服务采购_会计", "服务采购_物业", "服务采购_审计", "服务采购_安保", "服务采购_仓储物流",
-		"服务采购_广告宣传印刷"}
+	flag := false
+	flag2 := false
+	scope := []string{"信息技术_运维服务", "信息技术_软件开发", "信息技术_系统集成及安全", "信息技术_其他"}
+	titles := []string{"短信服务", "短信发送服务"}
+	details := []string{"短信发送服务", "短信服务平台", "短信服务项目"}
 	subscopeclass := util.ObjToString(tmp["s_subscopeclass"])
+	//先判断满足 s_subscopeclass 条件
 	for _, v := range scope {
 		if strings.Contains(subscopeclass, v) {
-			flag = false
+			flag = true
 			break
 		}
 	}
+	//满足 s_subscopeclass ,再去判断title  detail
 	if flag {
+		title := util.ObjToString(tmp["title"])
+		for _, v := range titles {
+			if strings.Contains(title, v) {
+				flag2 = true
+			}
+		}
+		if !flag2 {
+			detail := util.ObjToString(tmp["detail"])
+			for _, v := range details {
+				if strings.Contains(detail, v) {
+					flag2 = true
+				}
+			}
+		}
+	}
+
+	if !flag2 {
 		return
 	}
+
 	subtype := util.ObjToString(tmp["subtype"])
 	if subtype == "成交" || subtype == "合同" {
 		// yucestarttime、yuceendtime
@@ -584,7 +612,6 @@ func MatchService(tmp map[string]interface{}) (res string) {
 	if jsondata, ok := tmp["jsondata"]; ok {
 		if da, ok := jsondata.(map[string]interface{}); ok {
 			if item, ok := da["item"]; ok {
-				fmt.Println("item=>", item)
 				services := []string{"货物", "服务", "工程"}
 				for _, v := range services {
 					if strings.Contains(util.ObjToString(item), v) {