瀏覽代碼

修改-判重原因记录

apple 5 年之前
父節點
當前提交
a68bf92413
共有 2 個文件被更改,包括 10 次插入9 次删除
  1. 8 7
      udpfilterdup/src/datamap.go
  2. 2 2
      udpfilterdup/src/main.go

+ 8 - 7
udpfilterdup/src/datamap.go

@@ -368,7 +368,7 @@ L:
 	return
 }
 
-func (h *historymap) check(info *Info) (b bool,  source *Info ,reasons string ,) {
+func (h *historymap) checkHistory(info *Info) (b bool,  source *Info ,reasons string ,) {
 	reason = ""
 	h.lock.Lock()
 	defer h.lock.Unlock()
@@ -386,7 +386,7 @@ L:
 		data := h.data[k]
 		if len(data) > 0 { //对比v   找到同类型,同省或全国的数据作对比
 			for _, v := range data {
-				reason = ""
+				reason := ""
 				if v.id == info.id {//正常重复
 					return false, v,""
 				}
@@ -478,11 +478,12 @@ L:
 			}
 		}
 	}else {
-		reason = ""
-		if source.repeatid!=""{
-			//未判重-有变化--记录
-			b = true
-			reason = "未判重记录"
+		if source!=nil{
+			if source.repeatid!=""{
+				//未判重-有变化--记录
+				b = true
+				reason = "未判重记录"
+			}
 		}
 	}
 

+ 2 - 2
udpfilterdup/src/main.go

@@ -539,7 +539,7 @@ func historyTask(data []byte, mapInfo map[string]interface{}) {
 				mapLock.Unlock()
 			}else  {
 				mapLock.Lock()
-				b, source,reason := HM.check(info)
+				b, source,reason := HM.checkHistory(info)
 				if b { //有重复,生成更新语句,更新抽取和更新招标
 					if reason == "未判重记录" {
 						fmt.Println("未判重记录")
@@ -573,7 +573,7 @@ func historyTask(data []byte, mapInfo map[string]interface{}) {
 						if basic_bool {
 							//已原始数据为标准-对比数据打判重标签
 							newData,mergeArr= mergeDataFields(source,info)
-							DM.replaceSourceData(newData,source.id) //替换
+							DM.replaceSourceData(newData,source.id) //替换
 							id_map["_id"]= util.StringTOBsonId(source.id)
 							repeat_id = source.id
 						}else {