|
@@ -173,44 +173,53 @@ func (this *EdbInfoController) FenweiIndexData() {
|
|
|
}
|
|
|
|
|
|
resultList := make([]*data_manage.BaseFromFenweiIndexList, 0)
|
|
|
- for _, v := range indexes {
|
|
|
- product := new(data_manage.BaseFromFenweiIndexList)
|
|
|
- product.FenweiIndexId = v.FenweiIndexId
|
|
|
- product.ClassifyId = v.ClassifyId
|
|
|
- product.Unit = v.Unit
|
|
|
- product.IndexCode = v.IndexCode
|
|
|
- product.IndexName = v.IndexName
|
|
|
- product.Frequency = v.Frequency
|
|
|
- product.CreateTime = v.CreateTime
|
|
|
-
|
|
|
+ if indexes != nil {
|
|
|
// 获取指标数据最新更新时间
|
|
|
- modifyTime, err := data_manage.GetFenWeiDataLastModifyTime(v.IndexCode)
|
|
|
+ lastModifyTimeList, err := data_manage.GetFenWeiDataLastModifyTimeList(indexCodes)
|
|
|
if err != nil {
|
|
|
- br.Msg = "获取数据失败"
|
|
|
- br.ErrMsg = "获取指标数据最新更新时间失败, Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- product.ModifyTime = modifyTime
|
|
|
-
|
|
|
- edbInfo := edbCodeMap[v.IndexCode]
|
|
|
- if edbInfo != nil {
|
|
|
- product.EdbInfoId = edbInfo.EdbInfoId
|
|
|
+ lastModifyTimeMap := make(map[string]string)
|
|
|
+ for _, v := range lastModifyTimeList {
|
|
|
+ lastModifyTimeMap[v.IndexCode] = v.ModifyTime
|
|
|
}
|
|
|
|
|
|
- total := countMap[v.IndexCode]
|
|
|
- page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
- dataList, e := data_manage.GetFenweiIndexData(v.IndexCode, startSize, pageSize)
|
|
|
- if e != nil {
|
|
|
- br.Msg = "获取数据失败"
|
|
|
- br.ErrMsg = "获取指标数据失败,Err:" + e.Error()
|
|
|
- return
|
|
|
- }
|
|
|
- if dataList == nil {
|
|
|
- dataList = make([]*data_manage.BaseFromFenweiData, 0)
|
|
|
+ for _, v := range indexes {
|
|
|
+ product := new(data_manage.BaseFromFenweiIndexList)
|
|
|
+ product.FenweiIndexId = v.FenweiIndexId
|
|
|
+ product.ClassifyId = v.ClassifyId
|
|
|
+ product.Unit = v.Unit
|
|
|
+ product.IndexCode = v.IndexCode
|
|
|
+ product.IndexName = v.IndexName
|
|
|
+ product.Frequency = v.Frequency
|
|
|
+ product.CreateTime = v.CreateTime
|
|
|
+
|
|
|
+ if lastModifyTimeMap[v.IndexCode] != "" {
|
|
|
+ product.ModifyTime = lastModifyTimeMap[v.IndexCode]
|
|
|
+ } else {
|
|
|
+ product.ModifyTime = ""
|
|
|
+ }
|
|
|
+
|
|
|
+ edbInfo := edbCodeMap[v.IndexCode]
|
|
|
+ if edbInfo != nil {
|
|
|
+ product.EdbInfoId = edbInfo.EdbInfoId
|
|
|
+ }
|
|
|
+
|
|
|
+ total := countMap[v.IndexCode]
|
|
|
+ page := paging.GetPaging(currentIndex, pageSize, total)
|
|
|
+ dataList, e := data_manage.GetFenweiIndexData(v.IndexCode, startSize, pageSize)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "获取数据失败"
|
|
|
+ br.ErrMsg = "获取指标数据失败,Err:" + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if dataList == nil {
|
|
|
+ dataList = make([]*data_manage.BaseFromFenweiData, 0)
|
|
|
+ }
|
|
|
+ product.DataList = dataList
|
|
|
+ product.Paging = page
|
|
|
+ resultList = append(resultList, product)
|
|
|
}
|
|
|
- product.DataList = dataList
|
|
|
- product.Paging = page
|
|
|
- resultList = append(resultList, product)
|
|
|
}
|
|
|
|
|
|
br.Ret = 200
|
|
@@ -326,8 +335,14 @@ func (this *EdbInfoController) FenweiSingleData() {
|
|
|
ret.IndexName = indexInfo.IndexName
|
|
|
ret.Frequency = indexInfo.Frequency
|
|
|
ret.CreateTime = indexInfo.CreateTime.Format(utils.FormatDateTime)
|
|
|
- ret.ModifyTime = indexInfo.ModifyTime.Format(utils.FormatDateTime)
|
|
|
ret.Unit = indexInfo.Unit
|
|
|
+ // 获取数据最新更新时间
|
|
|
+ lastModifyTimeList, err := data_manage.GetFenWeiDataLastModifyTimeList([]string{indexInfo.IndexCode})
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ ret.ModifyTime = lastModifyTimeList[0].ModifyTime
|
|
|
+
|
|
|
for _, v := range dataTmpList {
|
|
|
tmp := &data_manage.FenweiSingleData{
|
|
|
Value: v.Value,
|