apple 5 жил өмнө
parent
commit
3e6fbe520a

+ 25 - 12
udpfilterdup/src/datamap.go

@@ -214,7 +214,9 @@ func NewInfo(tmp map[string]interface{}) *Info {
 	return info
 }
 //判重方法
-func (d *datamap) check(info *Info) (b bool, source *Info, reason string) {
+func (d *datamap) check(info *Info) (b bool, source *Info, reasons string) {
+
+	reason:=""
 	keys := []string{}
 	d.lock.Lock()
 	for k, _ := range d.keys { //不同时间段
@@ -258,6 +260,7 @@ L:
 							reason = "href相同"
 							b = true
 							source = v
+							reasons = reason
 							break L
 						}
 						if info.href != "" && info.href != v.href {
@@ -283,6 +286,7 @@ L:
 							if !againRepeat(v,info){
 								b = true
 								source = v
+								reasons = reason
 								break
 							}
 						}
@@ -295,6 +299,7 @@ L:
 						if repeat, reason = quickHeavyMethodTwo(v, info, reason); repeat {
 							b = true
 							source = v
+							reasons = reason
 							break
 						}
 					} else {
@@ -305,6 +310,7 @@ L:
 							if repeat, reason = quickHeavyMethodTwo(v, info, reason); repeat {
 								b = true
 								source = v
+								reasons = reason
 								break
 							}
 						} else {
@@ -313,6 +319,7 @@ L:
 							if repeat, reason = quickHeavyMethodOne(v, info, reason); repeat {
 								b = true
 								source = v
+								reasons = reason
 								break
 							}
 						}
@@ -346,7 +353,8 @@ L:
 	return
 }
 
-func (h *historymap) checkHistory(info *Info) (b bool, source *Info, reason string) {
+func (h *historymap) checkHistory(info *Info) (b bool, source *Info, reasons string) {
+	reason:=""
 	keys := []string{}
 	h.lock.Lock()
 	for k, _ := range h.keys { //不同时间段
@@ -391,6 +399,7 @@ L:
 							reason = "href相同"
 							b = true
 							source = v
+							reasons = reason
 							break L
 						}
 						if info.href != "" && info.href != v.href {
@@ -416,6 +425,7 @@ L:
 							if !againRepeat(v,info){
 								b = true
 								source = v
+								reasons = reason
 								break
 							}
 
@@ -429,6 +439,7 @@ L:
 						if repeat, reason = quickHeavyMethodTwo(v, info, reason); repeat {
 							b = true
 							source = v
+							reasons = reason
 							break
 						}
 					} else {
@@ -439,6 +450,7 @@ L:
 							if repeat, reason = quickHeavyMethodTwo(v, info, reason); repeat {
 								b = true
 								source = v
+								reasons = reason
 								break
 							}
 						} else {
@@ -447,6 +459,7 @@ L:
 							if repeat, reason = quickHeavyMethodOne(v, info, reason); repeat {
 								b = true
 								source = v
+								reasons = reason
 								break
 							}
 						}
@@ -466,6 +479,7 @@ L:
 			if source.repeatid != "" {//未判重-有变化--记录
 				b = true
 				reason = "未判重记录"
+				reasons = reason
 			}
 		}
 	}
