|
@@ -11,6 +11,7 @@ import (
|
|
|
"strings"
|
|
|
"time"
|
|
|
)
|
|
|
+
|
|
|
var zhb_key_list = []string{"budget", "buyer", "agency", "s_winner", "bidamount", "projectcode", "contractcode"}
|
|
|
var packreg *regexp.Regexp
|
|
|
var Mgo *MongodbSim
|
|
@@ -21,30 +22,31 @@ type dataSource struct {
|
|
|
projectname, projectcode, contractcode string
|
|
|
buyer, agency, s_winner string
|
|
|
budget, bidamount float64
|
|
|
- budget_isnull,bidamount_isnull bool
|
|
|
+ budget_isnull, bidamount_isnull bool
|
|
|
isrepeat bool
|
|
|
repeat_id_source string
|
|
|
repeat_id map[string]string
|
|
|
repeatText string
|
|
|
- publishtime int64
|
|
|
+ publishtime int64
|
|
|
}
|
|
|
|
|
|
//var addr, dbname, table, startTime, endTime, sortType *string
|
|
|
-var addr, dbname, table, sortType string
|
|
|
+var addr, dbname, table, sortType string
|
|
|
var cycle int64
|
|
|
-var sysconfig map[string]interface{} //配置文件
|
|
|
+var sysconfig map[string]interface{} //配置文件
|
|
|
|
|
|
-func initConfig() {
|
|
|
+func initConfig() {
|
|
|
qu.ReadConfig(&sysconfig)
|
|
|
- addr = sysconfig["mgo_addr"].(string)
|
|
|
- dbname = sysconfig["mgo_db"].(string)
|
|
|
- table = sysconfig["mgo_table"].(string)
|
|
|
- sortType = sysconfig["mgo_sort"].(string)
|
|
|
- month := qu.IntAllDef(sysconfig["cycle_month"],6)
|
|
|
+ addr = sysconfig["mgo_addr"].(string)
|
|
|
+ dbname = sysconfig["mgo_db"].(string)
|
|
|
+ table = sysconfig["mgo_table"].(string)
|
|
|
+ sortType = sysconfig["mgo_sort"].(string)
|
|
|
+ month := qu.IntAllDef(sysconfig["cycle_month"], 6)
|
|
|
cycle = qu.Int64All(month)
|
|
|
}
|
|
|
+
|
|
|
//创建mgo索引
|
|
|
-func createMgoIndex(){
|
|
|
+func createMgoIndex() {
|
|
|
mongoDBDialInfo := &mgo.DialInfo{
|
|
|
Addrs: []string{addr},
|
|
|
Timeout: 60 * time.Second,
|
|
@@ -56,12 +58,9 @@ func createMgoIndex(){
|
|
|
}
|
|
|
coll := session.DB(dbname).C(table)
|
|
|
err = coll.EnsureIndexKey("publishtime")
|
|
|
- fmt.Println("创建索引~publishtime",err)
|
|
|
-
|
|
|
- //查询所有的已存在索引
|
|
|
- //indexs, err := coll.Indexes()
|
|
|
- //fmt.Println("indexs--------------:", indexs)
|
|
|
+ fmt.Println("创建索引~publishtime", err)
|
|
|
}
|
|
|
+
|
|
|
//初始化
|
|
|
func init() {
|
|
|
initConfig()
|
|
@@ -77,9 +76,10 @@ func init() {
|
|
|
//packreg, _ = regexp.Compile(`([包标段][::]?[a-zA-Z0-9①②ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ一二三四五六七八九十]|[a-zA-Z0-9①②ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ一二三四五六七八九十][包标段]){1,}`)
|
|
|
//packreg, _ = regexp.MustCompile("([a-zA-Z0-9①②ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩ一二三四五六七八九十](包|标|段)[::]?)")
|
|
|
}
|
|
|
+
|
|
|
//主函数
|
|
|
func main() {
|
|
|
- if addr == "" || dbname == "" || table == "" || sortType == "" {
|
|
|
+ if addr == "" || dbname == "" || table == "" || sortType == "" {
|
|
|
log.Println("参数配置有误")
|
|
|
fmt.Printf("数据库地址:%s\n数据库名称:%s\n表名:%s\n排序方式:%s\n", addr, dbname, table, sortType)
|
|
|
os.Exit(0)
|
|
@@ -106,7 +106,7 @@ func main() {
|
|
|
sort = "-publishtime"
|
|
|
}
|
|
|
//log.Println(sort)
|
|
|
- q:=map[string]interface{}{}
|
|
|
+ q := map[string]interface{}{}
|
|
|
sess := Mgo.GetMgoConn()
|
|
|
defer Mgo.DestoryMongoConn(sess)
|
|
|
|
|
@@ -117,7 +117,7 @@ func main() {
|
|
|
//var filterReg = regexp.MustCompile("[`~!@#$^&*()=|{}':;,\\[\\].<>/?!¥…()—【】‘;:”“。,、?%+_--]")
|
|
|
index := 0
|
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); index++ {
|
|
|
- info :=tmp["v_baseinfo"].(map[string]interface{})
|
|
|
+ info := tmp["v_baseinfo"].(map[string]interface{})
|
|
|
d := &dataSource{
|
|
|
_id: BsonTOStringId(tmp["_id"]),
|
|
|
id: qu.ObjToString(tmp["id"]),
|
|
@@ -133,11 +133,11 @@ func main() {
|
|
|
publishtime: qu.Int64All(info["publishtime"]),
|
|
|
repeat_id: map[string]string{},
|
|
|
}
|
|
|
- if info["budget"]==nil{
|
|
|
- d.budget_isnull=true
|
|
|
+ if info["budget"] == nil {
|
|
|
+ d.budget_isnull = true
|
|
|
}
|
|
|
- if info["bidamount"]==nil{
|
|
|
- d.bidamount_isnull=true
|
|
|
+ if info["bidamount"] == nil {
|
|
|
+ d.bidamount_isnull = true
|
|
|
}
|
|
|
//log.Println(tmp["_id"],tmp["title"],tmp["projectname"])
|
|
|
if index%10000 == 0 {
|
|
@@ -146,9 +146,9 @@ func main() {
|
|
|
listSource = append(listSource, d)
|
|
|
tmp = map[string]interface{}{}
|
|
|
}
|
|
|
- log.Println("数据加载完成",len(listSource))
|
|
|
- for i:=0;i<len(listSource);i++ {
|
|
|
- for j:=0;j<len(listSource)-i-1;j++ {
|
|
|
+ log.Println("数据加载完成", len(listSource))
|
|
|
+ for i := 0; i < len(listSource); i++ {
|
|
|
+ for j := 0; j < len(listSource)-i-1; j++ {
|
|
|
if listSource[j].publishtime > listSource[j+1].publishtime {
|
|
|
listSource[j], listSource[j+1] = listSource[j+1], listSource[j]
|
|
|
}
|
|
@@ -162,35 +162,36 @@ func main() {
|
|
|
dd++
|
|
|
}
|
|
|
//更新数据
|
|
|
- if len(a.repeat_id) ==0{
|
|
|
+ if len(a.repeat_id) == 0 {
|
|
|
Mgo.UpdateById(table, a._id,
|
|
|
map[string]interface{}{"$set": map[string]interface{}{
|
|
|
//重复数据看repeatid
|
|
|
- "repeatid": a.repeat_id_source, //和哪条数据重复id
|
|
|
- "repeat": a.isrepeat, //本条数据是否重复数据
|
|
|
- "repeattext": a.repeatText, //本数据被判重的原因
|
|
|
+ "repeatid": a.repeat_id_source, //和哪条数据重复id
|
|
|
+ "repeat": a.isrepeat, //本条数据是否重复数据
|
|
|
+ "repeattext": a.repeatText, //本数据被判重的原因
|
|
|
}})
|
|
|
- }else {
|
|
|
- if len(a.repeat_id) > 0{
|
|
|
- arr:=[]string{}
|
|
|
- for k,_:=range a.repeat_id{
|
|
|
- arr = append(arr,k)
|
|
|
+ } else {
|
|
|
+ if len(a.repeat_id) > 0 {
|
|
|
+ arr := []string{}
|
|
|
+ for k, _ := range a.repeat_id {
|
|
|
+ arr = append(arr, k)
|
|
|
}
|
|
|
Mgo.UpdateById(table, a._id,
|
|
|
map[string]interface{}{"$set": map[string]interface{}{
|
|
|
//原始数据看repeatid_ids_str
|
|
|
- "repeatid": a.repeat_id_source, //和哪条数据重复id
|
|
|
- "repeat": a.isrepeat, //本条数据是否重复数据
|
|
|
+ "repeatid": a.repeat_id_source, //和哪条数据重复id
|
|
|
+ "repeat": a.isrepeat, //本条数据是否重复数据
|
|
|
//"repeatid_ids": a.repeat_id, //和我重复的数据都有哪些
|
|
|
- "repeatid_ids_str": strings.Join(arr,","),
|
|
|
- "repeattext": a.repeatText, //本数据被判重的原因
|
|
|
- }})}
|
|
|
+ "repeatid_ids_str": strings.Join(arr, ","),
|
|
|
+ "repeattext": a.repeatText, //本数据被判重的原因
|
|
|
+ }})
|
|
|
+ }
|
|
|
}
|
|
|
if i%1000 == 0 {
|
|
|
log.Println("已更新:", i)
|
|
|
}
|
|
|
}
|
|
|
- log.Println("重复数据量:",dd)
|
|
|
+ log.Println("重复数据量:", dd)
|
|
|
}
|
|
|
|
|
|
var listSize = 20000
|
|
@@ -205,7 +206,7 @@ func dataItem() {
|
|
|
for j := i + 1; j < len(listSource); j++ {
|
|
|
b = listSource[j]
|
|
|
if sortType == "1" {
|
|
|
- if publishtime_b_a(*a,*b){
|
|
|
+ if publishtime_b_a(*a, *b) {
|
|
|
// if b.isrepeat {
|
|
|
// continue
|
|
|
// }
|
|
@@ -216,8 +217,8 @@ func dataItem() {
|
|
|
// log.Println("sss", a.id, b.isrepeat, b.repeat_id)
|
|
|
// }
|
|
|
}
|
|
|
- }else{
|
|
|
- if publishtime_a_b(*a,*b){
|
|
|
+ } else {
|
|
|
+ if publishtime_a_b(*a, *b) {
|
|
|
// if b.isrepeat {
|
|
|
// continue
|
|
|
// }
|
|
@@ -241,14 +242,14 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
case a.title == b.title: //标题相等
|
|
|
if pankong(a.contractcode) && pankong(b.contractcode) && a.contractcode != b.contractcode {
|
|
|
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
- if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
+ if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题相等 && bidamount && buyer && s_winner"
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
r := key_list(a, b)
|
|
|
if r {
|
|
|
b.repeat_id_source = a.id
|
|
@@ -257,12 +258,12 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
b.repeatText = "标题相等 && bidamount && buyer && key_list"
|
|
|
}
|
|
|
}
|
|
|
- } else if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner {
|
|
|
+ } else if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题相等 && bidamount && s_winner"
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
r := key_list(a, b)
|
|
|
if r {
|
|
|
b.repeat_id_source = a.id
|
|
@@ -271,7 +272,7 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
b.repeatText = "标题相等 && bidamount && key_list"
|
|
|
}
|
|
|
}
|
|
|
- }else if pankong(a.projectcode) && pankong(b.projectcode) && a.projectcode == b.projectcode {
|
|
|
+ } else if pankong(a.projectcode) && pankong(b.projectcode) && a.projectcode == b.projectcode {
|
|
|
r := key_list(a, b)
|
|
|
if r {
|
|
|
b.repeat_id_source = a.id
|
|
@@ -279,10 +280,10 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题相等 && projectcode && key_list"
|
|
|
}
|
|
|
- }else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
- if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
+ } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
+ if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner {
|
|
|
- if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
+ if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -299,7 +300,7 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
b.repeatText = "标题相等 && budget && key_list"
|
|
|
}
|
|
|
}
|
|
|
- } else {
|
|
|
+ } else {
|
|
|
//
|
|
|
}
|
|
|
case a.title != b.title: //标题不相等
|
|
@@ -312,10 +313,10 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
if a.projectname == b.projectname {
|
|
|
if pankong(a.contractcode) && pankong(b.contractcode) && a.contractcode != b.contractcode {
|
|
|
//
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
- if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner != b.s_winner{
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
+ if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner != b.s_winner {
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -325,10 +326,10 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
//a.repeat_id[b.id] = ""
|
|
|
//b.isrepeat = true
|
|
|
//b.repeatText = "标题不相等-->有分包 && projectname && bidamount"
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
//
|
|
|
} else {
|
|
|
- if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner && !a.budget_isnull && !b.budget_isnull && a.budget == b.budget && (a.budget >=0 || b.budget >= 0) {
|
|
|
+ if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner && !a.budget_isnull && !b.budget_isnull && a.budget == b.budget && (a.budget >= 0 || b.budget >= 0) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -338,7 +339,7 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
} else { //项目名称包含
|
|
|
if pankong(a.contractcode) && pankong(b.contractcode) && a.contractcode != b.contractcode {
|
|
|
//
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
if pankong(a.projectcode) && pankong(b.projectcode) && a.projectcode == b.projectcode {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
@@ -349,13 +350,13 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题不相等-->有分包 && projectname包含 && bidamount && s_winner"
|
|
|
- } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
- if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
+ } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
+ if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题不相等-->有分包 && projectname包含 && bidamount && budget && buyer"
|
|
|
- } else if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
+ } else if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -367,7 +368,7 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
} else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
//
|
|
|
} else {
|
|
|
- if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner && !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
+ if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner && !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -382,20 +383,20 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
if a.projectname == b.projectname {
|
|
|
if pankong(a.contractcode) && pankong(b.contractcode) && a.contractcode != b.contractcode {
|
|
|
//
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题不相等-->无分包 && projectname && bidamount"
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
//
|
|
|
} else {
|
|
|
if pankong(a.projectcode) && pankong(b.projectcode) && a.projectcode == b.projectcode {
|
|
|
if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner != b.s_winner {
|
|
|
|
|
|
- }else if !a.budget_isnull && !b.budget_isnull && a.budget != b.budget{
|
|
|
+ } else if !a.budget_isnull && !b.budget_isnull && a.budget != b.budget {
|
|
|
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -424,13 +425,13 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
// b.isrepeat = true
|
|
|
// b.repeatText = "标题不相等-->无分包 && projectname && s_winner && key_list"
|
|
|
//}
|
|
|
- } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
- if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
+ } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
+ if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题不相等-->无分包 && projectname && budget && buyer"
|
|
|
- } else if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
+ } else if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -443,7 +444,7 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
} else { //项目名称包含
|
|
|
if pankong(a.contractcode) && pankong(b.contractcode) && a.contractcode != b.contractcode {
|
|
|
//
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount == b.bidamount {
|
|
|
if pankong(a.projectcode) && pankong(b.projectcode) && a.projectcode == b.projectcode {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
@@ -454,13 +455,13 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题不相等-->无分包 && projectname包含 && bidamount && s_winner"
|
|
|
- } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
- if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
+ } else if !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
+ if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
|
b.repeatText = "标题不相等-->无分包 && projectname包含 && budget && buyer"
|
|
|
- } else if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
+ } else if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -471,10 +472,10 @@ func panchong(a, b dataSource) (c, d *dataSource) {
|
|
|
} else {
|
|
|
//
|
|
|
}
|
|
|
- } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
+ } else if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
//
|
|
|
} else {
|
|
|
- if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner && !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
+ if pankong(a.s_winner) && pankong(b.s_winner) && a.s_winner == b.s_winner && !a.budget_isnull && !b.budget_isnull && a.budget == b.budget {
|
|
|
b.repeat_id_source = a.id
|
|
|
a.repeat_id[b.id] = ""
|
|
|
b.isrepeat = true
|
|
@@ -496,19 +497,19 @@ func key_list(a, b dataSource) bool {
|
|
|
key := zhb_key_list[i]
|
|
|
switch key {
|
|
|
case "budget":
|
|
|
- if !a.budget_isnull && !b.budget_isnull && a.budget != b.budget {
|
|
|
+ if !a.budget_isnull && !b.budget_isnull && a.budget != b.budget {
|
|
|
return false
|
|
|
} else {
|
|
|
continue
|
|
|
}
|
|
|
case "buyer":
|
|
|
- if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
+ if strings.Contains(a.buyer, b.buyer) || strings.Contains(b.buyer, a.buyer) && pankong(a.buyer) && pankong(b.buyer) {
|
|
|
continue
|
|
|
} else {
|
|
|
return false
|
|
|
}
|
|
|
case "agency":
|
|
|
- if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
+ if strings.Contains(a.agency, b.agency) || strings.Contains(b.agency, a.agency) && pankong(a.agency) && pankong(b.agency) {
|
|
|
continue
|
|
|
} else {
|
|
|
return false
|
|
@@ -520,7 +521,7 @@ func key_list(a, b dataSource) bool {
|
|
|
continue
|
|
|
}
|
|
|
case "bidamount":
|
|
|
- if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
+ if !a.bidamount_isnull && !b.bidamount_isnull && a.bidamount != b.bidamount {
|
|
|
return false
|
|
|
} else {
|
|
|
continue
|
|
@@ -541,17 +542,18 @@ func key_list(a, b dataSource) bool {
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
+
|
|
|
//发布时间判断
|
|
|
//正序
|
|
|
-func publishtime_b_a(a,b dataSource) bool{
|
|
|
- return b.publishtime-a.publishtime < 86400 * 31 * cycle
|
|
|
+func publishtime_b_a(a, b dataSource) bool {
|
|
|
+ return b.publishtime-a.publishtime < 86400*31*cycle
|
|
|
}
|
|
|
+
|
|
|
//倒序
|
|
|
-func publishtime_a_b(a,b dataSource) bool {
|
|
|
- return a.publishtime-b.publishtime < 86400 * 31 * cycle
|
|
|
+func publishtime_a_b(a, b dataSource) bool {
|
|
|
+ return a.publishtime-b.publishtime < 86400*31*cycle
|
|
|
}
|
|
|
|
|
|
-
|
|
|
//
|
|
|
func pankong(a string) bool {
|
|
|
if a != "" {
|