|
@@ -15,11 +15,11 @@ import (
|
|
)
|
|
)
|
|
|
|
|
|
var (
|
|
var (
|
|
- AreaFiled = []string{"credit_no", "company_code"}
|
|
|
|
- WordsArr = []string{"研发", "研制", "开发", "生产", "制造", "制作", "加工", "种植"}
|
|
|
|
|
|
+ AreaFiled = []string{"credit_no", "company_code"}
|
|
|
|
+ WordsArr = []string{"研发", "研制", "开发", "生产", "制造", "制作", "加工", "种植"}
|
|
|
|
|
|
- seg jiebago.Segmenter
|
|
|
|
- regPre, _ = regexp.Compile(`^(.+[省|市|区|县|州])?(.+)`)
|
|
|
|
|
|
+ seg jiebago.Segmenter
|
|
|
|
+ regPre, _ = regexp.Compile(`^(.+[省|市|区|县|州])?(.+)`)
|
|
)
|
|
)
|
|
|
|
|
|
// 企业基本信息
|
|
// 企业基本信息
|
|
@@ -30,7 +30,7 @@ var company_base = []string{"company_name", "company_code", "credit_no", "org_co
|
|
}
|
|
}
|
|
|
|
|
|
var province_map = map[string]string{
|
|
var province_map = map[string]string{
|
|
- "BJ": "北京", "TJ": "天津", "SH": "上海", "CQ": "重庆", "HB": "河北", "SX": "山西", "NMG": "内蒙", "LN": "辽宁", "JL": "吉林",
|
|
|
|
|
|
+ "BJ": "北京", "TJ": "天津", "SH": "上海", "CQ": "重庆", "HB": "河北", "SX": "山西", "NMG": "内蒙古", "LN": "辽宁", "JL": "吉林",
|
|
"HLJ": "黑龙江", "JS": "江苏", "ZJ": "浙江", "AH": "安徽", "FJ": "福建", "JX": "江西", "SD": "山东", "HEN": "河南", "HUB": "湖北",
|
|
"HLJ": "黑龙江", "JS": "江苏", "ZJ": "浙江", "AH": "安徽", "FJ": "福建", "JX": "江西", "SD": "山东", "HEN": "河南", "HUB": "湖北",
|
|
"HUN": "湖南", "GD": "广东", "GX": "广西", "HAIN": "海南", "SC": "四川", "GZ": "贵州", "YN": "云南", "XZ": "西藏", "SAX": "陕西",
|
|
"HUN": "湖南", "GD": "广东", "GX": "广西", "HAIN": "海南", "SC": "四川", "GZ": "贵州", "YN": "云南", "XZ": "西藏", "SAX": "陕西",
|
|
"GS": "甘肃", "QH": "青海", "NX": "宁夏", "XJ": "新疆",
|
|
"GS": "甘肃", "QH": "青海", "NX": "宁夏", "XJ": "新疆",
|
|
@@ -39,7 +39,7 @@ var province_map = map[string]string{
|
|
func TimeTask() {
|
|
func TimeTask() {
|
|
c := cron.New()
|
|
c := cron.New()
|
|
//cronstr := "0 0 " + fmt.Sprint(TaskTime) + " * * ?" //每天TaskTime跑一次
|
|
//cronstr := "0 0 " + fmt.Sprint(TaskTime) + " * * ?" //每天TaskTime跑一次
|
|
- cronstrPa := "0 0 15 ? * WED" //凭安增量数据每周二跑一次
|
|
|
|
|
|
+ cronstrPa := "0 0 15 ? * WED" //凭安增量数据每周二跑一次
|
|
_ = c.AddFunc(cronstrPa, func() {
|
|
_ = c.AddFunc(cronstrPa, func() {
|
|
TaskFun()
|
|
TaskFun()
|
|
})
|
|
})
|
|
@@ -51,16 +51,20 @@ func TaskFun() {
|
|
sess := MongoTool1.GetMgoConn()
|
|
sess := MongoTool1.GetMgoConn()
|
|
defer MongoTool1.DestoryMongoConn(sess)
|
|
defer MongoTool1.DestoryMongoConn(sess)
|
|
|
|
|
|
|
|
+ client := Es.GetEsConn()
|
|
|
|
+ defer Es.DestoryEsConn(client)
|
|
|
|
+
|
|
pool := make(chan bool, 10)
|
|
pool := make(chan bool, 10)
|
|
wg := &sync.WaitGroup{}
|
|
wg := &sync.WaitGroup{}
|
|
|
|
|
|
//q := bson.M{"_id": bson.M{"$gt": lastId}}
|
|
//q := bson.M{"_id": bson.M{"$gt": lastId}}
|
|
//q := bson.M{"_id": 262454280}
|
|
//q := bson.M{"_id": 262454280}
|
|
|
|
+ //q := map[string]interface{}{"_id": "3fd1352a95f552bda9bac1248eb24f03"}
|
|
|
|
+ //q := map[string]interface{}{"company_name": nil}
|
|
it := sess.DB("mixdata").C("qyxy_tmp").Find(nil).Select(nil).Iter()
|
|
it := sess.DB("mixdata").C("qyxy_tmp").Find(nil).Select(nil).Iter()
|
|
count := 0
|
|
count := 0
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
- lastId = util.Int64All(tmp["_id"])
|
|
|
|
- if count%20000 == 0 {
|
|
|
|
|
|
+ if count%2000 == 0 {
|
|
util.Debug("current:", count)
|
|
util.Debug("current:", count)
|
|
}
|
|
}
|
|
pool <- true
|
|
pool <- true
|
|
@@ -71,6 +75,8 @@ func TaskFun() {
|
|
wg.Done()
|
|
wg.Done()
|
|
}()
|
|
}()
|
|
IncStd(tmp)
|
|
IncStd(tmp)
|
|
|
|
+ //taskinfo(tmp)
|
|
|
|
+
|
|
}(tmp)
|
|
}(tmp)
|
|
}
|
|
}
|
|
|
|
|
|
@@ -86,7 +92,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
if tmp["company_base"] != nil {
|
|
if tmp["company_base"] != nil {
|
|
companyArr := util.ObjArrToMapArr(tmp["company_base"].([]interface{}))
|
|
companyArr := util.ObjArrToMapArr(tmp["company_base"].([]interface{}))
|
|
company := companyArr[len(companyArr)-1]
|
|
company := companyArr[len(companyArr)-1]
|
|
- for _, v := range company_base{
|
|
|
|
|
|
+ for _, v := range company_base {
|
|
if company[v] == nil {
|
|
if company[v] == nil {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
@@ -94,7 +100,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
if v == "company_type" {
|
|
if v == "company_type" {
|
|
save["company_type_old"] = company[v]
|
|
save["company_type_old"] = company[v]
|
|
if text := util.ObjToString(company["company_type"]); text != "" {
|
|
if text := util.ObjToString(company["company_type"]); text != "" {
|
|
- if strings.Contains(text, "个体") || strings.Contains(text, "非公司") {
|
|
|
|
|
|
+ if strings.Contains(text, "个体") || strings.Contains(text, "非公司") {
|
|
save["company_type"] = "个体工商户"
|
|
save["company_type"] = "个体工商户"
|
|
} else {
|
|
} else {
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
@@ -107,7 +113,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// company_status
|
|
// company_status
|
|
- }else if v == "company_status" {
|
|
|
|
|
|
+ } else if v == "company_status" {
|
|
save["company_status_old"] = company[v]
|
|
save["company_status_old"] = company[v]
|
|
if text := util.ObjToString(company["company_status"]); text != "" {
|
|
if text := util.ObjToString(company["company_status"]); text != "" {
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
@@ -118,7 +124,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
save["company_status"] = "其他"
|
|
save["company_status"] = "其他"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else if v == "capital" {
|
|
|
|
|
|
+ } else if v == "capital" {
|
|
// capital/currency
|
|
// capital/currency
|
|
text := util.ObjToString(company[v])
|
|
text := util.ObjToString(company[v])
|
|
if currency := GetCurrency(text); currency != "" {
|
|
if currency := GetCurrency(text); currency != "" {
|
|
@@ -129,9 +135,9 @@ func IncStd(tmp map[string]interface{}) {
|
|
if capital != 0 {
|
|
if capital != 0 {
|
|
save[v] = capital
|
|
save[v] = capital
|
|
}
|
|
}
|
|
- }else if v == "use_flag" {
|
|
|
|
|
|
+ } else if v == "use_flag" {
|
|
save[v] = util.IntAll(company[v])
|
|
save[v] = util.IntAll(company[v])
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
save[v] = company[v]
|
|
save[v] = company[v]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -152,7 +158,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
code = code[:6]
|
|
code = code[:6]
|
|
}
|
|
}
|
|
if city := AddressMap[code]; city != nil { //未作废中取
|
|
if city := AddressMap[code]; city != nil { //未作废中取
|
|
- if city.Province != "" && city.Province == save["company_area"] {
|
|
|
|
|
|
+ if city.Province != "" && city.Province == util.ObjToString(save["company_area"]) {
|
|
if city.City != "" {
|
|
if city.City != "" {
|
|
save["company_city"] = city.City //市
|
|
save["company_city"] = city.City //市
|
|
}
|
|
}
|
|
@@ -163,7 +169,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
}
|
|
}
|
|
} else { //作废中取
|
|
} else { //作废中取
|
|
if city := AddressOldMap[code]; city != nil {
|
|
if city := AddressOldMap[code]; city != nil {
|
|
- if city.Province != "" && city.Province == save["company_area"] {
|
|
|
|
|
|
+ if city.Province != "" && city.Province == util.ObjToString(save["company_area"]) {
|
|
if city.City != "" {
|
|
if city.City != "" {
|
|
save["company_city"] = city.City //市
|
|
save["company_city"] = city.City //市
|
|
}
|
|
}
|
|
@@ -184,76 +190,191 @@ func IncStd(tmp map[string]interface{}) {
|
|
if tmp["company_history_name"] != nil {
|
|
if tmp["company_history_name"] != nil {
|
|
history_name := util.ObjArrToMapArr(tmp["company_history_name"].([]interface{}))
|
|
history_name := util.ObjArrToMapArr(tmp["company_history_name"].([]interface{}))
|
|
var names []string
|
|
var names []string
|
|
- for _, h := range history_name{
|
|
|
|
|
|
+ for _, h := range history_name {
|
|
names = append(names, util.ObjToString(h["history_name"]))
|
|
names = append(names, util.ObjToString(h["history_name"]))
|
|
}
|
|
}
|
|
- save["history_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ save["history_name"] = strings.Join(names, ",")
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // company_employee、company_partner、annual_report_base涉及存量更新动作
|
|
|
|
+ oldTmp := &map[string]interface{}{}
|
|
|
|
+ if tmp["company_employee"] != nil || tmp["company_partner"] != nil || tmp["annual_report_base"] != nil {
|
|
|
|
+ fields := map[string]interface{}{"employees": 1, "partners": 1, "annual_reports": 1}
|
|
|
|
+ oldTmp, _ = MongoTool.FindOneByField("qyxy_std", map[string]interface{}{"_id": tmp["_id"]}, fields)
|
|
}
|
|
}
|
|
|
|
+
|
|
// company_employee
|
|
// company_employee
|
|
if tmp["company_employee"] != nil {
|
|
if tmp["company_employee"] != nil {
|
|
employees := util.ObjArrToMapArr(tmp["company_employee"].([]interface{}))
|
|
employees := util.ObjArrToMapArr(tmp["company_employee"].([]interface{}))
|
|
var names []string
|
|
var names []string
|
|
var arr []map[string]interface{}
|
|
var arr []map[string]interface{}
|
|
- for _, v := range employees{
|
|
|
|
- tmp := make(map[string]interface{})
|
|
|
|
- tmp["employee_name"] = v["employee_name"]
|
|
|
|
- tmp["position"] = v["position"]
|
|
|
|
- tmp["is_history"] = v["is_history"]
|
|
|
|
- arr = append(arr, tmp)
|
|
|
|
- names = append(names, util.ObjToString(v["employee_name"]))
|
|
|
|
- }
|
|
|
|
- //save["employees"] = arr
|
|
|
|
- push["employees"] = bson.M{"$each": arr}
|
|
|
|
- save["employee_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ if (*oldTmp)["employees"] != nil {
|
|
|
|
+ arr = util.ObjArrToMapArr((*oldTmp)["employees"].([]interface{}))
|
|
|
|
+ } else {
|
|
|
|
+ arr = make([]map[string]interface{}, 0)
|
|
|
|
+ }
|
|
|
|
+ //arr := (*oldTmp)["employees"].([]map[string]interface{})
|
|
|
|
+ for _, v := range employees {
|
|
|
|
+ ep := make(map[string]interface{})
|
|
|
|
+ if util.ObjToString(v["_operation_type"]) == "insert" {
|
|
|
|
+ ep["employee_name"] = v["employee_name"]
|
|
|
|
+ ep["position"] = v["position"]
|
|
|
|
+ ep["is_history"] = v["is_history"]
|
|
|
|
+ ep["_id"] = util.IntAll(v["id"])
|
|
|
|
+ arr = append(arr, ep)
|
|
|
|
+ names = append(names, util.ObjToString(v["employee_name"]))
|
|
|
|
+ } else {
|
|
|
|
+ eq_flag := true
|
|
|
|
+ for _, m := range arr {
|
|
|
|
+ if util.IntAll(v["id"]) == util.IntAll(m["_id"]) {
|
|
|
|
+ eq_flag = false
|
|
|
|
+ m["employee_name"] = v["employee_name"]
|
|
|
|
+ m["position"] = v["position"]
|
|
|
|
+ m["is_history"] = v["is_history"]
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if eq_flag {
|
|
|
|
+ ep := make(map[string]interface{})
|
|
|
|
+ ep["employee_name"] = v["employee_name"]
|
|
|
|
+ ep["position"] = v["position"]
|
|
|
|
+ ep["is_history"] = v["is_history"]
|
|
|
|
+ ep["_id"] = util.IntAll(v["id"])
|
|
|
|
+ arr = append(arr, ep)
|
|
|
|
+ names = append(names, util.ObjToString(v["employee_name"]))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ save["employees"] = arr
|
|
|
|
+ //push["employees"] = bson.M{"$each": arr}
|
|
|
|
+ save["employee_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
// company_partner
|
|
// company_partner
|
|
if tmp["company_partner"] != nil {
|
|
if tmp["company_partner"] != nil {
|
|
partners := util.ObjArrToMapArr(tmp["company_partner"].([]interface{}))
|
|
partners := util.ObjArrToMapArr(tmp["company_partner"].([]interface{}))
|
|
var names []string
|
|
var names []string
|
|
var arr []map[string]interface{}
|
|
var arr []map[string]interface{}
|
|
- tmp["partners"] = partners
|
|
|
|
- for _, v := range partners{
|
|
|
|
- if util.IntAll(tmp["is_history"]) == 0 {
|
|
|
|
- tmp := make(map[string]interface{})
|
|
|
|
- tmp["stock_capital"] = v["stock_capital"]
|
|
|
|
- tmp["stock_name"] = v["stock_name"]
|
|
|
|
- tmp["identify_no"] = v["identify_no"]
|
|
|
|
- tmp["stock_realcapital"] = v["stock_realcapital"]
|
|
|
|
- tmp["is_history"] = v["is_history"]
|
|
|
|
- tmp["is_personal"] = v["is_personal"]
|
|
|
|
- tmp["stock_type"] = v["stock_type"]
|
|
|
|
- tmp["identify_type"] = v["identify_type"]
|
|
|
|
- arr = append(arr, tmp)
|
|
|
|
|
|
+ if (*oldTmp)["partners"] != nil {
|
|
|
|
+ arr = util.ObjArrToMapArr((*oldTmp)["partners"].([]interface{}))
|
|
|
|
+ } else {
|
|
|
|
+ arr = make([]map[string]interface{}, 0)
|
|
|
|
+ }
|
|
|
|
+ for _, v := range partners {
|
|
|
|
+ if util.ObjToString(v["_operation_type"]) == "insert" {
|
|
|
|
+ exp := make(map[string]interface{})
|
|
|
|
+ exp["stock_capital"] = v["stock_capital"]
|
|
|
|
+ exp["stock_name"] = v["stock_name"]
|
|
|
|
+ exp["identify_no"] = v["identify_no"]
|
|
|
|
+ exp["stock_realcapital"] = v["stock_realcapital"]
|
|
|
|
+ exp["is_history"] = v["is_history"]
|
|
|
|
+ exp["is_personal"] = v["is_personal"]
|
|
|
|
+ exp["stock_type"] = v["stock_type"]
|
|
|
|
+ exp["identify_type"] = v["identify_type"]
|
|
|
|
+ exp["_id"] = util.IntAll(v["id"])
|
|
|
|
+ arr = append(arr, exp)
|
|
names = append(names, util.ObjToString(v["stock_name"]))
|
|
names = append(names, util.ObjToString(v["stock_name"]))
|
|
|
|
+ } else {
|
|
|
|
+ eqFlag := true
|
|
|
|
+ for _, m := range arr {
|
|
|
|
+ if util.IntAll(v["id"]) == util.IntAll(m["_id"]) {
|
|
|
|
+ eqFlag = false
|
|
|
|
+ m["stock_capital"] = v["stock_capital"]
|
|
|
|
+ m["stock_name"] = v["stock_name"]
|
|
|
|
+ m["identify_no"] = v["identify_no"]
|
|
|
|
+ m["stock_realcapital"] = v["stock_realcapital"]
|
|
|
|
+ m["is_history"] = v["is_history"]
|
|
|
|
+ m["is_personal"] = v["is_personal"]
|
|
|
|
+ m["stock_type"] = v["stock_type"]
|
|
|
|
+ m["identify_type"] = v["identify_type"]
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if eqFlag {
|
|
|
|
+ exp := make(map[string]interface{})
|
|
|
|
+ exp["stock_capital"] = v["stock_capital"]
|
|
|
|
+ exp["stock_name"] = v["stock_name"]
|
|
|
|
+ exp["identify_no"] = v["identify_no"]
|
|
|
|
+ exp["stock_realcapital"] = v["stock_realcapital"]
|
|
|
|
+ exp["is_history"] = v["is_history"]
|
|
|
|
+ exp["is_personal"] = v["is_personal"]
|
|
|
|
+ exp["stock_type"] = v["stock_type"]
|
|
|
|
+ exp["identify_type"] = v["identify_type"]
|
|
|
|
+ exp["_id"] = util.IntAll(v["id"])
|
|
|
|
+ arr = append(arr, exp)
|
|
|
|
+ names = append(names, util.ObjToString(v["stock_name"]))
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- //save["partners"] = arr
|
|
|
|
- push["partners"] = bson.M{"$each": arr}
|
|
|
|
- save["stock_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ save["partners"] = arr
|
|
|
|
+ //push["partners"] = bson.M{"$each": arr}
|
|
|
|
+ save["stock_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
// annual_report_base
|
|
// annual_report_base
|
|
if tmp["annual_report_base"] != nil {
|
|
if tmp["annual_report_base"] != nil {
|
|
reports := util.ObjArrToMapArr(tmp["annual_report_base"].([]interface{}))
|
|
reports := util.ObjArrToMapArr(tmp["annual_report_base"].([]interface{}))
|
|
var arr []map[string]interface{}
|
|
var arr []map[string]interface{}
|
|
|
|
+ if (*oldTmp)["annual_reports"] != nil {
|
|
|
|
+ arr = util.ObjArrToMapArr((*oldTmp)["annual_reports"].([]interface{}))
|
|
|
|
+ } else {
|
|
|
|
+ arr = make([]map[string]interface{}, 0)
|
|
|
|
+ }
|
|
year := 0
|
|
year := 0
|
|
phone, email := "", ""
|
|
phone, email := "", ""
|
|
- for _, v := range reports{
|
|
|
|
- tmp := make(map[string]interface{})
|
|
|
|
- tmp["operator_name"] = v["operator_name"]
|
|
|
|
- tmp["report_year"] = v["report_year"]
|
|
|
|
- tmp["zip_code"] = v["zip_code"]
|
|
|
|
- tmp["employee_no"] = v["employee_no"]
|
|
|
|
- tmp["company_phone"] = v["company_phone"]
|
|
|
|
- tmp["company_email"] = v["company_email"]
|
|
|
|
- arr = append(arr, tmp)
|
|
|
|
- if year < util.IntAll(v["report_year"]) {
|
|
|
|
- year = util.IntAll(v["report_year"])
|
|
|
|
- phone = util.ObjToString(v["company_phone"])
|
|
|
|
- email = util.ObjToString(v["company_email"])
|
|
|
|
|
|
+ for _, v := range reports {
|
|
|
|
+ if util.ObjToString(v["_operation_type"]) == "insert" {
|
|
|
|
+ exp := make(map[string]interface{})
|
|
|
|
+ exp["operator_name"] = v["operator_name"]
|
|
|
|
+ exp["report_year"] = v["report_year"]
|
|
|
|
+ exp["zip_code"] = v["zip_code"]
|
|
|
|
+ exp["employee_no"] = v["employee_no"]
|
|
|
|
+ exp["company_phone"] = v["company_phone"]
|
|
|
|
+ exp["company_email"] = v["company_email"]
|
|
|
|
+ exp["_id"] = util.IntAll(v["id"])
|
|
|
|
+ arr = append(arr, exp)
|
|
|
|
+ if year < util.IntAll(v["report_year"]) {
|
|
|
|
+ year = util.IntAll(v["report_year"])
|
|
|
|
+ phone = util.ObjToString(v["company_phone"])
|
|
|
|
+ email = util.ObjToString(v["company_email"])
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ eqFlag := true
|
|
|
|
+ for _, m := range arr {
|
|
|
|
+ if util.IntAll(v["id"]) == util.IntAll(m["_id"]) {
|
|
|
|
+ eqFlag = false
|
|
|
|
+ m["operator_name"] = v["operator_name"]
|
|
|
|
+ m["report_year"] = v["report_year"]
|
|
|
|
+ m["zip_code"] = v["zip_code"]
|
|
|
|
+ m["employee_no"] = v["employee_no"]
|
|
|
|
+ m["company_phone"] = v["company_phone"]
|
|
|
|
+ m["company_email"] = v["company_email"]
|
|
|
|
+ break
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if eqFlag {
|
|
|
|
+ exp := make(map[string]interface{})
|
|
|
|
+ exp["stock_capital"] = v["stock_capital"]
|
|
|
|
+ exp["stock_name"] = v["stock_name"]
|
|
|
|
+ exp["identify_no"] = v["identify_no"]
|
|
|
|
+ exp["stock_realcapital"] = v["stock_realcapital"]
|
|
|
|
+ exp["is_history"] = v["is_history"]
|
|
|
|
+ exp["is_personal"] = v["is_personal"]
|
|
|
|
+ exp["stock_type"] = v["stock_type"]
|
|
|
|
+ exp["identify_type"] = v["identify_type"]
|
|
|
|
+ exp["_id"] = util.IntAll(v["id"])
|
|
|
|
+ arr = append(arr, exp)
|
|
|
|
+ if year < util.IntAll(v["report_year"]) {
|
|
|
|
+ year = util.IntAll(v["report_year"])
|
|
|
|
+ phone = util.ObjToString(v["company_phone"])
|
|
|
|
+ email = util.ObjToString(v["company_email"])
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
- //save["annual_reports"] = arr
|
|
|
|
- push["annual_reports"] = bson.M{"$each": arr}
|
|
|
|
|
|
+ save["annual_reports"] = arr
|
|
|
|
+ //push["annual_reports"] = bson.M{"$each": arr}
|
|
if year != 0 {
|
|
if year != 0 {
|
|
save["company_phone"] = phone
|
|
save["company_phone"] = phone
|
|
save["company_email"] = email
|
|
save["company_email"] = email
|
|
@@ -264,14 +385,14 @@ func IncStd(tmp map[string]interface{}) {
|
|
webs := util.ObjArrToMapArr(tmp["annual_report_website"].([]interface{}))
|
|
webs := util.ObjArrToMapArr(tmp["annual_report_website"].([]interface{}))
|
|
year := 0
|
|
year := 0
|
|
web := ""
|
|
web := ""
|
|
- for _, v := range webs{
|
|
|
|
|
|
+ for _, v := range webs {
|
|
if year < util.IntAll(v["report_year"]) && util.IntAll(v["is_history"]) == 0 {
|
|
if year < util.IntAll(v["report_year"]) && util.IntAll(v["is_history"]) == 0 {
|
|
year = util.IntAll(v["report_year"])
|
|
year = util.IntAll(v["report_year"])
|
|
web = util.ObjToString(v["website_url"])
|
|
web = util.ObjToString(v["website_url"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if year != 0 {
|
|
if year != 0 {
|
|
- save["website_url"] = web
|
|
|
|
|
|
+ save["website_url"] = web
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// bid_contracttype
|
|
// bid_contracttype
|
|
@@ -279,7 +400,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
if phone := util.ObjToString(save["company_phone"]); phone != "" {
|
|
if phone := util.ObjToString(save["company_phone"]); phone != "" {
|
|
if len(phone) == 11 {
|
|
if len(phone) == 11 {
|
|
types = append(types, "手机号")
|
|
types = append(types, "手机号")
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
types = append(types, "固定电话")
|
|
types = append(types, "固定电话")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -295,12 +416,12 @@ func IncStd(tmp map[string]interface{}) {
|
|
err1 := json.Unmarshal([]byte(text), &maps)
|
|
err1 := json.Unmarshal([]byte(text), &maps)
|
|
if err1 != nil {
|
|
if err1 != nil {
|
|
util.Debug(companyName, "winner-----map解析异常")
|
|
util.Debug(companyName, "winner-----map解析异常")
|
|
- }else {
|
|
|
|
- for k := range maps{
|
|
|
|
|
|
+ } else {
|
|
|
|
+ for k := range maps {
|
|
if k == "bid_contracttype" {
|
|
if k == "bid_contracttype" {
|
|
t1 := util.ObjArrToStringArr(maps[k].([]interface{}))
|
|
t1 := util.ObjArrToStringArr(maps[k].([]interface{}))
|
|
types = append(types, t1...)
|
|
types = append(types, t1...)
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
save[k] = maps[k]
|
|
save[k] = maps[k]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -312,7 +433,7 @@ func IncStd(tmp map[string]interface{}) {
|
|
save["bid_contracttype"] = types
|
|
save["bid_contracttype"] = types
|
|
// bid_unittype
|
|
// bid_unittype
|
|
flag := false
|
|
flag := false
|
|
- for _, v := range WordsArr{
|
|
|
|
|
|
+ for _, v := range WordsArr {
|
|
if strings.Contains(util.ObjToString(save["business_scope"]), v) {
|
|
if strings.Contains(util.ObjToString(save["business_scope"]), v) {
|
|
flag = true
|
|
flag = true
|
|
break
|
|
break
|
|
@@ -328,12 +449,12 @@ func IncStd(tmp map[string]interface{}) {
|
|
name := util.ObjToString(save["company_name"])
|
|
name := util.ObjToString(save["company_name"])
|
|
if strings.Contains(t1, "有限合伙") {
|
|
if strings.Contains(t1, "有限合伙") {
|
|
save["search_type"] = "有限合伙"
|
|
save["search_type"] = "有限合伙"
|
|
- }else if strings.Contains(t1, "合伙") {
|
|
|
|
|
|
+ } else if strings.Contains(t1, "合伙") {
|
|
save["search_type"] = "普通合伙"
|
|
save["search_type"] = "普通合伙"
|
|
- }else if strings.Contains(name, "股份") ||
|
|
|
|
|
|
+ } else if strings.Contains(name, "股份") ||
|
|
(strings.Contains(t1, "上市") && !strings.Contains(t1, "非上市")) {
|
|
(strings.Contains(t1, "上市") && !strings.Contains(t1, "非上市")) {
|
|
save["search_type"] = "股份有限公司"
|
|
save["search_type"] = "股份有限公司"
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
save["search_type"] = "有限责任公司"
|
|
save["search_type"] = "有限责任公司"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -356,9 +477,9 @@ func IncStd(tmp map[string]interface{}) {
|
|
}
|
|
}
|
|
|
|
|
|
// InfoStd 存量全量数据
|
|
// InfoStd 存量全量数据
|
|
-func InfoStd(tmp map[string]interface{}) {
|
|
|
|
|
|
+func InfoStd(tmp map[string]interface{}) {
|
|
save := make(map[string]interface{})
|
|
save := make(map[string]interface{})
|
|
- for _, v := range company_base{
|
|
|
|
|
|
+ for _, v := range company_base {
|
|
if tmp[v] == nil {
|
|
if tmp[v] == nil {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
@@ -366,7 +487,7 @@ func InfoStd(tmp map[string]interface{}) {
|
|
if v == "company_type" {
|
|
if v == "company_type" {
|
|
save["company_type_old"] = tmp[v]
|
|
save["company_type_old"] = tmp[v]
|
|
if text := util.ObjToString(tmp["company_type"]); text != "" {
|
|
if text := util.ObjToString(tmp["company_type"]); text != "" {
|
|
- if strings.Contains(text, "个体") || strings.Contains(text, "非公司") {
|
|
|
|
|
|
+ if strings.Contains(text, "个体") || strings.Contains(text, "非公司") {
|
|
save["company_type"] = "个体工商户"
|
|
save["company_type"] = "个体工商户"
|
|
} else {
|
|
} else {
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
@@ -378,8 +499,8 @@ func InfoStd(tmp map[string]interface{}) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- // company_status
|
|
|
|
- }else if v == "company_status" {
|
|
|
|
|
|
+ // company_status
|
|
|
|
+ } else if v == "company_status" {
|
|
save["company_status_old"] = tmp[v]
|
|
save["company_status_old"] = tmp[v]
|
|
if text := util.ObjToString(tmp["company_status"]); text != "" {
|
|
if text := util.ObjToString(tmp["company_status"]); text != "" {
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
text = strings.ReplaceAll(text, "(", "(")
|
|
@@ -390,7 +511,7 @@ func InfoStd(tmp map[string]interface{}) {
|
|
save["company_status"] = "其他"
|
|
save["company_status"] = "其他"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }else if v == "capital" {
|
|
|
|
|
|
+ } else if v == "capital" {
|
|
// capital/currency
|
|
// capital/currency
|
|
text := util.ObjToString(tmp[v])
|
|
text := util.ObjToString(tmp[v])
|
|
if currency := GetCurrency(text); currency != "" {
|
|
if currency := GetCurrency(text); currency != "" {
|
|
@@ -401,9 +522,9 @@ func InfoStd(tmp map[string]interface{}) {
|
|
if capital != 0 {
|
|
if capital != 0 {
|
|
save[v] = capital
|
|
save[v] = capital
|
|
}
|
|
}
|
|
- }else if v == "use_flag" {
|
|
|
|
|
|
+ } else if v == "use_flag" {
|
|
save[v] = util.IntAll(tmp[v])
|
|
save[v] = util.IntAll(tmp[v])
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
save[v] = tmp[v]
|
|
save[v] = tmp[v]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -427,7 +548,7 @@ func InfoStd(tmp map[string]interface{}) {
|
|
code = code[:6]
|
|
code = code[:6]
|
|
}
|
|
}
|
|
if city := AddressMap[code]; city != nil { //未作废中取
|
|
if city := AddressMap[code]; city != nil { //未作废中取
|
|
- if city.Province != "" && city.Province == save["company_area"] {
|
|
|
|
|
|
+ if city.Province != "" && strings.Contains(city.Province, util.ObjToString(save["company_area"])) {
|
|
if city.City != "" {
|
|
if city.City != "" {
|
|
save["company_city"] = city.City //市
|
|
save["company_city"] = city.City //市
|
|
}
|
|
}
|
|
@@ -467,7 +588,7 @@ func InfoStd(tmp map[string]interface{}) {
|
|
if phone := util.ObjToString(save["company_phone"]); phone != "" {
|
|
if phone := util.ObjToString(save["company_phone"]); phone != "" {
|
|
if len(phone) == 11 {
|
|
if len(phone) == 11 {
|
|
types = append(types, "手机号")
|
|
types = append(types, "手机号")
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
types = append(types, "固定电话")
|
|
types = append(types, "固定电话")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -483,12 +604,12 @@ func InfoStd(tmp map[string]interface{}) {
|
|
err1 := json.Unmarshal([]byte(text), &maps)
|
|
err1 := json.Unmarshal([]byte(text), &maps)
|
|
if err1 != nil {
|
|
if err1 != nil {
|
|
util.Debug(companyName, "winner-----map解析异常")
|
|
util.Debug(companyName, "winner-----map解析异常")
|
|
- }else {
|
|
|
|
- for k := range maps{
|
|
|
|
|
|
+ } else {
|
|
|
|
+ for k := range maps {
|
|
if k == "bid_contracttype" {
|
|
if k == "bid_contracttype" {
|
|
t1 := util.ObjArrToStringArr(maps[k].([]interface{}))
|
|
t1 := util.ObjArrToStringArr(maps[k].([]interface{}))
|
|
types = append(types, t1...)
|
|
types = append(types, t1...)
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
save[k] = maps[k]
|
|
save[k] = maps[k]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -500,7 +621,7 @@ func InfoStd(tmp map[string]interface{}) {
|
|
save["bid_contracttype"] = types
|
|
save["bid_contracttype"] = types
|
|
// bid_unittype
|
|
// bid_unittype
|
|
flag := false
|
|
flag := false
|
|
- for _, v := range WordsArr{
|
|
|
|
|
|
+ for _, v := range WordsArr {
|
|
if strings.Contains(util.ObjToString(tmp["business_scope"]), v) {
|
|
if strings.Contains(util.ObjToString(tmp["business_scope"]), v) {
|
|
flag = true
|
|
flag = true
|
|
break
|
|
break
|
|
@@ -516,12 +637,12 @@ func InfoStd(tmp map[string]interface{}) {
|
|
name := util.ObjToString(save["company_name"])
|
|
name := util.ObjToString(save["company_name"])
|
|
if strings.Contains(t1, "有限合伙") {
|
|
if strings.Contains(t1, "有限合伙") {
|
|
save["search_type"] = "有限合伙"
|
|
save["search_type"] = "有限合伙"
|
|
- }else if strings.Contains(t1, "合伙") {
|
|
|
|
|
|
+ } else if strings.Contains(t1, "合伙") {
|
|
save["search_type"] = "普通合伙"
|
|
save["search_type"] = "普通合伙"
|
|
- }else if strings.Contains(name, "股份") ||
|
|
|
|
|
|
+ } else if strings.Contains(name, "股份") ||
|
|
(strings.Contains(t1, "上市") && !strings.Contains(t1, "非上市")) {
|
|
(strings.Contains(t1, "上市") && !strings.Contains(t1, "非上市")) {
|
|
save["search_type"] = "股份有限公司"
|
|
save["search_type"] = "股份有限公司"
|
|
- }else {
|
|
|
|
|
|
+ } else {
|
|
save["search_type"] = "有限责任公司"
|
|
save["search_type"] = "有限责任公司"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -546,10 +667,10 @@ func historynamefunMysql(tmp map[string]interface{}) {
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
if len(*info) > 0 {
|
|
if len(*info) > 0 {
|
|
var names []string
|
|
var names []string
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ for _, v := range *info {
|
|
names = append(names, util.ObjToString(v["history_name"]))
|
|
names = append(names, util.ObjToString(v["history_name"]))
|
|
}
|
|
}
|
|
- tmp["history_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ tmp["history_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
func historyNameFun(tmp map[string]interface{}) {
|
|
func historyNameFun(tmp map[string]interface{}) {
|
|
@@ -557,36 +678,36 @@ func historyNameFun(tmp map[string]interface{}) {
|
|
info, b := MongoTool1.Find("company_history_name", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
info, b := MongoTool1.Find("company_history_name", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
if b && len(*info) > 0 {
|
|
if b && len(*info) > 0 {
|
|
var names []string
|
|
var names []string
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ for _, v := range *info {
|
|
names = append(names, util.ObjToString(v["history_name"]))
|
|
names = append(names, util.ObjToString(v["history_name"]))
|
|
}
|
|
}
|
|
- tmp["history_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ tmp["history_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// company_employee 高管
|
|
// company_employee 高管
|
|
-func employeeFunMySql(tmp map[string]interface{}) {
|
|
|
|
|
|
+func employeeFunMySql(tmp map[string]interface{}) {
|
|
query := "SELECT employee_name, position, is_history FROM company_employee WHERE company_id=?"
|
|
query := "SELECT employee_name, position, is_history FROM company_employee WHERE company_id=?"
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
if len(*info) > 0 {
|
|
if len(*info) > 0 {
|
|
var names []string
|
|
var names []string
|
|
- tmp["employees"] = *info
|
|
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ tmp["employees"] = *info
|
|
|
|
+ for _, v := range *info {
|
|
names = append(names, util.ObjToString(v["employee_name"]))
|
|
names = append(names, util.ObjToString(v["employee_name"]))
|
|
}
|
|
}
|
|
- tmp["employee_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ tmp["employee_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-func employeeFun(tmp map[string]interface{}) {
|
|
|
|
|
|
+func employeeFun(tmp map[string]interface{}) {
|
|
field := bson.M{"employee_name": 1, "position": 1, "is_history": 1}
|
|
field := bson.M{"employee_name": 1, "position": 1, "is_history": 1}
|
|
info, b := MongoTool1.Find("company_employee", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
info, b := MongoTool1.Find("company_employee", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
if b && len(*info) > 0 {
|
|
if b && len(*info) > 0 {
|
|
var names []string
|
|
var names []string
|
|
- tmp["employees"] = *info
|
|
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ tmp["employees"] = *info
|
|
|
|
+ for _, v := range *info {
|
|
names = append(names, util.ObjToString(v["employee_name"]))
|
|
names = append(names, util.ObjToString(v["employee_name"]))
|
|
}
|
|
}
|
|
- tmp["employee_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ tmp["employee_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -596,13 +717,13 @@ func partnerFunMySql(tmp map[string]interface{}) {
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
if len(*info) > 0 {
|
|
if len(*info) > 0 {
|
|
var names []string
|
|
var names []string
|
|
- tmp["partners"] = *info
|
|
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ tmp["partners"] = *info
|
|
|
|
+ for _, v := range *info {
|
|
if util.IntAll(tmp["is_history"]) == 0 {
|
|
if util.IntAll(tmp["is_history"]) == 0 {
|
|
names = append(names, util.ObjToString(v["stock_name"]))
|
|
names = append(names, util.ObjToString(v["stock_name"]))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- tmp["stock_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ tmp["stock_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
func partnerFun(tmp map[string]interface{}) {
|
|
func partnerFun(tmp map[string]interface{}) {
|
|
@@ -610,13 +731,13 @@ func partnerFun(tmp map[string]interface{}) {
|
|
info, b := MongoTool1.Find("company_partner", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
info, b := MongoTool1.Find("company_partner", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
if b && len(*info) > 0 {
|
|
if b && len(*info) > 0 {
|
|
var names []string
|
|
var names []string
|
|
- tmp["partners"] = *info
|
|
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ tmp["partners"] = *info
|
|
|
|
+ for _, v := range *info {
|
|
if util.IntAll(tmp["is_history"]) == 0 {
|
|
if util.IntAll(tmp["is_history"]) == 0 {
|
|
names = append(names, util.ObjToString(v["stock_name"]))
|
|
names = append(names, util.ObjToString(v["stock_name"]))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- tmp["stock_name"] = strings.Join(names, ",")
|
|
|
|
|
|
+ tmp["stock_name"] = strings.Join(names, ",")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -625,10 +746,10 @@ func reportFunMysql(tmp map[string]interface{}) {
|
|
query := "SELECT report_year, company_phone, company_email, zip_code, employee_no, operator_name FROM annual_report_base WHERE company_id=?"
|
|
query := "SELECT report_year, company_phone, company_email, zip_code, employee_no, operator_name FROM annual_report_base WHERE company_id=?"
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
info := MysqlTool.SelectBySql(query, util.ObjToString(tmp["_id"]))
|
|
if len(*info) > 0 {
|
|
if len(*info) > 0 {
|
|
- tmp["annual_reports"] = *info
|
|
|
|
|
|
+ tmp["annual_reports"] = *info
|
|
year := 0
|
|
year := 0
|
|
phone, email := "", ""
|
|
phone, email := "", ""
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ for _, v := range *info {
|
|
if year < util.IntAll(v["report_year"]) {
|
|
if year < util.IntAll(v["report_year"]) {
|
|
year = util.IntAll(v["report_year"])
|
|
year = util.IntAll(v["report_year"])
|
|
phone = util.ObjToString(v["company_phone"])
|
|
phone = util.ObjToString(v["company_phone"])
|
|
@@ -645,10 +766,10 @@ func reportFun(tmp map[string]interface{}) {
|
|
field := bson.M{"report_year": 1, "company_phone": 1, "company_email": 1, "zip_code": 1, "employee_no": 1, "operator_name": 1}
|
|
field := bson.M{"report_year": 1, "company_phone": 1, "company_email": 1, "zip_code": 1, "employee_no": 1, "operator_name": 1}
|
|
info, b := MongoTool1.Find("annual_report_base", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
info, b := MongoTool1.Find("annual_report_base", bson.M{"company_id": tmp["_id"]}, nil, field, false, -1, -1)
|
|
if b && len(*info) > 0 {
|
|
if b && len(*info) > 0 {
|
|
- tmp["annual_reports"] = *info
|
|
|
|
|
|
+ tmp["annual_reports"] = *info
|
|
year := 0
|
|
year := 0
|
|
phone, email := "", ""
|
|
phone, email := "", ""
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ for _, v := range *info {
|
|
if year < util.IntAll(v["report_year"]) {
|
|
if year < util.IntAll(v["report_year"]) {
|
|
year = util.IntAll(v["report_year"])
|
|
year = util.IntAll(v["report_year"])
|
|
phone = util.ObjToString(v["company_phone"])
|
|
phone = util.ObjToString(v["company_phone"])
|
|
@@ -669,14 +790,14 @@ func websiteFunMySql(tmp map[string]interface{}) {
|
|
if len(*info) > 0 {
|
|
if len(*info) > 0 {
|
|
year := 0
|
|
year := 0
|
|
web := ""
|
|
web := ""
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ for _, v := range *info {
|
|
if year < util.IntAll(v["report_year"]) && util.IntAll(tmp["is_history"]) == 0 {
|
|
if year < util.IntAll(v["report_year"]) && util.IntAll(tmp["is_history"]) == 0 {
|
|
year = util.IntAll(v["report_year"])
|
|
year = util.IntAll(v["report_year"])
|
|
web = util.ObjToString(v["website_url"])
|
|
web = util.ObjToString(v["website_url"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if year != 0 {
|
|
if year != 0 {
|
|
- tmp["website_url"] = web
|
|
|
|
|
|
+ tmp["website_url"] = web
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -686,14 +807,14 @@ func websiteFun(tmp map[string]interface{}) {
|
|
if b && len(*info) > 0 {
|
|
if b && len(*info) > 0 {
|
|
year := 0
|
|
year := 0
|
|
web := ""
|
|
web := ""
|
|
- for _, v := range *info{
|
|
|
|
|
|
+ for _, v := range *info {
|
|
if year < util.IntAll(v["report_year"]) && util.IntAll(tmp["is_history"]) == 0 {
|
|
if year < util.IntAll(v["report_year"]) && util.IntAll(tmp["is_history"]) == 0 {
|
|
year = util.IntAll(v["report_year"])
|
|
year = util.IntAll(v["report_year"])
|
|
web = util.ObjToString(v["website_url"])
|
|
web = util.ObjToString(v["website_url"])
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if year != 0 {
|
|
if year != 0 {
|
|
- tmp["website_url"] = web
|
|
|
|
|
|
+ tmp["website_url"] = web
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -722,4 +843,58 @@ func getStName(name string) string {
|
|
return name2
|
|
return name2
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+func taskinfo(tmp map[string]interface{}) {
|
|
|
|
+ q := map[string]interface{}{"company_id": tmp["_id"]}
|
|
|
|
+ info, _ := MongoTool1.FindOne("company_base", q)
|
|
|
|
+ if len(*info) > 0 {
|
|
|
|
+ InfoStd(*info)
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
|
|
|
|
+func taskinfo1() {
|
|
|
|
+ //updataMap := make(map[string]interface{})
|
|
|
|
+ //updataMap["company_area"] = "内蒙古"
|
|
|
|
+ //for i, field := range AreaFiled {
|
|
|
|
+ // if tmp[field] == nil {
|
|
|
|
+ // continue
|
|
|
|
+ // }
|
|
|
|
+ // if code := fmt.Sprint(tmp[field]); code != "" {
|
|
|
|
+ // if i == 0 && len(code) >= 8 { //credit_no企业信用代码
|
|
|
|
+ // code = code[2:8]
|
|
|
|
+ // } else if i == 1 && len(code) >= 6 { //company_code注册号
|
|
|
|
+ // code = code[:6]
|
|
|
|
+ // }
|
|
|
|
+ // if city := AddressMap[code]; city != nil {
|
|
|
|
+ // if city.Province != "" && city.Province == util.ObjToString(updataMap["company_area"]) {
|
|
|
|
+ // if city.City != "" {
|
|
|
|
+ // updataMap["company_city"] = city.City //市
|
|
|
|
+ // }
|
|
|
|
+ // if city.District != "" {
|
|
|
|
+ // updataMap["company_district"] = city.District //县
|
|
|
|
+ // }
|
|
|
|
+ // break
|
|
|
|
+ // }
|
|
|
|
+ // } else { //作废中取
|
|
|
|
+ // if city := AddressOldMap[code]; city != nil {
|
|
|
|
+ // if city.Province != "" && city.Province == util.ObjToString(updataMap["company_area"]) {
|
|
|
|
+ // if city.City != "" {
|
|
|
|
+ // updataMap["company_city"] = city.City //市
|
|
|
|
+ // }
|
|
|
|
+ // if city.District != "" {
|
|
|
|
+ // updataMap["company_district"] = city.District //县
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // break
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+ //
|
|
|
|
+ //_, _ = client.Update().Index("qyxy_v2").Type("qyxy").Id(util.ObjToString(tmp["_id"])).
|
|
|
|
+ // Doc(updataMap).Refresh(true).Do()
|
|
|
|
+ //updataInfo := []map[string]interface{}{
|
|
|
|
+ // {"_id": tmp["_id"]},
|
|
|
|
+ // {"$set": updataMap},
|
|
|
|
+ //}
|
|
|
|
+ //updatePool <- updataInfo
|
|
|
|
+}
|