Jianghan 11 months ago
parent
commit
4f38778d3f

+ 15 - 2
CMPlatform/history/util_history.go

@@ -942,7 +942,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 		for _, v := range company {
 			contactInfo := v + ":"
 			contactData, _ := util.MgoEnps.FindOne("winner_enterprise", bson.M{"company_name": v})
-			if partners, ok := (*contactData)["contact"].(primitive.A); ok && len(partners) > 0 {
+			if partners, ok := (*contactData)["contact"].([]interface{}); ok && len(partners) > 0 {
 				contact_name_arr := []string{}
 				for _, partner := range partners {
 					if p, oks := partner.(map[string]interface{}); oks {
@@ -966,6 +966,19 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 		}
 		tmp["contact"] = contactAllInfo
 	}
+	//2024.8.13 buyer补充标签
+	q1 := `{"query":{"bool":{"must":[{"term":{"name":"%s"}}]}}}`
+	if buyer := common.ObjToString(tmp["buyer"]); buyer != "" {
+		ent := util.Es.Get("ent_info", "", fmt.Sprintf(q1, buyer))
+		if ent != nil && len(*ent) > 0 {
+			if (*ent)[0]["tag_labels"] != nil {
+				tags := common.ObjArrToStringArr((*ent)[0]["tag_labels"].([]interface{}))
+				if len(tags) > 0 {
+					tmp["tag_labels"] = strings.Join(tags, ",")
+				}
+			}
+		}
+	}
 	if noticeFilter == 1 && (dataTable == 0 || dataTable == 1) && isOk {
 		ok := checkBidId(appid, id, dataTable)
 		log.Debug("公告去重结果", zap.String("id", id), zap.Int("dataTable", dataTable), zap.Any("ok", ok))
@@ -1457,7 +1470,7 @@ func GetXlsxs(mMap []map[string]interface{}, i_contact int, fn, email, id string
 		for index, _ := range mMap {
 			for _, v := range strings.Split(fmt.Sprint(mMap[index]["s_winner"]), ",") {
 				contactData, _ := util.MgoEnps.FindOne("winner_enterprise", bson.M{"company_name": v})
-				if partners, ok := (*contactData)["contact"].(primitive.A); ok && len(partners) > 0 {
+				if partners, ok := (*contactData)["contact"].([]interface{}); ok && len(partners) > 0 {
 					var contactInfo string
 					contact_name_arr := []string{}
 					for _, partner := range partners {

+ 1 - 1
CMPlatform/util/util.go

@@ -69,7 +69,7 @@ func FormatNumber(tmp map[string]interface{}) {
 }
 
 // 获取最新年报
-func Sort_year_report(year_report primitive.A) map[string]interface{} {
+func Sort_year_report(year_report []interface) map[string]interface{} {
 	new_year_report := year_report[0]
 	for i := 0; i < len(year_report); i++ {
 		if common.IntAll(new_year_report.(map[string]interface{})["report_year"]) < common.IntAll(year_report[i].(map[string]interface{})["report_year"]) {

+ 1 - 1
CMPlatform/util/utiltag.go

@@ -562,7 +562,7 @@ func UtilEsFind2(tags map[string]interface{}, n int) (error, int64) {
 								item["company_phone"] = phone
 							}
 							//从最新年报中获取 中标单位联系电话、中标单位邮箱
-							// if annual_reports, ok := finddata["annual_reports"].(primitive.A); ok && len(annual_reports) > 0 {
+							// if annual_reports, ok := finddata["annual_reports"].([]interface{}); ok && len(annual_reports) > 0 {
 							// 	report_year := Sort_year_report(annual_reports) //最新年报
 							// 	if len(report_year) > 0 {
 							// 		if email := common.ObjToString(report_year["company_email"]); email != "" {

+ 7 - 10
customerdata/src/task.go

@@ -8,7 +8,6 @@ import (
 	qu "qfw/util"
 	"qfw/util/redis"
 	"regexp"
-	. "sqlmodel"
 	"strings"
 	"sync"
 	"time"
@@ -22,8 +21,6 @@ import (
 
 	"github.com/antonmedv/expr"
 	"github.com/donnie4w/go-logger/logger"
-	"go.mongodb.org/mongo-driver/bson/primitive"
-
 	esV7 "github.com/olivere/elastic"
 )
 
@@ -125,7 +122,7 @@ func (c *Customer) GetTagRules() {
 					}
 				}
 				//规则
-				if o_list, ok := tr["o_list"].(primitive.A); ok && len(o_list) > 0 {
+				if o_list, ok := tr["o_list"].([]interface{}); ok && len(o_list) > 0 {
 					TR.GetKeyAddNotKeyWord(o_list)
 				}
 				c.TagRules = append(c.TagRules, TR)
@@ -151,7 +148,7 @@ func (c *Customer) GetTagRules() {
 				}
 			}
 			//规则
-			if o_list, ok := tr["o_list"].(primitive.A); ok && len(o_list) > 0 {
+			if o_list, ok := tr["o_list"].([]interface{}); ok && len(o_list) > 0 {
 				TR.GetKeyAddNotKeyWord(o_list)
 			}
 			c.TagRules2 = append(c.TagRules2, TR)
@@ -176,7 +173,7 @@ func (c *Customer) GetTagRules() {
 				}
 			}
 			//规则
-			if o_list, ok := tr["o_list"].(primitive.A); ok && len(o_list) > 0 {
+			if o_list, ok := tr["o_list"].([]interface{}); ok && len(o_list) > 0 {
 				TR.GetKeyAddNotKeyWord(o_list)
 			}
 			c.TagRules3 = append(c.TagRules3, TR)
@@ -370,7 +367,7 @@ func (c *Customer) EsConGetDataV7(stype string, esCon *esv.EsV7) {
 											tmp["company_phone"] = phone
 										}
 										//从最新年报中获取 中标单位联系电话、中标单位邮箱
-										// if annual_reports, ok := finddata["annual_reports"].(primitive.A); ok && len(annual_reports) > 0 {
+										// if annual_reports, ok := finddata["annual_reports"].([]interface{}); ok && len(annual_reports) > 0 {
 										// 	anreport := Sort_year_report(annual_reports)
 										// 	if len(anreport) > 0 {
 										// 		if email := qu.ObjToString(anreport["company_email"]); email != "" {
@@ -884,7 +881,7 @@ func (d *Department) GetSearchRules(cid, stype string, idRange, idRanges bson.M)
 				SR.GetEs(d.Name, esquery, idRange, idRanges)
 			}
 			//获取关键词和附加词
-			if o_rules, ok := sr["o_rules"].(primitive.A); ok && len(o_rules) > 0 {
+			if o_rules, ok := sr["o_rules"].([]interface{}); ok && len(o_rules) > 0 {
 				SR.GetKeyAddWord(o_rules)
 				for _, v := range o_rules {
 					orule, _ := v.(map[string]interface{})
@@ -978,7 +975,7 @@ func (sr *SearchRule) GetClearWord(key, match string) {
 }
 
 // 关键词、附加词处理
-func (sr *SearchRule) GetKeyAddWord(o_rules primitive.A) {
+func (sr *SearchRule) GetKeyAddWord(o_rules []interface) {
 	defer qu.Catch()
 	kw, aw, _, _, _ := GetNotkeyAndKeyAddWord(o_rules, sr.Fields, false)
 	sr.KW = kw
@@ -987,7 +984,7 @@ func (sr *SearchRule) GetKeyAddWord(o_rules primitive.A) {
 }
 
 // 排除词、关键词、附加词处理
-func (tr *TagRule) GetKeyAddNotKeyWord(o_list primitive.A) {
+func (tr *TagRule) GetKeyAddNotKeyWord(o_list []interface) {
 	defer qu.Catch()
 	kw, aw, nkw, tagnames, buyerclass := GetNotkeyAndKeyAddWord(o_list, tr.Fields, true)
 	tr.NW = nkw

+ 6 - 9
customerdata/src/util.go

@@ -3,6 +3,8 @@ package main
 import (
 	"encoding/json"
 	"fmt"
+	"github.com/donnie4w/go-logger/logger"
+	"gopkg.in/mgo.v2/bson"
 	"log"
 	qu "qfw/util"
 	"qfw/util/redis"
@@ -10,11 +12,6 @@ import (
 	"sort"
 	"strings"
 	"time"
-	"util/mgodb"
-
-	"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]")
@@ -54,7 +51,7 @@ type (
 )
 
 // 加载排除词、附加词、关键词
-func GetNotkeyAndKeyAddWord(list primitive.A, fieldMap map[string]interface{}, hasNotKey bool) (kws []*KeyWord, aws []*AddWord, nkws []*NotKeyWord, tagnames, buyerclasss []string) {
+func GetNotkeyAndKeyAddWord(list []interface, fieldMap map[string]interface{}, hasNotKey bool) (kws []*KeyWord, aws []*AddWord, nkws []*NotKeyWord, tagnames, buyerclasss []string) {
 	defer qu.Catch()
 	for _, rules := range list {
 		ruleMap := rules.(map[string]interface{})
@@ -358,7 +355,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
 						}
@@ -1255,7 +1252,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
 						}
@@ -1345,7 +1342,7 @@ func InitProjectId(appid string) {
 }
 
 // 获取最新年报
-func Sort_year_report(year_report primitive.A) map[string]interface{} {
+func Sort_year_report(year_report []interface) map[string]interface{} {
 	new_year_report := year_report[0]
 	for i := 0; i < len(year_report); i++ {
 		if qu.IntAll(new_year_report.(map[string]interface{})["report_year"]) < qu.IntAll(year_report[i].(map[string]interface{})["report_year"]) {