|
@@ -0,0 +1,891 @@
|
|
|
|
+package main
|
|
|
|
+
|
|
|
|
+import (
|
|
|
|
+ "fmt"
|
|
|
|
+ "gorm.io/driver/mysql"
|
|
|
|
+ "gorm.io/gorm"
|
|
|
|
+ util "jygit.jydev.jianyu360.cn/data_processing/common_utils"
|
|
|
|
+ "jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
|
|
|
|
+ "log"
|
|
|
|
+ "sort"
|
|
|
|
+ "strings"
|
|
|
|
+ "sync"
|
|
|
|
+ "unicode/utf8"
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+type CodeIndCode struct {
|
|
|
|
+ CODE string `gorm:"column:CODE;type:varchar(6);not null"`
|
|
|
|
+ NAME string `gorm:"column:NAME;type:varchar(200);not null"`
|
|
|
|
+ KINDSIGN string `gorm:"column:KINDSIGN;type:char(1);not null"`
|
|
|
|
+ MAXKINDSIGN string `gorm:"column:MAXKINDSIGN;type:char(1);not null"`
|
|
|
|
+ MIDKINDSIGN string `gorm:"column:MIDKINDSIGN;type:char(1);not null"`
|
|
|
|
+ MINKINDSIGN string `gorm:"column:MINKINDSIGN;type:char(1);not null"`
|
|
|
|
+ PARIND string `gorm:"column:PARIND;type:varchar(6);default:null"`
|
|
|
|
+ CHOSIGN string `gorm:"column:CHOSIGN;type:char(1);not null"`
|
|
|
|
+ RISKTYPECODE string `gorm:"column:RISKTYPECODE;type:varchar(20);default:null"`
|
|
|
|
+ ENTTYPES string `gorm:"column:ENTTYPES;type:varchar(100);default:null"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+type CodeINDUSTRYFEAT struct {
|
|
|
|
+ ID int64 `gorm:"column:ID;type:bigint(20);not null"`
|
|
|
|
+ HYCODE string `gorm:"column:HYCODE;type:varchar(6);not null"`
|
|
|
|
+ HYPECUL string `gorm:"column:HYPECUL;type:varchar(100);not null"`
|
|
|
|
+ BUSITYPE string `gorm:"column:BUSITYPE;type:varchar(100);default:null"`
|
|
|
|
+ ENTTYPE string `gorm:"column:ENTTYPE;type:varchar(200);default:null"`
|
|
|
|
+ ENTTYPEGROUP string `gorm:"column:ENTTYPEGROUP;type:varchar(200);default:null"`
|
|
|
|
+ FROMTYPE string `gorm:"column:FROMTYPE;type:char(1);default:null"`
|
|
|
|
+ ENTMATTERCODES string `gorm:"column:ENTMATTERCODES;type:varchar(3000);default:null"`
|
|
|
|
+ ISRECOMM string `gorm:"column:ISRECOMM;type:char(1);default:null"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// CodeBUSITERMCODE 经营范围行业
|
|
|
|
+type CodeBUSITERMCODE struct {
|
|
|
|
+ CODE string `gorm:"column:CODE;not null"`
|
|
|
|
+ NAME string `gorm:"column:NAME"`
|
|
|
|
+ PARENTCODE string `gorm:"column:PARENTCODE"`
|
|
|
|
+ COMMONSIGN string `gorm:"column:COMMONSIGN"`
|
|
|
|
+ POSITIONSIGN string `gorm:"column:POSITIONSIGN"`
|
|
|
|
+ CHOSIGN string `gorm:"column:CHOSIGN"`
|
|
|
|
+ BIZTYPE string `gorm:"column:BIZTYPE"`
|
|
|
|
+ POSITIONNAME string `gorm:"column:POSITIONNAME"`
|
|
|
|
+ TIPS string `gorm:"column:TIPS"`
|
|
|
|
+ INDUSTYPECODE string `gorm:"column:INDUSTYPECODE"`
|
|
|
|
+ OTHERTYPE string `gorm:"column:OTHERTYPE"`
|
|
|
|
+ RESON string `gorm:"column:RESON"`
|
|
|
|
+ INDUSTYPENAME string `gorm:"column:INDUSTYPENAME"`
|
|
|
|
+ FLAG string `gorm:"column:FLAG"`
|
|
|
|
+ ENTTYPE string `gorm:"column:ENTTYPE"`
|
|
|
|
+ ENTPROPERTY string `gorm:"column:ENTPROPERTY"`
|
|
|
|
+ ISBLONGINDUSTRIAL string `gorm:"column:ISBLONGINDUSTRIAL"`
|
|
|
|
+ MATTERSCODE string `gorm:"column:MATTERSCODE"`
|
|
|
|
+ MATTERSNAME string `gorm:"column:MATTERSNAME"`
|
|
|
|
+ LAWREGULATION string `gorm:"column:LAWREGULATION"`
|
|
|
|
+ CATEGORY string `gorm:"column:CATEGORY"`
|
|
|
|
+ HEADING string `gorm:"column:HEADING"`
|
|
|
|
+ MATTERSTYPE string `gorm:"column:MATTERSTYPE"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+var (
|
|
|
|
+ industryFeats []CodeINDUSTRYFEAT
|
|
|
|
+ businessScope []CodeBUSITERMCODE
|
|
|
|
+ indCodes []CodeIndCode
|
|
|
|
+ // 将 CODE_IndCode 表数据加载到内存中的 map
|
|
|
|
+ indCodeMap = make(map[string]CodeIndCode)
|
|
|
|
+)
|
|
|
|
+
|
|
|
|
+// companyNameLabel 根据公司名称,给企业打标记,利用拓扑标签
|
|
|
|
+func companyNameLabel() {
|
|
|
|
+ //username := "datascbi"
|
|
|
|
+ //password := "Da#Bi20221111SC"
|
|
|
|
+ //host := "127.0.0.1:4001"
|
|
|
|
+ ////host := "172.17.162.25:4000"
|
|
|
|
+
|
|
|
|
+ //测试环境tidb
|
|
|
|
+ username := "root"
|
|
|
|
+ password := "=PDT49#80Z!RVv52_z"
|
|
|
|
+ host := "192.168.3.14:4000"
|
|
|
|
+ database := "wcc"
|
|
|
|
+ dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", username, password, host, database)
|
|
|
|
+ // 连接到数据库
|
|
|
|
+ db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("Failed to connect to database:", err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ db.Table("CODE_INDUSTRYFEAT").Find(&industryFeats)
|
|
|
|
+
|
|
|
|
+ db.Table("CODE_IndCode").Find(&indCodes)
|
|
|
|
+
|
|
|
|
+ for _, indCode := range indCodes {
|
|
|
|
+ indCodeMap[indCode.CODE] = indCode
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //开始调用
|
|
|
|
+ MgoB := &mongodb.MongodbSim{
|
|
|
|
+ //MongodbAddr: "172.17.189.140:27080",
|
|
|
|
+ MongodbAddr: "127.0.0.1:27083",
|
|
|
|
+ DbName: "qfw",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
|
+ Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoB.InitPool()
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ sess := MgoB.GetMgoConn()
|
|
|
|
+ defer MgoB.DestoryMongoConn(sess)
|
|
|
|
+
|
|
|
|
+ it := sess.DB("qfw").C("ent_info_buyer_912").Find(nil).Select(nil).Sort("_id").Iter()
|
|
|
|
+ fmt.Println("taskRun 开始")
|
|
|
|
+ count := 0
|
|
|
|
+
|
|
|
|
+ ch := make(chan bool, 10)
|
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
|
+
|
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
|
+ name := util.ObjToString(tmp["name"])
|
|
|
|
+ if count%1000 == 0 {
|
|
|
|
+ log.Println(count, "----", name)
|
|
|
|
+ }
|
|
|
|
+ ch <- true
|
|
|
|
+ wg.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-ch
|
|
|
|
+ wg.Done()
|
|
|
|
+ }()
|
|
|
|
+ //
|
|
|
|
+ res := GetIndustryNames(name)
|
|
|
|
+ res = removeDuplicates(res)
|
|
|
|
+ id := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
|
+ if len(res) > 0 {
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ //"top_labels": res,
|
|
|
|
+ "top_labels_name": res,
|
|
|
|
+ }
|
|
|
|
+ if len(res) == 1 {
|
|
|
|
+ update["credibility"] = 5
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+ }(tmp)
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
|
+ }
|
|
|
|
+ wg.Wait()
|
|
|
|
+ log.Println("企业名称匹配结束")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetIndustryNames2 根据企业名称关键词 获取对应行业标签
|
|
|
|
+func GetIndustryNames2(companyName string) []string {
|
|
|
|
+ var hycodes []CodeINDUSTRYFEAT
|
|
|
|
+ for _, feat := range industryFeats {
|
|
|
|
+ if strings.Contains(companyName, feat.HYPECUL) {
|
|
|
|
+ hycodes = append(hycodes, feat)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var industryNames []string
|
|
|
|
+ if len(hycodes) > 0 {
|
|
|
|
+ for _, hycode := range hycodes {
|
|
|
|
+ indCode, ok := indCodeMap[hycode.HYCODE]
|
|
|
|
+ if ok {
|
|
|
|
+ var path []string
|
|
|
|
+ path = append(path, hycode.HYPECUL)
|
|
|
|
+ path = append(path, indCode.NAME)
|
|
|
|
+ for indCode.PARIND != "" {
|
|
|
|
+ indCode = indCodeMap[indCode.PARIND]
|
|
|
|
+ path = append(path, indCode.NAME)
|
|
|
|
+ }
|
|
|
|
+ // 反转路径
|
|
|
|
+ for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
|
|
|
+ path[i], path[j] = path[j], path[i]
|
|
|
|
+ }
|
|
|
|
+ industryNames = append(industryNames, strings.Join(path, "-"))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return industryNames
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetIndustryNames 根据企业名称关键词 获取对应行业标签
|
|
|
|
+func GetIndustryNames(companyName string) []string {
|
|
|
|
+ var hycodes []CodeINDUSTRYFEAT
|
|
|
|
+ for _, feat := range industryFeats {
|
|
|
|
+ if strings.Contains(companyName, feat.HYPECUL) {
|
|
|
|
+ hycodes = append(hycodes, feat)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 按 HYPECUL 长度降序排序
|
|
|
|
+ sort.Slice(hycodes, func(i, j int) bool {
|
|
|
|
+ return len(hycodes[i].HYPECUL) > len(hycodes[j].HYPECUL)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ longestLength := 0
|
|
|
|
+ if len(hycodes) > 0 {
|
|
|
|
+ longestLength = len(hycodes[0].HYPECUL)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var longestHycodes []CodeINDUSTRYFEAT
|
|
|
|
+ for _, hycode := range hycodes {
|
|
|
|
+ if len(hycode.HYPECUL) == longestLength {
|
|
|
|
+ longestHycodes = append(longestHycodes, hycode)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var industryNames []string
|
|
|
|
+ if len(longestHycodes) > 0 {
|
|
|
|
+ //// 选择第一个最长的
|
|
|
|
+ //selectedHycode := longestHycodes[0]
|
|
|
|
+ for _, selectedHycode := range longestHycodes {
|
|
|
|
+ indCode, ok := indCodeMap[selectedHycode.HYCODE]
|
|
|
|
+ if ok {
|
|
|
|
+ var path []string
|
|
|
|
+ path = append(path, selectedHycode.HYPECUL) //匹配上的关键词
|
|
|
|
+ path = append(path, indCode.NAME) // 标记分类名称;
|
|
|
|
+ for indCode.PARIND != "" {
|
|
|
|
+ indCode = indCodeMap[indCode.PARIND]
|
|
|
|
+ path = append(path, indCode.NAME)
|
|
|
|
+ }
|
|
|
|
+ // 反转路径
|
|
|
|
+ for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
|
|
|
+ path[i], path[j] = path[j], path[i]
|
|
|
|
+ }
|
|
|
|
+ industryNames = append(industryNames, strings.Join(path, "-"))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return industryNames
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+------------------------------------------------------------------
|
|
|
|
+*/
|
|
|
|
+// businessScopeLabel 经营范围标签
|
|
|
|
+func businessScopeLabel() {
|
|
|
|
+ //测试环境tidb
|
|
|
|
+ username := "root"
|
|
|
|
+ password := "=PDT49#80Z!RVv52_z"
|
|
|
|
+ host := "192.168.3.14:4000"
|
|
|
|
+ database := "wcc"
|
|
|
|
+ dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", username, password, host, database)
|
|
|
|
+ // 连接到数据库
|
|
|
|
+ db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
|
|
|
+ if err != nil {
|
|
|
|
+ log.Println("Failed to connect to database:", err)
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ db.Table("CODE_BUSITERMCODE").Find(&businessScope)
|
|
|
|
+ db.Table("CODE_IndCode").Find(&indCodes)
|
|
|
|
+
|
|
|
|
+ for _, indCode := range indCodes {
|
|
|
|
+ indCodeMap[indCode.CODE] = indCode
|
|
|
|
+ }
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
+ //开始调用
|
|
|
|
+ MgoB := &mongodb.MongodbSim{
|
|
|
|
+ //MongodbAddr: "172.17.189.140:27080",
|
|
|
|
+ MongodbAddr: "127.0.0.1:27083",
|
|
|
|
+ DbName: "qfw",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
|
+ Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoB.InitPool()
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ sess := MgoB.GetMgoConn()
|
|
|
|
+ defer MgoB.DestoryMongoConn(sess)
|
|
|
|
+
|
|
|
|
+ it := sess.DB("qfw").C("ent_info_buyer_912").Find(nil).Select(nil).Sort("_id").Iter()
|
|
|
|
+ fmt.Println("taskRun 开始")
|
|
|
|
+ count := 0
|
|
|
|
+
|
|
|
|
+ ch := make(chan bool, 15)
|
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
|
+
|
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
|
+ if count%1000 == 0 {
|
|
|
|
+ log.Println("current:", count)
|
|
|
|
+ }
|
|
|
|
+ bus := util.ObjToString(tmp["businessScope"])
|
|
|
|
+ if bus == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //if _, ok := tmp["top_labels2"]; ok {
|
|
|
|
+ // continue
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ ch <- true
|
|
|
|
+ wg.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-ch
|
|
|
|
+ wg.Done()
|
|
|
|
+ }()
|
|
|
|
+ //
|
|
|
|
+ business := util.ObjToString(tmp["businessScope"])
|
|
|
|
+
|
|
|
|
+ //if utf8.RuneCountInString(business) > 50 {
|
|
|
|
+ // if strings.Contains(business, "。") {
|
|
|
|
+ // if utf8.RuneCountInString(business[:strings.Index(business, "。")]) < 50 {
|
|
|
|
+ // business = business[:strings.Index(business, "。")]
|
|
|
|
+ // } else if strings.Contains(business, ";") {
|
|
|
|
+ // business = business[:strings.Index(business, ";")]
|
|
|
|
+ // }
|
|
|
|
+ // } else if strings.Contains(business, ";") {
|
|
|
|
+ // business = business[:strings.Index(business, ";")]
|
|
|
|
+ // }
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ res := GetIndustryBusiness(business)
|
|
|
|
+ res = removeDuplicates(res)
|
|
|
|
+ id := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
|
+ if len(res) > 0 {
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "top_labels_businessScope": res,
|
|
|
|
+ }
|
|
|
|
+ //代表只有一个分类;
|
|
|
|
+ if len(res) == 1 {
|
|
|
|
+ update["credibility"] = 10
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }(tmp)
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ wg.Wait()
|
|
|
|
+
|
|
|
|
+ log.Println("结束~~~~~~~~~~~")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// GetIndustryBusiness 根据经营范围获取行业标签
|
|
|
|
+func GetIndustryBusiness(business string) []string {
|
|
|
|
+ var hycodes []CodeBUSITERMCODE
|
|
|
|
+ for _, feat := range businessScope {
|
|
|
|
+ if strings.Contains(business, feat.NAME) {
|
|
|
|
+ hycodes = append(hycodes, feat)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var industryNames []string
|
|
|
|
+ if len(hycodes) > 0 {
|
|
|
|
+ for _, hycode := range hycodes {
|
|
|
|
+ business_codes := strings.Split(hycode.INDUSTYPECODE, ";")
|
|
|
|
+ for _, v := range business_codes {
|
|
|
|
+ indCode, ok := indCodeMap[v]
|
|
|
|
+ if ok {
|
|
|
|
+ var path []string
|
|
|
|
+ //path = append(path, hycode.NAME)
|
|
|
|
+ path = append(path, indCode.NAME)
|
|
|
|
+ for indCode.PARIND != "" {
|
|
|
|
+ indCode = indCodeMap[indCode.PARIND]
|
|
|
|
+ path = append(path, indCode.NAME)
|
|
|
|
+ }
|
|
|
|
+ // 反转路径
|
|
|
|
+ for i, j := 0, len(path)-1; i < j; i, j = i+1, j-1 {
|
|
|
|
+ path[i], path[j] = path[j], path[i]
|
|
|
|
+ }
|
|
|
|
+ industryNames = append(industryNames, strings.Join(path, "-"))
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return industryNames
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// updateBusinessScope 提取企业主营营业范围
|
|
|
|
+func updateBusinessScope() {
|
|
|
|
+ //开始调用
|
|
|
|
+ MgoB := &mongodb.MongodbSim{
|
|
|
|
+ //MongodbAddr: "172.17.189.140:27080",
|
|
|
|
+ MongodbAddr: "127.0.0.1:27083",
|
|
|
|
+ DbName: "qfw",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
|
+ Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoB.InitPool()
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ sess := MgoB.GetMgoConn()
|
|
|
|
+ defer MgoB.DestoryMongoConn(sess)
|
|
|
|
+
|
|
|
|
+ it := sess.DB("qfw").C("ent_info_buyer_912").Find(nil).Select(nil).Sort("_id").Iter()
|
|
|
|
+ fmt.Println("taskRun 开始")
|
|
|
|
+ count := 0
|
|
|
|
+ ch := make(chan bool, 15)
|
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
|
+ if count%1000 == 0 {
|
|
|
|
+ log.Println("current:", count)
|
|
|
|
+ }
|
|
|
|
+ bus := util.ObjToString(tmp["business_scope"])
|
|
|
|
+ if bus == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ch <- true
|
|
|
|
+ wg.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-ch
|
|
|
|
+ wg.Done()
|
|
|
|
+ }()
|
|
|
|
+ //
|
|
|
|
+ //business := util.ObjToString(tmp["business_scope"])
|
|
|
|
+ id := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
|
+ //update := map[string]interface{}{
|
|
|
|
+ // "businessScope": extractMainBusiness(business),
|
|
|
|
+ //}
|
|
|
|
+ //MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+
|
|
|
|
+ //=========//
|
|
|
|
+ if topBus, ok := tmp["top_labels_businessScope"]; ok {
|
|
|
|
+ if topBus2, ok2 := topBus.([]interface{}); ok2 {
|
|
|
|
+ if len(topBus2) == 1 {
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "credibility": 10,
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }(tmp)
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ wg.Wait()
|
|
|
|
+ log.Println("1234444444")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// getJiao 获取根据企业名称,营业范围标记结果的交集
|
|
|
|
+func getJiao() {
|
|
|
|
+ //开始调用
|
|
|
|
+ MgoB := &mongodb.MongodbSim{
|
|
|
|
+ //MongodbAddr: "172.17.189.140:27080",
|
|
|
|
+ MongodbAddr: "127.0.0.1:27083",
|
|
|
|
+ DbName: "qfw",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
|
+ Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoB.InitPool()
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ sess := MgoB.GetMgoConn()
|
|
|
|
+ defer MgoB.DestoryMongoConn(sess)
|
|
|
|
+
|
|
|
|
+ it := sess.DB("qfw").C("ent_info_buyer_912").Find(nil).Select(nil).Sort("_id").Iter()
|
|
|
|
+ fmt.Println("taskRun 开始")
|
|
|
|
+ count := 0
|
|
|
|
+ ch := make(chan bool, 15)
|
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
|
+ if count%1000 == 0 {
|
|
|
|
+ log.Println("current:", count)
|
|
|
|
+ }
|
|
|
|
+ bus := util.ObjToString(tmp["business_scope"])
|
|
|
|
+ if bus == "" {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if _, ok := tmp["top_labels_businessScope"]; !ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if _, ok := tmp["top_labels_name"]; !ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ ch <- true
|
|
|
|
+ wg.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-ch
|
|
|
|
+ wg.Done()
|
|
|
|
+ }()
|
|
|
|
+ //
|
|
|
|
+ id := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
|
+ intersection := findIntersection(tmp)
|
|
|
|
+ // 只有一个交集
|
|
|
|
+ if len(intersection) == 1 {
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "credibility": 11,
|
|
|
|
+ "top_intersection": intersection,
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }(tmp)
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
|
+ }
|
|
|
|
+ wg.Wait()
|
|
|
|
+ log.Println("1234444444")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// getIndustry 获取凭安企业标签
|
|
|
|
+func getIndustry() {
|
|
|
|
+ //开始调用
|
|
|
|
+ MgoB := &mongodb.MongodbSim{
|
|
|
|
+ //MongodbAddr: "172.17.189.140:27080",
|
|
|
|
+ MongodbAddr: "127.0.0.1:27083",
|
|
|
|
+ DbName: "qfw",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
|
+ Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoB.InitPool()
|
|
|
|
+ //181 凭安库
|
|
|
|
+ MgoQY := &mongodb.MongodbSim{
|
|
|
|
+ //MongodbAddr: "172.17.4.181:27001",
|
|
|
|
+ MongodbAddr: "127.0.0.1:27001",
|
|
|
|
+ DbName: "mixdata",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "",
|
|
|
|
+ Password: "",
|
|
|
|
+ Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoQY.InitPool()
|
|
|
|
+
|
|
|
|
+ key := "4d5206b1b297c1e7b77f9578edcb2cf7.TNU2i8G1oUNdR02i"
|
|
|
|
+ model := "glm-4-flash"
|
|
|
|
+
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ sess := MgoB.GetMgoConn()
|
|
|
|
+ defer MgoB.DestoryMongoConn(sess)
|
|
|
|
+
|
|
|
|
+ it := sess.DB("qfw").C("ent_info_buyer_912").Find(nil).Select(nil).Sort("_id").Iter()
|
|
|
|
+ fmt.Println("taskRun 开始")
|
|
|
|
+ count := 0
|
|
|
|
+ ch := make(chan bool, 15)
|
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
|
+ if count%1000 == 0 {
|
|
|
|
+ log.Println("current:", count)
|
|
|
|
+ }
|
|
|
|
+ // 名称小于5 认为不
|
|
|
|
+ if utf8.RuneCountInString(util.ObjToString(tmp["name"])) < 5 {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ ch <- true
|
|
|
|
+ wg.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-ch
|
|
|
|
+ wg.Done()
|
|
|
|
+ }()
|
|
|
|
+ //
|
|
|
|
+ id := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
|
+ name := mongodb.BsonIdToSId(tmp["name"])
|
|
|
|
+ //if name == "某部" || name == "某单位" {
|
|
|
|
+ //
|
|
|
|
+ //}
|
|
|
|
+ where := map[string]interface{}{
|
|
|
|
+ "company_name": name,
|
|
|
|
+ }
|
|
|
|
+ data, _ := MgoQY.FindOne("company_base", where)
|
|
|
|
+ companyID := util.ObjToString((*data)["company_id"])
|
|
|
|
+ //1.公司ID不为空,直接使用凭安标签
|
|
|
|
+ if companyID != "" {
|
|
|
|
+ whereIndustry := map[string]interface{}{
|
|
|
|
+ "company_id": companyID,
|
|
|
|
+ }
|
|
|
|
+ industry, _ := MgoQY.FindOne("company_industry", whereIndustry)
|
|
|
|
+ if industry != nil && len(*industry) > 0 {
|
|
|
|
+ totalIndustry := make([]interface{}, 0)
|
|
|
|
+ label := ""
|
|
|
|
+ if util.ObjToString((*industry)["industry_l1_name"]) != "" {
|
|
|
|
+ label = util.ObjToString((*industry)["industry_l1_name"])
|
|
|
|
+ }
|
|
|
|
+ //二级名称
|
|
|
|
+ if util.ObjToString((*industry)["industry_l2_name"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString((*industry)["industry_l2_name"])
|
|
|
|
+ }
|
|
|
|
+ if util.ObjToString((*industry)["industry_l3_name"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString((*industry)["industry_l3_name"])
|
|
|
|
+ }
|
|
|
|
+ if util.ObjToString((*industry)["industry_l4_name"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString((*industry)["industry_l4_name"])
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ tmpD := map[string]interface{}{
|
|
|
|
+ "name": label,
|
|
|
|
+ "score": 1.0,
|
|
|
|
+ }
|
|
|
|
+ totalIndustry = append(totalIndustry, tmpD)
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "totalIndustry": totalIndustry,
|
|
|
|
+ "industry_type": 1, //通过凭安
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ } else {
|
|
|
|
+ //2.company_base 表存在,但是没有对应标签,需要调用大模型
|
|
|
|
+ business := util.ObjToString(tmp["businessScope"])
|
|
|
|
+ if utf8.RuneCountInString(business) > 50 {
|
|
|
|
+ r := []rune(business)
|
|
|
|
+ business = string(r[:50])
|
|
|
|
+ }
|
|
|
|
+ res := ZpAI3(key, model, name, business)
|
|
|
|
+ if len(res) > 0 {
|
|
|
|
+ if resD, ok := res["result"].([]interface{}); ok {
|
|
|
|
+ labels := make([]interface{}, 0)
|
|
|
|
+ for _, resDa := range resD {
|
|
|
|
+ if v, ok := resDa.(map[string]interface{}); ok {
|
|
|
|
+ //log.Println(v)
|
|
|
|
+ label := ""
|
|
|
|
+ if util.ObjToString(v["label1"]) != "" {
|
|
|
|
+ label = util.ObjToString(v["label1"])
|
|
|
|
+ }
|
|
|
|
+ if util.ObjToString(v["label2"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString(v["label2"])
|
|
|
|
+ }
|
|
|
|
+ if util.ObjToString(v["label3"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString(v["label3"])
|
|
|
|
+ }
|
|
|
|
+ if len(label) > 0 && util.Float64All(v["score"]) > 0 {
|
|
|
|
+ tm := map[string]interface{}{
|
|
|
|
+ "name": label,
|
|
|
|
+ "score": v["score"],
|
|
|
|
+ }
|
|
|
|
+ labels = append(labels, tm)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if len(labels) > 0 {
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "totalIndustry": labels,
|
|
|
|
+ "industry_type": 2, //通过大模型
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ //3.凭安不存在,直接使用大模型
|
|
|
|
+ //2.company_base 表存在,但是没有对应标签,需要调用大模型
|
|
|
|
+ business := util.ObjToString(tmp["businessScope"])
|
|
|
|
+ if utf8.RuneCountInString(business) > 50 {
|
|
|
|
+ r := []rune(business)
|
|
|
|
+ business = string(r[:50])
|
|
|
|
+ }
|
|
|
|
+ res := ZpAI3(key, model, name, business)
|
|
|
|
+ if len(res) > 0 {
|
|
|
|
+ if resD, ok := res["result"].([]interface{}); ok {
|
|
|
|
+ labels := make([]interface{}, 0)
|
|
|
|
+ for _, resDa := range resD {
|
|
|
|
+ if v, ok := resDa.(map[string]interface{}); ok {
|
|
|
|
+ //log.Println(v)
|
|
|
|
+ label := ""
|
|
|
|
+ if util.ObjToString(v["label1"]) != "" {
|
|
|
|
+ label = util.ObjToString(v["label1"])
|
|
|
|
+ }
|
|
|
|
+ if util.ObjToString(v["label2"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString(v["label2"])
|
|
|
|
+ }
|
|
|
|
+ if util.ObjToString(v["label3"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString(v["label3"])
|
|
|
|
+ }
|
|
|
|
+ if len(label) > 0 && util.Float64All(v["score"]) > 0 {
|
|
|
|
+ tm := map[string]interface{}{
|
|
|
|
+ "name": label,
|
|
|
|
+ "score": v["score"],
|
|
|
|
+ }
|
|
|
|
+ labels = append(labels, tm)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if len(labels) > 0 {
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "totalIndustry": labels,
|
|
|
|
+ "industry_type": 2, //通过大模型
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("ent_info_buyer_912", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }(tmp)
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
|
+ }
|
|
|
|
+ wg.Wait()
|
|
|
|
+ log.Println("1234444444")
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// testIndustry 测试采购单位,凭安库标签
|
|
|
|
+func testIndustry() {
|
|
|
|
+ MgoB := &mongodb.MongodbSim{
|
|
|
|
+ MongodbAddr: "172.17.189.140:27080",
|
|
|
|
+ //MongodbAddr: "127.0.0.1:27083",
|
|
|
|
+ DbName: "qfw",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "SJZY_RWbid_ES",
|
|
|
|
+ Password: "SJZY@B4i4D5e6S",
|
|
|
|
+ //Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoB.InitPool()
|
|
|
|
+ //181 凭安库
|
|
|
|
+ MgoQY := &mongodb.MongodbSim{
|
|
|
|
+ MongodbAddr: "172.17.4.181:27001",
|
|
|
|
+ //MongodbAddr: "127.0.0.1:27001",
|
|
|
|
+ DbName: "mixdata",
|
|
|
|
+ Size: 10,
|
|
|
|
+ UserName: "",
|
|
|
|
+ Password: "",
|
|
|
|
+ //Direct: true,
|
|
|
|
+ }
|
|
|
|
+ MgoQY.InitPool()
|
|
|
|
+
|
|
|
|
+ defer util.Catch()
|
|
|
|
+ sess := MgoB.GetMgoConn()
|
|
|
|
+ defer MgoB.DestoryMongoConn(sess)
|
|
|
|
+
|
|
|
|
+ it := sess.DB("qfw").C("wcc_project_0925").Find(nil).Select(nil).Iter()
|
|
|
|
+ fmt.Println("taskRun 开始")
|
|
|
|
+ count := 0
|
|
|
|
+ ch := make(chan bool, 15)
|
|
|
|
+ wg := &sync.WaitGroup{}
|
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp); count++ {
|
|
|
|
+ if count%1000 == 0 {
|
|
|
|
+ log.Println("current:", count)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if _, ok := tmp["totalIndustry"]; ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ ch <- true
|
|
|
|
+ wg.Add(1)
|
|
|
|
+ go func(tmp map[string]interface{}) {
|
|
|
|
+ defer func() {
|
|
|
|
+ <-ch
|
|
|
|
+ wg.Done()
|
|
|
|
+ }()
|
|
|
|
+ id := mongodb.BsonIdToSId(tmp["_id"])
|
|
|
|
+ name := mongodb.BsonIdToSId(tmp["buyer"])
|
|
|
|
+ where := map[string]interface{}{
|
|
|
|
+ "company_name": name,
|
|
|
|
+ }
|
|
|
|
+ if name == "" {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ data, _ := MgoQY.FindOne("company_base", where)
|
|
|
|
+ companyID := util.ObjToString((*data)["company_id"])
|
|
|
|
+
|
|
|
|
+ //1.公司ID不为空,直接使用凭安标签
|
|
|
|
+ if companyID != "" {
|
|
|
|
+ whereIndustry := map[string]interface{}{
|
|
|
|
+ "company_id": companyID,
|
|
|
|
+ }
|
|
|
|
+ industry, _ := MgoQY.FindOne("company_industry", whereIndustry)
|
|
|
|
+ if industry != nil && len(*industry) > 0 {
|
|
|
|
+ //totalIndustry := make([]interface{}, 0)
|
|
|
|
+ label := ""
|
|
|
|
+ if util.ObjToString((*industry)["industry_l1_name"]) != "" {
|
|
|
|
+ label = util.ObjToString((*industry)["industry_l1_name"])
|
|
|
|
+ }
|
|
|
|
+ //二级名称
|
|
|
|
+ if util.ObjToString((*industry)["industry_l2_name"]) != "" {
|
|
|
|
+ label = label + "-" + util.ObjToString((*industry)["industry_l2_name"])
|
|
|
|
+ }
|
|
|
|
+ //if util.ObjToString((*industry)["industry_l3_name"]) != "" {
|
|
|
|
+ // label = label + "-" + util.ObjToString((*industry)["industry_l3_name"])
|
|
|
|
+ //}
|
|
|
|
+ //if util.ObjToString((*industry)["industry_l4_name"]) != "" {
|
|
|
|
+ // label = label + "-" + util.ObjToString((*industry)["industry_l4_name"])
|
|
|
|
+ //}
|
|
|
|
+
|
|
|
|
+ //tmpD := map[string]interface{}{
|
|
|
|
+ // "name": label,
|
|
|
|
+ // "score": 1.0,
|
|
|
|
+ //}
|
|
|
|
+ //totalIndustry = append(totalIndustry, tmpD)
|
|
|
|
+ update := map[string]interface{}{
|
|
|
|
+ "totalIndustry": label,
|
|
|
|
+ "industry_type": 1, //通过凭安
|
|
|
|
+ }
|
|
|
|
+ MgoB.UpdateById("wcc_project_0925", id, map[string]interface{}{"$set": update})
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ }(tmp)
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
|
+ }
|
|
|
|
+ wg.Wait()
|
|
|
|
+ log.Println("1234444444")
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+//---------------------------//
|
|
|
|
+
|
|
|
|
+type Category struct {
|
|
|
|
+ //ParentCode string
|
|
|
|
+ Level int
|
|
|
|
+ CODE string `gorm:"column:CODE;type:varchar(6);not null"`
|
|
|
|
+ NAME string `gorm:"column:NAME;type:varchar(200);not null"`
|
|
|
|
+ TotalName string //完整分类路径全称
|
|
|
|
+ //KINDSIGN string `gorm:"column:KINDSIGN;type:char(1);not null"`
|
|
|
|
+ //MAXKINDSIGN string `gorm:"column:MAXKINDSIGN;type:char(1);not null"`
|
|
|
|
+ //MIDKINDSIGN string `gorm:"column:MIDKINDSIGN;type:char(1);not null"`
|
|
|
|
+ //MINKINDSIGN string `gorm:"column:MINKINDSIGN;type:char(1);not null"`
|
|
|
|
+ PARIND string `gorm:"column:PARIND;type:varchar(6);default:null"`
|
|
|
|
+ //CHOSIGN string `gorm:"column:CHOSIGN;type:char(1);not null"`
|
|
|
|
+ //RISKTYPECODE string `gorm:"column:RISKTYPECODE;type:varchar(20);default:null"`
|
|
|
|
+ //ENTTYPES string `gorm:"column:ENTTYPES;type:varchar(100);default:null"`
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func connectToDB() (*gorm.DB, error) {
|
|
|
|
+ username := "root"
|
|
|
|
+ password := "=PDT49#80Z!RVv52_z"
|
|
|
|
+ host := "192.168.3.14:4000"
|
|
|
|
+ database := "wcc"
|
|
|
|
+ dsn := fmt.Sprintf("%s:%s@tcp(%s)/%s?charset=utf8mb4&parseTime=True&loc=Local", username, password, host, database)
|
|
|
|
+ //dsn := "username:password@tcp(host:port)/database_name?charset=utf8mb4&parseTime=True&loc=Local"
|
|
|
|
+ db, err := gorm.Open(mysql.Open(dsn), &gorm.Config{})
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ return db, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func buildCategoryTree(db *gorm.DB) ([]Category, error) {
|
|
|
|
+ topLevelCategories := []Category{}
|
|
|
|
+ result := db.Debug().Table("CODE_IndCode").Where("PARIND IS NULL").Find(&topLevelCategories)
|
|
|
|
+ if result.Error != nil {
|
|
|
|
+ return nil, result.Error
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var categories []Category
|
|
|
|
+ for _, topCategory := range topLevelCategories {
|
|
|
|
+ topCategory.Level = 1
|
|
|
|
+ topCategory.TotalName = topCategory.NAME
|
|
|
|
+ categories = append(categories, topCategory)
|
|
|
|
+ subCategories, err := findSubCategories(db, topCategory.CODE, 2, topCategory.TotalName)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ categories = append(categories, subCategories...)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return categories, nil
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+func findSubCategories(db *gorm.DB, parentCode string, level int, parentName string) ([]Category, error) {
|
|
|
|
+ subCategories := []Category{}
|
|
|
|
+ result := db.Table("CODE_IndCode").Where("PARIND =?", parentCode).Find(&subCategories)
|
|
|
|
+ if result.Error != nil {
|
|
|
|
+ return nil, result.Error
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for i := range subCategories {
|
|
|
|
+ subCategories[i].Level = level
|
|
|
|
+ subCategories[i].TotalName = parentName + "-" + subCategories[i].NAME
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ var allSubCategories []Category
|
|
|
|
+ for _, subCategory := range subCategories {
|
|
|
|
+ subSubCategories, err := findSubCategories(db, subCategory.CODE, level+1, subCategory.TotalName)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return nil, err
|
|
|
|
+ }
|
|
|
|
+ allSubCategories = append(allSubCategories, subCategory)
|
|
|
|
+ allSubCategories = append(allSubCategories, subSubCategories...)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return allSubCategories, nil
|
|
|
|
+}
|