Browse Source

Merge branch 'feature/bloomberg_0205' into debug

hsun 1 month ago
parent
commit
4066f72992
1 changed files with 25 additions and 24 deletions
  1. 25 24
      controllers/data_manage/bloomberg_data.go

+ 25 - 24
controllers/data_manage/bloomberg_data.go

@@ -7,7 +7,6 @@ import (
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
-	"eta/eta_api/services/elastic"
 	etaTrialService "eta/eta_api/services/eta_trial"
 	"eta/eta_api/utils"
 	"fmt"
@@ -75,8 +74,8 @@ func (this *BloombergDataController) List() {
 		params.Keywords = strings.TrimSpace(params.Keywords)
 		if params.Keywords != "" {
 			// 空格分词搜
-			//indexCodeCol := data_manage.BaseFromBloombergIndexCols.IndexCode
-			//indexNameCol := data_manage.BaseFromBloombergIndexCols.IndexName
+			indexCodeCol := data_manage.BaseFromBloombergIndexCols.IndexCode
+			indexNameCol := data_manage.BaseFromBloombergIndexCols.IndexName
 			//keywordArr := strings.Split(params.Keywords, " ")
 			//if len(keywordArr) > 1 {
 			//	sliceArr := make([]string, 0)
@@ -95,29 +94,31 @@ func (this *BloombergDataController) List() {
 			//	cond += fmt.Sprintf(` AND (%s LIKE ? OR %s LIKE ?)`, indexCodeCol, indexNameCol)
 			//	pars = utils.GetLikeKeywordPars(pars, params.Keywords, 2)
 			//}
+			cond += fmt.Sprintf(` AND (%s LIKE ? OR %s LIKE ?)`, indexCodeCol, indexNameCol)
+			pars = utils.GetLikeKeywordPars(pars, params.Keywords, 2)
 
 			// ES搜
-			_, list, e := elastic.SearchDataSourceIndex(utils.EsDataSourceIndexName, params.Keywords, utils.DATA_SOURCE_BLOOMBERG, 0, []int{}, []int{}, []string{}, startSize, params.PageSize)
-			if e != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = fmt.Sprintf("ES-搜索Bloomberg指标失败, %v", e)
-				return
-			}
-			if len(list) == 0 {
-				dataResp.Paging = paging.GetPaging(params.CurrentIndex, params.PageSize, 0)
-				dataResp.List = make([]*data_manage.BaseFromBloombergIndexItem, 0)
-				br.Data = dataResp
-				br.Ret = 200
-				br.Success = true
-				br.Msg = "获取成功"
-				return
-			}
-			var indexIds []int
-			for _, v := range list {
-				indexIds = append(indexIds, v.PrimaryId)
-			}
-			cond += fmt.Sprintf(" AND %s IN (%s)", data_manage.BaseFromBloombergIndexCols.BaseFromBloombergIndexId, utils.GetOrmInReplace(len(indexIds)))
-			pars = append(pars, indexIds)
+			//_, list, e := elastic.SearchDataSourceIndex(utils.EsDataSourceIndexName, params.Keywords, utils.DATA_SOURCE_BLOOMBERG, 0, []int{}, []int{}, []string{}, startSize, params.PageSize)
+			//if e != nil {
+			//	br.Msg = "获取失败"
+			//	br.ErrMsg = fmt.Sprintf("ES-搜索Bloomberg指标失败, %v", e)
+			//	return
+			//}
+			//if len(list) == 0 {
+			//	dataResp.Paging = paging.GetPaging(params.CurrentIndex, params.PageSize, 0)
+			//	dataResp.List = make([]*data_manage.BaseFromBloombergIndexItem, 0)
+			//	br.Data = dataResp
+			//	br.Ret = 200
+			//	br.Success = true
+			//	br.Msg = "获取成功"
+			//	return
+			//}
+			//var indexIds []int
+			//for _, v := range list {
+			//	indexIds = append(indexIds, v.PrimaryId)
+			//}
+			//cond += fmt.Sprintf(" AND %s IN (%s)", data_manage.BaseFromBloombergIndexCols.BaseFromBloombergIndexId, utils.GetOrmInReplace(len(indexIds)))
+			//pars = append(pars, indexIds)
 		}
 
 		if params.Frequency != "" {