jiaojiao7 4 年之前
父节点
当前提交
ff5496c0d7

+ 2 - 2
customerdata/src/config.json

@@ -159,7 +159,7 @@
       "name": "移动"
     }
   },
-  "checkbidhref_appid": [
-    "jyMDBXQQIDCQBeSUdBITNf"
+  "checkbidhref_ruleid": [
+    "123"
   ]
 }

+ 4 - 4
customerdata/src/main.go

@@ -29,7 +29,7 @@ type sysconfig struct {
 	CheckBidOpenAppid []string               `json:"checkbidopen_appid"`
 	DisPackageAppid   []string               `json:"dis_package_appid"`
 	DisPackageConfig  map[string]interface{} `json:"dis_package_config"`
-	CheckBidHrefAppid []string               `json:"checkbidhref_appid"`
+	CheckBidHrefRuleId []string               `json:"checkbidhref_ruleid"`
 }
 
 var (
@@ -61,7 +61,7 @@ var projectIdMap sync.Map
 var projectAppidMap = map[string]bool{}
 var CheckBidOpenAppidMap = map[string]bool{}
 var DisPackageAppidMap = map[string]bool{}
-var CheckBidHrefAppidMap = map[string]bool{}
+var CheckBidHrefRuleIdMap = map[string]bool{}
 
 func init() {
 	qu.ReadConfig(&Sysconfig)
@@ -140,8 +140,8 @@ func init() {
 	for _, v := range Sysconfig.DisPackageAppid {
 		DisPackageAppidMap[v] = true
 	}
-	for _, v := range Sysconfig.CheckBidHrefAppid {
-		CheckBidHrefAppidMap[v] = true
+	for _, v := range Sysconfig.CheckBidHrefRuleId {
+		CheckBidHrefRuleIdMap[v] = true
 	}
 }
 func main() {

+ 1 - 1
customerdata/src/task.go

@@ -221,7 +221,7 @@ func (c *Customer) GetData(stype string) {
 									}
 								}
 								//河南移动,过滤掉中国移动采购网招标数据
-								if CheckBidHrefAppidMap[c.AppId] {
+								if CheckBidHrefRuleIdMap[dm.ID] {
 									if strings.Contains(qu.ObjToString(tmp["href"]), "b2b.10086.cn") {
 										qu.Debug("跳过该条数据,公告原网址中包含 b2b.10086.cn,", id)
 										return

+ 1 - 1
customerdata/src/util.go

@@ -571,7 +571,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, a
 		}
 	}
 	//河南移动
-	if CheckBidHrefAppidMap[appid] {
+	if DisPackageAppidMap[appid] {
 		projectId := GetProjectId(id)
 		if projectId != "" {
 			//projectIds := strings.Split(projectId, ",")

+ 2 - 2
src/config.json

@@ -101,8 +101,8 @@
 		"222",
 		"jyPB1XQgsGBQNbQElICQNW"
 	],
-	"checkbidhref_appid": [
-		"jyMDBXQQIDCQBeSUdBITNf"
+	"checkbidhref_ruleid": [
+		"1234"
 	],
 	"dis_package_appid":[
 	    "111",

+ 1 - 1
src/history/datamodel.go

@@ -78,7 +78,7 @@ var (
 	projectIdMap         = sync.Map{}
 	FileTextAppidMap     = map[string]bool{}
 	CheckBidOpenAppidMap = map[string]bool{}
-	CheckBidHrefAppidMap = map[string]bool{}
+	CheckBidHrefRuleIdMap = map[string]bool{}
 	DisPackageAppidMap   = map[string]bool{}
 )
 

+ 1 - 1
src/history/historytask.go

@@ -45,7 +45,7 @@ func (this *HistoryData) HistoryTask(history_id string) {
 		if FileTextAppidMap[appId] {
 			isfile = true
 		}
-		if CheckBidHrefAppidMap[appId] {
+		if DisPackageAppidMap[appId] {
 			isHenanMobile = true
 		}
 		log.Println(isfile, isHenanMobile)

+ 3 - 3
src/history/task.go

@@ -165,7 +165,7 @@ func (c *Customer) GetData(stype string) {
 									}
 								}
 								//河南移动,过滤掉中国移动采购网招标数据
-								if CheckBidHrefAppidMap[c.AppId] {
+								if CheckBidHrefRuleIdMap[dm.ID] {
 									if strings.Contains(qu.ObjToString(tmp["href"]), "b2b.10086.cn") {
 										qu.Debug("跳过该条数据,公告原网址中包含 b2b.10086.cn,", id)
 										return
@@ -246,14 +246,14 @@ func (c *Customer) GetData(stype string) {
 								for i, aw := range sr.AW {
 									// qu.Debug("-------------------------开始附加词匹配--------------------------")
 									IsMatchAddKey := RegMatch(fieldText, aw.MatchType, aw.KeyReg, nil, nil, false, true)
-									// qu.Debug(IsMatchAddKey, "------------------------------------------------------------")
+									qu.Debug(IsMatchAddKey, id, "IsMatchAddKey------------------------------------------------------------")
 
 									//2.关键词匹配
 									if IsMatchAddKey {
 										kw := sr.KW[i]
 										// qu.Debug("-------------------------开始关键词匹配--------------------------")
 										IsMatchKey := RegMatch(fieldText, kw.MatchType, kw.KeyReg, matchKey, matchKeyType, true, false)
-										// qu.Debug(IsMatchKey, "------------------------------------------------------------")
+										qu.Debug(IsMatchKey, id, "IsMatchKey------------------------------------------------------------")
 										if IsMatchKey {
 											IsMatch = true
 										}

+ 34 - 23
src/history/util_history.go

@@ -63,7 +63,7 @@ func GetNotkeyAndKeyAddWord(list []map[string]interface{}, fieldMap map[string]i
 					tmp_nkw := nkw_addArr[0]
 					if tmp_nkw != "" {
 						cr := &CommonReg{}
-						cr.CsVal = tmp_nkw                   //记录原值
+						cr.CsVal = tmp_nkw //记录原值
 						if LetterCase.MatchString(tmp_nkw) { //判断附加词中是否有英文
 							tmp_nkw = strings.ToUpper(tmp_nkw) //附加词中有英文全部转为大写
 							cr.IsLetter = true                 //含字母
@@ -115,7 +115,7 @@ func GetNotkeyAndKeyAddWord(list []map[string]interface{}, fieldMap map[string]i
 				tmp_aw := aw_addArr[0]
 				if tmp_aw != "" {
 					cr := &CommonReg{}
-					cr.CsVal = tmp_aw                   //记录原值
+					cr.CsVal = tmp_aw //记录原值
 					if LetterCase.MatchString(tmp_aw) { //判断附加词中是否有英文
 						tmp_aw = strings.ToUpper(tmp_aw) //附加词中有英文全部转为大写
 						cr.IsLetter = true               //含字母
@@ -309,11 +309,13 @@ func CheckLetter(text string, reg *regexp.Regexp, indexArr [][]int) (flag bool)
 //匹配
 func RegMatch(fieldText map[string]interface{}, matchType []string, matchReg *Reg, matchKey map[string]bool, matchKeyType map[string]bool, goon, isAddWord bool) (match bool) {
 	defer qu.Catch()
+	fmt.Println("*************", fieldText, matchType, matchReg, matchKey, matchKeyType, goon, isAddWord)
 	if len(matchType) == 0 && isAddWord { //特殊处理附加词为空的情况
 		match = true
 		return
 	}
 	for _, mt := range matchType {
+
 		if text := qu.ObjToString(fieldText[mt]); text != "" {
 			for _, cr := range matchReg.CReg { //逗号分隔,任意一个匹配表示匹配成功
 				if goon && matchKey[cr.CsVal] { //matchkey已存在不在匹配
@@ -487,7 +489,7 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 		}
 	}
 	//河南移动
-	if CheckBidHrefAppidMap[appid] {
+	if DisPackageAppidMap[appid] {
 		projectId := GetProjectId(id)
 		if projectId != "" {
 			//projectIds := strings.Split(projectId, ",")
@@ -555,6 +557,9 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 					}
 				}
 			}
+			if index == 1 {
+				GetWinnerType(qu.ObjToString(tmp["s_winner"]), tmp)
+			}
 			if len(indexdata) > 0 {
 				for _, v := range indexdata {
 					MgoSaveCache <- v
@@ -562,6 +567,8 @@ func AssembelSave(tmp map[string]interface{}, IsSearchHosp, IsSearchEnps bool, h
 					xlsxCount++
 				}
 			}
+		} else {
+			log.Println("查result为空id:", id)
 		}
 	}
 	if isDup == 1 {
@@ -1130,7 +1137,7 @@ func GetXlsxs(mMap []map[string]interface{}, fn, email, id string, isfile, isHen
 					row.AddCell().SetValue(v["projectname"]) //项目名称
 					row.AddCell().SetValue(v["buyer"])       //采购单位
 					row.AddCell().SetValue(v[""])            //采购单位类别---私有标签tagname
-					if v["bidamount"] != nil {               //中标金额
+					if v["bidamount"] != nil { //中标金额
 						row.AddCell().SetFloat(qu.Float64All(v["bidamount"]))
 					} else {
 						row.AddCell()
@@ -1169,8 +1176,8 @@ func GetXlsxs(mMap []map[string]interface{}, fn, email, id string, isfile, isHen
 					ids := SE.EncodeString(qu.ObjToString(v["id"])) //唯一标识
 					row.AddCell().SetValue(ids)
 					row.AddCell().SetValue(SE.EncodeString(qu.ObjToString(v["projectId"]))) //项目标识
+					row.AddCell().SetValue(v["jybxhref"])                                   //剑鱼标讯地址
 
-					//row.AddCell().SetValue(v["jybxhref"])
 					//row.AddCell().SetValue(v["projectcode"])
 				}
 				xf.Sheets = xf.Sheets[4:5]
@@ -1272,29 +1279,33 @@ func checkBidId(appid, id string) bool {
 
 func GetWinnerType(s_winner string, v map[string]interface{}) {
 	isMatch := false
-	for _, vs := range Sysconfig["dis_package_config"].(map[string]interface{}) {
-		vvs := vs.(map[string]interface{})
-		keyWord := qu.ObjToString(vvs["keyWord"])
-		exclued := qu.ObjToString(vvs["exclued"])
-		name := qu.ObjToString(vvs["name"])
-		for _, key := range strings.Split(keyWord, ",") {
-			if strings.Contains(s_winner, key) {
-				isMatch = true
-				if exclued != "" {
-					for _, keys := range strings.Split(exclued, ",") {
-						if strings.Contains(s_winner, keys) {
-							isMatch = false
+	if s_winner != "" {
+		for _, vs := range Sysconfig["dis_package_config"].(map[string]interface{}) {
+			vvs := vs.(map[string]interface{})
+			keyWord := qu.ObjToString(vvs["keyWord"])
+			exclued := qu.ObjToString(vvs["exclued"])
+			name := qu.ObjToString(vvs["name"])
+			for _, key := range strings.Split(keyWord, ",") {
+				if strings.Contains(s_winner, key) {
+					isMatch = true
+					if exclued != "" {
+						for _, keys := range strings.Split(exclued, ",") {
+							if strings.Contains(s_winner, keys) {
+								isMatch = false
+							}
 						}
 					}
 				}
 			}
+			if isMatch {
+				v["winner_type"] = name
+				break
+			}
 		}
-		if isMatch {
-			v["winner_type"] = name
-			break
+		if !isMatch {
+			v["winner_type"] = "集成商"
 		}
-	}
-	if !isMatch {
-		v["winner_type"] = "集成商"
+	} else {
+		v["winner_type"] = ""
 	}
 }

+ 2 - 2
src/main.go

@@ -68,8 +68,8 @@ func init() {
 	for _, s := range util.Sysconfig["checkbidopen_appid"].([]interface{}) {
 		history.CheckBidOpenAppidMap[s.(string)] = true
 	}
-	for _, v := range util.Sysconfig["checkbidhref_appid"].([]interface{}) {
-		history.CheckBidHrefAppidMap[v.(string)] = true
+	for _, v := range util.Sysconfig["checkbidhref_ruleid"].([]interface{}) {
+		history.CheckBidHrefRuleIdMap[v.(string)] = true
 	}
 	for _, v := range util.Sysconfig["dis_package_appid"].([]interface{}) {
 		history.DisPackageAppidMap[v.(string)] = true

+ 2 - 2
src/service/customer_service.go

@@ -408,7 +408,7 @@ func (c *Customer) SynEuser() {
 	for _, v := range *ruleMap {
 		idAndSet := []map[string]interface{}{}
 		idAndSet = append(idAndSet, bson.M{"_id": v["_id"]}) //查询条件
-		idAndSet = append(idAndSet, v)                       //修改的数据
+		idAndSet = append(idAndSet, v)                                          //修改的数据
 		update2 = append(update2, idAndSet)
 	}
 	b = Mgo.UpSertBulk("euserdepartrule", update2...)
@@ -614,7 +614,7 @@ func (c *Customer) EuserRule1() {
 	data, _ := Mgo.FindOneByField("euserdepartrule", query, `{}`)
 	(*data)["id"] = mongoutil.BsonIdToSId((*data)["_id"])
 	var existfields = []string{}
-	if _,ok:=(*data)["s_existfields"];ok{
+	if _, ok := (*data)["s_existfields"]; ok {
 		s_existfields := (*data)["s_existfields"].(string)
 		for _, m := range strings.Split(s_existfields, ",") {
 			res, _ := Mgo.FindOne("code_field", map[string]interface{}{

+ 1 - 2
src/service/second_push.go

@@ -620,8 +620,7 @@ func GetXlsxs(mMap []map[string]interface{}, fn, email, id string) {
 					ids := SE.EncodeString(qu.ObjToString(v["id"])) //唯一标识
 					row.AddCell().SetValue(ids)
 					row.AddCell().SetValue(SE.EncodeString(qu.ObjToString(v["projectId"]))) //项目标识
-
-					//row.AddCell().SetValue(v["jybxhref"])
+					row.AddCell().SetValue(v["jybxhref"])
 					//row.AddCell().SetValue(v["projectcode"])
 				}
 				xf.Sheets = xf.Sheets[4:5]