@@ -589,7 +603,6 @@ func (d *datamap) GetLatelyFiveDay(t int64) []string {
 ******* 以下为判重 ********
 **************************
 */
-
 //判重方法1
 func quickHeavyMethodOne(v *Info, info *Info, reason string) (bool, string) {
 
@@ -611,9 +624,6 @@ func quickHeavyMethodOne(v *Info, info *Info, reason string) (bool, string) {
 
 	} else if info.subtype == "中标" || info.subtype == "成交" || info.subtype == "废标" || info.subtype == "流标" {
 		//中标结果
-		if isMeet, reason = tenderRepeat_A(v, info, reason); isMeet {
-
-		}
 		if isMeet, reason = winningRepeat_A(v, info, reason);isMeet {
 			if winningRepeat_C(v, info) {
 				return false, reason
@@ -938,11 +948,13 @@ func winningRepeat_C(v *Info, info *Info) bool {
 //合同_A
 func contractRepeat_A(v *Info, info *Info, reason string) (bool,string) {
 
-	isMeet := false
-	if isMeet, reason = tenderRepeat_A(v, info, reason);isMeet {
+	isMeet_1 := false
+	if isMeet_1, reason = tenderRepeat_A(v, info, reason);isMeet_1 {
 		return true,reason
 	}
-	if isMeet, reason = winningRepeat_A(v, info, reason);isMeet {
+
+	isMeet_2 := false
+	if isMeet_2, reason = winningRepeat_A(v, info, reason);isMeet_2 {
 		return true,reason
 	}
 	return false,reason
@@ -951,11 +963,12 @@ func contractRepeat_A(v *Info, info *Info, reason string) (bool,string) {
 //合同_B
 func contractRepeat_B(v *Info, info *Info, reason string) (bool,string) {
 
-	isMeet := false
-	if isMeet, reason = tenderRepeat_B(v, info, reason);isMeet {
+	isMeet_1 := false
+	if isMeet_1, reason = tenderRepeat_B(v, info, reason);isMeet_1 {
 		return true,reason
 	}
-	if isMeet, reason = winningRepeat_B(v, info, reason);isMeet {
+	isMeet_2 := false
+	if isMeet_2, reason = winningRepeat_B(v, info, reason);isMeet_2 {
 		return true,reason
 	}
 	return false,reason

+ 17 - 10
udpfilterdup/src/main.go

@@ -63,7 +63,6 @@ func init() {
 	extract = mconf["extract"].(string)
 	mgo.InitPool()
 
-	//测试可以临时注释
 	dupdays = util.IntAllDef(Sysconfig["dupdays"], 3)
 	//加载数据
 	DM = NewDatamap(dupdays, lastid)
@@ -104,8 +103,13 @@ func main() {
 
 //测试组人员使用
 func mainT() {
+	/*
+	ObjectId("5da3f31aa5cb26b9b798d3aa")
+	ObjectId("5da418c4a5cb26b9b7e3e9a6")
+	*/
 	//sid = "5da3f31aa5cb26b9b798d3aa"
-	//eid = "5da422fba5cb26b9b706984b"
+	//eid = "5da418c4a5cb26b9b7e3e9a6"
+
 	mapinfo := map[string]interface{}{}
 	if sid == "" || eid == "" {
 		log.Println("sid,eid参数不能为空")
@@ -236,9 +240,9 @@ func task(data []byte, mapInfo map[string]interface{}) {
 							newData, mergeArr = mergeDataFields(source, info)
 							DM.replaceSourceData(newData, source.id) //替换
 							if idtype == "1" {
-								id_map["_id"] = source.id
+								id_map["_id"] = info.id
 							} else {
-								id_map["_id"] = util.StringTOBsonId(source.id)
+								id_map["_id"] = util.StringTOBsonId(info.id)
 							}
 
 							repeat_id = source.id
@@ -247,9 +251,9 @@ func task(data []byte, mapInfo map[string]interface{}) {
 							newData, mergeArr = mergeDataFields(info, source)
 							DM.replaceSourceData(newData, source.id) //替换
 							if idtype == "1" {
-								id_map["_id"] = info.id
+								id_map["_id"] = source.id
 							} else {
-								id_map["_id"] = util.StringTOBsonId(info.id)
+								id_map["_id"] = util.StringTOBsonId(source.id)
 							}
 
 							repeat_id = info.id
@@ -483,23 +487,26 @@ func historyTask(data []byte, mapInfo map[string]interface{}) {
 								newData, mergeArr = mergeDataFields(source, info)
 								DM.replaceSourceData(newData, source.id) //替换
 								if idtype == "1" {
-									id_map["_id"] = source.id
+									id_map["_id"] = info.id
 								} else {
-									id_map["_id"] = util.StringTOBsonId(source.id)
+									id_map["_id"] = util.StringTOBsonId(info.id)
 								}
+
 								repeat_id = source.id
 							} else {
 								//已对比数据为标准 ,数据池的数据打判重标签
 								newData, mergeArr = mergeDataFields(info, source)
 								DM.replaceSourceData(newData, source.id) //替换
 								if idtype == "1" {
-									id_map["_id"] = info.id
+									id_map["_id"] = source.id
 								} else {
-									id_map["_id"] = util.StringTOBsonId(info.id)
+									id_map["_id"] = util.StringTOBsonId(source.id)
 								}
+
 								repeat_id = info.id
 							}
 						}
+
 						var update_map = map[string]interface{}{
 							"$set": map[string]interface{}{
 								"repeat_reason": reason,

+ 4 - 0
udps/main.go

@@ -22,6 +22,10 @@ func main() {
 	//2017-04-01,2017-06-01
 	//2017-06-01,2018-06-01
 	//2018-06-01,2019-02-20
+	/*
+ObjectId("5da3f31aa5cb26b9b798d3aa")
+ObjectId("5da422fba5cb26b9b706984b")
+*/
 
 	flag.StringVar(&sid, "sid", "", "开始id")
 	flag.StringVar(&eid, "eid", "", "结束id")