|
@@ -260,11 +260,9 @@ func HisTransactionDataAddInformation() {
|
|
|
wg := &sync.WaitGroup{}
|
|
|
lock := &sync.Mutex{}
|
|
|
query := map[string]interface{}{
|
|
|
- //"_id": map[string]interface{}{
|
|
|
- // "$gte": mongodb.StringTOBsonId("6627289319c5408c478125d4"),
|
|
|
- //},
|
|
|
+ "_id": mongodb.StringTOBsonId("662f01d8397fa006e2e75e6c"),
|
|
|
}
|
|
|
- it := sess.DB(MgoPro.DbName).C("projectset_wy").Find(&query).Iter()
|
|
|
+ it := sess.DB(MgoPro.DbName).C("projectset_wy_back").Find(&query).Iter()
|
|
|
n := 0
|
|
|
arr := [][]map[string]interface{}{}
|
|
|
for tmp := make(map[string]interface{}); it.Next(tmp); n++ {
|
|
@@ -282,10 +280,14 @@ func HisTransactionDataAddInformation() {
|
|
|
set := map[string]interface{}{}
|
|
|
//法人信息
|
|
|
buyer_id, agency_id, winner_ids := FindEntInfoData(id, gconv.String(tmp["buyer"]), gconv.String(tmp["agency"]), gconv.Strings(tmp["winner"]))
|
|
|
+ //更新
|
|
|
set["buyer_id"] = buyer_id
|
|
|
set["agency_id"] = agency_id
|
|
|
set["winner_id"] = winner_ids
|
|
|
-
|
|
|
+ //保存
|
|
|
+ //tmp["buyer_id"] = buyer_id
|
|
|
+ //tmp["agency_id"] = agency_id
|
|
|
+ //tmp["winner_id"] = winner_ids
|
|
|
//项目信息补充业态
|
|
|
if from := gconv.String(tmp["from"]); from == "project" {
|
|
|
project_id := gconv.String(tmp["project_id"])
|
|
@@ -293,26 +295,48 @@ func HisTransactionDataAddInformation() {
|
|
|
if len(*pro) > 0 && (*pro)["property_form"] != nil {
|
|
|
set["property_form"] = (*pro)["property_form"]
|
|
|
}
|
|
|
+ //查询情报信息
|
|
|
+ ids := gconv.Strings(tmp["info_ids"])
|
|
|
+ info := FindInfomationData(ids...) //情报信息查询
|
|
|
+ //更新
|
|
|
+ set["information_id"] = info.Id
|
|
|
+ set["starttime"] = info.Starttime
|
|
|
+ set["endtime"] = info.Endtime
|
|
|
+ //保存
|
|
|
+ //tmp["information_id"] = info.Id
|
|
|
+ //tmp["starttime"] = info.Starttime
|
|
|
+ //tmp["endtime"] = info.Endtime
|
|
|
+ } else {
|
|
|
+ if project_bidstatus := gconv.Int(tmp["project_bidstatus"]); project_bidstatus == 4 { //拟建新增项目,补充情报信息
|
|
|
+ //查询情报信息
|
|
|
+ id := gconv.String(tmp["info_id"])
|
|
|
+ info := FindInfomationData(id) //情报信息查询
|
|
|
+ //更新
|
|
|
+ set["information_id"] = info.Id
|
|
|
+ set["starttime"] = info.Starttime
|
|
|
+ set["endtime"] = info.Endtime
|
|
|
+ //保存
|
|
|
+ //tmp["information_id"] = info.Id
|
|
|
+ //tmp["starttime"] = info.Starttime
|
|
|
+ //tmp["endtime"] = info.Endtime
|
|
|
+ }
|
|
|
+ }
|
|
|
+ delete(tmp, "from") //无用字段删除
|
|
|
+ delete(tmp, "_id") //无用字段删除
|
|
|
+ if !SaveDataToEs(tmp) { //保存、更新es
|
|
|
+ fmt.Println("数据保存es失败,数据类型 项目project_id", tmp["project_id"])
|
|
|
+ }
|
|
|
+ var err error
|
|
|
+ err = UpdateOrSaveDataToClickHouse(tmp)
|
|
|
+ if err != nil {
|
|
|
+ fmt.Println("数据迁移失败,数据类型 项目project_id", tmp["project_id"], err)
|
|
|
}
|
|
|
- delete(tmp, "from") //无用字段删除
|
|
|
- delete(tmp, "_id") //无用字段删除
|
|
|
- tmp["buyer_id"] = buyer_id
|
|
|
- tmp["agency_id"] = agency_id
|
|
|
- tmp["w-inner_id"] = winner_ids
|
|
|
- //if !SaveDataToEs(tmp) { //保存、更新es
|
|
|
- // fmt.Println("数据保存es失败,数据类型 项目project_id", tmp["project_id"])
|
|
|
- //}
|
|
|
- //var err error
|
|
|
- //err = UpdateOrSaveDataToClickHouse(tmp)
|
|
|
- //if err != nil {
|
|
|
- // fmt.Println("数据迁移失败,数据类型 项目project_id", tmp["project_id"], err)
|
|
|
- //}
|
|
|
//更新
|
|
|
update = append(update, map[string]interface{}{"$set": set})
|
|
|
lock.Lock()
|
|
|
arr = append(arr, update)
|
|
|
if len(arr) > 100 {
|
|
|
- MgoPro.UpdateBulk("projectset_wy", arr...)
|
|
|
+ MgoPro.UpdateBulk("projectset_wy_back", arr...)
|
|
|
arr = [][]map[string]interface{}{}
|
|
|
}
|
|
|
lock.Unlock()
|
|
@@ -324,7 +348,7 @@ func HisTransactionDataAddInformation() {
|
|
|
}
|
|
|
wg.Wait()
|
|
|
if len(arr) > 0 {
|
|
|
- MgoPro.UpdateBulk("projectset_wy", arr...)
|
|
|
+ MgoPro.UpdateBulk("projectset_wy_back", arr...)
|
|
|
arr = [][]map[string]interface{}{}
|
|
|
}
|
|
|
fmt.Println("迁移结束...")
|