Просмотр исходного кода

拟建数据buyer由owner补充

mxs 1 год назад
Родитель
Сommit
8ed57eac52
3 измененных файлов с 14 добавлено и 5 удалено
  1. 1 0
      data_project_wy/history.go
  2. 9 5
      data_project_wy/main.go
  3. 4 0
      data_project_wy/task.go

+ 1 - 0
data_project_wy/history.go

@@ -110,6 +110,7 @@ func HisTransactionDataFromBid2() {
 		"city":          1,
 		"district":      1,
 		//
+		"owner":                 1,
 		"s_topscopeclass":       1,
 		"publishtime":           1,
 		"toptype":               1,

+ 9 - 5
data_project_wy/main.go

@@ -26,7 +26,7 @@ func main() {
 	//HisTransactionDataFromProject() //历史项目数据(projectset_20230904)TODO 待补充业态、情报信息、法人信息
 	//临时处理(信息补充)
 	//HisTransactionDataAddInformation() //历史信息补充法人库信息,项目信息补充业态property_form
-	//IncTransactionDataMgoToCkh() //数据迁移
+	//IncTransactionDataMgoToCkhAndEs() //数据迁移
 	ch := make(chan bool)
 	<-ch
 }
@@ -38,7 +38,7 @@ func tmp() {
 	wg := &sync.WaitGroup{}
 	lock := &sync.Mutex{}
 	query := map[string]interface{}{
-		//"zbtime": 0,
+		"business_type": "新增项目",
 	}
 	it := sess.DB(MgoPro.DbName).C("projectset_wy").Find(&query).Iter()
 	n := 0
@@ -51,12 +51,16 @@ func tmp() {
 				<-ch
 				wg.Done()
 			}()
-			info_id := gconv.String(tmp["info_id"])
 			update := []map[string]interface{}{
 				{"_id": tmp["_id"]},
 			}
-			set := map[string]interface{}{
-				"info_ids": []string{info_id},
+			set := map[string]interface{}{}
+			info_id := gconv.String(tmp["info_id"])
+			data, _ := MgoB.FindById("bidding", info_id, map[string]interface{}{"owner": 1})
+			if gconv.String(tmp["buyer"]) == "" {
+				set["buyer"] = gconv.String((*data)["owner"])
+			} else {
+				return
 			}
 			update = append(update, map[string]interface{}{"$set": set})
 			lock.Lock()

+ 4 - 0
data_project_wy/task.go

@@ -84,6 +84,7 @@ func IncTransactionDataFromBid() {
 		"city":          1,
 		"district":      1,
 		//
+		"owner":                 1,
 		"s_topscopeclass":       1,
 		"publishtime":           1,
 		"toptype":               1,
@@ -159,6 +160,9 @@ func DealTransactionForBid(tmp map[string]interface{}, business_type string, pro
 	//基本信息封装
 	id := mongodb.BsonIdToSId(tmp["_id"])
 	buyer := gconv.String(tmp["buyer"])
+	if buyer == "" {
+		buyer = gconv.String(tmp["owner"])
+	}
 	winner := gconv.String(tmp["s_winner"])
 	agency := gconv.String(tmp["agency"])
 	property_form := []string{}