|
@@ -662,7 +662,7 @@ func (this *TargetController) EditExcelData() {
|
|
|
// @Description 获取研究员指标
|
|
|
// @Param request body models.BatchAddEdbReq true "type json string"
|
|
|
// @Success 200 {object} models.TargetItemListResp
|
|
|
-// @router /target/edb/batch/list [get]
|
|
|
+// @router /target/edb/batch/list [post]
|
|
|
func (this *TargetController) BatchEdbList() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
@@ -698,7 +698,7 @@ func (this *TargetController) BatchEdbList() {
|
|
|
|
|
|
// 是否加到指标库
|
|
|
condition += ` AND a.is_join_edb = ? `
|
|
|
- pars = append(pars, req.IsJoinEdb)
|
|
|
+ pars = append(pars, 0)
|
|
|
|
|
|
//超管账号可以查看分类下的所有频度数据
|
|
|
if sysUser.RoleTypeCode != utils.ROLE_TYPE_CODE_ADMIN {
|
|
@@ -744,7 +744,7 @@ func (this *TargetController) BatchEdbList() {
|
|
|
// 所属用户
|
|
|
lenUser := len(req.UserIdList)
|
|
|
if lenUser > 0 {
|
|
|
- condition += ` AND a.user_id in (` + utils.GetOrmInReplace(lenClassify) + `) `
|
|
|
+ condition += ` AND a.user_id in (` + utils.GetOrmInReplace(lenUser) + `) `
|
|
|
pars = append(pars, req.UserIdList)
|
|
|
}
|
|
|
|
|
@@ -775,7 +775,7 @@ func (this *TargetController) BatchEdbList() {
|
|
|
// BatchAddEdbCheck
|
|
|
// @Title 新增校验
|
|
|
// @Description 新增校验
|
|
|
-// @Param request body data_manage.BloombergSourceBatchAddCheckReq true "type json string"
|
|
|
+// @Param request body data_manage.BatchManualEdbReq true "type json string"
|
|
|
// @Success 200 string "操作成功"
|
|
|
// @router /target/edb/batch/add/check [post]
|
|
|
func (this *TargetController) BatchAddEdbCheck() {
|
|
@@ -854,7 +854,7 @@ func (this *TargetController) BatchAddEdbCheck() {
|
|
|
// 所属用户
|
|
|
lenUser := len(req.UserIdList)
|
|
|
if lenUser > 0 {
|
|
|
- condition += ` AND a.user_id in (` + utils.GetOrmInReplace(lenClassify) + `) `
|
|
|
+ condition += ` AND a.user_id in (` + utils.GetOrmInReplace(lenUser) + `) `
|
|
|
pars = append(pars, req.UserIdList)
|
|
|
}
|
|
|
|
|
@@ -1126,6 +1126,123 @@ func (this *TargetController) BatchAdd() {
|
|
|
br.IsAddLog = true
|
|
|
}
|
|
|
|
|
|
+// BatchDelEdbCheck
|
|
|
+// @Title 新增校验
|
|
|
+// @Description 新增校验
|
|
|
+// @Param request body data_manage.BatchManualEdbReq true "type json string"
|
|
|
+// @Success 200 string "操作成功"
|
|
|
+// @router /target/edb/batch/del/check [post]
|
|
|
+func (this *TargetController) BatchDelEdbCheck() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ if br.ErrMsg == "" {
|
|
|
+ br.IsSendEmail = false
|
|
|
+ }
|
|
|
+ this.Data["json"] = br
|
|
|
+ this.ServeJSON()
|
|
|
+ }()
|
|
|
+ sysUser := this.SysUser
|
|
|
+ if sysUser == nil {
|
|
|
+ br.Msg = "请登录"
|
|
|
+ br.ErrMsg = "请登录,SysUser Is Empty"
|
|
|
+ br.Ret = 408
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ var req models.BatchManualEdbReq
|
|
|
+ err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+
|
|
|
+ req.Keyword = strings.TrimSpace(req.Keyword)
|
|
|
+
|
|
|
+ var condition string
|
|
|
+ var pars []interface{}
|
|
|
+
|
|
|
+ // 就是为了找出已经加入指标库的指标
|
|
|
+ condition += ` AND a.is_join_edb = ? `
|
|
|
+ pars = append(pars, 1)
|
|
|
+
|
|
|
+ //超管账号可以查看分类下的所有频度数据
|
|
|
+ if sysUser.RoleTypeCode != utils.ROLE_TYPE_CODE_ADMIN {
|
|
|
+ classifyList, err := models.GetEdbdataClassify(int64(sysUser.AdminId))
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取分类数据失败"
|
|
|
+ br.Msg = "获取拥有的分类数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ num := len(classifyList)
|
|
|
+ if num > 0 {
|
|
|
+ classifyIdList := make([]int, 0)
|
|
|
+ for _, v := range classifyList {
|
|
|
+ classifyIdList = append(classifyIdList, v.ClassifyId)
|
|
|
+ }
|
|
|
+ condition += ` AND a.classify_id in (` + utils.GetOrmInReplace(num) + `) `
|
|
|
+ pars = append(pars, classifyIdList)
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.ListAll {
|
|
|
+ // 关键词
|
|
|
+ if req.Keyword != "" {
|
|
|
+ condition += ` AND (a.SEC_NAME like ? or a.TRADE_CODE like ? )`
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, req.Keyword, 2)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 所属分类
|
|
|
+ lenFrequency := len(req.FrequencyList)
|
|
|
+ if lenFrequency > 0 {
|
|
|
+ condition += ` AND a.frequency in (` + utils.GetOrmInReplace(lenFrequency) + `) `
|
|
|
+ pars = append(pars, req.FrequencyList)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 所属分类
|
|
|
+ lenClassify := len(req.ClassifyIdList)
|
|
|
+ if lenClassify > 0 {
|
|
|
+ condition += ` AND a.classify_id in (` + utils.GetOrmInReplace(lenClassify) + `) `
|
|
|
+ pars = append(pars, req.ClassifyIdList)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 所属用户
|
|
|
+ lenUser := len(req.UserIdList)
|
|
|
+ if lenUser > 0 {
|
|
|
+ condition += ` AND a.user_id in (` + utils.GetOrmInReplace(lenUser) + `) `
|
|
|
+ pars = append(pars, req.UserIdList)
|
|
|
+ }
|
|
|
+
|
|
|
+ lenTradeList := len(req.TradeCodeList)
|
|
|
+ // 指标
|
|
|
+ if lenTradeList > 0 {
|
|
|
+ condition += ` AND a.TRADE_CODE not in (` + utils.GetOrmInReplace(lenTradeList) + `) `
|
|
|
+ pars = append(pars, req.TradeCodeList)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ lenTradeList := len(req.TradeCodeList)
|
|
|
+ if lenTradeList <= 0 {
|
|
|
+ br.Msg = "请选择指标"
|
|
|
+ br.ErrMsg = "请选择指标"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 指标
|
|
|
+ if lenTradeList > 0 {
|
|
|
+ condition += ` AND a.TRADE_CODE in (` + utils.GetOrmInReplace(lenTradeList) + `) `
|
|
|
+ pars = append(pars, req.TradeCodeList)
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ list, err := models.GetEdbInfoList(condition, pars, 0, 0)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Data = list
|
|
|
+ br.Msg = "校验成功"
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+}
|
|
|
+
|
|
|
// BatchDel
|
|
|
// @Title 批量删除
|
|
|
// @Description 批量新增
|