|
@@ -136,6 +136,7 @@ func handleUsdaFasIndex(req *models.HandleUsdaFasExcelData, terminalCode string,
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
+ oldIndexObj := item
|
|
|
if item != nil && item.BaseFromUsdaFasIndexId > 0 {
|
|
|
fmt.Println("item:", item)
|
|
|
isAdd = 2
|
|
@@ -191,11 +192,13 @@ func handleUsdaFasIndex(req *models.HandleUsdaFasExcelData, terminalCode string,
|
|
|
updateColsArr = append(updateColsArr, "frequency")
|
|
|
updateColsArr = append(updateColsArr, "sort")
|
|
|
updateColsArr = append(updateColsArr, "modify_time")
|
|
|
-
|
|
|
- e := indexObj.Update(updateColsArr)
|
|
|
- if e != nil {
|
|
|
- fmt.Println("Index Update Err:" + e.Error())
|
|
|
- return
|
|
|
+ // 指标数据有变化才更新
|
|
|
+ if oldIndexObj.IndexName != indexName || oldIndexObj.ClassifyId != classifyId || oldIndexObj.Country != req.Country || oldIndexObj.Commodity != req.Commodity || oldIndexObj.Frequency != req.Frequency || oldIndexObj.Sort != req.Sort {
|
|
|
+ e := indexObj.Update(updateColsArr)
|
|
|
+ if e != nil {
|
|
|
+ fmt.Println("Index Update Err:" + e.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -287,7 +290,14 @@ func handleUsdaFasIndex(req *models.HandleUsdaFasExcelData, terminalCode string,
|
|
|
}
|
|
|
|
|
|
go func() {
|
|
|
- indexObj.ModifyIndexMaxAndMinDate(indexCode, dateItem)
|
|
|
+ if isAdd == 2 && oldIndexObj != nil && oldIndexObj.BaseFromUsdaFasIndexId > 0 {
|
|
|
+ // 判断指标数据是否有变更
|
|
|
+ if oldIndexObj.StartDate != dateItem.MinDate || oldIndexObj.EndDate != dateItem.MaxDate || oldIndexObj.EndValue != dateItem.LatestValue {
|
|
|
+ indexObj.ModifyIndexMaxAndMinDate(indexCode, dateItem)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ indexObj.ModifyIndexMaxAndMinDate(indexCode, dateItem)
|
|
|
+ }
|
|
|
}()
|
|
|
|
|
|
// 同步刷新ETA指标库的指标
|