|
@@ -18,7 +18,7 @@ import (
|
|
|
)
|
|
|
|
|
|
//projectset同步
|
|
|
-func Projectset() {
|
|
|
+func Projectset(gteId, ltId string) {
|
|
|
sess := MongoP.GetMgoConn()
|
|
|
defer MongoP.DestoryMongoConn(sess)
|
|
|
|
|
@@ -26,19 +26,37 @@ func Projectset() {
|
|
|
wg := &sync.WaitGroup{}
|
|
|
|
|
|
query := map[string]interface{}{}
|
|
|
- if config.Conf.Info.ProjectsetIdGt != "" {
|
|
|
+ if gteId != "" && ltId != "" {
|
|
|
+ query = map[string]interface{}{
|
|
|
+ "_id": map[string]interface{}{
|
|
|
+ "$gt": mongodb.StringTOBsonId(gteId),
|
|
|
+ "$lt": mongodb.StringTOBsonId(ltId),
|
|
|
+ },
|
|
|
+ }
|
|
|
+ log.Info("info", zap.Any("ids_zengliang", map[string]interface{}{
|
|
|
+ "gteId": gteId,
|
|
|
+ "lteId": ltId,
|
|
|
+ }))
|
|
|
+
|
|
|
+ } else if config.Conf.Info.ProjectsetIdGt != "" {
|
|
|
query = map[string]interface{}{
|
|
|
"_id": map[string]interface{}{
|
|
|
"$gt": mongodb.StringTOBsonId(config.Conf.Info.ProjectsetIdGt),
|
|
|
"$lt": mongodb.StringTOBsonId(config.Conf.Info.ProjectsetIdLt),
|
|
|
},
|
|
|
}
|
|
|
+
|
|
|
+ log.Info("info", zap.Any("ids_cunliang", map[string]interface{}{
|
|
|
+ "gteId": config.Conf.Info.ProjectsetIdGt,
|
|
|
+ "lteId": config.Conf.Info.ProjectsetIdLt,
|
|
|
+ }))
|
|
|
}
|
|
|
log.Info("info", zap.Any("query", query))
|
|
|
+
|
|
|
it := sess.DB(config.Conf.DB.MongoP.Dbname).C(config.Conf.Info.TableName).Find(query).Sort("-_id").Iter()
|
|
|
count := 0
|
|
|
for tmp := make(map[string]interface{}); it.Next(tmp); count++ {
|
|
|
- if count%20000 == 0 {
|
|
|
+ if count%10000 == 0 {
|
|
|
log.Info(fmt.Sprintf("current --- %d ,%s", count, tmp["_id"]))
|
|
|
}
|
|
|
ch <- true
|
|
@@ -149,9 +167,13 @@ func dwd_f_bid_project_final_package(tx *sql.Tx, tmp map[string]interface{}) boo
|
|
|
saveMap := map[string]interface{}{}
|
|
|
//
|
|
|
saveMap["s_projectid"] = _id
|
|
|
- saveMap["s_packagecode"] = gconv.String(vv["origin"]) //标(包)段编号
|
|
|
- saveMap["s_packagename"] = gconv.String(vv["name"]) //标段名称
|
|
|
- saveMap["s_detail"] = gconv.String(vv["text"]) //标段内容
|
|
|
+ packagecode := gconv.String(vv["origin"])
|
|
|
+ if VarcharCheck(packagecode, 255) {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ saveMap["s_packagecode"] = packagecode //标(包)段编号
|
|
|
+ saveMap["s_packagename"] = gconv.String(vv["name"]) //标段名称
|
|
|
+ saveMap["s_detail"] = gconv.String(vv["text"]) //标段内容
|
|
|
//
|
|
|
TransferMoneyRateInfo(vv, &saveMap, []string{"budget", "bidamount"}, []float64{1000000000.0, 1000000000.0})
|
|
|
//
|
|
@@ -273,8 +295,9 @@ func InsertGlobalMysqlData(tx *sql.Tx, name string, data map[string]interface{},
|
|
|
id := MysqlTool.InsertByTx(tx, name, data)
|
|
|
if id == -1 {
|
|
|
log.Info("插入数据异常", zap.String(name, mark))
|
|
|
- Alert(fmt.Sprintf("%s表 检测到异常数据同步,id:%s </br>", name, mark))
|
|
|
-
|
|
|
+ if config.Conf.Alarm.IsOpen {
|
|
|
+ Alert(fmt.Sprintf("%s表 检测到异常数据同步,id:%s </br>", name, mark))
|
|
|
+ }
|
|
|
}
|
|
|
return id
|
|
|
}
|