123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- package data_manage
- import (
- "github.com/beego/beego/v2/client/orm"
- )
- type ChartEdbInfoMapping struct {
- EdbInfoId int `description:"指标id"`
- SourceName string `description:"来源名称"`
- Source int `description:"来源id"`
- EdbCode string `description:"指标编码"`
- EdbName string `description:"指标名称"`
- EdbAliasName string `description:"指标名称(别名)"`
- EdbNameEn string `description:"英文指标名称"`
- EdbAliasNameEn string `description:"英文指标名称(别名)"`
- EdbType int `description:"指标类型:1:基础指标,2:计算指标"`
- Frequency string `description:"频率"`
- FrequencyEn string `description:"英文频率"`
- Unit string `description:"单位"`
- UnitEn string `description:"英文单位"`
- StartDate string `description:"起始日期"`
- EndDate string `description:"终止日期"`
- ModifyTime string `description:"指标最后更新时间"`
- ChartEdbMappingId int `description:"图表指标id"`
- ChartInfoId int `description:"图表id"`
- MaxData float64 `description:"上限"`
- MinData float64 `description:"下限"`
- IsOrder bool `description:"true:正序,false:逆序"`
- IsAxis int `description:"1:左轴,0:右轴"`
- EdbInfoType int `description:"1:标准指标,0:领先指标"`
- EdbInfoCategoryType int `description:"0:普通指标,1:预测指标"`
- LeadValue int `description:"领先值"`
- LeadUnit string `description:"领先单位"`
- LeadUnitEn string `description:"领先英文单位"`
- ChartStyle string `description:"图表类型"`
- ChartColor string `description:"颜色"`
- PredictChartColor string `description:"预测数据的颜色"`
- ChartWidth float64 `description:"线条大小"`
- ChartType int `description:"生成样式:1:曲线图,2:季节性图,3:面积图,4:柱状图,5:散点图,6:组合图"`
- LatestDate string `description:"数据最新日期"`
- LatestValue float64 `description:"数据最新值"`
- UniqueCode string `description:"指标唯一编码"`
- MinValue float64 `json:"-" description:"最小值"`
- MaxValue float64 `json:"-" description:"最大值"`
- DataList interface{}
- IsNullData bool `json:"-" description:"是否空数据"`
- }
- func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err error) {
- o := orm.NewOrmUsingDB("data")
- sql := ` SELECT a.*,b.source_name,b.source,b.edb_code,b.edb_name,b.edb_name_en,b.frequency,b.unit,b.unit_en,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value,b.unique_code,b.edb_info_type AS edb_info_category_type
- FROM chart_edb_mapping AS a
- INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
- WHERE chart_info_id=?
- ORDER BY chart_edb_mapping_id ASC `
- _, err = o.Raw(sql, chartInfoId).QueryRows(&list)
- return
- }
- // BarChartInfoReq 柱方图预览请求数据
- type BarChartInfoReq struct {
- EdbInfoIdList []BarChartInfoEdbItemReq `description:"指标信息"`
- DateList []BarChartInfoDateReq `description:"日期配置"`
- Sort BarChartInfoSortReq `description:"排序"`
- }
- type FutureGoodBarChartInfoReq struct {
- EdbInfoIdList []BarChartInfoEdbItemReq `description:"指标信息"`
- DateList []BarChartInfoDateReq `description:"日期配置"`
- XDataList []XData `description:"横轴配置"`
- BaseEdbInfoId int `description:"日期基准指标id"`
- }
- // XData 商品价格曲线的的x轴数据
- type XData struct {
- Name string `description:"别名"`
- NameEn string `description:"英文别名"`
- IsHide int `description:"是否隐藏,0不隐藏,1隐藏"`
- }
- // BarChartInfoEdbItemReq 柱方图预览请求数据(指标相关)
- type BarChartInfoEdbItemReq struct {
- EdbInfoId int `description:"指标ID"`
- Name string `description:"别名"`
- NameEn string `description:"英文别名"`
- Source int `description:"1:ETA图库;2:商品价格"`
- IsHide int `description:"是否隐藏该项,0不隐藏,1隐藏"`
- }
- // BarChartInfoDateReq 柱方图预览请求数据(日期相关)
- type BarChartInfoDateReq struct {
- Type int `description:"配置类型"`
- Date string `description:"固定日期"`
- Value int `description:"N天的值"`
- Color string `description:"颜色"`
- Name string `description:"别名"`
- }
- // BarChartInfoSortReq 柱方图预览请求数据(排序相关)
- type BarChartInfoSortReq struct {
- Sort int `description:"排序类型,0:默认,1:升序,2:降序"`
- DateIndex int `description:"日期数据的下标,从0开始"`
- }
- // SectionScatterReq 截面散点请求
- type SectionScatterReq struct {
- XName string `description:"x轴名称"`
- XNameEn string `description:"x轴名称(英文)"`
- XUnitName string `description:"x轴单位名称"`
- XUnitNameEn string `description:"x轴单位名称(英文)"`
- YName string `description:"y轴名称"`
- YNameEn string `description:"y轴名称(英文)"`
- YUnitName string `description:"y轴单位名称"`
- YUnitNameEn string `description:"y轴单位名称(英文)"`
- XMinValue string `description:"X轴的最小值"`
- XMaxValue string `description:"X轴的最大值"`
- YMinValue string `description:"Y轴的最小值"`
- YMaxValue string `description:"Y轴的最大值"`
- //EdbList []SectionScatterEdbItemReq `description:"指标数据"`
- SeriesList []SectionScatterSeriesItemReq `description:"系列数据"`
- }
- // SectionScatterSeriesItemReq 系列的请求
- type SectionScatterSeriesItemReq struct {
- Name string `description:"系列名"`
- NameEn string `description:"系列名(英文)"`
- Color string `description:"颜色"`
- EdbInfoList []SectionScatterEdbItemReq
- ShowTrendLine bool `description:"是否展示趋势线"`
- ShowFitEquation bool `description:"是否展示方程式"`
- ShowRSquare bool `description:"是否展示R平方"`
- }
- // SectionScatterEdbItemReq 截面散点请求的指标
- type SectionScatterEdbItemReq struct {
- XEdbInfoId int `description:"X轴的指标ID"`
- YEdbInfoId int `description:"Y轴的指标ID"`
- Name string `description:"别名"`
- NameEn string `description:"英文别名"`
- XDateType int `description:"X轴的日期配置类型"`
- XDate string `description:"X轴的日期固定日期"`
- XDateValue int `description:"X轴的日期N天的值"`
- YDateType int `description:"Y轴的日期配置类型"`
- YDate string `description:"Y轴的日期固定日期"`
- YDateValue int `description:"Y轴的日期N天的值"`
- IsShow bool `description:"是否展示"`
- }
- // SectionScatterInfoResp 截面散点图数据
- type SectionScatterInfoResp struct {
- XName string `description:"x轴名称"`
- XNameEn string `description:"x轴名称(英文)"`
- XUnitName string `description:"x轴单位名称"`
- XUnitNameEn string `description:"x轴单位名称(英文)"`
- YName string `description:"y轴名称"`
- YNameEn string `description:"y轴名称(英文)"`
- YUnitName string `description:"y轴单位名称"`
- YUnitNameEn string `description:"y轴单位名称(英文)"`
- XMinValue string `description:"X轴的最小值"`
- XMaxValue string `description:"X轴的最大值"`
- YMinValue string `description:"Y轴的最小值"`
- YMaxValue string `description:"Y轴的最大值"`
- DataList []SectionScatterSeriesItemResp `description:"数据列"`
- }
- // SectionScatterSeriesItemResp 系列的返回
- type SectionScatterSeriesItemResp struct {
- Name string `description:"系列名"`
- NameEn string `description:"系列名(英文)"`
- Color string `description:"颜色"`
- EdbInfoList []SectionScatterEdbItemResp
- ShowTrendLine bool `description:"是否展示趋势线"`
- ShowFitEquation bool `description:"是否展示方程式"`
- ShowRSquare bool `description:"是否展示R平方"`
- TrendLine string `description:"方程式"`
- RSquare string `description:"R平方的值(决定系数R2)"`
- TrendLimitData []CoordinatePoint `description:"趋势线的前后坐标点"`
- }
- // SectionScatterEdbItemResp 截面散点的返回参数
- type SectionScatterEdbItemResp struct {
- XEdbInfoId int `description:"X轴指标id"`
- XDate string `description:"X轴指标实际日期"`
- XName string `description:"X轴指标名称"`
- XNameEn string `description:"X轴指标英文名称"`
- XValue float64 `description:"X轴实际值"`
- YEdbInfoId int `description:"Y轴指标id"`
- YDate string `description:"Y轴指标实际日期"`
- YName string `description:"Y轴指标名称"`
- YNameEn string `description:"Y轴指标英文名称"`
- YValue float64 `description:"Y轴实际值"`
- IsShow bool `description:"是否展示"`
- Name string `description:"标签名称"`
- NameEn string `description:"英文标签名称"`
- }
- // CoordinatePoint 坐标点
- type CoordinatePoint struct {
- X float64
- Y float64
- }
- // RadarChartInfoReq 雷达图预览请求数据
- type RadarChartInfoReq struct {
- DateList []RadarChartInfoDateReq `description:"日期配置"`
- }
- // RadarChartInfoEdbItemReq 雷达图预览请求数据(指标相关)
- type RadarChartInfoEdbItemReq struct {
- EdbInfoId int `description:"指标ID"`
- Name string `description:"别名"`
- //NameEn string `description:"英文别名"`
- //Source int `description:"1:ETA图库;2:商品价格"`
- }
- // RadarChartInfoDateReq 雷达图预览请求数据(日期相关)
- type RadarChartInfoDateReq struct {
- Type int `description:"配置类型"`
- Date string `description:"固定日期"`
- Value int `description:"N天的值"`
- Color string `description:"颜色"`
- Name string `description:"别名"`
- }
- // RadarChartInfoResp 雷达图数据
- type RadarChartInfoResp struct {
- YDataList []RadarYData `description:"数据列"`
- XEdbIdValue []int
- }
- // RadarYData 雷达图的y轴数据
- type RadarYData struct {
- Date string `description:"数据日期"`
- Color string `description:"数据颜色"`
- Name string `description:"别名"`
- Value []float64 `description:"每个指标的值"`
- }
|