|
@@ -11,7 +11,9 @@ import (
|
|
ul "util"
|
|
ul "util"
|
|
)
|
|
)
|
|
|
|
|
|
-var fields = map[string]interface{}{"toptype": 1, "subtype": 1, "subscopeclass": 1, "repeat": 1, "yl_purchasinglist": 1}
|
|
|
|
|
|
+var fields = map[string]interface{}{"toptype": 1, "subtype": 1, "subscopeclass": 1, "extracttype": 1, "purchasinglist": 1}
|
|
|
|
+
|
|
|
|
+var datalock, numlock sync.Mutex
|
|
|
|
|
|
func RunPurchasingInfo(gtid string, lteid string) {
|
|
func RunPurchasingInfo(gtid string, lteid string) {
|
|
log.Debug("开始处理标讯信息~~~", gtid, "~", lteid)
|
|
log.Debug("开始处理标讯信息~~~", gtid, "~", lteid)
|
|
@@ -23,15 +25,15 @@ func RunPurchasingInfo(gtid string, lteid string) {
|
|
"$lte": class.StringTOBsonId(lteid),
|
|
"$lte": class.StringTOBsonId(lteid),
|
|
},
|
|
},
|
|
}
|
|
}
|
|
- it := sess.DB(ul.Mgo.DbName).C("zktest_mysql_bidding").Find(&q).Sort("_id").Select(fields).Iter()
|
|
|
|
|
|
+ it := sess.DB(ul.Mgo.DbName).C(ul.S_Bidding_Coll).Find(&q).Sort("_id").Select(fields).Iter()
|
|
pool := make(chan bool, 10)
|
|
pool := make(chan bool, 10)
|
|
wg := &sync.WaitGroup{}
|
|
wg := &sync.WaitGroup{}
|
|
- total := 0
|
|
|
|
|
|
+ total, isok := 0, 0
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); total++ {
|
|
if total%100 == 0 {
|
|
if total%100 == 0 {
|
|
- log.Debug("cur index ", total)
|
|
|
|
|
|
+ log.Debug("cur index ", total, "~", isok)
|
|
}
|
|
}
|
|
- if qu.IntAll(tmp["repeat"]) == 1 {
|
|
|
|
|
|
+ if qu.IntAll(tmp["extracttype"]) != 1 {
|
|
tmp = make(map[string]interface{})
|
|
tmp = make(map[string]interface{})
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
@@ -43,26 +45,30 @@ func RunPurchasingInfo(gtid string, lteid string) {
|
|
wg.Done()
|
|
wg.Done()
|
|
}()
|
|
}()
|
|
//构建标的物基本信息
|
|
//构建标的物基本信息
|
|
- createBaseInfo(tmp)
|
|
|
|
-
|
|
|
|
|
|
+ b := createBaseInfo(tmp)
|
|
|
|
+ if b {
|
|
|
|
+ numlock.Lock()
|
|
|
|
+ isok++
|
|
|
|
+ numlock.Unlock()
|
|
|
|
+ }
|
|
}(tmp)
|
|
}(tmp)
|
|
tmp = make(map[string]interface{})
|
|
tmp = make(map[string]interface{})
|
|
}
|
|
}
|
|
wg.Wait()
|
|
wg.Wait()
|
|
|
|
|
|
- log.Debug("is over ", total)
|
|
|
|
|
|
+ log.Debug("is over ", total, "~", isok)
|
|
}
|
|
}
|
|
|
|
|
|
//构建标的物基本信息
|
|
//构建标的物基本信息
|
|
-func createBaseInfo(tmp map[string]interface{}) {
|
|
|
|
- p_list := isMarkInterfaceMap(tmp["yl_purchasinglist"])
|
|
|
|
- sub_list := isMarkInterfaceArr(tmp["subscopeclass"])
|
|
|
|
|
|
+func createBaseInfo(tmp map[string]interface{}) bool {
|
|
|
|
+ p_list := IsMarkInterfaceMap(tmp["purchasinglist"])
|
|
|
|
+ sub_list := IsMarkInterfaceArr(tmp["subscopeclass"])
|
|
infoid := class.BsonTOStringId(tmp["_id"])
|
|
infoid := class.BsonTOStringId(tmp["_id"])
|
|
bid_topsubtype_code := confrimTopSubCode(qu.ObjToString(tmp["toptype"]), qu.ObjToString(tmp["subtype"]))
|
|
bid_topsubtype_code := confrimTopSubCode(qu.ObjToString(tmp["toptype"]), qu.ObjToString(tmp["subtype"]))
|
|
b, industry_code, new_plist := checkWhetherValidInfo(p_list, sub_list)
|
|
b, industry_code, new_plist := checkWhetherValidInfo(p_list, sub_list)
|
|
if b {
|
|
if b {
|
|
//标的物基本信息~记录标签
|
|
//标的物基本信息~记录标签
|
|
- insertBaseInfo(new_plist, infoid, bid_topsubtype_code)
|
|
|
|
|
|
+ //insertBaseInfo(new_plist, infoid, bid_topsubtype_code)
|
|
//招标信息领域标签
|
|
//招标信息领域标签
|
|
//insertFiledTag(infoid)
|
|
//insertFiledTag(infoid)
|
|
//招标信息行业标签
|
|
//招标信息行业标签
|
|
@@ -71,13 +77,13 @@ func createBaseInfo(tmp map[string]interface{}) {
|
|
if industry_code != "" && len(new_plist) > 0 && bid_topsubtype_code != "" && infoid != "" {
|
|
if industry_code != "" && len(new_plist) > 0 && bid_topsubtype_code != "" && infoid != "" {
|
|
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+ return b
|
|
}
|
|
}
|
|
|
|
|
|
//return 是否有效~行业代码~新标的物信息
|
|
//return 是否有效~行业代码~新标的物信息
|
|
func checkWhetherValidInfo(p_list []map[string]interface{}, sub_list []string) (bool, string, []map[string]interface{}) {
|
|
func checkWhetherValidInfo(p_list []map[string]interface{}, sub_list []string) (bool, string, []map[string]interface{}) {
|
|
is_exists := false
|
|
is_exists := false
|
|
- industry_code, b := isIndustryInfo(sub_list)
|
|
|
|
|
|
+ industry_code, b := IsIndustryInfo(sub_list)
|
|
new_plist := []map[string]interface{}{}
|
|
new_plist := []map[string]interface{}{}
|
|
if len(p_list) > 0 && b {
|
|
if len(p_list) > 0 && b {
|
|
is_exists, new_plist = createNewPurchasingInfo(p_list)
|
|
is_exists, new_plist = createNewPurchasingInfo(p_list)
|
|
@@ -136,7 +142,7 @@ func createNewPurchasingInfo(p_list []map[string]interface{}) (bool, []map[strin
|
|
}
|
|
}
|
|
|
|
|
|
//是否为医疗行业数据
|
|
//是否为医疗行业数据
|
|
-func isIndustryInfo(sub_list []string) (string, bool) {
|
|
|
|
|
|
+func IsIndustryInfo(sub_list []string) (string, bool) {
|
|
code := ""
|
|
code := ""
|
|
b := false
|
|
b := false
|
|
for _, v := range sub_list {
|
|
for _, v := range sub_list {
|
|
@@ -179,7 +185,7 @@ func confrimTopSubCode(toptype string, subtype string) string {
|
|
}
|
|
}
|
|
|
|
|
|
//return
|
|
//return
|
|
-func isMarkInterfaceMap(t interface{}) []map[string]interface{} {
|
|
|
|
|
|
+func IsMarkInterfaceMap(t interface{}) []map[string]interface{} {
|
|
p_list := []map[string]interface{}{}
|
|
p_list := []map[string]interface{}{}
|
|
if yl_list_1, ok_1 := t.(primitive.A); ok_1 {
|
|
if yl_list_1, ok_1 := t.(primitive.A); ok_1 {
|
|
p_list = qu.ObjArrToMapArr(yl_list_1)
|
|
p_list = qu.ObjArrToMapArr(yl_list_1)
|
|
@@ -192,7 +198,7 @@ func isMarkInterfaceMap(t interface{}) []map[string]interface{} {
|
|
}
|
|
}
|
|
|
|
|
|
//return
|
|
//return
|
|
-func isMarkInterfaceArr(t interface{}) []string {
|
|
|
|
|
|
+func IsMarkInterfaceArr(t interface{}) []string {
|
|
sub_list := []string{}
|
|
sub_list := []string{}
|
|
if list_1, ok_1 := t.(primitive.A); ok_1 {
|
|
if list_1, ok_1 := t.(primitive.A); ok_1 {
|
|
sub_list = qu.ObjArrToStringArr(list_1)
|
|
sub_list = qu.ObjArrToStringArr(list_1)
|