123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270 |
- package main
- import (
- "log"
- "regexp"
- "strings"
- )
- // getProject 根据标讯ID获取项目信息
- func getProject(id string) map[string]interface{} {
- where := map[string]interface{}{
- "ids": id,
- }
- p, _ := MgoP.FindOne("projectset_20230904", where)
- project := *p
- return project
- }
- // getCodeByCompanyType 根据企业类型,返回经营主体代码
- func getCodeByCompanyType(cleanText string, codeMap map[string]string) (code string) {
- if code == "" {
- //一人有限责任公司
- if strings.Contains(cleanText, "一人有限责任公司分公司") {
- cleanText = "一人有限责任公司分公司"
- } else if strings.Contains(cleanText, "一人有限责任公司") {
- cleanText = "一人有限责任公司"
- } else if cleanText == "有限责任(公司)" {
- cleanText = "有限责任公司"
- } else if cleanText == "上市股份有限公司分公司" {
- cleanText = "股份有限公司分公司(上市)"
- } else if cleanText == "上市股份有限公司分公司(非上市)" {
- cleanText = "股份有限公司分公司(非上市)"
- } else if !strings.Contains(cleanText, "非个人") && !strings.Contains(cleanText, "非个体") {
- if strings.Contains(cleanText, "个人") || strings.Contains(cleanText, "个体") || strings.Contains(cleanText, "户体商工个") {
- cleanText = "个体工商户"
- }
- } else if strings.Contains(cleanText, "中外合作") { // 中外合作企业 - 有限责任公司(中外合作)
- if strings.Contains(cleanText, "非公司外商投资企业(中外合作)") {
- cleanText = "非公司外商投资企业(中外合作)"
- } else {
- cleanText = "有限责任公司(中外合作)"
- }
- } else if strings.Contains(cleanText, "有限责任公司(中外合资)") { //有限责任公司(中外合资)
- cleanText = "有限责任公司(中外合资)"
- } else if strings.Contains(cleanText, "外商投资企业分支机构") { //非公司外商投资企业分支机构;外商投资企业分支机构
- if strings.Contains(cleanText, "非公司") {
- cleanText = "非公司外商投资企业分支机构"
- } else {
- cleanText = "外商投资企业分支机构"
- }
- } else if strings.Contains(cleanText, "其他") {
- //有限责任公司(港、澳、台)
- if strings.Contains(cleanText, "港、澳、台") {
- if strings.Contains(cleanText, "有限责任公司") {
- cleanText = "有限责任公司(港、澳、台)"
- } else if strings.Contains(cleanText, "非公司") {
- code = "6300"
- cleanText = "非公司"
- }
- }
- } else if strings.Contains(cleanText, "有限责任公司(台港澳与境内合作)") {
- cleanText = "有限责任公司(台港澳与境内合作)"
- } else if strings.Contains(cleanText, "有限责任公司(台港澳与境内合资)") {
- cleanText = "有限责任公司(台港澳与境内合资)"
- } else if strings.Contains(cleanText, "有限责任公司(台港澳与外国投资者合资)") {
- cleanText = "有限责任公司(台港澳与外国投资者合资)"
- } else if strings.Contains(cleanText, "有限责任公司(台港澳合资)") || (strings.Contains(cleanText, "台、港、澳资") && strings.Contains(cleanText, "有限责任公司")) {
- cleanText = "有限责任公司(台港澳合资)"
- } else if strings.Contains(cleanText, "有限责任公司(台港澳法人独资)") {
- cleanText = "有限责任公司(港澳台法人独资)"
- } else if strings.Contains(cleanText, "有限责任公司(台港澳自然人独资)") {
- cleanText = "有限责任公司(港澳台自然人独资)"
- } else if strings.Contains(cleanText, "有限责任公司(外商合资)") {
- cleanText = "有限责任公司(外商合资)"
- } else if strings.Contains(cleanText, "有限责任公司(外商投资") {
- cleanText = "有限责任公司(外商投资、非独资)"
- } else if strings.Contains(cleanText, "有限责任公司(外国法人独资)") {
- cleanText = "有限责任公司(外国法人独资)"
- } else if strings.Contains(cleanText, "外国非法人经济组织独资") {
- cleanText = "外国非法人经济组织独资"
- } else if strings.Contains(cleanText, "有限责任公司(外国自然人独资)") || strings.Contains(cleanText, "有限责任公司(外自然人独资)") {
- cleanText = "有限责任公司(外国自然人独资)"
- } else if strings.Contains(cleanText, "有限责任公司(法人独资)(外商投资企业投资)") {
- cleanText = "有限责任公司分公司(外商投资企业法人独资)"
- } else if strings.Contains(cleanText, "有限责任公司(港、澳、台)") || strings.Contains(cleanText, "有限责任公司(港澳台合资)") {
- cleanText = "有限责任公司(台港澳合资)"
- } else if strings.Contains(cleanText, "有限责任公司") || strings.Contains(cleanText, "港澳台与境内合作") {
- cleanText = "有限责任公司(台港澳与境内合作)"
- } else if strings.Contains(cleanText, "港澳台与境内合资") && strings.Contains(cleanText, "有限责任公司") {
- cleanText = "有限责任公司(台港澳与境内合资)"
- } else
- // 这个需要和贾老师确认
- if strings.Contains(cleanText, "有限责任公司(法人独资") && strings.Contains(cleanText, "私营") {
- cleanText = "有限责任公司(非自然人投资或控股的法人独资)"
- } else if strings.Contains(cleanText, "港澳台与外国投资者合资") && strings.Contains(cleanText, "有限责任公司") {
- cleanText = "有限责任公司(台港澳与外国投资者合资)"
- } else if strings.Contains(cleanText, "港澳台法人独资") && strings.Contains(cleanText, "有限责任公司") {
- cleanText = "有限责任公司(港澳台法人独资)"
- } else if strings.Contains(cleanText, "港澳台自然人独资") && strings.Contains(cleanText, "有限责任公司") {
- cleanText = "有限责任公司(港澳台自然人独资)"
- } else if strings.Contains(cleanText, "有限责任公司(港澳台非法人经济组织独资)") {
- cleanText = "有限责任公司(台港澳非法人经济组织独资)"
- } else if strings.Contains(cleanText, "港澳台投资、非独资") && strings.Contains(cleanText, "有限责任公司") {
- cleanText = "有限责任公司(港澳台投资、非独资)"
- } else if strings.Contains(cleanText, "港澳台合资") && strings.Contains(cleanText, "未上市") {
- if strings.Contains(cleanText, "股份有限公司") {
- code = "6230"
- }
- } else if strings.Contains(cleanText, "集体所有制") {
- cleanText = "集体所有制"
- } else if strings.Contains(cleanText, "国有独资") {
- if strings.Contains(cleanText, "有限责公司分公司") {
- cleanText = "有限责任公司分公司(国有独资)"
- } else if strings.Contains(cleanText, "有限责公司") {
- cleanText = "有限责任公司(国有独资)"
- }
- } else
- //台、港、澳
- if strings.Contains(cleanText, "台、港、澳") {
- if strings.Contains(cleanText, "台、港、澳分公司") || strings.Contains(cleanText, "台、港、澳投资企业分公司") || strings.Contains(cleanText, "台、港、澳投资公司分公司") {
- code = "6810"
- }
- if strings.Contains(cleanText, "台、港、澳办事处") {
- code = "6830"
- }
- if strings.Contains(cleanText, "台、港、澳投资企业") {
- code = "6000"
- }
- if strings.Contains(cleanText, "台、港、澳投资企业其他") {
- code = "6190"
- }
- } else if cleanText == "股份有限公司分支机构(台港澳与境内合资)" {
- code = "6220"
- } else if strings.Contains(cleanText, "台港澳投资企业办事处") {
- code = "6830"
- } else if strings.Contains(cleanText, "台港澳投资有限合伙企业") {
- code = "6400"
- } else if strings.Contains(cleanText, "台港澳投资普通合伙企业分支机构") {
- code = "6840"
- } else if strings.Contains(cleanText, "台港澳投资特殊普通合伙企业分支机构") {
- code = "6420"
- } else if strings.Contains(cleanText, "台港澳股份有限公司") {
- code = "6200"
- } else if strings.Contains(cleanText, "台港澳非公司") {
- code = "6300"
- } else if cleanText == "国外投资" {
- code = "5000"
- } else if strings.Contains(cleanText, "国有事业单位营业") {
- cleanText = "国有事业单位营业"
- } else if strings.Contains(cleanText, "国有控股") {
- if strings.Contains(cleanText, "非上市") {
- if strings.Contains(cleanText, "股份有限公司分公司") {
- code = "1223"
- }
- } else if strings.Contains(cleanText, "上市") {
- if strings.Contains(cleanText, "股份有限公司分公司") {
- code = "2213"
- cleanText = "股份有限公司分公司(上市、国有控股)"
- }
- } else if strings.Contains(cleanText, "股份有限公司分公司") {
- code = "2223"
- } else if strings.Contains(cleanText, "有限责任公司分公司") {
- code = "2140"
- } else if strings.Contains(cleanText, "有限责任公司") {
- code = "1140"
- }
- } else if strings.Contains(cleanText, "国有") {
- if strings.Contains(cleanText, "经营单位") && strings.Contains(cleanText, "非法人") {
- code = "4410"
- cleanText = "国有经营单位(非法人)"
- } else if strings.Contains(cleanText, "国有联营") {
- code = "4600"
- }
- } else
- //合伙企业
- if strings.Contains(cleanText, "合伙企业") {
- if strings.Contains(cleanText, "特殊普通合伙") {
- code = "4532"
- } else if strings.Contains(cleanText, "普通合伙") {
- code = "4530"
- } else if strings.Contains(cleanText, "有限合伙") {
- code = "4533"
- } else if strings.Contains(cleanText, "合伙企业分支机构") {
- code = "4550"
- }
- } else if strings.Contains(cleanText, "合伙私营企业") {
- code = "4530"
- } else if cleanText == "内资企业法人联营" {
- cleanText = "联营"
- } else
- //农民专业合作社分支机构
- if strings.Contains(cleanText, "合作社") {
- if strings.Contains(cleanText, "农民专业合作社分支机构") {
- cleanText = "农民专业合作社分支机构"
- } else if strings.Contains(cleanText, "农民专业合作社") {
- cleanText = "农民专业合作社"
- } else if strings.Contains(cleanText, "合作社分支机构") {
- cleanText = "农民专业合作社分支机构"
- } else {
- cleanText = "农民专业合作社"
- }
- } else if strings.Contains(cleanText, "非公司") {
- if strings.Contains(cleanText, "港、澳、台投资企业分支机构") {
- cleanText = "非公司台、港、澳投资企业分支机构"
- code = "6820"
- } else if strings.Contains(cleanText, "港、澳、台企业(港澳台合资)") {
- cleanText = "非公司台、港、澳企业(台港澳与境内合作)"
- code = "6310"
- } else if strings.Contains(cleanText, "非公司外商投资企业") && strings.Contains(cleanText, "其他") {
- code = "5390"
- }
- } else if strings.Contains(cleanText, "股份有限公司(上市公司)") {
- cleanText = "股份有限公司(上市)"
- code = "1210"
- } else if strings.Contains(cleanText, "股份有限公司(中外合资、上市)") {
- cleanText = "股份有限公司(中外合资、上市)"
- code = "5220"
- } else if strings.Contains(cleanText, "股份有限公司(中外合资、未上市)") || strings.Contains(cleanText, "股份有限公司(中外合资,未上市)") {
- cleanText = "股份有限公司(中外合资、未上市)"
- code = "5210"
- } else if cleanText == "股份有限公司(其他)" {
- code = "5290"
- } else if strings.Contains(cleanText, "股份有限公司(其他台港澳股份有限公司)") {
- code = "6290"
- } else if cleanText == "股份有限公司(台、港、澳资)" {
- code = "6270"
- } else if strings.Contains(cleanText, "股份有限公司(台港澳与境内合资、上市)") || strings.Contains(cleanText, "股份有限公司(台港澳与境内合资,上市)") {
- cleanText = "股份有限公司(台港澳与境内合资、上市)"
- code = "6220"
- } else if strings.Contains(cleanText, "股份有限公司(台港澳与境内合资、未上市)") {
- cleanText = "股份有限公司(台港澳与境内合资、未上市)"
- code = "6210"
- } else if strings.Contains(cleanText, "股份有限公司(台港澳与外国投资者合资、未上市)") {
- cleanText = "股份有限公司(台港澳与外国投资者合资、未上市)"
- code = "6250"
- } else if strings.Contains(cleanText, "股份有限公司(台港澳合资、上市)") {
- cleanText = "股份有限公司(台港澳合资、上市)"
- code = "6240"
- } else if strings.Contains(cleanText, "股份有限公司(台港澳合资、未上市)") {
- cleanText = "股份有限公司(台港澳合资、未上市)"
- code = "6230"
- } else if cleanText == "股份有限公司(港、澳、台)" {
- code = "6200"
- } else {
- }
- // 判断是不是日期(如 2008/10/31)
- if matched, _ := regexp.MatchString(`^\d{4}/\d{1,2}/\d{1,2}$`, cleanText); matched {
- log.Printf("跳过日期行: %s", cleanText)
- return
- }
- // 如果包含“年”/“月”/“日”等,也跳过(不提取数字)
- if strings.Contains(cleanText, "年") || strings.Contains(cleanText, "月") || strings.Contains(cleanText, "日") {
- log.Printf("跳过含日期描述的行: %s", cleanText)
- return
- }
- cleanText = strings.TrimSpace(cleanText)
- cleanText = strings.ReplaceAll(cleanText, "(", "(")
- cleanText = strings.ReplaceAll(cleanText, ")", ")")
- if code == "" {
- if c, ok := codeMap[cleanText]; ok {
- code = c
- }
- }
- }
- return code
- }
|