|
@@ -270,6 +270,9 @@ func hookfn(c string, line []byte) {
|
|
|
|
|
|
case "annual_report_website":
|
|
|
dealAnnualReportWebsite(tmp)
|
|
|
+ //处理特使企业信息
|
|
|
+ case "special_enterprise", "special_foundation", "special_gov_unit", "special_hongkong_company", "special_law_office", "special_social_organ", "special_trade_union":
|
|
|
+ dealSpecial(c, tmp)
|
|
|
default:
|
|
|
fmt.Println("CurrentColl =>", c)
|
|
|
|
|
@@ -441,6 +444,194 @@ func dealCompanyBase(data map[string]interface{}) {
|
|
|
|
|
|
}
|
|
|
|
|
|
+// dealSpecial 处理特殊企业数据
|
|
|
+func dealSpecial(coll string, data map[string]interface{}) {
|
|
|
+ update := make(map[string]interface{})
|
|
|
+ save := make(map[string]interface{})
|
|
|
+
|
|
|
+ companyID := util.ObjToString(data["company_id"])
|
|
|
+ if companyID == "" {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range company_base {
|
|
|
+ if data[v] == nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ // company_type 公司类型处理
|
|
|
+ if v == "company_type" {
|
|
|
+ save["company_type_old"] = data[v]
|
|
|
+ if text := util.ObjToString(data["company_type"]); text != "" {
|
|
|
+ if strings.Contains(text, "个体") || strings.Contains(text, "非公司") {
|
|
|
+ save["company_type"] = "个体工商户"
|
|
|
+ } else {
|
|
|
+ text = strings.ReplaceAll(text, "(", "(")
|
|
|
+ text = strings.ReplaceAll(text, ")", ")")
|
|
|
+ if stype := QyStypeMap[text]; stype != "" {
|
|
|
+ save["company_type"] = stype
|
|
|
+ } else {
|
|
|
+ save["company_type"] = "其他"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if v == "company_status" {
|
|
|
+ save["company_status_old"] = data[v]
|
|
|
+ if text := util.ObjToString(data["company_status"]); text != "" {
|
|
|
+ text = strings.ReplaceAll(text, "(", "(")
|
|
|
+ text = strings.ReplaceAll(text, ")", ")")
|
|
|
+ if status := CompanyStatusMap[text]; status != "" {
|
|
|
+ save["company_status"] = status
|
|
|
+ } else {
|
|
|
+ save["company_status"] = "其他"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if v == "capital" {
|
|
|
+ // capital/currency
|
|
|
+ text := util.ObjToString(data[v])
|
|
|
+ if currency := GetCurrency(text); currency != "" {
|
|
|
+ save["currency"] = currency //币种
|
|
|
+ }
|
|
|
+ capital := ObjToMoney(text)
|
|
|
+ capital = capital / 10000
|
|
|
+ if capital != 0 {
|
|
|
+ save[v] = capital
|
|
|
+ }
|
|
|
+ } else if v == "use_flag" {
|
|
|
+ save[v] = util.IntAll(data[v])
|
|
|
+ } else {
|
|
|
+ save[v] = data[v]
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // mysql create_time/update_time
|
|
|
+ save["create_time_msql"] = data["create_time"]
|
|
|
+ save["update_time_msql"] = data["update_time"]
|
|
|
+ save["_id"] = data["company_id"]
|
|
|
+ save["createtime"] = time.Now().Unix()
|
|
|
+ save["updatetime"] = time.Now().Unix()
|
|
|
+
|
|
|
+ // company_area/company_city/company_district
|
|
|
+ pshort := util.ObjToString(data["province_short"])
|
|
|
+ save["company_area"] = province_map[pshort]
|
|
|
+
|
|
|
+ //company_city,company_district
|
|
|
+ for i, field := range AreaFiled {
|
|
|
+ if data[field] == nil {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if code := fmt.Sprint(data[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(save["company_area"]) {
|
|
|
+ if city.City != "" {
|
|
|
+ save["company_city"] = city.City //市
|
|
|
+ }
|
|
|
+ if city.District != "" {
|
|
|
+ save["company_district"] = city.District //县
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ } else { //作废中取
|
|
|
+ if city := AddressOldMap[code]; city != nil {
|
|
|
+ if city.Province != "" && city.Province == util.ObjToString(save["company_area"]) {
|
|
|
+ if city.City != "" {
|
|
|
+ save["company_city"] = city.City //市
|
|
|
+ }
|
|
|
+ if city.District != "" {
|
|
|
+ save["company_district"] = city.District //县
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // search_type
|
|
|
+ if t := util.ObjToString(save["company_type"]); t != "" {
|
|
|
+ if t != "个体工商户" && t != "其他" {
|
|
|
+ t1 := util.ObjToString(save["company_type_old"])
|
|
|
+ name := util.ObjToString(save["company_name"])
|
|
|
+ if strings.Contains(t1, "有限合伙") {
|
|
|
+ save["search_type"] = "有限合伙"
|
|
|
+ } else if strings.Contains(t1, "合伙") {
|
|
|
+ save["search_type"] = "普通合伙"
|
|
|
+ } else if strings.Contains(name, "股份") ||
|
|
|
+ (strings.Contains(t1, "上市") && !strings.Contains(t1, "非上市")) {
|
|
|
+ save["search_type"] = "股份有限公司"
|
|
|
+ } else {
|
|
|
+ save["search_type"] = "有限责任公司"
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // company_shortname
|
|
|
+ if m := getStName(util.ObjToString(save["company_name"])); m != "" {
|
|
|
+ save["company_shortname"] = m
|
|
|
+ }
|
|
|
+
|
|
|
+ // bid_unittype
|
|
|
+ flag := false
|
|
|
+ for _, v := range WordsArr {
|
|
|
+ if strings.Contains(util.ObjToString(save["business_scope"]), v) {
|
|
|
+ flag = true
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if flag {
|
|
|
+ if save["bid_unittype"] != nil {
|
|
|
+ save["bid_unittype"] = append(util.ObjArrToStringArr(save["bid_unittype"].([]interface{})), "厂商")
|
|
|
+ } else {
|
|
|
+ save["bid_unittype"] = []string{"厂商"}
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ oldInfo, _ := MongoTool.FindOne(GF.Env.Dbsave, map[string]interface{}{"_id": companyID})
|
|
|
+ if len(*oldInfo) > 0 && util.Int64All((*oldInfo)["autoid"]) > 0 {
|
|
|
+ save["autoid"] = (*oldInfo)["autoid"]
|
|
|
+ } else {
|
|
|
+ id := util.Int64All(data["id"])
|
|
|
+ /**
|
|
|
+ special_enterprise,起始ID 从2000000000 开始+data["id"]
|
|
|
+ special_foundation,起始ID 从3000000000 开始+data["id"]
|
|
|
+ special_gov_unit,起始ID 从4000000000 开始+data["id"]
|
|
|
+ special_hongkong_company,起始ID 从5000000000 开始+data["id"]
|
|
|
+ special_law_office,起始ID 从6000000000 开始+data["id"]
|
|
|
+ special_social_organ,起始ID 从7000000000 开始+data["id"]
|
|
|
+ special_trade_union,起始ID 从8000000000 开始+data["id"]
|
|
|
+ */
|
|
|
+ startID := 0
|
|
|
+ if coll == "special_enterprise" {
|
|
|
+ startID = 2000000000
|
|
|
+ } else if coll == "special_foundation" {
|
|
|
+ startID = 3000000000
|
|
|
+ } else if coll == "special_gov_unit" {
|
|
|
+ startID = 4000000000
|
|
|
+ } else if coll == "special_hongkong_company" {
|
|
|
+ startID = 5000000000
|
|
|
+ } else if coll == "special_law_office" {
|
|
|
+ startID = 6000000000
|
|
|
+ } else if coll == "special_social_organ" {
|
|
|
+ startID = 7000000000
|
|
|
+ } else if coll == "special_trade_union" {
|
|
|
+ startID = 8000000000
|
|
|
+ }
|
|
|
+ autoid := startID + int(id)
|
|
|
+ save["autoid"] = autoid
|
|
|
+ }
|
|
|
+
|
|
|
+ update["$set"] = save
|
|
|
+ updataInfo := []map[string]interface{}{
|
|
|
+ {"_id": save["_id"]},
|
|
|
+ update,
|
|
|
+ }
|
|
|
+ MongoTool.UpSertBulk(GF.Env.Dbsave, updataInfo)
|
|
|
+}
|
|
|
+
|
|
|
// dealCompanyEmployee company_employee
|
|
|
func dealCompanyEmployee(data map[string]interface{}) {
|
|
|
save := make(map[string]interface{})
|