|
@@ -60,6 +60,14 @@ func AddOrUpdateEdbData(edbCode string, dataList []*models.EdbDataBase) (err err
|
|
|
DataTimestamp: v.DataTimestamp,
|
|
|
}
|
|
|
addList = append(addList, tmp)
|
|
|
+ if len(addList) >= 500 {
|
|
|
+ err = mgodb.InsertEdbDataBatch(addList)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("批量新增指标数据失败 error, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ addList = make([]interface{}, 0)
|
|
|
+ }
|
|
|
} else {
|
|
|
if val != oldObj.Value {
|
|
|
err = mgodb.ModifyValueEdbDataValue(oldObj.EdbDataId, val)
|
|
@@ -110,6 +118,14 @@ func AddOrUpdateEdbDataCalculate(edbCode string, dataList []*models.EdbDataBase)
|
|
|
DataTimestamp: v.DataTimestamp,
|
|
|
}
|
|
|
addList = append(addList, tmp)
|
|
|
+ if len(addList) >= 500 {
|
|
|
+ err = mgodb.InsertEdbCalculateDataBatch(addList)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("批量新增指标数据失败 error, %v", e)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ addList = make([]interface{}, 0)
|
|
|
+ }
|
|
|
} else {
|
|
|
if val != oldObj.Value {
|
|
|
err = mgodb.ModifyValueEdbCalculateDataValue(oldObj.EdbDataId, val)
|