ソースを参照

备注~标的物数据

zhengkun 2 年 前
コミット
1c4cd33e21

+ 17 - 3
data_purchasing/src/bidclass.go

@@ -16,10 +16,10 @@ func CreateBaseUpdateInfo(tmp map[string]interface{}) map[string]interface{} {
 		"toptype":         qu.ObjToString(tmp["toptype"]),
 		"site":            qu.ObjToString(tmp["site"]),
 		"basicClass":      qu.ObjToString(tmp["basicClass"]),
-		"title":           qu.ObjToString(tmp["site"]),
+		"title":           qu.ObjToString(tmp["title"]),
 		"projectname":     qu.ObjToString(tmp["projectname"]),
 		"href":            qu.ObjToString(tmp["href"]),
-		"jyhref":          fmt.Sprintf(Url, qu.CommonEncodeArticle("content", BsonTOStringId(tmp["_id"]))),
+		"jyhref":          fmt.Sprintf(Url, qu.CommonEncodeArticle("content", qu.ObjToString(tmp["_id"]))),
 	}
 }
 
@@ -35,8 +35,14 @@ func BeaconInfoPurchasingClass() {
 			log.Debug("cur index ", total, "~", isok)
 		}
 		update := CreateBaseUpdateInfo(tmp)
+		//前置特殊~单标的
+		if qu.ObjToString(update["class_code"]) == "" {
+			prejudgmentListInfo(&update, tmp)
+		}
 		//标准分类
-		makePlistClassInfo(&update, tmp)
+		if qu.ObjToString(update["class_code"]) == "" {
+			acquirePlistClassInfo(&update, tmp)
+		}
 		//补充分类
 		if qu.ObjToString(update["class_code"]) == "" {
 			replenishRuleClassInfo(&update, tmp)
@@ -46,8 +52,16 @@ func BeaconInfoPurchasingClass() {
 			similarPurClass(&update, tmp)
 		}
 
+		//class_1, class_2, class_3, class_4, class_5 := relevanceEntireClassCode(ab_code)
+		//update["class_1"] = class_1
+		//update["class_2"] = class_2
+		//update["class_3"] = class_3
+		//update["class_4"] = class_4
+		//update["class_5"] = class_5
+
 		data_mgo.Save(SourceColl+"_new", update)
 		tmp = make(map[string]interface{})
 	}
 	log.Debug("is over ", total, "~", isok)
+
 }

+ 117 - 7
data_purchasing/src/bidexport.go

@@ -2,16 +2,99 @@ package main
 
 import (
 	"bufio"
+	"encoding/json"
 	log "github.com/donnie4w/go-logger/logger"
 	"github.com/tealeg/xlsx"
 	"io"
 	"os"
+	es_elastic "qfw/common/src/gopkg.in/olivere/elastic.v1"
 	qu "qfw/util"
+	"qfw/util/elastic"
 	"strings"
 	"sync"
 	"unicode/utf8"
 )
 
