wcc 3 mesiacov pred
rodič
commit
02cef2431a

+ 14 - 0
graph/graph_test.go

@@ -78,3 +78,17 @@ func TestFindSuspectInvestRelationsByNames(t *testing.T) {
 	log.Println(res, err)
 
 }
+
+// TestNebulaClient_FindExecutivesInvestRelationsByNames 测试 董事高管 关系
+func TestNebulaClient_FindExecutivesInvestRelationsByNames(t *testing.T) {
+	client, err := NewNebulaClient(HostList, UserName, PassWord)
+	if err != nil {
+		log.Fatal("连接失败:", err)
+	}
+	defer client.Close()
+	names := []string{"南雄市宝虹农业开发有限公司", "南雄市龙旭园林景观设计有限公司", "香港豪华国际酒店有限公司", "香港豪华酒店(中国)国际管理有限公司"}
+
+	res, err := client.FindExecutivesInvestRelationsByNames(names)
+
+	log.Println(res, err)
+}

+ 27 - 0
graph/main.go

@@ -270,6 +270,33 @@ func handHttp() {
 			c.JSON(http.StatusOK, res)
 		}
 
+	})
+	//3.董高监 关系
+	r.POST("/dgj-relations", func(c *gin.Context) {
+		var req CheckRequest
+		if err := c.ShouldBindJSON(&req); err != nil {
+			c.JSON(http.StatusBadRequest, gin.H{"error": "请求参数无效"})
+			return
+		}
+
+		results, err := client.FindExecutivesInvestRelationsByNames(req.Names)
+		if err != nil {
+			res := map[string]interface{}{
+				"code": 200,
+				"msg":  "请求失败",
+				"data": err.Error(),
+			}
+			c.JSON(http.StatusInternalServerError, res)
+			return
+		} else {
+			res := map[string]interface{}{
+				"code": 200,
+				"msg":  "请求成功",
+				"data": results,
+			}
+			c.JSON(http.StatusOK, res)
+		}
+
 	})
 	//--------------------------//
 	// 启动服务

+ 3 - 0
graph/utils.go

@@ -1066,6 +1066,9 @@ func (c *NebulaClient) CheckLegalRelationships(names []string, deep, stype int)
 		return false, nil, fmt.Errorf("企业数量不足,至少需要两个")
 	}
 
+	if deep == 0 {
+		deep = 1
+	}
 	var rawPaths []string
 	var rawNodeLists [][]string
 

+ 0 - 8
top_clickhouse/clickhouse.go

@@ -15,14 +15,6 @@ import (
 	"time"
 )
 
