|
@@ -2183,6 +2183,11 @@ func (this *EdbInfoController) EdbInfoAdd() {
|
|
|
|
|
|
//新增操作日志
|
|
|
{
|
|
|
+ // 添加钢联指标更新日志
|
|
|
+ if edbInfo.Source == utils.DATA_SOURCE_MYSTEEL_CHEMICAL {
|
|
|
+ go data_stat.AddEdbInfoUpdateLog(edbInfo.EdbInfoId, 1, "", sysUser, 2)
|
|
|
+ }
|
|
|
+
|
|
|
edbLog := new(data_manage.EdbInfoLog)
|
|
|
edbLog.EdbInfoId = edbInfo.EdbInfoId
|
|
|
edbLog.SourceName = edbInfo.SourceName
|
|
@@ -2358,11 +2363,13 @@ func (this *EdbInfoController) EdbInfoEdit() {
|
|
|
data.AddOrEditEdbInfoToEs(req.EdbInfoId)
|
|
|
|
|
|
// 修改关联的预测指标基础信息
|
|
|
- go data.ModifyPredictEdbBaseInfoBySourceEdb(edbInfo)
|
|
|
+ go data.ModifyPredictEdbBaseInfoBySourceEdb(edbInfo, req.Frequency, req.Unit)
|
|
|
|
|
|
// 添加钢联指标更新日志
|
|
|
if edbInfo.Source == utils.DATA_SOURCE_MYSTEEL_CHEMICAL {
|
|
|
- go data_stat.AddEdbInfoUpdateLog(req.EdbInfoId, 1, "", sysUser)
|
|
|
+ if edbInfo.EdbName != req.EdbName || edbInfo.Frequency != req.Frequency || edbInfo.Unit != req.Unit {
|
|
|
+ go data_stat.AddEdbInfoUpdateLog(req.EdbInfoId, 1, "", sysUser, 1)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
br.Ret = 200
|
|
@@ -2473,7 +2480,7 @@ func (this *EdbInfoController) EdbEnInfoEdit() {
|
|
|
|
|
|
// 修改关联的预测指标基础信息
|
|
|
if edbInfo.EdbInfoType == 0 {
|
|
|
- go data.ModifyPredictEdbEnBaseInfoBySourceEdb(edbInfo)
|
|
|
+ go data.ModifyPredictEdbEnBaseInfoBySourceEdb(edbInfo, req.UnitEn)
|
|
|
}
|
|
|
|
|
|
br.Ret = 200
|
|
@@ -5370,101 +5377,117 @@ func (this *EdbInfoController) EdbInfoBatchAdd() {
|
|
|
// @Param EdbCode query string false "指标编码/指标代码"
|
|
|
// @Param StockCode query string false "证券代码"
|
|
|
// @Success 200 {object} data_manage.EdbInfoExistCheckResp
|
|
|
-// @router /edb_info/smm/exist/check [get]
|
|
|
+// @router /edb_info/smm/exist/check [post]
|
|
|
func (this *EdbInfoController) SmmExistCheck() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
- selectAll, err := this.GetBool("SelectAll", false)
|
|
|
+
|
|
|
+ var req data_manage.SmmIndexExistCheckReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
- br.Msg = "参数解析失败"
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- types := this.GetString("Types")
|
|
|
- frequency := this.GetString("Frequency")
|
|
|
- dataState := this.GetString("DataState")
|
|
|
- edbCode := this.GetString("EdbCode")
|
|
|
+
|
|
|
+ types := req.Types
|
|
|
+ frequency := req.Frequency
|
|
|
+ dataState := req.DataState
|
|
|
+ selectAll := req.SelectAll
|
|
|
+ keyword := req.Keyword
|
|
|
+
|
|
|
+ edbCode := req.EdbCode
|
|
|
edbCode = strings.Trim(edbCode, "\t")
|
|
|
edbCode = strings.Trim(edbCode, " ")
|
|
|
edbCode = strings.Replace(edbCode, "\t", "", -1)
|
|
|
|
|
|
- selectCode := this.GetString("SelectCode")
|
|
|
- selectCode = strings.Trim(selectCode, "\t")
|
|
|
- selectCode = strings.Trim(selectCode, " ")
|
|
|
- selectCode = strings.Replace(selectCode, "\t", "", -1)
|
|
|
-
|
|
|
var edbCodeArr []string
|
|
|
var codeArr []string
|
|
|
|
|
|
if selectAll {
|
|
|
// 如果勾了列表全选,那么EdbCode传的就是排除的code
|
|
|
- if selectCode == "" {
|
|
|
- // 无勾选code,走查询
|
|
|
- var condition string
|
|
|
- var pars []interface{}
|
|
|
|
|
|
- if types != "" {
|
|
|
- typeArr := strings.Split(types, ",")
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ if len(types) > 0 {
|
|
|
+ condition += " AND ( "
|
|
|
+ for _, v := range types {
|
|
|
+ typeArr := strings.Split(v, ",")
|
|
|
for i, v := range typeArr {
|
|
|
+ if i == 0 {
|
|
|
+ condition += " ( "
|
|
|
+ }
|
|
|
typeStr := "type_"
|
|
|
typeStr += fmt.Sprintf("%d", i+1)
|
|
|
- condition += " AND " + typeStr + " =? "
|
|
|
+ condition += typeStr + " =? "
|
|
|
pars = append(pars, v)
|
|
|
+ if i == len(typeArr)-1 {
|
|
|
+ condition += " ) "
|
|
|
+ } else {
|
|
|
+ condition += " AND "
|
|
|
+ }
|
|
|
}
|
|
|
+ condition += " OR "
|
|
|
}
|
|
|
+ condition = strings.Trim(condition, "OR ")
|
|
|
+ condition += " ) "
|
|
|
+ }
|
|
|
|
|
|
- if dataState != "" {
|
|
|
- if dataState == "normal" {
|
|
|
- condition += " AND (data_state = 'normal' OR data_state = '') "
|
|
|
- pars = append(pars)
|
|
|
- } else {
|
|
|
- condition += " AND data_state = ? "
|
|
|
- pars = append(pars, dataState)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if frequency != "" {
|
|
|
- condition += " AND frequency = ? "
|
|
|
- pars = append(pars, frequency)
|
|
|
- }
|
|
|
+ if frequency != "" {
|
|
|
+ frequencyArr := strings.Split(frequency, ",")
|
|
|
+ condition += ` AND frequency IN (` + utils.GetOrmInReplace(len(frequencyArr)) + `) `
|
|
|
+ pars = append(pars, frequencyArr)
|
|
|
+ }
|
|
|
|
|
|
- indexList, err := data_manage.GetSmmIndexDataListNoPage(condition, pars)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取指标列表失败"
|
|
|
- br.ErrMsg = "获取指标列表失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ if dataState != "" {
|
|
|
+ stateArr := strings.Split(dataState, ",")
|
|
|
+ if strings.Contains(dataState, "normal") {
|
|
|
+ stateArr = append(stateArr, "")
|
|
|
+ condition += ` AND data_state IN (` + utils.GetOrmInReplace(len(stateArr)) + `) `
|
|
|
+ pars = append(pars, stateArr)
|
|
|
+ } else {
|
|
|
+ condition += ` AND data_state IN (` + utils.GetOrmInReplace(len(stateArr)) + `) `
|
|
|
+ pars = append(pars, stateArr)
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- for _, v := range indexList {
|
|
|
- codeArr = append(codeArr, v.IndexCode)
|
|
|
+ if keyword != "" {
|
|
|
+ keyWordArr := strings.Split(keyword, " ")
|
|
|
+ if len(keyWordArr) > 0 {
|
|
|
+ condition += " AND ( "
|
|
|
+ for _, v := range keyWordArr {
|
|
|
+ condition += ` CONCAT(index_name,index_code) LIKE '%` + v + `%' OR`
|
|
|
+ }
|
|
|
+ condition = strings.TrimRight(condition, "OR")
|
|
|
+ condition += " ) "
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- noUseCodeArr := strings.Split(edbCode, ",")
|
|
|
+ indexList, err := data_manage.GetSmmIndexDataListNoPage(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取指标列表失败"
|
|
|
+ br.ErrMsg = "获取指标列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- for _, code := range codeArr {
|
|
|
- // 检查code是否在noUseCodeArr数组中
|
|
|
- if !utils.ArrContainsStr(noUseCodeArr, code) {
|
|
|
- // 如果不在,将其添加到结果数组中
|
|
|
- edbCodeArr = append(edbCodeArr, code)
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 有勾选,不查询
|
|
|
- codeArr = strings.Split(selectCode, ",")
|
|
|
+ for _, v := range indexList {
|
|
|
+ codeArr = append(codeArr, v.IndexCode)
|
|
|
+ }
|
|
|
|
|
|
- noUseCodeArr := strings.Split(edbCode, ",")
|
|
|
+ noUseCodeArr := strings.Split(edbCode, ",")
|
|
|
|
|
|
- for _, code := range codeArr {
|
|
|
- // 检查code是否在noUseCodeArr数组中
|
|
|
- if !utils.ArrContainsStr(noUseCodeArr, code) {
|
|
|
- // 如果不在,将其添加到结果数组中
|
|
|
- edbCodeArr = append(edbCodeArr, code)
|
|
|
- }
|
|
|
+ for _, code := range codeArr {
|
|
|
+ // 检查code是否在noUseCodeArr数组中
|
|
|
+ if !utils.ArrContainsStr(noUseCodeArr, code) {
|
|
|
+ // 如果不在,将其添加到结果数组中
|
|
|
+ edbCodeArr = append(edbCodeArr, code)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
//未勾选全选EdbCode就是需要的code
|
|
|
edbCodeArr = strings.Split(edbCode, ",")
|
|
@@ -5525,101 +5548,116 @@ func (this *EdbInfoController) SmmExistCheck() {
|
|
|
// @Param EdbCode query string false "指标编码/指标代码"
|
|
|
// @Param StockCode query string false "证券代码"
|
|
|
// @Success 200 {object} data_manage.EdbInfoSearchResp
|
|
|
-// @router /edb_info/smm/search [get]
|
|
|
+// @router /edb_info/smm/search [post]
|
|
|
func (this *EdbInfoController) EdbInfoSmmSearch() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
this.Data["json"] = br
|
|
|
this.ServeJSON()
|
|
|
}()
|
|
|
- selectAll, err := this.GetBool("SelectAll", false)
|
|
|
+
|
|
|
+ var req data_manage.SmmIndexExistCheckReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
- br.Msg = "参数解析失败"
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
- types := this.GetString("Types")
|
|
|
- frequency := this.GetString("Frequency")
|
|
|
- dataState := this.GetString("DataState")
|
|
|
- edbCode := this.GetString("EdbCode")
|
|
|
+
|
|
|
+ types := req.Types
|
|
|
+ frequency := req.Frequency
|
|
|
+ dataState := req.DataState
|
|
|
+ selectAll := req.SelectAll
|
|
|
+ keyword := req.Keyword
|
|
|
+ edbCode := req.EdbCode
|
|
|
edbCode = strings.Trim(edbCode, "\t")
|
|
|
edbCode = strings.Trim(edbCode, " ")
|
|
|
edbCode = strings.Replace(edbCode, "\t", "", -1)
|
|
|
|
|
|
- selectCode := this.GetString("SelectCode")
|
|
|
- selectCode = strings.Trim(selectCode, "\t")
|
|
|
- selectCode = strings.Trim(selectCode, " ")
|
|
|
- selectCode = strings.Replace(selectCode, "\t", "", -1)
|
|
|
-
|
|
|
var edbCodeArr []string
|
|
|
var codeArr []string
|
|
|
|
|
|
if selectAll {
|
|
|
// 如果勾了列表全选,那么EdbCode传的就是排除的code
|
|
|
- if selectCode == "" {
|
|
|
- // 无勾选code,走查询
|
|
|
- var condition string
|
|
|
- var pars []interface{}
|
|
|
|
|
|
- if types != "" {
|
|
|
- typeArr := strings.Split(types, ",")
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ if len(types) > 0 {
|
|
|
+ condition += " AND ( "
|
|
|
+ for _, v := range types {
|
|
|
+ typeArr := strings.Split(v, ",")
|
|
|
for i, v := range typeArr {
|
|
|
+ if i == 0 {
|
|
|
+ condition += " ( "
|
|
|
+ }
|
|
|
typeStr := "type_"
|
|
|
typeStr += fmt.Sprintf("%d", i+1)
|
|
|
- condition += " AND " + typeStr + " =? "
|
|
|
+ condition += typeStr + " =? "
|
|
|
pars = append(pars, v)
|
|
|
+ if i == len(typeArr)-1 {
|
|
|
+ condition += " ) "
|
|
|
+ } else {
|
|
|
+ condition += " AND "
|
|
|
+ }
|
|
|
}
|
|
|
+ condition += " OR "
|
|
|
}
|
|
|
+ condition = strings.Trim(condition, "OR ")
|
|
|
+ condition += " ) "
|
|
|
+ }
|
|
|
|
|
|
- if dataState != "" {
|
|
|
- if dataState == "normal" {
|
|
|
- condition += " AND (data_state = 'normal' OR data_state = '') "
|
|
|
- pars = append(pars)
|
|
|
- } else {
|
|
|
- condition += " AND data_state = ? "
|
|
|
- pars = append(pars, dataState)
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if frequency != "" {
|
|
|
- condition += " AND frequency = ? "
|
|
|
- pars = append(pars, frequency)
|
|
|
- }
|
|
|
+ if frequency != "" {
|
|
|
+ frequencyArr := strings.Split(frequency, ",")
|
|
|
+ condition += ` AND frequency IN (` + utils.GetOrmInReplace(len(frequencyArr)) + `) `
|
|
|
+ pars = append(pars, frequencyArr)
|
|
|
+ }
|
|
|
|
|
|
- indexList, err := data_manage.GetSmmIndexDataListNoPage(condition, pars)
|
|
|
- if err != nil {
|
|
|
- br.Msg = "获取指标列表失败"
|
|
|
- br.ErrMsg = "获取指标列表失败,Err:" + err.Error()
|
|
|
- return
|
|
|
+ if dataState != "" {
|
|
|
+ stateArr := strings.Split(dataState, ",")
|
|
|
+ if strings.Contains(dataState, "normal") {
|
|
|
+ stateArr = append(stateArr, "")
|
|
|
+ condition += ` AND data_state IN (` + utils.GetOrmInReplace(len(stateArr)) + `) `
|
|
|
+ pars = append(pars, stateArr)
|
|
|
+ } else {
|
|
|
+ condition += ` AND data_state IN (` + utils.GetOrmInReplace(len(stateArr)) + `) `
|
|
|
+ pars = append(pars, stateArr)
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- for _, v := range indexList {
|
|
|
- codeArr = append(codeArr, v.IndexCode)
|
|
|
+ if keyword != "" {
|
|
|
+ keyWordArr := strings.Split(keyword, " ")
|
|
|
+ if len(keyWordArr) > 0 {
|
|
|
+ condition += " AND ( "
|
|
|
+ for _, v := range keyWordArr {
|
|
|
+ condition += ` CONCAT(index_name,index_code) LIKE '%` + v + `%' OR`
|
|
|
+ }
|
|
|
+ condition = strings.TrimRight(condition, "OR")
|
|
|
+ condition += " ) "
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- noUseCodeArr := strings.Split(edbCode, ",")
|
|
|
+ indexList, err := data_manage.GetSmmIndexDataListNoPage(condition, pars)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取指标列表失败"
|
|
|
+ br.ErrMsg = "获取指标列表失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
- for _, code := range codeArr {
|
|
|
- // 检查code是否在noUseCodeArr数组中
|
|
|
- if !utils.ArrContainsStr(noUseCodeArr, code) {
|
|
|
- // 如果不在,将其添加到结果数组中
|
|
|
- edbCodeArr = append(edbCodeArr, code)
|
|
|
- }
|
|
|
- }
|
|
|
- } else {
|
|
|
- // 有勾选,不查询
|
|
|
- codeArr = strings.Split(selectCode, ",")
|
|
|
+ for _, v := range indexList {
|
|
|
+ codeArr = append(codeArr, v.IndexCode)
|
|
|
+ }
|
|
|
|
|
|
- noUseCodeArr := strings.Split(edbCode, ",")
|
|
|
+ noUseCodeArr := strings.Split(edbCode, ",")
|
|
|
|
|
|
- for _, code := range codeArr {
|
|
|
- // 检查code是否在noUseCodeArr数组中
|
|
|
- if !utils.ArrContainsStr(noUseCodeArr, code) {
|
|
|
- // 如果不在,将其添加到结果数组中
|
|
|
- edbCodeArr = append(edbCodeArr, code)
|
|
|
- }
|
|
|
+ for _, code := range codeArr {
|
|
|
+ // 检查code是否在noUseCodeArr数组中
|
|
|
+ if !utils.ArrContainsStr(noUseCodeArr, code) {
|
|
|
+ // 如果不在,将其添加到结果数组中
|
|
|
+ edbCodeArr = append(edbCodeArr, code)
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
} else {
|
|
|
//未勾选全选EdbCode就是需要的code
|
|
|
edbCodeArr = strings.Split(edbCode, ",")
|