浏览代码

新增获取图表详情接口

hongze 3 年之前
父节点
当前提交
b880be5ae8
共有 4 个文件被更改,包括 603 次插入136 次删除
  1. 287 1
      controllers/chart.go
  2. 262 0
      models/chart.go
  3. 51 0
      models/edb_data_table.go
  4. 3 135
      utils/constants.go

+ 287 - 1
controllers/chart.go

@@ -1,7 +1,293 @@
 package controllers
 package controllers
 
 
+import (
+	"encoding/json"
+	"fmt"
+	"hongze/hongze_chart_lib/models"
+	"hongze/hongze_chart_lib/utils"
+	"strconv"
+	"time"
+)
 
 
 //图表
 //图表
 type ChartController struct {
 type ChartController struct {
 	BaseAuthController
 	BaseAuthController
-}
+}
+
+// @Title 获取图表详情
+// @Description 获取图表详情接口
+// @Param   UniqueCode   query   int  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
+// @Success 200 {object} data_manage.ChartInfoDetailResp
+// @router /detail [get]
+func (this *ChartController) ChartInfoDetail() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+
+	uniqueCode := this.GetString("UniqueCode")
+	if uniqueCode == "" {
+		br.Msg = "参数错误"
+		br.ErrMsg = "参数错误,uniqueCode is empty"
+		return
+	}
+	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
+	resp := new(models.ChartInfoDetailResp)
+	//判断是否有缓存
+	if utils.Re == nil {
+		if utils.Re == nil && utils.Rc.IsExist(key) {
+			if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {
+				err := json.Unmarshal(data, &resp)
+				if err == nil && resp != nil {
+					br.Ret = 200
+					br.Success = true
+					br.Msg = "获取成功"
+					br.Data = resp
+				}
+			}
+		}
+	}
+
+	chartInfo, err := models.GetChartInfoByUniqueCode(uniqueCode)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "改图已被删除,请刷新页面"
+			br.ErrMsg = "改图已被删除,请刷新页面,Err:" + err.Error()
+			return
+		}
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
+		return
+	}
+	chartInfoId := chartInfo.ChartInfoId
+
+	dateType := chartInfo.DateType
+	if dateType <= 0 {
+		dateType = 3
+	}
+	startDate := chartInfo.StartDate
+	endDate := chartInfo.EndDate
+	seasonStartDate := chartInfo.SeasonStartDate
+	seasonEndDate := chartInfo.SeasonEndDate
+	calendar := chartInfo.Calendar
+	chartType := chartInfo.ChartType
+
+	if calendar == "" {
+		calendar = "公历"
+	}
+
+	switch dateType {
+	case 1:
+		startDate = "2000-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 2:
+		startDate = "2010-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 3:
+		startDate = "2015-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 4:
+		startDate = strconv.Itoa(time.Now().Year()) + "-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 5:
+		startDate = startDate + "-01"
+		endDate = endDate + "-01"
+	case 6:
+		startDate = startDate + "-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 7:
+		startDate = "2018-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 8:
+		startDate = "2019-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	case 9:
+		startDate = "2020-01-01"
+		endDate = time.Now().Format(utils.FormatDate)
+	}
+
+	if startDate == "" || endDate == "" {
+		br.Msg = "参数错误"
+		br.Msg = "参数错误,无效的查询日期"
+		return
+	}
+
+	if chartType == 2 {
+		if seasonStartDate != "" {
+			startDate = seasonStartDate + "-01-01"
+		} else {
+			fivePre := time.Now().AddDate(-4, 0, 0).Year()
+			startDate = strconv.Itoa(fivePre) + "-01-01"
+		}
+		if seasonEndDate != "" {
+			endDate = seasonEndDate + "-12-31"
+		} else {
+			endDate = time.Now().Format(utils.FormatDate)
+		}
+	}
+
+	mappingList, err := models.GetChartEdbMappingList(chartInfoId)
+	if err != nil {
+		br.Msg = "获取失败"
+		br.ErrMsg = "获取图表,指标信息失败,Err:" + err.Error()
+		return
+	}
+
+	edbList := make([]*models.ChartEdbInfoMapping, 0)
+	for _, v := range mappingList {
+		//minData, maxData, err := data_manage.GetEdbDataListMinAndMax(v.Source, v.EdbInfoId, startDate, endDate)
+		item := new(models.ChartEdbInfoMapping)
+		item.EdbInfoId = v.EdbInfoId
+		item.SourceName = v.SourceName
+		item.Source = v.Source
+		item.EdbCode = v.EdbCode
+		item.EdbName = v.EdbName
+		item.Frequency = v.Frequency
+		item.Unit = v.Unit
+		item.StartDate = v.StartDate
+		item.EndDate = v.EndDate
+		item.ModifyTime = v.ModifyTime
+		item.ChartEdbMappingId = v.ChartEdbMappingId
+		item.ChartInfoId = v.ChartInfoId
+		item.MaxData = v.MaxData
+		item.MinData = v.MinData
+		item.IsOrder = v.IsOrder
+		item.IsAxis = v.IsAxis
+		item.EdbInfoType = v.EdbInfoType
+		item.LeadValue = v.LeadValue
+		item.LeadUnit = v.LeadUnit
+		item.ChartStyle = v.ChartStyle
+		item.ChartColor = v.ChartColor
+		item.ChartWidth = v.ChartWidth
+
+		var startDateReal string
+		var diffSeconds int64
+		if chartType == 1 {
+			if v.EdbInfoType == 0 && v.LeadUnit != "" && v.LeadValue > 0 { //领先指标
+				var startTimeRealTemp time.Time
+				startDateParse, _ := time.Parse(utils.FormatDate, startDate)
+				switch v.LeadUnit {
+				case "天":
+					startTimeRealTemp = startDateParse.AddDate(0, 0, -v.LeadValue)
+				case "月":
+					startTimeRealTemp = startDateParse.AddDate(0, -v.LeadValue, 0)
+				case "季":
+					startTimeRealTemp = startDateParse.AddDate(0, -3*v.LeadValue, 0)
+				case "周":
+					startTimeRealTemp = startDateParse.AddDate(0, 0, -7*v.LeadValue)
+				case "年":
+					startTimeRealTemp = startDateParse.AddDate(-v.LeadValue, 0, 0)
+				}
+				if startTimeRealTemp.Before(startDateParse) {
+					startDateReal = startTimeRealTemp.Format(utils.FormatDate)
+					diffSeconds = (int64(startTimeRealTemp.UnixNano()) - int64(startDateParse.UnixNano())) / 1e6
+				} else {
+					startDateReal = startDate
+					diffSeconds = 0
+				}
+			} else {
+				startDateReal = startDate
+			}
+		} else {
+			startDateReal = startDate
+		}
+		calendarPreYear := 0
+		if calendar == "农历" {
+			newStartDateReal, err := time.Parse(utils.FormatDate, startDateReal)
+			if err != nil {
+				fmt.Println("time.Parse:" + err.Error())
+				utils.FileLog.Info("startDateReal parse err:" + err.Error())
+			}
+			calendarPreYear = newStartDateReal.Year() - 1
+			newStartDateReal = newStartDateReal.AddDate(-1, 0, 0)
+			startDateReal = newStartDateReal.Format(utils.FormatDate)
+		}
+		dataList := make([]*models.EdbDataList, 0)
+		fmt.Println("chart:", v.Source, v.EdbInfoId, startDateReal, endDate)
+		dataList, err = models.GetEdbDataList(v.Source, v.EdbInfoId, startDateReal, endDate)
+		if err != nil {
+			br.Msg = "获取失败"
+			br.Msg = "获取失败,Err:" + err.Error()
+			return
+		}
+		if diffSeconds != 0 && v.EdbInfoType == 0 {
+			dataListLen := len(dataList)
+			for i := 0; i < dataListLen; i++ {
+				dataList[i].DataTimestamp = dataList[i].DataTimestamp - diffSeconds
+			}
+		}
+
+		if chartType == 2 {
+			if calendar == "农历" {
+				result, err := models.AddCalculateQuarterV4(dataList)
+				if err != nil {
+					br.Msg = "获取失败"
+					br.Msg = "获取农历数据失败,Err:" + err.Error()
+					return
+				}
+				if result.List[0].Year != calendarPreYear {
+					itemList := make([]*models.EdbDataList, 0)
+					items := new(models.EdbDataItems)
+					//items.Year = calendarPreYear
+					items.Items = itemList
+
+					newResult := new(models.EdbDataResult)
+					newResult.List = append(newResult.List, items)
+					newResult.List = append(newResult.List, result.List...)
+					item.DataList = newResult
+				} else {
+					item.DataList = result
+				}
+			} else {
+				currentYear := time.Now().Year()
+				quarterDataList := make([]*models.QuarterData, 0)
+				quarterMap := make(map[int][]*models.EdbDataList)
+				var quarterArr []int
+				for _, v := range dataList {
+					//v.DataTime
+					itemDate, err := time.Parse(utils.FormatDate, v.DataTime)
+					if err != nil {
+						br.Msg = "获取失败"
+						br.Msg = "季度指标日期转换,Err:" + err.Error() + ";DataTime:" + v.DataTime
+						return
+					}
+					year := itemDate.Year()
+					newItemDate := itemDate.AddDate(currentYear-year, 0, 0)
+					timestamp := newItemDate.UnixNano() / 1e6
+					v.DataTimestamp = timestamp
+					if findVal, ok := quarterMap[year]; !ok {
+						quarterArr = append(quarterArr, year)
+						findVal = append(findVal, v)
+						quarterMap[year] = findVal
+					} else {
+						findVal = append(findVal, v)
+						quarterMap[year] = findVal
+					}
+				}
+				for _, v := range quarterArr {
+					itemList := quarterMap[v]
+					quarterItem := new(models.QuarterData)
+					quarterItem.Year = v
+					quarterItem.DataList = itemList
+					quarterDataList = append(quarterDataList, quarterItem)
+				}
+				item.DataList = quarterDataList
+			}
+		} else {
+			item.DataList = dataList
+		}
+		edbList = append(edbList, item)
+	}
+
+	resp.ChartInfo = chartInfo
+	resp.EdbInfoList = edbList
+	if utils.Re == nil {
+		data, _ := json.Marshal(resp)
+		utils.Rc.Put(key, data, utils.GetTodayLastSecond())
+	}
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "获取成功"
+	br.Data = resp
+}

