|
@@ -97,6 +97,9 @@ func QyxyStandard() bool {
|
|
|
wg := &sync.WaitGroup{}
|
|
|
lock := &sync.Mutex{} //控制读写
|
|
|
arr := [][]map[string]interface{}{}
|
|
|
+ //q := map[string]interface{}{
|
|
|
+ // "company_name" : "北京教培师训网络科技股份有限公司",
|
|
|
+ //}
|
|
|
count, _ := sess.DB(Dbname).C(Dbcoll).Find(nil).Count()
|
|
|
log.Println("共查询:", count, "条")
|
|
|
if count == 0 {
|
|
@@ -377,23 +380,17 @@ func QyxyStandard() bool {
|
|
|
}
|
|
|
//es数据过滤
|
|
|
EsSaveFlag := true
|
|
|
- company_name := qu.ObjToString(esMap["company_name"])
|
|
|
- if len([]rune(company_name)) < 8 {
|
|
|
- EsSaveFlag = false
|
|
|
- }
|
|
|
- if EsSaveFlag {
|
|
|
- company_type := qu.ObjToString(esMap["company_type"])
|
|
|
- if company_type == "" || company_type == "个体工商户" {
|
|
|
- EsSaveFlag = false
|
|
|
- }
|
|
|
- }
|
|
|
- if EsSaveFlag {
|
|
|
- status := qu.ObjToString(esMap["company_status"])
|
|
|
- if status != "正常" {
|
|
|
+ company_type := qu.ObjToString(esMap["company_type"])
|
|
|
+ if company_type == "个体工商户" {
|
|
|
+ esMap["company_type_int"] = 1
|
|
|
+ company_name := qu.ObjToString(esMap["company_name"])
|
|
|
+ if len([]rune(company_name)) < 5 {
|
|
|
EsSaveFlag = false
|
|
|
}
|
|
|
- }
|
|
|
- if EsSaveFlag {
|
|
|
+ }else if company_type == "" {
|
|
|
+ EsSaveFlag = false
|
|
|
+ }else {
|
|
|
+ esMap["company_type_int"] = 0
|
|
|
credit_no := strings.TrimSpace(qu.ObjToString(esMap["credit_no"]))
|
|
|
company_code := strings.TrimSpace(qu.ObjToString(esMap["company_code"]))
|
|
|
if credit_no == "" && company_code == "" {
|
|
@@ -417,7 +414,7 @@ func QyxyStandard() bool {
|
|
|
}
|
|
|
EsSaveAllCache <- esMap //所有数据保存
|
|
|
update = append(update, map[string]interface{}{"$set": mgoMap})
|
|
|
- SaveHistoryName(tmp)
|
|
|
+ SaveHistoryName(tmp) //保存曾用名
|
|
|
if len(update) == 2 {
|
|
|
arr = append(arr, update)
|
|
|
}
|
|
@@ -728,19 +725,20 @@ func HistoryQyxyStandard() {
|
|
|
}
|
|
|
//es数据过滤
|
|
|
EsSaveFlag := true
|
|
|
- company_name := qu.ObjToString(esMap["company_name"])
|
|
|
- if len([]rune(company_name)) < 8 {
|
|
|
- EsSaveFlag = false
|
|
|
- }
|
|
|
- if EsSaveFlag {
|
|
|
- company_type := qu.ObjToString(esMap["company_type"])
|
|
|
- if company_type == "" || company_type == "个体工商户" {
|
|
|
+ company_type := qu.ObjToString(esMap["company_type"])
|
|
|
+ if company_type == "个体工商户" {
|
|
|
+ esMap["company_type_int"] = 1
|
|
|
+ company_name := qu.ObjToString(esMap["company_name"])
|
|
|
+ if len([]rune(company_name)) < 5 {
|
|
|
EsSaveFlag = false
|
|
|
}
|
|
|
- }
|
|
|
- if EsSaveFlag {
|
|
|
- status := qu.ObjToString(esMap["company_status"])
|
|
|
- if status != "正常" {
|
|
|
+ }else if company_type == "" {
|
|
|
+ EsSaveFlag = false
|
|
|
+ }else {
|
|
|
+ esMap["company_type_int"] = 0
|
|
|
+ credit_no := strings.TrimSpace(qu.ObjToString(esMap["credit_no"]))
|
|
|
+ company_code := strings.TrimSpace(qu.ObjToString(esMap["company_code"]))
|
|
|
+ if credit_no == "" && company_code == "" {
|
|
|
EsSaveFlag = false
|
|
|
}
|
|
|
}
|
|
@@ -766,9 +764,9 @@ func HistoryQyxyStandard() {
|
|
|
}
|
|
|
EsSaveCache <- esMap //过滤后数据保存
|
|
|
}
|
|
|
- EsSaveAllCache <- esMap //所有数据保存
|
|
|
- SaveHistoryName(tmp)
|
|
|
- update = append(update, map[string]interface{}{"$set": mgoMap})
|
|
|
+ //EsSaveAllCache <- esMap //所有数据保存
|
|
|
+ //SaveHistoryName(tmp)
|
|
|
+ //update = append(update, map[string]interface{}{"$set": mgoMap})
|
|
|
if len(update) == 2 {
|
|
|
arr = append(arr, update)
|
|
|
}
|
|
@@ -896,10 +894,17 @@ func InitAddress() {
|
|
|
log.Println("Init Address...")
|
|
|
AddressMap = map[string]*City{}
|
|
|
AddressOldMap = map[string]*City{}
|
|
|
- address, _ := Mgo.Find("address_new_2020", nil, nil, nil, false, -1, -1)
|
|
|
- for _, tmp := range *address {
|
|
|
+
|
|
|
+ sess := Mgo.GetMgoConn()
|
|
|
+ defer Mgo.DestoryMongoConn(sess)
|
|
|
+ result := sess.DB(Dbname).C("address_new_2020").Find(nil).Iter()
|
|
|
+ count := 0
|
|
|
+ for tmp := make(map[string]interface{}); result.Next(&tmp); count++ {
|
|
|
code := qu.ObjToString(tmp["code"])
|
|
|
codeLen := len(code)
|
|
|
+ if codeLen > 6 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
if t_code := CodeMap[codeLen]; t_code != "" { //新的address表补齐code
|
|
|
code = code + t_code
|
|
|
}
|
|
@@ -915,6 +920,7 @@ func InitAddress() {
|
|
|
AddressMap[code] = city
|
|
|
}
|
|
|
}
|
|
|
+ qu.Debug("Init Address end...", len(AddressMap), len(AddressOldMap))
|
|
|
}
|
|
|
|
|
|
func InitQyStype() {
|