|
@@ -132,17 +132,18 @@ func NewHistorymap(startid string,lastid string,startTime int64,lastTime int64)
|
|
|
defer mgo.DestoryMongoConn(sess_start) //lte gte
|
|
|
it_start := sess_start.DB(mgo.DbName).C(extract).Find(mongodb.ObjToMQ(`{"_id":{"$lte":"`+startid+`"}}`,
|
|
|
true)).Sort("-_id").Iter()
|
|
|
- n := 0
|
|
|
- for tmp := make(map[string]interface{}); it_start.Next(&tmp); n++ {
|
|
|
- cm := tmp["comeintime"]
|
|
|
- comeintime := qutil.Int64All(tmp["comeintime"])
|
|
|
+ m,n := 0,0
|
|
|
+ for tmp_start := make(map[string]interface{}); it_start.Next(&tmp_start);{
|
|
|
+ cm := tmp_start["comeintime"]
|
|
|
+ comeintime := qutil.Int64All(tmp_start["comeintime"])
|
|
|
if comeintime == 0 {
|
|
|
- id := qutil.BsonIdToSId(tmp["_id"])[0:8]
|
|
|
+ id := qutil.BsonIdToSId(tmp_start["_id"])[0:8]
|
|
|
comeintime, _ = strconv.ParseInt(id, 16, 64)
|
|
|
}
|
|
|
|
|
|
- if qutil.Float64All(startTime-comeintime) < datelimit {
|
|
|
- info := NewInfo(tmp)
|
|
|
+ if qutil.Float64All(startTime-comeintime) <= datelimit {
|
|
|
+ n++
|
|
|
+ info := NewInfo(tmp_start)
|
|
|
dkey := qutil.FormatDateWithObj(&cm, qutil.Date_yyyyMMdd)
|
|
|
k := fmt.Sprintf("%s_%s_%s", dkey, info.subtype, info.area)
|
|
|
data := hm.data[k]
|
|
@@ -152,28 +153,30 @@ func NewHistorymap(startid string,lastid string,startTime int64,lastTime int64)
|
|
|
data = append(data, info)
|
|
|
hm.data[k] = data
|
|
|
hm.keys[dkey] = true
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
break
|
|
|
}
|
|
|
- tmp = make(map[string]interface{})
|
|
|
+ tmp_start = make(map[string]interface{})
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ log.Println("load history 前:", n)
|
|
|
//取lastid之后5天
|
|
|
sess_last := mgo.GetMgoConn()
|
|
|
defer mgo.DestoryMongoConn(sess_last) //lte gte
|
|
|
- it_last := sess_start.DB(mgo.DbName).C(extract).Find(mongodb.ObjToMQ(`{"_id":{"$gte":"`+lastid+`"}}`,
|
|
|
+ it_last := sess_last.DB(mgo.DbName).C(extract).Find(mongodb.ObjToMQ(`{"_id":{"$gte":"`+lastid+`"}}`,
|
|
|
true)).Sort("_id").Iter()
|
|
|
- for tmp := make(map[string]interface{}); it_last.Next(&tmp); n++ {
|
|
|
- cm := tmp["comeintime"]
|
|
|
- comeintime := qutil.Int64All(tmp["comeintime"])
|
|
|
+
|
|
|
+ for tmp_last := make(map[string]interface{}); it_last.Next(&tmp_last); {
|
|
|
+ cm := tmp_last["comeintime"]
|
|
|
+ comeintime := qutil.Int64All(tmp_last["comeintime"])
|
|
|
if comeintime == 0 {
|
|
|
- id := qutil.BsonIdToSId(tmp["_id"])[0:8]
|
|
|
+ id := qutil.BsonIdToSId(tmp_last["_id"])[0:8]
|
|
|
comeintime, _ = strconv.ParseInt(id, 16, 64)
|
|
|
}
|
|
|
|
|
|
- if qutil.Float64All(comeintime-lastTime) > datelimit {
|
|
|
- info := NewInfo(tmp)
|
|
|
+ if qutil.Float64All(comeintime-lastTime) <= datelimit {
|
|
|
+ m++
|
|
|
+ info := NewInfo(tmp_last)
|
|
|
dkey := qutil.FormatDateWithObj(&cm, qutil.Date_yyyyMMdd)
|
|
|
k := fmt.Sprintf("%s_%s_%s", dkey, info.subtype, info.area)
|
|
|
data := hm.data[k]
|
|
@@ -183,17 +186,15 @@ func NewHistorymap(startid string,lastid string,startTime int64,lastTime int64)
|
|
|
data = append(data, info)
|
|
|
hm.data[k] = data
|
|
|
hm.keys[dkey] = true
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
break
|
|
|
}
|
|
|
- tmp = make(map[string]interface{})
|
|
|
+ tmp_last = make(map[string]interface{})
|
|
|
}
|
|
|
|
|
|
+ log.Println("load history 后:", m)
|
|
|
|
|
|
|
|
|
-
|
|
|
-
|
|
|
- log.Println("load history:", n)
|
|
|
return hm
|
|
|
}
|
|
|
|
|
@@ -293,54 +294,54 @@ L:
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- //前置条件
|
|
|
+ //前置条件2个不重复 一个重复
|
|
|
if info.titleSpecialWord&&info.title!=v.title&&v.title!="" {
|
|
|
continue
|
|
|
}
|
|
|
-
|
|
|
if info.buyer != "" &&v.buyer == info.buyer {
|
|
|
//满足标题
|
|
|
if len([]rune(v.title)) >= 10 && len([]rune(info.title)) >= 10 && v.title != info.title && (info.specialWord || v.specialWord) {
|
|
|
continue
|
|
|
}
|
|
|
}
|
|
|
+ if info.site!=""&&info.site==v.site{
|
|
|
+ if info.href!=""&&info.href==v.href {
|
|
|
+ reason = "href相同"
|
|
|
+ b = true
|
|
|
+ source = v
|
|
|
+ reasons = reason
|
|
|
+ break L
|
|
|
+ }
|
|
|
+ }
|
|
|
//代理机构相同-非空相等
|
|
|
if v.agency != "" && info.agency != "" && v.agency == info.agency {
|
|
|
- reason = reason + "同机构,"
|
|
|
- if info.agency=="" {
|
|
|
- reason = reason + "指定范围,"
|
|
|
- //指定该范围内数据判重 jsondata
|
|
|
- if v.agency=="" {
|
|
|
- continue
|
|
|
- }
|
|
|
- }else {
|
|
|
- reason = reason + "非指定范围,"
|
|
|
+ reason = reason + "同机构-"
|
|
|
+ if quickHeavyMethodTwo(v,info) {
|
|
|
+ b = true
|
|
|
+ source = v
|
|
|
+ reasons = reason
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ reason = reason + "非同机构-"
|
|
|
+ if info.city!=""&&info.city==v.city{
|
|
|
+ reason = reason + "同城-"
|
|
|
if quickHeavyMethodTwo(v,info) {
|
|
|
b = true
|
|
|
source = v
|
|
|
reasons = reason
|
|
|
- break L
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- reason = reason + "非同机构,"
|
|
|
- if info.agency=="" {
|
|
|
- reason = reason + "指定范围,"
|
|
|
- //指定该范围内数据判重 jsondata
|
|
|
- if v.agency=="" {
|
|
|
- continue
|
|
|
+ break
|
|
|
}
|
|
|
}else {
|
|
|
- reason = reason + "非指定范围,"
|
|
|
+ reason = reason + "不同城-"
|
|
|
if quickHeavyMethodOne(v,info) {
|
|
|
b = true
|
|
|
source = v
|
|
|
reasons = reason
|
|
|
- break L
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -385,47 +386,78 @@ L:
|
|
|
data := h.data[k]
|
|
|
if len(data) > 0 { //对比v 找到同类型,同省或全国的数据作对比
|
|
|
for _, v := range data {
|
|
|
+ reason = ""
|
|
|
if v.id == info.id {//正常重复
|
|
|
return false, v,""
|
|
|
}
|
|
|
+ //备份 新增发布时间为空-取入库时间-在为空取id
|
|
|
if math.Abs(qutil.Float64All(v.accurateTime-info.accurateTime)) > datelimit {
|
|
|
continue //是否为5天内数据
|
|
|
}
|
|
|
- //类型分组-相同类型继续
|
|
|
+ //类型分组
|
|
|
if info.subtype==v.subtype {
|
|
|
+ //站点配置--
|
|
|
+ if info.site!="" {
|
|
|
+ dict := SiteMap[info.site].(map[string]string)
|
|
|
+ if dict!=nil{
|
|
|
+ //临时改变--具体值
|
|
|
+ if info.area=="全国" &&dict["area"]!="" {
|
|
|
+ info.area = dict["area"]
|
|
|
+ info.city = dict["city"]
|
|
|
+ }else {
|
|
|
+ if info.city=="" &&dict["city"]!="" {
|
|
|
+ info.area = dict["area"]
|
|
|
+ info.city = dict["city"]
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //前置条件2个不重复 一个重复
|
|
|
+ if info.titleSpecialWord&&info.title!=v.title&&v.title!="" {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if info.buyer != "" &&v.buyer == info.buyer {
|
|
|
+ //满足标题
|
|
|
+ if len([]rune(v.title)) >= 10 && len([]rune(info.title)) >= 10 && v.title != info.title && (info.specialWord || v.specialWord) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if info.site!=""&&info.site==v.site{
|
|
|
+ if info.href!=""&&info.href==v.href {
|
|
|
+ reason = "href相同"
|
|
|
+ b = true
|
|
|
+ source = v
|
|
|
+ reasons = reason
|
|
|
+ break L
|
|
|
+ }
|
|
|
+ }
|
|
|
//代理机构相同-非空相等
|
|
|
if v.agency != "" && info.agency != "" && v.agency == info.agency {
|
|
|
- reason = reason + "同机构,"
|
|
|
- if info.agency=="" {
|
|
|
- reason = reason + "指定范围,"
|
|
|
- //指定该范围内数据判重 jsondata
|
|
|
- if v.agency=="" {
|
|
|
- continue
|
|
|
- }
|
|
|
- }else {
|
|
|
- reason = reason + "非指定范围,"
|
|
|
+ reason = reason + "同机构-"
|
|
|
+ if quickHeavyMethodTwo(v,info) {
|
|
|
+ b = true
|
|
|
+ source = v
|
|
|
+ reasons = reason
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }else {
|
|
|
+ reason = reason + "非同机构-"
|
|
|
+ if info.city!=""&&info.city==v.city{
|
|
|
+ reason = reason + "同城-"
|
|
|
if quickHeavyMethodTwo(v,info) {
|
|
|
b = true
|
|
|
source = v
|
|
|
reasons = reason
|
|
|
- break L
|
|
|
- }
|
|
|
- }
|
|
|
- }else {
|
|
|
- reason = reason + "非同机构,"
|
|
|
- if info.agency=="" {
|
|
|
- reason = reason + "指定范围,"
|
|
|
- //指定该范围内数据判重 jsondata
|
|
|
- if v.agency=="" {
|
|
|
- continue
|
|
|
+ break
|
|
|
}
|
|
|
}else {
|
|
|
- reason = reason + "非指定范围,"
|
|
|
+ reason = reason + "不同城-"
|
|
|
if quickHeavyMethodOne(v,info) {
|
|
|
b = true
|
|
|
source = v
|
|
|
reasons = reason
|
|
|
- break L
|
|
|
+ break
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -657,32 +689,32 @@ func tenderRepeat_A(v *Info ,info *Info) bool {
|
|
|
var ss string
|
|
|
p1,p2,p3,p4,p9,p10,p11 := false,false,false,false,false,false,false
|
|
|
if v.projectname!=""&&v.projectname==info.projectname {
|
|
|
- ss = fmt.Sprintf(ss,"p1(名称)-")
|
|
|
+ ss = ss+"p1(名称)-"
|
|
|
p1 = true
|
|
|
}
|
|
|
if v.buyer!=""&&v.buyer==info.buyer {
|
|
|
- ss = fmt.Sprintf(ss,"p2(单位)-")
|
|
|
+ ss = ss+"p2(单位)-"
|
|
|
p2 = true
|
|
|
}
|
|
|
if v.projectcode!=""&&v.projectcode==info.projectcode {
|
|
|
- ss = fmt.Sprintf(ss,"p3(编号)-")
|
|
|
+ ss = ss+"p3(编号)-"
|
|
|
p3 = true
|
|
|
}
|
|
|
if v.budget!=0&&v.budget==info.budget {
|
|
|
- ss = fmt.Sprintf(ss,"p4(预算)-")
|
|
|
+ ss = ss+"p4(预算)-"
|
|
|
p4 = true
|
|
|
}
|
|
|
if v.bidopentime!=0&&v.bidopentime==info.bidopentime {
|
|
|
- ss = fmt.Sprintf(ss,"p9(开标时间)-")
|
|
|
+ ss = ss+"p9(开标时间)-"
|
|
|
p9 = true
|
|
|
}
|
|
|
if v.agencyaddr!=""&&v.agencyaddr==info.agencyaddr {
|
|
|
- ss = fmt.Sprintf(ss,"p10(开标地点)-")
|
|
|
+ ss = ss+"p10(开标地点)-"
|
|
|
p10 = true
|
|
|
}
|
|
|
if len([]rune(v.title))>10 && len([]rune(info.title))>10&&
|
|
|
(strings.Contains(v.title, info.title)||strings.Contains(info.title, v.title)) {
|
|
|
- ss = fmt.Sprintf(ss,"p11(标题)-")
|
|
|
+ ss = ss+"p11(标题)-"
|
|
|
p11 = true
|
|
|
}
|
|
|
|
|
@@ -731,7 +763,7 @@ func tenderRepeat_B(v *Info ,info *Info) bool {
|
|
|
if n==2 &&m==2 {
|
|
|
return false
|
|
|
}else {
|
|
|
- reason = reason+"满足招标B,七选二,"
|
|
|
+ reason = reason+"满足招标B,七选二,"
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
@@ -767,28 +799,28 @@ func winningRepeat_A(v *Info ,info *Info) bool {
|
|
|
var ss string
|
|
|
p1,p2,p3,p5,p6,p11 := false,false,false,false,false,false
|
|
|
if v.projectname!=""&&v.projectname==info.projectname {
|
|
|
- ss = fmt.Sprintf(ss,"p1(标题)-")
|
|
|
+ ss = ss+"p1(标题)-"
|
|
|
p1 = true
|
|
|
}
|
|
|
if v.buyer!=""&&v.buyer==info.buyer {
|
|
|
- ss = fmt.Sprintf(ss,"p2(单位)-")
|
|
|
+ ss = ss+"p2(单位)-"
|
|
|
p2 = true
|
|
|
}
|
|
|
if v.projectcode!=""&&v.projectcode==info.projectcode {
|
|
|
- ss = fmt.Sprintf(ss,"p3(编号)-")
|
|
|
+ ss = ss+"p3(编号)-"
|
|
|
p3 = true
|
|
|
}
|
|
|
if v.bidamount!=0&&v.bidamount==info.bidamount {
|
|
|
- ss = fmt.Sprintf(ss,"p5(中标金)-")
|
|
|
+ ss = ss+"p5(中标金)-"
|
|
|
p5 = true
|
|
|
}
|
|
|
if v.winner!=""&&v.winner==info.winner {
|
|
|
- ss = fmt.Sprintf(ss,"p6(中标人)-")
|
|
|
+ ss = ss+"p6(中标人)-"
|
|
|
p6 = true
|
|
|
}
|
|
|
if len([]rune(v.title))>10 && len([]rune(info.title))>10&&
|
|
|
(strings.Contains(v.title, info.title)||strings.Contains(info.title, v.title)) {
|
|
|
- ss = fmt.Sprintf(ss,"p11(标题)-")
|
|
|
+ ss = ss+"p11(标题)-"
|
|
|
p11 = true
|
|
|
}
|
|
|
|
|
@@ -798,7 +830,7 @@ func winningRepeat_A(v *Info ,info *Info) bool {
|
|
|
(p2&&p5&&p6)||(p2&&p5&&p11)||(p2&&p6&&p11)||
|
|
|
(p3&&p5&&p6)||(p3&&p5&&p11)||(p3&&p6&&p11)||
|
|
|
(p5&&p6&&p11){
|
|
|
- reason = reason+"满足中标A,3要素组合-"+ss+","
|
|
|
+ reason = reason+"满足中标A,3要素组合-"+ss+","
|
|
|
return true
|
|
|
}
|
|
|
|
|
@@ -833,7 +865,7 @@ func winningRepeat_B(v *Info ,info *Info) bool {
|
|
|
if n==2 &&m==2 {
|
|
|
return false
|
|
|
}else {
|
|
|
- reason = reason+"满足中标B,六选二,"
|
|
|
+ reason = reason+"满足中标B.六选二,"
|
|
|
return true
|
|
|
}
|
|
|
}
|
|
@@ -924,13 +956,6 @@ func (d *datamap) update(t int64) {
|
|
|
//log.Println("更新前后数据:", all, all1)
|
|
|
}
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
func (d *datamap) GetLatelyFiveDay(t int64) []string {
|
|
|
array := make([]string, d.days)
|
|
|
now := time.Unix(t, 0)
|