Преглед изворни кода

wip:新增直采采购信息类型分类

wangshan пре 9 месеци
родитељ
комит
e5c61a2f75
7 измењених фајлова са 97 додато и 3 уклоњено
  1. 8 0
      .idea/.gitignore
  2. 9 0
      .idea/DataService.iml
  3. 8 0
      .idea/modules.xml
  4. 6 0
      .idea/vcs.xml
  5. 36 2
      jy_publishing/config.json
  6. 17 0
      jy_publishing/main.go
  7. 13 1
      jy_publishing/task.go

+ 8 - 0
.idea/.gitignore

@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml

+ 9 - 0
.idea/DataService.iml

@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="Go" enabled="true" />
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$" />
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/DataService.iml" filepath="$PROJECT_DIR$/.idea/DataService.iml" />
+    </modules>
+  </component>
+</project>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>

+ 36 - 2
jy_publishing/config.json

@@ -45,5 +45,39 @@
     "addr": "127.0.0.1",
     "port": 1482,
     "memo": "删除项目中数据"
-  }
-}
+  },
+  "infoCode": [
+    {
+      "code": "jy_zbxx",
+      "name": "招标信息"
+    },
+    {
+      "code": "jy_cgxx",
+      "name": "采购信息"
+    },
+    {
+      "code": "jy_gyxx",
+      "name": "供应信息"
+    },
+    {
+      "code": "jy_zbgg",
+      "name": "招标公告"
+    },
+    {
+      "code": "jy_cgyx",
+      "name": "采购意向"
+    },
+    {
+      "code": "jy_zbyg",
+      "name": "招标预告"
+    },
+    {
+      "code": "jy_zbjg",
+      "name": "招标结果"
+    },
+    {
+      "code": "zc_cgxx",
+      "name": "直采-采购信息"
+    }
+  ]
+}

+ 17 - 0
jy_publishing/main.go

@@ -12,6 +12,7 @@ import (
 	"jygit.jydev.jianyu360.cn/data_processing/common_utils/elastic"
 	"jygit.jydev.jianyu360.cn/data_processing/common_utils/mongodb"
 	"jygit.jydev.jianyu360.cn/data_processing/common_utils/udp"
+	"log"
 	"net"
 	"strings"
 )
@@ -31,11 +32,27 @@ var (
 	MProducer         *nsq.Producer
 	Ms                *ms.Megaloscope //敏感词
 	UdpClient         udp.UdpClient   //udp对象
+	InfoCodes         []infoCode
 )
 
+type infoCode struct {
+	Code string `json:"code"`
+	Name string `json:"name"`
+}
+
 func init() {
 	Logger.InitLogger("./log/All.log", "debug")
 	util.ReadConfig(&Sysconfig)
+	//信息类型
+	if Sysconfig["infoCode"] != nil {
+		b, err := json.Marshal(Sysconfig["infoCode"])
+		if err == nil {
+			err = json.Unmarshal(b, &InfoCodes)
+		}
+		if err != nil {
+			log.Println("infoCode init err :", err)
+		}
+	}
 	bidding := Sysconfig["bidding"].(map[string]interface{})
 	BidColl = bidding["dbColl"].(string)
 	MgoBid = &mongodb.MongodbSim{

+ 13 - 1
jy_publishing/task.go

@@ -55,6 +55,7 @@ var InfoType = map[int]string{
 	5: "采购意向",
 	6: "招标预告",
 	7: "招标结果",
+	8: "直采-采购信息",
 }
 
 // @Description 信息处理(信息发布和附件识别)
@@ -256,7 +257,18 @@ func InfoPub(info map[string]interface{}) {
 				saveMap[SaveFields[f]] = atts_txt
 			}
 		} else if f == "type" {
-			jyMap[f] = InfoType[util.IntAll(tmp[f])]
+			jyMap[f] = InfoType[0]
+			it := util.IntAll(tmp[f])
+			infoType := InfoType[it]
+			if infoType != "" {
+				jyMap[f] = infoType
+			}
+			if len(InfoCodes) >= it {
+				if infoType == "" {
+					jyMap[f] = InfoCodes[it-1]
+				}
+				saveMap["infoAttribute"] = InfoCodes[it-1].Code
+			}
 		} else if f == "recommended_service" {
 			saveMap[SaveFields[f]] = util.IntAll(tmp[f])
 		} else {