+//导出指定数据
+func exportLdxInfo() {
+	log.Debug("准备~标讯信息~~~")
+	elastic.InitElasticSize("http://172.17.4.184:19800", 10)
+	//elastic.InitElasticSize("http://127.0.0.1:13002", 10)
+	log.Debug("开始...遍历索引...")
+	total := int64(0)
+	esclient := elastic.GetEsConn()
+	defer elastic.DestoryEsConn(esclient)
+	if esclient == nil {
+		log.Debug("连接池异常")
+	}
+	taskQuery := [][]string{}
+	taskQuery = append(taskQuery, []string{"成交", "学校"})
+	taskQuery = append(taskQuery, []string{"成交", "教育"})
+	taskQuery = append(taskQuery, []string{"中标", "学校"})
+	taskQuery = append(taskQuery, []string{"中标", "教育"})
+
+	for _, v := range taskQuery {
+		q_1, q_2 := v[0], v[1]
+		query1 := es_elastic.NewRangeQuery("publishtime").Gte(1609430400).Lt(1672502400)
+		query2 := es_elastic.NewTermQuery("subtype", q_1)
+		query3 := es_elastic.NewTermQuery("buyerclass", q_2)
+		cursor, err := esclient.Scan("bidding").Query(es_elastic.NewBoolQuery().Must(query1, query2, query3)).
+			Size(200).Do()
+		if err != nil {
+			log.Debug("cursor", err)
+		}
+		if cursor.Results == nil {
+			log.Debug("results != nil; got nil")
+		}
+		if cursor.Results.Hits == nil {
+			log.Debug("expected results.Hits != nil; got nil")
+		}
+		total += cursor.TotalHits()
+		log.Debug("当前查询正常数:", cursor.TotalHits(), "总数:", total)
+		numDocs := 0
+		//多线程 - 处理数据
+		pool_es := make(chan bool, 10)
+		wg_es := &sync.WaitGroup{}
+		for {
+			searchResult, err := cursor.Next()
+			if err != nil {
+				if err.Error() == "EOS" {
+					break
+				} else {
+					log.Debug("cursor searchResult", err)
+				}
+			}
+			for _, hit := range searchResult.Hits.Hits {
+				tmp := make(map[string]interface{})
+				err := json.Unmarshal(*hit.Source, &tmp)
+				if err != nil {
+					log.Debug("json Unmarshal error")
+					continue
+				}
+				if numDocs%1000 == 0 {
+					log.Debug("当前条数:", numDocs, "Es数据:", tmp["_id"])
+				}
+				numDocs++
+				pool_es <- true
+				wg_es.Add(1)
+				go func(tmp map[string]interface{}) {
+					defer func() {
+						<-pool_es
+						wg_es.Done()
+					}()
+					p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
+					if len(p_list) > 0 {
+						data_mgo.Save("zktest_lidaxin_info", tmp)
+					}
+				}(tmp)
+			}
+		}
+		wg_es.Wait()
+		log.Debug("遍历完毕...", total, numDocs)
+	}
+	log.Debug("最后真结束了~~~~~~~~~~~~~")
+}
+
 func exportSimilarText() {
 	r, err := os.Open("res/similar.txt")
 	if err != nil {
@@ -83,12 +166,12 @@ func CiLinInfo(strArr []string) (bool, string, string, string, string, string) {
 		if utf8.RuneCountInString(v) <= 1 {
 			continue
 		}
-		for k1, v1 := range PurNameInfo {
+		for k1, v1 := range PurClassInfo {
 			if utf8.RuneCountInString(k1) <= 1 {
 				continue
 			}
 			if v == k1 {
-				code = v1
+				code = v1.code
 				if utf8.RuneCountInString(code) == 7 {
 					code_1 = code[:2]
 					code_2 = code[:4]
@@ -102,14 +185,41 @@ func CiLinInfo(strArr []string) (bool, string, string, string, string, string) {
 				} else {
 
 				}
-				return true, v1, PurCodeInfo[code_1], PurCodeInfo[code_2], PurCodeInfo[code_3], k1
+				return true, v1.code, PurCodeInfo[code_1], PurCodeInfo[code_2], PurCodeInfo[code_3], k1
 			}
 		}
 	}
 	return false, "", "", "", "", ""
 }
 
-//
+func exportXXJS() {
+	sess := data_mgo.GetMgoConn()
+	defer data_mgo.DestoryMongoConn(sess)
+	q, total := map[string]interface{}{
+		"class_code": "",
+	}, 0
+	isok := 0
+	it := sess.DB(data_mgo.DbName).C(SourceColl + "_new").Find(&q).Sort("_id").Iter()
+	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
+		if total%10000 == 0 {
+			log.Debug("cur index ", total, "~", isok)
+		}
+		num := 0
+		s_subscopeclass := qu.ObjToString(tmp["s_subscopeclass"])
+		for _, v := range strings.Split(s_subscopeclass, ",") {
+			if strings.Contains(v, "信息技术") {
+				num++
+			}
+		}
+		if num > 1 {
+			isok++
+			data_mgo.Save("zktest_bidding_info_jg_new_new", tmp)
+		}
+		tmp = make(map[string]interface{})
+	}
+	log.Debug("is over~", total, "~", isok)
+}
+
 func exportXXJSInfo() {
 	sess := data_mgo.GetMgoConn()
 	defer data_mgo.DestoryMongoConn(sess)
@@ -208,7 +318,7 @@ func exportPurSourceInfo() {
 				}
 				for _, v := range p_list {
 					itemname := qu.ObjToString(v["itemname"])
-					if itemname == "" || utf8.RuneCountInString(itemname) > 30 {
+					if itemname == "" || utf8.RuneCountInString(itemname) > 50 {
 						continue
 					}
 					if toptype == "招标" {
@@ -308,7 +418,7 @@ func exportIndustryPurchasingInfo() {
 				p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
 				for _, v := range p_list {
 					itemname := qu.ObjToString(v["itemname"])
-					if itemname != "" && utf8.RuneCountInString(itemname) <= 30 {
+					if itemname != "" && utf8.RuneCountInString(itemname) <= 50 {
 						num := qu.IntAll(infos[itemname])
 						infos[itemname] = num + 1
 					}
@@ -360,7 +470,7 @@ func exportEmptyClassInfo() {
 			p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
 			for _, v := range p_list {
 				itemname := qu.ObjToString(v["itemname"])
-				if itemname != "" && utf8.RuneCountInString(itemname) <= 30 {
+				if itemname != "" && utf8.RuneCountInString(itemname) <= 50 {
 					num := qu.IntAll(infos[itemname])
 					infos[itemname] = num + 1
 					bas := qu.ObjToString(basic[itemname])

+ 43 - 49
data_purchasing/src/bidinit.go

@@ -13,32 +13,45 @@ import (
 type PurInfo struct {
 	name string
 	code string
-	root int
 }
 
-//词名称应对代码集合
-var PurClassInfo = map[string][]PurInfo{}
-
-//名称对应代码
-var PurNameInfo = map[string]string{}
+//词名称~所有信息
+var PurClassInfo = map[string]PurInfo{}
 
 //代码对应名称
 var PurCodeInfo = map[string]string{}
 
 //记录三大类的词组
-var BasicClassInfo = map[string][]string{}
+var BasicClassNameInfo = map[string][]string{}
+
+//记录三大类划分的类别代码
+var BasicClassCodeInfo = map[string][]string{
+	"货物": []string{"01", "02", "03", "04", "06", "07", "08", "09", "10", "11", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "4702"},
+	"工程": []string{"48", "49", "50", "4701"},
+	"服务": []string{"05", "51", "52", "53", "54", "55", "56", "57", "58", "59", "60", "61", "62", "63", "65", "66", "67", "68", "69", "70", "71", "72", "73", "74", "75", "76", "77", "78", "79", "80", "81", "82", "83", "84", "85", "86", "87", "88", "89", "90", "91", "92", "93", "94", "95", "96", "97"},
+}
 
 //清洗
 var CleanItemReg1 *regexp.Regexp = regexp.MustCompile("^(其他|无|服务|台|个|套)$")
 var CleanItemReg2 *regexp.Regexp = regexp.MustCompile("(发布时间|序号|产品型号|注[::]|请点击.*查看|m3|m³|m2|㎡|人工)")
+var CleanItemReg3 *regexp.Regexp = regexp.MustCompile("[((].*")
+var CleanItemReg4 *regexp.Regexp = regexp.MustCompile("(合计)$")
+
+//符合条件
+var RulePreReg1 *regexp.Regexp = regexp.MustCompile("(费|费用)(】)?$")
+var RulePreReg2 *regexp.Regexp = regexp.MustCompile("(维护|维修|保养|检修|维保|修复)")
+var RulePreReg3 *regexp.Regexp = regexp.MustCompile("(费|费用|手册|修缮|工程|施工|装修)")
+var RulePreReg4 *regexp.Regexp = regexp.MustCompile("(修缮|工程|改造|施工|房屋)")
+
+var RulePreReg5 *regexp.Regexp = regexp.MustCompile("(服务)$")
 
 //拆分
 var SplitItemReg1 *regexp.Regexp = regexp.MustCompile("[((](.*)[))]")
 var SplitItemReg2 *regexp.Regexp = regexp.MustCompile("[(())]")
 
 const (
-	SourceColl    = "zktest_xinxijishu_info_zb"
-	InitialColl   = "zktest_code_purchasing"
+	SourceColl    = "zktest_lidaxin_info"
+	InitialColl   = "zktest_code_purchasing_new"
 	ReplenishColl = "zktest_code_purchasing_replenish"
 )
 
@@ -64,7 +77,10 @@ var SensitiveInfo *sensitive.Filter
 //切词
 var Gse *gse.Segmenter = &gse.Segmenter{}
 
+var IsSaveLog bool
+
 func initReadyInfo() {
+	IsSaveLog = true
 	initPurchasingCode()
 	initScopeCode()
 	initSensitiveInfo()
@@ -74,66 +90,44 @@ func initReadyInfo() {
 func initPurchasingCode() {
 	dataArr1, _ := data_mgo.Find(InitialColl, nil, map[string]interface{}{"_id": 1}, nil)
 	for _, tmp := range dataArr1 {
-		path := qu.ObjToString(tmp["path"])
 		name := qu.ObjToString(tmp["name"])
 		code := qu.ObjToString(tmp["code"])
-		data := PurInfo{name, code, 1}
-		arr := strings.Split(path, "~")
-		for _, v := range arr {
-			info := PurClassInfo[v]
-			if len(info) == 0 {
-				PurClassInfo[v] = []PurInfo{data}
-			} else {
-				info = append(info, data)
-				PurClassInfo[v] = info
-			}
-			PurNameInfo[v] = code
-
-			basic := qu.ObjToString(tmp["basic"])
-			if basic != "" {
-				basicArr := BasicClassInfo[basic]
-				if basicArr == nil {
-					basicArr = []string{}
-				}
-				basicArr = append(basicArr, v)
-				BasicClassInfo[basic] = basicArr
+		basic := qu.ObjToString(tmp["basic"])
+		PurClassInfo[name] = PurInfo{name, code}
+		PurCodeInfo[code] = name
+		if basic != "" {
+			basicArr := BasicClassNameInfo[basic]
+			if basicArr == nil {
+				basicArr = []string{}
 			}
+			basicArr = append(basicArr, name)
+			BasicClassNameInfo[basic] = basicArr
 		}
-		PurCodeInfo[code] = name
 	}
 
 	//补充模型
 	dataArr2, _ := data_mgo.Find(ReplenishColl, nil, map[string]interface{}{"_id": 1}, nil)
 	for _, tmp := range dataArr2 {
-		key := qu.ObjToString(tmp["name"])
+		new_key := qu.ObjToString(tmp["name"])
 		code := qu.ObjToString(tmp["code"])
 		name := PurCodeInfo[code]
 		if name == "" || code == "" {
-			log.Debug("异常~", key, "~", code, "~", tmp["type"])
+			log.Debug("异常~", new_key, "~", code, "~", tmp["type"])
 			continue
 		}
-		PurNameInfo[key] = code
-		data := PurInfo{name, code, 2}
-		info := PurClassInfo[key]
-		if len(info) == 0 {
-			PurClassInfo[key] = []PurInfo{data}
-		} else {
-			info = append(info, data)
-			PurClassInfo[key] = info
-		}
-
+		PurClassInfo[new_key] = PurInfo{name, code}
 		basic := qu.ObjToString(tmp["basic"])
 		if basic != "" {
-			basicArr := BasicClassInfo[basic]
+			basicArr := BasicClassNameInfo[basic]
 			if basicArr == nil {
 				basicArr = []string{}
 			}
-			basicArr = append(basicArr, name)
-			BasicClassInfo[basic] = basicArr
+			basicArr = append(basicArr, new_key)
+			BasicClassNameInfo[basic] = basicArr
 		}
 	}
 	log.Debug("源数据~", len(dataArr1), "~", len(dataArr2))
-	log.Debug("总计~", len(PurClassInfo), "~", len(PurNameInfo), "~", len(PurCodeInfo), "~", len(BasicClassInfo))
+	log.Debug("总计~", len(PurClassInfo), "~", len(PurCodeInfo), "~", len(BasicClassNameInfo))
 }
 
 func initScopeCode() {
@@ -144,10 +138,10 @@ func initScopeCode() {
 			TopScopeClass[v] = codeArr[k]
 		}
 		//if v != "" && codeArr[k] == "" {
-		//log.Debug("异常~", v, "~", codeArr[k])
+		//	log.Debug("异常~", v, "~", codeArr[k])
 		//}
 		//if v == "" && codeArr[k] != "" {
-		//log.Debug("异常~", v, "~", codeArr[k])
+		//	log.Debug("异常~", v, "~", codeArr[k])
 		//}
 	}
 	log.Debug("行业对应代码~", len(nameArr), "~", len(codeArr), "~", len(TopScopeClass))

+ 126 - 47
data_purchasing/src/bidmethod.go

@@ -8,17 +8,42 @@ import (
 	"unicode/utf8"
 )
 
+//前置判断
+func prejudgmentListInfo(update *map[string]interface{}, tmp map[string]interface{}) {
+	p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
+	logArr := []map[string]interface{}{}
+	if len(p_list) == 1 {
+		itemname_old := qu.ObjToString(p_list[0]["itemname"])
+		itemname_new := CleanItemReg3.ReplaceAllString(itemname_old, "")
+		itemname_new = CleanItemReg4.ReplaceAllString(itemname_new, "")
+		logArr = append(logArr, map[string]interface{}{
+			"itemname_old": itemname_old,
+			"itemname_new": itemname_new,
+		})
+		if RulePreReg1.MatchString(itemname_new) {
+			(*update)["class_code"] = "83"
+			(*update)["class_name"] = PurCodeInfo["83"]
+			(*update)["class_level"] = 0
+			if IsSaveLog {
+				(*update)["class_link"] = "前置筛选"
+				(*update)["class_log"] = logArr
+			}
+		}
+	}
+}
+
 //处理标讯的标的物
-func makePlistClassInfo(update *map[string]interface{}, tmp map[string]interface{}) {
+func acquirePlistClassInfo(update *map[string]interface{}, tmp map[string]interface{}) {
 	p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
+	basic := qu.ObjToString(tmp["basicClass"])
 	codeArr := []string{}
 	logArr := []map[string]interface{}{}
 	for _, v := range p_list {
 		itemname := qu.ObjToString(v["itemname"])
 		logInfo := map[string]interface{}{}
 		logInfo["itemname"] = itemname
-		if itemname != "" && utf8.RuneCountInString(itemname) < 30 {
-			info := processPurNameClass(itemname) //标的打分类
+		if itemname != "" && utf8.RuneCountInString(itemname) <= 50 {
+			info := processPurNameClass(itemname, basic) //标的打分类
 			if len(info) > 0 {
 				class_code := qu.ObjToString(info["class_code"])
 				if !strings.Contains(class_code, "~") {
@@ -30,68 +55,96 @@ func makePlistClassInfo(update *map[string]interface{}, tmp map[string]interface
 		}
 		logArr = append(logArr, logInfo)
 	}
-	(*update)["class_log"] = logArr
-	(*update)["class_code"] = standardCodeArr(codeArr)
+	if IsSaveLog {
+		(*update)["class_log"] = logArr
+	}
+	class_code, class_name := standardCodeArr(codeArr)
+	(*update)["class_code"] = class_code
+	(*update)["class_name"] = class_name
+	if class_code != "" {
+		(*update)["class_level"] = 5
+	}
 }
 
 //补充逻辑规则
 func replenishRuleClassInfo(update *map[string]interface{}, tmp map[string]interface{}) {
 	//项目名称补充
-	r_code, r_name := checkDetailClass(qu.ObjToString(tmp["projectname"]))
+	r_code, r_name, r_match := checkDetailClass(qu.ObjToString(tmp["projectname"]))
 	if r_code != "" {
 		(*update)["class_code"] = r_code
-		(*update)["class_link"] = "项目名称补充"
-		(*update)["class_link_matching"] = r_name
+		(*update)["class_name"] = r_name
+		(*update)["class_level"] = 4
+		if IsSaveLog {
+			(*update)["class_link"] = "项目名称补充"
+			(*update)["class_link_matching"] = r_match
+		}
 	}
 
 	//标题名称补充
 	if r_code == "" {
-		r_code, r_name = checkDetailClass(qu.ObjToString(tmp["title"]))
+		r_code, r_name, r_match = checkDetailClass(qu.ObjToString(tmp["title"]))
 		if r_code != "" {
 			(*update)["class_code"] = r_code
-			(*update)["class_link"] = "标题名称补充"
-			(*update)["class_link_matching"] = r_name
+			(*update)["class_name"] = r_name
+			(*update)["class_level"] = 3
+			if IsSaveLog {
+				(*update)["class_link"] = "标题名称补充"
+				(*update)["class_link_matching"] = r_match
+			}
 		}
 	}
 
 	//行业类别补充
 	if r_code == "" {
-		r_code = checkTopScopeClass(qu.ObjToString(tmp["s_subscopeclass"]), 2)
+		r_code, r_name = checkTopScopeClass(qu.ObjToString(tmp["s_subscopeclass"]), 2)
 		if r_code != "" {
 			(*update)["class_code"] = r_code
-			(*update)["class_link"] = "行业二级补充"
+			(*update)["class_name"] = r_name
+			(*update)["class_level"] = 2
+			if IsSaveLog {
+				(*update)["class_link"] = "行业二级补充"
+			}
 		} else {
-			r_code = checkTopScopeClass(qu.ObjToString(tmp["s_topscopeclass"]), 1)
+			r_code, r_name = checkTopScopeClass(qu.ObjToString(tmp["s_topscopeclass"]), 1)
 			if r_code != "" {
 				(*update)["class_code"] = r_code
-				(*update)["class_link"] = "行业一级补充"
+				(*update)["class_name"] = r_name
+				(*update)["class_level"] = 2
+				if IsSaveLog {
+					(*update)["class_link"] = "行业一级补充"
+				}
 			}
 		}
 	}
 }
 
 //标准化后code
-func standardCodeArr(codeArr []string) string {
+func standardCodeArr(codeArr []string) (string, string) {
 	new_code := ""
-	arr := []string{}
+	new_name := ""
+	new_codeArr := []string{}
+	new_nameArr := []string{}
 	temp := map[string]string{}
 	for _, v := range codeArr {
 		if temp[v] == "" {
-			arr = append(arr, v)
+			new_codeArr = append(new_codeArr, v)
+			new_nameArr = append(new_nameArr, PurCodeInfo[v])
 			temp[v] = v
 		}
 	}
-	new_code = strings.Join(arr, "~")
-	return new_code
+	new_code = strings.Join(new_codeArr, "~")
+	new_name = strings.Join(new_nameArr, "~")
+	return new_code, new_name
 }
 
 //行业补充词
-func checkTopScopeClass(text string, level int) string {
-	if TopScopeClass[text] != "" {
-		return TopScopeClass[text]
+func checkTopScopeClass(text string, level int) (string, string) {
+	t_code := TopScopeClass[text]
+	if t_code != "" {
+		return t_code, PurCodeInfo[t_code]
 	}
 	if text == "" {
-		return ""
+		return "", ""
 	}
 	if level == 2 { //计算比例
 		temp := map[string]int{}
@@ -113,38 +166,45 @@ func checkTopScopeClass(text string, level int) string {
 
 			}
 		}
-		//交通工程,弱电安防,市政设施,水利水电,机械设备
-		if key_name == "交通工程" || key_name == "弱电安防" || key_name == "市政设施" ||
+		if key_name == "信息技术" {
+			if strings.Contains(key_name, "软件开发") {
+				return "61~62", PurCodeInfo["61"] + "~" + PurCodeInfo["62"]
+			} else {
+				return "61", PurCodeInfo["61"]
+			}
+		} else if key_name == "交通工程" || key_name == "弱电安防" || key_name == "市政设施" ||
 			key_name == "水利水电" || key_name == "机械设备" {
-			if TopScopeClass[key_name] != "" {
-				return TopScopeClass[key_name]
+			r_code := TopScopeClass[key_name]
+			if r_code != "" {
+				return r_code, PurCodeInfo[r_code]
 			}
 		}
-
 	}
-	return TopScopeClass[text]
+	return "", ""
 }
 
 //文本补充词
-func checkDetailClass(text string) (string, string) {
-	new_code, new_name := "", ""
+func checkDetailClass(text string) (string, string, string) {
+	new_code, new_name, new_match := "", "", ""
 	dataArr := SensitiveInfo.FindAll(text)
-	codeArr, nameArr := []string{}, []string{}
+	codeArr, matchArr := []string{}, []string{}
+	nameArr := []string{}
 	tempInfo := map[string]string{}
 	for _, v := range dataArr {
-		infoArr := PurClassInfo[v]
-		for _, info := range infoArr {
-			code := info.code
-			if tempInfo[code] == "" {
-				tempInfo[code] = code
-				codeArr = append(codeArr, code)
-				nameArr = append(nameArr, v)
-			}
+		info := PurClassInfo[v]
+		code := info.code
+		if tempInfo[code] == "" {
+			tempInfo[code] = code
+			codeArr = append(codeArr, code)
+			matchArr = append(matchArr, v)
+			nameArr = append(nameArr, PurCodeInfo[code])
 		}
 	}
 	new_code = strings.Join(codeArr, "~")
 	new_name = strings.Join(nameArr, "~")
-	return new_code, new_name
+	new_match = strings.Join(matchArr, "~")
+
+	return new_code, new_name, new_match
 }
 
 //相似度计算
@@ -153,7 +213,8 @@ func similarPurClass(update *map[string]interface{}, tmp map[string]interface{})
 	if basicClass == "" {
 		return
 	}
-	basicArr := BasicClassInfo[basicClass]
+	basicArr := BasicClassNameInfo[basicClass]
+
 	if len(basicArr) > 0 {
 		p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
 		codeArr := []string{}
@@ -162,7 +223,7 @@ func similarPurClass(update *map[string]interface{}, tmp map[string]interface{})
 			itemname := qu.ObjToString(v["itemname"])
 			logInfo := map[string]interface{}{}
 			logInfo["itemname"] = itemname
-			if itemname != "" && utf8.RuneCountInString(itemname) < 30 {
+			if itemname != "" && utf8.RuneCountInString(itemname) <= 50 {
 				textArr := cleanItemName(itemname)
 				if len(textArr) == 0 {
 					continue
@@ -170,7 +231,7 @@ func similarPurClass(update *map[string]interface{}, tmp map[string]interface{})
 				for _, text := range textArr {
 					req := strsim.FindBestMatchOne(text, basicArr, strsim.DiceCoefficient())
 					if req.Score >= 0.5 { //认为有效
-						req_code := PurNameInfo[req.S]
+						req_code := PurClassInfo[req.S].code
 						if req_code != "" {
 							logInfo["matching_name"] = req.S
 							codeArr = append(codeArr, req_code)
@@ -183,12 +244,18 @@ func similarPurClass(update *map[string]interface{}, tmp map[string]interface{})
 			logArr = append(logArr, logInfo)
 		}
 		if len(codeArr) > 0 {
-			(*update)["class_similar"] = logArr
-			(*update)["class_code"] = standardCodeArr(codeArr)
+			class_code, class_name := standardCodeArr(codeArr)
+			(*update)["class_code"] = class_code
+			(*update)["class_name"] = class_name
+			(*update)["class_level"] = 1
+			if IsSaveLog {
+				(*update)["class_similar"] = logArr
+			}
 		}
 	}
 }
 
+//标的物分类计算
 func dealWithPurInfo(info map[string]interface{}, classArr []string) map[string]interface{} {
 	new_info := map[string]interface{}{}
 	name := qu.ObjToString(info["name"])
@@ -222,6 +289,18 @@ func dealWithPurInfo(info map[string]interface{}, classArr []string) map[string]
 	return new_info
 }
 
+//服务类校验
+func verifyServiceCode(code string) bool {
+	dataArr := BasicClassCodeInfo["服务"]
+	for _, v := range dataArr {
+		if v == code[:2] {
+			return true
+		}
+	}
+	return false
+}
+
+//通用转换
 func IsMarkInterfaceMap(t interface{}) []map[string]interface{} {
 	p_list := []map[string]interface{}{}
 	if yl_list_1, ok_1 := t.(primitive.A); ok_1 {

+ 1 - 1
data_purchasing/src/bidtest.go

@@ -19,7 +19,7 @@ func testEmptyBasic() {
 		}
 		name := qu.ObjToString(tmp["name"])
 		basic := qu.ObjToString(tmp["basic"])
-		testArr := BasicClassInfo[basic]
+		testArr := BasicClassNameInfo[basic]
 		if len(testArr) > 0 && name != "" {
 			req := strsim.FindBestMatchOne(name, testArr, strsim.DiceCoefficient())
 			data_mgo.Save("zktest_bidding_info_zb_empty_result", map[string]interface{}{

+ 2 - 3
data_purchasing/src/main.go

@@ -30,7 +30,7 @@ func initMgo() {
 }
 
 func init() {
-	IsLocal = true
+	//IsLocal = true
 	initMgo()
 	initReadyInfo()
 }
@@ -39,13 +39,12 @@ func main() {
 	log.Debug("main...")
 	//准备代码表
 	//prparePurClassCode()
-	//prparePurClassCodePath()
 	//补充映射表
 	//prepareReplenishInfo()
 	//prepareBasicInfo()
 
 	//标讯信息打分类
-	BeaconInfoPurchasingClass()
+	//BeaconInfoPurchasingClass()
 
 	lock := make(chan bool)
 	<-lock

+ 114 - 37
data_purchasing/src/purclass.go

@@ -6,7 +6,7 @@ import (
 	"unicode/utf8"
 )
 
-func processPurNameClass(name string) map[string]interface{} {
+func processPurNameClass(name string, basic string) map[string]interface{} {
 	update := map[string]interface{}{}
 	//1、标的物名称进行清洗
 	textArr := cleanItemName(name)
@@ -21,33 +21,66 @@ func processPurNameClass(name string) map[string]interface{} {
 			update["matching_name"] = text
 			update["class_name"] = ab_name
 			update["class_code"] = ab_code
-			class_1, class_2, class_3 := dealWithEntireClassCode(ab_code)
-			update["class_1"] = class_1
-			update["class_2"] = class_2
-			update["class_3"] = class_3
 			return update
 		}
+
+		//标的物筛选
+		if RulePreReg2.MatchString(name) && !RulePreReg3.MatchString(name) {
+			update["matching"] = 3
+			update["matching_name"] = "维保类"
+			update["class_name"] = PurCodeInfo["8301"]
+			update["class_code"] = "8301"
+			return update
+		} else {
+			if RulePreReg4.MatchString(name) {
+				update["matching"] = 3
+				update["matching_name"] = "工程类"
+				update["class_name"] = PurCodeInfo["4701"]
+				update["class_code"] = "4701"
+				return update
+			}
+		}
+
 		//包含匹配~多个解
-		in_name, in_code, in_match := inclusionMatchingMethod(text)
+		in_name, in_code, in_match := inclusionMatchingMethod(text, basic)
 		if in_name != "" && in_code != "" {
+			//对包含匹配出来的结果进行服务校验
+			if RulePreReg5.MatchString(text) {
+				if verifyServiceCode(in_code) {
+					update["matching"] = 2
+					update["matching_name"] = in_match
+					update["class_name"] = in_name
+					update["class_code"] = in_code
+				} else {
+					update["matching"] = 2
+					update["matching_name"] = "服务校验"
+					update["class_name"] = PurCodeInfo["83"]
+					update["class_code"] = "83"
+				}
+				return update
+			}
 			update["matching"] = 2
 			update["matching_name"] = in_match
 			update["class_name"] = in_name
 			update["class_code"] = in_code
-			class_1, class_2, class_3 := dealWithEntireClassCode(in_code)
-			update["class_1"] = class_1
-			update["class_2"] = class_2
-			update["class_3"] = class_3
-			return update
+		} else {
+			if RulePreReg5.MatchString(text) {
+				update["matching"] = 2
+				update["matching_name"] = "服务校验"
+				update["class_name"] = PurCodeInfo["83"]
+				update["class_code"] = "83"
+			}
 		}
 	}
-
 	return update
 }
 
 //清洗名称
 func cleanItemName(text string) []string {
 	textArr := []string{}
+	if utf8.RuneCountInString(text) <= 1 {
+		return textArr
+	}
 	if CleanItemReg1.MatchString(text) {
 		return textArr
 	}
@@ -77,20 +110,13 @@ func cleanItemName(text string) []string {
 
 //完全匹配~比对
 func absoluteMatchingMethod(text string) (string, string) {
-	infoArr := PurClassInfo[text]
-	class_name, class_code := "", ""
-	if len(infoArr) > 0 {
-		for _, v := range infoArr {
-			class_name = v.name
-			class_code = v.code
-			break
-		}
-	}
+	info := PurClassInfo[text]
+	class_name, class_code := info.name, info.code
 	return class_name, class_code
 }
 
 //包含匹配~比对
-func inclusionMatchingMethod(text string) (string, string, string) {
+func inclusionMatchingMethod(text string, basic string) (string, string, string) {
 	codeArr := []string{}
 	nameArr := []string{}
 	matchArr := []string{}
@@ -100,13 +126,11 @@ func inclusionMatchingMethod(text string) (string, string, string) {
 			continue
 		}
 		if strings.Contains(k, text) || strings.Contains(text, k) {
-			for _, v1 := range v {
-				if temp[v1.code] == "" {
-					temp[v1.code] = v1.code
-					codeArr = append(codeArr, v1.code)
-					nameArr = append(nameArr, v1.name)
-					matchArr = append(matchArr, k)
-				}
+			if temp[v.code] == "" {
+				temp[v.code] = v.code
+				codeArr = append(codeArr, v.code)
+				nameArr = append(nameArr, v.name)
+				matchArr = append(matchArr, k)
 			}
 		}
 	}
@@ -117,7 +141,7 @@ func inclusionMatchingMethod(text string) (string, string, string) {
 		matching_name = strings.Join(matchArr, "~")
 	} else if len(codeArr) > 1 {
 		//多分类选取
-		new_code := multiClassSelectionInfo(text, codeArr, matchArr)
+		new_code := multiClassSelectionInfo(text, basic, codeArr, matchArr)
 		if new_code != "" {
 			class_code = new_code
 			class_name = PurCodeInfo[class_code]
@@ -134,7 +158,15 @@ func inclusionMatchingMethod(text string) (string, string, string) {
 }
 
 //多分类选取
-func multiClassSelectionInfo(text string, codeArr []string, matchArr []string) string {
+func multiClassSelectionInfo(text string, basic string, codeArr []string, matchArr []string) string {
+	//根据三大类~去除掉冗余的分类
+	if basic != "" && basic != "服务" {
+		codeArr = excludePartClassInfo(text, basic, codeArr)
+	}
+	if len(codeArr) == 0 {
+		return ""
+	}
+
 	//比例选取大类
 	code := proportionSelection(codeArr)
 	if code != "" {
@@ -203,18 +235,62 @@ func proportionSelection(codeArr []string) string {
 	return class_code
 }
 
-func dealWithEntireClassCode(class_code string) (string, string, string) {
+//根据三大类判处多选~冗余的选项
+func excludePartClassInfo(text string, basic string, codeArr []string) []string {
+	//分类
+	new_codeArr := []string{}
+	basicArr := BasicClassCodeInfo[basic]
+	for _, code := range codeArr {
+		state := false
+		for _, base_code := range basicArr {
+			l := utf8.RuneCountInString(base_code)
+			if l > utf8.RuneCountInString(code) {
+				continue
+			}
+			if code[:l] == base_code {
+				state = true
+			}
+		}
+		if state {
+			new_codeArr = append(new_codeArr, code)
+		}
+	}
+	return new_codeArr
+}
 
+//关联出全部分类
+func relevanceEntireClassCode(class_code string) (string, string, string, string, string) {
 	class_1_arr := []string{}
 	class_2_arr := []string{}
 	class_3_arr := []string{}
+	class_4_arr := []string{}
+	class_5_arr := []string{}
 	class_code_arr := strings.Split(class_code, "~")
-
 	for _, code := range class_code_arr {
-		if utf8.RuneCountInString(code) == 7 {
+		if utf8.RuneCountInString(code) == 10 {
 			code_1 := code[:2]
 			code_2 := code[:4]
-			code_3 := code[:7]
+			code_3 := code[:6]
+			code_4 := code[:8]
+			code_5 := code[:10]
+			class_1_arr = append(class_1_arr, PurCodeInfo[code_1])
+			class_2_arr = append(class_2_arr, PurCodeInfo[code_2])
+			class_3_arr = append(class_3_arr, PurCodeInfo[code_3])
+			class_4_arr = append(class_4_arr, PurCodeInfo[code_4])
+			class_5_arr = append(class_5_arr, PurCodeInfo[code_5])
+		} else if utf8.RuneCountInString(code) == 8 {
+			code_1 := code[:2]
+			code_2 := code[:4]
+			code_3 := code[:6]
+			code_4 := code[:8]
+			class_1_arr = append(class_1_arr, PurCodeInfo[code_1])
+			class_2_arr = append(class_2_arr, PurCodeInfo[code_2])
+			class_3_arr = append(class_3_arr, PurCodeInfo[code_3])
+			class_4_arr = append(class_4_arr, PurCodeInfo[code_4])
+		} else if utf8.RuneCountInString(code) == 6 {
+			code_1 := code[:2]
+			code_2 := code[:4]
+			code_3 := code[:6]
 			class_1_arr = append(class_1_arr, PurCodeInfo[code_1])
 			class_2_arr = append(class_2_arr, PurCodeInfo[code_2])
 			class_3_arr = append(class_3_arr, PurCodeInfo[code_3])
@@ -233,6 +309,7 @@ func dealWithEntireClassCode(class_code string) (string, string, string) {
 	class_1 := strings.Join(class_1_arr, "~")
 	class_2 := strings.Join(class_2_arr, "~")
 	class_3 := strings.Join(class_3_arr, "~")
-
-	return class_1, class_2, class_3
+	class_4 := strings.Join(class_4_arr, "~")
+	class_5 := strings.Join(class_5_arr, "~")
+	return class_1, class_2, class_3, class_4, class_5
 }

+ 36 - 100
data_purchasing/src/purcode.go

@@ -13,7 +13,7 @@ import (
 var CleanTailReg *regexp.Regexp = regexp.MustCompile("(服务)$")
 var numLock sync.Mutex
 
-//源代码表
+//源代码表~五级分类
 func prparePurClassCode() {
 	ff, _ := xlsx.OpenFile("res/source.xlsx")
 	isok := 0
@@ -26,107 +26,46 @@ func prparePurClassCode() {
 				s = strings.ReplaceAll(s, " ", "")
 				str = append(str, s)
 			}
-			s_1, s_2, s_3, name := str[0], str[1], str[2], str[5]
-			info := map[string]interface{}{}
-			level := 1
-			code := ""
+			if len(str) < 3 {
+				log.Debug("异常~~~~~~")
+				continue
+			}
+			name, code, level := str[0], str[1], str[2]
 			pcode := ""
-			if s_3 != "" { //三级
-				code = s_1 + s_2 + "0" + s_3
-				pcode = s_1 + s_2
-				level = 3
-			} else {
-				if s_2 != "" { //二级
-					code = s_1 + s_2
-					pcode = s_1
-					level = 2
-				} else {
-					if s_1 != "" { //一级
-						code = s_1
-						level = 1
-					} else {
-						log.Debug("异常行~~~")
-						continue
-					}
-				}
+			switch {
+			case qu.IntAll(level) == 1:
+
+			case qu.IntAll(level) == 2:
+				pcode = code[:2]
+			case qu.IntAll(level) == 3:
+				pcode = code[:4]
+			case qu.IntAll(level) == 4:
+				pcode = code[:6]
+			case qu.IntAll(level) == 5:
+				pcode = code[:8]
+			default:
+				log.Debug("异常~~~", str)
 			}
-			f_code := code[:2]
-			new_name := name
-			if f_code == "47" || f_code == "48" || f_code == "49" || f_code == "50" {
-				new_name = CleanTailReg.ReplaceAllString(name, "")
+			if code == "47" || code == "48" || code == "49" || code == "50" {
+				name = CleanTailReg.ReplaceAllString(name, "")
 			}
-			info["name"] = new_name
-			info["code"] = code
-			info["pcode"] = pcode
-			info["level"] = level
-			data_mgo.Save(InitialColl, info)
+			data_mgo.Save(InitialColl, map[string]interface{}{
+				"name":  name,
+				"code":  code,
+				"pcode": pcode,
+				"level": qu.IntAll(level),
+			})
 			isok++
-
 		}
 	}
 	log.Debug("is over ~ ", isok)
 }
 
-//准备代码表
-func prparePurClassCodePath() {
-	sess := data_mgo.GetMgoConn()
-	defer data_mgo.DestoryMongoConn(sess)
-	q, total := map[string]interface{}{}, 0
-	it := sess.DB(data_mgo.DbName).C(InitialColl).Find(&q).Sort("_id").Iter()
-	//记录当前代码
-	tmp_code := ""
-	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
-		if total%10000 == 0 {
-			log.Debug("curent index ", total)
-		}
-		level := qu.IntAll(tmp["level"])
-		name := qu.ObjToString(tmp["name"])
-		code := qu.ObjToString(tmp["code"])
-		pcode := qu.ObjToString(tmp["pcode"])
-		path := ""
-		if level == 1 || level == 2 {
-			tmp_code = ""
-			path = name
-			info := map[string]interface{}{}
-			info["name"] = name
-			info["code"] = code
-			info["pcode"] = pcode
-			info["level"] = level
-			info["path"] = path
-			data_mgo.Save(InitialColl+"_new", info)
-		} else {
-			if tmp_code != code {
-				tmp_code = code
-				arr, _ := data_mgo.Find(InitialColl, map[string]interface{}{
-					"code": code,
-				}, map[string]interface{}{
-					"_id": 1,
-				}, nil)
-				pathArr := []string{}
-				for _, v := range arr {
-					pathArr = append(pathArr, qu.ObjToString(v["name"]))
-				}
-				path = strings.Join(pathArr, "~")
-
-				info := map[string]interface{}{}
-				info["name"] = name
-				info["code"] = code
-				info["pcode"] = pcode
-				info["level"] = level
-				info["path"] = path
-				data_mgo.Save(InitialColl+"_new", info)
-			}
-		}
-		tmp = make(map[string]interface{})
-	}
-	log.Debug("标的物分类~~ ", total)
-}
-
 //补充数据表
 func prepareReplenishInfo() {
 	temp := map[string]string{}
 	ff, _ := xlsx.OpenFile("res/replenish.xlsx")
-	for indexName, sheet := range ff.Sheets {
+	for _, sheet := range ff.Sheets {
 		isok := 0
 		for _, row := range sheet.Rows {
 			var arr []string
@@ -143,20 +82,20 @@ func prepareReplenishInfo() {
 					s_code = arr[2]
 				}
 				if code != "" && name != "" {
-					if PurClassInfo[name] == nil && temp[name] == "" {
+					if PurClassInfo[name].name == "" && temp[name] == "" {
 						isok++
-						data_mgo.Save("zktest_code_purchasing_replenish", map[string]interface{}{
+						data_mgo.Save(ReplenishColl, map[string]interface{}{
 							"name":   name,
 							"code":   code,
 							"s_code": s_code,
-							"type":   indexName,
+							"type":   sheet.Name,
 						})
 						temp[name] = name
 					}
 				}
 			}
 		}
-		log.Debug("cur sheet is over ~ ", isok)
+		log.Debug("cur sheet ", sheet.Name, " is over ~ ", isok)
 	}
 
 	//补充近义词
@@ -179,9 +118,6 @@ func prepareReplenishInfo() {
 				arr = arr[6:]
 				code := ""
 				for k, v := range arr {
-					if v == "" {
-						continue
-					}
 					if k == 0 {
 						code = v
 					} else if k == 1 {
@@ -189,7 +125,7 @@ func prepareReplenishInfo() {
 							break
 						}
 					} else {
-						if PurClassInfo[v] == nil && temp[v] == "" {
+						if PurClassInfo[v].name == "" && temp[v] == "" && v != "" {
 							isok++
 							info := map[string]interface{}{
 								"name":   v,
@@ -198,7 +134,7 @@ func prepareReplenishInfo() {
 								"type":   "近义词",
 							}
 							if len(info) > 0 {
-								data_mgo.Save("zktest_code_purchasing_replenish", info)
+								data_mgo.Save(ReplenishColl, info)
 							}
 							temp[v] = v
 						}
@@ -206,7 +142,7 @@ func prepareReplenishInfo() {
 				}
 			}
 		}
-		log.Debug("cur sheet is over ~ ", isok)
+		log.Debug("cur sheet ", sheet.Name, " is over ~ ", isok)
 	}
 }
 
@@ -260,7 +196,7 @@ func updateBasicCode(coll_name string, temp map[string]string) {
 				} else {
 					log.Debug("异常~", code)
 				}
-			} else if l == 7 {
+			} else if l >= 6 {
 				n_c := code[:2]
 				if temp[n_c] != "" { //更新
 					basic = temp[n_c]

BIN
data_purchasing/src/res/replenish.xlsx


BIN
data_purchasing/src/res/similar.xlsx


BIN
data_purchasing/src/res/source.xlsx


+ 18 - 16
listen_data/src/main.go

@@ -115,29 +115,31 @@ func main() {
 	//}
 	//save_mgo.InitPool()
 
+	save_mgo = &MongodbSim{
+		MongodbAddr: "172.17.145.163:27083,172.17.4.187:27082",
+		DbName:      "qfw",
+		Size:        10,
+		UserName:    "zhengkun",
+		Password:    "zk@123123",
+	}
+	save_mgo.InitPool()
+
 	//save_mgo = &MongodbSim{
-	//	MongodbAddr: "172.17.145.163:27083,172.17.4.187:27082",
-	//	DbName:      "qfw",
+	//	MongodbAddr: "127.0.0.1:27017",
+	//	DbName:      "zhengkun",
 	//	Size:        10,
-	//	UserName:    "zhengkun",
-	//	Password:    "zk@123123",
+	//	UserName:    "",
+	//	Password:    "",
 	//}
 	//save_mgo.InitPool()
 
-	save_mgo = &MongodbSim{
-		MongodbAddr: "127.0.0.1:27017",
-		DbName:      "zhengkun",
-		Size:        10,
-		UserName:    "",
-		Password:    "",
-	}
-	save_mgo.InitPool()
+	//decodeJyUrl("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
+	//decodeSEUrl("QlxHe2B7PAUGAggSCUErOnE8AQUCC0JW")
+	//decodeFeedBackInfo()
 
-	//decodeJyUrl("ABCY1wFYi44Myw4AmtyZ08wCDNfESJgAX9kKT8CNi8dfGlzZytUCSM")
-	//decodeJyUrl("ABCY1xGZD0oMyM4NHtycAcJJjMZARFgYWNhKC8FKj0wZFVzcl5UCUk")
-	//decodeJyUrl("ABCY1xGZDI%2FGSA7I3hlZAckDDMZDSdgV1VjK1gvLCFFXlRzXTtUCS0")
+	exportFromArrToBiddingData("zktest_kdxf_info")
+	//exportAllDataYXT()
 
-	time.Sleep(99999 * time.Hour)
 	return
 
 	/*

+ 325 - 10
listen_data/src/zkmethod.go

@@ -44,7 +44,106 @@ var (
 
 //导出数据-bidding相关
 func exportFromArrToBiddingData(coll_name string) {
-	arr := []string{}
+	arr := []string{
+		"640fcb4556e044e9137e8d76",
+		"64102c5a8aea8786d1cf2252",
+		"64102cb28aea8786d1cf23e3",
+		"64102c5b8aea8786d1cf2266",
+		"641424cf779467cff193c9b6",
+		"640e94c7779467cff188ec14",
+		"640efcac8aea8786d1ce8dae",
+		"640ea0f88aea8786d1ce0767",
+		"6413d13f56e044e9138b3ee8",
+		"64117b818aea8786d1cffbf9",
+		"64142a108aea8786d1d1cc90",
+		"6417b1408aea8786d1d2782c",
+		"64104dd1779467cff18cd583",
+		"6413e37a8aea8786d1d17828",
+		"6412148456e044e91386c106",
+		"641685da56e044e91391551c",
+		"640ff99856e044e9137f6193",
+		"640e9509779467cff188ece2",
+		"6412817a56e044e91387d432",
+		"64118dce8aea8786d1d02185",
+		"6412b48d779467cff190ba27",
+		"6415dc5f779467cff1952d6d",
+		"64127ada779467cff190087b",
+		"6415dc5a779467cff1952d6c",
+		"641509ec779467cff194b6a4",
+		"640fe3ec779467cff18b530e",
+		"640e9767779467cff188f76b",
+		"640fd583779467cff18b140a",
+		"6412b613779467cff190bfd1",
+		"641299ce779467cff19083b3",
+		"64116f49779467cff18e791f",
+		"640fea318aea8786d1cede7e",
+		"641025618aea8786d1cf17dc",
+		"641173568aea8786d1cff098",
+		"6412b0258aea8786d1d0b6a1",
+		"6412d2388aea8786d1d0e31f",
+		"6412d2388aea8786d1d0e31c",
+		"6413f6a48aea8786d1d18fa1",
+		"640e99ed8aea8786d1cdfaa6",
+		"6410296f8aea8786d1cf1d64",
+		"641029708aea8786d1cf1d7d",
+		"641031678aea8786d1cf2b35",
+		"641031688aea8786d1cf2b49",
+		"641031688aea8786d1cf2b55",
+		"641031688aea8786d1cf2b5e",
+		"641031688aea8786d1cf2b61",
+		"641031698aea8786d1cf2b77",
+		"641031698aea8786d1cf2b71",
+		"64119a3a56e044e91385475d",
+		"640efb4456e044e9137d9b0f",
+		"6411db9e56e044e913861625",
+		"6415894856e044e9138f867d",
+		"64103b4256e044e9138061fe",
+		"640fda5756e044e9137edcc3",
+		"6411a5e056e044e91385785f",
+		"641138d456e044e913838d6d",
+		"64120bce56e044e91386a8e9",
+		"6411e9cf56e044e913863a76",
+		"6411433556e044e91383bcc7",
+		"6412b6ec56e044e913888145",
+		"640fd3ad56e044e9137eb73f",
+		"64162c6e56e044e91390ab01",
+		"641215d356e044e91386c4b6",
+		"641320e356e044e91389d08b",
+		"640e8e9f56e044e9137bc09f",
+		"6410222756e044e9137fe011",
+		"641138d356e044e913838d4f",
+		"641755db56e044e91392e551",
+		"6411433556e044e91383bcc2",
+		"640fd3b556e044e9137eb907",
+		"6412f21356e044e913896c76",
+		"6416dd4f56e044e91391e1d4",
+		"6410713b56e044e9138127d1",
+		"640e8ea956e044e9137bc1e5",
+		"640eddf6779467cff189d726",
+		"641033c8779467cff18c6852",
+		"64111023779467cff18d411e",
+		"6412cfd5779467cff1913608",
+		"6411234d779467cff18d818c",
+		"6413ae8c779467cff1923893",
+		"64126e1e779467cff18fd257",
+		"640e847d779467cff188a713",
+		"640eec62779467cff18a254a",
+		"6411366d779467cff18dd385",
+		"640ec8e6779467cff18973ea",
+		"64113681779467cff18dd40b",
+		"64144303779467cff1944f06",
+		"641598f1779467cff195188f",
+		"6413bd6a779467cff19254c1",
+		"640fe753779467cff18b6144",
+		"641421ec779467cff193b896",
+		"6412e314779467cff191957d",
+		"64140864779467cff19345b6",
+		"6412ff8b779467cff191f1a6",
+		"6415a2e5779467cff1951c91",
+		"640e7fc8779467cff188953c",
+		"640f04bb779467cff18a72f9",
+		"6412cfd9779467cff191361e",
+	}
 	isok := 0
 	for _, v := range arr {
 		data := save_mgo.FindById("bidding", v)
@@ -76,7 +175,7 @@ func exportFromArrToExtractData(coll_name string) {
 }
 
 //导出数据-bidding相关
-func exportFromMongoToBiddingData(from string, to string) {
+func exportFromMongoToBiddingData(from string, to string, uuid string) {
 	sess := save_mgo.GetMgoConn()
 	defer save_mgo.DestoryMongoConn(sess)
 	q, total := map[string]interface{}{}, 0
@@ -87,6 +186,9 @@ func exportFromMongoToBiddingData(from string, to string) {
 			log.Debug("curent index ", total, "~", isok)
 		}
 		tmpid := BsonTOStringId(tmp["_id"])
+		if uuid != "" {
+			tmpid = qu.ObjToString(tmp[uuid])
+		}
 		data := save_mgo.FindById("bidding", tmpid)
 		if data != nil && len(data) > 2 {
 			save_mgo.Save(to, data)
@@ -131,9 +233,13 @@ func exportFromMongoToExtractData(from string, to string) {
 }
 
 //秘钥~base64
-func encodeSEUrl() {
+func encodeSEUrl(str string) {
 	var SE = qu.SimpleEncrypt{Key: "topJYBX2019"}
-	SE.EncodeString("tmpid_string")
+	log.Debug(SE.EncodeString(str))
+}
+func decodeSEUrl(str string) {
+	var SE = qu.SimpleEncrypt{Key: "topJYBX2019"}
+	log.Debug(SE.DecodeString(str))
 }
 
 //解密
@@ -151,9 +257,214 @@ func encodeJyUrl() {
 	log.Debug(Encode)
 }
 
+//解密数据id
+func decodeFeedBackInfo() {
+	arr := []string{
+		"QltALDogbAcFB1xEW0QvYHNrBVUJXUNZ",
+		"QltBemshbVMIUFwVV0dybyZpUVYDC0Fd",
+		"QltBemshOgAIUFwVV0dybyZpUVYDChFc",
+		"QltBemshbVAIUFwVV0dybyZpUVYDC0JZ",
+		"QltBfmt2O1QHBgBAWUcpPyRpCwNSABZZ",
+		"QltAL2B2OwUHBgBAWUcpPyRpCghUWkVb",
+		"QltALz8hOVEIUFwVV0dybyZpUVUJXRUK",
+		"QltALzhyPgoIUFwVV0dybyZpUVUBDkJY",
+		"QltBeT1za1QFB1xEW0QvYHNrClICXBFX",
+		"QltBe24gYAMIUFwVV0dybyZpUVZXWxJW",
+		"QltBfmsjaQIIUFwVV0dybyZpVgFSWk1f",
+		"QltBfTtzbAIIUFwVV0dybyZpVgIGAUYM",
+		"QltBem0mPAMHBgBAWUcpPyRpClNVDExc",
+		"QltBeTxxb1MIUFwVV0dybyZpVgEGAUZX",
+		"QltBeGh2YAYFB1xEW0QvYHNrCgZSCERZ",
+		"QltBfGF3PFMFB1xEW0QvYHNrCwEEDEUM",
+		"QltALD97YQoFB1xEW0QvYHNrBVYHCE1c",
+		"QltAL2B3aAsHBgBAWUcpPyRpCghUWhFd",
+		"QltBeGFzb1MFB1xEW0QvYHNrCgdVDUdd",
+		"QltBe2EmO1cIUFwVV0dybyZpVgADCExa",
+		"QltBeDt2YFYHBgBAWUcpPyRpCwBTWEZY",
+		"QltBfz0hbVQHBgBAWUcpPyRpCwUDXUIL",
+		"QltBeG4jPFMHBgBAWUcpPyRpCwABAUMN",
+		"QltBfz0hbVMHBgBAWUcpPyRpCwUDXUIM",
+		"QltBf2l7PVEHBgBAWUcpPyRpCwRTDxVb",
+		"QltALDxxPVEHBgBAWUcpPyRpClIECkQK",
+		"QltAL2B1bgUHBgBAWUcpPyRpCghXDkIN",
+		"QltALD13YAEHBgBAWUcpPyRpClIADUQO",
+		"QltBeDt0aQEHBgBAWUcpPyRpCwBTXxBe",
+		"QltBeGB7O1cHBgBAWUcpPyRpCwAJChZc",
+		"QltBe28kbAsHBgBAWUcpPyRpClUGAEUJ",
+		"QltALDwjawMIUFwVV0dybyZpUVVVXEMK",
+		"QltBemt3bgMIUFwVV0dybyZpUVYADhAM",
+		"QltBe25xbQQIUFwVV0dybyZpUVZXCU1X",
+		"QltBeDtyagcIUFwVV0dybyZpVgBTDxVe",
+		"QltBeD1wawoIUFwVV0dybyZpVgBUCkUJ",
+		"QltBeD1wawoIUFwVV0dybyZpVgBUCkUM",
+		"QltBeT90OQYIUFwVV0dybyZpVgEJXxVe",
+		"QltAL2B7PVYIUFwVV0dybyZpUVRXWBVZ",
+		"QltBemt7blQIUFwVV0dybyZpUVYAXUJb",
+		"QltBemt7bwIIUFwVV0dybyZpUVYAXUML",
+		"QltBempzbgUIUFwVV0dybyZpUVYDW0da",
+		"QltBempzbgoIUFwVV0dybyZpUVYDW0BW",
+		"QltBempzbgoIUFwVV0dybyZpUVYDW0Fa",
+		"QltBempzbgoIUFwVV0dybyZpUVYDW0EK",
+		"QltBempzbgoIUFwVV0dybyZpUVYDW0Je",
+		"QltBempzbgsIUFwVV0dybyZpUVYDW0NY",
+		"QltBempzbgsIUFwVV0dybyZpUVYDW0Ne",
+		"QltBe2Aja1MFB1xEW0QvYHNrCgUFDkEL",
+		"QltALz8gbAYFB1xEW0QvYHNrBVQIW0QJ",
+		"QltBez0gYVcFB1xEW0QvYHNrCgYAD0Za",
+		"QltBf2F7bAoFB1xEW0QvYHNrClYJD0ML",
+		"QltBemogbAAFB1xEW0QvYHNrCgAHCBIK",
+		"QltALD0jbQUFB1xEW0QvYHNrBVVVWhdc",
+		"QltBezh3PQIFB1xEW0QvYHNrCgUGAUEJ",
+		"QltBe2p6PAYFB1xEW0QvYHNrCgMJXUIL",
+		"QltBeGkgO1cFB1xEW0QvYHNrCgZQARFW",
+		"QltBezx7O1QFB1xEW0QvYHNrCgYCWENZ",
+		"QltBe21xawcFB1xEW0QvYHNrCgNTWhdY",
+		"QltBeDt0PVEFB1xEW0QvYHNrCggJCEBa",
+		"QltALD1xOVYFB1xEW0QvYHNrBVVTDkcJ",
+		"QltBfGshblcFB1xEW0QvYHNrCwBQW0Re",
+		"QltBeGh3PAEFB1xEW0QvYHNrCgZSDRZZ",
+		"QltBeWtyPQEFB1xEW0QvYHNrCglVCUwN",
+		"QltAL2EnYVQFB1xEW0QvYHNrBVJSCU0J",
+		"QltBemtwagUFB1xEW0QvYHNrBVZUCUVe",
+		"QltBe2p6PAEFB1xEW0QvYHNrCgMJXUAJ",
+		"QltBfWx3PFAFB1xEW0QvYHNrCwJUDEFe",
+		"QltBe21xawcFB1xEW0QvYHNrCgNTWhdd",
+		"QltALD1xOgcFB1xEW0QvYHNrBVVTAERY",
+		"QltBeD9waQEFB1xEW0QvYHNrCgkHWkNZ",
+		"QltBfD0mbFQFB1xEW0QvYHNrCwFUCBBb",
+		"QltBem5za1AFB1xEW0QvYHNrCgEDDhBe",
+		"QltAL2EnOQsFB1xEW0QvYHNrBVJSCBFa",
+		"QltALz0mPgQHBgBAWUcpPyRpCglVDkZZ",
+		"QltBempxOwoHBgBAWUcpPyRpClMHAUFd",
+		"QltBe2hyagEHBgBAWUcpPyRpClQFCEUK",
+		"QltBeDokPAcHBgBAWUcpPyRpCwECD0RX",
+		"QltBe2txbFYHBgBAWUcpPyRpClQJCEwM",
+		"QltBeTgnYFEHBgBAWUcpPyRpCwICAU1c",
+		"QltBeG8naVcHBgBAWUcpPyRpClZVC0FY",
+		"QltAL2F2b1YHBgBAWUcpPyRpCghQDkVc",
+		"QltALzwhbgAHBgBAWUcpPyRpClEDDEAO",
+		"QltBe2p0blYHBgBAWUcpPyRpClRVCkxa",
+		"QltALzp6PQQHBgBAWUcpPyRpCgkGChEO",
+		"QltBe2p0YAMHBgBAWUcpPyRpClRVDUQN",
+		"QltBfm1xaAEHBgBAWUcpPyRpCwQFX0RZ",
+		"QltBf2B6PgMHBgBAWUcpPyRpCwUAAUwJ",
+		"QltBeTsmblMHBgBAWUcpPyRpCwIEDRde",
+		"QltALDx1bQEHBgBAWUcpPyRpClIHCEBb",
+		"QltBfmtzPVEHBgBAWUcpPyRpCwNTAU1Z",
+		"QltBeDxxaQYHBgBAWUcpPyRpCwEIDEML",
+		"QltBfml6bgYHBgBAWUcpPyRpCwMFDBZZ",
+		"QltBeD8kYFAHBgBAWUcpPyRpCwFXCBVZ",
+		"QltBfzhwPQcHBgBAWUcpPyRpCwUAWk1e",
+		"QltAL24kOwoHBgBAWUcpPyRpCggIDEcM",
+		"QltALGl2OlAHBgBAWUcpPyRpClEGCxJW",
+		"QltBeDokPAsHBgBAWUcpPyRpCwECD0UK",
+	}
+	for _, v := range arr {
+		decodeSEUrl(v)
+	}
+}
+
+func repair0317() {
+	//20230314Zdx_xx_new
+	dataArr, _ := save_mgo.Find("20230314Zdx_xx_new", nil, nil, nil)
+	isok := 0
+	for _, v := range dataArr {
+		id := BsonTOStringId(v["_id"])
+		info := save_mgo.FindOne("20230314Zdx_xx", map[string]interface{}{
+			"id": id,
+		})
+		if len(info) > 0 && info != nil {
+			isok++
+			tmpid := BsonTOStringId(info["_id"])
+			update := v
+			delete(update, "_id")
+			save_mgo.UpdateById("20230314Zdx_xx", tmpid, map[string]interface{}{
+				"$set": update,
+			})
+		}
+	}
+	log.Debug("is over ", isok)
+}
+
+//导出标注分析错误数据
+func exportErrBiaoZhuDataFenXi() {
+
+	dataArr, _ := save_mgo.Find("zzzzzzkkk_bz_info_new", nil, nil, map[string]interface{}{
+		"s_winner":    1,
+		"bidamount":   1,
+		"href":        1,
+		"jytest_href": 1,
+	})
+
+	for _, v := range dataArr {
+		info := v
+		tmpid := BsonTOStringId(v["_id"])
+		data := save_mgo.FindById("zzzzzzkkk_bz", tmpid)
+		if v_baseinfo, ok := data["v_baseinfo"].(map[string]interface{}); ok {
+			for kk, vv := range v_baseinfo {
+				new_key := "right_" + kk
+				info[new_key] = vv
+			}
+		}
+		save_mgo.Save("zzzzzzkkk_bz_info_err", info)
+	}
+
+	log.Debug("is over ~~~")
+}
+
+//导出人工分析错误数据
+func exportErrRenGongDataFenXi() {
+	dataArr, _ := save_mgo.Find("zzzzzzkkk_rg_info_new", nil, nil, map[string]interface{}{
+		"s_winner":    1,
+		"bidamount":   1,
+		"href":        1,
+		"jytest_href": 1,
+	})
+	temp := map[string]map[string]interface{}{}
+	sourceArr, _ := save_mgo.Find("zzzzzzkkk_rg_info", nil, nil, map[string]interface{}{
+		"s_winner":  1,
+		"bidamount": 1,
+	})
+	for _, v := range sourceArr {
+		key := BsonTOStringId(v["_id"])
+		temp[key] = v
+	}
+	log.Debug("数据准备~", len(dataArr), "~", len(sourceArr))
+
+	isok := 0
+	for _, v := range dataArr {
+		key := BsonTOStringId(v["_id"])
+		biamount := qu.Float64All(v["biamount"])
+		s_winner := qu.ObjToString(v["s_winner"])
+		tmp := temp[key]
+		tmp_biamount := qu.Float64All(tmp["biamount"])
+		tmp_s_winner := qu.ObjToString(tmp["s_winner"])
+		str := ""
+		if tmp_biamount != biamount {
+			str += "金额~"
+		}
+		if tmp_s_winner != s_winner {
+			str += "单位"
+		}
+		if str != "" {
+			isok++
+			info := v
+			for kk, vv := range tmp {
+				if kk == "_id" {
+					continue
+				}
+				new_key := "right_" + kk
+				info[new_key] = vv
+			}
+			save_mgo.Save("zzzzzzkkk_rg_info_err", info)
+		}
+	}
+	//是的是的是的
+	log.Debug("最终~", isok)
+}
+
 //验证数据
 func verifyCutWordsInfo() {
-
 	//总部泰康研修院南大堂人造大理石地面维修更换项目
 	GSE.LoadDict()
 	var reg *regexp.Regexp = regexp.MustCompile("[ \\s].*")
@@ -326,7 +637,7 @@ func exportSourceCgyxData() {
 }
 
 //导出全量~采购意向数据
-func exportAllDataCGYX() {
+func exportAllDataYXT() {
 	//elastic.InitElasticSize("http://172.17.4.184:19800", 10)
 	elastic.InitElasticSize("http://127.0.0.1:13002", 10)
 	log.Debug("开始...遍历索引...")
@@ -336,7 +647,7 @@ func exportAllDataCGYX() {
 	if esclient == nil {
 		log.Debug("连接池异常")
 	}
-	query := es_elastic.NewTermQuery("buyer", "泰康保险集团股份有限公司")
+	query := es_elastic.NewTermQuery("site", "医信通")
 	cursor, err := esclient.Scan("bidding").Query(es_elastic.NewBoolQuery().Must(query)).
 		Size(200).Do()
 	if err != nil {
@@ -351,7 +662,7 @@ func exportAllDataCGYX() {
 	total += cursor.TotalHits()
 	log.Debug("当前查询正常数:", cursor.TotalHits(), "总数:", total)
 	numDocs := 0 //多线程 - 处理数据
-	pool_es := make(chan bool, 1)
+	pool_es := make(chan bool, 3)
 	wg_es := &sync.WaitGroup{}
 	for {
 		searchResult, err := cursor.Next()
@@ -381,7 +692,7 @@ func exportAllDataCGYX() {
 					<-pool_es
 					wg_es.Done()
 				}()
-				save_mgo.Save("zktest_xxxx_id", map[string]interface{}{
+				save_mgo.Save("zktest_yixintong_id", map[string]interface{}{
 					"id": tmpid,
 				})
 			}(tmpid)
@@ -2468,7 +2779,11 @@ func repairExtCity() {
 	defer save_mgo.DestoryMongoConn(sess)
 	q, total := map[string]interface{}{}, 0
 	ok_1, ok_2 := 0, 0
-	it := sess.DB("qfw").C("zktest_xxs_city_new").Find(&q).Iter()
+	it := sess.DB("qfw").C("zktest_yixintong_info_new").Find(&q).Select(map[string]interface{}{
+		"area":     1,
+		"city":     1,
+		"district": 1,
+	}).Iter()
 	for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
 		if total%1000 == 0 {
 			log.Debug("cur index ", total, ok_1, ok_2)