فهرست منبع

删除无用的方法

xyxie 1 ماه پیش
والد
کامیت
d74ad35436
1فایلهای تغییر یافته به همراه0 افزوده شده و 160 حذف شده
  1. 0 160
      services/chart_info_show.go

+ 0 - 160
services/chart_info_show.go

@@ -11,7 +11,6 @@ import (
 	"math"
 	"sort"
 	"strconv"
-	"strings"
 	"time"
 )
 
@@ -2317,162 +2316,3 @@ func SeasonChartData(dataList []*models.ChartEdbInfoMapping, seasonExtraConfig s
 
 	return
 }
-
-// GetChartDetailDataByChartInfoId 根据图表信息id获取图表详情数据
-func GetChartDetailDataByChartInfoId(chartInfo *models.ChartInfoView, isCache bool) (resp *models.ChartInfoDetailResp, err error, errMsg string) {
-	// 添加至缓存中
-	//是否走缓存
-	chartInfoId := chartInfo.ChartInfoId
-	resp = new(models.ChartInfoDetailResp)
-
-	//判断是否存在缓存,如果存在缓存,那么直接从缓存中获取
-	key := fmt.Sprint(utils.CACHE_CHART_INFO_DATA, chartInfo.ChartInfoId)
-	if utils.Re == nil && isCache {
-		if utils.Re == nil && utils.Rc.IsExist(key) {
-			if chartData, err1 := utils.Rc.RedisBytes(key); err1 == nil {
-				err = json.Unmarshal(chartData, &resp)
-				if err != nil || resp == nil {
-					return
-				}
-				return
-			}
-		}
-	}
-	chartType := chartInfo.ChartType
-
-	startDate := chartInfo.StartDate
-	endDate := chartInfo.EndDate
-	seasonStartDate := chartInfo.SeasonStartDate
-	seasonEndDate := chartInfo.SeasonEndDate
-	startYear := chartInfo.StartYear
-
-	calendar := chartInfo.Calendar
-
-	dateType := chartInfo.DateType
-
-	// 获取主题样式
-	chartTheme, err := GetChartThemeConfig(chartInfo.ChartThemeId, chartInfo.Source, chartInfo.ChartType)
-	if err != nil {
-		errMsg = "获取失败"
-		err = fmt.Errorf("获取主题信息失败,Err:" + err.Error())
-		return
-	}
-	chartInfo.ChartThemeStyle = chartTheme.Config
-	chartInfo.ChartThemeId = chartTheme.ChartThemeId
-
-	mappingList := make([]*models.ChartEdbInfoMapping, 0)
-
-	mappingList, err = models.GetChartEdbMappingList(chartInfoId)
-	if err != nil {
-		errMsg = "获取失败"
-		err = fmt.Errorf("获取图表,指标信息失败,Err:" + err.Error())
-		return
-	}
-
-	// 图表额外数据参数
-	extraConfigStr := chartInfo.ExtraConfig
-	// 柱方图的一些配置
-	var barConfig models.BarChartInfoReq
-	if chartInfo != nil && chartInfo.ChartType == 7 {
-		if chartInfo.BarConfig == `` {
-			errMsg = "柱方图未配置"
-			err = fmt.Errorf("柱方图未配置")
-			return
-		}
-		err = json.Unmarshal([]byte(chartInfo.BarConfig), &barConfig)
-		if err != nil {
-			errMsg = "柱方图配置异常"
-			err = fmt.Errorf("柱方图配置异常")
-			return
-		}
-		extraConfigStr = chartInfo.BarConfig
-	}
-	if chartType == 2 {
-		startDate = seasonStartDate
-		endDate = seasonEndDate
-		if dateType <= 0 {
-			if startDate != "" {
-				dateType = 5
-			} else {
-				dateType = utils.DateTypeNYears
-			}
-		}
-	} else {
-		if dateType <= 0 {
-			dateType = 3
-		}
-	}
-	yearMax := 0
-	if dateType == utils.DateTypeNYears {
-		for _, v := range mappingList {
-			if v.LatestDate != "" {
-				lastDateT, tErr := time.Parse(utils.FormatDate, v.LatestDate)
-				if tErr != nil {
-					errMsg = "获取失败"
-					err = fmt.Errorf("获取图表日期信息失败,Err:" + tErr.Error())
-					return
-				}
-				if lastDateT.Year() > yearMax {
-					yearMax = lastDateT.Year()
-				}
-			}
-		}
-	}
-	startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, yearMax)
-
-	if chartInfo.ChartType == 2 {
-		chartInfo.StartDate = startDate
-		chartInfo.EndDate = endDate
-		chartInfo.Calendar = calendar
-	}
-
-	// 获取图表中的指标数据
-	edbList, xEdbIdValue, yDataList, dataResp, err, errMsg := GetChartEdbData(chartInfoId, chartType, calendar, startDate, endDate, mappingList, extraConfigStr, chartInfo.SeasonExtraConfig)
-	if err != nil {
-		if errMsg == `` {
-			errMsg = "获取失败"
-		}
-		err = fmt.Errorf("获取图表,指标信息失败,Err:" + err.Error())
-		return
-	}
-	// 单位
-	if chartType == utils.CHART_TYPE_BAR && len(yDataList) > 0 {
-		chartInfo.Unit = yDataList[0].Unit
-		chartInfo.UnitEn = yDataList[0].UnitEn
-	}
-	warnEdbList := make([]string, 0)
-	for _, v := range edbList {
-		if v.IsNullData {
-			warnEdbList = append(warnEdbList, v.EdbName+"("+v.EdbCode+")")
-		}
-	}
-	if len(warnEdbList) > 0 {
-		chartInfo.WarnMsg = `图表引用指标异常,异常指标:` + strings.Join(warnEdbList, ",")
-	}
-	// 图表的指标来源
-	sourceNameList, sourceNameEnList := GetEdbSourceByEdbInfoIdList(edbList)
-	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
-	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")
-	//判断是否需要展示英文标识
-	chartInfo.IsEnChart = CheckIsEnChart(chartInfo.ChartNameEn, edbList, chartInfo.Source, chartInfo.ChartType)
-
-	resp.EdbInfoList = edbList
-	resp.XEdbIdValue = xEdbIdValue
-	resp.YDataList = yDataList
-	resp.DataResp = dataResp
-
-	chartInfo.Button = models.ChartViewButton{
-		IsEdit:    chartInfo.IsEdit,
-		IsEnChart: chartInfo.IsEnChart,
-		IsAdd:     chartInfo.IsAdd,
-		IsCopy:    true,
-		IsSetName: chartInfo.IsSetName,
-	}
-	resp.ChartInfo = chartInfo
-	// 将数据加入缓存
-	if utils.Re == nil {
-		d, _ := json.Marshal(resp)
-		_ = utils.Rc.Put(key, d, 2*time.Hour)
-	}
-	return
-}