|
@@ -271,6 +271,7 @@ func (c *EdbInfoController) RefreshEdbList() {
|
|
|
sysUserId := c.GetString("SysUserId")
|
|
|
frequency := c.GetString("Frequency")
|
|
|
keyword := c.GetString("Keyword")
|
|
|
+ status := c.GetString("Status")
|
|
|
|
|
|
pageSize, _ := c.GetInt("PageSize")
|
|
|
currentIndex, _ := c.GetInt("CurrentIndex")
|
|
@@ -284,7 +285,7 @@ func (c *EdbInfoController) RefreshEdbList() {
|
|
|
}
|
|
|
startSize = utils.StartIndex(currentIndex, pageSize)
|
|
|
|
|
|
- total, list, err := getList(source, subSource, classifyId, terminalCode, sysUserId, frequency, keyword, startSize, pageSize)
|
|
|
+ total, list, err := getList(source, subSource, classifyId, terminalCode, sysUserId, frequency, keyword, status, startSize, pageSize)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -489,7 +490,7 @@ func (c *EdbInfoController) SaveEdbRefreshConfig() {
|
|
|
// 指标id列表
|
|
|
if req.IsSelectAll {
|
|
|
// 如果是列表全选
|
|
|
- _, edbList, err := getList(req.Source, req.SubSource, req.ClassifyId, req.TerminalCode, req.SysUserId, req.Frequency, req.Keyword, 0, 100000)
|
|
|
+ _, edbList, err := getList(req.Source, req.SubSource, req.ClassifyId, req.TerminalCode, req.SysUserId, req.Frequency, req.Keyword, req.Status, 0, 100000)
|
|
|
if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
br.Msg = "获取失败"
|
|
|
br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
@@ -576,6 +577,96 @@ func (c *EdbInfoController) SaveEdbRefreshConfig() {
|
|
|
br.Msg = "保存成功"
|
|
|
}
|
|
|
|
|
|
+// SaveEdbRefreshStatus
|
|
|
+// @Title 单独设置指标刷新状态接口
|
|
|
+// @Description 单独设置指标刷新状态接口
|
|
|
+// @Param request body data_manage.SaveEdbRefreshStatusReq true "type json string"
|
|
|
+// @Success 200 {object} data_manage.RefreshBaseEdbInfoResp
|
|
|
+// @router /edb_info/refresh/status/save [post]
|
|
|
+func (c *EdbInfoController) SaveEdbRefreshStatus() {
|
|
|
+ br := new(models.BaseResponse).Init()
|
|
|
+ defer func() {
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
+ }()
|
|
|
+
|
|
|
+ var req request.SaveEdbRefreshStatusReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if req.Source <= 0 {
|
|
|
+ br.Msg = "来源不能为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ edbIdList := make([]int, 0)
|
|
|
+ edbCodeList := make([]string, 0)
|
|
|
+ // 指标id列表
|
|
|
+ if req.IsSelectAll {
|
|
|
+ // 如果是列表全选
|
|
|
+ _, edbList, err := getList(req.Source, req.SubSource, req.ClassifyId, req.TerminalCode, req.SysUserId, req.Frequency, req.Keyword, req.Status, 0, 100000)
|
|
|
+ if err != nil && err.Error() != utils.ErrNoRow() {
|
|
|
+ br.Msg = "获取失败"
|
|
|
+ br.ErrMsg = "获取数据失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ // 不配置的指标id
|
|
|
+ notIdMap := make(map[int]int, 0)
|
|
|
+ for _, v := range req.EdbSelectIdList {
|
|
|
+ notIdMap[v] = v
|
|
|
+ }
|
|
|
+
|
|
|
+ for _, v := range edbList {
|
|
|
+ _, ok := notIdMap[v.EdbInfoId]
|
|
|
+ // 在不配置的指标id列表内的话,那就过滤
|
|
|
+ if ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+
|
|
|
+ // 加入到待配置的指标列表id
|
|
|
+ edbIdList = append(edbIdList, v.EdbInfoId)
|
|
|
+ edbCodeList = append(edbCodeList, v.IndexCode)
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ edbIdList = req.EdbSelectIdList
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(edbIdList) <= 0 {
|
|
|
+ br.Msg = "指标不能为空"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ isStop := 0
|
|
|
+ if req.ModifyStatus == `禁用` {
|
|
|
+ isStop = 1
|
|
|
+ }
|
|
|
+
|
|
|
+ switch req.Source {
|
|
|
+ case utils.DATA_SOURCE_MYSTEEL_CHEMICAL: // 钢联
|
|
|
+ err = data_manage.ModifyMysteelChemicalUpdateStatus(edbIdList, edbCodeList, isStop)
|
|
|
+ case utils.DATA_SOURCE_YS: // 有色
|
|
|
+ err = data_manage.ModifySmmUpdateStatus(edbIdList, edbCodeList, isStop)
|
|
|
+ default:
|
|
|
+ err = data_manage.ModifyEdbInfoUpdateStatus(edbIdList, isStop)
|
|
|
+ }
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = `保存失败`
|
|
|
+ br.ErrMsg = "保存失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "保存成功"
|
|
|
+}
|
|
|
+
|
|
|
// getList
|
|
|
// @Description: 获取指标列表
|
|
|
// @author: Roc
|
|
@@ -592,12 +683,17 @@ func (c *EdbInfoController) SaveEdbRefreshConfig() {
|
|
|
// @return total int
|
|
|
// @return list []*data_manage.BaseEdbInfo
|
|
|
// @return err error
|
|
|
-func getList(source, subSource, classifyId int, terminalCode, sysUserId, frequency, keyword string, startSize, pageSize int) (total int, list []*data_manage.BaseEdbInfo, err error) {
|
|
|
+func getList(source, subSource, classifyId int, terminalCode, sysUserId, frequency, keyword, status string, startSize, pageSize int) (total int, list []*data_manage.BaseEdbInfo, err error) {
|
|
|
var pars []interface{}
|
|
|
var condition string
|
|
|
|
|
|
list = make([]*data_manage.BaseEdbInfo, 0)
|
|
|
|
|
|
+ isStop := 0
|
|
|
+ if status == `禁用` {
|
|
|
+ isStop = 1
|
|
|
+ }
|
|
|
+
|
|
|
switch source {
|
|
|
case utils.DATA_SOURCE_MYSTEEL_CHEMICAL: // 钢联
|
|
|
if classifyId > 0 {
|
|
@@ -635,6 +731,8 @@ func getList(source, subSource, classifyId int, terminalCode, sysUserId, frequen
|
|
|
pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
}
|
|
|
}
|
|
|
+ condition += " AND is_stop = ? "
|
|
|
+ pars = append(pars, isStop)
|
|
|
|
|
|
total, list, err = data_manage.GetMysteelChemicalBaseInfo(condition, pars, startSize, pageSize)
|
|
|
case utils.DATA_SOURCE_YS: // 有色
|
|
@@ -669,10 +767,13 @@ func getList(source, subSource, classifyId int, terminalCode, sysUserId, frequen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ condition += " AND is_stop = ? "
|
|
|
+ pars = append(pars, isStop)
|
|
|
+
|
|
|
total, list, err = data_manage.GetSmmBaseInfo(condition, pars, startSize, pageSize)
|
|
|
default:
|
|
|
- condition += ` AND source = ? AND sub_source = ? `
|
|
|
- pars = append(pars, source, subSource)
|
|
|
+ condition += ` AND source = ? AND sub_source = ? AND no_update = ?`
|
|
|
+ pars = append(pars, source, subSource, isStop)
|
|
|
|
|
|
if classifyId > 0 {
|
|
|
condition += " AND classify_id = ? "
|