|
@@ -708,10 +708,10 @@ func (this *BaseFromUsdaFasController) UsdaFasNameCheck() {
|
|
|
br.Msg = "请选择指标"
|
|
|
return
|
|
|
}
|
|
|
- codeMax := 30
|
|
|
+ codeMaxT := 30
|
|
|
codeLen := len(req)
|
|
|
- if codeLen > codeMax {
|
|
|
- br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMax)
|
|
|
+ if codeLen > codeMaxT {
|
|
|
+ br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMaxT)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -805,7 +805,7 @@ func (c *BaseFromUsdaFasController) UsdaFasAddCheck() {
|
|
|
br.ErrMsg = "参数解析失败,Err:" + e.Error()
|
|
|
return
|
|
|
}
|
|
|
- codeMax := 30
|
|
|
+ codeMaxT := 30
|
|
|
codeLen := len(req.IndexCodes)
|
|
|
|
|
|
// 获取指标库已有指标
|
|
@@ -824,8 +824,8 @@ func (c *BaseFromUsdaFasController) UsdaFasAddCheck() {
|
|
|
br.Msg = "请选择指标"
|
|
|
return
|
|
|
}
|
|
|
- if codeLen > codeMax {
|
|
|
- br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMax)
|
|
|
+ if codeLen > codeMaxT {
|
|
|
+ br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMaxT)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -840,8 +840,8 @@ func (c *BaseFromUsdaFasController) UsdaFasAddCheck() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- if len(list) > codeMax {
|
|
|
- br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMax)
|
|
|
+ if len(list) > codeMaxT {
|
|
|
+ br.Msg = fmt.Sprintf("最多只能选择%d个指标", codeMaxT)
|
|
|
return
|
|
|
}
|
|
|
|
|
@@ -1282,3 +1282,105 @@ func (this *BaseFromUsdaFasController) GetFrequency() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = frequencyList
|
|
|
}
|
|
|
+
|
|
|
+// BatchAddEdbCheck
|
|
|
+// @Title 新增校验
|
|
|
+// @Description 新增校验
|
|
|
+// @Param request body data_manage.BatchManualEdbReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /usda_fas/batch/add/check [post]
|
|
|
+func (c *BaseFromUsdaFasController) BatchAddEdbCheck() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := c.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 最大批量添加的数量
|
|
|
+ codeMaxT := 31
|
|
|
+
|
|
|
+ var req data_manage.BatchCheckUsdaFasEdbReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数错误"
|
|
|
+ br.ErrMsg = "参数错误,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ req.Keyword = strings.TrimSpace(req.Keyword)
|
|
|
+ classifyIdStr := req.ClassifyIds
|
|
|
+
|
|
|
+ var list = make([]*data_manage.BaseFromUsdaFasIndexList, 0)
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ if req.ListAll {
|
|
|
+ classifyIds := strings.Split(classifyIdStr, ",")
|
|
|
+ if len(classifyIds) > 0 && classifyIds[0] != `` {
|
|
|
+ condition += " AND classify_id IN (" + utils.GetOrmInReplace(len(classifyIds)) + " ) "
|
|
|
+ pars = append(pars, classifyIds)
|
|
|
+ }
|
|
|
+ keyword := req.Keyword
|
|
|
+ if keyword != `` {
|
|
|
+ condition += " AND (index_name like ? OR index_code like ?) "
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
+ }
|
|
|
+ frequencies := req.Frequencies
|
|
|
+ if frequencies != "" {
|
|
|
+ frequencyList := strings.Split(frequencies, ",")
|
|
|
+ condition += " AND frequency IN (" + utils.GetOrmInReplace(len(frequencyList)) + " ) "
|
|
|
+ pars = append(pars, frequencyList)
|
|
|
+ }
|
|
|
+ codes := req.TradeCodeList
|
|
|
+ codeList := make([]string, 0)
|
|
|
+ if codes != "" {
|
|
|
+ codeList = strings.Split(codes, ",")
|
|
|
+ }
|
|
|
+ if len(codeList) > 0 {
|
|
|
+ condition += ` AND index_code not in (` + utils.GetOrmInReplace(len(codeList)) + `) `
|
|
|
+ pars = append(pars, codeList)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ codes := req.TradeCodeList
|
|
|
+ codeList := make([]string, 0)
|
|
|
+ if codes != "" {
|
|
|
+ codeList = strings.Split(codes, ",")
|
|
|
+ }
|
|
|
+ if len(codeList) <= 0 {
|
|
|
+ br.Msg = "请选择指标"
|
|
|
+ br.ErrMsg = "请选择指标"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 指标
|
|
|
+ condition += ` AND index_code in (` + utils.GetOrmInReplace(len(codeList)) + `) `
|
|
|
+ pars = append(pars, codeList)
|
|
|
+
|
|
|
+ }
|
|
|
+ condition += ` AND index_code not in (SELECT edb_code FROM edb_info WHERE source=?) `
|
|
|
+ pars = append(pars, utils.DATA_SOURCE_USDA_FAS)
|
|
|
+
|
|
|
+ list, err = data_manage.GetUsdaFasIndexPage(condition, pars, 0, codeMaxT)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(list) >= codeMaxT {
|
|
|
+ br.Msg = "最多只能添加" + strconv.Itoa(codeMaxT) + "条数据"
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = list
|
|
|
+ br.Msg = "校验成功"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+}
|