+ 262 - 0
models/chart.go

@@ -0,0 +1,262 @@
+package models
+
+import (
+	"errors"
+	"fmt"
+	"hongze/hongze_chart_lib/utils"
+	"rdluck_tools/orm"
+	"strconv"
+	"time"
+
+	"github.com/nosixtools/solarlunar"
+)
+
+type ChartInfo struct {
+	ChartInfoId     int    `orm:"column(chart_info_id);pk"`
+	ChartName       string `description:"来源名称"`
+	ChartClassifyId int    `description:"图表分类id"`
+	SysUserId       int
+	SysUserRealName string
+	UniqueCode      string `description:"图表唯一编码"`
+	CreateTime      time.Time
+	ModifyTime      time.Time
+	DateType        int    `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
+	StartDate       string `description:"自定义开始日期"`
+	EndDate         string `description:"自定义结束日期"`
+	IsSetName       int    `description:"设置名称"`
+	EdbInfoIds      string `description:"指标id"`
+	ChartType       int    `description:"生成样式:1:曲线图,2:季节性图"`
+	Calendar        string `description:"公历/农历"`
+	SeasonStartDate string `description:"季节性图开始日期"`
+	SeasonEndDate   string `description:"季节性图开始日期"`
+	ChartImage      string `description:"图表图片"`
+}
+
+func GetChartInfoByUniqueCode(uniqueCode string) (item *ChartInfo, err error) {
+	o := orm.NewOrm()
+	o.Using("data")
+	sql := ` SELECT * FROM chart_info WHERE unique_code=? `
+	err = o.Raw(sql, uniqueCode).QueryRow(&item)
+	return
+}
+
+type ChartEdbInfoMapping struct {
+	EdbInfoId         int     `description:"指标id"`
+	SourceName        string  `description:"来源名称"`
+	Source            int     `description:"来源id"`
+	EdbCode           string  `description:"指标编码"`
+	EdbName           string  `description:"指标名称"`
+	Frequency         string  `description:"频率"`
+	Unit              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:领先指标"`
+	LeadValue         int     `description:"领先值"`
+	LeadUnit          string  `description:"领先单位"`
+	ChartStyle        string  `description:"图表类型"`
+	ChartColor        string  `description:"颜色"`
+	ChartWidth        float64 `description:"线条大小"`
+	DataList          interface{}
+}
+
+func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err error) {
+	o := orm.NewOrm()
+	o.Using("data")
+	sql := ` SELECT a.*,b.source_name,b.source,b.edb_code,b.edb_name,b.frequency,b.unit,b.start_date,b.end_date,b.modify_time 
+             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
+}
+
+type EdbDataList struct {
+	EdbDataId     int     `json:"-" description:" 指标数据ID"`
+	EdbInfoId     int     `json:"-" description:"指标ID"`
+	DataTime      string  `json:"-" description:"数据日期"`
+	DataTimestamp int64   `description:"数据日期"`
+	Value         float64 `description:"数据值"`
+}
+
+
+func GetEdbDataList(source, endInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
+	tableName := GetEdbDataTableName(source)
+	if tableName == "" {
+		err = errors.New("无效的渠道:" + strconv.Itoa(source))
+		list = make([]*EdbDataList, 0)
+		return list, err
+	}
+	sql := `SELECT edb_data_id,edb_info_id,data_time,TRUNCATE(value,2) AS value,data_timestamp FROM %s WHERE edb_info_id=? AND data_time>=? AND data_time<=? ORDER BY data_time ASC `
+	sql = fmt.Sprintf(sql, tableName)
+	o := orm.NewOrm()
+	o.Using("data")
+	_, err = o.Raw(sql, endInfoId, startDate, endDate).QueryRows(&list)
+	return
+}
+
+
+//指标季度数据计算(公历转农历)
+func AddCalculateQuarterV4(dataList []*EdbDataList) (result *EdbDataResult, err error) {
+	var errMsg string
+	defer func() {
+		if errMsg != "" {
+			fmt.Println("errMsg:", errMsg)
+		}
+	}()
+	result = new(EdbDataResult)
+	var yearArr []int
+	yearMap := make(map[int]int)
+	var cureentDate time.Time
+	for k, v := range dataList {
+		dateTime, err := time.Parse(utils.FormatDate, v.DataTime)
+		if err != nil {
+			errMsg = "time.Parse Err:" + err.Error() + ";DataTime:" + v.DataTime
+			return result, err
+		}
+		if k == len(dataList)-1 {
+			cureentDate = dateTime
+		}
+		year := dateTime.Year()
+		if _, ok := yearMap[year]; !ok {
+			yearArr = append(yearArr, year)
+		}
+		yearMap[year] = year
+	}
+	//排序
+	fmt.Println(yearArr)
+	thisYear := cureentDate.Year()
+	thisMonth := int(cureentDate.Month())
+
+	fmt.Println("thisMonth:", thisMonth)
+	//sort.Ints(yearArr)
+	fmt.Println("yearArr:", yearArr)
+	fmt.Println("thisYear:", thisYear)
+
+	for ky, vy := range yearArr {
+		fmt.Println("line 432:", ky, vy, thisYear, thisMonth)
+		if thisMonth < 11 {
+			currentYearCjnl := strconv.Itoa(thisYear) + "-01-01"               //当前年份春节农历
+			currentYearCjgl := solarlunar.LunarToSolar(currentYearCjnl, false) //当前年份春节公历
+			currentYearCjglDate, err := time.Parse(utils.FormatDate, currentYearCjgl)
+			if err != nil {
+				errMsg = "生成当前春节失败,Err:" + err.Error()
+				return result, err
+			}
+
+			fmt.Println(ky, vy)
+			preYear := vy
+			preYearCjnl := strconv.Itoa(preYear) + "-01-01"            //之前年份春节农历
+			preYearCjgl := solarlunar.LunarToSolar(preYearCjnl, false) //之前年份春节公历
+			preYearCjglDate, err := time.Parse(utils.FormatDate, preYearCjgl)
+			if err != nil {
+				errMsg = "生成历史年份春节失败,Err:" + err.Error()
+				return result, err
+			}
+			day := currentYearCjglDate.Sub(preYearCjglDate).Hours() / float64(24)
+
+			fmt.Println("day:", day)
+			fmt.Println("currentYearCjgl:", currentYearCjgl, "preYearCjgl:", preYearCjgl)
+
+			items := new(EdbDataItems)
+			items.Year = preYear
+			for _, v := range dataList {
+				dateTime, err := time.Parse(utils.FormatDate, v.DataTime)
+				if err != nil {
+					errMsg = "time.Parse Err:" + err.Error() + ";DataTime:" + v.DataTime
+					return result, err
+				}
+
+				newDate := dateTime.AddDate(0, 0, int(day))
+				selectDateStr := strconv.Itoa(thisYear) + "-11" + "-30"
+				selectDate, _ := time.Parse(utils.FormatDate, selectDateStr)
+				fmt.Println("line 467:", newDate, selectDate)
+				if newDate.Before(selectDate) {
+					timestamp := newDate.UnixNano() / 1e6
+					item := new(EdbDataList)
+					item.DataTime = newDate.Format(utils.FormatDate)
+					item.EdbInfoId = v.EdbInfoId
+					item.Value = v.Value
+					item.EdbDataId = v.EdbDataId
+					item.DataTimestamp = timestamp
+					items.Items = append(items.Items, item)
+				}
+			}
+			result.List = append(result.List, items)
+		} else {
+			fmt.Println(ky, vy)
+			nextYear := thisYear + 1
+			nextYearCjnl := strconv.Itoa(nextYear) + "-01-01"            //当前年份春节农历
+			nextYearCjgl := solarlunar.LunarToSolar(nextYearCjnl, false) //当前年份春节公历
+
+			nextYearCjglDate, err := time.Parse(utils.FormatDate, nextYearCjgl)
+			if err != nil {
+				errMsg = "生成当前春节失败,Err:" + err.Error()
+				return result, err
+			}
+
+			preYear := vy
+			preYearCjnl := strconv.Itoa(preYear) + "-01-01"            //之前年份春节农历
+			preYearCjgl := solarlunar.LunarToSolar(preYearCjnl, false) //之前年份春节公历
+			preYearCjglDate, err := time.Parse(utils.FormatDate, preYearCjgl)
+			if err != nil {
+				errMsg = "生成历史年份春节失败,Err:" + err.Error()
+				return result, err
+			}
+			day := nextYearCjglDate.Sub(preYearCjglDate).Hours() / float64(24)
+
+			fmt.Println("day:", day)
+			items := new(EdbDataItems)
+			items.Year = preYear
+			for _, v := range dataList {
+				dateTime, err := time.Parse(utils.FormatDate, v.DataTime)
+				if err != nil {
+					errMsg = "time.Parse Err:" + err.Error() + ";DataTime:" + v.DataTime
+					return result, err
+				}
+				newDate := dateTime.AddDate(0, 0, int(day))
+				selectDateStr := strconv.Itoa(nextYear) + "-05" + "-31"
+				selectDate, _ := time.Parse(utils.FormatDate, selectDateStr)
+
+				if newDate.Before(selectDate) {
+					timestamp := newDate.UnixNano() / 1e6
+					item := new(EdbDataList)
+					item.DataTime =newDate.Format(utils.FormatDate)
+					item.EdbInfoId = v.EdbInfoId
+					item.Value = v.Value
+					item.EdbDataId = v.EdbDataId
+					item.DataTimestamp = timestamp
+					items.Items = append(items.Items, item)
+				}
+			}
+			result.List = append(result.List, items)
+		}
+	}
+	return
+}
+
+type EdbDataItems struct {
+	Items []*EdbDataList
+	Year  int
+}
+
+type EdbDataResult struct {
+	List []*EdbDataItems
+}
+
+type QuarterData struct {
+	Year     int
+	DataList []*EdbDataList
+}
+
+type ChartInfoDetailResp struct {
+	ChartInfo   *ChartInfo
+	EdbInfoList []*ChartEdbInfoMapping
+}

+ 51 - 0
models/edb_data_table.go

@@ -0,0 +1,51 @@
+package models
+
+import (
+	"hongze/hongze_chart_lib/utils"
+)
+
+func GetEdbDataTableName(source int) (tableName string) {
+	switch source {
+	case utils.DATA_SOURCE_THS:
+		tableName = "edb_data_ths"
+	case utils.DATA_SOURCE_WIND:
+		tableName = "edb_data_wind"
+	case utils.DATA_SOURCE_PB:
+		tableName = "edb_data_pb"
+	case utils.DATA_SOURCE_CALCULATE:
+		tableName = "edb_data_calculate"
+	case utils.DATA_SOURCE_CALCULATE_LJZZY:
+		tableName = "edb_data_calculate_ljzzy"
+	case utils.DATA_SOURCE_CALCULATE_TBZ:
+		tableName = "edb_data_calculate_tbz"
+	case utils.DATA_SOURCE_CALCULATE_TCZ:
+		tableName = "edb_data_calculate_tcz"
+	case utils.DATA_SOURCE_CALCULATE_NSZYDPJJS:
+		tableName = "edb_data_calculate_nszydpjjs"
+	case utils.DATA_SOURCE_MANUAL:
+		tableName = "edb_data_manual"
+	case utils.DATA_SOURCE_LZ:
+		tableName = "edb_data_lz"
+	default:
+		tableName = ""
+	}
+	return
+}
+
+func GetEdbInfoCalculateTableName(source int) (tableName string) {
+	switch source {
+	case utils.DATA_SOURCE_CALCULATE:
+		tableName = "edb_info_calculate"
+	case utils.DATA_SOURCE_CALCULATE_LJZZY:
+		tableName = "edb_info_calculate_ljzzy"
+	case utils.DATA_SOURCE_CALCULATE_TBZ:
+		tableName = "edb_info_calculate_tbz"
+	case utils.DATA_SOURCE_CALCULATE_TCZ:
+		tableName = "edb_info_calculate_tcz"
+	case utils.DATA_SOURCE_CALCULATE_NSZYDPJJS:
+		tableName = "edb_info_calculate_nszydpjjs"
+	default:
+		tableName = ""
+	}
+	return
+}

+ 3 - 135
utils/constants.go

@@ -20,7 +20,7 @@ const (
 )
 )
 
 
 const (
 const (
-	APPNAME          = "弘则-日度点评-管理后台"
+	APPNAME          = "弘则-图库"
 	EmailSendToUsers = "glji@hzinsights.com;pyan@hzinsights.com;cxzhang@hzinsights.com"
 	EmailSendToUsers = "glji@hzinsights.com;pyan@hzinsights.com;cxzhang@hzinsights.com"
 )
 )
 
 
@@ -30,121 +30,6 @@ const (
 	RegularEmail  = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                             //匹配电子邮箱
 	RegularEmail  = `\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*`                                             //匹配电子邮箱
 )
 )
 
 
-//验证码code
-const (
-	REGISTER_CODE = iota + 1 //注册
-	LOGIN_CODE               //登录
-)
-
-//聚合短信
-var (
-	JhGnTplId  = "65692"                            //聚合国内模板编码
-	JhGjTplId  = "10054"                            //聚合国内模板编码
-	JhGnAppKey = "4c8504c49dd335e99cfd7b6a3a9e2415" //聚合国内AppKey
-	JhGjAppKey = "3326ad2c1047a4cd92ace153e6044ca3"
-)
-
-//科大讯飞--语音合成
-const (
-	XfSTATUS_FIRST_FRAME    = 0 //第一帧标识
-	XfSTATUS_CONTINUE_FRAME = 1 //中间帧标识
-	XfSTATUS_LAST_FRAME     = 2 //最后一帧标识
-	XfAPPID                 = "5ed70e9d"
-	XfAPIKey                = "d580509ca262e9586fb65a7064d5ce77"
-	XfAPISecret             = "a085720dc55850c720fa5576335f847a"
-	XfHostUrl               = "wss://tts-api.xfyun.cn/v2/tts"
-	XfOrigin                = "http://tts-api.xfyun.cn/"
-	XfHost                  = "tts-api.xfyun.cn"
-	XfMaxFontSize           = 8000
-	XfVcn                   = "x2_chaoge" //发言人
-)
-
-//OSS
-/*var (
-	Endpoint   string = "oss-cn-shanghai.aliyuncs.com"
-	Bucketname string = "hongze"
-
-	Imghost          string = "http://hongze.oss-cn-shanghai.aliyuncs.com/"
-	Upload_dir       string = "static/images/"
-	Upload_Audio_Dir string = "static/audio/"
-
-	AccessKeyId     string = "LTAIFMZYQhS2BTvW"
-	AccessKeySecret string = "12kk1ptCHoGWedhBnKRVW5hRJzq9Fq"
-)
-*/
-
-//baidu
-const (
-	BdAppID     = "23047694"
-	BdApiKey    = "RlisEen1Imd8haXx5Tqirstd"
-	BdSecretKey = "tT75bhMW5UlmoA0flyQsjgurZzSWfuB9"
-)
-
-//客户状态
-const (
-	COMPANY_STATUS_TRY_OUT       = "试用"
-	COMPANY_STATUS_FOREVER       = "永续"
-	COMPANY_STATUS_FREEZE        = "冻结"
-	COMPANY_STATUS_LOSE          = "流失"
-	COMPANY_STATUS_FORMAL        = "正式"
-	COMPANY_STATUS_POTENTIAL     = "潜在"
-	COMPANY_STATUS_TRY_OUT_COUNT = 30
-
-	COMPANY_APPROVE_STATUS = "待审批"
-)
-
-//管理员,ficc管理员,ficc销售,权益管理员,权益销售。
-//角色类型/类型编码
-const (
-	ROLE_TYPE_ADMIN       = "管理员"
-	ROLE_TYPE_FICC_ADMIN  = "ficc管理员"
-	ROLE_TYPE_FICC_SELLER = "ficc销售"
-	ROLE_TYPE_RAI_ADMIN   = "权益管理员"
-	ROLE_TYPE_RAI_SELLER  = "权益销售"
-
-	ROLE_TYPE_FICC_GROUP      = "ficc组长"
-	ROLE_TYPE_RAI_GROUP       = "权益组长"
-	ROLE_TYPE_FICC_DEPARTMENT = "ficc部门经理"
-	ROLE_TYPE_RAI_DEPARTMENT  = "权益部门经理"
-	ROLE_TYPE_FICC_RESEARCHR  = "ficc研究员"
-	ROLE_TYPE_RAI_RESEARCHR   = "权益研究员"
-
-	ROLE_TYPE_CODE_ADMIN           = "admin"           //管理员
-	ROLE_TYPE_CODE_FICC_ADMIN      = "ficc_admin"      //ficc管理员
-	ROLE_TYPE_CODE_FICC_SELLER     = "ficc_seller"     //ficc销售
-	ROLE_TYPE_CODE_RAI_ADMIN       = "rai_admin"       //权益管理员
-	ROLE_TYPE_CODE_RAI_SELLER      = "rai_seller"      //权益销售
-	ROLE_TYPE_CODE_FICC_GROUP      = "ficc_group"      //ficc组长
-	ROLE_TYPE_CODE_RAI_GROUP       = "rai_group"       //ficc组长
-	ROLE_TYPE_CODE_FICC_DEPARTMENT = "ficc_department" //ficc部门经理
-	ROLE_TYPE_CODE_RAI_DEPARTMENT  = "rai_department"  //权益部门经理
-	ROLE_TYPE_CODE_FICC_RESEARCHR  = "ficc_researcher" //ficc研究员
-	ROLE_TYPE_CODE_RESEARCHR       = "researcher"      //ficc研究员(最早定义的)
-	ROLE_TYPE_CODE_RAI_RESEARCHR   = "rai_researcher"  //权益研究员
-	ROLE_TYPE_CODE_COMPLIANCE      = "compliance"      //合规角色
-
-	ROLE_TYPE_SELLERS = "'ficc_admin','ficc_seller','rai_admin','rai_seller','ficc_group','rai_group','ficc_department','rai_department','compliance'"
-)
-
-//客户类型
-const (
-	COMPANY_CLASSIFY_FICC    = "ficc"
-	COMPANY_CLASSIFY_RAI     = "权益"
-	COMPANY_CLASSIFY_PARTNER = "合作伙伴"
-)
-
-const (
-	COMPANY_PRODUCT_FICC_ID   = 1
-	COMPANY_PRODUCT_FICC_NAME = "ficc"
-	COMPANY_PRODUCT_RAI_ID    = 2
-	COMPANY_PRODUCT_RAI_NAME  = "权益"
-)
-
-var PermissionFiccClassifyArr = [...]string{"宏观经济", "化工产业", "黑色产业", "有色产业", "市场策略"}
-var PermissionAllClassifyArr = [...]string{"宏观经济", "化工产业", "黑色产业", "有色产业", "市场策略", "权益"}
-
-//apply_method:申请类型:1:试用->正式,2:冻结—>试用,3:流失—>正式,4:试用延期,5:原销售申请领取流失客户,6:正式客户申请服务更新
-
 //数据来源渠道
 //数据来源渠道
 const (
 const (
 	DATA_SOURCE_THS                 = iota + 1 //同花顺
 	DATA_SOURCE_THS                 = iota + 1 //同花顺
@@ -159,23 +44,6 @@ const (
 	DATA_SOURCE_LZ                             //隆众
 	DATA_SOURCE_LZ                             //隆众
 )
 )
 
 
-//数据刷新频率
 const (
 const (
-	DATA_REFRESH = 7 //7个单位,日/周/月/季度/年
-)
-
-//数据缓存
-const (
-	CATCH_EDB_DATA = "EDB_DATA_"
-)
-
-const (
-	DATA_PREFIX  = "hz_data"
-	CHART_PREFIX = "hz_chart"
-)
-
-const (
-	Hz_Data_Url    = "http://datawind.hzinsights.com:8040/" //同花顺,万得接口服务地址
-	Hz_Data_PB_Url = "http://datapb.hzinsights.com:8040/"   //彭博接口地址
-	EDB_DATA_LIMIT = 10
-)
+	HZ_CHART_LIB_DETAIL="HZ_CHART_LIB_DETAIL_"
+)