瀏覽代碼

Merge remote-tracking branch 'origin/debug' into debug

zwxi 1 年之前
父節點
當前提交
610c734fab

+ 431 - 0
controllers/data_manage/edb_info_refresh.go

@@ -0,0 +1,431 @@
+package data_manage
+
+import (
+	"eta/eta_api/models"
+	"eta/eta_api/models/data_manage"
+	"eta/eta_api/utils"
+	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
+)
+
+// RefreshSourceList
+// @Title 获取指标刷新配置的来源接口
+// @Description 获取指标刷新配置的来源接口
+// @Success Ret=200 获取成功
+// @router /edb_info/refresh/source_list [get]
+func (c *EdbInfoController) RefreshSourceList() {
+	br := new(models.BaseResponse).Init()
+
+	defer func() {
+		c.Data["json"] = br
+		c.ServeJSON()
+	}()
+
+	item := data_manage.EdbRefreshSource{}
+	tmpList, err := item.GetAllList()
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取刷新数据源失败, Err: " + err.Error()
+		return
+	}
+
+	list := make([]data_manage.EdbRefreshSourceList, 0)
+	tmpMap := make(map[int]data_manage.EdbRefreshSourceList, 0)
+
+	for _, v := range tmpList {
+		tmp, ok := tmpMap[v.Source]
+		if ok {
+			continue
+		}
+		tmp = data_manage.EdbRefreshSourceList{
+			Source:     v.Source,
+			SourceName: v.SourceName,
+			//SubSource:     v.SubSource,
+			//SubSourceName: v.SubSourceName,
+			Child:    make([]data_manage.EdbRefreshSourceList, 0),
+			HasChild: v.HasChild,
+		}
+
+		if v.HasChild == 1 {
+			for _, v2 := range tmpList {
+				if v2.Source == v.Source {
+					tmp.Child = append(tmp.Child, data_manage.EdbRefreshSourceList{
+						Source:        v.Source,
+						SourceName:    v.SourceName,
+						SubSource:     v.SubSource,
+						SubSourceName: v.SubSourceName,
+						HasChild:      0,
+					})
+				}
+			}
+		}
+
+		tmpMap[v.Source] = tmp
+		list = append(list, tmp)
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = list
+}
+
+// RefreshClassifyList
+// @Title 获取指标分类列表接口
+// @Description 获取指标分类列表接口
+// @Param   Source   query   int  true       "来源:1:同花顺,2:wind,3:彭博"
+// @Success Ret=200 获取成功
+// @router /edb_info/refresh/classify_list [get]
+func (c *EdbInfoController) RefreshClassifyList() {
+	br := new(models.BaseResponse).Init()
+
+	defer func() {
+		c.Data["json"] = br
+		c.ServeJSON()
+	}()
+
+	source, _ := c.GetInt("Source", utils.DATA_SOURCE_MYSTEEL_CHEMICAL)
+
+	list := make([]*data_manage.BaseClassifyItems, 0)
+	switch source {
+	case utils.DATA_SOURCE_MYSTEEL_CHEMICAL: // 钢联
+		rootList, err := data_manage.GetBaseFromMysteelChemicalClassifyByParentId(0)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+
+		classifyAll, err := data_manage.GetAllBaseFromMysteelChemicalClassify()
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+
+		rootChildMap := make(map[int][]*data_manage.BaseClassifyItems)
+
+		for _, v := range classifyAll {
+			//tmpList, ok := rootChildMap[v.ParentId]
+			//if !ok {
+			//	tmpList = make([]data_manage.BaseClassifyItems, 0)
+			//}
+			//tmpList = append(tmpList, data_manage.BaseClassifyItems{
+			//	ClassifyId:   v.BaseFromMysteelChemicalClassifyId,
+			//	ClassifyName: v.ClassifyName,
+			//	ParentId:     v.ParentId,
+			//	UniqueCode:   fmt.Sprint(v.BaseFromMysteelChemicalClassifyId),
+			//	Children:     nil,
+			//})
+			//rootChildMap[v.ParentId] = tmpList
+
+			rootChildMap[v.ParentId] = append(rootChildMap[v.ParentId], &data_manage.BaseClassifyItems{
+				ClassifyId:   v.BaseFromMysteelChemicalClassifyId,
+				ClassifyName: v.ClassifyName,
+				ParentId:     v.ParentId,
+				UniqueCode:   fmt.Sprint(v.BaseFromMysteelChemicalClassifyId),
+				Children:     nil,
+			})
+		}
+		for _, v := range rootList {
+			tmp := &data_manage.BaseClassifyItems{
+				ClassifyId:   v.BaseFromMysteelChemicalClassifyId,
+				ClassifyName: v.ClassifyName,
+				ParentId:     v.ParentId,
+				UniqueCode:   fmt.Sprint(v.BaseFromMysteelChemicalClassifyId),
+				Children:     nil,
+			}
+			if existItems, ok := rootChildMap[v.BaseFromMysteelChemicalClassifyId]; ok {
+				tmp.Children = existItems
+			} else {
+				items := make([]*data_manage.BaseClassifyItems, 0)
+				tmp.Children = items
+			}
+			list = append(list, tmp)
+		}
+
+	case utils.DATA_SOURCE_YS: // 有色
+
+		list = append(list, &data_manage.BaseClassifyItems{
+			ClassifyId:   0,
+			ClassifyName: "未分类",
+			ParentId:     0,
+			UniqueCode:   fmt.Sprint(0),
+			Children:     nil,
+		})
+		rootList, err := data_manage.GetBaseFromSmmClassifyByParentId(0)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+
+		classifyAll, err := data_manage.GetAllBaseFromSmmClassify()
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+
+		rootChildMap := make(map[int][]*data_manage.BaseClassifyItems)
+		for _, v := range classifyAll {
+			rootChildMap[v.ParentId] = append(rootChildMap[v.ParentId], &data_manage.BaseClassifyItems{
+				ClassifyId:   v.ClassifyId,
+				ClassifyName: v.ClassifyName,
+				ParentId:     v.ParentId,
+				UniqueCode:   fmt.Sprint(v.ClassifyId),
+				Children:     nil,
+			})
+		}
+		for _, v := range rootList {
+			tmp := &data_manage.BaseClassifyItems{
+				ClassifyId:   v.ClassifyId,
+				ClassifyName: v.ClassifyName,
+				ParentId:     v.ParentId,
+				UniqueCode:   fmt.Sprint(v.ClassifyId),
+				Children:     nil,
+			}
+			if existItems, ok := rootChildMap[v.ClassifyId]; ok {
+				tmp.Children = existItems
+			} else {
+				items := make([]*data_manage.BaseClassifyItems, 0)
+				tmp.Children = items
+			}
+			list = append(list, tmp)
+
+		}
+
+	default:
+		tmpList, err := data_manage.GetAllEdbClassify()
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+		for _, v := range tmpList {
+			list = append(list, &data_manage.BaseClassifyItems{
+				ClassifyId:   v.ClassifyId,
+				ClassifyName: v.ClassifyName,
+				ParentId:     v.ParentId,
+				UniqueCode:   fmt.Sprint(v.ClassifyId),
+				Children:     nil,
+			})
+		}
+		list = buildTree(list, 0)
+		//fmt.Println(result)
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = list
+}
+
+// 生成多层级列表的递归函数
+func buildTree(items []*data_manage.BaseClassifyItems, parentId int) []*data_manage.BaseClassifyItems {
+	var result []*data_manage.BaseClassifyItems
+
+	// 遍历所有分类项
+	for i := range items {
+		// 找到当前节点的子节点
+		if items[i].ParentId == parentId {
+			// 递归构建子节点的子节点
+			items[i].Children = buildTree(items, items[i].ClassifyId)
+			// 将当前节点添加到结果中
+			result = append(result, items[i])
+		}
+	}
+
+	return result
+}
+
+// RefreshEdbList
+// @Title 获取待配置的指标列表接口
+// @Description 获取待配置的指标列表接口
+// @Param   Source   query   int  true       "来源:1:同花顺,2:wind,3:彭博"
+// @Param   SubSource   query   int  true       "来源:0:经济数据库,1:日期序列"
+// @Param   ClassifyId   query   int  false             "分类ID"
+// @Param   TerminalCode   query   string  false       "终端编码"
+// @Param   SysUserId   query   string  false       "创建人"
+// @Param   Frequency   query   string  false       "频度"
+// @Param   Keyword   query   string  false       "关键词"
+// @Success 200 {object} data_manage.RefreshBaseEdbInfoResp
+// @router /edb_info/refresh/edb_list [get]
+func (c *EdbInfoController) RefreshEdbList() {
+	br := new(models.BaseResponse).Init()
+
+	defer func() {
+		c.Data["json"] = br
+		c.ServeJSON()
+	}()
+
+	source, _ := c.GetInt("Source")
+	subSource, _ := c.GetInt("SubSource")
+	classifyId, _ := c.GetInt("ClassifyId")
+	terminalCode := c.GetString("TerminalCode")
+	sysUserId := c.GetString("SysUserId")
+	frequency := c.GetString("Frequency")
+	keyword := c.GetString("Keyword")
+
+	pageSize, _ := c.GetInt("PageSize")
+	currentIndex, _ := c.GetInt("CurrentIndex")
+	var startSize int
+
+	if pageSize <= 0 {
+		pageSize = utils.PageSize20
+	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize = utils.StartIndex(currentIndex, pageSize)
+
+	var pars []interface{}
+	var condition string
+
+	var total int
+	list := make([]*data_manage.BaseEdbInfo, 0)
+	var err error
+
+	switch source {
+	case utils.DATA_SOURCE_MYSTEEL_CHEMICAL: // 钢联
+		if classifyId > 0 {
+			condition += " AND base_from_mysteel_chemical_classify_id = ? "
+			pars = append(pars, classifyId)
+		}
+		if terminalCode != `` {
+			condition += " AND terminal_code = ? "
+			pars = append(pars, terminalCode)
+		}
+		if sysUserId != `` {
+			sysUserIdSlice := strings.Split(sysUserId, ",")
+			condition += ` AND sys_user_id IN (` + utils.GetOrmInReplace(len(sysUserIdSlice)) + `)`
+			pars = append(pars, sysUserIdSlice)
+		}
+		if frequency != `` {
+			condition += " AND frequency = ? "
+			pars = append(pars, frequency)
+		}
+		if keyword != `` {
+			keywordSlice := strings.Split(keyword, ",")
+			if len(keywordSlice) > 0 {
+				tmpConditionSlice := make([]string, 0)
+				tmpConditionSlice = append(tmpConditionSlice, ` index_name like ? or index_code like ? `)
+				pars = utils.GetLikeKeywordPars(pars, keyword, 2)
+
+				for _, v := range keywordSlice {
+					tmpConditionSlice = append(tmpConditionSlice, ` index_name like ? or index_code like ? `)
+					pars = utils.GetLikeKeywordPars(pars, v, 2)
+				}
+				condition += ` AND (` + strings.Join(tmpConditionSlice, " or ") + `)`
+
+			} else {
+				condition += ` index_name like ? or index_code like ? `
+				pars = utils.GetLikeKeywordPars(pars, keyword, 2)
+			}
+		}
+
+		total, list, err = data_manage.GetMysteelChemicalBaseInfo(condition, pars, startSize, pageSize)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+	case utils.DATA_SOURCE_YS: // 有色
+		if classifyId > 0 {
+			condition += " AND classify_id = ? "
+			pars = append(pars, classifyId)
+		}
+		if terminalCode != `` {
+			condition += " AND terminal_code = ? "
+			pars = append(pars, terminalCode)
+		}
+		if frequency != `` {
+			condition += " AND frequency = ? "
+			pars = append(pars, frequency)
+		}
+		if keyword != `` {
+			keywordSlice := strings.Split(keyword, ",")
+			if len(keywordSlice) > 0 {
+				tmpConditionSlice := make([]string, 0)
+				tmpConditionSlice = append(tmpConditionSlice, ` index_name like ? or index_code like ? `)
+				pars = utils.GetLikeKeywordPars(pars, keyword, 2)
+
+				for _, v := range keywordSlice {
+					tmpConditionSlice = append(tmpConditionSlice, ` index_name like ? or index_code like ? `)
+					pars = utils.GetLikeKeywordPars(pars, v, 2)
+				}
+				condition += ` AND (` + strings.Join(tmpConditionSlice, " or ") + `)`
+
+			} else {
+				condition += ` index_name like ? or index_code like ? `
+				pars = utils.GetLikeKeywordPars(pars, keyword, 2)
+			}
+		}
+
+		total, list, err = data_manage.GetSmmBaseInfo(condition, pars, startSize, pageSize)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+	default:
+		condition += ` AND source = ? AND sub_source = ? `
+		pars = append(pars, source, subSource)
+
+		if classifyId > 0 {
+			condition += " AND classify_id = ? "
+			pars = append(pars, classifyId)
+		}
+		if terminalCode != `` {
+			condition += " AND terminal_code = ? "
+			pars = append(pars, terminalCode)
+		}
+		if sysUserId != `` {
+			sysUserIdSlice := strings.Split(sysUserId, ",")
+			condition += ` AND sys_user_id IN (` + utils.GetOrmInReplace(len(sysUserIdSlice)) + `)`
+			pars = append(pars, sysUserIdSlice)
+		}
+		if frequency != `` {
+			condition += " AND frequency = ? "
+			pars = append(pars, frequency)
+		}
+		if keyword != `` {
+			keywordSlice := strings.Split(keyword, ",")
+			if len(keywordSlice) > 0 {
+				tmpConditionSlice := make([]string, 0)
+				tmpConditionSlice = append(tmpConditionSlice, ` edb_name like ? or edb_code like ? `)
+				pars = utils.GetLikeKeywordPars(pars, keyword, 2)
+
+				for _, v := range keywordSlice {
+					tmpConditionSlice = append(tmpConditionSlice, ` edb_name like ? or edb_code like ? `)
+					pars = utils.GetLikeKeywordPars(pars, v, 2)
+				}
+				condition += ` AND (` + strings.Join(tmpConditionSlice, " or ") + `)`
+
+			} else {
+				condition += ` edb_name like ? or edb_code like ? `
+				pars = utils.GetLikeKeywordPars(pars, keyword, 2)
+			}
+		}
+
+		total, list, err = data_manage.GetEdbBaseInfo(condition, pars, startSize, pageSize)
+		if err != nil && err.Error() != utils.ErrNoRow() {
+			br.Msg = "获取失败"
+			br.ErrMsg = "获取数据失败,Err:" + err.Error()
+			return
+		}
+	}
+
+	page := paging.GetPaging(currentIndex, pageSize, total)
+
+	resp := data_manage.RefreshBaseEdbInfoResp{
+		Paging: page,
+		List:   list,
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 25 - 6
controllers/data_source/guagnzhouqihuo.go

@@ -273,8 +273,15 @@ func (this *DataSourceController) GfexIndexDetail() {
 	condition += ` a.base_from_trade_guangzhou_classify_id = ? `
 	pars = append(pars, baseFromTradeGuangzhouIndexId)
 
-	condition += ` a.end_date = ? `
-	pars = append(pars, tradeDate)
+	td, err := time.Parse(utils.FormatDate, tradeDate)
+	if err != nil {
+		br.Msg = "日期格式错误"
+		br.ErrMsg = "日期格式错误,Err:" + err.Error()
+		return
+	}
+	_, monthEndDay := utils.GetMonthStartAndEnd(strconv.Itoa(td.Year()), strconv.Itoa(int(td.Month())))
+	condition += ` AND a.end_date = ? `
+	pars = append(pars, monthEndDay)
 
 	gzqhObj := new(data_source.BaseFromTradeGuangzhouIndex)
 	list, err := gzqhObj.GetBaseFromTradeGuangzhouIndexDetail(condition, pars)
@@ -326,8 +333,15 @@ func (this *DataSourceController) ExportGfexIndexDetail() {
 	condition += ` a.base_from_trade_guangzhou_classify_id = ? `
 	pars = append(pars, baseFromTradeGuangzhouIndexId)
 
-	condition += ` a.end_date = ? `
-	pars = append(pars, tradeDate)
+	td, err := time.Parse(utils.FormatDate, tradeDate)
+	if err != nil {
+		br.Msg = "日期格式错误"
+		br.ErrMsg = "日期格式错误,Err:" + err.Error()
+		return
+	}
+	_, monthEndDay := utils.GetMonthStartAndEnd(strconv.Itoa(td.Year()), strconv.Itoa(int(td.Month())))
+	condition += ` AND a.end_date = ? `
+	pars = append(pars, monthEndDay)
 
 	gzqhObj := new(data_source.BaseFromTradeGuangzhouIndex)
 	list, err := gzqhObj.GetBaseFromTradeGuangzhouIndexDetail(condition, pars)
@@ -342,7 +356,12 @@ func (this *DataSourceController) ExportGfexIndexDetail() {
 
 	downLoadnFilePath := exPath + "/" + time.Now().Format(utils.FormatDateTimeUnSpace) + ".xlsx"
 	xlsxFile := xlsx.NewFile()
-	sheetNew := xlsxFile.Sheets[0]
+	sheetNew, err := xlsxFile.AddSheet("详情")
+	if err != nil {
+		br.ErrMsg = "导出失败,Err:" + err.Error()
+		br.Msg = "导出失败"
+		return
+	}
 	titleRow := sheetNew.AddRow()
 	titleRow.AddCell().SetValue("指标ID")
 	titleRow.AddCell().SetValue("指标名称")
@@ -385,7 +404,7 @@ func (this *DataSourceController) ExportGfexIndexDetail() {
 		}
 	}
 	fileName := `一次性交割卖方仓单详情`
-	fileName += indexCode[:6] + time.Now().Format("06.01.02") + `.xlsx` //文件名称
+	fileName = indexCode[:6] + fileName + `.xlsx` //文件名称
 	this.Ctx.Output.Download(downLoadnFilePath, fileName)
 	defer func() {
 		os.Remove(downLoadnFilePath)

+ 2 - 0
go.mod

@@ -62,6 +62,7 @@ require (
 	github.com/fatih/structs v1.1.0 // indirect
 	github.com/fsnotify/fsnotify v1.6.0 // indirect
 	github.com/garyburd/redigo v1.6.3 // indirect
+	github.com/go-ego/gse v0.80.2 // indirect
 	github.com/go-redis/redis/v8 v8.11.6-0.20220405070650-99c79f7041fc // indirect
 	github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
 	github.com/golang/protobuf v1.5.2 // indirect
@@ -103,6 +104,7 @@ require (
 	github.com/tidwall/match v1.1.1 // indirect
 	github.com/tidwall/pretty v1.2.0 // indirect
 	github.com/tjfoc/gmsm v1.3.2 // indirect
+	github.com/vcaesar/cedar v0.20.1 // indirect
 	github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 // indirect
 	github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 // indirect
 	golang.org/x/crypto v0.12.0 // indirect

+ 12 - 0
go.sum

@@ -15,6 +15,7 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy
 github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
 github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
 github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
+github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
 github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4 h1:iC9YFYKDGEy3n/FtqJnOkZsene9olVspKmkX5A2YBEo=
 github.com/alibabacloud-go/alibabacloud-gateway-spi v0.0.4/go.mod h1:sCavSAvdzOjul4cEqeVtvlSaSScfNsTQ+46HwlTL1hc=
 github.com/alibabacloud-go/alimt-20181012/v2 v2.0.0 h1:RZF3WXYiPB/m1FiZS51udLbpAvg0urYi1wAfB18kiUQ=
@@ -143,10 +144,13 @@ github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbS
 github.com/garyburd/redigo v1.6.3 h1:HCeeRluvAgMusMomi1+6Y5dmFOdYV/JzoRrrbFlkGIc=
 github.com/garyburd/redigo v1.6.3/go.mod h1:rTb6epsqigu3kYKBnaF028A7Tf/Aw5s0cqA47doKKqw=
 github.com/glendc/gopher-json v0.0.0-20170414221815-dc4743023d0c/go.mod h1:Gja1A+xZ9BoviGJNA2E9vFkPjjsl+CoJxSXiQM1UXtw=
+github.com/go-ego/gse v0.80.2 h1:3LRfkaBuwlsHsmkOZvnhTcsYPXUAhiP06Sqcid7mO1M=
+github.com/go-ego/gse v0.80.2/go.mod h1:kesekpZfcFQ/kwd9b27VZHUOH5dQUjaaQUZ4OGt4Hj4=
 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
 github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
 github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
 github.com/go-redis/redis v6.14.2+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA=
 github.com/go-redis/redis/v8 v8.11.6-0.20220405070650-99c79f7041fc h1:jZY+lpZB92nvBo2f31oPC/ivGll6NcsnEOORm8Fkr4M=
 github.com/go-redis/redis/v8 v8.11.6-0.20220405070650-99c79f7041fc/go.mod h1:25mL1NKxbJhB63ihiK8MnNeTRd+xAizd6bOdydrTLUQ=
@@ -244,6 +248,7 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1 h1:shLQSRRSCCPj3f2gpwzGw
 github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
 github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
 github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
+github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
 github.com/json-iterator/go v1.1.5/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
 github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -252,6 +257,7 @@ github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHm
 github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
 github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
 github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
 github.com/kgiannakakis/mp3duration v0.0.0-20191013070830-d834f8d5ed53 h1:+8X3HMX8A2QhvNg3dImiQTCiVUt6BQXz1mW+/DrWI+k=
 github.com/kgiannakakis/mp3duration v0.0.0-20191013070830-d834f8d5ed53/go.mod h1:E61jD6q4yJ6Cu9uDGRAfiENM1G5TVZhOog0Y3+GgTpQ=
 github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
@@ -261,6 +267,7 @@ github.com/klauspost/cpuid/v2 v2.0.1/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa02
 github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg=
 github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
 github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
+github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
 github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
 github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
 github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
@@ -301,6 +308,7 @@ github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826/go.mod h1:TaXosZuwd
 github.com/mojocn/base64Captcha v1.3.5 h1:Qeilr7Ta6eDtG4S+tQuZ5+hO+QHbiGAJdi4PfoagaA0=
 github.com/mojocn/base64Captcha v1.3.5/go.mod h1:/tTTXn4WTpX9CfrmipqRytCpJ27Uw3G6I7NcP2WwcmY=
 github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
 github.com/nbio/st v0.0.0-20140626010706-e9e8d9816f32/go.mod h1:9wM+0iRr9ahx58uYLpLIr5fm8diHn0JbqRycJi6w0Ms=
 github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
 github.com/nosixtools/solarlunar v0.0.0-20211112060703-1b6dea7b4a19 h1:LhWT2dBuNkYexwRSsPpYh67e0ikmH1ebBDaVkGHoMts=
@@ -431,6 +439,8 @@ github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhso
 github.com/tjfoc/gmsm v1.3.2 h1:7JVkAn5bvUJ7HtU08iW6UiD+UTmJTIToHCfeFzkcCxM=
 github.com/tjfoc/gmsm v1.3.2/go.mod h1:HaUcFuY0auTiaHB9MHFGCPx5IaLhTUd2atbCFBQXn9w=
 github.com/ugorji/go v0.0.0-20171122102828-84cb69a8af83/go.mod h1:hnLbHMwcvSihnDhEfx2/BzKp2xb0Y+ErdfYcrs9tkJQ=
+github.com/vcaesar/cedar v0.20.1 h1:cDOmYWdprO7ZW8cngJrDi8Zivnscj9dA/y8Y+2SB1P0=
+github.com/vcaesar/cedar v0.20.1/go.mod h1:iMDweyuW76RvSrCkQeZeQk4iCbshiPzcCvcGCtpM7iI=
 github.com/wendal/errors v0.0.0-20130201093226-f66c77a7882b/go.mod h1:Q12BUT7DqIlHRmgv3RskH+UCM/4eqVMgI0EMmlSpAXc=
 github.com/xuri/efp v0.0.0-20220603152613-6918739fd470 h1:6932x8ltq1w4utjmfMPVj09jdMlkY0aiA6+Skbtl3/c=
 github.com/xuri/efp v0.0.0-20220603152613-6918739fd470/go.mod h1:ybY/Jr0T0GTCnYjKqmdwxyxn2BQf2RcQIIvex5QldPI=
@@ -438,6 +448,8 @@ github.com/xuri/excelize/v2 v2.7.1 h1:gm8q0UCAyaTt3MEF5wWMjVdmthm2EHAWesGSKS9tdV
 github.com/xuri/excelize/v2 v2.7.1/go.mod h1:qc0+2j4TvAUrBw36ATtcTeC1VCM0fFdAXZOmcF4nTpY=
 github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22 h1:OAmKAfT06//esDdpi/DZ8Qsdt4+M5+ltca05dA5bG2M=
 github.com/xuri/nfp v0.0.0-20220409054826-5e722a1d9e22/go.mod h1:WwHg+CVyzlv/TX9xqBFXEZAuxOPxn2k1GNHwG41IIUQ=
+github.com/yanyiwu/gojieba v1.3.0 h1:6VeaPOR+MawnImdeSvWNr7rP4tvUfnGlEKaoBnR33Ds=
+github.com/yanyiwu/gojieba v1.3.0/go.mod h1:54wkP7sMJ6bklf7yPl6F+JG71dzVUU1WigZbR47nGdY=
 github.com/yidane/formula v0.0.0-20210902154546-0782e1736717 h1:9CTJJpdISGxMAELfVlprj5kZEsJEaNAWiobv8ZAd72U=
 github.com/yidane/formula v0.0.0-20210902154546-0782e1736717/go.mod h1:9/dQiKiN04yPMdgsuFmKGuI2Hdp6OmFV9gSWS1col6g=
 github.com/ylywyn/jpush-api-go-client v0.0.0-20190906031852-8c4466c6e369/go.mod h1:Nv7wKD2/bCdKUFNKcJRa99a+1+aSLlCRJFriFYdjz/I=

+ 1 - 1
models/data_manage/chart_edb_mapping.go

@@ -186,7 +186,7 @@ func GetChartEdbMappingListV2(chartInfoId int) (list []*ChartEdbInfoMapping, err
 // GetChartEdbMappingByEdbInfoId 根据指标id获取edb_mapping
 func GetChartEdbMappingByEdbInfoId(edbInfoId int) (item *ChartEdbInfoMapping, err error) {
 	o := orm.NewOrmUsingDB("data")
-	sql := ` SELECT edb_info_id,source_name,classify_id,source,sub_source,edb_code,edb_name,edb_name_en,frequency,unit,unit_en,start_date,end_date,modify_time,latest_date,latest_value,unique_code,edb_info_type AS edb_info_category_type,max_value,min_value
+	sql := ` SELECT edb_info_id,source_name,classify_id,source,sub_source,edb_code,edb_name,edb_name_en,frequency,unit,unit_en,start_date,end_date,modify_time,latest_date,latest_value,unique_code,edb_info_type AS edb_info_category_type,edb_type,max_value,min_value
              FROM edb_info
 			 WHERE edb_info_id = ? limit 1`
 	err = o.Raw(sql, edbInfoId).QueryRow(&item)

+ 8 - 0
models/data_manage/edb_classify.go

@@ -146,6 +146,14 @@ func GetEdbClassifyAll() (items []*EdbClassifyItems, err error) {
 	return
 }
 
+// GetAllEdbClassify 获取所有的普通指标的分类列表(包含第一级)
+func GetAllEdbClassify() (items []*EdbClassifyItems, err error) {
+	o := orm.NewOrmUsingDB("data")
+	sql := ` SELECT * FROM edb_classify WHERE  classify_type = 0  order by sort asc,classify_id asc`
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
 // GetNormalEdbClassifyAll 获取普通指标的分类列表
 func GetNormalEdbClassifyAll() (items []*EdbClassifyItems, err error) {
 	o := orm.NewOrmUsingDB("data")

+ 23 - 0
models/data_manage/edb_info.go

@@ -1735,3 +1735,26 @@ type EdbInfoSmmExistCheckResp struct {
 	EdbInfoExistCheckResp
 	ExistAll bool `description:"是否全部重复"`
 }
+
+// GetEdbBaseInfo 获取指标库数据列表
+func GetEdbBaseInfo(condition string, pars []interface{}, startSize, pageSize int) (total int, items []*BaseEdbInfo, err error) {
+	o := orm.NewOrmUsingDB("data")
+	// 数量汇总
+	totalSql := ` SELECT count(1) FROM edb_info WHERE 1=1 `
+	if condition != "" {
+		totalSql += condition
+	}
+	err = o.Raw(totalSql, pars).QueryRow(&total)
+	if err != nil {
+		return
+	}
+
+	// 列表数据
+	sql := ` SELECT edb_info_id as edb_info_id, classify_id as classify_id,edb_code as index_code,edb_name as index_name,end_date,sys_user_id,sys_user_real_name,frequency,no_update as is_stop,terminal_code FROM edb_info WHERE 1=1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` ORDER BY edb_info_id ASC  LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 51 - 0
models/data_manage/edb_refresh_source.go

@@ -0,0 +1,51 @@
+package data_manage
+
+import (
+	"github.com/beego/beego/v2/client/orm"
+	"time"
+)
+
+// EdbRefreshSource
+// @Description: 获取刷新的数据源
+type EdbRefreshSource struct {
+	Id            int       `orm:"column(id);pk"`
+	Source        int       `orm:"column(source)" description:"来源"`
+	SourceName    string    `description:"来源名称"`
+	SubSource     int       `description:"子数据来源:0:经济数据库,1:日期序列"`
+	SubSourceName string    `description:"子来源名称"`
+	HasChild      int       `description:"是否有子来源,0:否,1:是"`
+	ModifyTime    time.Time `description:"修改时间"`
+	CreateTime    time.Time `description:"创建时间"`
+}
+
+// EdbRefreshSourceList
+// @Description: 获取刷新的数据源列表
+type EdbRefreshSourceList struct {
+	Source        int                    `orm:"column(source)" description:"来源"`
+	SourceName    string                 `description:"来源名称"`
+	SubSource     int                    `description:"子数据来源:0:经济数据库,1:日期序列"`
+	SubSourceName string                 `description:"子来源名称"`
+	Child         []EdbRefreshSourceList `description:"子来源"`
+	HasChild      int                    `description:"是否有子来源,0:否,1:是"`
+}
+
+// GetAllList
+// @Description: 获取刷新数据源列表
+// @author: Roc
+// @datetime 2024-01-03 15:03:24
+// @return items []*EdbRefreshSource
+// @return err error
+func (m EdbRefreshSource) GetAllList() (items []*EdbRefreshSource, err error) {
+	o := orm.NewOrmUsingDB("data")
+	sql := ` SELECT *  FROM edb_refresh_source ORDER BY id ASC `
+	_, err = o.Raw(sql).QueryRows(&items)
+	return
+}
+
+type BaseClassifyItems struct {
+	ClassifyId   int                  `description:"分类id"`
+	ClassifyName string               `description:"分类名称"`
+	ParentId     int                  `description:"父级id"`
+	UniqueCode   string               `description:"唯一编码"`
+	Children     []*BaseClassifyItems `description:"下级"`
+}

+ 47 - 0
models/data_manage/mysteel_chemical_index.go

@@ -30,6 +30,7 @@ type BaseFromMysteelChemicalIndex struct {
 	Sort                              int       `description:"排序字段"`
 	MergeFilePath                     string    `description:"合并文件"`
 	TerminalCode                      string    `description:"终端编码"`
+	IsStop                            int       `description:"是否停更:1:停更,0:未停更"`
 }
 
 // Update 更新钢联化工指标基础信息
@@ -337,3 +338,49 @@ func GetMysteelChemicalGroupTerminalNum() (items []*TerminalNum, err error) {
 	_, err = o.Raw(sql).QueryRows(&items)
 	return
 }
+
+type BaseEdbInfo struct {
+	EdbInfoId       int
+	ClassifyId      int    `description:"钢联化工指标分类id"`
+	IndexCode       string `description:"指标编码"`
+	IndexName       string `description:"指标名称"`
+	EndDate         string `description:"最新日期"`
+	EndValue        string `description:"最新值"`
+	SysUserId       int    `description:"创建人id"`
+	SysUserRealName string `description:"创建人姓名"`
+	Frequency       string `description:"频度"`
+	IsStop          int    `description:"是否停更:1:停更,0:未停更"`
+	TerminalCode    string `description:"终端编码"`
+	RefreshTime     string `description:"刷新时间"`
+}
+
+// RefreshBaseEdbInfoResp
+// @Description: 刷新数据源的数据返回
+type RefreshBaseEdbInfoResp struct {
+	Paging *paging.PagingItem
+	List   []*BaseEdbInfo
+}
+
+// GetMysteelChemicalBaseInfo 获取钢联化工数据列表
+func GetMysteelChemicalBaseInfo(condition string, pars []interface{}, startSize, pageSize int) (total int, items []*BaseEdbInfo, err error) {
+	o := orm.NewOrmUsingDB("data")
+
+	// 数量汇总
+	totalSql := ` SELECT count(1) FROM base_from_mysteel_chemical_index WHERE 1=1 `
+	if condition != "" {
+		totalSql += condition
+	}
+	err = o.Raw(totalSql, pars).QueryRow(&total)
+	if err != nil {
+		return
+	}
+
+	// 列表数据
+	sql := ` SELECT base_from_mysteel_chemical_index_id as edb_info_id, base_from_mysteel_chemical_classify_id as classify_id,index_code,index_name,end_date,sys_user_id,sys_user_real_name,frequency,is_stop,terminal_code FROM base_from_mysteel_chemical_index WHERE 1=1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` ORDER BY base_from_mysteel_chemical_index_id ASC  LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 24 - 0
models/data_manage/smm_data.go

@@ -230,3 +230,27 @@ func GetExportSmmIndexDataByCodes(indexCodes []string) (items []*ExportSmmIndexD
 	_, err = o.Raw(sql, indexCodes).QueryRows(&items)
 	return
 }
+
+// GetSmmBaseInfo 获取有色数据列表
+func GetSmmBaseInfo(condition string, pars []interface{}, startSize, pageSize int) (total int, items []*BaseEdbInfo, err error) {
+	o := orm.NewOrmUsingDB("data")
+
+	// 数量汇总
+	totalSql := ` SELECT count(1) FROM base_from_smm_index WHERE 1=1 `
+	if condition != "" {
+		totalSql += condition
+	}
+	err = o.Raw(totalSql, pars).QueryRow(&total)
+	if err != nil {
+		return
+	}
+
+	// 列表数据
+	sql := ` SELECT base_from_smm_index_id as edb_info_id, classify_id,index_code,index_name,end_date,frequency,is_stop,terminal_code FROM base_from_smm_index WHERE 1=1  `
+	if condition != "" {
+		sql += condition
+	}
+	sql += ` ORDER BY base_from_smm_index_id ASC  LIMIT ?,? `
+	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
+	return
+}

+ 27 - 0
routers/commentsRouter.go

@@ -2950,6 +2950,33 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"],
+        beego.ControllerComments{
+            Method: "RefreshClassifyList",
+            Router: `/edb_info/refresh/classify_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"],
+        beego.ControllerComments{
+            Method: "RefreshEdbList",
+            Router: `/edb_info/refresh/edb_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"],
+        beego.ControllerComments{
+            Method: "RefreshSourceList",
+            Router: `/edb_info/refresh/source_list`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage:EdbInfoController"],
         beego.ControllerComments{
             Method: "RelationChartList",