-// ExampleModel 定义数据模型
-type ExampleModel struct {
-	ID         uint      `gorm:"column:id"`
-	Name       string    `gorm:"column:name"`
-	Age        uint      `gorm:"column:age"`
-	CreateTime time.Time `gorm:"create_time"`
-	UpdateTime time.Time `gorm:"update_time"`
-}
 type EnterpriseBaseInfo struct {
 	ID             int       `json:"id"`
 	Name           string    `json:"name"`

+ 1 - 2
top_clickhouse/mian.go

@@ -14,7 +14,6 @@ import (
 
 func main() {
 	//getProjectDataFromEs() //整理数据,然后才能写Clickhouse
-
 	click()
 	log.Println("数据处理完毕")
 }
@@ -61,7 +60,7 @@ func getProjectDataFromEs() {
 	//2023-10-1 2024-1-1;1696089600-1704038400
 	//areaTermsQuery := elastic.NewTermsQuery("area", "江苏", "安徽", "上海", "天津", "河北", "浙江", "天津市", "上海市", "河北省", "安徽省", "江苏省", "浙江省", "北京", "北京市")
 	//rangeQuery := elastic.NewRangeQuery("firsttime").Gte(1711900800).Lt(1719763200) //2024年4-7月
-	rangeQuery := elastic.NewRangeQuery("firsttime").Gte(1735660800).Lt(1743436800) //2025年1-3月
+	rangeQuery := elastic.NewRangeQuery("jgtime").Gte(1735660800).Lt(1743436800) //2025年1-3月
 	query := elastic.NewBoolQuery().
 		//Must(areaTermsQuery).
 		Must(elastic.NewTermsQuery("bidstatus", "中标", "单一", "成交", "合同")).

BIN
top_clickhouse/top_clickhouse


+ 42 - 25
updateBidding/main.go

@@ -41,13 +41,13 @@ var (
 
 func Init() {
 	MgoB = &mongodb.MongodbSim{
-		//MongodbAddr: "172.31.31.202:27081,172.20.45.128:27080",
-		MongodbAddr: "127.0.0.1:27083",
-		DbName:      "qfw",
-		Size:        10,
-		UserName:    "SJZY_RWbid_ES",
-		Password:    "SJZY@B4i4D5e6S",
-		Direct:      true,
+		MongodbAddr: "172.31.31.202:27081,172.20.45.128:27080",
+		//MongodbAddr: "127.0.0.1:27083",
+		DbName:   "qfw",
+		Size:     10,
+		UserName: "SJZY_RWbid_ES",
+		Password: "SJZY@B4i4D5e6S",
+		//Direct:      true,
 	}
 	MgoB.InitPool()
 
@@ -108,8 +108,8 @@ func Init() {
 
 	//es
 	Es = &elastic.Elastic{
-		S_esurl: "http://127.0.0.1:19908",
-		//S_esurl:  "http://172.17.4.184:19908",
+		//S_esurl: "http://127.0.0.1:19908",
+		S_esurl:  "http://172.17.4.184:19908",
 		I_size:   5,
 		Username: "jybid",
 		Password: "Top2023_JEB01i@31",
@@ -118,8 +118,8 @@ func Init() {
 
 	//es 新集群
 	EsNew = &elastic.Elastic{
-		S_esurl: "http://127.0.0.1:19905",
-		//S_esurl:  "http://172.17.4.184:19905",
+		//S_esurl: "http://127.0.0.1:19905",
+		S_esurl:  "http://172.17.4.184:19905",
 		I_size:   5,
 		Username: "jybid",
 		Password: "Top2023_JEB01i@31",
@@ -197,7 +197,7 @@ func taskRunBidding() {
 	//}
 
 	//selected := map[string]interface{}{"contenthtml": 0, "detail": 0}
-	it := sess.DB("qfw").C("zktest_0428").Find(nil).Select(nil).Iter()
+	it := sess.DB("qfw").C("zktest_unit_0430_data").Find(nil).Select(nil).Iter()
 
 	fmt.Println("taskRun 开始")
 	count := 0
@@ -235,24 +235,41 @@ func taskRunBidding() {
 		//
 		//}
 		//-------------------------------------------//
-		// 2.更新中标单位
-		//biddingID := util.ObjToString(tmp["id"])
-		////biddingID := mongodb.BsonIdToSId(tmp["_id"])
-		//update["winner"] = ""
-		//update["s_winner"] = ""
+		// 2.更新中标单位、采购单位、代理机构
+		biddingID := util.ObjToString(tmp["id"])
+		//biddingID := mongodb.BsonIdToSId(tmp["_id"])
+
+		if _, ok := tmp["buyer"]; ok {
+			update["buyer"] = tmp["buyer"]
+		}
+
+		if _, ok := tmp["agency"]; ok {
+			update["agency"] = tmp["agency"]
+		}
+		if _, ok := tmp["s_winner"]; ok {
+			update["s_winner"] = tmp["s_winner"]
+		}
+		if _, ok := tmp["winner"]; ok {
+			update["winner"] = tmp["winner"]
+		}
 		//-------------------------------------------//
 		//3. 更新中标金额
-		biddingID := util.ObjToString(tmp["tmpid"])
-		update["bidamount"] = tmp["bidamount"]
-		// 更新 MongoDB + ES
+		//biddingID := util.ObjToString(tmp["id"])
+		//if _, ok := tmp["nb"]; !ok {
+		//	continue
+		//} else {
+		//	update["bidamount"] = tmp["nb"]
+		//}
+		//update["bidamount"] = tmp["bidamount"]
+		//// 更新 MongoDB + ES
 		if len(update) > 0 {
 			MgoB.UpdateById("bidding", biddingID, map[string]interface{}{"$set": update})
 			//2.es 项目 更新字段
-			//err := Es.UpdateDocument("bidding", biddingID, update)
-			//err = EsNew.UpdateDocument("bidding", biddingID, update)
-			//if err != nil && err.Error() != "Document not updated: noop" {
-			//	log.Info("bidding es update err", err, biddingID)
-			//}
+			err := Es.UpdateDocument("bidding", biddingID, update)
+			err = EsNew.UpdateDocument("bidding", biddingID, update)
+			if err != nil && err.Error() != "Document not updated: noop" {
+				log.Info("bidding es update err", err, biddingID)
+			}
 		}
 
 	}

BIN
updateBidding/updateBidding