|
@@ -439,7 +439,8 @@ func AddOrUpdateEdbDataWithOpType(edbInfoId int, dataList []*models.EdbDataBaseW
|
|
|
err = mgodb.ModifyValueEdbDataValue(oldObj.EdbDataId, val, v.ModifyTime)
|
|
|
if err != nil {
|
|
|
err = fmt.Errorf("更新指标数据出错 error, %v", err)
|
|
|
- return
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}else if v.OpType == "delete" {
|
|
|
removeDateList = append(removeDateList, dataTime)
|
|
@@ -448,22 +449,21 @@ func AddOrUpdateEdbDataWithOpType(edbInfoId int, dataList []*models.EdbDataBaseW
|
|
|
// if err != nil {
|
|
|
// err = fmt.Errorf("删除指标数据出错 error, %v", err)
|
|
|
// return
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//遍历deletemap,找出需要删除的日期
|
|
|
- {
|
|
|
- removeNum := len(removeDateList)
|
|
|
- if removeNum > 0 {
|
|
|
- err = mgodb.DeleteEdbInfoDataByEdbInfoIdAndDateList(edbInfoId, removeDateList)
|
|
|
- if err != nil {
|
|
|
- err = fmt.Errorf("删除多余日期失败,error, %v", err)
|
|
|
- return
|
|
|
- }
|
|
|
+
|
|
|
+ removeNum := len(removeDateList)
|
|
|
+ if removeNum > 0 {
|
|
|
+ err = mgodb.DeleteEdbInfoDataByEdbInfoIdAndDateList(edbInfoId, removeDateList)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("删除多余日期失败,error, %v", err)
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
|
|
|
if len(addList) > 0 {
|
|
|
err = mgodb.InsertEdbDataBatch(addList)
|
|
@@ -489,6 +489,10 @@ func AddOrUpdateEdbDataCalculateWithOpType(edbInfoId int, dataList []*models.Edb
|
|
|
return
|
|
|
}
|
|
|
existList, err := mgodb.GetEdbCalculateDataList(edbInfoId, minDataTimeT, maxDataTimeT)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("查询指标数据出错 error, %v", err)
|
|
|
+ return
|
|
|
+ }
|
|
|
existMap := make(map[string]*mgodb.EdbDataBase, len(existList))
|
|
|
removeDateList := make([]time.Time, 0)
|
|
|
for _, exist := range existList {
|
|
@@ -544,16 +548,15 @@ func AddOrUpdateEdbDataCalculateWithOpType(edbInfoId int, dataList []*models.Edb
|
|
|
}
|
|
|
}
|
|
|
//遍历deleteMap,找出需要删除的日期
|
|
|
- {
|
|
|
- removeNum := len(removeDateList)
|
|
|
- if removeNum > 0 {
|
|
|
- err = mgodb.DeleteEdbCalculateDataByEdbInfoIdAndDateList(edbInfoId, removeDateList)
|
|
|
- if err != nil {
|
|
|
- err = fmt.Errorf("删除多余日期失败,error, %v", err)
|
|
|
- return
|
|
|
- }
|
|
|
+ removeNum := len(removeDateList)
|
|
|
+ if removeNum > 0 {
|
|
|
+ err = mgodb.DeleteEdbCalculateDataByEdbInfoIdAndDateList(edbInfoId, removeDateList)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("删除多余日期失败,error, %v", err)
|
|
|
+ return
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if len(addList) > 0 {
|
|
|
err = mgodb.InsertEdbCalculateDataBatch(addList)
|
|
|
}
|