|
@@ -15,47 +15,51 @@ import (
|
|
"hongze/hongze_yb/utils"
|
|
"hongze/hongze_yb/utils"
|
|
"sort"
|
|
"sort"
|
|
"strconv"
|
|
"strconv"
|
|
|
|
+ "strings"
|
|
"time"
|
|
"time"
|
|
)
|
|
)
|
|
|
|
|
|
// GetChartEdbData 获取图表的指标数据
|
|
// GetChartEdbData 获取图表的指标数据
|
|
-func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping, futureGoodEdbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList, barChartInfoDateList []request.BarChartInfoDateReq) (barConfigEdbInfoIdList []request.BarChartInfoEdbItemReq, edbList []*chartEdbMappingModel.ChartEdbInfoMappingList, xEdbIdValue []int, xDataList []chart_info.XData, yDataList []chart_info.YData, sourceArr []string, err error) {
|
|
|
|
|
|
+func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapping *chartEdbMappingModel.ChartEdbInfoMapping, edbInfoMappingList []*chartEdbMappingModel.ChartEdbInfoMappingList, futureGoodEdbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList, barChartInfoConf request.FutureGoodBarChartInfoReq, needData bool) (barConfigEdbInfoIdList []request.BarChartInfoEdbItemReq, edbList []*chartEdbMappingModel.ChartEdbInfoMappingList, xEdbIdValue []int, xDataList []request.XData, yDataList []chart_info.YData, sourceArr []string, err error) {
|
|
edbList = make([]*chartEdbMappingModel.ChartEdbInfoMappingList, 0)
|
|
edbList = make([]*chartEdbMappingModel.ChartEdbInfoMappingList, 0)
|
|
-
|
|
|
|
- sourceArr = make([]string, 0)
|
|
|
|
|
|
+ barChartInfoDateList := barChartInfoConf.DateList
|
|
if futureGoodEdbInfoMapping == nil {
|
|
if futureGoodEdbInfoMapping == nil {
|
|
err = errors.New("商品指标未选取")
|
|
err = errors.New("商品指标未选取")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- if edbInfoMapping == nil {
|
|
|
|
|
|
+ if len(edbInfoMappingList) == 0 {
|
|
err = errors.New("ETA指标未选取")
|
|
err = errors.New("ETA指标未选取")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
// 指标对应的所有数据
|
|
// 指标对应的所有数据
|
|
edbDataListMap := make(map[int][]*edbDataModel.EdbDataList)
|
|
edbDataListMap := make(map[int][]*edbDataModel.EdbDataList)
|
|
|
|
|
|
- item := new(chartEdbMappingModel.ChartEdbInfoMappingList)
|
|
|
|
- edbInfoMapping.FrequencyEn = chart.GetFrequencyEn(edbInfoMapping.Frequency)
|
|
|
|
|
|
+ // todo item
|
|
|
|
+ //item := new(chartEdbMappingModel.ChartEdbInfoMappingList)
|
|
|
|
|
|
- if edbInfoMapping.Unit == `无` {
|
|
|
|
- edbInfoMapping.Unit = ``
|
|
|
|
- }
|
|
|
|
if futureGoodEdbInfoMapping.Unit == `无` {
|
|
if futureGoodEdbInfoMapping.Unit == `无` {
|
|
futureGoodEdbInfoMapping.Unit = ``
|
|
futureGoodEdbInfoMapping.Unit = ``
|
|
}
|
|
}
|
|
|
|
|
|
if chartInfoId <= 0 {
|
|
if chartInfoId <= 0 {
|
|
- edbInfoMapping.IsAxis = 1
|
|
|
|
- edbInfoMapping.LeadValue = 0
|
|
|
|
- edbInfoMapping.LeadUnit = ""
|
|
|
|
- edbInfoMapping.ChartEdbMappingId = 0
|
|
|
|
- edbInfoMapping.ChartInfoId = 0
|
|
|
|
- edbInfoMapping.IsOrder = false
|
|
|
|
- edbInfoMapping.EdbInfoType = 1
|
|
|
|
- edbInfoMapping.ChartStyle = ""
|
|
|
|
- edbInfoMapping.ChartColor = ""
|
|
|
|
- edbInfoMapping.ChartWidth = 0
|
|
|
|
-
|
|
|
|
|
|
+ for k, edbInfoMapping := range edbInfoMappingList {
|
|
|
|
+ edbInfoMapping.FrequencyEn = chart.GetFrequencyEn(edbInfoMapping.Frequency)
|
|
|
|
+ if edbInfoMapping.Unit == `无` {
|
|
|
|
+ edbInfoMapping.Unit = ``
|
|
|
|
+ }
|
|
|
|
+ edbInfoMapping.IsAxis = 1
|
|
|
|
+ edbInfoMapping.LeadValue = 0
|
|
|
|
+ edbInfoMapping.LeadUnit = ""
|
|
|
|
+ edbInfoMapping.ChartEdbMappingId = 0
|
|
|
|
+ edbInfoMapping.ChartInfoId = 0
|
|
|
|
+ edbInfoMapping.IsOrder = false
|
|
|
|
+ edbInfoMapping.EdbInfoType = 1
|
|
|
|
+ edbInfoMapping.ChartStyle = ""
|
|
|
|
+ edbInfoMapping.ChartColor = ""
|
|
|
|
+ edbInfoMapping.ChartWidth = 0
|
|
|
|
+ edbInfoMappingList[k] = edbInfoMapping
|
|
|
|
+ }
|
|
futureGoodEdbInfoMapping.IsAxis = 1
|
|
futureGoodEdbInfoMapping.IsAxis = 1
|
|
futureGoodEdbInfoMapping.LeadValue = 0
|
|
futureGoodEdbInfoMapping.LeadValue = 0
|
|
futureGoodEdbInfoMapping.LeadUnit = ""
|
|
futureGoodEdbInfoMapping.LeadUnit = ""
|
|
@@ -67,37 +71,48 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
futureGoodEdbInfoMapping.ChartColor = ""
|
|
futureGoodEdbInfoMapping.ChartColor = ""
|
|
futureGoodEdbInfoMapping.ChartWidth = 0
|
|
futureGoodEdbInfoMapping.ChartWidth = 0
|
|
} else {
|
|
} else {
|
|
- edbInfoMapping.LeadUnitEn = chart.GetLeadUnitEn(edbInfoMapping.LeadUnit)
|
|
|
|
|
|
+ for k, edbInfoMapping := range edbInfoMappingList {
|
|
|
|
+ edbInfoMapping.FrequencyEn = chart.GetFrequencyEn(edbInfoMapping.Frequency)
|
|
|
|
+ if edbInfoMapping.Unit == `无` {
|
|
|
|
+ edbInfoMapping.Unit = ``
|
|
|
|
+ }
|
|
|
|
+ edbInfoMapping.LeadUnitEn = chart.GetLeadUnitEn(edbInfoMapping.LeadUnit)
|
|
|
|
+ edbInfoMappingList[k] = edbInfoMapping
|
|
|
|
+ }
|
|
futureGoodEdbInfoMapping.LeadUnitEn = chart.GetLeadUnitEn(futureGoodEdbInfoMapping.LeadUnit)
|
|
futureGoodEdbInfoMapping.LeadUnitEn = chart.GetLeadUnitEn(futureGoodEdbInfoMapping.LeadUnit)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //查询横轴配置项
|
|
|
|
+ xDataItemMap := make(map[int]request.XData)
|
|
|
|
+ for k, v := range barChartInfoConf.XDataList {
|
|
|
|
+ xDataItemMap[k] = v
|
|
|
|
+ }
|
|
|
|
+
|
|
// 普通的指标数据
|
|
// 普通的指标数据
|
|
{
|
|
{
|
|
- dataList := make([]*edbDataModel.EdbDataList, 0)
|
|
|
|
-
|
|
|
|
- dataList, err = edbDataModel.GetEdbDataList(edbInfoMapping.Source, edbInfoMapping.SubSource, edbInfoMapping.EdbInfoId, startDate, endDate)
|
|
|
|
- edbDataListMap[edbInfoMapping.EdbInfoId] = dataList
|
|
|
|
- item.DataList = dataList
|
|
|
|
-
|
|
|
|
- edbList = append(edbList, edbInfoMapping)
|
|
|
|
-
|
|
|
|
- barConfigEdbInfoIdList = append(barConfigEdbInfoIdList, request.BarChartInfoEdbItemReq{
|
|
|
|
- EdbInfoId: edbInfoMapping.EdbInfoId,
|
|
|
|
- //Name: edbInfoMapping.EdbName,
|
|
|
|
- Name: "现货价",
|
|
|
|
- NameEn: "Spot Price",
|
|
|
|
- Source: edbInfoMapping.Source,
|
|
|
|
- })
|
|
|
|
-
|
|
|
|
- if !utils.InArray(edbInfoMapping.Source, utils.SystemSourceList) { //来源于系统的指标,都展示为弘则研究
|
|
|
|
- if !utils.InArray(edbInfoMapping.SourceName, sourceArr) {
|
|
|
|
- sourceArr = append(sourceArr, edbInfoMapping.SourceName)
|
|
|
|
|
|
+ edbList = edbInfoMappingList
|
|
|
|
+
|
|
|
|
+ for k, edbInfoMapping := range edbInfoMappingList {
|
|
|
|
+ tmp := request.BarChartInfoEdbItemReq{
|
|
|
|
+ EdbInfoId: edbInfoMapping.EdbInfoId,
|
|
|
|
+ Name: edbInfoMapping.EdbName,
|
|
|
|
+ NameEn: edbInfoMapping.EdbNameEn,
|
|
|
|
+ Source: edbInfoMapping.Source,
|
|
|
|
+ }
|
|
|
|
+ // 如果有配置,则用配置中的指标名称替换
|
|
|
|
+ xItem, ok := xDataItemMap[k]
|
|
|
|
+ if ok && xItem.Name != "" {
|
|
|
|
+ tmp.Name = xItem.Name
|
|
|
|
+ tmp.NameEn = xItem.NameEn
|
|
|
|
+ tmp.IsHide = xItem.IsHide
|
|
}
|
|
}
|
|
|
|
+ barConfigEdbInfoIdList = append(barConfigEdbInfoIdList, tmp)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
// 获取主力合约和最新日期
|
|
// 获取主力合约和最新日期
|
|
var zlFutureGoodEdbInfo *future_good_edb_info.FutureGoodEdbInfo
|
|
var zlFutureGoodEdbInfo *future_good_edb_info.FutureGoodEdbInfo
|
|
|
|
+
|
|
var latestDate string // 最新日期是这个
|
|
var latestDate string // 最新日期是这个
|
|
var regionType string // 交易所来源:“国内”,“海外”
|
|
var regionType string // 交易所来源:“国内”,“海外”
|
|
var futureGoodEdbType int
|
|
var futureGoodEdbType int
|
|
@@ -108,11 +123,11 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
return
|
|
return
|
|
}
|
|
}
|
|
regionType = zlFutureGoodEdbInfo.RegionType
|
|
regionType = zlFutureGoodEdbInfo.RegionType
|
|
- futureGoodEdbType = int(zlFutureGoodEdbInfo.FutureGoodEdbType)
|
|
|
|
|
|
+ futureGoodEdbType = zlFutureGoodEdbInfo.FutureGoodEdbType
|
|
|
|
|
|
// 如果当前合约配置的 "画图时,日期来源的指标id" 并不是自己的话,那么就去查找对应配置的合约
|
|
// 如果当前合约配置的 "画图时,日期来源的指标id" 并不是自己的话,那么就去查找对应配置的合约
|
|
- if uint64(zlFutureGoodEdbInfo.DateSourceID) != zlFutureGoodEdbInfo.FutureGoodEdbInfoID {
|
|
|
|
- sourceDateFutureGoodEdbInfo, tmpErr := future_good_edb_info.GetFutureGoodEdbInfo(int(zlFutureGoodEdbInfo.DateSourceID))
|
|
|
|
|
|
+ if zlFutureGoodEdbInfo.DateSourceID != zlFutureGoodEdbInfo.FutureGoodEdbInfoID {
|
|
|
|
+ sourceDateFutureGoodEdbInfo, tmpErr := future_good_edb_info.GetFutureGoodEdbInfo(zlFutureGoodEdbInfo.DateSourceID)
|
|
if tmpErr != nil {
|
|
if tmpErr != nil {
|
|
err = tmpErr
|
|
err = tmpErr
|
|
return
|
|
return
|
|
@@ -141,70 +156,168 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
|
|
|
|
futureGoodMappingList := make([]*chartEdbMappingModel.ChartEdbInfoMappingList, 0)
|
|
futureGoodMappingList := make([]*chartEdbMappingModel.ChartEdbInfoMappingList, 0)
|
|
for k, v := range futureGoodEdbInfoList {
|
|
for k, v := range futureGoodEdbInfoList {
|
|
|
|
+ tmp1 := chartEdbMappingModel.ChartEdbInfoMapping{
|
|
|
|
+ EdbInfoId: v.FutureGoodEdbInfoID,
|
|
|
|
+ SourceName: v.Exchange,
|
|
|
|
+ Source: 0,
|
|
|
|
+ EdbCode: v.FutureGoodEdbCode,
|
|
|
|
+ EdbName: v.FutureGoodEdbName,
|
|
|
|
+ EdbAliasName: v.FutureGoodEdbName,
|
|
|
|
+ EdbNameEn: v.FutureGoodEdbNameEn,
|
|
|
|
+ EdbType: baseEdbInfoMapping.EdbType, //todo baseEdbInfoMapping
|
|
|
|
+ Frequency: baseEdbInfoMapping.Frequency,
|
|
|
|
+ FrequencyEn: baseEdbInfoMapping.FrequencyEn,
|
|
|
|
+ Unit: baseEdbInfoMapping.Unit,
|
|
|
|
+ UnitEn: baseEdbInfoMapping.UnitEn,
|
|
|
|
+ StartDate: v.StartDate.Format(utils.FormatDate),
|
|
|
|
+ EndDate: v.EndDate.Format(utils.FormatDate),
|
|
|
|
+ ModifyTime: v.ModifyTime.Format(utils.FormatDateTime),
|
|
|
|
+ ChartEdbMappingId: v.FutureGoodEdbInfoID,
|
|
|
|
+ ChartInfoId: baseEdbInfoMapping.ChartInfoId,
|
|
|
|
+ MaxData: v.MaxValue,
|
|
|
|
+ MinData: v.MinValue,
|
|
|
|
+ IsOrder: baseEdbInfoMapping.IsOrder,
|
|
|
|
+ IsAxis: baseEdbInfoMapping.IsAxis,
|
|
|
|
+ EdbInfoType: baseEdbInfoMapping.EdbInfoType,
|
|
|
|
+ EdbInfoCategoryType: baseEdbInfoMapping.EdbInfoCategoryType,
|
|
|
|
+ LeadValue: baseEdbInfoMapping.LeadValue,
|
|
|
|
+ LeadUnit: baseEdbInfoMapping.LeadUnit,
|
|
|
|
+ LeadUnitEn: baseEdbInfoMapping.LeadUnitEn,
|
|
|
|
+ ChartStyle: baseEdbInfoMapping.ChartStyle,
|
|
|
|
+ ChartColor: baseEdbInfoMapping.ChartColor,
|
|
|
|
+ PredictChartColor: baseEdbInfoMapping.PredictChartColor,
|
|
|
|
+ ChartWidth: baseEdbInfoMapping.ChartWidth,
|
|
|
|
+ ChartType: baseEdbInfoMapping.ChartType,
|
|
|
|
+ LatestDate: v.LatestDate,
|
|
|
|
+ LatestValue: v.LatestValue,
|
|
|
|
+ UniqueCode: futureGoodEdbInfoMapping.UniqueCode + strconv.Itoa(k),
|
|
|
|
+ MinValue: v.MinValue,
|
|
|
|
+ MaxValue: v.MaxValue,
|
|
|
|
+ }
|
|
newMappingInfo := &chartEdbMappingModel.ChartEdbInfoMappingList{
|
|
newMappingInfo := &chartEdbMappingModel.ChartEdbInfoMappingList{
|
|
- ChartEdbInfoMapping: chartEdbMappingModel.ChartEdbInfoMapping{
|
|
|
|
- EdbInfoId: int(v.FutureGoodEdbInfoID),
|
|
|
|
- SourceName: v.Exchange,
|
|
|
|
- Source: utils.CHART_SOURCE_FUTURE_GOOD,
|
|
|
|
- EdbCode: v.FutureGoodEdbCode,
|
|
|
|
- EdbName: v.FutureGoodEdbName,
|
|
|
|
- EdbAliasName: v.FutureGoodEdbName,
|
|
|
|
- EdbNameEn: v.FutureGoodEdbNameEn,
|
|
|
|
- EdbType: edbInfoMapping.EdbType,
|
|
|
|
- Frequency: edbInfoMapping.Frequency,
|
|
|
|
- FrequencyEn: edbInfoMapping.FrequencyEn,
|
|
|
|
- Unit: edbInfoMapping.Unit,
|
|
|
|
- UnitEn: edbInfoMapping.UnitEn,
|
|
|
|
- StartDate: v.StartDate.Format(utils.FormatDateTime),
|
|
|
|
- EndDate: v.EndDate.Format(utils.FormatDateTime),
|
|
|
|
- ModifyTime: v.ModifyTime.Format(utils.FormatDateTime),
|
|
|
|
- ChartEdbMappingId: int(v.FutureGoodEdbInfoID),
|
|
|
|
- ChartInfoId: edbInfoMapping.ChartInfoId,
|
|
|
|
- MaxData: v.MaxValue,
|
|
|
|
- MinData: v.MinValue,
|
|
|
|
- IsOrder: edbInfoMapping.IsOrder,
|
|
|
|
- IsAxis: edbInfoMapping.IsAxis,
|
|
|
|
- EdbInfoType: edbInfoMapping.EdbInfoType,
|
|
|
|
- EdbInfoCategoryType: edbInfoMapping.EdbInfoCategoryType,
|
|
|
|
- LeadValue: edbInfoMapping.LeadValue,
|
|
|
|
- LeadUnit: edbInfoMapping.LeadUnit,
|
|
|
|
- LeadUnitEn: edbInfoMapping.LeadUnitEn,
|
|
|
|
- ChartStyle: edbInfoMapping.ChartStyle,
|
|
|
|
- ChartColor: edbInfoMapping.ChartColor,
|
|
|
|
- PredictChartColor: edbInfoMapping.PredictChartColor,
|
|
|
|
- ChartWidth: edbInfoMapping.ChartWidth,
|
|
|
|
- ChartType: edbInfoMapping.ChartType,
|
|
|
|
- LatestDate: v.LatestDate,
|
|
|
|
- LatestValue: v.LatestValue,
|
|
|
|
- UniqueCode: futureGoodEdbInfoMapping.UniqueCode + "1" + strconv.Itoa(k),
|
|
|
|
- MinValue: v.MinValue,
|
|
|
|
- MaxValue: v.MaxValue,
|
|
|
|
- },
|
|
|
|
- DataList: nil,
|
|
|
|
- IsNullData: false,
|
|
|
|
|
|
+ ChartEdbInfoMapping: tmp1,
|
|
|
|
+ DataList: nil,
|
|
|
|
+ IsNullData: false,
|
|
}
|
|
}
|
|
futureGoodMappingList = append(futureGoodMappingList, newMappingInfo)
|
|
futureGoodMappingList = append(futureGoodMappingList, newMappingInfo)
|
|
|
|
|
|
- barConfigEdbInfoIdList = append(barConfigEdbInfoIdList, request.BarChartInfoEdbItemReq{
|
|
|
|
|
|
+ tmp := request.BarChartInfoEdbItemReq{
|
|
EdbInfoId: newMappingInfo.EdbInfoId,
|
|
EdbInfoId: newMappingInfo.EdbInfoId,
|
|
Name: fmt.Sprint("M+", v.Month),
|
|
Name: fmt.Sprint("M+", v.Month),
|
|
NameEn: fmt.Sprint("M+", v.Month),
|
|
NameEn: fmt.Sprint("M+", v.Month),
|
|
Source: newMappingInfo.Source,
|
|
Source: newMappingInfo.Source,
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+ // 判断如果有配置,需要替换为配置内容
|
|
|
|
+ xItem, ok := xDataItemMap[k]
|
|
|
|
+ if ok && xItem.Name != "" {
|
|
|
|
+ tmp.Name = xItem.Name
|
|
|
|
+ tmp.NameEn = xItem.NameEn
|
|
|
|
+ tmp.IsHide = xItem.IsHide
|
|
|
|
+ }
|
|
|
|
+ barConfigEdbInfoIdList = append(barConfigEdbInfoIdList, tmp)
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if regionType == `海外` {
|
|
|
|
+ zlTmp := chartEdbMappingModel.ChartEdbInfoMapping{
|
|
|
|
+ EdbInfoId: zlFutureGoodEdbInfo.FutureGoodEdbInfoID,
|
|
|
|
+ SourceName: zlFutureGoodEdbInfo.Exchange,
|
|
|
|
+ Source: 0,
|
|
|
|
+ EdbCode: zlFutureGoodEdbInfo.FutureGoodEdbCode,
|
|
|
|
+ EdbName: zlFutureGoodEdbInfo.FutureGoodEdbName,
|
|
|
|
+ EdbAliasName: zlFutureGoodEdbInfo.FutureGoodEdbName,
|
|
|
|
+ EdbNameEn: zlFutureGoodEdbInfo.FutureGoodEdbNameEn,
|
|
|
|
+ EdbType: baseEdbInfoMapping.EdbType,
|
|
|
|
+ Frequency: baseEdbInfoMapping.Frequency,
|
|
|
|
+ FrequencyEn: baseEdbInfoMapping.FrequencyEn,
|
|
|
|
+ Unit: baseEdbInfoMapping.Unit,
|
|
|
|
+ UnitEn: baseEdbInfoMapping.UnitEn,
|
|
|
|
+ StartDate: zlFutureGoodEdbInfo.StartDate.Format(utils.FormatDate),
|
|
|
|
+ EndDate: zlFutureGoodEdbInfo.EndDate.Format(utils.FormatDate),
|
|
|
|
+ ModifyTime: zlFutureGoodEdbInfo.ModifyTime.Format(utils.FormatDateTime),
|
|
|
|
+ ChartEdbMappingId: zlFutureGoodEdbInfo.FutureGoodEdbInfoID,
|
|
|
|
+ ChartInfoId: baseEdbInfoMapping.ChartInfoId,
|
|
|
|
+ MaxData: zlFutureGoodEdbInfo.MaxValue,
|
|
|
|
+ MinData: zlFutureGoodEdbInfo.MinValue,
|
|
|
|
+ IsOrder: baseEdbInfoMapping.IsOrder,
|
|
|
|
+ IsAxis: baseEdbInfoMapping.IsAxis,
|
|
|
|
+ EdbInfoType: baseEdbInfoMapping.EdbInfoType,
|
|
|
|
+ EdbInfoCategoryType: baseEdbInfoMapping.EdbInfoCategoryType,
|
|
|
|
+ LeadValue: baseEdbInfoMapping.LeadValue,
|
|
|
|
+ LeadUnit: baseEdbInfoMapping.LeadUnit,
|
|
|
|
+ LeadUnitEn: baseEdbInfoMapping.LeadUnitEn,
|
|
|
|
+ ChartStyle: baseEdbInfoMapping.ChartStyle,
|
|
|
|
+ ChartColor: baseEdbInfoMapping.ChartColor,
|
|
|
|
+ PredictChartColor: baseEdbInfoMapping.PredictChartColor,
|
|
|
|
+ ChartWidth: baseEdbInfoMapping.ChartWidth,
|
|
|
|
+ ChartType: baseEdbInfoMapping.ChartType,
|
|
|
|
+ LatestDate: zlFutureGoodEdbInfo.LatestDate,
|
|
|
|
+ LatestValue: zlFutureGoodEdbInfo.LatestValue,
|
|
|
|
+ UniqueCode: futureGoodEdbInfoMapping.UniqueCode + strconv.Itoa(0),
|
|
|
|
+ MinValue: zlFutureGoodEdbInfo.MinValue,
|
|
|
|
+ MaxValue: zlFutureGoodEdbInfo.MaxValue,
|
|
|
|
+ }
|
|
|
|
+ zlFutureGoodEdbMapping := &chartEdbMappingModel.ChartEdbInfoMappingList{
|
|
|
|
+ ChartEdbInfoMapping: zlTmp,
|
|
|
|
+ DataList: nil,
|
|
|
|
+ IsNullData: false,
|
|
|
|
+ }
|
|
|
|
+ edbList = append(edbList, zlFutureGoodEdbMapping)
|
|
|
|
+ edbList = append(edbList, futureGoodMappingList...)
|
|
|
|
+ } else {
|
|
|
|
+ edbList = append(edbList, futureGoodMappingList...)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if !needData {
|
|
|
|
+ return
|
|
}
|
|
}
|
|
|
|
|
|
// 获取数据
|
|
// 获取数据
|
|
- for _, v := range futureGoodMappingList {
|
|
|
|
|
|
+
|
|
|
|
+ // 现货数据
|
|
|
|
+ for _, edbInfoMapping := range edbInfoMappingList {
|
|
dataList := make([]*edbDataModel.EdbDataList, 0)
|
|
dataList := make([]*edbDataModel.EdbDataList, 0)
|
|
|
|
+ dataList, err = edbDataModel.GetEdbDataList(edbInfoMapping.Source, edbInfoMapping.SubSource, edbInfoMapping.EdbInfoId, startDate, endDate)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ edbDataListMap[edbInfoMapping.EdbInfoId] = dataList
|
|
|
|
+ // todo item
|
|
|
|
+ //item.DataList = dataList
|
|
|
|
+ }
|
|
|
|
|
|
- tmpDataList, tmpErr := future_good_edb_data.GetFutureGoodEdbDataListByDate(v.EdbInfoId, startDate, endDate)
|
|
|
|
|
|
+ futureEdbInfoIds := make([]int, 0)
|
|
|
|
+ for _, v := range futureGoodMappingList {
|
|
|
|
+ futureEdbInfoIds = append(futureEdbInfoIds, v.EdbInfoId)
|
|
|
|
+ }
|
|
|
|
+ tmpDataListMap := make(map[int][]*future_good_edb_data.FutureGoodEdbData)
|
|
|
|
+ if len(futureEdbInfoIds) > 0 {
|
|
|
|
+ // 期货数据
|
|
|
|
+ tmpDataList, tmpErr := future_good_edb_data.GetFutureGoodEdbDataListByIdsAndDate(futureEdbInfoIds, startDate, endDate)
|
|
if tmpErr != nil {
|
|
if tmpErr != nil {
|
|
|
|
+ err = tmpErr
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for _, v := range tmpDataList {
|
|
|
|
+ if _, ok := tmpDataListMap[v.FutureGoodEdbInfoID]; !ok {
|
|
|
|
+ tmpDataListMap[v.FutureGoodEdbInfoID] = make([]*future_good_edb_data.FutureGoodEdbData, 0)
|
|
|
|
+ }
|
|
|
|
+ tmpDataListMap[v.FutureGoodEdbInfoID] = append(tmpDataListMap[v.FutureGoodEdbInfoID], v)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ // 期货数据
|
|
|
|
+ for _, v := range futureGoodMappingList {
|
|
|
|
+ dataList := make([]*edbDataModel.EdbDataList, 0)
|
|
|
|
+ tmpDataList, ok := tmpDataListMap[v.EdbInfoId]
|
|
|
|
+ if !ok {
|
|
|
|
+ err = fmt.Errorf("期货数据不存在 FutureGoodEdbInfoId: %d", v.EdbInfoId)
|
|
return
|
|
return
|
|
}
|
|
}
|
|
for _, tmpData := range tmpDataList {
|
|
for _, tmpData := range tmpDataList {
|
|
dataList = append(dataList, &edbDataModel.EdbDataList{
|
|
dataList = append(dataList, &edbDataModel.EdbDataList{
|
|
- EdbDataId: int(tmpData.FutureGoodEdbDataID),
|
|
|
|
- EdbInfoId: int(tmpData.FutureGoodEdbInfoID),
|
|
|
|
|
|
+ EdbDataId: tmpData.FutureGoodEdbDataID,
|
|
|
|
+ EdbInfoId: tmpData.FutureGoodEdbInfoID,
|
|
DataTime: tmpData.DataTime.Format(utils.FormatDate),
|
|
DataTime: tmpData.DataTime.Format(utils.FormatDate),
|
|
DataTimestamp: tmpData.DataTimestamp,
|
|
DataTimestamp: tmpData.DataTimestamp,
|
|
Value: tmpData.Close,
|
|
Value: tmpData.Close,
|
|
@@ -214,16 +327,25 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
v.DataList = dataList
|
|
v.DataList = dataList
|
|
}
|
|
}
|
|
|
|
|
|
- edbList = append(edbList, futureGoodMappingList...)
|
|
|
|
|
|
+ // 特殊处理日期
|
|
|
|
+ // 因为时间格式是:2023-07-19T00:00:00+08:00;所以需要分开
|
|
|
|
+ baseEndDateTime := strings.Split(baseEdbInfoMapping.EndDate, "T")
|
|
|
|
+ baseEndDate := baseEndDateTime[0]
|
|
|
|
|
|
- xEdbIdValue, yDataList, err = BarChartData(edbList[0], futureGoodEdbInfoList, edbDataListMap, barChartInfoDateList, regionType, edbInfoMapping.EndDate)
|
|
|
|
|
|
+ xEdbIdValue, yDataList, err = BarChartData(baseEdbInfoMapping, edbInfoMappingList, futureGoodEdbInfoList, edbDataListMap, barChartInfoDateList, regionType, baseEndDate)
|
|
|
|
|
|
- xDataList = []chart_info.XData{
|
|
|
|
- {
|
|
|
|
- Name: "现货价",
|
|
|
|
- NameEn: "Spot Price",
|
|
|
|
- },
|
|
|
|
|
|
+ if len(barChartInfoConf.XDataList) > 0 {
|
|
|
|
+ xDataList = barChartInfoConf.XDataList
|
|
|
|
+ } else {
|
|
|
|
+ for _, v := range edbInfoMappingList {
|
|
|
|
+ xDataList = append(xDataList, request.XData{
|
|
|
|
+ Name: v.EdbName,
|
|
|
|
+ NameEn: v.EdbNameEn,
|
|
|
|
+ IsHide: 0,
|
|
|
|
+ })
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
//yDataList =make([]chart_info.YData,0)
|
|
//yDataList =make([]chart_info.YData,0)
|
|
//chart_info.YData{
|
|
//chart_info.YData{
|
|
// Date: "",
|
|
// Date: "",
|
|
@@ -236,7 +358,7 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
//}
|
|
//}
|
|
futureGoodEdbInfoIndexMap := make(map[int]int)
|
|
futureGoodEdbInfoIndexMap := make(map[int]int)
|
|
for index, v := range futureGoodEdbInfoList {
|
|
for index, v := range futureGoodEdbInfoList {
|
|
- futureGoodEdbInfoIndexMap[int(v.FutureGoodEdbInfoID)] = index
|
|
|
|
|
|
+ futureGoodEdbInfoIndexMap[v.FutureGoodEdbInfoID] = index
|
|
}
|
|
}
|
|
nMap := make(map[int]int)
|
|
nMap := make(map[int]int)
|
|
maxIndex := 0 // 最大x轴的下标
|
|
maxIndex := 0 // 最大x轴的下标
|
|
@@ -253,19 +375,20 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
}
|
|
}
|
|
|
|
|
|
// 基础指标
|
|
// 基础指标
|
|
- {
|
|
|
|
- baseEdbInfId := edbList[0].EdbInfoId
|
|
|
|
- edbInfoIdList = append(edbInfoIdList, baseEdbInfId)
|
|
|
|
- tmpVal, ok := yDataMap[baseEdbInfId]
|
|
|
|
|
|
+ baseEdbIds := make([]int, 0)
|
|
|
|
+ for _, tmp := range edbInfoMappingList {
|
|
|
|
+ edbInfoIdList = append(edbInfoIdList, tmp.EdbInfoId)
|
|
|
|
+ baseEdbIds = append(baseEdbIds, tmp.EdbInfoId)
|
|
|
|
+ tmpVal, ok := yDataMap[tmp.EdbInfoId]
|
|
valueList = append(valueList, tmpVal)
|
|
valueList = append(valueList, tmpVal)
|
|
if !ok || tmpVal == 0 {
|
|
if !ok || tmpVal == 0 {
|
|
- noDataEdbInfoIdList = append(noDataEdbInfoIdList, baseEdbInfId)
|
|
|
|
- noDataEdbIdMap[baseEdbInfId] = baseEdbInfId
|
|
|
|
|
|
+ noDataEdbInfoIdList = append(noDataEdbInfoIdList, tmp.EdbInfoId)
|
|
|
|
+ noDataEdbIdMap[tmp.EdbInfoId] = tmp.EdbInfoId
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
for _, futureGoodEdbInfo := range futureGoodEdbInfoList {
|
|
for _, futureGoodEdbInfo := range futureGoodEdbInfoList {
|
|
- tmpEdbInfId := int(futureGoodEdbInfo.FutureGoodEdbInfoID)
|
|
|
|
|
|
+ tmpEdbInfId := futureGoodEdbInfo.FutureGoodEdbInfoID
|
|
edbInfoIdList = append(edbInfoIdList, tmpEdbInfId)
|
|
edbInfoIdList = append(edbInfoIdList, tmpEdbInfId)
|
|
tmpVal, ok := yDataMap[tmpEdbInfId]
|
|
tmpVal, ok := yDataMap[tmpEdbInfId]
|
|
valueList = append(valueList, tmpVal)
|
|
valueList = append(valueList, tmpVal)
|
|
@@ -283,7 +406,7 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
|
|
|
|
for i := lenEdbId - 1; i >= 0; i-- {
|
|
for i := lenEdbId - 1; i >= 0; i-- {
|
|
// 如果没有在无数据的指标列表中找到,那么就找到了最大x轴的下标
|
|
// 如果没有在无数据的指标列表中找到,那么就找到了最大x轴的下标
|
|
- if _, ok := noDataEdbIdMap[edbInfoIdList[i]]; !ok {
|
|
|
|
|
|
+ if _, ok := noDataEdbIdMap[edbInfoIdList[i]]; !ok || utils.InArrayByInt(baseEdbIds, edbInfoIdList[i]) {
|
|
// 如果最大x轴的下标 小于 当前下标,那么就重新赋值
|
|
// 如果最大x轴的下标 小于 当前下标,那么就重新赋值
|
|
if maxIndex < i-1 {
|
|
if maxIndex < i-1 {
|
|
maxIndex = i - 1
|
|
maxIndex = i - 1
|
|
@@ -319,34 +442,60 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, edbInfoMapping,
|
|
yDataList[k].Value = v.Value[0 : maxIndex+1]
|
|
yDataList[k].Value = v.Value[0 : maxIndex+1]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
- tmpXDataList, newYDataList, err := handleResultData(regionType, futureGoodEdbType, yDataList, futureGoodEdbInfoList, maxIndex)
|
|
|
|
|
|
+ baseEdbLen := len(edbInfoMappingList)
|
|
|
|
+ tmpXDataList, newYDataList, err := handleResultData(regionType, futureGoodEdbType, baseEdbLen, yDataList, futureGoodEdbInfoList, maxIndex)
|
|
if err != nil {
|
|
if err != nil {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- xDataList = append(xDataList, tmpXDataList...)
|
|
|
|
|
|
+ if len(barChartInfoConf.XDataList) == 0 {
|
|
|
|
+ xDataList = append(xDataList, tmpXDataList...)
|
|
|
|
+ }
|
|
|
|
+
|
|
yDataList = newYDataList
|
|
yDataList = newYDataList
|
|
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
// BarChartData 获取数据
|
|
// BarChartData 获取数据
|
|
-func BarChartData(edbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList, futureGoodMappingList []*future_good_edb_info.FutureGoodEdbInfo, edbDataListMap map[int][]*edbDataModel.EdbDataList, barChartInfoDateList []request.BarChartInfoDateReq, regionType, latestDate string) (edbIdList []int, yDataList []chart_info.YData, err error) {
|
|
|
|
|
|
+func BarChartData(baseEdbInfoMapping *chartEdbMappingModel.ChartEdbInfoMapping, edbInfoMappingList []*chartEdbMappingModel.ChartEdbInfoMappingList, futureGoodMappingList []*future_good_edb_info.FutureGoodEdbInfo, edbDataListMap map[int][]*edbDataModel.EdbDataList, barChartInfoDateList []request.BarChartInfoDateReq, regionType, latestDate string) (edbIdList []int, yDataList []chart_info.YData, err error) {
|
|
// 指标数据数组(10086:{"2022-12-02":100.01,"2022-12-01":102.3})
|
|
// 指标数据数组(10086:{"2022-12-02":100.01,"2022-12-01":102.3})
|
|
- edbDataMap := make(map[int]map[string]float64)
|
|
|
|
|
|
+ // 现货指标数据map
|
|
|
|
+ baseEdbDataMap := make(map[int]map[string]float64)
|
|
|
|
+ edbInfoMappingMap := make(map[int]struct{})
|
|
|
|
+ for _, v := range edbInfoMappingList {
|
|
|
|
+ edbInfoMappingMap[v.EdbInfoId] = struct{}{}
|
|
|
|
+ }
|
|
for edbInfoId, edbDataList := range edbDataListMap {
|
|
for edbInfoId, edbDataList := range edbDataListMap {
|
|
|
|
+ if _, ok1 := edbInfoMappingMap[edbInfoId]; ok1 {
|
|
|
|
+ edbDateData := make(map[string]float64)
|
|
|
|
+ for _, edbData := range edbDataList {
|
|
|
|
+ edbDateData[edbData.DataTime] = edbData.Value
|
|
|
|
+ }
|
|
|
|
+ baseEdbDataMap[edbInfoId] = edbDateData
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 期货指标数据map
|
|
|
|
+ futureGoodEdbDataMap := make(map[int]map[string]float64)
|
|
|
|
+ for edbInfoId, edbDataList := range edbDataListMap {
|
|
|
|
+ if _, ok := edbInfoMappingMap[edbInfoId]; ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
edbDateData := make(map[string]float64)
|
|
edbDateData := make(map[string]float64)
|
|
for _, edbData := range edbDataList {
|
|
for _, edbData := range edbDataList {
|
|
edbDateData[edbData.DataTime] = edbData.Value
|
|
edbDateData[edbData.DataTime] = edbData.Value
|
|
}
|
|
}
|
|
- edbDataMap[edbInfoId] = edbDateData
|
|
|
|
|
|
+ futureGoodEdbDataMap[edbInfoId] = edbDateData
|
|
}
|
|
}
|
|
|
|
|
|
// edbIdList 指标展示顺序;x轴的指标顺序
|
|
// edbIdList 指标展示顺序;x轴的指标顺序
|
|
edbIdList = make([]int, 0)
|
|
edbIdList = make([]int, 0)
|
|
- edbIdList = append(edbIdList, edbInfoMapping.EdbInfoId)
|
|
|
|
|
|
+ for _, v := range edbInfoMappingList {
|
|
|
|
+ edbIdList = append(edbIdList, v.EdbInfoId)
|
|
|
|
+ }
|
|
|
|
+
|
|
for _, v := range futureGoodMappingList {
|
|
for _, v := range futureGoodMappingList {
|
|
- edbIdList = append(edbIdList, int(v.FutureGoodEdbInfoID))
|
|
|
|
|
|
+ edbIdList = append(edbIdList, v.FutureGoodEdbInfoID)
|
|
}
|
|
}
|
|
|
|
|
|
latestDateTime, _ := time.ParseInLocation(utils.FormatDate, latestDate, time.Local)
|
|
latestDateTime, _ := time.ParseInLocation(utils.FormatDate, latestDate, time.Local)
|
|
@@ -385,23 +534,43 @@ func BarChartData(edbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList,
|
|
noDataIdMap := make(map[int]int, 0) // 没有数据的指标map
|
|
noDataIdMap := make(map[int]int, 0) // 没有数据的指标map
|
|
xEdbInfoIdList := make([]int, 0) // 当前数据的指标id列表
|
|
xEdbInfoIdList := make([]int, 0) // 当前数据的指标id列表
|
|
|
|
|
|
- // 现货指标
|
|
|
|
- realDateTime, findDataValue, isFind, tmpErr := GetNeedDateData(findDateTime, edbDataListMap[edbInfoMapping.EdbInfoId], edbDataMap[edbInfoMapping.EdbInfoId])
|
|
|
|
|
|
+ // 先找到基准日期
|
|
|
|
+ var realDateTime time.Time
|
|
|
|
+ realDateTime, findDataValue, isFind, tmpErr := GetNeedDateData(findDateTime, edbDataListMap[baseEdbInfoMapping.EdbInfoId], baseEdbDataMap[baseEdbInfoMapping.EdbInfoId], futureGoodEdbDataMap)
|
|
if tmpErr != nil {
|
|
if tmpErr != nil {
|
|
err = tmpErr
|
|
err = tmpErr
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- findDataList = append(findDataList, findDataValue)
|
|
|
|
- yDataMap[edbInfoMapping.EdbInfoId] = findDataValue
|
|
|
|
- if isFind {
|
|
|
|
- maxDate = realDateTime
|
|
|
|
- } else {
|
|
|
|
- noDataIdList = append(noDataIdList, edbInfoMapping.EdbInfoId)
|
|
|
|
- noDataIdMap[edbInfoMapping.EdbInfoId] = edbInfoMapping.EdbInfoId
|
|
|
|
|
|
+ // 处理其余现货指标
|
|
|
|
+ for _, v := range edbInfoMappingList {
|
|
|
|
+ if v.EdbInfoId == baseEdbInfoMapping.EdbInfoId {
|
|
|
|
+ findDataList = append(findDataList, findDataValue)
|
|
|
|
+ yDataMap[baseEdbInfoMapping.EdbInfoId] = findDataValue
|
|
|
|
+ if isFind {
|
|
|
|
+ maxDate = realDateTime
|
|
|
|
+ } else {
|
|
|
|
+ noDataIdList = append(noDataIdList, baseEdbInfoMapping.EdbInfoId)
|
|
|
|
+ noDataIdMap[baseEdbInfoMapping.EdbInfoId] = baseEdbInfoMapping.EdbInfoId
|
|
|
|
+ }
|
|
|
|
+ xEdbInfoIdList = append(xEdbInfoIdList, v.EdbInfoId)
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ findDataValueTmp, isFindTmp := baseEdbDataMap[v.EdbInfoId][realDateTime.Format(utils.FormatDate)]
|
|
|
|
+ findDataList = append(findDataList, findDataValueTmp)
|
|
|
|
+ yDataMap[v.EdbInfoId] = findDataValueTmp
|
|
|
|
+ if !isFindTmp {
|
|
|
|
+ noDataIdList = append(noDataIdList, v.EdbInfoId)
|
|
|
|
+ noDataIdMap[v.EdbInfoId] = v.EdbInfoId
|
|
|
|
+ }
|
|
|
|
+ xEdbInfoIdList = append(xEdbInfoIdList, v.EdbInfoId)
|
|
}
|
|
}
|
|
- currMonth := findDateTime.Month() // 当前月份
|
|
|
|
- currYear := findDateTime.Year() // 当前年份
|
|
|
|
- xEdbInfoIdList = append(xEdbInfoIdList, edbInfoMapping.EdbInfoId)
|
|
|
|
|
|
+ //currMonth := findDateTime.Month() // 当前月份
|
|
|
|
+ //currYear := findDateTime.Year() // 当前年份
|
|
|
|
+
|
|
|
|
+ // 用实际日期的月份作为基准,往前推12个月(2024-5-13 16:26:43修改)
|
|
|
|
+ currMonth := realDateTime.Month() // 当前月份
|
|
|
|
+ currYear := realDateTime.Year() // 当前年份
|
|
|
|
+
|
|
mList := make([]int, 0) // 间隔月份
|
|
mList := make([]int, 0) // 间隔月份
|
|
indexList := make([]int, 0)
|
|
indexList := make([]int, 0)
|
|
if regionType == `国内` {
|
|
if regionType == `国内` {
|
|
@@ -420,11 +589,11 @@ func BarChartData(edbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList,
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
indexList = append(indexList, i)
|
|
indexList = append(indexList, i)
|
|
- mList = append(mList, int(v.Month))
|
|
|
|
|
|
+ mList = append(mList, v.Month)
|
|
} else {
|
|
} else {
|
|
- if v.Year > currYear || (v.Year == currYear && int(v.Month) > int(currMonth)) {
|
|
|
|
|
|
+ if v.Year > currYear || (v.Year == currYear && v.Month > int(currMonth)) {
|
|
indexList = append(indexList, i)
|
|
indexList = append(indexList, i)
|
|
- mList = append(mList, (v.Year-currYear)*12+int(v.Month)-int(currMonth))
|
|
|
|
|
|
+ mList = append(mList, (v.Year-currYear)*12+v.Month-int(currMonth))
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -432,15 +601,15 @@ func BarChartData(edbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList,
|
|
|
|
|
|
for _, i := range indexList {
|
|
for _, i := range indexList {
|
|
futureGoodMapping := futureGoodMappingList[i] // 当前的期货指标
|
|
futureGoodMapping := futureGoodMappingList[i] // 当前的期货指标
|
|
- //tmpRealDateTime, tmpFindDataValue, tmpIsFind, tmpErr := GetNeedDateData(findDateTime, edbDataListMap[futureGoodMapping.FutureGoodEdbInfoId], edbDataMap[futureGoodMapping.FutureGoodEdbInfoId])
|
|
|
|
|
|
+ //tmpRealDateTime, tmpFindDataValue, tmpIsFind, tmpErr := GetNeedDateData(findDateTime, edbDataListMap[futureGoodMapping.FutureGoodEdbInfoID], edbDataMap[futureGoodMapping.FutureGoodEdbInfoID])
|
|
//if tmpErr != nil {
|
|
//if tmpErr != nil {
|
|
// err = tmpErr
|
|
// err = tmpErr
|
|
// return
|
|
// return
|
|
//}
|
|
//}
|
|
//tmpRealDateTime := findDateTime // 按照配置找到的日期
|
|
//tmpRealDateTime := findDateTime // 按照配置找到的日期
|
|
tmpRealDateTime := realDateTime // 实际现货的日期
|
|
tmpRealDateTime := realDateTime // 实际现货的日期
|
|
- tmpFindDataValue, tmpIsFind := edbDataMap[int(futureGoodMapping.FutureGoodEdbInfoID)][tmpRealDateTime.Format(utils.FormatDate)]
|
|
|
|
- yDataMap[int(futureGoodMapping.FutureGoodEdbInfoID)] = tmpFindDataValue
|
|
|
|
|
|
+ tmpFindDataValue, tmpIsFind := futureGoodEdbDataMap[futureGoodMapping.FutureGoodEdbInfoID][tmpRealDateTime.Format(utils.FormatDate)]
|
|
|
|
+ yDataMap[futureGoodMapping.FutureGoodEdbInfoID] = tmpFindDataValue
|
|
|
|
|
|
findDataList = append(findDataList, tmpFindDataValue)
|
|
findDataList = append(findDataList, tmpFindDataValue)
|
|
if tmpIsFind {
|
|
if tmpIsFind {
|
|
@@ -448,11 +617,11 @@ func BarChartData(edbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList,
|
|
maxDate = tmpRealDateTime
|
|
maxDate = tmpRealDateTime
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- noDataIdList = append(noDataIdList, int(futureGoodMapping.FutureGoodEdbInfoID))
|
|
|
|
- noDataIdMap[int(futureGoodMapping.FutureGoodEdbInfoID)] = int(futureGoodMapping.FutureGoodEdbInfoID)
|
|
|
|
|
|
+ noDataIdList = append(noDataIdList, futureGoodMapping.FutureGoodEdbInfoID)
|
|
|
|
+ noDataIdMap[futureGoodMapping.FutureGoodEdbInfoID] = futureGoodMapping.FutureGoodEdbInfoID
|
|
}
|
|
}
|
|
// 当前期货合约的指标
|
|
// 当前期货合约的指标
|
|
- xEdbInfoIdList = append(xEdbInfoIdList, int(futureGoodMapping.FutureGoodEdbInfoID))
|
|
|
|
|
|
+ xEdbInfoIdList = append(xEdbInfoIdList, futureGoodMapping.FutureGoodEdbInfoID)
|
|
}
|
|
}
|
|
|
|
|
|
yName := barChartInfoDate.Name
|
|
yName := barChartInfoDate.Name
|
|
@@ -520,86 +689,9 @@ func BarChartData(edbInfoMapping *chartEdbMappingModel.ChartEdbInfoMappingList,
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
-// GetNeedDateData 获取合约内需要的日期数据
|
|
|
|
-func GetNeedDateData(needDateTime time.Time, dataList []*edbDataModel.EdbDataList, edbDataMap map[string]float64) (findDateTime time.Time, findDataValue float64, isFind bool, err error) {
|
|
|
|
- //dataList := edbDataListMap[edbInfoId] //指标的所有数据值
|
|
|
|
- if len(dataList) <= 0 {
|
|
|
|
- // 没有数据的指标id
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- //最早的日期
|
|
|
|
- minDateTime, err := time.ParseInLocation(utils.FormatDate, dataList[0].DataTime, time.Local)
|
|
|
|
- if err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- for tmpDateTime := needDateTime; tmpDateTime.After(minDateTime) || tmpDateTime.Equal(minDateTime); tmpDateTime = tmpDateTime.AddDate(0, 0, -1) {
|
|
|
|
- tmpDate := tmpDateTime.Format(utils.FormatDate)
|
|
|
|
- if tmpValue, ok := edbDataMap[tmpDate]; ok { //如果能找到数据,那么就返回
|
|
|
|
- // 数据为0,也直接返回,做无值处理
|
|
|
|
- if tmpValue == 0 {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- findDateTime, _ = time.ParseInLocation(utils.FormatDate, tmpDate, time.Local)
|
|
|
|
- findDataValue = tmpValue
|
|
|
|
- isFind = true
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-// FutureGoodChartInfoRefresh
|
|
|
|
-// @author Roc
|
|
|
|
-// @datetime 2023-2-2 18:44:46
|
|
|
|
-// @description 商品价格曲线图表刷新
|
|
|
|
-func FutureGoodChartInfoRefresh(chartInfoId int) (err error) {
|
|
|
|
- var errMsg string
|
|
|
|
- defer func() {
|
|
|
|
- if err != nil {
|
|
|
|
- go alarm_msg.SendAlarmMsg("ChartInfoRefresh:"+errMsg, 3)
|
|
|
|
- fmt.Println("ChartInfoRefresh Err:" + errMsg)
|
|
|
|
- }
|
|
|
|
- }()
|
|
|
|
-
|
|
|
|
- edbInfoMapping, err := chartEdbMappingModel.GetEtaEdbChartEdbMapping(chartInfoId)
|
|
|
|
- if err != nil {
|
|
|
|
- errMsg = "获取需要刷新的ETA指标失败:Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
- // 获取期货指标
|
|
|
|
- futureGoodEdbInfoMapping, err := chartEdbMappingModel.GetFutureGoodEdbChartEdbMapping(chartInfoId)
|
|
|
|
- if err != nil {
|
|
|
|
- errMsg = "获取需要刷新的商品期货指标失败:Err:" + err.Error()
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 获取期货指标以及期货数据
|
|
|
|
- futureGoodEdbInfoList, err := future_good_edb_info.GetFutureGoodEdbInfoListByParentId(futureGoodEdbInfoMapping.EdbInfoId)
|
|
|
|
- if err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 批量刷新ETA指标
|
|
|
|
- err, _ = chart.EdbInfoRefreshAllFromBase([]int{edbInfoMapping.EdbInfoId}, false)
|
|
|
|
- if err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- // 批量刷新期货指标
|
|
|
|
- err = FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList, false)
|
|
|
|
- if err != nil {
|
|
|
|
- return
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- return
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
// handleResultData 处理成最终的结果数据
|
|
// handleResultData 处理成最终的结果数据
|
|
-func handleResultData(regionType string, futureGoodEdbType int, yDataList []chart_info.YData, futureGoodEdbInfoList []*future_good_edb_info.FutureGoodEdbInfo, maxIndex int) (xDataList []chart_info.XData, newYDataList []chart_info.YData, err error) {
|
|
|
|
- xDataList = make([]chart_info.XData, 0)
|
|
|
|
|
|
+func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDataList []chart_info.YData, futureGoodEdbInfoList []*future_good_edb_info.FutureGoodEdbInfo, maxIndex int) (xDataList []request.XData, newYDataList []chart_info.YData, err error) {
|
|
|
|
+ xDataList = make([]request.XData, 0)
|
|
newYDataList = yDataList
|
|
newYDataList = yDataList
|
|
|
|
|
|
if regionType == `国内` {
|
|
if regionType == `国内` {
|
|
@@ -607,7 +699,8 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
if i > maxIndex {
|
|
if i > maxIndex {
|
|
break
|
|
break
|
|
}
|
|
}
|
|
- xDataList = append(xDataList, chart_info.XData{
|
|
|
|
|
|
+ // todo x轴 内容调整
|
|
|
|
+ xDataList = append(xDataList, request.XData{
|
|
Name: fmt.Sprint("M+", i),
|
|
Name: fmt.Sprint("M+", i),
|
|
NameEn: fmt.Sprint("M+", i),
|
|
NameEn: fmt.Sprint("M+", i),
|
|
})
|
|
})
|
|
@@ -617,13 +710,13 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
|
|
|
|
futureGoodEdbInfoMap := make(map[int]*future_good_edb_info.FutureGoodEdbInfo)
|
|
futureGoodEdbInfoMap := make(map[int]*future_good_edb_info.FutureGoodEdbInfo)
|
|
for _, v := range futureGoodEdbInfoList {
|
|
for _, v := range futureGoodEdbInfoList {
|
|
- futureGoodEdbInfoMap[int(v.FutureGoodEdbInfoID)] = v
|
|
|
|
|
|
+ futureGoodEdbInfoMap[v.FutureGoodEdbInfoID] = v
|
|
}
|
|
}
|
|
|
|
|
|
if futureGoodEdbType == 2 { // FutureGoodEdbType int `description:"指标类型,1:年月是固定的合约;2:只有M+N期的合约,未固定年月"`
|
|
if futureGoodEdbType == 2 { // FutureGoodEdbType int `description:"指标类型,1:年月是固定的合约;2:只有M+N期的合约,未固定年月"`
|
|
nList := []int{3, 15, 27}
|
|
nList := []int{3, 15, 27}
|
|
for _, i := range nList {
|
|
for _, i := range nList {
|
|
- xDataList = append(xDataList, chart_info.XData{
|
|
|
|
|
|
+ xDataList = append(xDataList, request.XData{
|
|
Name: fmt.Sprint("M+", i),
|
|
Name: fmt.Sprint("M+", i),
|
|
NameEn: fmt.Sprint("M+", i),
|
|
NameEn: fmt.Sprint("M+", i),
|
|
})
|
|
})
|
|
@@ -635,11 +728,11 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
tmpNList := nList
|
|
tmpNList := nList
|
|
|
|
|
|
//当前的主力合约
|
|
//当前的主力合约
|
|
- newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, yData.XEdbInfoIdList[0])
|
|
|
|
- newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, yData.Value[0])
|
|
|
|
|
|
+ newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, yData.XEdbInfoIdList[0:baseEdbLen]...)
|
|
|
|
+ newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, yData.Value[0:baseEdbLen]...)
|
|
|
|
|
|
- xEdbInfoIdList := yData.XEdbInfoIdList[1:]
|
|
|
|
- valIndex := 1
|
|
|
|
|
|
+ xEdbInfoIdList := yData.XEdbInfoIdList[baseEdbLen:]
|
|
|
|
+ valIndex := baseEdbLen
|
|
needNum := 0
|
|
needNum := 0
|
|
for _, n := range tmpNList {
|
|
for _, n := range tmpNList {
|
|
if len(xEdbInfoIdList) > 0 {
|
|
if len(xEdbInfoIdList) > 0 {
|
|
@@ -650,7 +743,7 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
return
|
|
return
|
|
}
|
|
}
|
|
// 当前距离最早的日期相差的N数
|
|
// 当前距离最早的日期相差的N数
|
|
- if int(futureGoodEdbInfo.Month) == n {
|
|
|
|
|
|
+ if futureGoodEdbInfo.Month == n {
|
|
if needNum > 0 {
|
|
if needNum > 0 {
|
|
currVal := yData.Value[valIndex]
|
|
currVal := yData.Value[valIndex]
|
|
preVal := yData.Value[valIndex-1]
|
|
preVal := yData.Value[valIndex-1]
|
|
@@ -712,7 +805,7 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
//v.XEdbInfoIdList
|
|
//v.XEdbInfoIdList
|
|
for edbInfoIndex, edbInfoId := range v.XEdbInfoIdList {
|
|
for edbInfoIndex, edbInfoId := range v.XEdbInfoIdList {
|
|
// 第一个不处理
|
|
// 第一个不处理
|
|
- if edbInfoIndex == 0 {
|
|
|
|
|
|
+ if edbInfoIndex <= baseEdbLen-1 {
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
|
|
|
|
@@ -721,7 +814,7 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
err = errors.New("找不到指标")
|
|
err = errors.New("找不到指标")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- n := (futureGoodEdbInfo.Year-currYear)*12 + int(futureGoodEdbInfo.Month) - int(currMonth)
|
|
|
|
|
|
+ n := (futureGoodEdbInfo.Year-currYear)*12 + futureGoodEdbInfo.Month - int(currMonth)
|
|
nMap[n] = n
|
|
nMap[n] = n
|
|
}
|
|
}
|
|
|
|
|
|
@@ -739,7 +832,7 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
//prevMonth := 1
|
|
//prevMonth := 1
|
|
|
|
|
|
for _, n := range nList {
|
|
for _, n := range nList {
|
|
- xDataList = append(xDataList, chart_info.XData{
|
|
|
|
|
|
+ xDataList = append(xDataList, request.XData{
|
|
Name: fmt.Sprint("M+", n),
|
|
Name: fmt.Sprint("M+", n),
|
|
NameEn: fmt.Sprint("M+", n),
|
|
NameEn: fmt.Sprint("M+", n),
|
|
})
|
|
})
|
|
@@ -751,12 +844,12 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
tmpNList := nList
|
|
tmpNList := nList
|
|
|
|
|
|
//当前的主力合约
|
|
//当前的主力合约
|
|
- newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, yData.XEdbInfoIdList[0])
|
|
|
|
- newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, yData.Value[0])
|
|
|
|
|
|
+ newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, yData.XEdbInfoIdList[0:baseEdbLen]...)
|
|
|
|
+ newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, yData.Value[0:baseEdbLen]...)
|
|
|
|
|
|
- xEdbInfoIdList := yData.XEdbInfoIdList[1:]
|
|
|
|
|
|
+ xEdbInfoIdList := yData.XEdbInfoIdList[baseEdbLen:]
|
|
currDataTime := yData.ConfigDate
|
|
currDataTime := yData.ConfigDate
|
|
- valIndex := 1
|
|
|
|
|
|
+ valIndex := baseEdbLen
|
|
needNum := 0
|
|
needNum := 0
|
|
for _, n := range tmpNList {
|
|
for _, n := range tmpNList {
|
|
if len(xEdbInfoIdList) > 0 {
|
|
if len(xEdbInfoIdList) > 0 {
|
|
@@ -767,7 +860,7 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
return
|
|
return
|
|
}
|
|
}
|
|
// 当前距离最早的日期相差的N数
|
|
// 当前距离最早的日期相差的N数
|
|
- divMonth := (futureGoodEdbInfo.Year-currDataTime.Year())*12 + (int(futureGoodEdbInfo.Month) - int(currDataTime.Month()))
|
|
|
|
|
|
+ divMonth := (futureGoodEdbInfo.Year-currDataTime.Year())*12 + (futureGoodEdbInfo.Month - int(currDataTime.Month()))
|
|
if divMonth == n {
|
|
if divMonth == n {
|
|
if needNum > 0 {
|
|
if needNum > 0 {
|
|
currVal := yData.Value[valIndex]
|
|
currVal := yData.Value[valIndex]
|
|
@@ -818,7 +911,6 @@ func handleResultData(regionType string, futureGoodEdbType int, yDataList []char
|
|
newYDataList[yIndex].Value = yData.Value[0 : maxI+1]
|
|
newYDataList[yIndex].Value = yData.Value[0 : maxI+1]
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
@@ -862,14 +954,14 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
|
|
}
|
|
}
|
|
//海外的连续日期,目前
|
|
//海外的连续日期,目前
|
|
if v.FutureGoodEdbType == 2 {
|
|
if v.FutureGoodEdbType == 2 {
|
|
- if int(v.Month) <= maxM {
|
|
|
|
- //addMonth := int(earliestDateTime.Month()) + int(v.Month)
|
|
|
|
|
|
+ if v.Month <= maxM {
|
|
|
|
+ //addMonth := int(earliestDateTime.Month()) + v.Month
|
|
//v.Year = earliestDateTime.Year() + addMonth/12
|
|
//v.Year = earliestDateTime.Year() + addMonth/12
|
|
//realMonth := addMonth % 12
|
|
//realMonth := addMonth % 12
|
|
//if realMonth == 0 {
|
|
//if realMonth == 0 {
|
|
// realMonth = 12
|
|
// realMonth = 12
|
|
//}
|
|
//}
|
|
- //v.Month = uint32(realMonth)
|
|
|
|
|
|
+ //v.Month = realMonth
|
|
futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
|
|
futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
|
|
}
|
|
}
|
|
continue
|
|
continue
|
|
@@ -884,7 +976,7 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
// 如果(当前年-最新日期的年份) * 12个月 + (当前月-最新日期的月份) 小于总月份
|
|
// 如果(当前年-最新日期的年份) * 12个月 + (当前月-最新日期的月份) 小于总月份
|
|
- if (v.Year-earliestDateTime.Year())*12+(int(v.Month)-int(earliestDateTime.Month())) <= maxM {
|
|
|
|
|
|
+ if (v.Year-earliestDateTime.Year())*12+(v.Month-int(earliestDateTime.Month())) <= maxM {
|
|
futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
|
|
futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
|
|
continue
|
|
continue
|
|
}
|
|
}
|
|
@@ -893,3 +985,109 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
|
|
|
|
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+// GetNeedDateData 获取合约内需要的日期数据
|
|
|
|
+func GetNeedDateData(needDateTime time.Time, dataList []*edbDataModel.EdbDataList, edbDataMap map[string]float64, allEdbDataMap map[int]map[string]float64) (findDateTime time.Time, findDataValue float64, isFind bool, err error) {
|
|
|
|
+ //dataList := edbDataListMap[edbInfoId] //指标的所有数据值
|
|
|
|
+ if len(dataList) <= 0 {
|
|
|
|
+ // 没有数据的指标id
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //最早的日期
|
|
|
|
+ minDateTime, err := time.ParseInLocation(utils.FormatDate, dataList[0].DataTime, time.Local)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 该日期存在数据的期货指标的最小数量,目前是现货和期货各1个,总共2个
|
|
|
|
+ maxCount := 1
|
|
|
|
+
|
|
|
|
+ for tmpDateTime := needDateTime; tmpDateTime.After(minDateTime) || tmpDateTime.Equal(minDateTime); tmpDateTime = tmpDateTime.AddDate(0, 0, -1) {
|
|
|
|
+ tmpDate := tmpDateTime.Format(utils.FormatDate)
|
|
|
|
+ tmpValue, ok := edbDataMap[tmpDate]
|
|
|
|
+ if !ok {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 该日期存在数据的指标数量
|
|
|
|
+ count := 0
|
|
|
|
+
|
|
|
|
+ for _, currEdbDataMap := range allEdbDataMap {
|
|
|
|
+ _, tmpIsFind := currEdbDataMap[tmpDate]
|
|
|
|
+ if tmpIsFind {
|
|
|
|
+ count++
|
|
|
|
+ if count >= maxCount {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 该日期存在数据的期货指标数量小于2个,那么要继续往前找
|
|
|
|
+ if count < maxCount {
|
|
|
|
+ continue
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //如果能找到数据,那么就返回
|
|
|
|
+ // 数据为0,也直接返回,做无值处理
|
|
|
|
+ if tmpValue == 0 {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ findDateTime, _ = time.ParseInLocation(utils.FormatDate, tmpDate, time.Local)
|
|
|
|
+ findDataValue = tmpValue
|
|
|
|
+ isFind = true
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+// FutureGoodChartInfoRefresh
|
|
|
|
+// @author Roc
|
|
|
|
+// @datetime 2023-2-2 18:44:46
|
|
|
|
+// @description 商品价格曲线图表刷新
|
|
|
|
+func FutureGoodChartInfoRefresh(chartInfoId int) (err error) {
|
|
|
|
+ var errMsg string
|
|
|
|
+ defer func() {
|
|
|
|
+ if err != nil {
|
|
|
|
+ go alarm_msg.SendAlarmMsg("ChartInfoRefresh:"+errMsg, 3)
|
|
|
|
+ fmt.Println("ChartInfoRefresh Err:" + errMsg)
|
|
|
|
+ }
|
|
|
|
+ }()
|
|
|
|
+
|
|
|
|
+ edbInfoMappingList, err := chartEdbMappingModel.GetEtaEdbChartEdbMappingList(chartInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ errMsg = "获取需要刷新的ETA指标失败:Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ edbInfoIds := make([]int, 0)
|
|
|
|
+ for _, edbInfoMapping := range edbInfoMappingList {
|
|
|
|
+ edbInfoIds = append(edbInfoIds, edbInfoMapping.EdbInfoId)
|
|
|
|
+ }
|
|
|
|
+ // 获取期货指标
|
|
|
|
+ futureGoodEdbInfoMapping, err := chartEdbMappingModel.GetFutureGoodEdbChartEdbMapping(chartInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ errMsg = "获取需要刷新的商品期货指标失败:Err:" + err.Error()
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 获取期货指标以及期货数据
|
|
|
|
+ futureGoodEdbInfoList, err := future_good_edb_info.GetFutureGoodEdbInfoListByParentId(futureGoodEdbInfoMapping.EdbInfoId)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 批量刷新ETA指标
|
|
|
|
+ err, _ = chart.EdbInfoRefreshAllFromBase(edbInfoIds, false)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 批量刷新期货指标
|
|
|
|
+ err = FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList, false)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return
|
|
|
|
+}
|