|
@@ -8,14 +8,34 @@ import (
|
|
|
"strings"
|
|
|
)
|
|
|
|
|
|
+//生成两个 mysql 表
|
|
|
+func dealWithBiddingSource() {
|
|
|
+ //f_bidding f_bidproduct
|
|
|
+ log.Debug("分析数据-保存两个mysql表...")
|
|
|
+ sess := save_mgo.GetMgoConn()
|
|
|
+ defer save_mgo.DestoryMongoConn(sess)
|
|
|
+ q,total:=map[string]interface{}{},0
|
|
|
+ it := sess.DB(save_mgo.DbName).C("zktest_mysql_source").Find(&q).Iter()
|
|
|
+ for tmp := make(map[string]interface{}); it.Next(&tmp);total++{
|
|
|
+ if total%10000==0 {
|
|
|
+ log.Debug("curent index ",total)
|
|
|
+ }
|
|
|
|
|
|
+
|
|
|
|
|
|
+ tmp = make(map[string]interface{})
|
|
|
+ }
|
|
|
+ log.Debug("is over ",total)
|
|
|
|
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+//导出源数据...
|
|
|
func exportUsefulPurchasing() {
|
|
|
sess := save_mgo.GetMgoConn()
|
|
|
defer save_mgo.DestoryMongoConn(sess)
|
|
@@ -38,25 +58,34 @@ func exportUsefulPurchasing() {
|
|
|
if len(p_list)>0 {
|
|
|
isok++
|
|
|
s_winner := qu.ObjToString(tmp["s_winner"])
|
|
|
+
|
|
|
new_data["yl_purchasinglist"] = p_list
|
|
|
+
|
|
|
+
|
|
|
tmpid := BsonTOStringId(tmp["_id"])
|
|
|
- new_data["_id"] = tmp["_id"]
|
|
|
new_data["info_id"] = tmpid
|
|
|
- new_data["subtype"] = tmp["subtype"]
|
|
|
- new_data["toptype"] = tmp["toptype"]
|
|
|
- new_data["projectname"] =tmp["projectname"]
|
|
|
- new_data["publishtime"] =tmp["publishtime"]
|
|
|
- new_data["buyer"] =tmp["buyer"]
|
|
|
- new_data["buyerclass"] =tmp["buyerclass"]
|
|
|
- new_data["budget"] =tmp["budget"]
|
|
|
- new_data["bidamount"] = tmp["bidamount"]
|
|
|
+ new_data["subtype"] = qu.ObjToString(tmp["subtype"])
|
|
|
+ new_data["toptype"] = qu.ObjToString(tmp["toptype"])
|
|
|
+ new_data["projectname"] =qu.ObjToString(tmp["projectname"])
|
|
|
+ new_data["publishtime"] = qu.IntAll(tmp["publishtime"])
|
|
|
+ new_data["buyer"] =qu.ObjToString(tmp["buyer"])
|
|
|
+ new_data["buyerclass"] =qu.ObjToString(tmp["buyerclass"])
|
|
|
+ if tmp["budget"]!=nil {
|
|
|
+ new_data["budget"] =tmp["budget"]
|
|
|
+ }
|
|
|
+ if tmp["bidamount"]!=nil {
|
|
|
+ new_data["bidamount"] =tmp["bidamount"]
|
|
|
+ }
|
|
|
new_data["s_winner"] =s_winner
|
|
|
- new_data["agency"] =tmp["agency"]
|
|
|
- new_data["area"] =tmp["area"]
|
|
|
- new_data["city"] =tmp["city"]
|
|
|
- new_data["district"] =tmp["district"]
|
|
|
- new_data["jyhref"] = fmt.Sprintf(Url, qu.CommonEncodeArticle("content", BsonTOStringId(tmp["_id"])))
|
|
|
- new_data["subscopeclass"] = tmp["subscopeclass"]
|
|
|
+ new_data["agency"] =qu.ObjToString(tmp["agency"])
|
|
|
+ new_data["area"] =qu.ObjToString(tmp["area"])
|
|
|
+ new_data["city"] =qu.ObjToString(tmp["city"])
|
|
|
+ new_data["district"] =qu.ObjToString(tmp["district"])
|
|
|
+ new_data["jyhref"] = fmt.Sprintf(Url, qu.CommonEncodeArticle("content", tmpid))
|
|
|
+
|
|
|
+ if tmp["subscopeclass"]!=nil {
|
|
|
+ new_data["subscopeclass"] = tmp["subscopeclass"]
|
|
|
+ }
|
|
|
company_id:=""
|
|
|
//根据s_winner-关联company_id
|
|
|
if s_winner != "" && !strings.Contains(s_winner,",") {
|
|
@@ -69,7 +98,7 @@ func exportUsefulPurchasing() {
|
|
|
}
|
|
|
new_data["company_id"] = company_id
|
|
|
|
|
|
- spi_mgo.Save("zktest_mysql_source",new_data)
|
|
|
+ save_mgo.Save("zktest_mysql_source",new_data)
|
|
|
}
|
|
|
|
|
|
|
|
@@ -81,6 +110,7 @@ func exportUsefulPurchasing() {
|
|
|
log.Debug("is over ",total,isok)
|
|
|
}
|
|
|
|
|
|
+//暂未使用
|
|
|
func getUsefulPurchasingData(arr []map[string]interface{}) []map[string]interface{} {
|
|
|
new_arr :=[]map[string]interface{}{}
|
|
|
for _,v:=range arr {
|