浏览代码

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

Roc 1 年之前
父节点
当前提交
ca2580d7f7

+ 192 - 2
controllers/data_manage/edb_info_refresh.go

@@ -5,6 +5,8 @@ import (
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/utils"
 	"fmt"
+	"github.com/rdlucklib/rdluck_tools/paging"
+	"strings"
 )
 
 // RefreshSourceList
@@ -220,8 +222,6 @@ func (c *EdbInfoController) RefreshClassifyList() {
 	br.Data = list
 }
 
-// 生成多层级列表的函数
-
 // 生成多层级列表的递归函数
 func buildTree(items []*data_manage.BaseClassifyItems, parentId int) []*data_manage.BaseClassifyItems {
 	var result []*data_manage.BaseClassifyItems
@@ -239,3 +239,193 @@ func buildTree(items []*data_manage.BaseClassifyItems, parentId int) []*data_man
 
 	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
+}

+ 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=

+ 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
+}

+ 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
+}

+ 9 - 0
routers/commentsRouter.go

@@ -2959,6 +2959,15 @@ 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: "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",