Roc hai 4 meses
pai
achega
91af811247
Modificáronse 100 ficheiros con 397 adicións e 8669 borrados
  1. 0 99
      controllers/base_auth.go
  2. 0 99
      controllers/base_auth_v2.go
  3. 0 1
      controllers/base_common.go
  4. 0 34
      controllers/chart.go
  5. 0 9
      controllers/chart_auth.go
  6. 0 101
      controllers/chart_common.go
  7. 0 3
      controllers/error.go
  8. 0 50
      controllers/excel_info.go
  9. 0 7
      controllers/table.go
  10. 0 23
      global/dm.go
  11. 0 1
      global/global.go
  12. 0 2
      main.go
  13. 6 60
      models/business_conf.go
  14. 27 650
      models/chart.go
  15. 7 84
      models/chart_edb_mapping.go
  16. 0 1
      models/chart_info_range_analysis.go
  17. 10 269
      models/chart_series.go
  18. 0 17
      models/chart_series_edb_mapping.go
  19. 0 71
      models/data_manage/chart_info.go
  20. 6 86
      models/data_manage/chart_info_correlation.go
  21. 13 193
      models/data_manage/chart_theme/chart_theme.go
  22. 9 109
      models/data_manage/chart_theme/chart_theme_type.go
  23. 0 61
      models/data_manage/cross_variety/chart_tag.go
  24. 0 40
      models/data_manage/cross_variety/chart_tag_variety.go
  25. 12 136
      models/data_manage/cross_variety/chart_variety.go
  26. 0 4
      models/data_manage/cross_variety/request/chart.go
  27. 0 75
      models/data_manage/edb_info.go
  28. 7 74
      models/data_manage/edb_info_calculate.go
  29. 0 71
      models/data_manage/edb_source.go
  30. 2 114
      models/data_manage/excel/excel_chart_data.go
  31. 13 364
      models/data_manage/excel/excel_chart_edb.go
  32. 5 194
      models/data_manage/excel/excel_classify.go
  33. 0 14
      models/data_manage/excel/excel_draft.go
  34. 0 130
      models/data_manage/excel/excel_edb_mapping.go
  35. 60 706
      models/data_manage/excel/excel_info.go
  36. 6 82
      models/data_manage/excel/excel_sheet.go
  37. 7 62
      models/data_manage/excel/excel_sheet_data.go
  38. 0 1
      models/data_manage/excel/request/excel.go
  39. 0 3
      models/data_manage/excel/request/excel_classify.go
  40. 0 17
      models/data_manage/excel/request/excel_info.go
  41. 0 28
      models/data_manage/excel/request/mixed_table.go
  42. 0 9
      models/data_manage/excel/response/excel_info.go
  43. 0 2
      models/data_manage/excel/response/sheet.go
  44. 11 124
      models/data_manage/factor_edb_series.go
  45. 0 116
      models/data_manage/factor_edb_series_chart_mapping.go
  46. 14 172
      models/data_manage/factor_edb_series_mapping.go
  47. 6 64
      models/data_manage/future_good/chart_info_future_good_profit.go
  48. 15 171
      models/data_manage/future_good/future_good_chart_classify.go
  49. 9 114
      models/data_manage/future_good/future_good_edb_info.go
  50. 6 105
      models/data_manage/future_good/future_good_edb_info_data.go
  51. 0 3
      models/data_manage/future_good/request/future_good_chart.go
  52. 0 3
      models/data_manage/future_good/request/future_good_chart_classify.go
  53. 0 1
      models/data_manage/future_good/response/future_good_chart_profit.go
  54. 0 2
      models/data_manage/line_equation/request/line_equation.go
  55. 0 8
      models/data_manage/line_feature/request/line_feature.go
  56. 0 4
      models/data_manage/line_feature/response/line_feature.go
  57. 0 48
      models/data_manage/multiple_graph_config.go
  58. 8 63
      models/data_manage/multiple_graph_config_chart_mapping.go
  59. 7 61
      models/data_manage/multiple_graph_config_edb_mapping.go
  60. 0 132
      models/data_manage/predict_edb_conf.go
  61. 7 91
      models/data_manage/predict_edb_conf_calculate_mapping.go
  62. 0 29
      models/data_manage/predict_edb_rule_data.go
  63. 0 51
      models/db.go
  64. 0 3
      models/dm_base.go
  65. 22 268
      models/excel_info.go
  66. 0 70
      models/excel_info_rule_mapping.go
  67. 12 148
      models/factor_edb_series_calculate_data_qjjs.go
  68. 0 5
      models/handle_data.go
  69. 0 112
      models/mgo/base_from_business_data.go
  70. 0 18
      models/mgo/common.go
  71. 0 136
      models/mgo/edb_data_business.go
  72. 2 179
      models/mgo/edb_data_ths_hf.go
  73. 0 32
      models/mgo_base.go
  74. 0 28
      models/request/mixed_table.go
  75. 0 7
      models/response/excel_info.go
  76. 0 14
      models/share_chart_refresh_log.go
  77. 0 24
      models/table.go
  78. 0 9
      models/table_data.go
  79. 86 86
      routers/commentsRouter.go
  80. 0 7
      routers/router.go
  81. 0 5
      services/alarm_msg/alarm_msg.go
  82. 0 77
      services/data/base_edb_lib.go
  83. 0 38
      services/data/chart_extra_config.go
  84. 0 164
      services/data/chart_info.go
  85. 0 25
      services/data/chart_info_excel_balance.go
  86. 0 7
      services/data/chart_info_interface.go
  87. 0 19
      services/data/chart_theme.go
  88. 2 88
      services/data/correlation/chart_info.go
  89. 0 55
      services/data/cross_variety/chart.go
  90. 0 6
      services/data/edb_data.go
  91. 0 200
      services/data/edb_info.go
  92. 0 55
      services/data/excel/balance_table.go
  93. 0 876
      services/data/excel/excel_info.go
  94. 0 165
      services/data/excel/mixed_table.go
  95. 0 95
      services/data/excel/time_table.go
  96. 0 4
      services/data/future_good/base_future_good_lib.go
  97. 0 97
      services/data/future_good/chart_info.go
  98. 0 6
      services/data/future_good/future_edb_info.go
  99. 0 6
      services/data/handle_data.go
  100. 0 17
      services/data/line_equation/chart_info.go

+ 0 - 99
controllers/base_auth.go

@@ -25,7 +25,6 @@ func (c *BaseAuthController) Prepare() {
 	fmt.Println("Url:", uri+";ip:"+ip)
 	if method != "HEAD" {
 		if method == "POST" || method == "GET" {
-			// 当前语言
 			{
 				lang := c.Ctx.Input.Header("Lang")
 				if lang == "" {
@@ -34,104 +33,6 @@ func (c *BaseAuthController) Prepare() {
 				c.Lang = lang
 			}
 
-			//authorization := this.Ctx.Input.Header("authorization")
-			//if authorization == "" {
-			//	authorization = this.Ctx.Input.Header("Authorization")
-			//}
-			//if authorization == "" {
-			//	newAuthorization := this.GetString("authorization")
-			//	account := this.GetString("account")
-			//	authorization = "authorization=" + newAuthorization + ";account=" + account
-			//	if newAuthorization == "" {
-			//		newAuthorization = this.GetString("Authorization")
-			//		if account == "" {
-			//			account = this.GetString("Account")
-			//		}
-			//		authorization = "authorization=" + newAuthorization + ";account=" + account
-			//	}
-			//}
-			//fmt.Println("authorization##################")
-			//fmt.Println(authorization)
-			//fmt.Println("authorization############")
-			//if authorization == "" {
-			//	strArr := strings.Split(uri, "?")
-			//	for k, v := range strArr {
-			//		fmt.Println(k, v)
-			//	}
-			//	if len(strArr) > 1 {
-			//		authorization := strArr[1]
-			//		authorization = strings.Replace(authorization, "Authorization", "authorization", -1)
-			//		fmt.Println(authorization)
-			//	}
-			//}
-			//fmt.Println("authorization------------")
-			//fmt.Println(authorization)
-			//fmt.Println("authorization-------------")
-			//if authorization == "" {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:Token is empty or account is empty"}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//authorizationArr := strings.Split(authorization, ";")
-			//tokenStr := authorizationArr[0]
-			//tokenArr := strings.Split(tokenStr, "=")
-			//token := tokenArr[1]
-			//
-			//accountStr := authorizationArr[1]
-			//accountArr := strings.Split(accountStr, "=")
-			//account := accountArr[1]
-			//
-			//fmt.Println("token:", token)
-			//fmt.Println("account:", account)
-			////校验token是否合法
-			//// JWT校验Token和Account
-			//if !utils.CheckToken(account, token) {
-			//	fmt.Println("CheckToken Err")
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "鉴权失败,请重新登录!", ErrMsg: "登录失效,请重新登陆!,CheckToken Fail"}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//
-			//fmt.Println("GetUserByToken")
-			//session, err := system.GetSysSessionByToken(token)
-			//if err != nil {
-			//	if utils.IsErrNoRow() {
-			//		this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + token}, false, false)
-			//		this.StopRun()
-			//		return
-			//	}
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//if session == nil {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "sesson is empty "}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//if time.Now().After(session.ExpiredTime) {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新登录!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//admin, err := system.GetSysUserById(session.SysUserId)
-			//if err != nil {
-			//	if utils.IsErrNoRow() {
-			//		this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取admin 信息失败 " + strconv.Itoa(session.SysUserId)}, false, false)
-			//		this.StopRun()
-			//		return
-			//	}
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取admin信息异常,Eerr:" + err.Error()}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//if admin == nil {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "admin is empty "}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//admin.RoleTypeCode = GetSysUserRoleTypeCode(admin.RoleTypeCode)
-			//this.SysUser = admin
 		} else {
 			c.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
 			c.StopRun()

+ 0 - 99
controllers/base_auth_v2.go

@@ -25,7 +25,6 @@ func (c *BaseAuthV2Controller) Prepare() {
 	fmt.Println("Url:", uri+";ip:"+ip)
 	if method != "HEAD" {
 		if method == "POST" || method == "GET" {
-			// 当前语言
 			{
 				lang := c.Ctx.Input.Header("Lang")
 				if lang == "" {
@@ -46,104 +45,6 @@ func (c *BaseAuthV2Controller) Prepare() {
 				c.StopRun()
 				return
 			}
-			//authorization := this.Ctx.Input.Header("authorization")
-			//if authorization == "" {
-			//	authorization = this.Ctx.Input.Header("Authorization")
-			//}
-			//if authorization == "" {
-			//	newAuthorization := this.GetString("authorization")
-			//	account := this.GetString("account")
-			//	authorization = "authorization=" + newAuthorization + ";account=" + account
-			//	if newAuthorization == "" {
-			//		newAuthorization = this.GetString("Authorization")
-			//		if account == "" {
-			//			account = this.GetString("Account")
-			//		}
-			//		authorization = "authorization=" + newAuthorization + ";account=" + account
-			//	}
-			//}
-			//fmt.Println("authorization##################")
-			//fmt.Println(authorization)
-			//fmt.Println("authorization############")
-			//if authorization == "" {
-			//	strArr := strings.Split(uri, "?")
-			//	for k, v := range strArr {
-			//		fmt.Println(k, v)
-			//	}
-			//	if len(strArr) > 1 {
-			//		authorization := strArr[1]
-			//		authorization = strings.Replace(authorization, "Authorization", "authorization", -1)
-			//		fmt.Println(authorization)
-			//	}
-			//}
-			//fmt.Println("authorization------------")
-			//fmt.Println(authorization)
-			//fmt.Println("authorization-------------")
-			//if authorization == "" {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新授权!", ErrMsg: "请重新授权:Token is empty or account is empty"}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//authorizationArr := strings.Split(authorization, ";")
-			//tokenStr := authorizationArr[0]
-			//tokenArr := strings.Split(tokenStr, "=")
-			//token := tokenArr[1]
-			//
-			//accountStr := authorizationArr[1]
-			//accountArr := strings.Split(accountStr, "=")
-			//account := accountArr[1]
-			//
-			//fmt.Println("token:", token)
-			//fmt.Println("account:", account)
-			////校验token是否合法
-			//// JWT校验Token和Account
-			//if !utils.CheckToken(account, token) {
-			//	fmt.Println("CheckToken Err")
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "鉴权失败,请重新登录!", ErrMsg: "登录失效,请重新登陆!,CheckToken Fail"}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//
-			//fmt.Println("GetUserByToken")
-			//session, err := system.GetSysSessionByToken(token)
-			//if err != nil {
-			//	if utils.IsErrNoRow() {
-			//		this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "Token 信息已变更:Token: " + token}, false, false)
-			//		this.StopRun()
-			//		return
-			//	}
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//if session == nil {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "sesson is empty "}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//if time.Now().After(session.ExpiredTime) {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "请重新登录!", ErrMsg: "获取用户信息异常,Eerr:" + err.Error()}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//admin, err := system.GetSysUserById(session.SysUserId)
-			//if err != nil {
-			//	if utils.IsErrNoRow() {
-			//		this.JSON(models.BaseResponse{Ret: 408, Msg: "信息已变更,请重新登陆!", ErrMsg: "获取admin 信息失败 " + strconv.Itoa(session.SysUserId)}, false, false)
-			//		this.StopRun()
-			//		return
-			//	}
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "获取admin信息异常,Eerr:" + err.Error()}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//if admin == nil {
-			//	this.JSON(models.BaseResponse{Ret: 408, Msg: "网络异常,请稍后重试!", ErrMsg: "admin is empty "}, false, false)
-			//	this.StopRun()
-			//	return
-			//}
-			//admin.RoleTypeCode = GetSysUserRoleTypeCode(admin.RoleTypeCode)
-			//this.SysUser = admin
 		} else {
 			c.JSON(models.BaseResponse{Ret: 408, Msg: "请求异常,请联系客服!", ErrMsg: "POST之外的请求,暂不支持"}, false, false)
 			c.StopRun()

+ 0 - 1
controllers/base_common.go

@@ -23,7 +23,6 @@ func (c *BaseCommonController) Prepare() {
 	} else {
 		requestBody, _ = url.QueryUnescape(string(c.Ctx.Input.RequestBody))
 	}
-	// 当前语言
 	{
 		lang := c.Ctx.Input.Header("Lang")
 		if lang == "" {

+ 0 - 34
controllers/chart.go

@@ -16,16 +16,10 @@ import (
 	"time"
 )
 
-// 图表
 type ChartController struct {
 	BaseAuthController
 }
 
-// ChartInfoDetail
-// @Title 获取图表详情
-// @Description 获取图表详情接口
-// @Param   UniqueCode   query   string  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Success 200 {object} data_manage.ChartInfoDetailResp
 // @router /detail [get]
 func (this *ChartController) ChartInfoDetail() {
 	br := new(models.BaseResponse).Init()
@@ -45,7 +39,6 @@ func (this *ChartController) ChartInfoDetail() {
 	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
 	resp := new(models.ChartInfoDetailResp)
 
-	// 图表水印
 	conf, e := models.GetBusinessConf()
 	if e != nil {
 		br.Msg = "获取失败"
@@ -63,7 +56,6 @@ func (this *ChartController) ChartInfoDetail() {
 		isCollect = tmpIsCollect
 	}
 
-	//判断是否有缓存
 	if utils.Re == nil {
 		if utils.Re == nil && utils.Rc.IsExist(key) {
 			if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {
@@ -98,7 +90,6 @@ func (this *ChartController) ChartInfoDetail() {
 		return
 	}
 
-	//var resp interface{}
 	var isOk bool
 	var msg, errMsg string
 	switch chartInfo.Source {
@@ -154,17 +145,11 @@ func (this *ChartController) ChartInfoDetail() {
 	br.Data = resp
 }
 
-// ChartInfoRefresh
-// @Title 图表刷新接口
-// @Description 图表刷新接口
-// @Param   UniqueCode   query   string  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Success Ret=200 刷新成功
 // @router /refresh [get]
 func (this *ChartController) ChartInfoRefresh() {
 	br := new(models.BaseResponse).Init()
 	chartId := 0
 	defer func() {
-		// 添加日志
 		if chartId > 0 {
 			shareChartRefreshLogInfo := &models.ShareChartRefreshLog{
 				Ip:         this.Ctx.Input.IP(),
@@ -207,7 +192,6 @@ func (this *ChartController) ChartInfoRefresh() {
 			return
 		}
 
-		// 获取关联的指标信息
 		_, _, edbInfoIdList, tmpErr := cross_variety.GetXYEdbIdList(config.TagX, config.TagY, config.VarietyList)
 		if tmpErr != nil {
 			br.Msg = "刷新失败,获取指标信息失败"
@@ -230,7 +214,6 @@ func (this *ChartController) ChartInfoRefresh() {
 			return
 		}
 	case utils.CHART_SOURCE_RANGE_ANALYSIS:
-		//// 刷新相关性图表
 		if _, e := range_analysis.ChartInfoRefresh(chartInfo.ChartInfoId, ""); e != nil {
 			br.Msg = "刷新失败"
 			br.ErrMsg = "刷新相关性图表失败, Err:" + e.Error()
@@ -246,7 +229,6 @@ func (this *ChartController) ChartInfoRefresh() {
 		return
 	}
 
-	//清除数据缓存
 	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
 	if utils.Re == nil {
 		utils.Rc.Delete(key)
@@ -256,11 +238,6 @@ func (this *ChartController) ChartInfoRefresh() {
 	br.Msg = "刷新成功"
 }
 
-// CollectCancel
-// @Title 东吴小程序图表取消收藏接口
-// @Description 东吴小程序图表取消收藏接口
-// @Param	request	body models.ChartDwCollectReq true "type json string"
-// @Success Ret=200 取消收藏成功
 // @router /dw/collectCancel [post]
 func (this *ChartController) CollectCancel() {
 	br := new(models.BaseResponse).Init()
@@ -302,11 +279,6 @@ func (this *ChartController) CollectCancel() {
 	br.Msg = "取消收藏成功"
 }
 
-// Collect
-// @Title 东吴小程序图表收藏接口
-// @Description 东吴小程序图表收藏接口
-// @Param   request	body models.ChartDwCollectReq true "type json string"
-// @Success Ret=200 收藏成功
 // @router /dw/collect [post]
 func (this *ChartController) Collect() {
 	br := new(models.BaseResponse).Init()
@@ -361,7 +333,6 @@ func (this *ChartController) Collect() {
 	br.Msg = "收藏成功"
 }
 
-// 获取频度的英文版
 func GetFrequencyEn(frequency string) (frequencyEn string) {
 	switch frequency {
 	case "日度":
@@ -407,10 +378,8 @@ func GetLeadUnitEn(unit string) (unitEn string) {
 	return
 }
 
-// GetChartInfoDetailFromUniqueCode 根据编码获取图表详情
 func GetChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, chartInfo.Source, chartInfo.ChartType)
 	if err != nil {
 		msg = "获取失败"
@@ -463,7 +432,6 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (
 	startDate, endDate = utils.GetDateByDateTypeV2(dateType, startDate, endDate, startYear, yearMax)
 
 	extraConfigStr := chartInfo.ExtraConfig
-	// 柱方图的一些配置
 	var barConfig data_manage.BarChartInfoReq
 	if chartInfo != nil && chartInfo.ChartType == 7 {
 		if chartInfo.BarConfig == `` {
@@ -491,7 +459,6 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (
 	}
 
 	for _, v := range edbList {
-		// 指标别名
 		if barConfig.EdbInfoIdList != nil && len(barConfig.EdbInfoIdList) > 0 {
 			for _, reqEdb := range barConfig.EdbInfoIdList {
 				if v.EdbInfoId == reqEdb.EdbInfoId {
@@ -501,7 +468,6 @@ func GetChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (
 		}
 	}
 
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")

+ 0 - 9
controllers/chart_auth.go

@@ -7,16 +7,10 @@ import (
 	"fmt"
 )
 
-// 需要验证密钥的图表
 type ChartAuthController struct {
 	BaseAuthV2Controller
 }
 
-// ChartInfoDetail
-// @Title 获取图表详情
-// @Description 获取图表详情接口
-// @Param   UniqueCode   query   string  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Success 200 {object} data_manage.ChartInfoDetailResp
 // @router /detail [get]
 func (this *ChartAuthController) ChartInfoDetail() {
 	br := new(models.BaseResponse).Init()
@@ -34,7 +28,6 @@ func (this *ChartAuthController) ChartInfoDetail() {
 	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
 	resp := new(models.ChartInfoDetailResp)
 
-	// 图表水印
 	conf, e := models.GetBusinessConf()
 	if e != nil {
 		br.Msg = "获取失败"
@@ -42,7 +35,6 @@ func (this *ChartAuthController) ChartInfoDetail() {
 		return
 	}
 
-	//判断是否有缓存
 	if utils.Re == nil {
 		if utils.Re == nil && utils.Rc.IsExist(key) {
 			if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {
@@ -74,7 +66,6 @@ func (this *ChartAuthController) ChartInfoDetail() {
 		return
 	}
 
-	//var resp interface{}
 	var isOk bool
 	var msg, errMsg string
 	switch chartInfo.Source {

+ 0 - 101
controllers/chart_common.go

@@ -26,14 +26,6 @@ import (
 	"time"
 )
 
-// CommonChartInfoDetailFromUniqueCode
-// @Title 根据编码获取图表详情
-// @Description 根据编码获取图表详情接口
-// @Param   UniqueCode   query   int  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Param   IsCache   query   bool  true       "是否走缓存,默认false"
-// @Param   Token   query   string  true       "东吴小程序token"
-// @Param   Source   query   int  true       "查询来源 1:东吴"
-// @Success 200 {object} data_manage.ChartInfoDetailFromUniqueCodeResp
 // @router /common/detail [get]
 func (this *ChartController) CommonChartInfoDetailFromUniqueCode() {
 	br := new(models.BaseResponse).Init()
@@ -53,7 +45,6 @@ func (this *ChartController) CommonChartInfoDetailFromUniqueCode() {
 	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
 	resp := new(models.ChartInfoDetailResp)
 
-	// 图表水印
 	conf, e := models.GetBusinessConf()
 	if e != nil {
 		br.Msg = "获取失败"
@@ -70,7 +61,6 @@ func (this *ChartController) CommonChartInfoDetailFromUniqueCode() {
 		}
 		isCollect = tmpIsCollect
 	}
-	//判断是否有缓存
 	if utils.Re == nil {
 		if utils.Re == nil && utils.Rc.IsExist(key) {
 			if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {
@@ -105,7 +95,6 @@ func (this *ChartController) CommonChartInfoDetailFromUniqueCode() {
 		return
 	}
 
-	//var resp interface{}
 	var isOk bool
 	var msg, errMsg string
 	switch chartInfo.Source {
@@ -162,11 +151,9 @@ func (this *ChartController) CommonChartInfoDetailFromUniqueCode() {
 	br.Data = resp
 }
 
-// GetFutureGoodChartInfoDetailFromUniqueCode 根据编码获取图表详情
 func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
 
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 1)
 	if err != nil {
 		msg = "获取失败"
@@ -181,7 +168,6 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 	startDate := chartInfo.StartDate
 	endDate := chartInfo.EndDate
 
-	// 兼容日期错误
 	{
 		if strings.Count(startDate, "-") == 1 {
 			startDate = startDate + "-01"
@@ -204,9 +190,7 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 		return
 	}
 
-	// 商品价格曲线图的一些配置
 	var barConfig data_manage.FutureGoodBarChartInfoReq
-	//barChartInfoSort := data_manage.BarChartInfoSortReq{}
 
 	if chartInfo.BarConfig == `` {
 		msg = "商品价格曲线图未配置"
@@ -222,9 +206,7 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 
 	baseEdbInfoId := barConfig.BaseEdbInfoId
 	var baseEdbInfoMapping *models.ChartEdbInfoMapping
-	// todo 兼容历史数据,
 	if baseEdbInfoId == 0 {
-		// 默认取第一个现货指标
 		baseEdbInfoId = edbInfoMappingList[0].EdbInfoId
 		baseEdbInfoMapping = edbInfoMappingList[0]
 		barConfig.BaseEdbInfoId = baseEdbInfoId
@@ -237,7 +219,6 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 		}
 	}
 
-	// 获取图表中的指标数据
 	barConfigEdbInfoIdList, edbList, xEdbIdValue, xDataList, yDataList, err := future_goodServ.GetChartEdbData(chartInfoId, startDate, endDate, baseEdbInfoMapping, edbInfoMappingList, futureGoodEdbInfoMapping, barConfig, true)
 	if err != nil {
 		msg = "获取失败"
@@ -256,7 +237,6 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 		if v.IsNullData {
 			warnEdbList = append(warnEdbList, v.EdbName+"("+v.EdbCode+")")
 		}
-		// 指标别名
 		if barConfigEdbInfoIdList != nil && len(barConfigEdbInfoIdList) > 0 {
 			for _, reqEdb := range barConfigEdbInfoIdList {
 				if v.EdbInfoId == reqEdb.EdbInfoId {
@@ -268,7 +248,6 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 	}
 	chartInfo.UnitEn = baseEdbInfo.UnitEn
 
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")
@@ -287,10 +266,7 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 	resp.XEdbIdValue = xEdbIdValue
 	resp.YDataList = yDataList
 	resp.XDataList = xDataListFinal
-	//resp.BarChartInfo = barConfig
-	//resp.Status = true
 
-	// 将数据加入缓存
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)
 		utils.Rc.Put(key, data, 2*time.Hour)
@@ -300,13 +276,11 @@ func GetFutureGoodChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key
 	return
 }
 
-// GetFutureGoodProfitChartInfoDetailFromUniqueCode 根据编码获取商品利润图表详情
 func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
 
 	chartInfoId := chartInfo.ChartInfoId
 
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 1)
 	if err != nil {
 		msg = "获取失败"
@@ -316,7 +290,6 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *models.ChartInf
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
-	// 商品利润曲线图的一些配置
 	var extraConf request.ChartInfoReq
 	err = json.Unmarshal([]byte(chartInfo.ExtraConfig), &extraConf)
 	if err != nil {
@@ -359,7 +332,6 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *models.ChartInf
 	xDataList := make([]models.XData, 0)
 	yDataList := make([]models.YData, 0)
 
-	// 查找商品利润图表的扩展信息
 	chartInfoFutureGoodProfit := new(future_good.ChartInfoFutureGoodProfit)
 	if err = chartInfoFutureGoodProfit.GetItemById(chartInfo.ChartInfoId); err != nil {
 		msg = "获取失败"
@@ -400,7 +372,6 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *models.ChartInf
 		Extra:        extraConf,
 	}
 
-	// 将数据加入缓存
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)
 		utils.Rc.Put(key, data, 2*time.Hour)
@@ -410,10 +381,8 @@ func GetFutureGoodProfitChartInfoDetailFromUniqueCode(chartInfo *models.ChartInf
 	return
 }
 
-// GetLineEquationChartInfoDetailFromUniqueCode 根据编码获取拟合方程图表详情
 func GetLineEquationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 1)
 	if err != nil {
 		msg = "获取失败"
@@ -423,7 +392,6 @@ func GetLineEquationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, k
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
-	//chartInfoId := chartInfo.ChartInfoId
 	if chartInfo.ExtraConfig == `` {
 		msg = "获取失败"
 		errMsg = "获取配置信息失败"
@@ -466,8 +434,6 @@ func GetLineEquationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, k
 		resultResp = dataResp.R2Data
 	}
 
-	//chartInfo.UnitEn = baseEdbInfo.UnitEn
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")
@@ -476,7 +442,6 @@ func GetLineEquationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, k
 	resp.DataResp = resultResp
 	resp.EdbInfoList = edbList
 
-	// 将数据加入缓存
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)
 		utils.Rc.Put(key, data, 2*time.Hour)
@@ -486,10 +451,8 @@ func GetLineEquationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, k
 	return
 }
 
-// GetLineFeatureChartInfoDetailFromUniqueCode 根据编码获取统计特征图表详情
 func GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 1)
 	if err != nil {
 		msg = "获取失败"
@@ -499,7 +462,6 @@ func GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 	chartInfo.ChartThemeStyle = chartTheme.Config
 	chartInfo.ChartThemeId = chartTheme.ChartThemeId
 
-	// 获取图表关联指标
 	edbMappingList, err := models.GetChartEdbMappingList(chartInfo.ChartInfoId)
 	if err != nil {
 		msg = "获取失败"
@@ -544,7 +506,6 @@ func GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 			errMsg = "格式化配置项失败,Err:" + err.Error()
 			return
 		}
-		// 获取图表中的指标数据
 		edbList, resultResp, err, errMsg = lineFeatureServ.GetFrequencyDistributionData(0, edbMapping, frequencyDistributionConfig.DateType, frequencyDistributionConfig.FrequencyValue, frequencyDistributionConfig.StartDate, frequencyDistributionConfig.EndDate)
 	default:
 		msg = `错误的图表`
@@ -559,8 +520,6 @@ func GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 		return
 	}
 
-	//chartInfo.UnitEn = baseEdbInfo.UnitEn
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")
@@ -569,7 +528,6 @@ func GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 	resp.DataResp = resultResp
 	resp.EdbInfoList = edbList
 
-	// 将数据加入缓存
 	if utils.Re == nil {
 		data, _ := json.Marshal(resp)
 		utils.Rc.Put(key, data, 2*time.Hour)
@@ -579,10 +537,8 @@ func GetLineFeatureChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 	return
 }
 
-// GetCrossVarietyChartInfoDetailFromUniqueCode 根据编码获取图表详情
 func GetCrossVarietyChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 5)
 	if err != nil {
 		msg = "获取失败"
@@ -604,27 +560,20 @@ func GetCrossVarietyChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, k
 		errMsg = "解析跨品种分析配置失败,Err:" + err.Error()
 		return
 	}
-	// 获取图表x轴y轴
 	edbList, dataResp, err, msg, _ := cross_variety.GetChartData(0, config)
 	if err != nil {
 		errMsg = "获取图表,指标信息失败,Err:" + err.Error()
 		return
 	}
-	//判断是否需要展示英文标识
-	//chartInfo.IsEnChart = data.CheckIsEnChart(chartInfo.ChartNameEn, edbList[0:1], chartInfo.Source, chartInfo.ChartType)
-	//chartInfo.UnitEn = edbInfoMappingA.UnitEn
 
-	// 另存为
 	resp.ChartInfo = chartInfo
 	resp.DataResp = dataResp
 	resp.EdbInfoList = edbList
 
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")
 
-	// 将数据加入缓存
 	if utils.Re == nil {
 		d, _ := json.Marshal(resp)
 		_ = utils.Rc.Put(key, d, 2*time.Hour)
@@ -646,7 +595,6 @@ func GetBalanceChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key, l
 			errMsg = err.Error()
 		}
 	}()
-	// 相关联指标
 	mappingListTmp, dataListMap, err, errMsg := excel.GetBalanceExcelChartSingle(chartInfo.ChartInfoId, 0, lang)
 	if err != nil {
 		errMsg = "获取失败"
@@ -680,17 +628,11 @@ func GetBalanceChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key, l
 	return
 }
 
-// FutureGoodChartInfoRefresh
-// @Title 商品价格图表刷新接口
-// @Description 商品价格图表刷新接口
-// @Param   UniqueCode   query   string  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Success Ret=200 刷新成功
 // @router /future_good/refresh [get]
 func (this *ChartController) FutureGoodChartInfoRefresh() {
 	br := new(models.BaseResponse).Init()
 	chartId := 0
 	defer func() {
-		// 添加日志
 		if chartId > 0 {
 			shareChartRefreshLogInfo := &models.ShareChartRefreshLog{
 				Ip:         this.Ctx.Input.IP(),
@@ -728,21 +670,8 @@ func (this *ChartController) FutureGoodChartInfoRefresh() {
 		br.ErrMsg = "刷新图表关联指标信息失败,Err:" + err.Error()
 		return
 	}
-	//err = data.ChartInfoRefresh(chartInfo.ChartInfoId)
-	//if err != nil {
-	//	br.Msg = "刷新失败"
-	//	br.ErrMsg = "刷新图表关联指标信息失败,Err:" + err.Error()
-	//	return
-	//}
 
-	//err = data.ChartInfoRefreshV2(chartInfo.ChartInfoId)
-	//if err != nil {
-	//	br.Msg = "刷新失败"
-	//	br.ErrMsg = "刷新图表关联指标信息失败,Err:" + err.Error()
-	//	return
-	//}
 
-	//清除数据缓存
 	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
 	if utils.Re == nil {
 		utils.Rc.Delete(key)
@@ -752,10 +681,8 @@ func (this *ChartController) FutureGoodChartInfoRefresh() {
 	br.Msg = "刷新成功"
 }
 
-// GetCorrelationChartInfoDetailFromUniqueCode 根据编码获取相关性图表详情
 func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 1)
 	if err != nil {
 		msg = "获取失败"
@@ -770,7 +697,6 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 	startDate := chartInfo.StartDate
 	endDate := chartInfo.EndDate
 
-	// 兼容日期错误
 	{
 		if strings.Count(startDate, "-") == 1 {
 			startDate = startDate + "-01"
@@ -780,7 +706,6 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 		}
 	}
 
-	// 相关性图表信息
 	correlationChart := new(data_manage.ChartInfoCorrelation)
 	if e := correlationChart.GetItemById(chartInfoId); e != nil {
 		msg = "获取失败"
@@ -788,7 +713,6 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 		return
 	}
 
-	// 获取指标信息
 	edbInfoMappingA, e := models.GetChartEdbMappingByEdbInfoId(correlationChart.EdbInfoIdFirst)
 	if e != nil {
 		msg = "获取失败"
@@ -839,7 +763,6 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 		}
 	}
 
-	// 完善指标信息
 	edbList, e := correlationServ.GetChartEdbInfoFormat(chartInfo.ChartInfoId, edbInfoMappingA, edbInfoMappingB)
 	if e != nil {
 		msg = "获取失败"
@@ -847,7 +770,6 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 		return
 	}
 
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")
@@ -869,7 +791,6 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 	resp.CorrelationChartInfo = correlationInfo
 	resp.DataResp = dataResp
 
-	// 将数据加入缓存
 	if utils.Re == nil {
 		d, _ := json.Marshal(resp)
 		_ = utils.Rc.Put(key, d, 2*time.Hour)
@@ -878,17 +799,11 @@ func GetCorrelationChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, ke
 	return
 }
 
-// CorrelationChartInfoRefresh
-// @Title 商品价格图表刷新接口
-// @Description 商品价格图表刷新接口
-// @Param   UniqueCode   query   string  true       "图表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Success Ret=200 刷新成功
 // @router /correlation/refresh [get]
 func (this *ChartController) CorrelationChartInfoRefresh() {
 	br := new(models.BaseResponse).Init()
 	chartId := 0
 	defer func() {
-		// 添加日志
 		if chartId > 0 {
 			shareChartRefreshLogInfo := &models.ShareChartRefreshLog{
 				Ip:         this.Ctx.Input.IP(),
@@ -927,14 +842,7 @@ func (this *ChartController) CorrelationChartInfoRefresh() {
 		return
 	}
 
-	//// 刷新相关性图表
-	//if e := correlationServ.ChartInfoRefresh(chartInfo.ChartInfoId); e != nil {
-	//	br.Msg = "刷新失败"
-	//	br.ErrMsg = "刷新相关性图表失败, Err:" + e.Error()
-	//	return
-	//}
 
-	//清除数据缓存
 	key := utils.HZ_CHART_LIB_DETAIL + uniqueCode
 	if utils.Re == nil {
 		_ = utils.Rc.Delete(key)
@@ -944,10 +852,8 @@ func (this *ChartController) CorrelationChartInfoRefresh() {
 	br.Msg = "刷新成功"
 }
 
-// GetRangeAnalysisChartInfoDetailFromUniqueCode 根据编码获取区间计算图表详情
 func GetRangeAnalysisChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo, key, lang string) (resp *models.ChartInfoDetailResp, isOk bool, msg, errMsg string) {
 	resp = new(models.ChartInfoDetailResp)
-	// 获取主题样式
 	chartTheme, err := data.GetChartThemeConfig(chartInfo.ChartThemeId, utils.CHART_SOURCE_DEFAULT, 1)
 	if err != nil {
 		msg = "获取失败"
@@ -959,8 +865,6 @@ func GetRangeAnalysisChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo,
 
 	chartInfoId := chartInfo.ChartInfoId
 
-	// 获取指标信息
-	//chartInfo.CorrelationLeadUnit = req.LeadUnit
 	edbInfoMappingList, err := models.GetChartEdbMappingList(chartInfoId)
 	if err != nil {
 		msg = "获取失败"
@@ -968,12 +872,10 @@ func GetRangeAnalysisChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo,
 		return
 	}
 	dateType := chartInfo.DateType
-	// 开始/结束日期
 	startYear := chartInfo.StartYear
 	startDate := chartInfo.StartDate
 	endDate := chartInfo.EndDate
 
-	// 区间计算图表配置校验
 	var extraConfig models.ChartRangeAnalysisExtraConf
 	if chartInfo.ExtraConfig == `` {
 		msg = "配置信息错误"
@@ -986,14 +888,12 @@ func GetRangeAnalysisChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo,
 		return
 	}
 
-	// 获取图表数据
 	if len(edbInfoMappingList) == 0 {
 		msg = "获取失败"
 		errMsg = "图表没有指标,无法计算"
 		return
 	}
 
-	// 获取图表x轴y轴
 	edbList, xEdbIdValue, dataResp, e := range_analysis.GetChartDataByEdbInfoList(chartInfoId, dateType, startYear, startDate, endDate, edbInfoMappingList, &extraConfig)
 	if e != nil {
 		msg = "获取失败"
@@ -1001,7 +901,6 @@ func GetRangeAnalysisChartInfoDetailFromUniqueCode(chartInfo *models.ChartInfo,
 		return
 	}
 
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := data.GetEdbSourceByEdbInfoIdList(edbList)
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
 	chartInfo.ChartSourceEn = strings.Join(sourceNameEnList, ",")

+ 0 - 3
controllers/error.go

@@ -2,15 +2,12 @@ package controllers
 
 import "eta_gn/eta_chart_lib/models"
 
-// ErrorController
-// @Description: 该控制器处理页面错误请求
 type ErrorController struct {
 	BaseCommonController
 }
 
 func (c *ErrorController) Error404() {
 	c.Data["content"] = "很抱歉您访问的地址或者方法不存在"
-	//c.TplName = "error/404.html"
 
 	br := new(models.BaseResponse).Init()
 

+ 0 - 50
controllers/excel_info.go

@@ -17,17 +17,10 @@ import (
 	"github.com/shopspring/decimal"
 )
 
-// ExcelInfoController excel表格
 type ExcelInfoController struct {
 	BaseAuthController
 }
 
-// GetTableDetail
-// @Title 获取表格表详情
-// @Description 获取表格表详情接口
-// @Param   UniqueCode   query   string  true       "表格表唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Param   FromScene   query   int  true       "场景来源,1:智能研报,2:研报列表;3:英文研报;4:中文PPT;5:英文PPT"
-// @Success 200 {object} response.ExcelTableDetailResp
 // @router /detail [get]
 func (this *ExcelInfoController) GetTableDetail() {
 	br := new(models.BaseResponse).Init()
@@ -46,39 +39,6 @@ func (this *ExcelInfoController) GetTableDetail() {
 	key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + uniqueCode
 	resp := new(response.ExcelTableDetailResp)
 
-	//判断是否有缓存
-	//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 {
-	//				// 配置项
-	//				config := response.ExcelTableDetailConfigResp{
-	//					FontSize: 9,
-	//				}
-	//				// 获取配置的字体大小
-	//				confName := models.FromSceneMap[fromScene]
-	//				if confName != `` {
-	//					busConf, err := models.GetBusinessConfByKey(confName)
-	//					if err == nil {
-	//						sizeDeci, err := decimal.NewFromString(busConf.ConfVal)
-	//						if err == nil {
-	//							config.FontSize = int(sizeDeci.IntPart())
-	//						}
-	//					}
-	//				}
-	//				resp.Config = config
-	//
-	//				br.Ret = 200
-	//				br.Success = true
-	//				br.Msg = "获取成功"
-	//				br.Data = resp
-	//				fmt.Println("source redis")
-	//				return
-	//			}
-	//		}
-	//	}
-	//}
 
 	excelInfo, err := models.GetExcelInfoByUniqueCode(uniqueCode)
 	if err != nil {
@@ -188,7 +148,6 @@ func (this *ExcelInfoController) GetTableDetail() {
 		FontSize: 9,
 	}
 
-	// 获取配置的字体大小
 	confName := models.FromSceneMap[fromScene]
 	if confName != `` {
 		busConf, err := models.GetBusinessConfByKey(confName)
@@ -245,7 +204,6 @@ func refreshBalanceTable(excelDetail *excel3.ExcelInfo, lang string) (err error)
 		}
 	}
 
-	// 清除缓存
 	key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + excelDetail.UniqueCode
 	if utils.Re == nil {
 		_ = utils.Rc.Delete(key)
@@ -261,10 +219,6 @@ func refreshBalanceTable(excelDetail *excel3.ExcelInfo, lang string) (err error)
 	return
 }
 
-// Refresh
-// @Title 刷新
-// @Description 刷新接口
-// @Param   UniqueCode  query  string  true  "表格id"
 // @router /refresh [get]
 func (this *ExcelInfoController) Refresh() {
 	br := new(models.BaseResponse).Init()
@@ -294,7 +248,6 @@ func (this *ExcelInfoController) Refresh() {
 		_ = utils.Rc.Delete(key)
 	}()
 
-	// 获取数据详情
 	excelDetail, errMsg, err := excel2.GetExcelDetailInfoByExcelInfoId(uniqueCode, this.Lang)
 	if err != nil {
 		if utils.IsErrNoRow(err) {
@@ -307,7 +260,6 @@ func (this *ExcelInfoController) Refresh() {
 		return
 	}
 
-	// 数据刷新(只有自定义表格有刷新)
 	if excelDetail.Source == utils.TIME_TABLE {
 		jsonByte, e := json.Marshal(excelDetail.TableData)
 		if e != nil {
@@ -331,7 +283,6 @@ func (this *ExcelInfoController) Refresh() {
 		}
 	}
 
-	// 数据刷新-混合表格
 	if excelDetail.Source == utils.MIXED_TABLE {
 		jsonByte, e := json.Marshal(excelDetail.TableData)
 		if e != nil {
@@ -366,7 +317,6 @@ func (this *ExcelInfoController) Refresh() {
 		}
 	}
 
-	// 清除缓存
 	detailKey := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + excelDetail.UniqueCode
 	if utils.Re == nil {
 		_ = utils.Rc.Delete(detailKey)

+ 0 - 7
controllers/table.go

@@ -8,16 +8,10 @@ import (
 	"time"
 )
 
-// TableController 表格
 type TableController struct {
 	BaseAuthController
 }
 
-// TableInfoDetail
-// @Title 获取表格详情
-// @Description 获取表格详情接口
-// @Param   UniqueCode   query   string  true       "表格唯一编码,如果是管理后台访问,传固定字符串:7c69b590249049942070ae9dcd5bf6dc"
-// @Success 200 {object} data_manage.TableInfoDetailResp
 // @router /detail [get]
 func (this *TableController) TableInfoDetail() {
 	br := new(models.BaseResponse).Init()
@@ -34,7 +28,6 @@ func (this *TableController) TableInfoDetail() {
 	}
 	key := utils.HZ_TABLE_LIB_DETAIL + uniqueCode
 	resp := new(models.TableInfoDetailResp)
-	//判断是否有缓存
 	if utils.Re == nil {
 		if utils.Re == nil && utils.Rc.IsExist(key) {
 			if data, err1 := utils.Rc.RedisBytes(key); err1 == nil {

+ 0 - 23
global/dm.go

@@ -17,12 +17,9 @@ import (
 	_ "github.com/go-sql-driver/mysql"
 )
 
-// InitDm
-// @Description: 达梦数据库初始化
 func InitDm() {
 	dmSqlMap := make(map[string]*gorm.DB)
 
-	//开启日志
 	logWriter := io.MultiWriter(utils.Binlog) //binlog日志,记录到文件中去
 	if utils.RunMode == `dev` {               // 测试环境,默认输出在控制台,不需要的话,可以注释if里面下面的这行
 		logWriter = io.MultiWriter(utils.Binlog, os.Stdout)
@@ -34,31 +31,18 @@ func InitDm() {
 		Colorful:                  true,                   //是否颜色输出
 	})
 
-	// 默认库
 	connectDm(utils.MYSQL_URL, "default", newLogger, dmSqlMap, true)
 
-	// 指标库
 	connectDm(utils.MYSQL_URL_DATA, "data", newLogger, dmSqlMap, false)
 
-	//全局赋值数据库链接
 	DmSQL = dmSqlMap
 
 }
 
-// connectDm
-// @Description: 达梦数据库连接
-// @param dsn
-// @param aliasName
-// @param newLogger
-// @param dmSqlMap
-// @param isDefault
 func connectDm(dsn, aliasName string, newLogger logger.Interface, dmSqlMap map[string]*gorm.DB, isDefault bool) {
-	//fmt.Println("dsn:", dsn, "  ==  ;aliasName:", aliasName)
 	if dsn == `` {
 		return
 	}
-	//dsn := "dm://SYSDBA:SYSDBA001@8.136.199.33:30236?schema=\"eta_master\""
-	//dsn := "dm://ETA:Han6258199118%60@localhost:5236?schema=ECOLOGY_TARGET"
 	db, err := gorm.Open(dm.Open(dsn), &gorm.Config{
 		Logger: newLogger,
 		NamingStrategy: schema.NamingStrategy{
@@ -66,31 +50,24 @@ func connectDm(dsn, aliasName string, newLogger logger.Interface, dmSqlMap map[s
 		},
 	})
 	if err != nil {
-		//global.LOG.Errorf("mysql 启动异常,数据库:default;Err:", err)
 		panic(fmt.Errorf("mysql 启动异常,数据库:%s;Err:%s", aliasName, err))
 	}
 
-	//创建连接池
 	sqlDB, err := db.DB()
 	if err != nil {
-		//global.LOG.Errorf("mysql 创建连接池失败,数据库:default;Err:", err)
 		panic(fmt.Errorf("mysql 创建连接池失败,数据库:%s;Err:%s", aliasName, err))
 	}
 
 	dmSqlMap[aliasName] = db
 
-	//默认数据库连接
 	if isDefault {
 		DEFAULT_DmSQL = db
 	}
 
-	// SetMaxIdleConns 设置空闲连接池中连接的最大数量
 	sqlDB.SetMaxIdleConns(50)
 
-	// SetMaxOpenConns 设置打开数据库连接的最大数量。
 	sqlDB.SetMaxOpenConns(100)
 
-	// SetConnMaxLifetime 设置了连接可复用的最大时间。
 	sqlDB.SetConnMaxLifetime(10 * time.Minute)
 
 }

+ 0 - 1
global/global.go

@@ -12,6 +12,5 @@ var (
 )
 
 func init() {
-	// 初始化达梦连接
 	InitDm()
 }

+ 0 - 2
main.go

@@ -22,7 +22,6 @@ func main() {
 	}
 
 	models.AfterInitTable()
-	// 异常处理
 	beego.ErrorController(&controllers.ErrorController{})
 
 	beego.BConfig.RecoverFunc = Recover
@@ -55,7 +54,6 @@ func Recover(ctx *context.Context, conf *beego.Config) {
 			logs.Critical(fmt.Sprintf("%s:%d", file, line))
 			stack = stack + fmt.Sprintln(fmt.Sprintf("%s:%d</br>", file, line))
 		}
-		//go utils.SendEmail(utils.APPNAME+"崩了"+time.Now().Format("2006-01-02 15:04:05"), stack, utils.EmailSendToUsers)
 		go alarm_msg.SendAlarmMsg(utils.APPNAME+"崩了"+time.Now().Format("2006-01-02 15:04:05")+"<br/>"+stack, 3)
 	}
 	return

+ 6 - 60
models/business_conf.go

@@ -14,7 +14,6 @@ const (
 	BusinessConfWatermarkChart   = "WatermarkChart"
 )
 
-// FromSceneMap 数据源名称与数据源ID的对应关系
 var FromSceneMap = map[int]string{
 	1: "SmartReportSheetSize",
 	2: "ReportSheetSize",
@@ -23,18 +22,7 @@ var FromSceneMap = map[int]string{
 	5: "EnPptSheetSize",
 }
 
-// BusinessConf 商户配置表
-// type BusinessConf struct {
-// 	Id         int    `orm:"column(id);pk"`
-// 	ConfKey    string `description:"配置Key"`
-// 	ConfVal    string `description:"配置值"`
-// 	ValType    int    `description:"1-字符串;2-数值;3-字符串数组;4-富文本;"`
-// 	Necessary  int    `description:"是否必填:0-否;1-是"`
-// 	Remark     string `description:"备注"`
-// 	CreateTime time.Time
-// }
-
-// BusinessConf 商户配置表
+
 type BusinessConf struct {
 	Id         int       `gorm:"column:id;primaryKey" description:"配置ID" orm:"column(id);pk"`
 	ConfKey    string    `gorm:"column:conf_key" description:"配置Key"`
@@ -45,7 +33,6 @@ type BusinessConf struct {
 	CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
 }
 
-// GetBusinessConf 获取商家配置
 func GetBusinessConf() (list map[string]string, err error) {
 	list = make(map[string]string)
 
@@ -74,10 +61,6 @@ func GetBusinessConfByKey(key string) (item *BusinessConf, err error) {
 	return
 }
 
-// InitUseMongoConf
-// @Description:
-// @author: Roc
-// @datetime 2024-07-01 13:49:09
 func InitUseMongoConf() {
 	useMongo, e := GetBusinessConfByKey("UseMongo")
 	if e != nil {
@@ -89,45 +72,8 @@ func InitUseMongoConf() {
 	}
 }
 
-// func GetBusinessConf() (list map[string]string, err error) {
-// 	list = make(map[string]string)
-
-// 	var items []*BusinessConf
-// 	o := orm.NewOrm()
-// 	sql := `SELECT * FROM business_conf`
-// 	_, err = o.Raw(sql).QueryRows(&items)
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	for _, v := range items {
-// 		if v.ValType == 4 {
-// 			list[v.ConfKey] = html.UnescapeString(v.ConfVal)
-// 			continue
-// 		}
-// 		list[v.ConfKey] = v.ConfVal
-// 	}
-// 	return
-// }
-
-// func GetBusinessConfByKey(key string) (item *BusinessConf, err error) {
-// 	o := orm.NewOrm()
-// 	sql := fmt.Sprintf(`SELECT * FROM business_conf WHERE conf_key = ? LIMIT 1`)
-// 	err = o.Raw(sql, key).QueryRow(&item)
-// 	return
-// }
-
-// // InitUseMongoConf
-// // @Description:
-// // @author: Roc
-// // @datetime 2024-07-01 13:49:09
-// func InitUseMongoConf() {
-// 	useMongo, e := GetBusinessConfByKey("UseMongo")
-// 	if e != nil {
-// 		return
-// 	}
-
-// 	if useMongo.ConfVal == `true` {
-// 		utils.UseMongo = true
-// 	}
-// }
+
+
+
+
+

+ 27 - 650
models/chart.go

@@ -15,51 +15,6 @@ import (
 	"github.com/nosixtools/solarlunar"
 )
 
-//	type ChartInfo struct {
-//		ChartInfoId       int       `json:"-" orm:"column(chart_info_id);pk"`
-//		ChartName         string    `description:"来源名称"`
-//		ChartNameEn       string    `description:"英文图表名称"`
-//		ChartClassifyId   int       `json:"-" description:"图表分类id"`
-//		SysUserId         int       `json:"-"`
-//		SysUserRealName   string    `json:"-"`
-//		UniqueCode        string    `description:"图表唯一编码"`
-//		CreateTime        time.Time `json:"-"`
-//		ModifyTime        time.Time `json:"-"`
-//		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:"图表图片"`
-//		BarConfig         string    `description:"柱方图的配置,json数据" json:"-"`
-//		XMin              string    `description:"图表X轴最小值"`
-//		XMax              string    `description:"图表X轴最大值"`
-//		LeftMin           string    `description:"图表左侧最小值"`
-//		LeftMax           string    `description:"图表左侧最大值"`
-//		RightMin          string    `description:"图表右侧最小值"`
-//		RightMax          string    `description:"图表右侧最大值"`
-//		Right2Min         string    `description:"图表右侧2最小值"`
-//		Right2Max         string    `description:"图表右侧2最大值"`
-//		MinMaxSave        int       `description:"是否手动保存过上下限:0-否;1-是"`
-//		Source            int       `description:"1:ETA图库;2:商品价格曲线"`
-//		Unit              string    `description:"中文单位名称"`
-//		UnitEn            string    `description:"英文单位名称"`
-//		ExtraConfig       string    `description:"图表额外配置,json数据" json:"-"`
-//		ChartSource       string    `description:"图表来源str"`
-//		ChartSourceEn     string    `description:"图表来源(英文)"`
-//		SeasonExtraConfig string    `description:"季节性图表中的配置,json数据"`
-//		StartYear         int       `description:"当选择的日期类型为最近N年类型时,即date_type=20, 用start_year表示N"`
-//		ChartThemeId      int       `description:"图表应用主题ID"`
-//		ChartThemeStyle   string    `description:"图表应用主题样式"`
-//		SourcesFrom       string    `description:"图表来源"`
-//		Instructions      string    `description:"图表说明"`
-//		MarkersLines      string    `description:"标识线"`
-//		MarkersAreas      string    `description:"标识区"`
-//	}
 type ChartInfo struct {
 	ChartInfoId       int       `gorm:"column:chart_info_id;primaryKey" json:"-" orm:"column(chart_info_id);pk"`
 	ChartName         string    `gorm:"column:chart_name" description:"来源名称"`
@@ -117,68 +72,8 @@ func GetChartInfoByUniqueCode(uniqueCode string) (item *ChartInfo, err error) {
 	return
 }
 
-// func GetChartInfoByUniqueCode(uniqueCode string) (item *ChartInfo, err error) {
-// 	o := orm.NewOrmUsingDB("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:"指标名称"`
-// 	EdbAliasName      string  `description:"指标名称(别名)"`
-// 	EdbAliasNameEn    string  `description:"英文指标名称(别名)"`
-// 	EdbNameEn         string  `description:"英文指标名称"`
-// 	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" json:"-"`
-// 	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:领先指标"`
-// 	EdbType           int     `description:"指标类型:1:基础指标,2:计算指标"`
-// 	LeadValue         int     `description:"领先值"`
-// 	LeadUnit          string  `description:"领先单位"`
-// 	LeadUnitEn        string  `description:"领先英文单位"`
-// 	ChartStyle        string  `description:"图表类型"`
-// 	ChartColor        string  `description:"颜色"`
-// 	ChartWidth        float64 `description:"线条大小"`
-// 	DataList          interface{}
-
-// 	EdbInfoCategoryType int     `description:"0:普通指标,1:预测指标"`
-// 	PredictChartColor   string  `description:"预测数据的颜色"`
-// 	ChartType           int     `description:"生成样式:1:曲线图,2:季节性图,3:面积图,4:柱状图,5:散点图,6:组合图"`
-// 	LatestDate          string  `description:"数据最新日期"`
-// 	LatestValue         float64 `description:"数据最新值"`
-// 	MoveLatestDate      string  `description:"移动后的数据最新日期"`
-// 	UniqueCode          string  `description:"指标唯一编码"`
-// 	MinValue            float64 `json:"-" description:"最小值"`
-// 	MaxValue            float64 `json:"-" description:"最大值"`
-// 	IsNullData          bool    `json:"-" description:"是否空数据"`
-// 	MappingSource       int     `description:"1:ETA图库;2:商品价格曲线"`
-// 	SubSource           int     `description:"子数据来源:0:经济数据库,1:日期序列"`
-// 	SubSourceName       string  `description:"子数据来源名称"`
-// 	IndicatorCode       string  `description:"指标代码"`
-// 	StockCode           string  `description:"证券代码"`
-// 	IsConvert           int     `description:"是否数据转换 0不转 1转"`
-// 	ConvertType         int     `description:"数据转换类型 1乘 2除 3对数"`
-// 	ConvertValue        float64 `description:"数据转换值"`
-// 	ConvertUnit         string  `description:"数据转换单位"`
-// 	ConvertEnUnit       string  `description:"数据转换单位"`
-// 	ClassifyId          int     `description:"分类id"`
-// 	IsJoinPermission    int     `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
-// }
+
+
 
 type ChartEdbInfoMapping struct {
 	EdbInfoId           int         `gorm:"column:edb_info_id;primaryKey" description:"指标id"`
@@ -248,26 +143,7 @@ a.is_convert, a.convert_type, a.convert_value, a.convert_unit, a.convert_en_unit
 	return
 }
 
-// func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source,a.edb_alias_name`
-// 	sql := ` SELECT ` + aField + `,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.edb_type,b.latest_date,b.latest_value,b.unique_code,b.edb_info_type AS edb_info_category_type,b.sub_source,
-// a.is_convert, a.convert_type, a.convert_value, a.convert_unit, a.convert_en_unit
-//              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  `description:"数据日期"`
-// 	DataTimestamp int64   `description:"数据日期"`
-// 	Value         float64 `description:"数据值"`
-// }
+
 
 type EdbDataList struct {
 	EdbDataId     int     `gorm:"column:edb_data_id;primaryKey" description:"指标数据ID"`
@@ -286,9 +162,7 @@ func (e *EdbDataList) AfterFind(db *gorm.DB) (err error) {
 	return
 }
 
-// GetEdbDataList 获取指标的数据(日期正序返回)
 func GetEdbDataList(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
-	// 自有数据需要额外处理(从mongo获取)
 	if source == utils.DATA_SOURCE_BUSINESS && utils.UseMongo {
 		return getEdbDataListByMongo(source, subSource, edbInfoId, startDate, endDate)
 	}
@@ -299,17 +173,6 @@ func GetEdbDataList(source, subSource, edbInfoId int, startDate, endDate string)
 	return getEdbDataListByMysql(source, subSource, edbInfoId, startDate, endDate)
 }
 
-// getEdbDataListByMysql
-// @Description: 从mysql中获取指标的数据(日期正序返回)
-// @author: Roc
-// @datetime 2024-05-08 16:49:48
-// @param source int
-// @param subSource int
-// @param edbInfoId int
-// @param startDate string
-// @param endDate string
-// @return list []*EdbDataList
-// @return err error
 func getEdbDataListByMysql(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
 	tableName := GetEdbDataTableName(source, subSource)
 	if tableName == "" {
@@ -339,26 +202,13 @@ func getEdbDataListByMysql(source, subSource, edbInfoId int, startDate, endDate
 	return
 }
 
-// getEdbDataListByMongo
-// @Description: 从mongo中获取指标的数据(日期正序返回)
-// @author: Roc
-// @datetime 2024-05-08 16:49:59
-// @param source int
-// @param subSource int
-// @param edbInfoId int
-// @param startDate string
-// @param endDate string
-// @return list []*EdbDataList
-// @return err error
 func getEdbDataListByMongo(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
 	list = make([]*EdbDataList, 0)
 
 	mogDataObj := mgo.EdbDataBusiness{}
-	// 构建查询条件
 	queryConditions := bson.M{
 		"edb_info_id": edbInfoId,
 	}
-	// 日期
 	dateCondition, err := mgo.BuildDateCondition(startDate, endDate)
 	if err != nil {
 		return
@@ -367,7 +217,6 @@ func getEdbDataListByMongo(source, subSource, edbInfoId int, startDate, endDate
 		queryConditions["data_time"] = dateCondition
 	}
 
-	// 获取列表数据
 	tmpDataList, tmpErr := mogDataObj.GetAllDataList(queryConditions, []string{"data_time"})
 	if tmpErr != nil {
 		err = tmpErr
@@ -386,91 +235,10 @@ func getEdbDataListByMongo(source, subSource, edbInfoId int, startDate, endDate
 	return
 }
 
-// getEdbDataListByMysql
-// @Description: 从mysql中获取指标的数据(日期正序返回)
-// @author: Roc
-// @datetime 2024-05-08 16:49:48
-// @param source int
-// @param subSource int
-// @param edbInfoId int
-// @param startDate string
-// @param endDate string
-// @return list []*EdbDataList
-// @return err error
-// func getEdbDataListByMysql(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
-// 	tableName := GetEdbDataTableName(source, subSource)
-// 	if tableName == "" {
-// 		err = errors.New("无效的渠道:" + strconv.Itoa(source))
-// 		list = make([]*EdbDataList, 0)
-// 		return list, err
-// 	}
-// 	var pars []interface{}
-// 	var condition string
-// 	if startDate != "" {
-// 		condition += ` AND data_time>=? `
-// 		pars = append(pars, startDate)
-// 	}
-// 	if endDate != "" {
-// 		condition += ` AND data_time<=? `
-// 		pars = append(pars, endDate)
-// 	}
-// 	sql := `SELECT edb_data_id,edb_info_id,data_time,value,data_timestamp FROM %s WHERE edb_info_id=? `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += ` ORDER BY data_time ASC  `
-// 	sql = fmt.Sprintf(sql, tableName)
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Raw(sql, edbInfoId, pars).QueryRows(&list)
-// 	return
-// }
-
-// // getEdbDataListByMongo
-// // @Description: 从mongo中获取指标的数据(日期正序返回)
-// // @author: Roc
-// // @datetime 2024-05-08 16:49:59
-// // @param source int
-// // @param subSource int
-// // @param edbInfoId int
-// // @param startDate string
-// // @param endDate string
-// // @return list []*EdbDataList
-// // @return err error
-// func getEdbDataListByMongo(source, subSource, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
-// 	list = make([]*EdbDataList, 0)
-
-// 	mogDataObj := mgo.EdbDataBusiness{}
-// 	// 构建查询条件
-// 	queryConditions := bson.M{
-// 		"edb_info_id": edbInfoId,
-// 	}
-// 	// 日期
-// 	dateCondition, err := mgo.BuildDateCondition(startDate, endDate)
-// 	if err != nil {
-// 		return
-// 	}
-// 	if len(dateCondition) > 0 {
-// 		queryConditions["data_time"] = dateCondition
-// 	}
-
-// 	// 获取列表数据
-// 	tmpDataList, tmpErr := mogDataObj.GetAllDataList(queryConditions, []string{"data_time"})
-// 	if tmpErr != nil {
-// 		err = tmpErr
-// 		return
-// 	}
-// 	for k, v := range tmpDataList {
-// 		list = append(list, &EdbDataList{
-// 			EdbDataId:     k + 1,
-// 			EdbInfoId:     v.EdbInfoId,
-// 			DataTime:      v.DataTime.Format(utils.FormatDate),
-// 			DataTimestamp: v.DataTimestamp,
-// 			Value:         v.Value,
-// 		})
-// 	}
-
-// 	return
-// }
+
+
+
+
 
 type EdbDataItemList struct {
 	EdbDataId     int     `json:"-" description:" 指标数据ID"`
@@ -480,12 +248,6 @@ type EdbDataItemList struct {
 	Value         float64 `description:"数据值"`
 }
 
-//	type EdbDataItems struct {
-//		Items                []*EdbDataList
-//		Year                 int
-//		BetweenDay           int   `json:"-" description:"公历与农历之间相差的天数"`
-//		CuttingDataTimestamp int64 `description:"切割的时间戳"`
-//	}
 type EdbDataItems struct {
 	Items                []*EdbDataList `gorm:"column:items" description:"指标数据项列表"`
 	Year                 int            `gorm:"column:year" description:"年份"`
@@ -525,14 +287,12 @@ type ChartInfoDetailResp struct {
 	IsCollect            bool             `description:"是否收藏"`
 }
 
-// XData 商品价格曲线的的x轴数据
 type XData struct {
 	Name   string `description:"别名"`
 	NameEn string `description:"英文别名"`
 	IsHide int    `description:"是否隐藏,0不隐藏,1隐藏"`
 }
 
-// YData 柱方图的y轴数据
 type YData struct {
 	Date           string          `description:"数据日期"`
 	ConfigDate     time.Time       `description:"配置的日期" json:"-"`
@@ -552,13 +312,11 @@ type YData struct {
 	} `description:"对应的系列指标"`
 }
 
-// RollingCorrelationChartDataResp 滚动相关性图
 type RollingCorrelationChartDataResp struct {
 	XDateTimeValue []string `description:"滚动相关性图的x轴数据,日期数据"`
 	YDataList      []YData  `description:"滚动相关性图的y轴数据"`
 }
 
-// 指标季度数据计算(公历转农历)
 func AddCalculateQuarterV5(dataList []*EdbDataList) (result *EdbDataResult, err error) {
 	var errMsg string
 	defer func() {
@@ -615,10 +373,8 @@ func AddCalculateQuarterV5(dataList []*EdbDataList) (result *EdbDataResult, err
 			yearMap[year] = year
 		}
 	}
-	//排序
 	fmt.Println("yearArr:", yearArr)
 	thisYear := cureentDate.Year()
-	//thisMonth := int(cureentDate.Month())
 
 	fmt.Println("thisMonth:", thisMonth)
 	for ky, vy := range yearArr {
@@ -738,7 +494,6 @@ func AddCalculateQuarterV5(dataList []*EdbDataList) (result *EdbDataResult, err
 	return
 }
 
-// AddCalculateQuarterV6 指标季度数据计算(季节性图表)
 func AddCalculateQuarterV6(dataList []*EdbDataList) (result *EdbDataResult, err error) {
 	var errMsg string
 	defer func() {
@@ -791,10 +546,8 @@ func AddCalculateQuarterV6(dataList []*EdbDataList) (result *EdbDataResult, err
 			yearMap[year] = year
 		}
 	}
-	//排序
 	fmt.Println("yearArr:", yearArr)
 	thisYear := cureentDate.Year()
-	//thisMonth := int(cureentDate.Month())
 
 	fmt.Println("thisMonth:", thisMonth)
 	for ky, vy := range yearArr {
@@ -867,7 +620,6 @@ func AddCalculateQuarterV6(dataList []*EdbDataList) (result *EdbDataResult, err
 			items.BetweenDay = int(day) //公历日期换算成农历,需要减除的天数
 			items.Year = preYear
 			fmt.Println("preYear:", preYear, "ky:", ky, "yearArrLen:", len(yearArr))
-			//if ky+1 < len(yearArr) {
 			for _, v := range dataList {
 				dateTime, err := time.Parse(utils.FormatDate, v.DataTime)
 				if err != nil {
@@ -908,354 +660,25 @@ func AddCalculateQuarterV6(dataList []*EdbDataList) (result *EdbDataResult, err
 	return
 }
 
-// func AddCalculateQuarterV5(dataList []*EdbDataList) (result *EdbDataResult, err error) {
-// 	var errMsg string
-// 	defer func() {
-// 		if errMsg != "" {
-// 			fmt.Println("errMsg:", errMsg)
-// 		}
-// 	}()
-// 	if len(dataList) <= 0 {
-// 		result.List = make([]*EdbDataItems, 0)
-// 		return
-// 	}
-
-// 	endDate := dataList[len(dataList)-1].DataTime
-// 	endDateForm, err := time.Parse(utils.FormatDate, endDate)
-// 	if err != nil {
-// 		return result, err
-// 	}
-// 	thisMonth := int(endDateForm.Month())
-
-// 	result = new(EdbDataResult)
-// 	var yearArr []int
-// 	yearMap := make(map[int]int)
-// 	var cureentDate time.Time
-// 	if thisMonth < 11 {
-// 		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
-// 		}
-// 	} else {
-// 		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() + 1
-// 			if _, ok := yearMap[year]; !ok {
-// 				yearArr = append(yearArr, year)
-// 			}
-// 			yearMap[year] = year
-// 		}
-// 	}
-// 	//排序
-// 	fmt.Println("yearArr:", yearArr)
-// 	thisYear := cureentDate.Year()
-// 	//thisMonth := int(cureentDate.Month())
-
-// 	fmt.Println("thisMonth:", thisMonth)
-// 	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
-// 			}
-
-// 			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)
-
-// 			items := new(EdbDataItems)
-// 			items.BetweenDay = int(day) //公历日期换算成农历,需要减除的天数
-// 			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)
-// 				if newDate.Before(selectDate) || newDate == 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 {
-// 			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, nextYearCjglDate, preYearCjglDate)
-
-// 			items := new(EdbDataItems)
-// 			items.BetweenDay = int(day) //公历日期换算成农历,需要减除的天数
-// 			items.Year = preYear - 1
-// 			fmt.Println("preYear:", preYear, "ky:", ky, "yearArrLen:", len(yearArr))
-// 			if ky+1 < len(yearArr) {
-// 				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) || newDate == 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 {
-// 				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
-// 					}
-// 					timestamp := dateTime.UnixNano() / 1e6
-// 					item := new(EdbDataList)
-// 					item.DataTime = dateTime.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
-// }
-
-// // AddCalculateQuarterV6 指标季度数据计算(季节性图表)
-// func AddCalculateQuarterV6(dataList []*EdbDataList) (result *EdbDataResult, err error) {
-// 	var errMsg string
-// 	defer func() {
-// 		if errMsg != "" {
-// 			fmt.Println("errMsg:", errMsg)
-// 		}
-// 	}()
-
-// 	endDate := dataList[len(dataList)-1].DataTime
-// 	endDateForm, err := time.Parse(utils.FormatDate, endDate)
-// 	if err != nil {
-// 		return result, err
-// 	}
-// 	thisMonth := int(endDateForm.Month())
-
-// 	result = new(EdbDataResult)
-// 	var yearArr []int
-// 	yearMap := make(map[int]int)
-// 	var cureentDate time.Time
-// 	if thisMonth < 11 {
-// 		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
-// 		}
-// 	} else {
-// 		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() + 1
-// 			if _, ok := yearMap[year]; !ok {
-// 				yearArr = append(yearArr, year)
-// 			}
-// 			yearMap[year] = year
-// 		}
-// 	}
-// 	//排序
-// 	fmt.Println("yearArr:", yearArr)
-// 	thisYear := cureentDate.Year()
-// 	//thisMonth := int(cureentDate.Month())
-
-// 	fmt.Println("thisMonth:", thisMonth)
-// 	for ky, vy := range yearArr {
-// 		fmt.Printf("line 432:ky:%d, vy:%d, thisYear:%d, thisMonth:%d", ky, vy, thisYear, thisMonth)
-// 		fmt.Println("")
-// 		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
-// 			}
-
-// 			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, currentYearCjglDate, preYearCjglDate)
-
-// 			items := new(EdbDataItems)
-// 			items.BetweenDay = int(day) //公历日期换算成农历,需要减除的天数
-// 			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))
-// 				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 {
-// 			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, nextYearCjglDate, preYearCjglDate)
-
-// 			items := new(EdbDataItems)
-// 			items.BetweenDay = int(day) //公历日期换算成农历,需要减除的天数
-// 			items.Year = preYear
-// 			fmt.Println("preYear:", preYear, "ky:", ky, "yearArrLen:", len(yearArr))
-// 			//if ky+1 < len(yearArr) {
-// 			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))
-// 				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 {
-// 				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
-// 					}
-// 					timestamp := dateTime.UnixNano() / 1e6
-// 					item := new(EdbDataList)
-// 					item.DataTime = dateTime.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 CorrelationInfo struct {
 	LeadValue       int    `description:"领先值"`
@@ -1280,7 +703,6 @@ type SeasonExtraItem struct {
 	SamePeriodStandardDeviation SamePeriodStandardDeviation `description:"自定义同期标准差"`
 }
 
-// 自定义右轴指标
 type SeasonRightAxis struct {
 	IndicatorType int     `description:"右轴指标类型 1:左轴指标同比,2:指标库,3:预测指标 "`
 	Style         string  `description:"生成样式"`
@@ -1297,7 +719,6 @@ type SeasonRightAxis struct {
 	IsAdd         bool    `description:"是否添加"`
 }
 
-// 自定义同期上下限
 type MaxMinLimits struct {
 	Color  string `description:"颜色"`
 	Year   int    `description:"上下限取值范围"`
@@ -1306,7 +727,6 @@ type MaxMinLimits struct {
 	IsAdd  bool   `description:"是否添加"`
 }
 
-// 自定义同期均线
 type SamePeriodAverage struct {
 	Color     string  `description:"颜色"`
 	Year      int     `description:"均线取值范围"`
@@ -1317,7 +737,6 @@ type SamePeriodAverage struct {
 	IsAdd     bool    `description:"是否添加"`
 }
 
-// 自定义同期均线
 type SamePeriodAverageResp struct {
 	Color     string                   `description:"颜色"`
 	Year      int                      `description:"均线取值范围"`
@@ -1335,7 +754,6 @@ type SamePeriodAverageData struct {
 	Value         float64 `description:"均值"`
 }
 
-// 自定义同期标准差
 type SamePeriodStandardDeviation struct {
 	Color    string  `description:"颜色"`
 	Year     int     `description:"标准差取值范围"`
@@ -1362,7 +780,6 @@ type SeasonChartResp struct {
 	RightAxis                   SeasonRightAxisResp             `description:"自定义右轴指标"`
 }
 
-// 自定义右轴指标
 type SeasonRightAxisResp struct {
 	SeasonRightAxis
 	EdbInfoList []*ChartEdbInfoMapping
@@ -1408,7 +825,6 @@ type ChartDwCollectReq struct {
 	Token      string
 }
 
-// 截面组合图额外配置
 type ChartSectionExtraConf struct {
 	DateConfList        []*ChartSectionDateConfItem
 	IsHeap              int                      `description:"是否堆积(1.堆积,0不堆积)"`
@@ -1418,7 +834,6 @@ type ChartSectionExtraConf struct {
 	SortType            int                      `description:"排序类型,0默认,1升序,2降序"`
 }
 
-// 截面组合图额外配置
 type ChartSectionAllExtraConf struct {
 	ChartSectionExtraConf
 	SeriesList []*ChartSectionSeriesItem
@@ -1439,7 +854,6 @@ type ChartSectionDateConfItem struct {
 	DateChange     []*ChartSectionDateChange
 }
 
-// 截面组合图引用日期配置
 type ChartSectionDateChange struct {
 	Year         int
 	Month        int
@@ -1449,26 +863,7 @@ type ChartSectionDateChange struct {
 	ChangeType   int    `description:"日期变换类型1日期位移,2指定频率"`
 }
 
-// 截面组合图系列配置
-// type ChartSectionSeriesItem struct {
-// 	ChartSeriesId int     `description:"系列ID"`
-// 	SeriesName    string  `description:"系列名称"` //系列名称不可同名
-// 	SeriesNameEn  string  `description:"系列英文名称"`
-// 	ChartStyle    string  `description:"图表类型"`
-// 	ChartColor    string  `description:"颜色"`
-// 	ChartWidth    int     `description:"线条大小"`
-// 	IsPoint       int     `description:"是否用数据点展示(0 否,1是)"`
-// 	IsNumber      int     `description:"是否用数值展示(0 否,1是)"`
-// 	IsAxis        int     `description:"1:左轴,0:右轴"`
-// 	MaxData       float64 `description:"上限"`
-// 	MinData       float64 `description:"下限"`
-// 	//IsOrder         bool    `description:"true:正序,false:逆序"`
-// 	EdbInfoList    []*ChartSectionSeriesEdbConf
-// 	DataList       []float64
-// 	NoDataEdbIndex []int
-// }
-
-// 截面组合图系列配置
+
 type ChartSectionSeriesItem struct {
 	ChartSeriesId  int                          `gorm:"column:chart_series_id;primaryKey" description:"系列ID"`
 	SeriesName     string                       `gorm:"column:series_name" description:"系列名称"` //系列名称不可同名
@@ -1489,7 +884,6 @@ type ChartSectionSeriesItem struct {
 type ChartSectionSeriesEdbConf struct {
 	ChartSeriesEdbMappingId int `description:"映射ID"`
 	ChartSeriesId           int `description:"系列ID"`
-	//ChartInfoId             int `description:"图表ID"`
 	EdbInfoId    int `description:"指标id"`
 	DateConf     *ChartSectionSeriesDateConfItem
 	EdbName      string `description:"中文别名"`
@@ -1517,13 +911,11 @@ type ChartSectionCombineDataResp struct {
 	Right2Max           string `description:"图表右侧最大值"`
 }
 
-// 系列里的指标日期配置
 type ChartSectionSeriesDateConfItem struct {
 	MoveForward int `description:"前移的期数"`
 	DateChange  []*ChartSectionDateChange
 }
 
-// PreviewSectionCombineChartReq 预览截面组合图的请求
 type PreviewSectionCombineChartReq struct {
 	ChartName       string `description:"图表名称"`
 	ChartClassifyId int    `description:"分类id"`
@@ -1539,7 +931,6 @@ type ChartSectionCombineUnit struct {
 	RightTwoNameEn string `description:"右2轴英文单位"`
 }
 
-// 时序组合图额外配置
 type ChartTimeCombineExtraConf struct {
 	IsHeap int `description:"是否堆积(1.堆积,0不堆积)"`
 }
@@ -1555,12 +946,6 @@ func GetChartInfoById(chartInfoId int) (item *ChartInfo, err error) {
 	return
 }
 
-// func GetChartInfoById(chartInfoId int) (item *ChartInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM chart_info WHERE chart_info_id=? `
-// 	err = o.Raw(sql, chartInfoId).QueryRow(&item)
-// 	return
-// }
 
 type MarkersLine struct {
 	Axis             int             `json:"axis" description:"1左轴 2右轴 3横轴"`
@@ -1593,8 +978,6 @@ type MarkersLineTime struct {
 	Conf     EdbDateChangeConf `json:"conf" description:"动态时间配置"`
 }
 
-// EdbDateExtraConf
-// @Description: 导入指标日期前移和日期变换
 type EdbDateChangeConf struct {
 	MoveForward int `json:"moveForward" description:"前移的期数"`
 	BaseDate    int `json:"baseDate" description:"基准日期 0系统日期 1指标最新日期"`
@@ -1614,12 +997,10 @@ func getThsHfEdbDataListByMongo(source, subSource, edbInfoId int, startDate, end
 	list = make([]*EdbDataList, 0)
 
 	mogDataObj := mgo.EdbDataThsHf{}
-	// 构建查询条件
 	queryConditions := bson.M{
 		"edb_info_id": edbInfoId,
 	}
 
-	// 数据日期
 	dateCondition, err := mgo.BuildDateCondition(startDate, endDate)
 	if err != nil {
 		return
@@ -1628,7 +1009,6 @@ func getThsHfEdbDataListByMongo(source, subSource, edbInfoId int, startDate, end
 		queryConditions["data_time"] = dateCondition
 	}
 
-	// 获取列表数据
 	tmpDataList, tmpErr := mogDataObj.GetAllDataList(queryConditions, []string{"data_time"})
 	if tmpErr != nil {
 		err = tmpErr
@@ -1646,9 +1026,6 @@ func getThsHfEdbDataListByMongo(source, subSource, edbInfoId int, startDate, end
 	return
 }
 
-// ConvertToResp
-// @Description: 转成需要输出的格式
-// @receiver m
 func (m *ChartEdbInfoMapping) ConvertToResp() {
 	m.ModifyTime = utils.GormDateStrToDateTimeStr(m.ModifyTime)
 	m.StartDate = utils.GormDateStrToDateStr(m.StartDate)

+ 7 - 84
models/chart_edb_mapping.go

@@ -5,7 +5,6 @@ import (
 	"eta_gn/eta_chart_lib/utils"
 )
 
-// GetEtaEdbChartEdbMapping       商品曲线图查询对应的普通指标
 func GetEtaEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
 	o := global.DmSQL["data"]
 
@@ -19,7 +18,6 @@ func GetEtaEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err e
 	return
 }
 
-// GetEtaEdbChartEdbMappingList       商品曲线图查询对应的普通指标
 func GetEtaEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
 	o := global.DmSQL["data"]
 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
@@ -33,7 +31,6 @@ func GetEtaEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping
 	return
 }
 
-// GetFutureGoodEdbChartEdbMapping       商品曲线图查询对应的商品指标
 func GetFutureGoodEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
 	o := global.DmSQL["data"]
 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
@@ -46,7 +43,6 @@ func GetFutureGoodEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping
 	return
 }
 
-// GetFutureGoodEdbChartEdbMappingList       商品曲线图查询对应的商品指标
 func GetFutureGoodEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
 	o := global.DmSQL["data"]
 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
@@ -59,7 +55,6 @@ func GetFutureGoodEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfo
 	return
 }
 
-// GetChartEdbMappingByEdbInfoId 根据指标id获取edb_mapping
 func GetChartEdbMappingByEdbInfoId(edbInfoId int) (item *ChartEdbInfoMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT edb_info_id,source_name,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
@@ -69,7 +64,6 @@ func GetChartEdbMappingByEdbInfoId(edbInfoId int) (item *ChartEdbInfoMapping, er
 	return
 }
 
-// GetChartEdbMappingListByEdbInfoIdList 根据指标id列表获取关联关系
 func GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (list []*ChartEdbInfoMapping, err error) {
 	num := len(edbIdList)
 	if num <= 0 {
@@ -90,81 +84,10 @@ func GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (list []*ChartEdbInf
 	return
 }
 
-// func GetEtaEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-
-// 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
-// 	sql := ` SELECT ` + aField + `,b.source_name,b.source,b.sub_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 a.chart_info_id=? AND a.source = ?
-//              ORDER BY chart_edb_mapping_id ASC `
-// 	err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_DEFAULT).QueryRow(&item)
-// 	return
-// }
-
-// // GetEtaEdbChartEdbMappingList       商品曲线图查询对应的普通指标
-// func GetEtaEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
-
-// 	sql := ` SELECT ` + aField + `,b.source_name,b.source,b.sub_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,b.classify_id,b.is_join_permission
-//              FROM chart_edb_mapping AS a
-// 			 INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
-// 			 WHERE a.chart_info_id=? AND a.source = ?
-//              ORDER BY chart_edb_mapping_id ASC `
-// 	_, err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_DEFAULT).QueryRows(&items)
-// 	return
-// }
-
-// // GetFutureGoodEdbChartEdbMapping       商品曲线图查询对应的商品指标
-// func GetFutureGoodEdbChartEdbMapping(chartInfoId int) (item *ChartEdbInfoMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
-// 	sql := ` SELECT ` + aField + `,b.future_good_edb_info_id,b.future_good_edb_code as edb_code,b.future_good_edb_name as edb_name,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value
-//              FROM chart_edb_mapping AS a
-// 			 INNER JOIN future_good_edb_info AS b ON a.edb_info_id=b.future_good_edb_info_id
-// 			 WHERE a.chart_info_id=? AND a.source = ?
-//              ORDER BY chart_edb_mapping_id ASC `
-// 	err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_FUTURE_GOOD).QueryRow(&item)
-// 	return
-// }
-
-// // GetFutureGoodEdbChartEdbMappingList       商品曲线图查询对应的商品指标
-// func GetFutureGoodEdbChartEdbMappingList(chartInfoId int) (items []*ChartEdbInfoMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	aField := `a.chart_edb_mapping_id,a.chart_info_id,a.edb_info_id,a.create_time,a.modify_time,a.unique_code,a.max_data,a.min_data,a.is_order,a.is_axis,a.edb_info_type,a.lead_value,a.lead_unit,a.chart_style,a.chart_color,a.predict_chart_color,a.chart_width,a.source as mapping_source`
-// 	sql := ` SELECT ` + aField + `,b.future_good_edb_info_id,b.future_good_edb_code as edb_code,b.future_good_edb_name as edb_name,b.start_date,b.end_date,b.modify_time,b.latest_date,b.latest_value
-//              FROM chart_edb_mapping AS a
-// 			 INNER JOIN future_good_edb_info AS b ON a.edb_info_id=b.future_good_edb_info_id
-// 			 WHERE a.chart_info_id=? AND a.source = ?
-//              ORDER BY chart_edb_mapping_id ASC `
-// 	_, err = o.Raw(sql, chartInfoId, utils.CHART_SOURCE_FUTURE_GOOD).QueryRows(&items)
-// 	return
-// }
-
-// // GetChartEdbMappingByEdbInfoId 根据指标id获取edb_mapping
-// func GetChartEdbMappingByEdbInfoId(edbInfoId int) (item *ChartEdbInfoMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT edb_info_id,source_name,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
-//              FROM edb_info
-// 			 WHERE edb_info_id = ? limit 1`
-// 	err = o.Raw(sql, edbInfoId).QueryRow(&item)
-// 	return
-// }
-
-// // GetChartEdbMappingListByEdbInfoIdList 根据指标id列表获取关联关系
-// func GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (list []*ChartEdbInfoMapping, err error) {
-// 	num := len(edbIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT edb_info_id,source_name,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,edb_type
-//              FROM edb_info
-// 			 WHERE edb_info_id IN(` + utils.GetOrmInReplace(num) + `)
-// 			ORDER BY FIELD(edb_info_id,` + utils.GetOrmInReplace(num) + `)
-//               `
-// 	_, err = o.Raw(sql, edbIdList, edbIdList).QueryRows(&list)
-// 	return
-// }
+
+
+
+
+
+
+

+ 0 - 1
models/chart_info_range_analysis.go

@@ -86,7 +86,6 @@ type ChartRangeAnalysisDateDataItem struct {
 	DataList  []*EdbDataList
 }
 
-// ChartRangeAnalysisConfigEdbResp 指标列表
 type ChartRangeAnalysisConfigEdbResp struct {
 	EdbInfoList []*ChartRangeAnalysisConfigEdbItem `description:"指标列表"`
 }

+ 10 - 269
models/chart_series.go

@@ -8,23 +8,6 @@ import (
 	"time"
 )
 
-//	type ChartSeries struct {
-//		ChartSeriesId int       `orm:"column(chart_series_id);pk"`
-//		SeriesName    string    `description:"系列名称"`
-//		SeriesNameEn  string    `description:"系列英文名称"`
-//		ChartInfoId   int       `description:"图表ID"`
-//		ChartStyle    string    `description:"图表类型"`
-//		ChartColor    string    `description:"颜色"`
-//		ChartWidth    int       `description:"线条大小"`
-//		IsPoint       int       `description:"是否用数据点展示(0 否,1是)"`
-//		IsNumber      int       `description:"是否用数值展示(0 否,1是)"`
-//		IsAxis        int       `description:"1:左轴,0:右轴"`
-//		MaxData       float64   `description:"上限"`
-//		MinData       float64   `description:"下限"`
-//		IsOrder       bool      `description:"true:正序,false:逆序"`
-//		CreateTime    time.Time `description:"创建时间"`
-//		ModifyTime    time.Time `description:"修改时间"`
-//	}
 type ChartSeries struct {
 	ChartSeriesId int       `gorm:"column:chart_series_id;primaryKey" description:"系列ID" orm:"column(chart_series_id);pk"`
 	SeriesName    string    `gorm:"column:series_name" description:"系列名称"`
@@ -54,7 +37,6 @@ func GetChartSeriesByChartInfoId(chartInfoId int) (items []*ChartSeries, err err
 	return
 }
 
-// EditChartSeriesAndEdbMapping
 func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err error) {
 	o := global.DmSQL["data"]
 	to := o.Begin()
@@ -66,12 +48,10 @@ func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err e
 		}
 	}()
 
-	// 获取已经存在的系列
 	series, err := GetChartSeriesByChartInfoId(chartInfoId)
 	if err != nil {
 		return
 	}
-	//整理成系列map
 	seriesMap := make(map[int]struct{})
 	seriesDeleteMap := make(map[int]struct{})
 	for _, v := range series {
@@ -85,7 +65,6 @@ func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err e
 		return
 	}
 
-	// 删除所有的指标映射
 	err = o.Exec("DELETE FROM chart_series_edb_mapping WHERE chart_info_id = ?", chartInfoId).Error
 	if err != nil {
 		return
@@ -114,7 +93,6 @@ func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err e
 				err = fmt.Errorf("系列ID错误")
 				return
 			}
-			//新增
 			tmp.CreateTime = time.Now()
 			e := to.Create(tmp).Error
 			if e != nil {
@@ -123,7 +101,6 @@ func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err e
 			}
 			seriesId = int(tmp.ChartSeriesId)
 		} else {
-			//编辑
 			delete(seriesDeleteMap, v.ChartSeriesId)
 			e := to.Model(tmp).Select("*").Updates(tmp).Error
 			if e != nil {
@@ -144,8 +121,6 @@ func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err e
 				ChartSeriesId: seriesId,    //todo 系列ID
 				ChartInfoId:   chartInfoId, //todo 表图ID
 				EdbInfoId:     edbItem.EdbInfoId,
-				//EdbAliasName:            "",
-				//EdbAliasNameEn:          "",
 				DateConfName: edbItem.DateConfName,
 				DateConf:     dateConfStr,
 				DateConfType: edbItem.DateConfType,
@@ -162,7 +137,6 @@ func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err e
 			}
 		}
 	}
-	//删除旧的系列和ID
 	seriesIds := make([]int, 0)
 	for id, _ := range seriesDeleteMap {
 		seriesIds = append(seriesIds, id)
@@ -238,8 +212,6 @@ func AddChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err er
 				ChartSeriesId: seriesId,    //todo 系列ID
 				ChartInfoId:   chartInfoId, //todo 表图ID
 				EdbInfoId:     edbItem.EdbInfoId,
-				//EdbAliasName:            "",
-				//EdbAliasNameEn:          "",
 				DateConfName: edbItem.DateConfName,
 				DateConfType: edbItem.DateConfType,
 				DateConf:     dateConfStr,
@@ -280,247 +252,16 @@ func DeleteChartSeriesAndEdbMapping(chartInfoId int) (err error) {
 	return
 }
 
-// func GetChartSeriesByChartInfoId(chartInfoId int) (items []*ChartSeries, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := "SELECT * FROM chart_series WHERE chart_info_id = ?"
-// 	_, err = o.Raw(sql, chartInfoId).QueryRows(&items)
-// 	return
-// }
-
-// // EditChartSeriesAndEdbMapping
-// func EditChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	to, err := o.Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = to.Rollback()
-// 		} else {
-// 			_ = to.Commit()
-// 		}
-// 	}()
-
-// 	// 获取已经存在的系列
-// 	series, err := GetChartSeriesByChartInfoId(chartInfoId)
-// 	if err != nil {
-// 		return
-// 	}
-// 	//整理成系列map
-// 	seriesMap := make(map[int]struct{})
-// 	seriesDeleteMap := make(map[int]struct{})
-// 	for _, v := range series {
-// 		seriesMap[v.ChartSeriesId] = struct{}{}
-// 		seriesDeleteMap[v.ChartSeriesId] = struct{}{}
-// 	}
-// 	var sectionExtraConfig ChartSectionAllExtraConf
-// 	err = json.Unmarshal([]byte(extraConfigStr), &sectionExtraConfig)
-// 	if err != nil {
-// 		err = fmt.Errorf("截面组合图配置异常")
-// 		return
-// 	}
-
-// 	// 删除所有的指标映射
-// 	_, err = o.Raw("DELETE FROM chart_series_edb_mapping WHERE chart_info_id = ?", chartInfoId).Exec()
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	seriesList := sectionExtraConfig.SeriesList
-// 	for _, v := range seriesList {
-// 		seriesId := v.ChartSeriesId
-// 		tmp := &ChartSeries{
-// 			ChartSeriesId: v.ChartSeriesId,
-// 			SeriesName:    v.SeriesName,
-// 			SeriesNameEn:  v.SeriesNameEn,
-// 			ChartInfoId:   chartInfoId,
-// 			ChartStyle:    v.ChartStyle,
-// 			ChartColor:    v.ChartColor,
-// 			ChartWidth:    v.ChartWidth,
-// 			IsPoint:       v.IsPoint,
-// 			IsNumber:      v.IsNumber,
-// 			IsAxis:        v.IsAxis,
-// 			MaxData:       v.MaxData,
-// 			MinData:       v.MinData,
-// 			ModifyTime:    time.Now(),
-// 		}
-// 		if _, ok := seriesMap[v.ChartSeriesId]; !ok {
-// 			if seriesId > 0 {
-// 				err = fmt.Errorf("系列ID错误")
-// 				return
-// 			}
-// 			//新增
-// 			tmp.CreateTime = time.Now()
-// 			seriesIdTmp, e := to.Insert(tmp)
-// 			if e != nil {
-// 				err = fmt.Errorf("AddChartSeries Err:" + e.Error())
-// 				return
-// 			}
-// 			seriesId = int(seriesIdTmp)
-// 		} else {
-// 			//编辑
-// 			delete(seriesDeleteMap, v.ChartSeriesId)
-// 			_, e := to.Update(tmp)
-// 			if e != nil {
-// 				err = fmt.Errorf("UpdateChartSeries Err:" + e.Error())
-// 				return
-// 			}
-// 		}
-
-// 		addSeriesEdbList := make([]*ChartSeriesEdbMapping, 0)
-// 		for _, edbItem := range v.EdbInfoList {
-// 			dateConfStrByte, e := json.Marshal(edbItem.DateConf)
-// 			if e != nil {
-// 				err = e
-// 				return
-// 			}
-// 			dateConfStr := string(dateConfStrByte)
-// 			edbTmp := &ChartSeriesEdbMapping{
-// 				ChartSeriesId: seriesId,    //todo 系列ID
-// 				ChartInfoId:   chartInfoId, //todo 表图ID
-// 				EdbInfoId:     edbItem.EdbInfoId,
-// 				//EdbAliasName:            "",
-// 				//EdbAliasNameEn:          "",
-// 				DateConfName: edbItem.DateConfName,
-// 				DateConf:     dateConfStr,
-// 				DateConfType: edbItem.DateConfType,
-// 				CreateTime:   time.Now(),
-// 				ModifyTime:   time.Now(),
-// 			}
-// 			addSeriesEdbList = append(addSeriesEdbList, edbTmp)
-// 		}
-// 		if len(addSeriesEdbList) > 0 {
-// 			_, err = to.InsertMulti(len(addSeriesEdbList), addSeriesEdbList)
-// 			if err != nil {
-// 				err = fmt.Errorf("AddChartSeries Err:" + err.Error())
-// 				return
-// 			}
-// 		}
-// 	}
-// 	//删除旧的系列和ID
-// 	seriesIds := make([]int, 0)
-// 	for id, _ := range seriesDeleteMap {
-// 		seriesIds = append(seriesIds, id)
-// 	}
-// 	if len(seriesIds) > 0 {
-// 		sql := `DELETE FROM chart_series WHERE chart_series_id IN (` + utils.GetOrmInReplace(len(seriesIds)) + `) and chart_info_id=?`
-// 		_, err = to.Raw(sql, seriesIds, chartInfoId).Exec()
-// 		if err != nil {
-// 			err = fmt.Errorf("删除系列失败 Err:" + err.Error())
-// 			return
-// 		}
-// 		sql = `DELETE FROM chart_series_edb_mapping WHERE chart_series_id IN (` + utils.GetOrmInReplace(len(seriesIds)) + `) and chart_info_id=?`
-// 		_, err = to.Raw(sql, seriesIds, chartInfoId).Exec()
-// 		if err != nil {
-// 			err = fmt.Errorf("删除系列指标 Err:" + err.Error())
-// 			return
-// 		}
-// 	}
-
-// 	return
-// }
-
-// func AddChartSeriesAndEdbMapping(extraConfigStr string, chartInfoId int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	to, err := o.Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = to.Rollback()
-// 		} else {
-// 			_ = to.Commit()
-// 		}
-// 	}()
-
-// 	var sectionExtraConfig ChartSectionAllExtraConf
-// 	err = json.Unmarshal([]byte(extraConfigStr), &sectionExtraConfig)
-// 	if err != nil {
-// 		err = fmt.Errorf("截面组合图配置异常")
-// 		return
-// 	}
-// 	seriesList := sectionExtraConfig.SeriesList
-// 	for _, v := range seriesList {
-// 		tmp := &ChartSeries{
-// 			SeriesName:   v.SeriesName,
-// 			SeriesNameEn: v.SeriesNameEn,
-// 			ChartInfoId:  chartInfoId,
-// 			ChartStyle:   v.ChartStyle,
-// 			ChartColor:   v.ChartColor,
-// 			ChartWidth:   v.ChartWidth,
-// 			IsPoint:      v.IsPoint,
-// 			IsNumber:     v.IsNumber,
-// 			IsAxis:       v.IsAxis,
-// 			MaxData:      v.MaxData,
-// 			MinData:      v.MinData,
-// 			IsOrder:      false, //todo 是否排序
-// 			CreateTime:   time.Now(),
-// 			ModifyTime:   time.Now(),
-// 		}
-// 		seriesIdTmp, e := to.Insert(tmp)
-// 		if e != nil {
-// 			err = fmt.Errorf("AddChartSeries Err:" + e.Error())
-// 			return
-// 		}
-// 		seriesId := int(seriesIdTmp)
-// 		addSeriesEdbList := make([]*ChartSeriesEdbMapping, 0)
-// 		for _, edbItem := range v.EdbInfoList {
-// 			dateConfStrByte, e := json.Marshal(edbItem.DateConf)
-// 			if e != nil {
-// 				err = e
-// 				return
-// 			}
-// 			dateConfStr := string(dateConfStrByte)
-// 			edbTmp := &ChartSeriesEdbMapping{
-// 				ChartSeriesId: seriesId,    //todo 系列ID
-// 				ChartInfoId:   chartInfoId, //todo 表图ID
-// 				EdbInfoId:     edbItem.EdbInfoId,
-// 				//EdbAliasName:            "",
-// 				//EdbAliasNameEn:          "",
-// 				DateConfName: edbItem.DateConfName,
-// 				DateConfType: edbItem.DateConfType,
-// 				DateConf:     dateConfStr,
-// 				CreateTime:   time.Now(),
-// 				ModifyTime:   time.Now(),
-// 			}
-// 			addSeriesEdbList = append(addSeriesEdbList, edbTmp)
-// 		}
-// 		if len(addSeriesEdbList) > 0 {
-// 			_, e = to.InsertMulti(len(addSeriesEdbList), addSeriesEdbList)
-// 			if e != nil {
-// 				err = fmt.Errorf("AddChartSeries Err:" + e.Error())
-// 				return
-// 			}
-// 		}
-// 	}
-// 	return
-// }
-
-// func DeleteChartSeriesAndEdbMapping(chartInfoId int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	to, err := o.Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = to.Rollback()
-// 		} else {
-// 			_ = to.Commit()
-// 		}
-// 	}()
-
-// 	sql := ` DELETE FROM chart_series WHERE chart_info_id=? `
-// 	_, err = to.Raw(sql, chartInfoId).Exec()
-// 	if err != nil {
-// 		return
-// 	}
-// 	sql = ` DELETE FROM  chart_series_edb_mapping WHERE chart_info_id=? `
-// 	_, err = to.Raw(sql, chartInfoId).Exec()
-// 	return
-// }
+
+
+
+
+
+
+
+
+
+
 
 type ChartSectionSeriesValSortAsc []ChartSectionSeriesValSort
 type ChartSectionSeriesValSortDesc []ChartSectionSeriesValSort

+ 0 - 17
models/chart_series_edb_mapping.go

@@ -5,17 +5,6 @@ import (
 	"time"
 )
 
-//	type ChartSeriesEdbMapping struct {
-//		ChartSeriesEdbMappingId int       `orm:"column(chart_series_edb_mapping_id);pk"`
-//		ChartSeriesId           int       `description:"系列ID"`
-//		ChartInfoId             int       `description:"图表ID"`
-//		EdbInfoId               int       `description:"指标id"`
-//		DateConfName            string    `description:"引用日期配置名称"`
-//		DateConfType            int       `description:"日期类型,0指标最新日期, 1引用日期"`
-//		DateConf                string    `description:"日期配置名称"`
-//		ModifyTime              time.Time `description:"修改时间"`
-//		CreateTime              time.Time `description:"创建时间"`
-//	}
 type ChartSeriesEdbMapping struct {
 	ChartSeriesEdbMappingId int       `gorm:"column:chart_series_edb_mapping_id;primaryKey" description:"系列指标映射ID" orm:"column(chart_series_edb_mapping_id);pk"`
 	ChartSeriesId           int       `gorm:"column:chart_series_id" description:"系列ID"`
@@ -39,9 +28,3 @@ func GetChartSeriesEdbByChartInfoId(chartInfoId int) (items []*ChartSeriesEdbMap
 	return
 }
 
-// func GetChartSeriesEdbByChartInfoId(chartInfoId int) (items []*ChartSeriesEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := "SELECT * FROM chart_series_edb_mapping WHERE chart_info_id = ?"
-// 	_, err = o.Raw(sql, chartInfoId).QueryRows(&items)
-// 	return
-// }

+ 0 - 71
models/data_manage/chart_info.go

@@ -2,47 +2,6 @@ package data_manage
 
 import "eta_gn/eta_chart_lib/global"
 
-//	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:"是否空数据"`
-//	}
 type ChartEdbInfoMapping struct {
 	EdbInfoId           int         `gorm:"column:edb_info_id" description:"指标id"`
 	SourceName          string      `gorm:"column:source_name" description:"来源名称"`
@@ -96,18 +55,7 @@ func GetChartEdbMappingList(chartInfoId int) (list []*ChartEdbInfoMapping, err e
 	return
 }
 
-// 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:"日期配置"`
@@ -121,14 +69,12 @@ type FutureGoodBarChartInfoReq struct {
 	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:"别名"`
@@ -137,7 +83,6 @@ type BarChartInfoEdbItemReq struct {
 	IsHide    int    `description:"是否隐藏该项,0不隐藏,1隐藏"`
 }
 
-// BarChartInfoDateReq 柱方图预览请求数据(日期相关)
 type BarChartInfoDateReq struct {
 	Type  int    `description:"配置类型"`
 	Date  string `description:"固定日期"`
@@ -146,13 +91,11 @@ type BarChartInfoDateReq struct {
 	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轴名称(英文)"`
@@ -166,11 +109,9 @@ type SectionScatterReq struct {
 	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:"系列名(英文)"`
@@ -181,7 +122,6 @@ type SectionScatterSeriesItemReq struct {
 	ShowRSquare     bool `description:"是否展示R平方"`
 }
 
-// SectionScatterEdbItemReq 截面散点请求的指标
 type SectionScatterEdbItemReq struct {
 	XEdbInfoId int    `description:"X轴的指标ID"`
 	YEdbInfoId int    `description:"Y轴的指标ID"`
@@ -196,7 +136,6 @@ type SectionScatterEdbItemReq struct {
 	IsShow     bool   `description:"是否展示"`
 }
 
-// SectionScatterInfoResp 截面散点图数据
 type SectionScatterInfoResp struct {
 	XName       string                         `description:"x轴名称"`
 	XNameEn     string                         `description:"x轴名称(英文)"`
@@ -213,7 +152,6 @@ type SectionScatterInfoResp struct {
 	DataList    []SectionScatterSeriesItemResp `description:"数据列"`
 }
 
-// SectionScatterSeriesItemResp 系列的返回
 type SectionScatterSeriesItemResp struct {
 	Name            string `description:"系列名"`
 	NameEn          string `description:"系列名(英文)"`
@@ -227,7 +165,6 @@ type SectionScatterSeriesItemResp struct {
 	TrendLimitData  []CoordinatePoint `description:"趋势线的前后坐标点"`
 }
 
-// SectionScatterEdbItemResp 截面散点的返回参数
 type SectionScatterEdbItemResp struct {
 	XEdbInfoId int     `description:"X轴指标id"`
 	XDate      string  `description:"X轴指标实际日期"`
@@ -244,26 +181,20 @@ type SectionScatterEdbItemResp struct {
 	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:"固定日期"`
@@ -272,13 +203,11 @@ type RadarChartInfoDateReq struct {
 	Name  string `description:"别名"`
 }
 
-// RadarChartInfoResp 雷达图数据
 type RadarChartInfoResp struct {
 	YDataList   []RadarYData `description:"数据列"`
 	XEdbIdValue []int
 }
 
-// RadarYData 雷达图的y轴数据
 type RadarYData struct {
 	Date  string    `description:"数据日期"`
 	Color string    `description:"数据颜色"`

+ 6 - 86
models/data_manage/chart_info_correlation.go

@@ -7,27 +7,6 @@ import (
 	"time"
 )
 
-// ChartInfoCorrelation 相关性图表-扩展信息
-//
-//	type ChartInfoCorrelation struct {
-//		CorrelationChartInfoId int       `orm:"column(correlation_chart_info_id);pk" description:"相关性图表ID(chart_info表source=3的)"`
-//		LeadValue              int       `description:"领先值"`
-//		LeadUnit               string    `description:"领先单位"`
-//		CalculateValue         int       `description:"计算窗口"`
-//		CalculateUnit          string    `description:"计算频度"`
-//		BaseCalculateValue     int       `description:"基础计算窗口(滚动相关性的时候用到)"`
-//		BaseCalculateUnit      string    `description:"基础计算频度(滚动相关性的时候用到)"`
-//		DateType               int       `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间,6:起始日期至今"`
-//		StartDate              time.Time `description:"开始日期"`
-//		EndDate                time.Time `description:"结束日期"`
-//		EdbInfoIdFirst         int       `description:"A指标ID"`
-//		EdbInfoIdSecond        int       `description:"B指标ID"`
-//		PeriodData             string    `description:"X轴-期数数据"`
-//		CorrelationData        string    `description:"Y轴-相关性系数"`
-//		CreateTime             time.Time `description:"创建时间"`
-//		ModifyTime             time.Time `description:"更新时间"`
-//		AnalysisMode           int       `description:"分析模式: 0-单因子; 1-多因子"`
-//	}
 type ChartInfoCorrelation struct {
 	CorrelationChartInfoId int       `gorm:"column:correlation_chart_info_id;primaryKey" description:"相关性图表ID(chart_info表source=3的)" orm:"column(correlation_chart_info_id);pk"`
 	LeadValue              int       `gorm:"column:lead_value" description:"领先值"`
@@ -58,7 +37,6 @@ func (m *ChartInfoCorrelation) Create() (err error) {
 	if err != nil {
 		return
 	}
-	//m.CorrelationChartInfoId = int(id)
 	return
 }
 
@@ -104,67 +82,12 @@ func (m *ChartInfoCorrelation) GetItemsByCondition(condition string, pars []inte
 	return
 }
 
-// func (m *ChartInfoCorrelation) Create() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	//m.CorrelationChartInfoId = int(id)
-// 	return
-// }
-
-// func (m *ChartInfoCorrelation) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// func (m *ChartInfoCorrelation) Delete() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE correlation_chart_info_id = ? LIMIT 1`, m.TableName())
-// 	_, err = o.Raw(sql, m.CorrelationChartInfoId).Exec()
-// 	return
-// }
-
-// func (m *ChartInfoCorrelation) GetItemById(id int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE correlation_chart_info_id = ? LIMIT 1`, m.TableName())
-// 	err = o.Raw(sql, id).QueryRow(&m)
-// 	return
-// }
-
-// func (m *ChartInfoCorrelation) GetItemByCondition(condition string, pars []interface{}) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s LIMIT 1`, m.TableName(), condition)
-// 	err = o.Raw(sql, pars).QueryRow(&m)
-// 	return
-// }
-
-// func (m *ChartInfoCorrelation) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*ChartInfoCorrelation, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := ``
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
-
-// FactorCorrelationConfig 因子指标系列-相关性配置
-//
-//	type FactorCorrelationConfig struct {
-//		LeadValue      int                       `description:"领先期数"`
-//		LeadUnit       string                    `description:"频度"`
-//		CalculateValue int                       `description:"计算窗口"`
-//		CalculateUnit  string                    `description:"计算频度"`
-//		SeriesEdb      []CorrelationSeriesEdbReq `description:"关联系列指标"`
-//	}
+
+
+
+
+
+
 type FactorCorrelationConfig struct {
 	LeadValue      int                       `gorm:"column:lead_value" description:"领先期数"`
 	LeadUnit       string                    `gorm:"column:lead_unit" description:"频度"`
@@ -173,7 +96,6 @@ type FactorCorrelationConfig struct {
 	SeriesEdb      []CorrelationSeriesEdbReq `gorm:"column:series_edb" description:"关联系列指标"`
 }
 
-// CorrelationChartLegend 相关性图表图例
 type CorrelationChartLegend struct {
 	LegendName string `description:"图例名称"`
 	Color      string `description:"图例颜色"`
@@ -181,13 +103,11 @@ type CorrelationChartLegend struct {
 	SeriesId   int    `description:"因子指标系列ID"`
 }
 
-// CorrelationSeriesEdbReq 指标系列
 type CorrelationSeriesEdbReq struct {
 	EdbInfoId int `description:"指标ID"`
 	SeriesId  int `description:"因子指标系列ID"`
 }
 
-// CorrelationChartInfoExtraConfig 相关性图表额外设置
 type CorrelationChartInfoExtraConfig struct {
 	LegendConfig []*CorrelationChartLegend `description:"图例设置"`
 }

+ 13 - 193
models/data_manage/chart_theme/chart_theme.go

@@ -6,22 +6,6 @@ import (
 	"time"
 )
 
-// ChartTheme
-// @Description: 图表主题表
-//
-//	type ChartTheme struct {
-//		ChartThemeId     int       `description:"图表主题类型ID" orm:"column(chart_theme_id);pk"`
-//		ChartThemeName   string    `description:"图表主题名称"`
-//		ChartThemeTypeId int       `description:"图表主题类型ID"`
-//		ChartImage       string    `description:"缩略图"`
-//		Config           string    `description:"配置"`
-//		IsDelete         int       `description:"是否删除,0:未删除;1:已删除"`
-//		SysUserId        int       `description:"操作人"`
-//		SysUserRealName  string    `description:"操作人的真实名称"`
-//		IsSystemTheme    int       `description:"是否是系统主题,0:不是;1:是"`
-//		ModifyTime       time.Time `description:"修改时间"`
-//		CreateTime       time.Time `description:"创建时间"`
-//	}
 type ChartTheme struct {
 	ChartThemeId     int       `description:"图表主题类型ID" gorm:"column:chart_theme_id;primaryKey" orm:"column(chart_theme_id);pk"`
 	ChartThemeName   string    `description:"图表主题名称" gorm:"column:chart_theme_name"`
@@ -40,28 +24,8 @@ func (m *ChartTheme) TableName() string {
 	return "chart_theme"
 }
 
-// GetChartThemeId
-// @Description: 根据id获取主题
-// @author: Roc
-// @datetime 2023-12-14 16:05:36
-// @param chartThemeId int
-// @return item *ChartTheme
-// @return err error
-// func GetChartThemeId(chartThemeId int) (item *ChartTheme, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme where chart_theme_id = ? AND is_delete = 0`
-// 	err = o.Raw(sql, chartThemeId).QueryRow(&item)
-
-// 	return
-// }
-
-// GetChartThemeId
-// @Description: 根据id获取主题
-// @author: zqbao
-// @datetime 2023-12-14 16:05:36
-// @param chartThemeId int
-// @return item *ChartTheme
-// @return err error
+
+
 func GetChartThemeId(chartThemeId int) (item *ChartTheme, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_theme where chart_theme_id = ? AND is_delete = 0`
@@ -69,35 +33,8 @@ func GetChartThemeId(chartThemeId int) (item *ChartTheme, err error) {
 	return
 }
 
-// Add
-// @Description: 添加
-// @author: Roc
-// @receiver m
-// @datetime 2023-12-14 16:11:10
-// @param cols []string
-// @return err error
-// func (m *ChartTheme) Add() (err error) {
-// 	if m.ChartThemeId > 0 {
-// 		err = errors.New("该配置已存在")
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err := o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	m.ChartThemeId = int(lastId)
-
-// 	return
-// }
-
-// Add
-// @Description: 添加
-// @author: zqbao
-// @receiver m
-// @datetime 2023-12-14 16:11:10
-// @param cols []string
-// @return err error
+
+
 func (m *ChartTheme) Add() (err error) {
 	if m.ChartThemeId > 0 {
 		err = errors.New("该配置已存在")
@@ -111,52 +48,15 @@ func (m *ChartTheme) Add() (err error) {
 	return
 }
 
-// Update
-// @Description: 更新
-// @author: Roc
-// @receiver m
-// @datetime 2023-12-14 16:11:10
-// @param cols []string
-// @return err error
-// func (m *ChartTheme) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// Update
-// @Description: 更新
-// @author: zqbao
-// @receiver m
-// @datetime 2023-12-14 16:11:10
-// @param cols []string
-// @return err error
+
 func (m *ChartTheme) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(m).Select(cols).Updates(m).Error
 	return
 }
 
-// GetChartThemeListByTypeId
-// @Description: 根据图表类型获取关联的图表主题列表
-// @author: Roc
-// @datetime 2023-12-13 17:39:48
-// @return list []*ChartTheme
-// @return err error
-// func GetChartThemeListByTypeId(chartThemeTypeId int) (list []*ChartTheme, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme WHERE chart_theme_type_id = ? AND  is_delete=0 ORDER BY chart_theme_id ASC `
-// 	_, err = o.Raw(sql, chartThemeTypeId).QueryRows(&list)
-
-// 	return
-// }
-
-// GetChartThemeListByTypeId
-// @Description: 根据图表类型获取关联的图表主题列表
-// @author: zqbao
-// @datetime 2023-12-13 17:39:48
-// @return list []*ChartTheme
-// @return err error
+
+
 func GetChartThemeListByTypeId(chartThemeTypeId int) (list []*ChartTheme, err error) {
 	o := global.DmSQL["data"]
 
@@ -165,26 +65,8 @@ func GetChartThemeListByTypeId(chartThemeTypeId int) (list []*ChartTheme, err er
 	return
 }
 
-// GetAllChartThemeList
-// @Description: 获取所有图表主题列表
-// @author: Roc
-// @datetime 2023-12-13 17:39:48
-// @return list []*ChartTheme
-// @return err error
-// func GetAllChartThemeList() (list []*ChartTheme, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme WHERE  is_delete=0 ORDER BY chart_theme_id ASC `
-// 	_, err = o.Raw(sql).QueryRows(&list)
-
-// 	return
-// }
-
-// GetAllChartThemeList
-// @Description: 获取所有图表主题列表
-// @author: zqbao
-// @datetime 2023-12-13 17:39:48
-// @return list []*ChartTheme
-// @return err error
+
+
 func GetAllChartThemeList() (list []*ChartTheme, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_theme WHERE  is_delete=0 ORDER BY chart_theme_id ASC `
@@ -192,30 +74,12 @@ func GetAllChartThemeList() (list []*ChartTheme, err error) {
 	return
 }
 
-// ChartThemeItem
-// @Description: 图表主题配置
-//
-//	type ChartThemeItem struct {
-//		ChartThemeId     int    `description:"图表主题类型ID" orm:"column(chart_theme_id);pk"`
-//		ChartThemeName   string `description:"图表主题名称"`
-//		ChartThemeTypeId int    `description:"图表主题类型ID"`
-//		Config           string `description:"配置"`
-//		ChartImage       string `description:"缩略图"`
-//		//IsDelete            int       `description:"是否删除,0:未删除;1:已删除"`
-//		IsSystemTheme       int       `description:"是否是系统主题,0:不是;1:是"`
-//		SysUserId           int       `description:"操作人"`
-//		SysUserRealName     string    `description:"操作人的真实名称"`
-//		ModifyTime          time.Time `description:"修改时间"`
-//		CreateTime          time.Time `description:"创建时间"`
-//		DefaultChartThemeId int       `description:"默认使用的图表主题ID"`
-//	}
 type ChartThemeItem struct {
 	ChartThemeId     int    `description:"图表主题类型ID" gorm:"column:chart_theme_id;primaryKey" orm:"column(chart_theme_id);pk"`
 	ChartThemeName   string `description:"图表主题名称" gorm:"column:chart_theme_name"`
 	ChartThemeTypeId int    `description:"图表Theme类型ID" gorm:"column:chart_theme_type_id"`
 	Config           string `description:"配置" gorm:"column:config"`
 	ChartImage       string `description:"缩略图" gorm:"column:chart_image"`
-	//IsDelete           int       `description:"是否删除,0:未删除;1:已删除"`
 	IsSystemTheme       int       `description:"是否是系统主题,0:不是;1:是" gorm:"column:is_system_theme"`
 	SysUserId           int       `description:"操作人" gorm:"column:sys_user_id"`
 	SysUserRealName     string    `description:"操作人的真实名称" gorm:"column:sys_user_real_name"`
@@ -224,35 +88,12 @@ type ChartThemeItem struct {
 	DefaultChartThemeId int       `description:"默认使用的图表主题ID" gorm:"column:default_chart_theme_id"`
 }
 
-// TableName 设置模型对应的表名
 func (ChartThemeItem) TableName() string {
 	return "chart_theme_item"
 }
 
-// GetChartThemeItemList
-// @Description: 根据图表类型id获取配置列表
-// @author: Roc
-// @datetime 2023-12-14 14:26:35
-// @param chartThemeTypeId int
-// @return list []*ChartThemeConfig
-// @return err error
-// func GetChartThemeItemList(chartThemeTypeId int) (list []*ChartThemeItem, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT a.*,b.default_chart_theme_id FROM chart_theme a
-//          JOIN chart_theme_type b on a.chart_theme_type_id =b.chart_theme_type_id
-//          WHERE a.chart_theme_type_id = ? AND a.is_delete=0 ORDER BY a.chart_theme_id ASC `
-// 	_, err = o.Raw(sql, chartThemeTypeId).QueryRows(&list)
-
-// 	return
-// }
-
-// GetChartThemeItemList
-// @Description: 根据图表类型id获取配置列表
-// @author: zqbao
-// @datetime 2023-12-14 14:26:35
-// @param chartThemeTypeId int
-// @return list []*ChartThemeConfig
-// @return err error
+
+
 func GetChartThemeItemList(chartThemeTypeId int) (list []*ChartThemeItem, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT a.*,b.default_chart_theme_id FROM chart_theme a 
@@ -262,29 +103,8 @@ func GetChartThemeItemList(chartThemeTypeId int) (list []*ChartThemeItem, err er
 	return
 }
 
-// GetSystemChartTheme
-// @Description: 根据图表类型id获取系统配置
-// @author: Roc
-// @datetime 2023-12-14 14:26:35
-// @param chartThemeTypeId int
-// @return item *ChartTheme
-// @return err error
-// func GetSystemChartTheme(chartThemeTypeId int) (item *ChartTheme, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT a.* FROM chart_theme a
-//          WHERE a.chart_theme_type_id = ? AND a.is_system_theme=1 ORDER BY a.chart_theme_id ASC `
-// 	err = o.Raw(sql, chartThemeTypeId).QueryRow(&item)
-
-// 	return
-// }
-
-// GetSystemChartTheme
-// @Description: 根据图表类型id获取系统配置
-// @author: Roc
-// @datetime 2023-12-14 14:26:35
-// @param chartThemeTypeId int
-// @return item *ChartTheme
-// @return err error
+
+
 func GetSystemChartTheme(chartThemeTypeId int) (item *ChartTheme, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT a.* FROM chart_theme a

+ 9 - 109
models/data_manage/chart_theme/chart_theme_type.go

@@ -5,8 +5,6 @@ import (
 	"time"
 )
 
-// ChartThemeType
-// @Description: 图表主题类型表
 type ChartThemeType struct {
 	ChartThemeTypeId    int       `description:"图表主题类型ID" orm:"column(chart_theme_type_id);pk" gorm:"column:chart_theme_type_id;primaryKey"`
 	ChartTypeName       string    `description:"类型名称" gorm:"column:chart_type_name"`
@@ -17,57 +15,19 @@ type ChartThemeType struct {
 	CreateTime          time.Time `description:"创建时间" gorm:"column:create_time"`
 }
 
-// TableName 设置模型对应的表名
 func (ChartThemeType) TableName() string {
 	return "chart_theme_type"
 }
 
-// Update
-// @Description: 更新
-// @author: Roc
-// @receiver m
-// @datetime 2023-12-14 16:11:10
-// @param cols []string
-// @return err error
-// func (m *ChartThemeType) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// Update
-// @Description: 更新
-// @author: zqbao
-// @receiver m
-// @datetime 2023-12-14 16:11:10
-// @param cols []string
-// @return err error
+
 func (m *ChartThemeType) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(m).Select(cols).Updates(m).Error
 	return
 }
 
-// GetAllChartThemeTypeList
-// @Description: 获取所有图表主题类型列表
-// @author: Roc
-// @datetime 2023-12-13 17:31:03
-// @return list []*ChartThemeType
-// @return err error
-// func GetAllChartThemeTypeList() (list []*ChartThemeType, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme_type ORDER BY chart_theme_type_id ASC `
-// 	_, err = o.Raw(sql).QueryRows(&list)
-
-// 	return
-// }
-
-// GetAllChartThemeTypeList
-// @Description: 获取所有图表主题类型列表
-// @author: zqbao
-// @datetime 2024-9-21 17:31:03
-// @return list []*ChartThemeType
-// @return err error
+
+
 func GetAllChartThemeTypeList() (list []*ChartThemeType, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_theme_type ORDER BY chart_theme_type_id ASC `
@@ -75,28 +35,8 @@ func GetAllChartThemeTypeList() (list []*ChartThemeType, err error) {
 	return
 }
 
-// GetChartThemeTypeListBySource
-// @Description: 根据来源获取图表主题类型列表
-// @author: Roc
-// @datetime 2023-12-13 17:31:03
-// @param source int
-// @return list []*ChartThemeType
-// @return err error
-// func GetChartThemeTypeListBySource(source int) (list []*ChartThemeType, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme_type WHERE chart_source = ?  ORDER BY chart_theme_type_id ASC `
-// 	_, err = o.Raw(sql, source).QueryRows(&list)
-
-// 	return
-// }
-
-// GetChartThemeTypeListBySource
-// @Description: 根据来源获取图表主题类型列表
-// @author: zqbao
-// @datetime 2023-12-13 17:31:03
-// @param source int
-// @return list []*ChartThemeType
-// @return err error
+
+
 func GetChartThemeTypeListBySource(source int) (list []*ChartThemeType, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_theme_type WHERE chart_source = ?  ORDER BY chart_theme_type_id ASC `
@@ -104,28 +44,8 @@ func GetChartThemeTypeListBySource(source int) (list []*ChartThemeType, err erro
 	return
 }
 
-// GetChartThemeTypeById
-// @Description: 通过类型id获取类型
-// @author: Roc
-// @datetime 2023-12-14 09:53:58
-// @param chartThemeTypeId int
-// @return item *ChartThemeType
-// @return err error
-// func GetChartThemeTypeById(chartThemeTypeId int) (item *ChartThemeType, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme_type where chart_theme_type_id = ? `
-// 	err = o.Raw(sql, chartThemeTypeId).QueryRow(&item)
-
-// 	return
-// }
-
-// GetChartThemeTypeById
-// @Description: 通过类型id获取类型
-// @author: zqbao
-// @datetime 2023-12-14 09:53:58
-// @param chartThemeTypeId int
-// @return item *ChartThemeType
-// @return err error
+
+
 func GetChartThemeTypeById(chartThemeTypeId int) (item *ChartThemeType, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_theme_type where chart_theme_type_id = ? `
@@ -133,28 +53,8 @@ func GetChartThemeTypeById(chartThemeTypeId int) (item *ChartThemeType, err erro
 	return
 }
 
-// GetChartThemeTypeByChartTypeAndSource
-// @Description: 通过图表类型和来源获取类型
-// @author: Roc
-// @datetime 2023-12-14 09:53:58
-// @param chartThemeTypeId int
-// @return item *ChartThemeType
-// @return err error
-// func GetChartThemeTypeByChartTypeAndSource(chartType, source int) (item *ChartThemeType, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_theme_type where chart_type = ? AND chart_source = ? `
-// 	err = o.Raw(sql, chartType, source).QueryRow(&item)
-
-// 	return
-// }
-
-// GetChartThemeTypeByChartTypeAndSource
-// @Description: 通过图表类型和来源获取类型
-// @author: zqbao
-// @datetime 2023-12-14 09:53:58
-// @param chartThemeTypeId int
-// @return item *ChartThemeType
-// @return err error
+
+
 func GetChartThemeTypeByChartTypeAndSource(chartType, source int) (item *ChartThemeType, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_theme_type where chart_type = ? AND chart_source = ? `

+ 0 - 61
models/data_manage/cross_variety/chart_tag.go

@@ -6,8 +6,6 @@ import (
 	"time"
 )
 
-// ChartTag
-// @Description: chart_tag 图表标签表
 type ChartTag struct {
 	ChartTagId      int       `orm:"column(chart_tag_id);pk" gorm:"column:chart_tag_id;primaryKey"`
 	ChartTagName    string    `description:"标签名称" gorm:"column:chart_tag_name"`
@@ -18,54 +16,19 @@ type ChartTag struct {
 	CreateTime      time.Time `description:"创建时间" gorm:"column:create_time"`
 }
 
-// TableName 设置模型对应的表名
 func (ChartTag) TableName() string {
 	return "chart_tag"
 }
 
-// type ChartTag struct {
-// 	ChartTagId      int       `orm:"column(chart_tag_id);pk"`
-// 	ChartTagName    string    `description:"标签名称"`
-// 	ChartTagNameEn  string    `description:"标签名称(英文)"`
-// 	SysUserId       int       `description:"创建人id"`
-// 	SysUserRealName string    `description:"创建人姓名"`
-// 	ModifyTime      time.Time `description:"修改时间"`
-// 	CreateTime      time.Time `description:"创建时间"`
-// }
 
-// Update
-// @Description: 更新标签
-// @author: Roc
-// @receiver item
-// @datetime 2023-11-21 15:15:17
-// @param updateColList []string
-// @return err error
-// func (item *ChartTag) Update(updateColList []string) (err error) {
-// 	to := orm.NewOrmUsingDB("data")
-// 	_, err = to.Update(item, updateColList...)
 
-// 	return
-// }
 
-// Update
-// @Description: 更新标签
-// @author: Roc
-// @receiver item
-// @datetime 2023-11-21 15:15:17
-// @param updateColList []string
-// @return err error
 func (item *ChartTag) Update(updateColList []string) (err error) {
 	to := global.DmSQL["data"]
 	err = to.Model(item).Select(updateColList).Updates(item).Error
 	return
 }
 
-// Delete 删除
-// func (item *ChartTag) Delete() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Delete(item)
-// 	return
-// }
 
 func (item *ChartTag) Delete() (err error) {
 	o := global.DmSQL["data"]
@@ -73,32 +36,8 @@ func (item *ChartTag) Delete() (err error) {
 	return
 }
 
-// GetTagListByIdList
-// @Description: 根据ID列表获取标签列表
-// @author: Roc
-// @datetime 2023-11-23 17:56:39
-// @param idList []int
-// @return items []*ChartTag
-// @return err error
-// func GetTagListByIdList(idList []int) (items []*ChartTag, err error) {
-// 	num := len(idList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_tag WHERE 1 = 1 AND chart_tag_id in (` + utils.GetOrmInReplace(num) + `)`
-// 	_, err = o.Raw(sql, idList).QueryRows(&items)
 
-// 	return
-// }
 
-// GetTagListByIdList
-// @Description: 根据ID列表获取标签列表
-// @author: zqbao
-// @datetime 2023-11-23 17:56:39
-// @param idList []int
-// @return items []*ChartTag
-// @return err error
 func GetTagListByIdList(idList []int) (items []*ChartTag, err error) {
 	num := len(idList)
 	if num <= 0 {

+ 0 - 40
models/data_manage/cross_variety/chart_tag_variety.go

@@ -6,19 +6,6 @@ import (
 	"time"
 )
 
-//	type ChartTagVariety struct {
-//		Id                        int       `orm:"column(id);pk"`
-//		ChartTagId                int       `description:"标签id"`
-//		ChartVarietyId            int       `description:"品种id"`
-//		EdbInfoId                 int       `description:"指标id"`
-//		LastUpdateSysUserId       int       `description:"最后一次操作人"`
-//		LastUpdateSysUserRealName string    `description:"最后一次操作人真实姓名"`
-//		ModifyTime                time.Time `description:"修改时间"`
-//		CreateTime                time.Time `description:"创建时间"`
-//	}
-//
-// ChartTagVariety
-// @Description: chart_tag_variety 图表标签品种关系表
 type ChartTagVariety struct {
 	Id                        int       `orm:"column(id);pk" gorm:"column:id;primaryKey"`
 	ChartTagId                int       `description:"标签id" gorm:"column:chart_tag_id"`
@@ -30,39 +17,12 @@ type ChartTagVariety struct {
 	CreateTime                time.Time `description:"创建时间" gorm:"column:create_time"`
 }
 
-// TableName 设置模型对应的表名
 func (ChartTagVariety) TableName() string {
 	return "chart_tag_variety"
 }
 
-// GetChartTagVarietyListByTagAndVariety
-// @Description: 根据标签id和品种id列表获取所绑定的品种列表
-// @author: Roc
-// @datetime 2023-11-23 15:04:20
-// @param chartTagId int
-// @param varietyIdList []int
-// @return items []*ChartTagVariety
-// @return err error
-// func GetChartTagVarietyListByTagAndVariety(chartTagId int, varietyIdList []int) (items []*ChartTagVariety, err error) {
-// 	num := len(varietyIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_tag_variety WHERE chart_tag_id = ? AND chart_variety_id in (` + utils.GetOrmInReplace(num) + `) `
-// 	_, err = o.Raw(sql, chartTagId, varietyIdList).QueryRows(&items)
 
-// 	return
-// }
 
-// GetChartTagVarietyListByTagAndVariety
-// @Description: 根据标签id和品种id列表获取所绑定的品种列表
-// @author: zqbao
-// @datetime 2023-11-23 15:04:20
-// @param chartTagId int
-// @param varietyIdList []int
-// @return items []*ChartTagVariety
-// @return err error
 func GetChartTagVarietyListByTagAndVariety(chartTagId int, varietyIdList []int) (items []*ChartTagVariety, err error) {
 	num := len(varietyIdList)
 	if num <= 0 {

+ 12 - 136
models/data_manage/cross_variety/chart_variety.go

@@ -6,8 +6,6 @@ import (
 	"time"
 )
 
-// ChartVariety
-// @Description: chart_variety 图表品种表
 type ChartVariety struct {
 	ChartVarietyId     int       `orm:"column(chart_variety_id);pk" gorm:"column:chart_variety_id;primaryKey"`
 	ChartVarietyName   string    `description:"品种名称" gorm:"column:chart_variety_name"`
@@ -18,43 +16,13 @@ type ChartVariety struct {
 	CreateTime         time.Time `description:"创建时间" gorm:"column:create_time"`
 }
 
-// TableName 设置模型对应的表名
 func (ChartVariety) TableName() string {
 	return "chart_variety"
 }
 
-// type ChartVariety struct {
-// 	ChartVarietyId     int       `orm:"column(chart_variety_id);pk"`
-// 	ChartVarietyName   string    `description:"品种名称"`
-// 	ChartVarietyNameEn string    `description:"品种名称(英文)"`
-// 	SysUserId          int       `description:"创建人id"`
-// 	SysUserRealName    string    `description:"创建人姓名"`
-// 	ModifyTime         time.Time `description:"修改时间"`
-// 	CreateTime         time.Time `description:"创建时间"`
-// }
-
-// GetVarietyById
-// @Description: 根据品种id获取品种详情
-// @author: Roc
-// @datetime 2023-11-21 14:55:31
-// @param id int
-// @return item *ChartVariety
-// @return err error
-// func GetVarietyById(id int) (item *ChartVariety, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_variety WHERE chart_variety_id = ?`
-// 	err = o.Raw(sql, id).QueryRow(&item)
-
-// 	return
-// }
-
-// GetVarietyById
-// @Description: 根据品种id获取品种详情
-// @author: zqbao
-// @datetime 2023-11-21 14:55:31
-// @param id int
-// @return item *ChartVariety
-// @return err error
+
+
+
 func GetVarietyById(id int) (item *ChartVariety, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_variety WHERE chart_variety_id = ?`
@@ -62,28 +30,8 @@ func GetVarietyById(id int) (item *ChartVariety, err error) {
 	return
 }
 
-// GetVarietyByName
-// @Description: 根据品种名称获取品种详情
-// @author: Roc
-// @datetime 2023-11-21 14:55:20
-// @param name string
-// @return item *ChartVariety
-// @return err error
-// func GetVarietyByName(name string) (item *ChartVariety, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_variety WHERE chart_variety_name = ?`
-// 	err = o.Raw(sql, name).QueryRow(&item)
-
-// 	return
-// }
-
-// GetVarietyByName
-// @Description: 根据品种名称获取品种详情
-// @author: zqbao
-// @datetime 2023-11-21 14:55:20
-// @param name string
-// @return item *ChartVariety
-// @return err error
+
+
 func GetVarietyByName(name string) (item *ChartVariety, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_variety WHERE chart_variety_name = ?`
@@ -91,97 +39,32 @@ func GetVarietyByName(name string) (item *ChartVariety, err error) {
 	return
 }
 
-// AddVariety
-// @Description: 添加品种
-// @author: Roc
-// @datetime 2023-11-21 14:52:56
-// @param item *ChartVariety
-// @return err error
-// func AddVariety(item *ChartVariety) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err := o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	item.ChartVarietyId = int(lastId)
-
-// 	return
-// }
-
-// AddVariety
-// @Description: 添加品种
-// @author: zqbao
-// @datetime 2023-11-21 14:52:56
-// @param item *ChartVariety
-// @return err error
+
+
+
 func AddVariety(item *ChartVariety) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(item).Error
 	return
 }
 
-// Update
-// @Description: 更新品种
-// @author: Roc
-// @receiver item
-// @datetime 2023-11-21 15:15:17
-// @param updateColList []string
-// @return err error
-// func (item *ChartVariety) Update(updateColList []string) (err error) {
-// 	to := orm.NewOrmUsingDB("data")
-// 	_, err = to.Update(item, updateColList...)
-
-// 	return
-// }
-
-// Update
-// @Description: 更新品种
-// @author: zqbao
-// @receiver item
-// @datetime 2023-11-21 15:15:17
-// @param updateColList []string
-// @return err error
+
+
 func (item *ChartVariety) Update(updateColList []string) (err error) {
 	to := global.DmSQL["data"]
 	err = to.Model(item).Select(updateColList).Updates(item).Error
 	return
 }
 
-// Delete 删除
-// func (item *ChartVariety) Delete() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Delete(item)
-// 	return
-// }
 
-// Delete 删除
 func (item *ChartVariety) Delete() (err error) {
 	o := global.DmSQL["data"]
 	err = o.Delete(item).Error
 	return
 }
 
-// GetVarietyList
-// @Description: 获取所有品种列表
-// @author: Roc
-// @datetime 2023-11-22 10:44:35
-// @return items []*ChartVariety
-// @return err error
-// func GetVarietyList() (items []*ChartVariety, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM chart_variety WHERE 1 = 1 `
-// 	_, err = o.Raw(sql).QueryRows(&items)
-
-// 	return
-// }
-
-// GetVarietyList
-// @Description: 获取所有品种列表
-// @author: zqbao
-// @datetime 2023-11-22 10:44:35
-// @return items []*ChartVariety
-// @return err error
+
+
 func GetVarietyList() (items []*ChartVariety, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM chart_variety WHERE 1 = 1 `
@@ -189,13 +72,6 @@ func GetVarietyList() (items []*ChartVariety, err error) {
 	return
 }
 
-// GetVarietyListByIdList
-// @Description: 根据ID列表获取品种列表
-// @author: Roc
-// @datetime 2023-11-23 17:56:39
-// @param idList []int
-// @return items []*ChartVariety
-// @return err error
 func GetVarietyListByIdList(idList []int) (items []*ChartVariety, err error) {
 	num := len(idList)
 	if num <= 0 {

+ 0 - 4
models/data_manage/cross_variety/request/chart.go

@@ -1,7 +1,5 @@
 package request
 
-// ChartConfigReq
-// @Description: 跨品种分析的图表配置
 type ChartConfigReq struct {
 	TagX           int               `description:"X轴的标签ID"`
 	TagY           int               `description:"Y轴的标签ID"`
@@ -12,8 +10,6 @@ type ChartConfigReq struct {
 	PercentType    int               `description:"百分位:0-数据区间(兼容历史数据); 1-数据个数;"`
 }
 
-// ChartConfigDate
-// @Description: 跨品种分析的日期配置
 type ChartConfigDate struct {
 	DateType int    `description:"日期类型:1-最新日期;2-N天前;3-固定日期"`
 	Num      int    `description:"N天前的N值"`

+ 0 - 75
models/data_manage/edb_info.go

@@ -7,42 +7,6 @@ import (
 	"time"
 )
 
-//	type EdbInfo struct {
-//		EdbInfoId        int    `orm:"column(edb_info_id);pk"`
-//		EdbInfoType      int    `description:"指标类型,0:普通指标,1:预测指标"`
-//		SourceName       string `description:"来源名称"`
-//		Source           int    `description:"来源id"`
-//		EdbCode          string `description:"指标编码"`
-//		EdbName          string `description:"指标名称"`
-//		EdbNameEn        string `description:"英文指标名称"`
-//		EdbNameSource    string `description:"指标名称来源"`
-//		Frequency        string `description:"频率"`
-//		Unit             string `description:"单位"`
-//		UnitEn           string `description:"英文单位"`
-//		StartDate        string `description:"起始日期"`
-//		EndDate          string `description:"终止日期"`
-//		ClassifyId       int    `description:"分类id"`
-//		SysUserId        int
-//		SysUserRealName  string
-//		UniqueCode       string `description:"指标唯一编码"`
-//		CreateTime       time.Time
-//		ModifyTime       time.Time
-//		MinValue         float64 `description:"指标最小值"`
-//		MaxValue         float64 `description:"指标最大值"`
-//		CalculateFormula string  `description:"计算公式"`
-//		EdbType          int     `description:"指标类型:1:基础指标,2:计算指标"`
-//		Sort             int     `description:"排序字段"`
-//		LatestDate       string  `description:"数据最新日期"`
-//		LatestValue      float64 `description:"数据最新值"`
-//		MoveType         int     `description:"移动方式:1:领先(默认),2:滞后"`
-//		MoveFrequency    string  `description:"移动频度"`
-//		NoUpdate         int8    `description:"是否停止更新,0:继续更新;1:停止更新"`
-//		DataDateType     string  `orm:"column(data_date_type);size(255);null;default(交易日)"`
-//		SubSource        int     `description:"子数据来源:0:经济数据库,1:日期序列"`
-//		SubSourceName    string  `description:"子数据来源名称"`
-//		IndicatorCode    string  `description:"指标代码"`
-//		StockCode        string  `description:"证券代码"`
-//	}
 type EdbInfo struct {
 	EdbInfoId        int       `gorm:"column:edb_info_id;primaryKey" description:"指标ID" orm:"column(edb_info_id);pk"`
 	EdbInfoType      int       `gorm:"column:edb_info_type" description:"指标类型,0:普通指标,1:预测指标"`
@@ -95,7 +59,6 @@ func GetEdbInfoById(edbInfoId int) (item *EdbInfo, err error) {
 	return
 }
 
-// GetEdbInfoByIdList 根据指标id集合 获取 指标列表
 func GetEdbInfoByIdList(edbInfoIdList []int) (items []*EdbInfo, err error) {
 	num := len(edbInfoIdList)
 	if num <= 0 {
@@ -128,52 +91,14 @@ func GetRefreshEdbInfoFromBase(edbInfoId, source int) (baseEdbInfoArr, calculate
 	return
 }
 
-// func GetEdbInfoById(edbInfoId int) (item *EdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM edb_info WHERE edb_info_id=? `
-// 	err = o.Raw(sql, edbInfoId).QueryRow(&item)
-// 	return
-// }
 
-// // GetEdbInfoByIdList 根据指标id集合 获取 指标列表
-// func GetEdbInfoByIdList(edbInfoIdList []int) (items []*EdbInfo, err error) {
-// 	num := len(edbInfoIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM edb_info WHERE edb_info_id in (` + utils.GetOrmInReplace(num) + `) `
-// 	_, err = o.Raw(sql, edbInfoIdList).QueryRows(&items)
-// 	return
-// }
 
-// func GetRefreshEdbInfoFromBase(edbInfoId, source int) (baseEdbInfoArr, calculateInfoArr []*EdbInfo, err error) {
-// 	calculateList, err := GetEdbInfoCalculateMap(edbInfoId, source)
-// 	if err != nil && !utils.IsErrNoRow() {
-// 		return
-// 	}
-// 	for _, item := range calculateList {
-// 		if item.EdbInfoId == edbInfoId { //	如果查出来关联的指标就是自己的话,那么就过滤
-// 			continue
-// 		}
-// 		if item.EdbType == 1 {
-// 			baseEdbInfoArr = append(baseEdbInfoArr, item)
-// 		} else {
-// 			calculateInfoArr = append(calculateInfoArr, item)
-// 			newBaseEdbInfoArr, newCalculateInfoArr, _ := GetRefreshEdbInfoFromBase(item.EdbInfoId, item.Source)
-// 			baseEdbInfoArr = append(baseEdbInfoArr, newBaseEdbInfoArr...)
-// 			calculateInfoArr = append(calculateInfoArr, newCalculateInfoArr...)
-// 		}
-// 	}
-// 	return
-// }
 
 type EdbInfoSearchData struct {
 	DataTime string  `description:"数据日期"`
 	Value    float64 `description:"数据"`
 }
 
-// TraceEdbInfoResp 指标追溯数据返回
 type TraceEdbInfoResp struct {
 	EdbInfoId   int                `description:"指标id"`
 	EdbInfoType int                `description:"指标类型: 0-普通指标; 1-预测指标"`

+ 7 - 74
models/data_manage/edb_info_calculate.go

@@ -9,13 +9,8 @@ import (
 func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error) {
 	o := global.DmSQL["data"]
 
-	//calculateTableName := GetEdbInfoCalculateTableName(source)
 
-	//sql := ` SELECT b.* FROM %s AS a
-	//		INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-	//		WHERE a.edb_info_id=? ORDER BY sort ASC `
 
-	//sql = fmt.Sprintf(sql, calculateTableName)
 
 	sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
@@ -24,7 +19,6 @@ func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error)
 	return
 }
 
-// GetEdbInfoAllCalculateByEdbInfoIdList 根据指标id集合 获取基础指标对应的所有计算指标
 func GetEdbInfoAllCalculateByEdbInfoIdList(edbInfoIdList []int) (list []*EdbInfo, err error) {
 	num := len(edbInfoIdList)
 	if num <= 0 {
@@ -41,64 +35,13 @@ func GetEdbInfoAllCalculateByEdbInfoIdList(edbInfoIdList []int) (list []*EdbInfo
 	return
 }
 
-// func GetEdbInfoCalculateMap(edbInfoId, source int) (list []*EdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-
-// 	//calculateTableName := GetEdbInfoCalculateTableName(source)
-
-// 	//sql := ` SELECT b.* FROM %s AS a
-// 	//		INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-// 	//		WHERE a.edb_info_id=? ORDER BY sort ASC `
-
-// 	//sql = fmt.Sprintf(sql, calculateTableName)
-
-// 	sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
-// 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-// 			WHERE a.edb_info_id=? ORDER BY sort ASC `
-// 	_, err = o.Raw(sql, edbInfoId).QueryRows(&list)
-// 	return
-// }
-
-// // GetEdbInfoAllCalculateByEdbInfoIdList 根据指标id集合 获取基础指标对应的所有计算指标
-// func GetEdbInfoAllCalculateByEdbInfoIdList(edbInfoIdList []int) (list []*EdbInfo, err error) {
-// 	num := len(edbInfoIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT b.* FROM edb_info_calculate_mapping AS a
-// 			 INNER JOIN edb_info AS b ON a.edb_info_id=b.edb_info_id
-//              WHERE a.from_edb_info_id in (` + utils.GetOrmInReplace(num) + `)
-// 			 GROUP BY a.edb_info_id
-// 			 ORDER BY a.edb_info_id ASC `
-// 	_, err = o.Raw(sql, edbInfoIdList).QueryRows(&list)
-// 	return
-// }
-
-// EdbInfoCalculateMappingInfo
-//
-//	type EdbInfoCalculateMappingInfo struct {
-//		EdbInfoCalculateMappingId int       `orm:"column(edb_info_calculate_mapping_id);pk"`
-//		EdbInfoId                 int       `description:"计算指标id"`
-//		Source                    int       `description:"计算指标来源"`
-//		SourceName                string    `description:"计算指标来源名称"`
-//		EdbCode                   string    `description:"计算指标编码"`
-//		FromEdbInfoId             int       `description:"基础指标id"`
-//		FromEdbCode               string    `description:"基础指标编码"`
-//		FromEdbName               string    `description:"基础指标名称"`
-//		FromSource                int       `description:"基础指标来源"`
-//		FromSourceName            string    `description:"基础指标来源名称"`
-//		MoveValue                 int       `description:"领先值"`
-//		FromTag                   string    `description:"来源指标标签"`
-//		Sort                      int       `description:"计算指标名称排序"`
-//		CreateTime                time.Time `description:"创建时间"`
-//		ModifyTime                time.Time `description:"修改时间"`
-//		FromEdbType               int       `description:"来源指标类型:1:基础指标,2:计算指标"`
-//		FromEdbInfoType           int       `description:"来源指标类型: 0-基础指标; 1-预测指标"`
-//		FromClassifyId            int       `description:"来源指标分类ID"`
-//		FromUniqueCode            string    `description:"来源指标唯一编码"`
-//	}
+
+
+
+
+
+
+
 type EdbInfoCalculateMappingInfo struct {
 	EdbInfoCalculateMappingId int       `gorm:"column:edb_info_calculate_mapping_id;primaryKey" description:"计算指标映射ID" orm:"column(edb_info_calculate_mapping_id);pk"`
 	EdbInfoId                 int       `gorm:"column:edb_info_id" description:"计算指标id"`
@@ -121,7 +64,6 @@ type EdbInfoCalculateMappingInfo struct {
 	FromUniqueCode            string    `gorm:"column:from_unique_code" description:"来源指标唯一编码"`
 }
 
-// GetEdbInfoCalculateMappingListByEdbInfoId 根据生成的指标id获取来源的指标id列表
 func GetEdbInfoCalculateMappingListByEdbInfoId(edbInfoId int) (items []*EdbInfoCalculateMappingInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT a.*,b.edb_type as from_edb_type,b.edb_info_type as from_edb_info_type, b.unique_code AS from_unique_code, b.classify_id AS from_classify_id FROM edb_info_calculate_mapping AS a
@@ -131,12 +73,3 @@ func GetEdbInfoCalculateMappingListByEdbInfoId(edbInfoId int) (items []*EdbInfoC
 	return
 }
 
-// GetEdbInfoCalculateMappingListByEdbInfoId 根据生成的指标id获取来源的指标id列表
-// func GetEdbInfoCalculateMappingListByEdbInfoId(edbInfoId int) (items []*EdbInfoCalculateMappingInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT a.*,b.edb_type as from_edb_type,b.edb_info_type as from_edb_info_type, b.unique_code AS from_unique_code, b.classify_id AS from_classify_id FROM edb_info_calculate_mapping AS a
-// 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-// 			WHERE a.edb_info_id=? `
-// 	_, err = o.Raw(sql, edbInfoId).QueryRows(&items)
-// 	return
-// }

+ 0 - 71
models/data_manage/edb_source.go

@@ -11,22 +11,7 @@ var (
 	EdbSourceIdMap map[int]*EdbSource // 指标来源
 )
 
-// EdbSource 指标来源表
-//
-//	type EdbSource struct {
-//		EdbSourceId      int    `orm:"column(edb_source_id);pk"`
-//		SourceName       string `description:"指标来源名称"`
-//		TableName        string `description:"数据表名"`
-//		EdbAddMethod     string `description:"指标新增接口"`
-//		EdbRefreshMethod string `description:"指标刷新接口"`
-//		IsBase           int    `description:"是否为基础指标: 0-否; 1-是"`
-//		FromBridge       int    `description:"是否来源于桥接服务: 0-否; 1-是"`
-//		BridgeFlag       string `description:"桥接服务对象标识"`
-//		SourceExtend     string `description:"扩展字段做查询用"`
-//		EdbCodeRequired  int    `description:"指标编码是否必填: 0-否; 1-是"`
-//	}
 
-// EdbSource 指标来源表
 type EdbSource struct {
 	EdbSourceId      int    `gorm:"column:edb_source_id;primaryKey" description:"指标来源ID" orm:"column(edb_source_id);pk"`
 	SourceName       string `gorm:"column:source_name" description:"指标来源名称"`
@@ -40,7 +25,6 @@ type EdbSource struct {
 	EdbCodeRequired  int    `gorm:"column:edb_code_required" description:"指标编码是否必填: 0-否; 1-是"`
 }
 
-// GetEdbSourceItemsByCondition 获取指标来源列表
 func GetEdbSourceItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*EdbSource, err error) {
 	o := global.DmSQL["data"]
 	fields := strings.Join(fieldArr, ",")
@@ -56,31 +40,7 @@ func GetEdbSourceItemsByCondition(condition string, pars []interface{}, fieldArr
 	return
 }
 
-// GetEdbSourceItemsByCondition 获取指标来源列表
-// func GetEdbSourceItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*EdbSource, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := `ORDER BY edb_source_id ASC`
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM edb_source WHERE 1=1 %s %s`, fields, condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
 
-// EdbSourceChild 指标来源表
-//
-//	type EdbSourceChild struct {
-//		EdbSourceId int    `orm:"column(edb_source_id);pk"`
-//		SourceName  string `description:"指标来源名称"`
-//		TableName   string `description:"数据表名"`
-//		IsBase      int    `description:"是否为基础指标: 2-否; 1-是"`
-//		Child       []EdbSourceChild
-//	}
 type EdbSourceChild struct {
 	EdbSourceId int              `gorm:"column:edb_source_id;primaryKey" description:"指标来源ID" orm:"column(edb_source_id);pk"`
 	SourceName  string           `gorm:"column:source_name" description:"指标来源名称"`
@@ -89,7 +49,6 @@ type EdbSourceChild struct {
 	Child       []EdbSourceChild `description:"子源"`
 }
 
-// GetEdbSourceItemByCondition 获取指标来源
 func GetEdbSourceItemByCondition(condition string, pars []interface{}) (item *EdbSource, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT * FROM edb_source WHERE 1=1 %s`, condition)
@@ -97,7 +56,6 @@ func GetEdbSourceItemByCondition(condition string, pars []interface{}) (item *Ed
 	return
 }
 
-// InitEdbSourceVar 初始化时加载指标来源对应信息, 避免循环中查库, 注意edb_source表修改table_name的话需要重启服务
 func InitEdbSourceVar() {
 	EdbSourceIdMap = make(map[int]*EdbSource)
 	sources, e := GetEdbSourceItemsByCondition(``, make([]interface{}, 0), []string{}, "")
@@ -110,11 +68,6 @@ func InitEdbSourceVar() {
 	}
 }
 
-// GetEdbSourceItemsSourceId
-// @Description: 根据来源id获取指标来源
-// @param sourceId
-// @return item
-// @return err
 func GetEdbSourceItemsSourceId(sourceId int) (item *EdbSource, err error) {
 	sql := `SELECT * FROM edb_source WHERE 1=1 AND edb_source_id = ? `
 	err = global.DmSQL["data"].Raw(sql, sourceId).First(&item).Error
@@ -122,10 +75,6 @@ func GetEdbSourceItemsSourceId(sourceId int) (item *EdbSource, err error) {
 	return
 }
 
-// GetEdbSourceBySourceId
-// @Description: 根据来源id获取指标来源
-// @param sourceId
-// @return sourceItem
 func GetEdbSourceBySourceId(sourceId int) (sourceItem *EdbSource) {
 	sourceItem, ok := EdbSourceIdMap[sourceId]
 	if !ok {
@@ -135,7 +84,6 @@ func GetEdbSourceBySourceId(sourceId int) (sourceItem *EdbSource) {
 		}
 		if item.EdbSourceId > 0 {
 			sourceItem = item
-			// 写入到内存中
 			EdbSourceIdMap[sourceId] = sourceItem
 		}
 	}
@@ -143,23 +91,4 @@ func GetEdbSourceBySourceId(sourceId int) (sourceItem *EdbSource) {
 	return
 }
 
-// GetEdbSourceItemByCondition 获取指标来源
-// func GetEdbSourceItemByCondition(condition string, pars []interface{}) (item *EdbSource, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM edb_source WHERE 1=1 %s`, condition)
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
 
-// // InitEdbSourceVar 初始化时加载指标来源对应信息, 避免循环中查库, 注意edb_source表修改table_name的话需要重启服务
-// func InitEdbSourceVar() {
-// 	EdbSourceIdMap = make(map[int]*EdbSource)
-// 	sources, e := GetEdbSourceItemsByCondition(``, make([]interface{}, 0), []string{}, "")
-// 	if e != nil {
-// 		utils.FileLog.Info("init source table err: %s", e.Error())
-// 		return
-// 	}
-// 	for _, v := range sources {
-// 		EdbSourceIdMap[v.EdbSourceId] = v
-// 	}
-// }

+ 2 - 114
models/data_manage/excel/excel_chart_data.go

@@ -19,73 +19,31 @@ type ExcelChartData struct {
 	DataTimestamp    int64     `gorm:"column:data_timestamp"`
 }
 
-// type ExcelChartData struct {
-// 	ExcelChartDataId int `orm:"column(excel_chart_data_id);pk"`
-// 	ExcelInfoId      int `description:"表格id"`
-// 	ExcelChartEdbId  int `description:"指标ID"`
-// 	ChartInfoId      int `description:"图表id"`
-// 	DataTime         string
-// 	Value            float64
-// 	ModifyTime       time.Time `description:"修改时间"`
-// 	CreateTime       time.Time `description:"创建时间"`
-// 	DataTimestamp    int64
-// }
 
 func (e *ExcelChartData) TableName() string {
 	return "excel_chart_data"
 }
 
-//	func (e *ExcelChartData) Add() (err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		_, err = o.Insert(e)
-//		return
-//	}
-//
-// 新增
 func (e *ExcelChartData) Add() (err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(e).Error
 	return
 }
 
-// 修改
-//	func (e *ExcelChartData) Update(cols []string) (err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		_, err = o.Update(e, cols...)
-//		return
-//	}
 
-// 修改
 func (e *ExcelChartData) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(e).Select(cols).Updates(e).Error
 	return
 }
 
-// 删除
-// func (e *ExcelChartData) Delete() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Delete(e)
-// 	return
-// }
 
-// 删除
 func (e *ExcelChartData) Delete() (err error) {
 	o := global.DmSQL["data"]
 	err = o.Delete(e).Error
 	return
 }
 
-// 查询
-// func GetExcelChartDataByExcelInfoId(excelInfoId int) (list []*ExcelChartData, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-//              FROM excel_chart_data
-// 			 WHERE excel_info_id=?
-//             ORDER BY excel_chart_edb_id ASC, data_time desc, excel_chart_data_id ASC `
-// 	_, err = o.Raw(sql, excelInfoId).QueryRows(&list)
-// 	return
-// }
 
 func GetExcelChartDataByExcelInfoId(excelInfoId int) (list []*ExcelChartData, err error) {
 	o := global.DmSQL["data"]
@@ -97,65 +55,8 @@ func GetExcelChartDataByExcelInfoId(excelInfoId int) (list []*ExcelChartData, er
 	return
 }
 
-// func BatchUpdateChartEdbData(excelInfoId int, excelEdbMap map[int]*ExcelChartEdb, excelDataMap map[int][]*models.EdbDataList) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-// 	//如果有数据则删除所有的数据
-// 	sql := `delete from excel_chart_data where excel_info_id = ?`
-// 	_, err = o.Raw(sql, excelInfoId).Exec()
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	// 图表指标数据入库
-// 	addList := make([]*ExcelChartData, 0)
-// 	for chartEdbId, dataList := range excelDataMap {
-// 		chartEdb, ok := excelEdbMap[chartEdbId]
-// 		if !ok {
-// 			err = fmt.Errorf("chartEdbId:%d not exist", chartEdbId)
-// 			return
-// 		}
-// 		for _, v := range dataList {
-// 			chartData := &ExcelChartData{
-// 				ExcelInfoId:     chartEdb.ExcelInfoId,
-// 				ExcelChartEdbId: chartEdb.ExcelChartEdbId,
-// 				ChartInfoId:     chartEdb.ChartInfoId,
-// 				DataTime:        v.DataTime,
-// 				Value:           v.Value,
-// 				DataTimestamp:   v.DataTimestamp,
-// 				ModifyTime:      time.Now(),
-// 				CreateTime:      time.Now(),
-// 			}
-// 			addList = append(addList, chartData)
-// 			// data信息入库
-// 			if len(addList) > 1000 {
-// 				_, err = o.InsertMulti(len(addList), addList)
-// 				if err != nil {
-// 					return
-// 				}
-// 				addList = addList[:0]
-// 			}
-// 		}
-// 	}
-
-//		// data信息入库
-//		if len(addList) > 0 {
-//			_, err = o.InsertMulti(len(addList), addList)
-//			if err != nil {
-//				return
-//			}
-//		}
-//		return
-//	}
+
+
 
 func BatchUpdateChartEdbData(excelInfoId int, excelEdbMap map[int]*ExcelChartEdb, excelDataMap map[int][]*models.EdbDataList) (err error) {
 	o := global.DmSQL["data"].Begin()
@@ -166,14 +67,12 @@ func BatchUpdateChartEdbData(excelInfoId int, excelEdbMap map[int]*ExcelChartEdb
 			_ = o.Commit()
 		}
 	}()
-	//如果有数据则删除所有的数据
 	sql := `delete from excel_chart_data where excel_info_id = ?`
 	err = o.Exec(sql, excelInfoId).Error
 	if err != nil {
 		return
 	}
 
-	// 图表指标数据入库
 	addList := make([]*ExcelChartData, 0)
 	for chartEdbId, dataList := range excelDataMap {
 		chartEdb, ok := excelEdbMap[chartEdbId]
@@ -193,7 +92,6 @@ func BatchUpdateChartEdbData(excelInfoId int, excelEdbMap map[int]*ExcelChartEdb
 				CreateTime:      time.Now(),
 			}
 			addList = append(addList, chartData)
-			// data信息入库
 			if len(addList) > 1000 {
 				err = o.Create(addList).Error
 				if err != nil {
@@ -204,7 +102,6 @@ func BatchUpdateChartEdbData(excelInfoId int, excelEdbMap map[int]*ExcelChartEdb
 		}
 	}
 
-	// data信息入库
 	if len(addList) > 0 {
 		err = o.Create(addList).Error
 		if err != nil {
@@ -214,15 +111,6 @@ func BatchUpdateChartEdbData(excelInfoId int, excelEdbMap map[int]*ExcelChartEdb
 	return
 }
 
-// func GetExcelChartDataByChartInfoId(chartInfoId int) (list []*ExcelChartData, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-//              FROM excel_chart_Data
-// 			 WHERE chart_info_id=?
-//              ORDER BY excel_chart_edb_id ASC `
-// 	_, err = o.Raw(sql, chartInfoId).QueryRows(&list)
-// 	return
-// }
 
 func GetExcelChartDataByChartInfoId(chartInfoId int) (list []*ExcelChartData, err error) {
 	o := global.DmSQL["data"]

+ 13 - 364
models/data_manage/excel/excel_chart_edb.go

@@ -38,7 +38,6 @@ type ExcelChartEdb struct {
 	ChartWidth      float64   `description:"线条大小" gorm:"column:chart_width"`
 }
 
-// TableName 设置模型对应的表名
 func (ExcelChartEdb) TableName() string {
 	return "excel_chart_edb"
 }
@@ -61,7 +60,6 @@ type ExcelChartEdbView struct {
 	FromTag string `description:"标签" gorm:"column:from_tag"`
 }
 
-// TableName 设置模型对应的表名
 func (ExcelChartEdbView) TableName() string {
 	return "excel_chart_edb_view"
 }
@@ -82,20 +80,12 @@ type BalanceTableChart struct {
 	ChartImage        string `description:"封面图" json:"-" gorm:"column:chart_image"`
 	SeasonExtraConfig string `description:"季节性图表中的配置,json数据" gorm:"column:season_extra_config"`
 	SourcesFrom       string `description:"图表来源" gorm:"column:sources_from"`
-	//	ChartEdbInfoList  []ExcelChartEfigView `gorm:"-"`
 }
 
-// TableName 设置模型对应的表名
 func (BalanceTableChart) TableName() string {
 	return "balance_table_chart"
 }
 
-// 新增
-//	func (e *ExcelChartEdb) Add() (err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		_, err = o.Insert(e)
-//		return
-//	}
 
 func (e *ExcelChartEdb) Add() (err error) {
 	o := global.DmSQL["data"]
@@ -103,12 +93,6 @@ func (e *ExcelChartEdb) Add() (err error) {
 	return
 }
 
-// 修改
-// func (e *ExcelChartEdb) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(e, cols...)
-// 	return
-// }
 
 func (e *ExcelChartEdb) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
@@ -116,12 +100,6 @@ func (e *ExcelChartEdb) Update(cols []string) (err error) {
 	return
 }
 
-// 删除
-// func (e *ExcelChartEdb) Delete() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Delete(e)
-// 	return
-// }
 
 func (e *ExcelChartEdb) Delete() (err error) {
 	o := global.DmSQL["data"]
@@ -134,74 +112,10 @@ type AddChartEdbAndDataItem struct {
 	DataList []*ExcelChartData `description:"数据列表" gorm:"column:data_list"`
 }
 
-// 同时添加指标和指标数据
-// func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chartInfo *models.ChartInfo, deleteEdbIds []int) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-
-// 	// 先删除原先的绑定的指标
-// 	if len(deleteEdbIds) > 0 && chartInfo.ChartInfoId > 0 {
-// 		sql := `DELETE FROM excel_chart_edb WHERE chart_info_id = ? AND excel_chart_edb_id in (` + utils.GetOrmInReplace(len(deleteEdbIds)) + `)`
-// 		_, err = o.Raw(sql, chartInfo.ChartInfoId, deleteEdbIds).Exec()
-// 		if err != nil {
-// 			err = fmt.Errorf("删除原先的指标失败:%v", err)
-// 			return
-// 		}
-// 	}
-// 	// 图表指标信息入库
-// 	updateIds := make([]int, 0)
-// 	var edbInfoIdArrStr []string
-// 	for _, item := range list {
-// 		err = addChartEdbAndData(o, item.ChartEdb, item.DataList)
-// 		if err != nil {
-// 			return
-// 		}
-// 		updateIds = append(updateIds, item.ChartEdb.ExcelChartEdbId)
-// 		edbInfoIdArrStr = append(edbInfoIdArrStr, strconv.Itoa(item.ChartEdb.ExcelChartEdbId))
-// 	}
-
-// 	//新增图表
-// 	chartInfoId := chartInfo.ChartInfoId
-// 	if chartInfo.ChartInfoId <= 0 {
-// 		lastId, e := o.Insert(chartInfo)
-// 		if e != nil {
-// 			err = fmt.Errorf("新增图表失败,AddChartEdbAndData: %v", e)
-// 			return
-// 		}
-// 		chartInfoId = int(lastId)
-// 	} else {
-// 		_, err = o.Update(chartInfo)
-// 		if err != nil {
-// 			err = fmt.Errorf("更新图表失败,AddChartEdbAndData: %v", e)
-// 			return
-// 		}
-// 	}
-
-// 	//更新图表id
-// 	sql := `update excel_chart_edb set chart_info_id = ? where excel_chart_edb_id in (` + utils.GetOrmInReplace(len(updateIds)) + `) and chart_info_id=0`
-// 	_, err = o.Raw(sql, chartInfoId, updateIds).Exec()
-// 	if err != nil {
-// 		err = fmt.Errorf("更新图表id失败,AddChartEdbAndData: %v", err)
-// 		return
-// 	}
-
-//		if len(edbInfoIdArrStr) > 0 {
-//			edbInfoIdStr := strings.Join(edbInfoIdArrStr, ",")
-//			//更新图表关联的指标id
-//			sql = `update chart_info set edb_info_ids = ? where chart_info_id = ?`
-//			_, err = o.Raw(sql, edbInfoIdStr, chartInfoId).Exec()
-//		}
-//		return
-//	}
+
+
+
+
 
 func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chartInfo *models.ChartInfo, deleteEdbIds []int) (err error) {
 	o := global.DmSQL["data"].Begin()
@@ -213,7 +127,6 @@ func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chart
 		}
 	}()
 
-	// 先删除原先的绑定的指标
 	if len(deleteEdbIds) > 0 && chartInfo.ChartInfoId > 0 {
 		sql := `DELETE FROM excel_chart_edb WHERE chart_info_id = ? AND excel_chart_edb_id in (` + utils.GetGormInReplace(len(deleteEdbIds)) + `)`
 		err = o.Exec(sql, chartInfo.ChartInfoId, deleteEdbIds).Error
@@ -222,7 +135,6 @@ func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chart
 			return
 		}
 	}
-	// 图表指标信息入库
 	updateIds := make([]int, 0)
 	var edbInfoIdArrStr []string
 	for _, item := range list {
@@ -234,7 +146,6 @@ func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chart
 		edbInfoIdArrStr = append(edbInfoIdArrStr, strconv.Itoa(item.ChartEdb.ExcelChartEdbId))
 	}
 
-	//新增图表
 	chartInfoId := chartInfo.ChartInfoId
 	if chartInfo.ChartInfoId <= 0 {
 		e := o.Create(chartInfo).Error
@@ -251,7 +162,6 @@ func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chart
 		}
 	}
 
-	//更新图表id
 	sql := `update excel_chart_edb set chart_info_id = ? where excel_chart_edb_id in (` + utils.GetGormInReplace(len(updateIds)) + `) and chart_info_id=0`
 	err = o.Exec(sql, chartInfoId, updateIds).Error
 	if err != nil {
@@ -261,138 +171,20 @@ func (e *ExcelChartEdb) AddChartEdbAndData(list []*AddChartEdbAndDataItem, chart
 
 	if len(edbInfoIdArrStr) > 0 {
 		edbInfoIdStr := strings.Join(edbInfoIdArrStr, ",")
-		//更新图表关联的指标id
 		sql = `update chart_info set edb_info_ids = ? where chart_info_id = ?`
 		err = o.Exec(sql, edbInfoIdStr, chartInfoId).Error
 	}
 	return
 }
 
-// func addChartEdbAndData(o orm.TxOrmer, chartEdb *ExcelChartEdb, dataList []*ExcelChartData) (err error) {
-// 	// 图表指标信息入库
-// 	excelChartEdbId := chartEdb.ExcelChartEdbId
-// 	if chartEdb.ExcelChartEdbId <= 0 {
-// 		lastId, e := o.Insert(chartEdb)
-// 		if e != nil {
-// 			err = fmt.Errorf("新增指标失败,addChartEdbAndData: %v", e)
-// 			return
-// 		}
-// 		excelChartEdbId = int(lastId)
-// 	} else {
-// 		_, e := o.Update(chartEdb)
-// 		if e != nil {
-// 			err = fmt.Errorf("更新指标失败,addChartEdbAndData: %v", e)
-// 			return
-// 		}
-// 		//如果有数据则删除所有的数据
-// 		sql := `delete from excel_chart_data where excel_chart_edb_id = ?`
-// 		_, err = o.Raw(sql, excelChartEdbId).Exec()
-// 		if err != nil {
-// 			return
-// 		}
-// 	}
-
-// 	chartEdb.ExcelChartEdbId = excelChartEdbId
-
-// 	// 图表指标数据入库
-// 	addList := make([]*ExcelChartData, 0)
-// 	if len(dataList) > 0 {
-// 		for _, v := range dataList {
-// 			chartData := &ExcelChartData{
-// 				ExcelInfoId:     chartEdb.ExcelInfoId,
-// 				ExcelChartEdbId: chartEdb.ExcelChartEdbId,
-// 				ChartInfoId:     chartEdb.ChartInfoId,
-// 				DataTime:        v.DataTime,
-// 				Value:           v.Value,
-// 				DataTimestamp:   v.DataTimestamp,
-// 				ModifyTime:      time.Now(),
-// 				CreateTime:      time.Now(),
-// 			}
-// 			addList = append(addList, chartData)
-// 			// data信息入库
-// 			if len(addList) > 1000 {
-// 				_, err = o.InsertMulti(len(addList), addList)
-// 				if err != nil {
-// 					return
-// 				}
-// 				addList = addList[:0]
-// 			}
-// 		}
-// 	}
-
-//		// data信息入库
-//		if len(addList) > 0 {
-//			_, err = o.InsertMulti(len(addList), addList)
-//			if err != nil {
-//				return
-//			}
-//		}
-//		return
-//	}
-// func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelChartData) (err error) {
-// 	// 图表指标信息入库
-// 	excelChartEdbId := chartEdb.ExcelChartEdbId
-// 	if chartEdb.ExcelChartEdbId <= 0 {
-// 		lastId, e := o.Insert(chartEdb)
-// 		if e != nil {
-// 			err = fmt.Errorf("新增指标失败,addChartEdbAndData: %v", e)
-// 			return
-// 		}
-// 		excelChartEdbId = int(lastId)
-// 	} else {
-// 		_, e := o.Update(chartEdb)
-// 		if e != nil {
-// 			err = fmt.Errorf("更新指标失败,addChartEdbAndData: %v", e)
-// 			return
-// 		}
-// 		//如果有数据则删除所有的数据
-// 		sql := `delete from excel_chart_data where excel_chart_edb_id = ?`
-// 		_, err = o.Raw(sql, excelChartEdbId).Exec()
-// 		if err != nil {
-// 			return
-// 		}
-// 	}
-
-// 	chartEdb.ExcelChartEdbId = excelChartEdbId
-
-// 	// 图表指标数据入库
-// 	addList := make([]*ExcelChartData, 0)
-// 	if len(dataList) > 0 {
-// 		for _, v := range dataList {
-// 			chartData := &ExcelChartData{
-// 				ExcelInfoId:     chartEdb.ExcelInfoId,
-// 				ExcelChartEdbId: chartEdb.ExcelChartEdbId,
-// 				ChartInfoId:     chartEdb.ChartInfoId,
-// 				DataTime:        v.DataTime,
-// 				Value:           v.Value,
-// 				DataTimestamp:   v.DataTimestamp,
-// 				ModifyTime:      time.Now(),
-// 				CreateTime:      time.Now(),
-// 			}
-// 			addList = append(addList, chartData)
-// 			// data信息入库
-// 			if len(addList) > 1000 {
-// 				_, err = o.InsertMulti(len(addList), addList)
-// 				if err != nil {
-// 					return
-// 				}
-// 				addList = addList[:0]
-// 			}
-// 		}
-// 	}
-
-// 	// data信息入库
-// 	if len(addList) > 0 {
-// 		_, err = o.InsertMulti(len(addList), addList)
-// 		if err != nil {
-// 			return
-// 		}
-// 	}
-// 	return
-// }
+
+
+
+
+
+
 
 func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelChartData) (err error) {
-	// 图表指标信息入库
 	excelChartEdbId := chartEdb.ExcelChartEdbId
 	if chartEdb.ExcelChartEdbId <= 0 {
 		e := o.Create(chartEdb).Error
@@ -403,12 +195,10 @@ func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelCh
 		excelChartEdbId = int(chartEdb.ExcelChartEdbId)
 	} else {
 		e := o.Model(chartEdb).Select("*").Updates(chartEdb).Error
-		// _, e := o.Update(chartEdb)
 		if e != nil {
 			err = fmt.Errorf("更新指标失败,addChartEdbAndData: %v", e)
 			return
 		}
-		//如果有数据则删除所有的数据
 		sql := `delete from excel_chart_data where excel_chart_edb_id = ?`
 		err = o.Exec(sql, excelChartEdbId).Error
 		if err != nil {
@@ -418,7 +208,6 @@ func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelCh
 
 	chartEdb.ExcelChartEdbId = excelChartEdbId
 
-	// 图表指标数据入库
 	addList := make([]*ExcelChartData, 0)
 	if len(dataList) > 0 {
 		for _, v := range dataList {
@@ -433,7 +222,6 @@ func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelCh
 				CreateTime:      time.Now(),
 			}
 			addList = append(addList, chartData)
-			// data信息入库
 			if len(addList) > 1000 {
 				err = o.Create(addList).Error
 				if err != nil {
@@ -444,7 +232,6 @@ func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelCh
 		}
 	}
 
-	// data信息入库
 	if len(addList) > 0 {
 		err = o.Create(addList).Error
 		if err != nil {
@@ -454,15 +241,6 @@ func addChartEdbAndData(o *gorm.DB, chartEdb *ExcelChartEdb, dataList []*ExcelCh
 	return
 }
 
-//	func GetExcelChartEdbMappingByExcelInfoId(excelInfoId int) (list []*ExcelChartEdb, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := ` SELECT *
-//	             FROM excel_chart_edb
-//				 WHERE excel_info_id=?
-//	             ORDER BY chart_info_id asc, excel_chart_edb_id ASC `
-//		_, err = o.Raw(sql, excelInfoId).QueryRows(&list)
-//		return
-//	}
 
 func GetExcelChartEdbMappingByExcelInfoId(excelInfoId int) (list []*ExcelChartEdb, err error) {
 	o := global.DmSQL["data"]
@@ -474,23 +252,7 @@ func GetExcelChartEdbMappingByExcelInfoId(excelInfoId int) (list []*ExcelChartEd
 	return
 }
 
-// func GetExcelChartEdbMappingByExcelInfoIds(excelInfoIds []int) (list []*ExcelChartEdb, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-//              FROM excel_chart_edb
-// 			 WHERE excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `)`
-// 	_, err = o.Raw(sql, excelInfoIds).QueryRows(&list)
-// 	return
-// }
-
-// func GetExcelChartEdbMappingByExcelInfoIds(excelInfoIds []int) (list []*ExcelChartEdb, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-//              FROM excel_chart_edb
-// 			 WHERE excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `)`
-// 	_, err = o.Raw(sql, excelInfoIds).QueryRows(&list)
-// 	return
-// }
+
 
 func GetExcelChartEdbMappingByExcelInfoIds(excelInfoIds []int) (list []*ExcelChartEdb, err error) {
 	o := global.DmSQL["data"]
@@ -501,12 +263,6 @@ func GetExcelChartEdbMappingByExcelInfoIds(excelInfoIds []int) (list []*ExcelCha
 	return
 }
 
-//	func GetExcelChartEdbById(id int) (item *ExcelChartEdb, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := ` SELECT * FROM excel_chart_edb WHERE excel_chart_edb_id=? `
-//		err = o.Raw(sql, id).QueryRow(&item)
-//		return
-//	}
 
 func GetExcelChartEdbById(id int) (item *ExcelChartEdb, err error) {
 	o := global.DmSQL["data"]
@@ -515,15 +271,6 @@ func GetExcelChartEdbById(id int) (item *ExcelChartEdb, err error) {
 	return
 }
 
-// func GetExcelChartEdbMappingByChartInfoId(chartInfoId int) (list []*ExcelChartEdb, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-//              FROM excel_chart_edb
-// 			 WHERE chart_info_id=?
-//              ORDER BY excel_chart_edb_id ASC `
-// 	_, err = o.Raw(sql, chartInfoId).QueryRows(&list)
-// 	return
-// }
 
 func GetExcelChartEdbMappingByChartInfoId(chartInfoId int) (list []*ExcelChartEdb, err error) {
 	o := global.DmSQL["data"]
@@ -535,14 +282,6 @@ func GetExcelChartEdbMappingByChartInfoId(chartInfoId int) (list []*ExcelChartEd
 	return
 }
 
-//	func GetExcelInfoByChartInfoId(chartInfoId int) (item *ExcelInfo, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := ` SELECT i.*
-//	             FROM excel_chart_edb e left join excel_info i on e.excel_info_id=i.excel_info_id
-//				 WHERE e.chart_info_id=? limit 1`
-//		err = o.Raw(sql, chartInfoId).QueryRow(&item)
-//		return
-//	}
 func GetExcelInfoByChartInfoId(chartInfoId int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT i.*
@@ -552,54 +291,7 @@ func GetExcelInfoByChartInfoId(chartInfoId int) (item *ExcelInfo, err error) {
 	return
 }
 
-// 同时删除指标和指标数据
-// func DeleteExcelChartEdbAndData(excelInfoIds []int, chartInfoIds []int) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-// 	// 把对应的表格状态改成删除状态
-// 	//更新图表id
-// 	sql := `update excel_info set is_delete = 1, modify_time = ? where excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `)`
-// 	_, err = o.Raw(sql, time.Now(), excelInfoIds).Exec()
-// 	if err != nil {
-// 		err = fmt.Errorf("更新图表id失败,AddChartEdbAndData: %v", err)
-// 		return
-// 	}
-// 	// 把删除图表状态
-// 	if len(chartInfoIds) > 0 {
-// 		sql := `DELETE FROM chart_info WHERE  chart_info_id in (` + utils.GetOrmInReplace(len(chartInfoIds)) + `)`
-// 		_, err = o.Raw(sql, chartInfoIds).Exec()
-// 		if err != nil {
-// 			err = fmt.Errorf("删除原先的指标失败:%v", err)
-// 			return
-// 		}
-
-// 		// todo 如果加入到我的图库中,则删除我的图库中的数据
-// 	}
-// 	// 删除原先的绑定的指标
-// 	sql = `DELETE FROM excel_chart_edb WHERE  excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `)`
-// 	_, err = o.Raw(sql, excelInfoIds).Exec()
-// 	if err != nil {
-// 		err = fmt.Errorf("删除原先的指标失败:%v", err)
-// 		return
-// 	}
-// 	// 删除指标数据
-// 	sql = `DELETE FROM excel_chart_data WHERE  excel_info_id in (` + utils.GetOrmInReplace(len(excelInfoIds)) + `)`
-// 	_, err = o.Raw(sql, excelInfoIds).Exec()
-// 	if err != nil {
-// 		err = fmt.Errorf("删除原先的指标失败:%v", err)
-// 		return
-// 	}
-// 	return
-// }
+
 
 func DeleteExcelChartEdbAndData(excelInfoIds []int, chartInfoIds []int) (err error) {
 	o := global.DmSQL["data"].Begin()
@@ -610,34 +302,27 @@ func DeleteExcelChartEdbAndData(excelInfoIds []int, chartInfoIds []int) (err err
 			_ = o.Commit()
 		}
 	}()
-	// 把对应的表格状态改成删除状态
-	//更新图表id
 	sql := `update excel_info set is_delete = 1, modify_time = ? where excel_info_id in (` + utils.GetGormInReplace(len(excelInfoIds)) + `)`
 	err = o.Exec(sql, time.Now(), excelInfoIds).Error
 	if err != nil {
 		err = fmt.Errorf("更新图表id失败,AddChartEdbAndData: %v", err)
 		return
 	}
-	// 把删除图表状态
 	if len(chartInfoIds) > 0 {
 		sql := `DELETE FROM chart_info WHERE  chart_info_id in (` + utils.GetGormInReplace(len(chartInfoIds)) + `)`
 		err = o.Exec(sql, chartInfoIds).Error
-		// _, err = o.Raw(sql, chartInfoIds).Exec()
 		if err != nil {
 			err = fmt.Errorf("删除原先的指标失败:%v", err)
 			return
 		}
 
-		// todo 如果加入到我的图库中,则删除我的图库中的数据
 	}
-	// 删除原先的绑定的指标
 	sql = `DELETE FROM excel_chart_edb WHERE  excel_info_id in (` + utils.GetGormInReplace(len(excelInfoIds)) + `)`
 	err = o.Exec(sql, excelInfoIds).Error
 	if err != nil {
 		err = fmt.Errorf("删除原先的指标失败:%v", err)
 		return
 	}
-	// 删除指标数据
 	sql = `DELETE FROM excel_chart_data WHERE  excel_info_id in (` + utils.GetGormInReplace(len(excelInfoIds)) + `)`
 	err = o.Exec(sql, excelInfoIds).Error
 	if err != nil {
@@ -647,42 +332,7 @@ func DeleteExcelChartEdbAndData(excelInfoIds []int, chartInfoIds []int) (err err
 	return
 }
 
-// 删除平衡表中的指标和数据
-// func DeleteBalanceExcelChartInfoAndData(chartInfoId int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	to, err := o.Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = to.Rollback()
-// 		} else {
-// 			_ = to.Commit()
-// 		}
-// 	}()
-
-//		sql := ` DELETE FROM chart_info WHERE chart_info_id=? `
-//		_, err = to.Raw(sql, chartInfoId).Exec()
-//		if err != nil {
-//			err = fmt.Errorf("删除平衡表图表失败 %s", err.Error())
-//			return
-//		}
-//		sql = ` DELETE FROM  excel_chart_edb WHERE chart_info_id=? `
-//		_, err = to.Raw(sql, chartInfoId).Exec()
-//		if err != nil {
-//			err = fmt.Errorf("删除平衡表图表指标失败 %s", err.Error())
-//			return
-//		}
-//		// 删除表格里的数据
-//		sql = ` DELETE FROM  excel_chart_data WHERE chart_info_id=? `
-//		_, err = to.Raw(sql, chartInfoId).Exec()
-//		if err != nil {
-//			err = fmt.Errorf("删除平衡表图表指标失败 %s", err.Error())
-//			return
-//		}
-//		return
-//	}
+
 func DeleteBalanceExcelChartInfoAndData(chartInfoId int) (err error) {
 	o := global.DmSQL["data"]
 	to := o.Begin()
@@ -709,7 +359,6 @@ func DeleteBalanceExcelChartInfoAndData(chartInfoId int) (err error) {
 		err = fmt.Errorf("删除平衡表图表指标失败 %s", err.Error())
 		return
 	}
-	// 删除表格里的数据
 	sql = ` DELETE FROM  excel_chart_data WHERE chart_info_id=? `
 	err = to.Exec(sql, chartInfoId).Error
 	if err != nil {

+ 5 - 194
models/data_manage/excel/excel_classify.go

@@ -7,22 +7,6 @@ import (
 	"time"
 )
 
-// ExcelClassify excel表格分类
-// type ExcelClassify struct {
-// 	ExcelClassifyId   int       `orm:"column(excel_classify_id);pk"`
-// 	Source            int       `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"`
-// 	ExcelClassifyName string    `description:"分类名称"`
-// 	ParentId          int       `description:"父级id"`
-// 	SysUserId         int       `description:"创建人id"`
-// 	SysUserRealName   string    `description:"创建人姓名"`
-// 	Level             int       `description:"层级"`
-// 	UniqueCode        string    `description:"唯一编码"`
-// 	Sort              int       `description:"排序字段,越小越靠前,默认值:10"`
-// 	IsDelete          int       `description:"排序字段,越小越靠前,默认值:10"`
-// 	CreateTime        time.Time `description:"创建时间"`
-// 	ModifyTime        time.Time `description:"修改时间"`
-// 	IsJoinPermission  int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
-// }
 
 type ExcelClassify struct {
 	ExcelClassifyId   int       `gorm:"column:excel_classify_id;primaryKey" orm:"column(excel_classify_id);pk"` // 主键
@@ -40,22 +24,11 @@ type ExcelClassify struct {
 	IsJoinPermission  int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0" gorm:"column:is_join_permission"`
 }
 
-// TableName 设置模型对应的表名
 func (ExcelClassify) TableName() string {
 	return "excel_classify"
 }
 
-// AddExcelClassify 添加excel分类
-// func AddExcelClassify(item *ExcelClassify) (lastId int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err = o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-// 	item.ExcelClassifyId = int(lastId)
-
-//		return
-//	}
+
 func AddExcelClassify(item *ExcelClassify) (lastId int64, err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(item).Error
@@ -66,14 +39,6 @@ func AddExcelClassify(item *ExcelClassify) (lastId int64, err error) {
 	return
 }
 
-// GetExcelClassifyCount 获取同级分类下存在同名分类的数量
-//
-//	func GetExcelClassifyCount(ExcelClassifyName string, parentId, source int) (count int, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := `SELECT COUNT(1) AS count FROM excel_classify WHERE parent_id=? AND source = ? AND excel_classify_name=? AND is_delete=0 `
-//		err = o.Raw(sql, parentId, source, ExcelClassifyName).QueryRow(&count)
-//		return
-//	}
 
 func GetExcelClassifyCount(ExcelClassifyName string, parentId, source int) (count int, err error) {
 	o := global.DmSQL["data"]
@@ -82,12 +47,6 @@ func GetExcelClassifyCount(ExcelClassifyName string, parentId, source int) (coun
 	return
 }
 
-//	func GetExcelClassifyById(classifyId int) (item *ExcelClassify, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := `SELECT * FROM excel_classify WHERE excel_classify_id=? AND is_delete=0 `
-//		err = o.Raw(sql, classifyId).QueryRow(&item)
-//		return
-//	}
 func GetExcelClassifyById(classifyId int) (item *ExcelClassify, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM excel_classify WHERE excel_classify_id=? AND is_delete=0 `
@@ -95,31 +54,7 @@ func GetExcelClassifyById(classifyId int) (item *ExcelClassify, err error) {
 	return
 }
 
-// GetExcelClassifyByIdList
-// @Description: 根据分类id列表获取所有分类信息
-// @author: Roc
-// @datetime 2024-04-07 16:24:04
-// @param classifyIdList []int
-// @return items []*ExcelClassify
-// @return err error
-// func GetExcelClassifyByIdList(classifyIdList []int) (items []*ExcelClassify, err error) {
-// 	num := len(classifyIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM excel_classify WHERE excel_classify_id in (` + utils.GetOrmInReplace(num) + `) AND is_delete=0 `
-// 	_, err = o.Raw(sql, classifyIdList).QueryRows(&items)
-// 	return
-// }
-
-// GetExcelClassifyByIdList
-// @Description: 根据分类id列表获取所有分类信息
-// @author: zqbao
-// @datetime 2024-04-07 16:24:04
-// @param classifyIdList []int
-// @return items []*ExcelClassify
-// @return err error
+
 func GetExcelClassifyByIdList(classifyIdList []int) (items []*ExcelClassify, err error) {
 	num := len(classifyIdList)
 	if num <= 0 {
@@ -131,28 +66,8 @@ func GetExcelClassifyByIdList(classifyIdList []int) (items []*ExcelClassify, err
 	return
 }
 
-// GetExcelClassifyBySourceAndIsJoinPermission
-// @Description: 根据分类id列表获取所有分类信息
-// @author: Roc
-// @datetime 2024-04-07 16:24:04
-// @param classifyIdList []int
-// @return items []*ExcelClassify
-// @return err error
-// func GetExcelClassifyBySourceAndIsJoinPermission(source, isJoinPermission int) (items []*ExcelClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM excel_classify WHERE source = ? AND is_join_permission = ? `
-// 	_, err = o.Raw(sql, source, isJoinPermission).QueryRows(&items)
-
-// 	return
-// }
-
-// GetExcelClassifyBySourceAndIsJoinPermission
-// @Description: 根据分类id列表获取所有分类信息
-// @author: zqbao
-// @datetime 2024-04-07 16:24:04
-// @param classifyIdList []int
-// @return items []*ExcelClassify
-// @return err error
+
+
 func GetExcelClassifyBySourceAndIsJoinPermission(source, isJoinPermission int) (items []*ExcelClassify, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM excel_classify WHERE source = ? AND is_join_permission = ? `
@@ -160,12 +75,6 @@ func GetExcelClassifyBySourceAndIsJoinPermission(source, isJoinPermission int) (
 	return
 }
 
-//	func GetChildClassifyById(classifyId int) (items []*ExcelClassify, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := `SELECT * FROM excel_classify WHERE parent_id=? AND is_delete=0 `
-//		_, err = o.Raw(sql, classifyId).QueryRows(&items)
-//		return
-//	}
 
 func GetChildClassifyById(classifyId int) (items []*ExcelClassify, err error) {
 	o := global.DmSQL["data"]
@@ -181,12 +90,6 @@ func GetExcelClassifyByParentId(parentId, source int) (items []*ExcelClassifyIte
 	return
 }
 
-//	func GetExcelClassifyBySource(source int) (items []*ExcelClassifyItems, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := ` SELECT * FROM excel_classify WHERE  source = ? AND is_delete=0 order by sort asc,excel_classify_id asc`
-//		_, err = o.Raw(sql, source).QueryRows(&items)
-//		return
-//	}
 func GetExcelClassifyBySource(source int) (items []*ExcelClassifyItems, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_classify WHERE  source = ? AND is_delete=0 order by sort asc,excel_classify_id asc`
@@ -194,12 +97,6 @@ func GetExcelClassifyBySource(source int) (items []*ExcelClassifyItems, err erro
 	return
 }
 
-//	func GetExcelClassifyBySourceOrderByLevel(source int) (items []*ExcelClassifyItems, err error) {
-//		o := orm.NewOrmUsingDB("data")
-//		sql := ` SELECT * FROM excel_classify WHERE  source = ? AND is_delete=0 order by level asc, sort asc,excel_classify_id asc`
-//		_, err = o.Raw(sql, source).QueryRows(&items)
-//		return
-//	}
 
 func GetExcelClassifyBySourceOrderByLevel(source int) (items []*ExcelClassifyItems, err error) {
 	o := global.DmSQL["data"]
@@ -215,21 +112,6 @@ func GetExcelClassifyAll() (items []*ExcelClassifyItems, err error) {
 	return
 }
 
-//	type ExcelClassifyItems struct {
-//		ExcelClassifyId   int `description:"分类id"`
-//		ExcelInfoId       int `description:"表格id"`
-//		ExcelClassifyName string
-//		ParentId          int
-//		Level             int    `description:"层级"`
-//		Sort              int    `description:"排序字段,越小越靠前,默认值:10"`
-//		UniqueCode        string `description:"唯一编码"`
-//		SysUserId         int    `description:"创建人id"`
-//		SysUserRealName   string `description:"创建人姓名"`
-//		StartDate         string `description:"自定义开始日期"`
-//		Children          []*ExcelClassifyItems
-//		IsJoinPermission  int  `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
-//		HaveOperaAuth     bool `description:"是否有数据权限"`
-//	}
 type ExcelClassifyItems struct {
 	ExcelClassifyId   int                   `gorm:"column:excel_classify_id" description:"分类id"` // 分类id
 	ExcelInfoId       int                   `gorm:"column:excel_info_id" description:"表格id"`     // 表格id
@@ -246,7 +128,6 @@ type ExcelClassifyItems struct {
 	HaveOperaAuth     bool                  `gorm:"column:have_opener_auth" description:"是否有数据权限"`                    // 是否有数据权限
 }
 
-// TableName 设置模型对应的表名
 func (ExcelClassifyItems) TableName() string {
 	return "excel_classify_items"
 }
@@ -261,17 +142,6 @@ func GetExcelClassifyByCondition(condition string, pars []interface{}) (item *Ex
 	return
 }
 
-// GetNextExcelClassifyByCondition 获取下一个分类
-// func GetNextExcelClassifyByCondition(condition string, pars []interface{}) (item *ExcelClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_classify WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += " ORDER BY sort asc , create_time ASC LIMIT 1 "
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
 
 func GetNextExcelClassifyByCondition(condition string, pars []interface{}) (item *ExcelClassify, err error) {
 	o := global.DmSQL["data"]
@@ -284,13 +154,6 @@ func GetNextExcelClassifyByCondition(condition string, pars []interface{}) (item
 	return
 }
 
-// GetFirstExcelClassifyByParentId 获取当前父级图表分类下的排序第一条的数据
-// func GetFirstExcelClassifyByParentId(parentId int) (item *ExcelClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_classify WHERE parent_id=? AND is_delete=0 order by sort asc,excel_classify_id asc limit 1`
-// 	err = o.Raw(sql, parentId).QueryRow(&item)
-// 	return
-// }
 
 func GetFirstExcelClassifyByParentId(parentId int) (item *ExcelClassify, err error) {
 	o := global.DmSQL["data"]
@@ -299,16 +162,6 @@ func GetFirstExcelClassifyByParentId(parentId int) (item *ExcelClassify, err err
 	return
 }
 
-// UpdateExcelClassifySortByParentId 根据图表父类id更新排序
-// func UpdateExcelClassifySortByParentId(parentId, classifyId, nowSort int, updateSort string, source int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` update excel_classify set sort = ` + updateSort + ` WHERE parent_id=? and source=? and sort > ? AND is_delete=0 `
-// 	if classifyId > 0 {
-// 		sql += ` or ( excel_classify_id > ` + fmt.Sprint(classifyId) + ` and sort= ` + fmt.Sprint(nowSort) + `)`
-// 	}
-// 	_, err = o.Raw(sql, parentId, source, nowSort).Exec()
-// 	return
-// }
 
 func UpdateExcelClassifySortByParentId(parentId, classifyId, nowSort int, updateSort string, source int) (err error) {
 	o := global.DmSQL["data"]
@@ -320,12 +173,6 @@ func UpdateExcelClassifySortByParentId(parentId, classifyId, nowSort int, update
 	return
 }
 
-// Update 更新图表分类基础信息
-// func (ExcelClassify *ExcelClassify) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(ExcelClassify, cols...)
-// 	return
-// }
 
 func (ExcelClassify *ExcelClassify) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
@@ -333,13 +180,6 @@ func (ExcelClassify *ExcelClassify) Update(cols []string) (err error) {
 	return
 }
 
-// GetExcelClassifyMaxSort 获取图表分类下最大的排序数
-// func GetExcelClassifyMaxSort(parentId int, source int) (sort int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT Max(sort) AS sort FROM excel_classify WHERE parent_id=? AND source = ? AND is_delete=0 `
-// 	err = o.Raw(sql, parentId, source).QueryRow(&sort)
-// 	return
-// }
 
 func GetExcelClassifyMaxSort(parentId int, source int) (sort int, err error) {
 	o := global.DmSQL["data"]
@@ -348,23 +188,12 @@ func GetExcelClassifyMaxSort(parentId int, source int) (sort int, err error) {
 	return
 }
 
-//	type ExcelClassifyView struct {
-//		ExcelClassifyId   int    `orm:"column(excel_classify_id);pk"`
-//		ExcelClassifyName string `description:"分类名称"`
-//		ParentId          int    `description:"父级id"`
-//	}
 type ExcelClassifyView struct {
 	ExcelClassifyId   int    `orm:"column(excel_classify_id);pk" gorm:"column:excel_classify_id;primaryKey"` // 主键
 	ExcelClassifyName string `description:"分类名称" gorm:"column:excel_classify_name"`                          // 分类名称
 	ParentId          int    `description:"父级id" gorm:"column:parent_id"`                                    // 父级id
 }
 
-// func GetExcelClassifyViewById(classifyId int) (item *ExcelClassifyView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM excel_classify WHERE excel_classify_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&item)
-// 	return
-// }
 
 func GetExcelClassifyViewById(classifyId int) (item *ExcelClassifyView, err error) {
 	o := global.DmSQL["data"]
@@ -373,18 +202,10 @@ func GetExcelClassifyViewById(classifyId int) (item *ExcelClassifyView, err erro
 	return
 }
 
-// ExcelClassifyItemBySort 自定义比较函数,按年龄从小到大排序
 func ExcelClassifyItemBySort(p1, p2 *ExcelClassifyItems) bool {
 	return p1.Sort < p2.Sort
 }
 
-// GetClassifyByIdList
-// @Description: 根据分类ID列表获取分类列表
-// @author: Roc
-// @datetime 2024-04-02 19:40:30
-// @param classifyIdList []int
-// @return items []*ExcelClassify
-// @return err error
 func GetClassifyByIdList(classifyIdList []int) (items []*ExcelClassify, err error) {
 	num := len(classifyIdList)
 	if num <= 0 {
@@ -396,14 +217,4 @@ func GetClassifyByIdList(classifyIdList []int) (items []*ExcelClassify, err erro
 	return
 }
 
-// func GetClassifyByIdList(classifyIdList []int) (items []*ExcelClassify, err error) {
-// 	num := len(classifyIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM excel_classify WHERE excel_classify_id in (` + utils.GetOrmInReplace(num) + `) AND is_delete=0 `
-// 	_, err = o.Raw(sql, classifyIdList).QueryRows(&items)
-
-// 	return
-// }
+

+ 0 - 14
models/data_manage/excel/excel_draft.go

@@ -5,17 +5,6 @@ import (
 	"time"
 )
 
-// ExcelDraft 沙盘推演草稿表
-//
-//	type ExcelDraft struct {
-//		ExcelDraftId int       `orm:"column(excel_draft_id);pk" description:"excel表格草稿记录id"`
-//		ExcelId      int       `description:"excel表格id"`
-//		Name         string    `description:"excel表格名称"`
-//		Content      string    `description:"excel数据"`
-//		OpUserId     int       `description:"最近一次编辑操作的用户id"`
-//		OpUserName   string    `description:"最近一次编辑的用户名称(冗余字段,避免查表)"`
-//		CreateTime   time.Time `description:"创建时间"`
-//	}
 type ExcelDraft struct {
 	ExcelDraftId int       `gorm:"column:excel_draft_id;primaryKey" description:"excel表格草稿记录id"`
 	ExcelId      int       `gorm:"column:excel_id" description:"excel表格id"`
@@ -26,15 +15,12 @@ type ExcelDraft struct {
 	CreateTime   time.Time `gorm:"column:create_time" description:"创建时间"`
 }
 
-// AddExcelDraft 添加一个新的excel表格草稿
 func AddExcelDraft(excelDraft *ExcelDraft) (err error) {
 	o := global.DmSQL["data"]
-	// 新增草稿
 	err = o.Create(excelDraft).Error
 	return
 }
 
-// GetLastExcelDraftById 根据沙盘id获取最后一条沙盘草稿详情
 func GetLastExcelDraftById(excelId int) (excelDraft *ExcelDraft, err error) {
 	o := global.DmSQL["data"]
 	sql := `select * from excel_draft where excel_id = ? order by excel_draft_id desc `

+ 0 - 130
models/data_manage/excel/excel_edb_mapping.go

@@ -7,16 +7,6 @@ import (
 	"time"
 )
 
-//	type ExcelEdbMapping struct {
-//		ExcelEdbMappingId int       `orm:"column(excel_edb_mapping_id);pk"`
-//		ExcelInfoId       int       `description:"excel的id"`
-//		Source            int       `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"`
-//		EdbInfoId         int       `description:"计算指标id"`
-//		CreateTime        time.Time `description:"创建时间"`
-//		ModifyTime        time.Time `description:"修改时间"`
-//	}
-//
-// ExcelEdbMapping excel与指标的关系表
 type ExcelEdbMapping struct {
 	ExcelEdbMappingId int       `gorm:"column:excel_edb_mapping_id;primaryKey"`
 	ExcelInfoId       int       `gorm:"column:excel_info_id" description:"excel的id"`
@@ -26,21 +16,18 @@ type ExcelEdbMapping struct {
 	ModifyTime        time.Time `gorm:"column:modify_time" description:"修改时间"`
 }
 
-// AddExcelEdbMappingMulti 批量添加excel与指标的关系
 func AddExcelEdbMappingMulti(items []*ExcelEdbMapping) (err error) {
 	o := global.DmSQL["data"]
 	err = o.CreateInBatches(items, utils.MultiAddNum).Error
 	return
 }
 
-// Add 添加excel与指标的关系
 func (e *ExcelEdbMapping) Add() (err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(e).Error
 	return
 }
 
-// GetExcelEdbMappingByEdbInfoId 根据指标id获取配置关系
 func GetExcelEdbMappingByEdbInfoId(edbInfoId int) (item *ExcelEdbMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT *  FROM excel_edb_mapping WHERE 1=1 AND edb_info_id = ? `
@@ -49,7 +36,6 @@ func GetExcelEdbMappingByEdbInfoId(edbInfoId int) (item *ExcelEdbMapping, err er
 	return
 }
 
-// GetExcelEdbMappingByExcelInfoId 根据excel的id获取配置关系
 func GetExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT *  FROM excel_edb_mapping AS a 
@@ -60,51 +46,12 @@ func GetExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMapping,
 	return
 }
 
-// // AddExcelEdbMappingMulti 批量添加excel与指标的关系
-// func AddExcelEdbMappingMulti(items []*ExcelEdbMapping) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.InsertMulti(len(items), items)
-// 	return
-// }
 
-// // Add 添加excel与指标的关系
-// func (e *ExcelEdbMapping) Add() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Insert(e)
-// 	return
-// }
 
-// // GetExcelEdbMappingByEdbInfoId 根据指标id获取配置关系
-// func GetExcelEdbMappingByEdbInfoId(edbInfoId int) (item *ExcelEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *  FROM excel_edb_mapping WHERE 1=1 AND edb_info_id = ? `
 
-// 	err = o.Raw(sql, edbInfoId).QueryRow(&item)
-// 	return
-// }
 
-// // GetExcelEdbMappingByExcelInfoId 根据excel的id获取配置关系
-// func GetExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *  FROM excel_edb_mapping AS a
-//            join edb_info as b on a.edb_info_id = b.edb_info_id
-//            WHERE 1=1 AND a.excel_info_id = ? `
-// 	_, err = o.Raw(sql, excelInfoId).QueryRows(&items)
 
-// 	return
-// }
 
-//	type ExcelEdbMappingItem struct {
-//		EdbInfoId        int    `description:"指标id"`
-//		UniqueCode       string `description:"唯一编码"`
-//		EdbName          string `description:"指标名称"`
-//		ClassifyId       int    `description:"分类id"`
-//		Frequency        string `description:"频度"`
-//		Unit             string `description:"单位"`
-//		CalculateFormula string `json:"-"`
-//		DateSequenceStr  string `description:"日期序列公式"`
-//		DataSequenceStr  string `description:"数据序列公式"`
-//	}
 type ExcelEdbMappingItem struct {
 	EdbInfoId        int    `gorm:"column:edb_info_id" description:"指标id"`
 	UniqueCode       string `gorm:"column:unique_code" description:"唯一编码"`
@@ -117,13 +64,11 @@ type ExcelEdbMappingItem struct {
 	DataSequenceStr  string `gorm:"column:data_sequence_str" description:"数据序列公式"`
 }
 
-// CalculateFormula 计算公式
 type CalculateFormula struct {
 	DateSequenceStr string `json:"DateSequenceStr"`
 	DataSequenceStr string `json:"DataSequenceStr"`
 }
 
-// GetAllExcelEdbMappingItemByExcelInfoId 根据品种id获取所有的指标结果集
 func GetAllExcelEdbMappingItemByExcelInfoId(excelInfoId int) (items []*ExcelEdbMappingItem, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT a.edb_info_id,a.unique_code,a.edb_name,a.classify_id,a.frequency,a.unit,calculate_formula FROM edb_info AS a 
@@ -133,7 +78,6 @@ func GetAllExcelEdbMappingItemByExcelInfoId(excelInfoId int) (items []*ExcelEdbM
 	return
 }
 
-// GetNoCustomAnalysisExcelEdbMappingCount 根据指标id获取非自定义分析的关联关系
 func GetNoCustomAnalysisExcelEdbMappingCount(edbInfoId int) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT COUNT(1) AS count FROM excel_edb_mapping a 
@@ -143,7 +87,6 @@ func GetNoCustomAnalysisExcelEdbMappingCount(edbInfoId int) (count int, err erro
 	return
 }
 
-// GetAllExcelEdbMappingByExcelInfoId 根据excel的id获取所有的指标
 func GetAllExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT a.* FROM  excel_edb_mapping a
@@ -152,12 +95,6 @@ func GetAllExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMappi
 	return
 }
 
-// DeleteCustomAnalysisExcelEdbMappingByEdbInfoId
-// @Description: 根据指标id删除与自定义分析表格的关系
-// @author: Roc
-// @datetime 2023-11-02 13:20:02
-// @param excelInfoId int
-// @return err error
 func DeleteCustomAnalysisExcelEdbMappingByEdbInfoId(excelInfoId int) (err error) {
 	o := global.DmSQL["data"]
 	sql := `DELETE FROM excel_edb_mapping WHERE source = ? AND edb_info_id = ? LIMIT 1`
@@ -166,7 +103,6 @@ func DeleteCustomAnalysisExcelEdbMappingByEdbInfoId(excelInfoId int) (err error)
 	return
 }
 
-// GetExcelEdbMappingItemByExcelInfoIdOrKeyword 根据表格ID或关键词获取指标
 func GetExcelEdbMappingItemByExcelInfoIdOrKeyword(excelInfoId int, keyword string) (items []*ExcelEdbMappingItem, err error) {
 	o := global.DmSQL["data"]
 	cond := `b.excel_info_id = ?`
@@ -195,74 +131,8 @@ func GetExcelEdbMappingItemByExcelInfoIdOrKeyword(excelInfoId int, keyword strin
 	return
 }
 
-// GetAllExcelEdbMappingItemByExcelInfoId 根据品种id获取所有的指标结果集
-// func GetAllExcelEdbMappingItemByExcelInfoId(excelInfoId int) (items []*ExcelEdbMappingItem, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT a.edb_info_id,a.unique_code,a.edb_name,a.classify_id,a.frequency,a.unit,calculate_formula FROM edb_info AS a
-//          JOIN excel_edb_mapping AS b ON a.edb_info_id=b.edb_info_id
-//          WHERE b.excel_info_id = ? ORDER BY b.excel_edb_mapping_id ASC `
-// 	_, err = o.Raw(sql, excelInfoId).QueryRows(&items)
-// 	return
-// }
 
-// // GetNoCustomAnalysisExcelEdbMappingCount 根据指标id获取非自定义分析的关联关系
-// func GetNoCustomAnalysisExcelEdbMappingCount(edbInfoId int) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT COUNT(1) AS count FROM excel_edb_mapping a
-//                           join excel_info b on a.excel_info_id=b.excel_info_id
-//                           WHERE edb_info_id=? AND a.source != 4 AND b.is_delete = 0`
-// 	err = o.Raw(sql, edbInfoId).QueryRow(&count)
-// 	return
-// }
 
-// // GetAllExcelEdbMappingByExcelInfoId 根据excel的id获取所有的指标
-// func GetAllExcelEdbMappingByExcelInfoId(excelInfoId int) (items []*ExcelEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT a.* FROM  excel_edb_mapping a
-//          WHERE a.excel_info_id = ? ORDER BY a.excel_edb_mapping_id ASC `
-// 	_, err = o.Raw(sql, excelInfoId).QueryRows(&items)
-// 	return
-// }
 
-// // DeleteCustomAnalysisExcelEdbMappingByEdbInfoId
-// // @Description: 根据指标id删除与自定义分析表格的关系
-// // @author: Roc
-// // @datetime 2023-11-02 13:20:02
-// // @param excelInfoId int
-// // @return err error
-// func DeleteCustomAnalysisExcelEdbMappingByEdbInfoId(excelInfoId int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `DELETE FROM excel_edb_mapping WHERE source = ? AND edb_info_id = ? LIMIT 1`
-// 	_, err = o.Raw(sql, utils.CUSTOM_ANALYSIS_TABLE, excelInfoId).Exec()
 
-// 	return
-// }
 
-// // GetExcelEdbMappingItemByExcelInfoIdOrKeyword 根据表格ID或关键词获取指标
-// func GetExcelEdbMappingItemByExcelInfoIdOrKeyword(excelInfoId int, keyword string) (items []*ExcelEdbMappingItem, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	cond := `b.excel_info_id = ?`
-// 	pars := make([]interface{}, 0)
-// 	pars = append(pars, excelInfoId)
-// 	if keyword != "" {
-// 		cond += ` AND (a.edb_code LIKE ? OR a.edb_name LIKE ?)`
-// 		pars = append(pars, keyword, keyword)
-// 	}
-// 	sql := fmt.Sprintf(`SELECT
-// 			a.edb_info_id,
-// 			a.unique_code,
-// 			a.edb_name,
-// 			a.classify_id,
-// 			a.frequency,
-// 			a.unit,
-// 			calculate_formula
-// 		FROM
-// 			edb_info AS a
-// 		JOIN excel_edb_mapping AS b ON a.edb_info_id = b.edb_info_id
-// 		WHERE
-// 			%s
-// 		ORDER BY
-// 			b.excel_edb_mapping_id ASC`, cond)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }

+ 60 - 706
models/data_manage/excel/excel_info.go

@@ -7,31 +7,6 @@ import (
 	"time"
 )
 
-// ExcelInfo excel表格详情表
-//
-//	type ExcelInfo struct {
-//		ExcelInfoId        int       `orm:"column(excel_info_id);pk"`
-//		Source             int       `description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"`
-//		ExcelType          int       `description:"表格类型,1:指标列,2:日期列,默认:1"`
-//		ExcelName          string    `description:"表格名称"`
-//		UniqueCode         string    `description:"表格唯一编码"`
-//		ExcelClassifyId    int       `description:"表格分类id"`
-//		SysUserId          int       `description:"操作人id"`
-//		SysUserRealName    string    `description:"操作人真实姓名"`
-//		Content            string    `description:"表格内容"`
-//		ExcelImage         string    `description:"表格图片"`
-//		FileUrl            string    `description:"表格下载地址"`
-//		Sort               int       `description:"排序字段,数字越小越排前面"`
-//		IsDelete           int       `description:"是否删除,0:未删除,1:已删除"`
-//		ModifyTime         time.Time `description:"最近修改日期"`
-//		CreateTime         time.Time `description:"创建日期"`
-//		IsJoinPermission   int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
-//		BalanceType        int       `description:"平衡表类型:0 动态表,1静态表"`
-//		UpdateUserId       int       `description:"更新人id"`
-//		UpdateUserRealName string    `description:"更新人真实姓名"`
-//		RelExcelInfoId     int       `description:"平衡表里静态表关联的动态表excel id"`
-//		VersionName        string    `description:"静态表版本名称"`
-//	}
 type ExcelInfo struct {
 	ExcelInfoId        int       `gorm:"column:excel_info_id;primaryKey" orm:"column(excel_info_id);pk"`
 	Source             int       `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,3:混合表格,4:自定义分析,默认:1"`
@@ -56,30 +31,12 @@ type ExcelInfo struct {
 	VersionName        string    `gorm:"column:version_name" description:"静态表版本名称"`
 }
 
-// Update 更新 excel表格基础信息
 func (excelInfo *ExcelInfo) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(excelInfo).Select(cols).Updates(excelInfo).Error
 	return
 }
 
-//	type MyExcelInfoList struct {
-//		ExcelInfoId      int       `orm:"column(excel_info_id);pk"`
-//		Source           int       `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
-//		ExcelType        int       `description:"表格类型,1:指标列,2:日期列,默认:1"`
-//		ExcelName        string    `description:"表格名称"`
-//		UniqueCode       string    `description:"表格唯一编码"`
-//		ExcelClassifyId  int       `description:"表格分类id"`
-//		SysUserId        int       `description:"操作人id"`
-//		SysUserRealName  string    `description:"操作人真实姓名"`
-//		ExcelImage       string    `description:"表格图片"`
-//		FileUrl          string    `description:"表格下载地址"`
-//		Sort             int       `description:"排序字段,数字越小越排前面"`
-//		ModifyTime       time.Time `description:"最近修改日期"`
-//		CreateTime       time.Time `description:"创建日期"`
-//		IsJoinPermission int       `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
-//		HaveOperaAuth    bool      `description:"是否有数据权限"`
-//	}
 type MyExcelInfoList struct {
 	ExcelInfoId      int       `gorm:"column:excel_info_id;primaryKey" orm:"column(excel_info_id);pk"`
 	Source           int       `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
@@ -98,7 +55,6 @@ type MyExcelInfoList struct {
 	HaveOperaAuth    bool      `gorm:"column:have_opera_auth" description:"是否有数据权限"`
 }
 
-// AddExcelInfo 新增表格
 func AddExcelInfo(excelInfo *ExcelInfo, excelEdbMappingList []*ExcelEdbMapping) (err error) {
 	o := global.DmSQL["data"].Begin()
 	defer func() {
@@ -108,13 +64,11 @@ func AddExcelInfo(excelInfo *ExcelInfo, excelEdbMappingList []*ExcelEdbMapping)
 			_ = o.Commit()
 		}
 	}()
-	// 表格信息入库
 	err = o.Create(excelInfo).Error
 	if err != nil {
 		return
 	}
 
-	// excel与指标的关联关系
 	dataNum := len(excelEdbMappingList)
 	if dataNum > 0 {
 		for k, v := range excelEdbMappingList {
@@ -127,7 +81,6 @@ func AddExcelInfo(excelInfo *ExcelInfo, excelEdbMappingList []*ExcelEdbMapping)
 	return
 }
 
-// EditExcelInfo 编辑表格
 func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string, excelEdbMappingList []*ExcelEdbMapping) (err error) {
 	o := global.DmSQL["data"].Begin()
 	defer func() {
@@ -138,20 +91,17 @@ func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string, excelEd
 		}
 	}()
 
-	// ETA表格信息变更
 	err = o.Model(excelInfo).Select(updateExcelInfoParams).Updates(excelInfo).Error
 	if err != nil {
 		return
 	}
 
-	// 删除关系表
 	sql := `DELETE FROM excel_edb_mapping WHERE excel_info_id=? `
 	err = o.Exec(sql, excelInfo.ExcelInfoId).Error
 	if err != nil {
 		return
 	}
 
-	// excel与指标的关联关系
 	dataNum := len(excelEdbMappingList)
 	if dataNum > 0 {
 		for k, v := range excelEdbMappingList {
@@ -164,7 +114,6 @@ func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string, excelEd
 	return
 }
 
-// GetExcelInfoAll 获取所有表格列表,用于分类展示
 func GetExcelInfoAll() (items []*ExcelClassifyItems, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
@@ -174,7 +123,6 @@ func GetExcelInfoAll() (items []*ExcelClassifyItems, err error) {
 	return
 }
 
-// GetNoContentExcelInfoAll 获取不含content的表格列表 用于分类展示
 func GetNoContentExcelInfoAll(source, userId int) (items []*ExcelClassifyItems, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
@@ -192,7 +140,6 @@ func GetNoContentExcelInfoAll(source, userId int) (items []*ExcelClassifyItems,
 	return
 }
 
-// GetAllExcelInfoBySource 根据来源获取包含content的表格列表
 func GetAllExcelInfoBySource(source int) (items []*ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info where is_delete=0  AND source = ?  ORDER BY sort asc,create_time desc `
@@ -200,7 +147,6 @@ func GetAllExcelInfoBySource(source int) (items []*ExcelInfo, err error) {
 	return
 }
 
-// GetExcelInfoById 根据id 获取eta表格详情
 func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
@@ -208,7 +154,6 @@ func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
 	return
 }
 
-// GetExcelInfoByUnicode 编码获取表格
 func GetExcelInfoByUnicode(unicode string) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE unique_code = ? AND is_delete = 0 `
@@ -257,7 +202,6 @@ func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelI
 	return
 }
 
-// GetNextExcelInfoByCondition 根据条件获取下一个表格
 func GetNextExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
@@ -269,7 +213,6 @@ func GetNextExcelInfoByCondition(condition string, pars []interface{}) (item *Ex
 	return
 }
 
-// GetNextExcelInfo 根据分类id获取下一个excel表格
 func GetNextExcelInfo(classifyId, classifySort, source int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT b.* FROM excel_classify AS a
@@ -282,7 +225,6 @@ func GetNextExcelInfo(classifyId, classifySort, source int) (item *ExcelInfo, er
 	return
 }
 
-// EditExcelInfoImage 修改excel表格的图片
 func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
 	o := global.DmSQL["data"]
 
@@ -295,7 +237,6 @@ func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
 	return
 }
 
-// GetExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
 func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE unique_code=? AND is_delete=0 `
@@ -303,7 +244,6 @@ func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfo, err error) {
 	return
 }
 
-// GetFirstExcelInfoByClassifyId 获取当前分类下,且排序数相同 的排序第一条的数据
 func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id=? AND is_delete=0 order by sort asc,excel_info_id desc limit 1`
@@ -311,11 +251,9 @@ func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error)
 	return
 }
 
-// UpdateExcelInfoSortByClassifyId 根据表格id更新排序
 func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string, source int) (err error) {
 	o := global.DmSQL["data"]
 	sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? AND source=? AND is_delete=0 AND ( sort > ? `
-	// todo 前一个兄弟节点后移
 	if prevExcelInfoId > 0 {
 		sql += ` or (excel_info_id < ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
 	}
@@ -324,267 +262,34 @@ func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, u
 	return
 }
 
-// AddExcelInfo 新增表格
-// func AddExcelInfo(excelInfo *ExcelInfo, excelEdbMappingList []*ExcelEdbMapping) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(excelInfo)
-// 	if err != nil {
-// 		return
-// 	}
-// 	excelInfo.ExcelInfoId = int(lastId)
-
-// 	// excel与指标的关联关系
-// 	dataNum := len(excelEdbMappingList)
-// 	if dataNum > 0 {
-// 		for k, v := range excelEdbMappingList {
-// 			v.ExcelInfoId = excelInfo.ExcelInfoId
-// 			excelEdbMappingList[k] = v
-// 		}
-// 		_, err = o.InsertMulti(dataNum, excelEdbMappingList)
-// 	}
-
-// 	return
-// }
-
-// // EditExcelInfo 编辑表格
-// func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string, excelEdbMappingList []*ExcelEdbMapping) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-
-// 	// ETA表格信息变更
-// 	_, err = o.Update(excelInfo, updateExcelInfoParams...)
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	// 删除关系表
-// 	sql := `DELETE FROM excel_edb_mapping WHERE excel_info_id=? `
-// 	_, err = o.Raw(sql, excelInfo.ExcelInfoId).Exec()
-
-// 	// excel与指标的关联关系
-// 	dataNum := len(excelEdbMappingList)
-// 	if dataNum > 0 {
-// 		for k, v := range excelEdbMappingList {
-// 			v.ExcelInfoId = excelInfo.ExcelInfoId
-// 			excelEdbMappingList[k] = v
-// 		}
-// 		_, err = o.InsertMulti(dataNum, excelEdbMappingList)
-// 	}
-
-// 	return
-// }
-
-// GetExcelInfoAll 获取所有表格列表,用于分类展示
-// func GetExcelInfoAll() (items []*ExcelClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
-//              unique_code,sys_user_id,sys_user_real_name,is_join_permission
-//             FROM excel_info where is_delete=0 ORDER BY sort asc,create_time ASC `
-// 	_, err = o.Raw(sql).QueryRows(&items)
-// 	return
-// }
-
-// // GetNoContentExcelInfoAll 获取不含content的表格列表 用于分类展示
-// func GetNoContentExcelInfoAll(source, userId int) (items []*ExcelClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
-//              unique_code,sys_user_id,sys_user_real_name,sort,is_join_permission
-//             FROM excel_info where is_delete=0 AND source = ?  `
-
-// 	pars := []interface{}{source}
-
-// 	if userId > 0 {
-// 		sql += ` AND sys_user_id = ? `
-// 		pars = append(pars, userId)
-// 	}
-// 	sql += `  ORDER BY sort asc,excel_info_id desc `
-// 	_, err = o.Raw(sql, pars...).QueryRows(&items)
-// 	return
-// }
-
-// // GetAllExcelInfoBySource 根据来源获取包含content的表格列表
-// func GetAllExcelInfoBySource(source int) (items []*ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info where is_delete=0  AND source = ?  ORDER BY sort asc,create_time desc `
-// 	_, err = o.Raw(sql, source).QueryRows(&items)
-// 	return
-// }
-
-// // GetExcelInfoById 根据id 获取eta表格详情
-// func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// // GetExcelInfoByUnicode 编码获取表格
-// func GetExcelInfoByUnicode(unicode string) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE unique_code = ? AND is_delete = 0 `
-// 	err = o.Raw(sql, unicode).QueryRow(&item)
-// 	return
-// }
-
-// func GetExcelInfoViewById(excelInfoId int) (item *ExcelInfoView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// func GetExcelInfoCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// func GetNoContentExcelInfoListByCondition(condition string, pars []interface{}, startSize, pageSize int) (items []*ExcelClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
-//              unique_code,sys_user_id,sys_user_real_name,sort,is_join_permission FROM excel_info WHERE 1=1 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-
-// 	sql += ` AND is_delete=0 ORDER BY excel_info_id DESC LIMIT ?,? `
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-// 	return
-// }
-
-// func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// // GetNextExcelInfoByCondition 根据条件获取下一个表格
-// func GetNextExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += " ORDER BY sort asc , create_time desc LIMIT 1 "
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// // GetNextExcelInfo 根据分类id获取下一个excel表格
-// func GetNextExcelInfo(classifyId, classifySort, source int) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT b.* FROM excel_classify AS a
-// 			INNER JOIN excel_info AS b ON a.excel_classify_id=b.excel_classify_id
-// 			WHERE (a.sort>? OR (a.sort=? and a.excel_classify_id>?) ) AND a.is_delete=0 AND b.is_delete=0
-// 			AND a.source = ? AND b.source = ?
-// 			ORDER BY a.sort ASC,b.sort asc,b.create_time desc
-// 			LIMIT 1 `
-// 	err = o.Raw(sql, classifySort, classifySort, classifyId, source, source).QueryRow(&item)
-// 	return
-// }
-
-// // EditExcelInfoImage 修改excel表格的图片
-// func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-
-// 	sql := ` UPDATE  excel_info SET excel_image=?, modify_time = NOW() WHERE excel_info_id = ? AND is_delete=0 `
-// 	_, err = o.Raw(sql, imageUrl, excelInfoId).Exec()
-// 	if err != nil {
-// 		fmt.Println("EditExcelInfoImage Err:", err.Error())
-// 		return err
-// 	}
-
-// 	return
-// }
-
-// // GetExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
-// func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE unique_code=? AND is_delete=0 `
-// 	err = o.Raw(sql, uniqueCode).QueryRow(&item)
-// 	return
-// }
-
-// // GetFirstExcelInfoByClassifyId 获取当前分类下,且排序数相同 的排序第一条的数据
-// func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id=? AND is_delete=0 order by sort asc,excel_info_id desc limit 1`
-// 	err = o.Raw(sql, classifyId).QueryRow(&item)
-// 	return
-// }
-
-// // UpdateExcelInfoSortByClassifyId 根据表格id更新排序
-// func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string, source int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? AND source=? AND is_delete=0 AND ( sort > ? `
-// 	// todo 前一个兄弟节点后移
-// 	if prevExcelInfoId > 0 {
-// 		sql += ` or (excel_info_id < ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
-// 	}
-// 	sql += `)`
-// 	_, err = o.Raw(sql, classifyId, source, nowSort).Exec()
-// 	return
-// }
-
-//	type ExcelInfoView struct {
-//		ExcelInfoId       int    `orm:"column(excel_info_id);pk"`
-//		ExcelName         string `description:"来源名称"`
-//		ExcelClassifyId   int    `description:"表格分类id"`
-//		ExcelClassifyName string `description:"表格名称"`
-//		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"`
-//		ExcelType         int    `description:"生成样式:1:曲线图,2:季节性图"`
-//		Calendar          string `description:"公历/农历"`
-//		SeasonStartDate   string `description:"季节性图开始日期"`
-//		SeasonEndDate     string `description:"季节性图开始日期"`
-//		ExcelImage        string `description:"表格图片"`
-//		Sort              int    `description:"排序字段,数字越小越排前面"`
-//		IsAdd             bool   `description:"true:已加入我的图库,false:未加入我的图库"`
-//		MyExcelId         int
-//		MyExcelClassifyId string `description:"我的表格分类,多个用逗号隔开"`
-//		ExcelClassify     []*ExcelClassifyView
-//		EdbEndDate        string `description:"指标最新更新日期"`
-//		LeftMin           string `description:"表格左侧最小值"`
-//		LeftMax           string `description:"表格左侧最大值"`
-//		RightMin          string `description:"表格右侧最小值"`
-//		RightMax          string `description:"表格右侧最大值"`
-//	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 type ExcelInfoView struct {
 	ExcelInfoId       int       `gorm:"column:excel_info_id;primaryKey" orm:"column(excel_info_id);pk"`
@@ -618,7 +323,6 @@ type ExcelInfoView struct {
 	RightMax          string `gorm:"column:right_max" description:"表格右侧最大值"`
 }
 
-// GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息
 func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id = ? and excel_name=? AND is_delete=0 `
@@ -626,7 +330,6 @@ func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *Ex
 	return
 }
 
-// GetNoContentExcelListByCondition 获取没有content的excel表格列表数据
 func GetNoContentExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission
@@ -634,7 +337,6 @@ FROM excel_info WHERE 1=1 AND is_delete=0 `
 	if condition != "" {
 		sql += condition
 	}
-	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
 	sql += " ORDER BY create_time DESC LIMIT ?,? "
 	pars = append(pars, startSize, pageSize)
 	err = o.Raw(sql, pars...).Scan(&item).Error
@@ -651,7 +353,6 @@ func GetExcelListCountByCondition(condition string, pars []interface{}) (count i
 	return
 }
 
-// GetExcelViewInfoByExcelInfoId 根据excelInfoId 获取ETA表格详情
 func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission FROM excel_info WHERE excel_info_id = ? AND is_delete=0 `
@@ -659,7 +360,6 @@ func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err
 	return
 }
 
-// GetExcelInfoCountByClassifyId 根据分类id获取名下表格数量
 func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
@@ -667,7 +367,6 @@ func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
 	return
 }
 
-// UpdateExcelInfoClassifyId 更改表格分类
 func UpdateExcelInfoClassifyId(classifyId, excelInfoId int) (err error) {
 	o := global.DmSQL["data"]
 	sql := ` update excel_info set excel_classify_id = ? WHERE excel_info_id=? `
@@ -676,7 +375,6 @@ func UpdateExcelInfoClassifyId(classifyId, excelInfoId int) (err error) {
 	return
 }
 
-// GetNoContentExcelInfoByName 根据名称 获取eta表格详情
 func GetNoContentExcelInfoByName(excelName string, source int) (item *MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission 
@@ -686,7 +384,6 @@ func GetNoContentExcelInfoByName(excelName string, source int) (item *MyExcelInf
 	return
 }
 
-// GetNoContentExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
 func GetNoContentExcelInfoByUniqueCode(uniqueCode string) (item *MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission 
@@ -695,7 +392,6 @@ func GetNoContentExcelInfoByUniqueCode(uniqueCode string) (item *MyExcelInfoList
 	return
 }
 
-// GetNoContentExcelInfoByExcelId 根据表格id来获取excel表格详情
 func GetNoContentExcelInfoByExcelId(excelInfoId int) (item *MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission 
@@ -704,7 +400,6 @@ func GetNoContentExcelInfoByExcelId(excelInfoId int) (item *MyExcelInfoList, err
 	return
 }
 
-// AddExcelInfoAndSheet 新增excel
 func AddExcelInfoAndSheet(excelInfo *ExcelInfo, sheetParamsList []AddExcelSheetParams) (err error) {
 	o := global.DmSQL["data"].Begin()
 	defer func() {
@@ -715,17 +410,14 @@ func AddExcelInfoAndSheet(excelInfo *ExcelInfo, sheetParamsList []AddExcelSheetP
 		}
 	}()
 
-	// 表格信息入库
 	err = o.Create(excelInfo).Error
 	if err != nil {
 		return
 	}
 
-	// sheet信息入库
 	for _, sheetInfo := range sheetParamsList {
 		dataNum := len(sheetInfo.DataList)
 
-		//sheet信息入库
 		excelSheetInfo := &ExcelSheet{
 			ExcelSheetId: 0,
 			ExcelInfoId:  excelInfo.ExcelInfoId,
@@ -744,7 +436,6 @@ func AddExcelInfoAndSheet(excelInfo *ExcelInfo, sheetParamsList []AddExcelSheetP
 			return
 		}
 
-		// data信息入库
 		if dataNum > 0 {
 			for k, _ := range sheetInfo.DataList {
 				sheetInfo.DataList[k].ExcelSheetId = excelSheetInfo.ExcelSheetId
@@ -761,7 +452,6 @@ func AddExcelInfoAndSheet(excelInfo *ExcelInfo, sheetParamsList []AddExcelSheetP
 	return
 }
 
-// SaveExcelInfoAndSheet 编辑保存
 func SaveExcelInfoAndSheet(excelInfo *ExcelInfo, updateExcelInfoParam []string, sheetParamsList []AddExcelSheetParams) (err error) {
 	o := global.DmSQL["data"].Begin()
 	defer func() {
@@ -772,31 +462,26 @@ func SaveExcelInfoAndSheet(excelInfo *ExcelInfo, updateExcelInfoParam []string,
 		}
 	}()
 
-	// 表格信息入库
 	err = o.Model(excelInfo).Select(updateExcelInfoParam).Updates(excelInfo).Error
 	if err != nil {
 		return
 	}
 
-	// 先删除历史的sheet信息
 	sql := `DELETE FROM excel_sheet WHERE excel_info_id = ?`
 	err = o.Exec(sql, excelInfo.ExcelInfoId).Error
 	if err != nil {
 		return
 	}
 
-	// 再删除历史sheet中的cell data信息
 	sql = `DELETE FROM excel_sheet_data WHERE excel_info_id = ?`
 	err = o.Exec(sql, excelInfo.ExcelInfoId).Error
 	if err != nil {
 		return
 	}
 
-	// sheet信息入库
 	for _, sheetInfo := range sheetParamsList {
 		dataNum := len(sheetInfo.DataList)
 
-		//sheet信息入库
 		excelSheetInfo := &ExcelSheet{
 			ExcelSheetId: 0,
 			ExcelInfoId:  excelInfo.ExcelInfoId,
@@ -815,7 +500,6 @@ func SaveExcelInfoAndSheet(excelInfo *ExcelInfo, updateExcelInfoParam []string,
 			return
 		}
 
-		// data信息入库
 		if dataNum > 0 {
 			for k, _ := range sheetInfo.DataList {
 				sheetInfo.DataList[k].ExcelSheetId = excelSheetInfo.ExcelSheetId
@@ -832,236 +516,31 @@ func SaveExcelInfoAndSheet(excelInfo *ExcelInfo, updateExcelInfoParam []string,
 	return
 }
 
-// // GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息
-// func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id = ? and excel_name=? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId, excelName).QueryRow(&item)
-// 	return
-// }
-
-// // GetNoContentExcelListByCondition 获取没有content的excel表格列表数据
-// func GetNoContentExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission
-// FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
-// 	sql += " ORDER BY create_time DESC LIMIT ?,? "
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
-// 	return
-// }
-
-// func GetExcelListCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// // GetExcelViewInfoByExcelInfoId 根据excelInfoId 获取ETA表格详情
-// func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission FROM excel_info WHERE excel_info_id = ? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// // GetExcelInfoCountByClassifyId 根据分类id获取名下表格数量
-// func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&total)
-// 	return
-// }
-
-// // UpdateExcelInfoClassifyId 更改表格分类
-// func UpdateExcelInfoClassifyId(classifyId, excelInfoId int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` update excel_info set excel_classify_id = ? WHERE excel_info_id=? `
-// 	_, err = o.Raw(sql, classifyId, excelInfoId).Exec()
-
-// 	return
-// }
-
-// // GetNoContentExcelInfoByName 根据名称 获取eta表格详情
-// func GetNoContentExcelInfoByName(excelName string, source int) (item *MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission
-//  FROM excel_info WHERE excel_name = ? AND source = ? AND is_delete=0 `
-// 	err = o.Raw(sql, excelName, source).QueryRow(&item)
-
-// 	return
-// }
-
-// // GetNoContentExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
-// func GetNoContentExcelInfoByUniqueCode(uniqueCode string) (item *MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission
-//  FROM excel_info WHERE unique_code=? AND is_delete=0 `
-// 	err = o.Raw(sql, uniqueCode).QueryRow(&item)
-// 	return
-// }
-
-// // GetNoContentExcelInfoByExcelId 根据表格id来获取excel表格详情
-// func GetNoContentExcelInfoByExcelId(excelInfoId int) (item *MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,source,excel_type,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time,is_join_permission
-//  FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// // AddExcelInfoAndSheet 新增excel
-// func AddExcelInfoAndSheet(excelInfo *ExcelInfo, sheetParamsList []AddExcelSheetParams) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(excelInfo)
-// 	if err != nil {
-// 		return
-// 	}
-// 	excelInfo.ExcelInfoId = int(lastId)
-
-// 	// sheet信息入库
-// 	for _, sheetInfo := range sheetParamsList {
-// 		dataNum := len(sheetInfo.DataList)
-
-// 		//sheet信息入库
-// 		excelSheetInfo := &ExcelSheet{
-// 			ExcelSheetId: 0,
-// 			ExcelInfoId:  excelInfo.ExcelInfoId,
-// 			SheetName:    sheetInfo.SheetName,
-// 			PageNum:      dataNum,
-// 			Index:        sheetInfo.Index,
-// 			Sort:         sheetInfo.Sort,
-// 			Config:       sheetInfo.Config,
-// 			CalcChain:    sheetInfo.CalcChain,
-// 			ModifyTime:   time.Now(),
-// 			CreateTime:   time.Now(),
-// 		}
-// 		sheetId, tmpErr := o.Insert(excelSheetInfo)
-// 		if tmpErr != nil {
-// 			err = tmpErr
-// 			return
-// 		}
-// 		excelSheetInfo.ExcelSheetId = int(sheetId)
-
-// 		// data信息入库
-// 		if dataNum > 0 {
-// 			for k, _ := range sheetInfo.DataList {
-// 				sheetInfo.DataList[k].ExcelSheetId = excelSheetInfo.ExcelSheetId
-// 				sheetInfo.DataList[k].ExcelInfoId = excelSheetInfo.ExcelInfoId
-// 			}
-// 			_, tmpErr = o.InsertMulti(dataNum, sheetInfo.DataList)
-// 			if tmpErr != nil {
-// 				err = tmpErr
-// 				return
-// 			}
-// 		}
-// 	}
-
-// 	return
-// }
-
-// // SaveExcelInfoAndSheet 编辑保存
-// func SaveExcelInfoAndSheet(excelInfo *ExcelInfo, updateExcelInfoParam []string, sheetParamsList []AddExcelSheetParams) (err error) {
-// 	o, err := orm.NewOrmUsingDB("data").Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			_ = o.Rollback()
-// 		} else {
-// 			_ = o.Commit()
-// 		}
-// 	}()
-
-// 	// 表格信息入库
-// 	_, err = o.Update(excelInfo, updateExcelInfoParam...)
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	// 先删除历史的sheet信息
-// 	sql := `DELETE FROM excel_sheet WHERE excel_info_id = ?`
-// 	_, err = o.Raw(sql, excelInfo.ExcelInfoId).Exec()
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	// 再删除历史sheet中的cell data信息
-// 	sql = `DELETE FROM excel_sheet_data WHERE excel_info_id = ?`
-// 	_, err = o.Raw(sql, excelInfo.ExcelInfoId).Exec()
-// 	if err != nil {
-// 		return
-// 	}
-
-// 	// sheet信息入库
-// 	for _, sheetInfo := range sheetParamsList {
-// 		dataNum := len(sheetInfo.DataList)
-
-// 		//sheet信息入库
-// 		excelSheetInfo := &ExcelSheet{
-// 			ExcelSheetId: 0,
-// 			ExcelInfoId:  excelInfo.ExcelInfoId,
-// 			SheetName:    sheetInfo.SheetName,
-// 			PageNum:      dataNum,
-// 			Index:        sheetInfo.Index,
-// 			Sort:         sheetInfo.Sort,
-// 			Config:       sheetInfo.Config,
-// 			CalcChain:    sheetInfo.CalcChain,
-// 			ModifyTime:   time.Now(),
-// 			CreateTime:   time.Now(),
-// 		}
-// 		sheetId, tmpErr := o.Insert(excelSheetInfo)
-// 		if tmpErr != nil {
-// 			err = tmpErr
-// 			return
-// 		}
-// 		excelSheetInfo.ExcelSheetId = int(sheetId)
-
-// 		// data信息入库
-// 		if dataNum > 0 {
-// 			for k, _ := range sheetInfo.DataList {
-// 				sheetInfo.DataList[k].ExcelSheetId = excelSheetInfo.ExcelSheetId
-// 				sheetInfo.DataList[k].ExcelInfoId = excelSheetInfo.ExcelInfoId
-// 			}
-// 			_, tmpErr = o.InsertMulti(dataNum, sheetInfo.DataList)
-// 			if tmpErr != nil {
-// 				err = tmpErr
-// 				return
-// 			}
-// 		}
-// 	}
-
-// 	return
-// }
-
-//	type BatchRefreshExcelReq struct {
-//		ExcelCodes      []string `description:"表格编码"`
-//		ReportId        int      `description:"报告ID"`
-//		ReportChapterId int      `description:"报告章节ID"`
-//		Source          string   `description:"来源,枚举值:report、english_report、smart_report"`
-//	}
-//
-// BatchRefreshExcelReq 批量刷新表格请求
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 type BatchRefreshExcelReq struct {
 	ExcelCodes      []string `gorm:"column:excel_codes" description:"表格编码"`
 	ReportId        int      `gorm:"column:report_id" description:"报告ID"`
@@ -1069,7 +548,6 @@ type BatchRefreshExcelReq struct {
 	Source          string   `gorm:"column:source" description:"来源,枚举值:report、english_report、smart_report"`
 }
 
-// GetExcelMaxSortByClassifyId 获取当前分类下,且排序数最大的excel
 func GetExcelMaxSortByClassifyId(classifyId int, source int) (sort int, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT COALESCE(MAX(sort), 0) AS sort FROM excel_info WHERE excel_classify_id=? AND source = ? AND is_delete=0 order by sort desc,excel_info_id desc limit 1`
@@ -1077,11 +555,6 @@ func GetExcelMaxSortByClassifyId(classifyId int, source int) (sort int, err erro
 	return
 }
 
-// GetNoContentExcelListByExcelInfoIdList
-// @Description: 根据ETA表格ID列表获取列表信息
-// @param excelInfoIdList []string
-// @return items
-// @return err
 func GetNoContentExcelListByExcelInfoIdList(excelInfoIdList []string) (items []*MyExcelInfoList, err error) {
 	num := len(excelInfoIdList)
 	if num <= 0 {
@@ -1094,11 +567,6 @@ func GetNoContentExcelListByExcelInfoIdList(excelInfoIdList []string) (items []*
 	return
 }
 
-// GetNoContentExcelListByUserId
-// @Description: 根据ETA表格ID列表获取列表信息
-// @param userIdList []int
-// @return items
-// @return err
 func GetNoContentExcelListByUserId(userIdList []int) (items []*MyExcelInfoList, err error) {
 	num := len(userIdList)
 	if num <= 0 {
@@ -1111,14 +579,6 @@ func GetNoContentExcelListByUserId(userIdList []int) (items []*MyExcelInfoList,
 	return
 }
 
-// // ModifyExcelInfoUserIdByCodeList
-// // @Description: 根据编码列表修改表格信息
-// // @author: Roc
-// // @datetime 2024-03-26 14:16:30
-// // @param excelIdList []string
-// // @param userId int
-// // @param userName string
-// // @return err error
 func ModifyExcelInfoUserIdByCodeList(excelIdList []string, userId int, userName string) (err error) {
 	num := len(excelIdList)
 	if num <= 0 {
@@ -1130,14 +590,6 @@ func ModifyExcelInfoUserIdByCodeList(excelIdList []string, userId int, userName
 	return
 }
 
-// // ModifyExcelInfoUserIdByOldUserId
-// // @Description:  根据旧的用户id修改创建人
-// // @author: Roc
-// // @datetime 2024-03-25 19:14:59
-// // @param oldUserId int
-// // @param userId int
-// // @param userName string
-// // @return err error
 func ModifyExcelInfoUserIdByOldUserId(oldUserIdList []int, userId int, userName string) (err error) {
 	num := len(oldUserIdList)
 	if num <= 0 {
@@ -1149,111 +601,13 @@ func ModifyExcelInfoUserIdByOldUserId(oldUserIdList []int, userId int, userName
 	return
 }
 
-// GetExcelMaxSortByClassifyId 获取当前分类下,且排序数最大的excel
-// func GetExcelMaxSortByClassifyId(classifyId int, source int) (sort int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT Max(sort) AS sort FROM excel_info WHERE excel_classify_id=? AND source = ? AND is_delete=0 order by sort desc,excel_info_id desc limit 1`
-// 	err = o.Raw(sql, classifyId, source).QueryRow(&sort)
-// 	return
-// }
-
-// // GetNoContentExcelListByExcelInfoIdList
-// // @Description: 根据ETA表格ID列表获取列表信息
-// // @param excelInfoIdList []string
-// // @return items
-// // @return err
-// func GetNoContentExcelListByExcelInfoIdList(excelInfoIdList []string) (items []*MyExcelInfoList, err error) {
-// 	num := len(excelInfoIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id in (` + utils.GetOrmInReplace(num) + `) order by excel_info_id DESC `
-// 	_, err = o.Raw(sql, excelInfoIdList).QueryRows(&items)
-
-// 	return
-// }
-
-// // GetNoContentExcelListByUserId
-// // @Description: 根据ETA表格ID列表获取列表信息
-// // @param userIdList []int
-// // @return items
-// // @return err
-// func GetNoContentExcelListByUserId(userIdList []int) (items []*MyExcelInfoList, err error) {
-// 	num := len(userIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id in (` + utils.GetOrmInReplace(num) + `) order by excel_info_id DESC `
-// 	_, err = o.Raw(sql, userIdList).QueryRows(&items)
-
-// 	return
-// }
-
-// // ModifyExcelInfoUserIdByCodeList
-// // @Description: 根据编码列表修改表格信息
-// // @author: Roc
-// // @datetime 2024-03-26 14:16:30
-// // @param excelIdList []string
-// // @param userId int
-// // @param userName string
-// // @return err error
-// func ModifyExcelInfoUserIdByCodeList(excelIdList []string, userId int, userName string) (err error) {
-// 	num := len(excelIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `UPDATE excel_info SET sys_user_id=?,sys_user_real_name=? WHERE excel_info_id in (` + utils.GetOrmInReplace(num) + `) `
-// 	_, err = o.Raw(sql, userId, userName, excelIdList).Exec()
-// 	return
-// }
-
-// // ModifyExcelInfoUserIdByOldUserId
-// // @Description:  根据旧的用户id修改创建人
-// // @author: Roc
-// // @datetime 2024-03-25 19:14:59
-// // @param oldUserId int
-// // @param userId int
-// // @param userName string
-// // @return err error
-// func ModifyExcelInfoUserIdByOldUserId(oldUserIdList []int, userId int, userName string) (err error) {
-// 	num := len(oldUserIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `UPDATE excel_info SET sys_user_id=?,sys_user_real_name=? WHERE is_delete=0 AND sys_user_id in (` + utils.GetOrmInReplace(num) + `) `
-// 	_, err = o.Raw(sql, userId, userName, oldUserIdList).Exec()
-// 	return
-// }
-
-//	type ExcelInfoDetail struct {
-//		ExcelInfoId     int         `orm:"column(excel_info_id);pk"`
-//		Source          int         `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
-//		ExcelType       int         `description:"表格类型,1:指标列,2:日期列,默认:1"`
-//		ExcelName       string      `description:"表格名称"`
-//		UniqueCode      string      `description:"表格唯一编码"`
-//		ExcelClassifyId int         `description:"表格分类id"`
-//		SysUserId       int         `description:"操作人id"`
-//		SysUserRealName string      `description:"操作人真实姓名"`
-//		Content         string      `description:"表格内容"`
-//		ExcelImage      string      `description:"表格图片"`
-//		FileUrl         string      `description:"表格下载地址"`
-//		Sort            int         `description:"排序字段,数字越小越排前面"`
-//		IsDelete        int         `description:"是否删除,0:未删除,1:已删除"`
-//		ModifyTime      time.Time   `description:"最近修改日期"`
-//		CreateTime      time.Time   `description:"创建日期"`
-//		TableData       interface{} `description:"表格内容"`
-//		//Button           ExcelInfoDetailButton `description:"操作权限"`
-//		CanEdit          bool   `description:"是否可编辑"`
-//		Editor           string `description:"编辑人"`
-//		IsJoinPermission int    `description:"是否加入权限管控,0:不加入;1:加入;默认:0"`
-//		HaveOperaAuth    bool   `description:"是否有数据权限"`
-//	}
-//
-// ExcelInfoDetail excel表格详情(前端使用)
+
+
+
+
+
+
+
 type ExcelInfoDetail struct {
 	ExcelInfoId      int         `gorm:"column:excel_info_id;primaryKey" orm:"column(excel_info_id);pk"`
 	Source           int         `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`

+ 6 - 82
models/data_manage/excel/excel_sheet.go

@@ -5,22 +5,6 @@ import (
 	"time"
 )
 
-// ExcelSheet excel表格详情表
-//
-//	type ExcelSheet struct {
-//		ExcelSheetId int       `orm:"column(excel_sheet_id);pk"`
-//		ExcelInfoId  int       `description:"excel的id"`
-//		SheetName    string    `description:"sheet名称"`
-//		PageNum      int       `description:"总页码数"`
-//		Index        string    `description:"excel数据中的index"`
-//		Sort         int       `description:"排序"`
-//		Config       string    `description:"配置信息"`
-//		CalcChain    string    `description:"计算公式"`
-//		ModifyTime   time.Time `description:"最近修改日期"`
-//		CreateTime   time.Time `description:"创建日期"`
-//	}
-//
-// ExcelSheet excel表格详情表
 type ExcelSheet struct {
 	ExcelSheetId int       `gorm:"column:excel_sheet_id;primaryKey" orm:"column(excel_sheet_id);pk"`
 	ExcelInfoId  int       `gorm:"column:excel_info_id" description:"excel的id"`
@@ -34,7 +18,6 @@ type ExcelSheet struct {
 	CreateTime   time.Time `gorm:"column:create_time" description:"创建日期"`
 }
 
-// Update 更新 excel表格的sheet基础信息
 func (excelSheet *ExcelSheet) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(excelSheet).Select(cols).Updates(excelSheet).Error
@@ -42,15 +25,12 @@ func (excelSheet *ExcelSheet) Update(cols []string) (err error) {
 	return
 }
 
-// AddExcelSheet 新增excel表格的sheet基础信息
 func AddExcelSheet(excelInfo *ExcelSheet) (err error) {
 	o := global.DmSQL["data"]
-	// 表格信息入库
 	err = o.Create(excelInfo).Error
 	return
 }
 
-// GetAllSheetList 根据excel_id获取所有的sheet
 func GetAllSheetList(excelInfoId int) (item []*ExcelSheet, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT *
@@ -60,52 +40,11 @@ FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
 	return
 }
 
-// Update 更新 excel表格的sheet基础信息
-// func (excelSheet *ExcelSheet) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(excelSheet, cols...)
-
-// 	return
-// }
-
-// // AddExcelSheet 新增excel表格的sheet基础信息
-// func AddExcelSheet(excelInfo *ExcelSheet) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(excelInfo)
-// 	if err != nil {
-// 		return
-// 	}
-// 	excelInfo.ExcelInfoId = int(lastId)
-
-// 	return
-// }
-
-// // GetAllSheetList 根据excel_id获取所有的sheet
-// func GetAllSheetList(excelInfoId int) (item []*ExcelSheet, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-// FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
-// 	sql += " ORDER BY sort asc "
-// 	_, err = o.Raw(sql, excelInfoId).QueryRows(&item)
-// 	return
-// }
-
-// SheetItem excel表格详情表
-//
-//	type SheetItem struct {
-//		ExcelSheetId int             `orm:"column(excel_sheet_id);pk" json:"-"`
-//		ExcelInfoId  int             `description:"excel的id"  json:"-"`
-//		SheetName    string          `description:"sheet名称"`
-//		PageNum      int             `description:"数据总页码数"`
-//		Index        string          `description:"excel数据中的index"`
-//		Sort         int             `description:"排序"`
-//		Config       string          `description:"sheet配置"`
-//		CalcChain    string          `description:"计算公式"`
-//		ModifyTime   time.Time       `description:"最近修改日期" json:"-"`
-//		CreateTime   time.Time       `description:"创建日期"`
-//		Data         *ExcelSheetData `description:"excel的数据"`
-//	}
+
+
+
+
+
 type SheetItem struct {
 	ExcelSheetId int             `gorm:"column:excel_sheet_id;primaryKey" json:"-" orm:"column(excel_sheet_id);pk"`
 	ExcelInfoId  int             `gorm:"column:excel_info_id" description:"excel的id" json:"-"`
@@ -120,7 +59,6 @@ type SheetItem struct {
 	Data         *ExcelSheetData `description:"excel的数据"`
 }
 
-// GetAllSheetItemList 根据excel_id获取所有的sheet详情
 func GetAllSheetItemList(excelInfoId int) (item []*SheetItem, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT *
@@ -130,7 +68,6 @@ FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
 	return
 }
 
-// GetAllNoConfigSheetItemList 根据excel_id获取所有的sheet详情
 func GetAllNoConfigSheetItemList(excelInfoId int) (item []*SheetItem, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_sheet_id,excel_info_id,sheet_name,sort,page_num,create_time
@@ -140,20 +77,7 @@ FROM excel_sheet WHERE 1=1 AND excel_info_id = ? `
 	return
 }
 
-// AddExcelSheetParams excel表格详情表
-//
-//	type AddExcelSheetParams struct {
-//		ExcelSheetId int               `orm:"column(excel_sheet_id);pk"`
-//		ExcelInfoId  int               `description:"excel的id"`
-//		SheetName    string            `description:"sheet名称"`
-//		Index        string            `description:"excel数据中的index"`
-//		Sort         int               `description:"排序"`
-//		Config       string            `description:"配置信息"`
-//		CalcChain    string            `description:"计算公式"`
-//		DataList     []*ExcelSheetData `description:"excel的数据"`
-//	}
-
-// AddExcelSheetParams excel表格详情表
+
 type AddExcelSheetParams struct {
 	ExcelSheetId int               `gorm:"column:excel_sheet_id;primaryKey" orm:"column(excel_sheet_id);pk"`
 	ExcelInfoId  int               `gorm:"column:excel_info_id" description:"excel的id" `

+ 7 - 62
models/data_manage/excel/excel_sheet_data.go

@@ -6,19 +6,6 @@ import (
 	"time"
 )
 
-// ExcelSheetData excel表格详情表
-//
-//	type ExcelSheetData struct {
-//		ExcelDataId  int       `orm:"column(excel_data_id);pk"`
-//		ExcelInfoId  int       `description:"数据归属的excel_info的id"`
-//		ExcelSheetId int       `description:"数据归属sheet"`
-//		Sort         int       `description:"数据排序"`
-//		Data         string    `description:"数据,分页存储"`
-//		ModifyTime   time.Time `description:"最近修改日期"`
-//		CreateTime   time.Time `description:"创建日期"`
-//	}
-//
-// ExcelSheetData excel表格详情表
 type ExcelSheetData struct {
 	ExcelDataId  int       `gorm:"column:excel_data_id;primaryKey" orm:"column(excel_data_id);pk"`
 	ExcelInfoId  int       `gorm:"column:excel_info_id" description:"数据归属的excel_info的id"`
@@ -29,7 +16,6 @@ type ExcelSheetData struct {
 	CreateTime   time.Time `gorm:"column:create_time" description:"创建日期"`
 }
 
-// Update 更新 excel表格的sheet基础信息
 func (ExcelSheetData *ExcelSheetData) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(ExcelSheetData).Select(cols).Updates(ExcelSheetData).Error
@@ -37,10 +23,8 @@ func (ExcelSheetData *ExcelSheetData) Update(cols []string) (err error) {
 	return
 }
 
-// AddExcelSheetData 新增excel表格的sheet基础信息
 func AddExcelSheetData(excelInfo *ExcelSheetData) (err error) {
 	o := global.DmSQL["data"]
-	// 表格信息入库
 	err = o.Create(excelInfo).Error
 	if err != nil {
 		return
@@ -48,7 +32,6 @@ func AddExcelSheetData(excelInfo *ExcelSheetData) (err error) {
 	return
 }
 
-// GetSheetDataListBySheetIdListAndPage 根据sheet_id列表和页码获取所有的sheet数据详情
 func GetSheetDataListBySheetIdListAndPage(excelSheetIdList []int, page int) (items []*ExcelSheetData, err error) {
 	num := len(excelSheetIdList)
 	if num <= 0 {
@@ -62,7 +45,6 @@ FROM excel_sheet_data WHERE 1=1 AND excel_sheet_id in (` + utils.GetGormInReplac
 	return
 }
 
-// GetAllSheetDataListByExcelInfoId 根据表格id获取所有的sheet的所有数据详情
 func GetAllSheetDataListByExcelInfoId(excelInfoId int) (items []*ExcelSheetData, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT *
@@ -72,47 +54,10 @@ FROM excel_sheet_data WHERE 1=1 AND excel_info_id = ? ORDER BY sort ASC `
 	return
 }
 
-// Update 更新 excel表格的sheet基础信息
-// func (ExcelSheetData *ExcelSheetData) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(ExcelSheetData, cols...)
-
-// 	return
-// }
-
-// // AddExcelSheetData 新增excel表格的sheet基础信息
-// func AddExcelSheetData(excelInfo *ExcelSheetData) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(excelInfo)
-// 	if err != nil {
-// 		return
-// 	}
-// 	excelInfo.ExcelInfoId = int(lastId)
-
-// 	return
-// }
-
-// // GetSheetDataListBySheetIdListAndPage 根据sheet_id列表和页码获取所有的sheet数据详情
-// func GetSheetDataListBySheetIdListAndPage(excelSheetIdList []int, page int) (items []*ExcelSheetData, err error) {
-// 	num := len(excelSheetIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-// FROM excel_sheet_data WHERE 1=1 AND excel_sheet_id in (` + utils.GetOrmInReplace(num) + `) AND sort = ? `
-// 	_, err = o.Raw(sql, excelSheetIdList, page).QueryRows(&items)
-
-// 	return
-// }
-
-// // GetAllSheetDataListByExcelInfoId 根据表格id获取所有的sheet的所有数据详情
-// func GetAllSheetDataListByExcelInfoId(excelInfoId int) (items []*ExcelSheetData, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT *
-// FROM excel_sheet_data WHERE 1=1 AND excel_info_id = ? ORDER BY sort ASC `
-// 	_, err = o.Raw(sql, excelInfoId).QueryRows(&items)
-
-// 	return
-// }
+
+
+
+
+
+
+

+ 0 - 1
models/data_manage/excel/request/excel.go

@@ -1,6 +1,5 @@
 package request
 
-// SaveExcelInfoReq 编辑表格请求
 type SaveExcelInfoReq struct {
 	ExcelInfoId     int         `description:"表格ID"`
 	ExcelName       string      `description:"表格名称"`

+ 0 - 3
models/data_manage/excel/request/excel_classify.go

@@ -1,6 +1,5 @@
 package request
 
-// AddExcelClassifyReq 添加excel分类请求
 type AddExcelClassifyReq struct {
 	ExcelClassifyName string `description:"分类名称"`
 	ParentId          int    `description:"父级id,第一级传0"`
@@ -8,13 +7,11 @@ type AddExcelClassifyReq struct {
 	Source            int    `description:"1:excel插件的表格,2:自定义表格,3:混合表格,默认:1"`
 }
 
-// EditExcelClassifyReq 修改excel分类请求
 type EditExcelClassifyReq struct {
 	ExcelClassifyName string `description:"分类名称"`
 	ExcelClassifyId   int    `description:"分类名称"`
 }
 
-// MoveExcelClassifyReq 移动图表分类请求参数
 type MoveExcelClassifyReq struct {
 	ClassifyId       int `description:"分类id"`
 	ParentClassifyId int `description:"父级分类id"`

+ 0 - 17
models/data_manage/excel/request/excel_info.go

@@ -1,6 +1,5 @@
 package request
 
-// MoveExcelInfoReq 移动excel表格请求
 type MoveExcelInfoReq struct {
 	ExcelClassifyId int `description:"excel表格分类id"`
 	ExcelInfoId     int `description:"excel表格ID"`
@@ -8,12 +7,10 @@ type MoveExcelInfoReq struct {
 	NextExcelInfoId int `description:"下一个excel表格ID"`
 }
 
-// DeleteExcelInfoReq 删除表格请求
 type DeleteExcelInfoReq struct {
 	ExcelInfoId int `description:"表格ID"`
 }
 
-// AddExcelInfoReq 新增表格请求
 type AddExcelInfoReq struct {
 	ExcelInfoId     int         `description:"表格ID"`
 	ExcelName       string      `description:"表格名称"`
@@ -25,7 +22,6 @@ type AddExcelInfoReq struct {
 	TableData       interface{} `description:"自定义表格的数据内容"`
 }
 
-// EditExcelInfoReq 编辑表格请求
 type EditExcelInfoReq struct {
 	ExcelInfoId     int         `description:"ETA表格ID"`
 	ExcelType       int         `description:"表格类型,1:指标列,2:日期列,默认:1"`
@@ -36,13 +32,11 @@ type EditExcelInfoReq struct {
 	TableData       interface{} `description:"自定义表格的数据内容"`
 }
 
-// SetExcelInfoImageReq 设置excel表格图片请求
 type SetExcelInfoImageReq struct {
 	ExcelInfoId int    `description:"表格ID"`
 	ImageUrl    string `description:"表格图片地址"`
 }
 
-// AddExcelDraftReq 新增表格草稿请求
 type AddExcelDraftReq struct {
 	ExcelInfoId     int    `description:"ETA表格ID"`
 	ExcelName       string `description:"表格名称"`
@@ -50,20 +44,17 @@ type AddExcelDraftReq struct {
 	Content         string `description:"Excel表格内容"`
 }
 
-// CalculateReq 公式计算
 type CalculateReq struct {
 	CalculateFormula string             `description:"计算公式"`
 	TagMap           map[string]float64 `description:"标签与值的关系"`
 }
 
-// GetOtherEdbDateDataReq 获取其他指标的指定日期的数据
 type GetOtherEdbDateDataReq struct {
 	EdbInfoId int      `description:"指标id"`
 	SortType  string   `description:"如何排序,是正序还是倒序,枚举值:asc 正序,desc 倒序,不传默认倒序"`
 	DateList  []string `description:"日期列表,从小到大"`
 }
 
-// GetFutureDateDataReq 获取未来日期的数据
 type GetFutureDateDataReq struct {
 	EdbInfoIdList []int  `description:"指标id列表,从左至右,从上到下的顺序"`
 	DateType      int    `description:"日期类型,1:期数,2:截止日期"`
@@ -72,14 +63,12 @@ type GetFutureDateDataReq struct {
 	EndDate       string `description:"结束日期"`
 }
 
-// GetHistoryDateDataReq 获取历史日期的数据
 type GetHistoryDateDataReq struct {
 	EdbInfoIdList []int  `description:"指标id列表,从左至右,从上到下的顺序"`
 	Num           int    `description:"需要添加的期数"`
 	EndDate       string `description:"结束日期"`
 }
 
-// TableSaveReq 表格保存
 type TableSaveReq struct {
 	ExcelName       string      `description:"表格名称"`
 	ExcelImage      string      `description:"表格截图"`
@@ -87,7 +76,6 @@ type TableSaveReq struct {
 	TableData       interface{} `description:"表格数据"`
 }
 
-// TableDataReq 自定义表格请求参数
 type TableDataReq struct {
 	EdbInfoIdList []int             `description:"指标id列表,从左至右,从上到下的顺序"`
 	Sort          int               `description:"日期排序,1:倒序,2:正序"`
@@ -95,7 +83,6 @@ type TableDataReq struct {
 	TextRowData   [][]ManualDataReq `description:"文本列表"`
 }
 
-// EdbInfoData 自定义表格的数据
 type EdbInfoData struct {
 	EdbInfoId        int             `description:"指标ID"`
 	Tag              string          `description:"标签"`
@@ -111,7 +98,6 @@ type EdbInfoData struct {
 	Data             []ManualDataReq `description:"单元格数据列表"`
 }
 
-// ManualDataReq 自定义表格的单元格数据
 type ManualDataReq struct {
 	DataType            int               `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算,5:预测值"`
 	DataTime            string            `description:"所属日期"`
@@ -121,20 +107,17 @@ type ManualDataReq struct {
 	RelationEdbInfoList []RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
 }
 
-// RelationEdbInfo 自定义表格中单元格的关联指标
 type RelationEdbInfo struct {
 	Tag string `description:"指标标签"`
 	Row string `description:"第几行"`
 }
 
-// CopyExcelInfoReq 复制表格请求
 type CopyExcelInfoReq struct {
 	ExcelInfoId     int    `description:"ETA表格ID"`
 	ExcelName       string `description:"表格名称"`
 	ExcelClassifyId int    `description:"分类id"`
 }
 
-// MarkEditExcel 标记编辑表格的请求数据
 type MarkEditExcel struct {
 	ExcelInfoId int `description:"表格id"`
 	Status      int `description:"标记状态,1:编辑中,2:编辑完成"`

+ 0 - 28
models/data_manage/excel/request/mixed_table.go

@@ -1,6 +1,5 @@
 package request
 
-// 单元格的数据类型
 const (
 	DateDT                   = iota + 1 //日期
 	EdbDT                               // 2 指标类型
@@ -12,7 +11,6 @@ const (
 	DateCalculateDataDT                 // 8 日期计算
 )
 
-// 单元格的日期类型类型
 const (
 	CustomDateT = iota //手动输入日期
 	SystemDateT        // 系统日期
@@ -20,20 +18,17 @@ const (
 
 )
 
-// 单元格的日期类型类型
 const (
 	SystemCurrDateT      = iota + 1 //系统当前日期
 	SystemCalculateDateT            // 系统日期计算后的日期
 	SystemFrequencyDateT            // 导入系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
 )
 
-// MixedTableReq 混合表格保存请求参数
 type MixedTableReq struct {
 	CellRelation string                    `description:"单元格关系"`
 	Data         [][]MixedTableCellDataReq `description:"混合表格单元格参数"`
 }
 
-// MixedTableCellDataReq 混合表格单元格参数
 type MixedTableCellDataReq struct {
 	Uid             string      `description:"单元格唯一标识"`
 	DataType        int         `description:"数据类型,1:日期,2:指标,3:自定义文本,4:插值"`
@@ -47,25 +42,17 @@ type MixedTableCellDataReq struct {
 	ShowFormatValue interface{} `description:"样式处理后的值"`
 }
 
-// CellRelationConf
-// @Description: 单元格的关系配置结构体
 type CellRelationConf struct {
 	CellRelation
-	//Type         int          `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
-	//Key          string       `json:"key" description:"单元格的唯一标识"`
 	RelationDate CellRelation `json:"relation_date"`
 	RelationEdb  CellRelation `json:"relation_edb"`
 }
 
-// CellRelation
-// @Description: 单元格的关系结构体
 type CellRelation struct {
 	Type int    `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
 	Key  string `json:"key" description:"单元格的唯一标识"`
 }
 
-// SystemDateConf
-// @Description: 系统导入日期配置
 type SystemDateConf struct {
 	Source             int    `description:"类型,1:导入系统日期;2:导入系统日期计算后的日期;3:导入系统日期相关的指定频率"`
 	CalculateNum       int    `description:"计算频度的数量"`
@@ -74,15 +61,11 @@ type SystemDateConf struct {
 	Day                string `description:"指定日期"`
 }
 
-// EdbDateConf
-// @Description: 导入指标日期配置
 type EdbDateConf struct {
 	EdbInfoId int `description:"指标id"`
 	EdbDateChangeConf
 }
 
-// EdbDateExtraConf
-// @Description: 导入指标日期前移和日期变换
 type EdbDateChangeConf struct {
 	MoveForward int `description:"前移的期数"`
 	DateChange  []*EdbDateConfDateChange
@@ -97,31 +80,26 @@ type EdbDateConfDateChange struct {
 	ChangeType   int    `description:"日期变换类型1日期位移,2指定频率"`
 }
 
-// MixedDateCalculateReq 混合表格日期计算
 type MixedDateCalculateReq struct {
 	Formula  string                   `description:"计算公式"`
 	DateList []MixDateCalculateTagReq `description:"表格中的单元格"`
 }
 
-// MixDateCalculateConf 混合表格中的日期计算
 type MixDateCalculateConf struct {
 	Formula          string                `description:"计算公式"`
 	RelationCellList []MixDateCalculateTag `description:"表格中的单元格"`
 }
 
-// MixDateCalculateTag 混合表格中的日期计算的关联单元格
 type MixDateCalculateTag struct {
 	Uid string `description:"单元格唯一值"`
 	Tag string `description:"单元格对应标签"`
 }
 
-// MixDateCalculateTagReq 混合表格中的日期计算的关联单元格
 type MixDateCalculateTagReq struct {
 	Date string `description:"日期"`
 	Tag  string `description:"指标对应标签"`
 }
 
-// MixCellShowStyle 混合表格 单元格样式展示计算
 type MixCellShowStyle struct {
 	Pn int    `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
 	Nt string `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`
@@ -135,8 +113,6 @@ type DateDataBeforeAfterReq struct {
 	DateChange  []*EdbDateConfDateChange
 }
 
-// CalculateConf
-// @Description: 计算公式
 type CalculateConf struct {
 	EdbInfoId     int         `description:"指标id"`
 	DataTime      string      `description:"所属日期,这个日期有传递的话,那么就取上下两期+自己的数据;没有传就默认最近5期的数据"`
@@ -150,15 +126,11 @@ type CalculateConf struct {
 	EdbDateChangeConf
 }
 
-// BaseCalculateConf
-// @Description: 基础计算公式(A+B)
 type BaseCalculateConf struct {
 	Formula             string         `description:"计算公式,默认是string,实际上还需要转成其他样式"`
 	RelationEdbInfoList []RelationCell `description:"关联单元格(计算公式中关联的单元格,用于计算的时候去匹配)"`
 }
 
-// RelationCell
-// @Description: 关联单元格的信息
 type RelationCell struct {
 	Tag string `description:"指标标签"`
 	Row string `description:"第几行"`

+ 0 - 9
models/data_manage/excel/response/excel_info.go

@@ -8,19 +8,16 @@ import (
 	"time"
 )
 
-// AddExcelInfoResp 添加excel表格的返回
 type AddExcelInfoResp struct {
 	ExcelInfoId int    `description:"表格id"`
 	UniqueCode  string `description:"表格唯一编码"`
 }
 
-// ExcelListResp 表格列表返回数据
 type ExcelListResp struct {
 	Paging *paging.PagingItem
 	List   []*excel2.MyExcelInfoList
 }
 
-// ExcelTableDetailResp  excel表格详情
 type ExcelTableDetailResp struct {
 	UniqueCode string `description:"表格唯一code"`
 	ExcelImage string `description:"表格截图"`
@@ -29,13 +26,10 @@ type ExcelTableDetailResp struct {
 	Config     ExcelTableDetailConfigResp
 }
 
-// ExcelTableDetailConfigResp
-// @Description: Excel表格的配置信息
 type ExcelTableDetailConfigResp struct {
 	FontSize int
 }
 
-// TableCellResp 单元格
 type TableCellResp struct {
 	DataType  int    `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算"`
 	DataTime  string `description:"所属日期"`
@@ -48,13 +42,11 @@ type TableDataItem struct {
 	Data      []request.ManualDataReq `description:"数据列表"`
 }
 
-// TableDetailResp  excel表格详情
 type TableDetailResp struct {
 	ExcelInfo excel2.ExcelInfo     `description:"表格基础信息"`
 	TableData request.TableDataReq `description:"表格内容"`
 }
 
-// ExcelInfoDetail excel表格详情(前端使用)
 type ExcelInfoDetail struct {
 	ExcelInfoId      int                   `orm:"column(excel_info_id);pk"`
 	Source           int                   `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
@@ -79,7 +71,6 @@ type ExcelInfoDetail struct {
 	HaveOperaAuth    bool                  `description:"是否有数据权限"`
 }
 
-// ExcelInfoDetailButton 操作按钮
 type ExcelInfoDetailButton struct {
 	RefreshButton    bool `description:"是否可刷新"`
 	CopyButton       bool `description:"是否可另存为"`

+ 0 - 2
models/data_manage/excel/response/sheet.go

@@ -5,14 +5,12 @@ import (
 	"time"
 )
 
-// FindExcelInfoResp 根据名称获取excel的信息
 type FindExcelInfoResp struct {
 	IsFind    bool               `description:"是否存在同名文件"`
 	ExcelInfo FindExcelInfo      `description:"表格详情"`
 	SheetList []*excel.SheetItem `description:"sheet列表"`
 }
 
-// FindExcelInfo excel的数据详情
 type FindExcelInfo struct {
 	ExcelInfoId     int                   `orm:"column(excel_info_id);pk"`
 	Source          int                   `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`

+ 11 - 124
models/data_manage/factor_edb_series.go

@@ -17,18 +17,7 @@ const (
 	FactorEdbSeriesCalculated    = 2
 )
 
-// FactorEdbSeries 因子指标系列表
-// type FactorEdbSeries struct {
-// 	FactorEdbSeriesId int       `orm:"column(factor_edb_series_id);pk"`
-// 	SeriesName        string    `description:"系列名称"`
-// 	EdbInfoType       int       `description:"关联指标类型:0-普通指标;1-预测指标"`
-// 	CalculateStep     string    `description:"计算步骤-JSON"`
-// 	CalculateState    int       `description:"计算状态: 0-无计算; 1-计算中; 2-计算完成"`
-// 	CreateTime        time.Time `description:"创建时间"`
-// 	ModifyTime        time.Time `description:"修改时间"`
-// }
-
-// FactorEdbSeries 因子指标系列表
+
 type FactorEdbSeries struct {
 	FactorEdbSeriesId int       `gorm:"column:factor_edb_series_id;primaryKey" description:"因子指标系列ID" orm:"column(factor_edb_series_id);pk"`
 	SeriesName        string    `gorm:"column:series_name" description:"系列名称"`
@@ -159,104 +148,16 @@ func (m *FactorEdbSeries) GetPageItemsByCondition(condition string, pars []inter
 	return
 }
 
-// func (m *FactorEdbSeries) Create() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	id, err := o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	m.FactorEdbSeriesId = int(id)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) CreateMulti(items []*FactorEdbSeries) (err error) {
-// 	if len(items) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.InsertMulti(len(items), items)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) Remove() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	_, err = o.Raw(sql, m.FactorEdbSeriesId).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeries) MultiRemove(ids []int) (err error) {
-// 	if len(ids) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s IN (%s)`, m.TableName(), m.Cols().PrimaryId, utils.GetOrmInReplace(len(ids)))
-// 	_, err = o.Raw(sql, ids).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeries) GetItemById(id int) (item *FactorEdbSeries, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *FactorEdbSeries, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	order := ``
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*FactorEdbSeries, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
-
-// func (m *FactorEdbSeries) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*FactorEdbSeries, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-// 	return
-// }
-
-// FactorEdbSeriesItem 多因子系列信息
+
+
+
+
+
+
+
+
+
+
 type FactorEdbSeriesItem struct {
 	SeriesId      int                            `description:"多因子系列ID"`
 	SeriesName    string                         `description:"系列名称"`
@@ -279,7 +180,6 @@ func (m *FactorEdbSeries) Format2Item() (item *FactorEdbSeriesItem) {
 	return
 }
 
-// FactorEdbSeriesCalculatePars 计算参数
 type FactorEdbSeriesCalculatePars struct {
 	Formula       interface{} `description:"N值/移动天数/指数修匀alpha值/计算公式等"`
 	Calendar      string      `description:"公历/农历"`
@@ -291,7 +191,6 @@ type FactorEdbSeriesCalculatePars struct {
 	Sort          int         `description:"计算顺序"`
 }
 
-// CreateSeriesAndMapping 新增系列和指标关联
 func (m *FactorEdbSeries) CreateSeriesAndMapping(item *FactorEdbSeries, mappings []*FactorEdbSeriesMapping) (seriesId int, err error) {
 	if item == nil {
 		err = fmt.Errorf("series is nil")
@@ -332,7 +231,6 @@ func (m *FactorEdbSeries) CreateSeriesAndMapping(item *FactorEdbSeries, mappings
 	return
 }
 
-// EditSeriesAndMapping 编辑系列和指标关联
 func (m *FactorEdbSeries) EditSeriesAndMapping(item *FactorEdbSeries, mappings []*FactorEdbSeriesMapping, updateCols []string) (err error) {
 	if item == nil {
 		err = fmt.Errorf("series is nil")
@@ -358,7 +256,6 @@ func (m *FactorEdbSeries) EditSeriesAndMapping(item *FactorEdbSeries, mappings [
 		return
 	}
 
-	// 清除原指标关联
 	mappingOb := new(FactorEdbSeriesMapping)
 	cond := fmt.Sprintf("%s = ?", mappingOb.Cols().FactorEdbSeriesId)
 	pars := make([]interface{}, 0)
@@ -383,14 +280,12 @@ func (m *FactorEdbSeries) EditSeriesAndMapping(item *FactorEdbSeries, mappings [
 	return
 }
 
-// FactorEdbSeriesStepCalculateResp 批量计算响应
 type FactorEdbSeriesStepCalculateResp struct {
 	SeriesId int                                  `description:"多因子指标系列ID"`
 	Fail     []FactorEdbSeriesStepCalculateResult `description:"计算失败的指标"`
 	Success  []FactorEdbSeriesStepCalculateResult `description:"计算成功的指标"`
 }
 
-// FactorEdbSeriesStepCalculateResult 批量计算结果
 type FactorEdbSeriesStepCalculateResult struct {
 	EdbInfoId int    `description:"指标ID"`
 	EdbCode   string `description:"指标编码"`
@@ -398,19 +293,16 @@ type FactorEdbSeriesStepCalculateResult struct {
 	ErrMsg    string `description:"错误信息"`
 }
 
-// FactorEdbSeriesDetail 因子指标系列-详情
 type FactorEdbSeriesDetail struct {
 	*FactorEdbSeriesItem
 	EdbMappings []*FactorEdbSeriesMappingItem
 }
 
-// FactorEdbSeriesCorrelationMatrixResp 因子指标系列-相关性矩阵响应
 type FactorEdbSeriesCorrelationMatrixResp struct {
 	Fail    []FactorEdbSeriesCorrelationMatrixItem `description:"计算失败的指标"`
 	Success []FactorEdbSeriesCorrelationMatrixItem `description:"计算成功的指标"`
 }
 
-// FactorEdbSeriesCorrelationMatrixItem 因子指标系列-相关性矩阵信息
 type FactorEdbSeriesCorrelationMatrixItem struct {
 	SeriesId   int                                      `description:"因子指标系列ID"`
 	EdbInfoId  int                                      `description:"指标ID"`
@@ -423,13 +315,11 @@ type FactorEdbSeriesCorrelationMatrixItem struct {
 	SourceName string                                   `description:"指标来源名称"`
 }
 
-// FactorEdbSeriesCorrelationMatrixValues 因子指标系列-相关性矩阵XY值
 type FactorEdbSeriesCorrelationMatrixValues struct {
 	XData int     `description:"X轴数据"`
 	YData float64 `description:"Y轴数据"`
 }
 
-// FactorEdbSeriesCorrelationMatrixOrder 排序规则[0 1 2 3 -1 -2 -3]
 type FactorEdbSeriesCorrelationMatrixOrder []FactorEdbSeriesCorrelationMatrixValues
 
 func (a FactorEdbSeriesCorrelationMatrixOrder) Len() int {
@@ -441,17 +331,14 @@ func (a FactorEdbSeriesCorrelationMatrixOrder) Swap(i, j int) {
 }
 
 func (a FactorEdbSeriesCorrelationMatrixOrder) Less(i, j int) bool {
-	// 非负数优先
 	if a[i].XData >= 0 && a[j].XData < 0 {
 		return true
 	}
 	if a[i].XData < 0 && a[j].XData >= 0 {
 		return false
 	}
-	// 非负数升序排序
 	if a[i].XData >= 0 {
 		return a[i].XData < a[j].XData
 	}
-	// 负数按绝对值的降序排序(即数值的升序)
 	return a[i].XData > a[j].XData
 }

+ 0 - 116
models/data_manage/factor_edb_series_chart_mapping.go

@@ -12,21 +12,6 @@ const (
 	FactorEdbSeriesChartCalculateTypeCorrelation = 1 // 相关性计算
 )
 
-// FactorEdbSeriesChartMapping 因子指标系列-图表关联
-//
-//	type FactorEdbSeriesChartMapping struct {
-//		FactorEdbSeriesChartMappingId int       `orm:"column(factor_edb_series_chart_mapping_id);pk"`
-//		ChartInfoId                   int       `description:"图表ID"`
-//		Source                        int       `description:"图表来源, 同chart_info表source"`
-//		CalculateType                 int       `description:"计算方式: 1-相关性"`
-//		CalculatePars                 string    `description:"计算参数-JSON(如计算窗口等)"`
-//		CalculateData                 string    `description:"计算数据-JSON(如相关性矩阵等)"`
-//		FactorEdbSeriesId             int       `description:"因子指标系列ID"`
-//		EdbInfoId                     int       `description:"指标ID"`
-//		EdbUsed                       int       `description:"指标是否使用: 0-否; 1-是"`
-//		CreateTime                    time.Time `description:"创建时间"`
-//		ModifyTime                    time.Time `description:"修改时间"`
-//	}
 type FactorEdbSeriesChartMapping struct {
 	FactorEdbSeriesChartMappingId int       `gorm:"column:factor_edb_series_chart_mapping_id;primaryKey" description:"因子指标系列图表映射ID" orm:"column(factor_edb_series_chart_mapping_id);pk"`
 	ChartInfoId                   int       `gorm:"column:chart_info_id" description:"图表ID"`
@@ -169,7 +154,6 @@ func (m *FactorEdbSeriesChartMapping) GetPageItemsByCondition(condition string,
 	return
 }
 
-// GetDistinctSeriesIdByChartId 获取图表关联的系列ID
 func (m *FactorEdbSeriesChartMapping) GetDistinctSeriesIdByChartId(chartId int) (seriesIds []int, err error) {
 	o := global.DmSQL["data"]
 	sql := fmt.Sprintf(`SELECT DISTINCT %s FROM %s WHERE %s = ?`, m.Cols().FactorEdbSeriesId, m.TableName(), m.Cols().ChartInfoId)
@@ -184,114 +168,14 @@ func (m *FactorEdbSeriesChartMapping) GetItemByChartInfoId(id int) (item *Factor
 	return
 }
 
-// func (m *FactorEdbSeriesChartMapping) Create() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	id, err := o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	m.FactorEdbSeriesChartMappingId = int(id)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) CreateMulti(items []*FactorEdbSeriesChartMapping) (err error) {
-// 	if len(items) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.InsertMulti(len(items), items)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) Remove() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	_, err = o.Raw(sql, m.FactorEdbSeriesChartMappingId).Exec()
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) MultiRemove(ids []int) (err error) {
-// 	if len(ids) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s IN (%s)`, m.TableName(), m.Cols().PrimaryId, utils.GetOrmInReplace(len(ids)))
-// 	_, err = o.Raw(sql, ids).Exec()
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) GetItemById(id int) (item *FactorEdbSeriesChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *FactorEdbSeriesChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	order := ``
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*FactorEdbSeriesChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*FactorEdbSeriesChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-// 	return
-// }
 
-// // GetDistinctSeriesIdByChartId 获取图表关联的系列ID
-// func (m *FactorEdbSeriesChartMapping) GetDistinctSeriesIdByChartId(chartId int) (seriesIds []int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT DISTINCT %s FROM %s WHERE %s = ?`, m.Cols().FactorEdbSeriesId, m.TableName(), m.Cols().ChartInfoId)
-// 	_, err = o.Raw(sql, chartId).QueryRows(&seriesIds)
-// 	return
-// }
 
-// func (m *FactorEdbSeriesChartMapping) GetItemByChartInfoId(id int) (item *FactorEdbSeriesChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().ChartInfoId)
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }

+ 14 - 172
models/data_manage/factor_edb_series_mapping.go

@@ -8,17 +8,7 @@ import (
 	"time"
 )
 
-// FactorEdbSeriesMapping 因子指标系列-指标关联表
-// type FactorEdbSeriesMapping struct {
-// 	FactorEdbSeriesMappingId int       `orm:"column(factor_edb_series_mapping_id);pk"`
-// 	FactorEdbSeriesId        int       `description:"因子指标系列ID"`
-// 	EdbInfoId                int       `description:"指标ID"`
-// 	EdbCode                  string    `description:"指标编码"`
-// 	CreateTime               time.Time `description:"创建时间"`
-// 	ModifyTime               time.Time `description:"修改时间"`
-// }
-
-// FactorEdbSeriesMapping 因子指标系列-指标关联表
+
 type FactorEdbSeriesMapping struct {
 	FactorEdbSeriesMappingId int       `gorm:"column:factor_edb_series_mapping_id;primaryKey" description:"因子指标系列映射ID" orm:"column(factor_edb_series_mapping_id);pk"`
 	FactorEdbSeriesId        int       `gorm:"column:factor_edb_series_id" description:"因子指标系列ID"`
@@ -156,124 +146,18 @@ func (m *FactorEdbSeriesMapping) GetPageItemsByCondition(condition string, pars
 	return
 }
 
-// func (m *FactorEdbSeriesMapping) Create() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	id, err := o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	m.FactorEdbSeriesMappingId = int(id)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) CreateMulti(items []*FactorEdbSeriesMapping) (err error) {
-// 	if len(items) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.InsertMulti(len(items), items)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) Remove() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	_, err = o.Raw(sql, m.FactorEdbSeriesMappingId).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) MultiRemove(ids []int) (err error) {
-// 	if len(ids) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s IN (%s)`, m.TableName(), m.Cols().PrimaryId, utils.GetOrmInReplace(len(ids)))
-// 	_, err = o.Raw(sql, ids).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) RemoveByCondition(condition string, pars []interface{}) (err error) {
-// 	if condition == "" {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s`, m.TableName(), condition)
-// 	_, err = o.Raw(sql, pars).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) GetItemById(id int) (item *FactorEdbSeriesMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *FactorEdbSeriesMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	order := ``
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*FactorEdbSeriesMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesMapping) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*FactorEdbSeriesMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-// 	return
-// }
-
-// FactorEdbSeriesMappingItem 因子指标系列-指标关联信息
-//
-//	type FactorEdbSeriesMappingItem struct {
-//		SeriesId  int    `description:"因子指标系列ID"`
-//		EdbInfoId int    `description:"指标ID"`
-//		EdbCode   string `description:"指标编码"`
-//		EdbName   string `description:"指标名称"`
-//		EdbNameEn string `description:"指标名称-英文"`
-//	}
-
-// FactorEdbSeriesMappingItem 因子指标系列-指标关联信息
+
+
+
+
+
+
+
+
+
+
+
+
 type FactorEdbSeriesMappingItem struct {
 	SeriesId  int    `gorm:"column:series_id" description:"因子指标系列ID"`
 	EdbInfoId int    `gorm:"column:edb_info_id" description:"指标ID"`
@@ -290,38 +174,7 @@ func (m *FactorEdbSeriesMapping) Format2Item() (item *FactorEdbSeriesMappingItem
 	return
 }
 
-// FactorEdbSeriesMappingUpdateCalculate 更新计算数据
-//type FactorEdbSeriesMappingUpdateCalculate struct {
-//	SeriesId      int    `description:"因子指标系列ID"`
-//	EdbInfoId     int    `description:"指标ID"`
-//	CalculateData string `description:"计算数据-JSON"`
-//}
-//
-//func (m *FactorEdbSeriesMapping) UpdateCalculateData(updates []*FactorEdbSeriesMappingUpdateCalculate) (err error) {
-//	if len(updates) == 0 {
-//		return
-//	}
-//	o := orm.NewOrm()
-//	sql := fmt.Sprintf(`UPDATE %s SET %s = ? WHERE %s = ? AND %s = ?`, m.TableName(), m.Cols().CalculateData, m.Cols().FactorEdbSeriesId, m.Cols().EdbInfoId)
-//	p, e := o.Raw(sql).Prepare()
-//	if e != nil {
-//		err = fmt.Errorf("sql prepare err: %v", e)
-//		return
-//	}
-//	defer func() {
-//		_ = p.Close()
-//	}()
-//	for _, v := range updates {
-//		_, e = p.Exec(v.CalculateData, v.SeriesId, v.EdbInfoId)
-//		if e != nil {
-//			err = fmt.Errorf("update exec err: %v", e)
-//			return
-//		}
-//	}
-//	return
-//}
-
-// GetChartUsedFactorSeriesEdb 获取图表引用的系列指标
+
 func GetChartUsedFactorSeriesEdb(chartId int) (items []*FactorEdbSeriesMapping, err error) {
 	o := global.DmSQL["data"]
 	chartOb := new(FactorEdbSeriesChartMapping)
@@ -333,14 +186,3 @@ func GetChartUsedFactorSeriesEdb(chartId int) (items []*FactorEdbSeriesMapping,
 	return
 }
 
-// GetChartUsedFactorSeriesEdb 获取图表引用的系列指标
-// func GetChartUsedFactorSeriesEdb(chartId int) (items []*FactorEdbSeriesMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	chartOb := new(FactorEdbSeriesChartMapping)
-// 	edbOb := new(FactorEdbSeriesMapping)
-// 	sql := fmt.Sprintf(`SELECT b.* FROM %s AS a
-// 	JOIN %s AS b ON a.%s = b.%s AND a.%s = b.%s
-// 	WHERE a.%s = ? ORDER BY %s ASC`, chartOb.TableName(), edbOb.TableName(), chartOb.Cols().FactorEdbSeriesId, edbOb.Cols().FactorEdbSeriesId, chartOb.Cols().EdbInfoId, edbOb.Cols().EdbInfoId, chartOb.Cols().ChartInfoId, edbOb.Cols().FactorEdbSeriesId)
-// 	_, err = o.Raw(sql, chartId).QueryRows(&items)
-// 	return
-// }

+ 6 - 64
models/data_manage/future_good/chart_info_future_good_profit.go

@@ -7,19 +7,7 @@ import (
 	"time"
 )
 
-// ChartInfoFutureGoodProfit 商品利润图表-扩展信息
-//
-//	type ChartInfoFutureGoodProfit struct {
-//		ChartInfoId  int       `orm:"column(chart_info_id);pk" description:"商品利润图表ID(chart_info表source=5的)"`
-//		ProfitName   string    `description:"利润名称"`
-//		ProfitNameEn string    `description:"利润英文名称"`
-//		XValue       string    `description:"X轴数据值"`
-//		YValue       string    `description:"Y轴数据值"`
-//		CreateTime   time.Time `description:"创建时间"`
-//		ModifyTime   time.Time `description:"更新时间"`
-//	}
-
-// ChartInfoFutureGoodProfit 商品利润图表-扩展信息
+
 type ChartInfoFutureGoodProfit struct {
 	ChartInfoId  int       `gorm:"column:chart_info_id;primaryKey" description:"商品利润图表ID(chart_info表source=5的)" orm:"column(chart_info_id);pk"`
 	ProfitName   string    `gorm:"column:profit_name" description:"利润名称"`
@@ -95,54 +83,8 @@ func (m *ChartInfoFutureGoodProfit) GetItemsByCondition(condition string, pars [
 	return
 }
 
-// func (m *ChartInfoFutureGoodProfit) Create() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	//m.CorrelationChartInfoId = int(id)
-// 	return
-// }
-
-// func (m *ChartInfoFutureGoodProfit) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// func (m *ChartInfoFutureGoodProfit) Delete() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE chart_info_id = ? LIMIT 1`, m.TableName())
-// 	_, err = o.Raw(sql, m.ChartInfoId).Exec()
-// 	return
-// }
-
-// func (m *ChartInfoFutureGoodProfit) GetItemById(id int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE chart_info_id = ? LIMIT 1`, m.TableName())
-// 	err = o.Raw(sql, id).QueryRow(&m)
-// 	return
-// }
-
-// func (m *ChartInfoFutureGoodProfit) GetItemByCondition(condition string, pars []interface{}) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s LIMIT 1`, m.TableName(), condition)
-// 	err = o.Raw(sql, pars).QueryRow(&m)
-// 	return
-// }
-
-// func (m *ChartInfoFutureGoodProfit) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*ChartInfoFutureGoodProfit, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := ``
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
+
+
+
+
+

+ 15 - 171
models/data_manage/future_good/future_good_chart_classify.go

@@ -6,23 +6,7 @@ import (
 	"time"
 )
 
-// FutureGoodChartClassify future_good_chart表格分类
-//
-//	type FutureGoodChartClassify struct {
-//		FutureGoodChartClassifyId   int       `orm:"column(future_good_chart_classify_id);pk"`
-//		FutureGoodChartClassifyName string    `description:"分类名称"`
-//		ParentId                    int       `description:"父级id"`
-//		SysUserId                   int       `description:"创建人id"`
-//		SysUserRealName             string    `description:"创建人姓名"`
-//		Level                       int       `description:"层级"`
-//		UniqueCode                  string    `description:"唯一编码"`
-//		Sort                        int       `description:"排序字段,越小越靠前,默认值:10"`
-//		IsDelete                    int       `description:"排序字段,越小越靠前,默认值:10"`
-//		CreateTime                  time.Time `description:"创建时间"`
-//		ModifyTime                  time.Time `description:"修改时间"`
-//	}
-
-// FutureGoodChartClassify future_good_chart表格分类
+
 type FutureGoodChartClassify struct {
 	FutureGoodChartClassifyId   int       `gorm:"column:future_good_chart_classify_id;primaryKey" description:"分类ID" orm:"column(future_good_chart_classify_id);pk"`
 	FutureGoodChartClassifyName string    `gorm:"column:future_good_chart_classify_name" description:"分类名称"`
@@ -37,14 +21,12 @@ type FutureGoodChartClassify struct {
 	ModifyTime                  time.Time `gorm:"column:modify_time" description:"修改时间"`
 }
 
-// AddFutureGoodChartClassify 添加future_good_chart分类
 func AddFutureGoodChartClassify(item *FutureGoodChartClassify) (lastId int64, err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(item).Error
 	return
 }
 
-// GetFutureGoodChartClassifyCount 获取同级分类下存在同名分类的数量
 func GetFutureGoodChartClassifyCount(FutureGoodChartClassifyName string, parentId int) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT COUNT(1) AS count FROM future_good_chart_classify WHERE parent_id=? AND future_good_chart_classify_name=? AND is_delete=0 `
@@ -73,55 +55,11 @@ func GetFutureGoodChartClassifyAll() (items []*FutureGoodChartClassifyItems, err
 	return
 }
 
-// AddFutureGoodChartClassify 添加future_good_chart分类
-// func AddFutureGoodChartClassify(item *FutureGoodChartClassify) (lastId int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err = o.Insert(item)
-// 	return
-// }
-
-// // GetFutureGoodChartClassifyCount 获取同级分类下存在同名分类的数量
-// func GetFutureGoodChartClassifyCount(FutureGoodChartClassifyName string, parentId int) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT COUNT(1) AS count FROM future_good_chart_classify WHERE parent_id=? AND future_good_chart_classify_name=? AND is_delete=0 `
-// 	err = o.Raw(sql, parentId, FutureGoodChartClassifyName).QueryRow(&count)
-// 	return
-// }
-
-// func GetFutureGoodChartClassifyById(classifyId int) (item *FutureGoodChartClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_chart_classify WHERE future_good_chart_classify_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&item)
-// 	return
-// }
-
-// func GetFutureGoodChartClassifyByParentId(parentId int) (items []*FutureGoodChartClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM future_good_chart_classify WHERE parent_id=? AND is_delete=0 order by sort asc,future_good_chart_classify_id asc`
-// 	_, err = o.Raw(sql, parentId).QueryRows(&items)
-// 	return
-// }
-
-// func GetFutureGoodChartClassifyAll() (items []*FutureGoodChartClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM future_good_chart_classify WHERE parent_id<>0 AND is_delete=0 order by sort asc,future_good_chart_classify_id asc`
-// 	_, err = o.Raw(sql).QueryRows(&items)
-// 	return
-// }
-
-//	type FutureGoodChartClassifyItems struct {
-//		FutureGoodChartClassifyId   int `description:"分类id"`
-//		FutureGoodChartInfoId       int `description:"表格id"`
-//		FutureGoodChartClassifyName string
-//		ParentId                    int
-//		Level                       int    `description:"层级"`
-//		Sort                        int    `description:"排序字段,越小越靠前,默认值:10"`
-//		UniqueCode                  string `description:"唯一编码"`
-//		SysUserId                   int    `description:"创建人id"`
-//		SysUserRealName             string `description:"创建人姓名"`
-//		StartDate                   string `description:"自定义开始日期"`
-//		Children                    []*FutureGoodChartClassifyItems
-//	}
+
+
+
+
+
 type FutureGoodChartClassifyItems struct {
 	FutureGoodChartClassifyId   int                             `gorm:"column:future_good_chart_classify_id" description:"分类id"`
 	FutureGoodChartInfoId       int                             `gorm:"column:future_good_chart_info_id" description:"表格id"`
@@ -146,7 +84,6 @@ func GetFutureGoodChartClassifyByCondition(condition string, pars []interface{})
 	return
 }
 
-// GetNextFutureGoodChartClassifyByCondition 获取下一个分类
 func GetNextFutureGoodChartClassifyByCondition(condition string, pars []interface{}) (item *FutureGoodChartClassify, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM future_good_chart_classify WHERE 1=1 AND is_delete=0 `
@@ -158,7 +95,6 @@ func GetNextFutureGoodChartClassifyByCondition(condition string, pars []interfac
 	return
 }
 
-// GetFirstFutureGoodChartClassifyByParentId 获取当前父级图表分类下的排序第一条的数据
 func GetFirstFutureGoodChartClassifyByParentId(parentId int) (item *FutureGoodChartClassify, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM future_good_chart_classify WHERE parent_id=? AND is_delete=0 order by sort asc,future_good_chart_classify_id asc limit 1`
@@ -166,7 +102,6 @@ func GetFirstFutureGoodChartClassifyByParentId(parentId int) (item *FutureGoodCh
 	return
 }
 
-// UpdateFutureGoodChartClassifySortByParentId 根据图表父类id更新排序
 func UpdateFutureGoodChartClassifySortByParentId(parentId, classifyId, nowSort int, updateSort string) (err error) {
 	o := global.DmSQL["data"]
 	sql := ` update future_good_chart_classify set sort = ` + updateSort + ` WHERE parent_id=? and sort > ? AND is_delete=0 `
@@ -177,14 +112,12 @@ func UpdateFutureGoodChartClassifySortByParentId(parentId, classifyId, nowSort i
 	return
 }
 
-// Update 更新图表分类基础信息
 func (FutureGoodChartClassify *FutureGoodChartClassify) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(FutureGoodChartClassify).Select(cols).Updates(FutureGoodChartClassify).Error
 	return
 }
 
-// GetFutureGoodChartClassifyMaxSort 获取图表分类下最大的排序数
 func GetFutureGoodChartClassifyMaxSort(parentId int) (sort int, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT COALESCE(MAX(sort), 0) AS sort FROM future_good_chart_classify WHERE parent_id=? AND is_delete=0 `
@@ -192,67 +125,12 @@ func GetFutureGoodChartClassifyMaxSort(parentId int) (sort int, err error) {
 	return
 }
 
-// func GetFutureGoodChartClassifyByCondition(condition string, pars []interface{}) (item *FutureGoodChartClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM future_good_chart_classify WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// // GetNextFutureGoodChartClassifyByCondition 获取下一个分类
-// func GetNextFutureGoodChartClassifyByCondition(condition string, pars []interface{}) (item *FutureGoodChartClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM future_good_chart_classify WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += " ORDER BY sort asc , create_time ASC LIMIT 1 "
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// // GetFirstFutureGoodChartClassifyByParentId 获取当前父级图表分类下的排序第一条的数据
-// func GetFirstFutureGoodChartClassifyByParentId(parentId int) (item *FutureGoodChartClassify, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM future_good_chart_classify WHERE parent_id=? AND is_delete=0 order by sort asc,future_good_chart_classify_id asc limit 1`
-// 	err = o.Raw(sql, parentId).QueryRow(&item)
-// 	return
-// }
-
-// // UpdateFutureGoodChartClassifySortByParentId 根据图表父类id更新排序
-// func UpdateFutureGoodChartClassifySortByParentId(parentId, classifyId, nowSort int, updateSort string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` update future_good_chart_classify set sort = ` + updateSort + ` WHERE parent_id=? and sort > ? AND is_delete=0 `
-// 	if classifyId > 0 {
-// 		sql += ` or ( future_good_chart_classify_id > ` + fmt.Sprint(classifyId) + ` and sort= ` + fmt.Sprint(nowSort) + `)`
-// 	}
-// 	_, err = o.Raw(sql, parentId, nowSort).Exec()
-// 	return
-// }
-
-// // Update 更新图表分类基础信息
-// func (FutureGoodChartClassify *FutureGoodChartClassify) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(FutureGoodChartClassify, cols...)
-// 	return
-// }
-
-// // GetFutureGoodChartClassifyMaxSort 获取图表分类下最大的排序数
-// func GetFutureGoodChartClassifyMaxSort(parentId int) (sort int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT Max(sort) AS sort FROM future_good_chart_classify WHERE parent_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, parentId).QueryRow(&sort)
-// 	return
-// }
-
-//	type FutureGoodChartClassifyView struct {
-//		FutureGoodChartClassifyId   int    `orm:"column(future_good_chart_classify_id);pk"`
-//		FutureGoodChartClassifyName string `description:"分类名称"`
-//		ParentId                    int    `description:"父级id"`
-//	}
+
+
+
+
+
+
 type FutureGoodChartClassifyView struct {
 	FutureGoodChartClassifyId   int    `gorm:"column:future_good_chart_classify_id;primaryKey" description:"分类ID" orm:"column(future_good_chart_classify_id);pk"`
 	FutureGoodChartClassifyName string `gorm:"column:future_good_chart_classify_name" description:"分类名称"`
@@ -266,7 +144,6 @@ func GetFutureGoodChartClassifyViewById(classifyId int) (item *FutureGoodChartCl
 	return
 }
 
-// 用于分类展示
 func GetChartInfoAll() (items []*FutureGoodChartClassifyItems, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT chart_info_id,chart_classify_id,chart_name AS chart_classify_name,
@@ -276,7 +153,6 @@ func GetChartInfoAll() (items []*FutureGoodChartClassifyItems, err error) {
 	return
 }
 
-// GetNoContentFutureGoodInfoAll 获取不含content的表格列表 用于分类展示
 func GetNoContentFutureGoodInfoAll() (items []FutureGoodChartClassifyItems, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
@@ -286,7 +162,6 @@ func GetNoContentFutureGoodInfoAll() (items []FutureGoodChartClassifyItems, err
 	return
 }
 
-// GetFutureGoodChartInfoCountByClassifyId 根据分类id获取名下表格数量
 func GetFutureGoodChartInfoCountByClassifyId(classifyId int) (total int64, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
@@ -294,37 +169,6 @@ func GetFutureGoodChartInfoCountByClassifyId(classifyId int) (total int64, err e
 	return
 }
 
-// func GetFutureGoodChartClassifyViewById(classifyId int) (item *FutureGoodChartClassifyView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_chart_classify WHERE future_good_chart_classify_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&item)
-// 	return
-// }
-
-// // 用于分类展示
-// func GetChartInfoAll() (items []*FutureGoodChartClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT chart_info_id,chart_classify_id,chart_name AS chart_classify_name,
-//              unique_code,sys_user_id,sys_user_real_name,date_type,start_date,end_date,chart_type,calendar,season_start_date,season_end_date
-//             FROM chart_info ORDER BY sort asc,create_time ASC `
-// 	_, err = o.Raw(sql).QueryRows(&items)
-// 	return
-// }
-
-// // GetNoContentFutureGoodInfoAll 获取不含content的表格列表 用于分类展示
-// func GetNoContentFutureGoodInfoAll() (items []FutureGoodChartClassifyItems, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,excel_classify_id,excel_name AS excel_classify_name,
-//              unique_code,sys_user_id,sys_user_real_name
-//             FROM excel_info where is_delete=0 ORDER BY sort asc,create_time desc `
-// 	_, err = o.Raw(sql).QueryRows(&items)
-// 	return
-// }
-
-// // GetFutureGoodChartInfoCountByClassifyId 根据分类id获取名下表格数量
-// func GetFutureGoodChartInfoCountByClassifyId(classifyId int) (total int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&total)
-// 	return
-// }
+
+
+

+ 9 - 114
models/data_manage/future_good/future_good_edb_info.go

@@ -5,31 +5,7 @@ import (
 	"time"
 )
 
-// FutureGoodEdbInfo 期货指标表
-// type FutureGoodEdbInfo struct {
-// 	FutureGoodEdbInfoId int       `orm:"column(future_good_edb_info_id);pk"`
-// 	FutureGoodEdbCode   string    `description:"期货指标code"`
-// 	FutureGoodEdbName   string    `description:"期货指标名称"`
-// 	FutureGoodEdbNameEn string    `description:"期货指标英文名称"`
-// 	ParentId            int       `description:"上级期货id"`
-// 	RegionType          string    `description:"交易所来源,海外还是国内"`
-// 	Exchange            string    `description:"所属交易所"`
-// 	FutureGoodEdbType   int       `description:"指标类型,1:年月是固定的合约;2:只有M+N期的合约,未固定年月"`
-// 	DateSourceId        int       `description:"画图时,日期来源的指标id"`
-// 	Year                int       `description:"所属年份"`
-// 	Month               int       `description:"所属月份"`
-// 	StartDate           string    `description:"起始日期"`
-// 	EndDate             string    `description:"终止日期"`
-// 	MinValue            float64   `description:"最小值"`
-// 	MaxValue            float64   `description:"最大值"`
-// 	LatestValue         float64   `description:"数据最新的值"`
-// 	LatestDate          time.Time `description:"数据最新的日期"`
-// 	ServerUrl           string    `description:"服务器地址"`
-// 	CreateTime          time.Time
-// 	ModifyTime          time.Time
-// }
-
-// FutureGoodEdbInfo 期货指标表
+
 type FutureGoodEdbInfo struct {
 	FutureGoodEdbInfoId int       `gorm:"column:future_good_edb_info_id;primaryKey" description:"期货指标ID" orm:"column(future_good_edb_info_id);pk"`
 	FutureGoodEdbCode   string    `gorm:"column:future_good_edb_code" description:"期货指标code"`
@@ -53,7 +29,6 @@ type FutureGoodEdbInfo struct {
 	ModifyTime          time.Time `gorm:"column:modify_time" description:"更新时间"`
 }
 
-// GetFutureGoodEdbInfo 期货指标
 func GetFutureGoodEdbInfo(edbInfoId int) (item *FutureGoodEdbInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_info WHERE future_good_edb_info_id = ? `
@@ -62,7 +37,6 @@ func GetFutureGoodEdbInfo(edbInfoId int) (item *FutureGoodEdbInfo, err error) {
 	return
 }
 
-// GetFutureGoodEdbInfoByCode 根据期货code获取 期货指标信息
 func GetFutureGoodEdbInfoByCode(futureGoodEdbCode string) (item *FutureGoodEdbInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_info WHERE future_good_edb_code = ? `
@@ -71,7 +45,6 @@ func GetFutureGoodEdbInfoByCode(futureGoodEdbCode string) (item *FutureGoodEdbIn
 	return
 }
 
-// GetFutureGoodEdbInfoList 获取指标数据列表
 func GetFutureGoodEdbInfoList(condition string, pars []interface{}) (list []*FutureGoodEdbInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_info WHERE 1=1 `
@@ -83,7 +56,6 @@ func GetFutureGoodEdbInfoList(condition string, pars []interface{}) (list []*Fut
 	return
 }
 
-// GetAllFutureGoodEdbInfoList 获取指标数据列表
 func GetAllFutureGoodEdbInfoList() (list []*FutureGoodEdbInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_info  ORDER BY future_good_edb_info_id DESC `
@@ -91,7 +63,6 @@ func GetAllFutureGoodEdbInfoList() (list []*FutureGoodEdbInfo, err error) {
 	return
 }
 
-// GetFutureGoodEdbInfoListByParentId 根据父级ID获取指标数据列表
 func GetFutureGoodEdbInfoListByParentId(parentId int) (list []*FutureGoodEdbInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_info WHERE parent_id = ? or  future_good_edb_info_id = ? ORDER BY future_good_edb_info_id ASC `
@@ -99,92 +70,31 @@ func GetFutureGoodEdbInfoListByParentId(parentId int) (list []*FutureGoodEdbInfo
 	return
 }
 
-// AddFutureGoodEdbInfo 添加期货数据库指标
 func AddFutureGoodEdbInfo(item *FutureGoodEdbInfo) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(item).Error
 	return
 }
 
-// Update 更新指标基础信息
 func (FutureGoodEdbInfo *FutureGoodEdbInfo) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(FutureGoodEdbInfo).Select(cols).Updates(FutureGoodEdbInfo).Error
 	return
 }
 
-// GetFutureGoodEdbInfo 期货指标
-// func GetFutureGoodEdbInfo(edbInfoId int) (item *FutureGoodEdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_info WHERE future_good_edb_info_id = ? `
-// 	sql += ` ORDER BY future_good_edb_info_id DESC `
-// 	err = o.Raw(sql, edbInfoId).QueryRow(&item)
-// 	return
-// }
-
-// // GetFutureGoodEdbInfoByCode 根据期货code获取 期货指标信息
-// func GetFutureGoodEdbInfoByCode(futureGoodEdbCode string) (item *FutureGoodEdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_info WHERE future_good_edb_code = ? `
-// 	sql += ` ORDER BY future_good_edb_info_id DESC `
-// 	err = o.Raw(sql, futureGoodEdbCode).QueryRow(&item)
-// 	return
-// }
-
-// // GetFutureGoodEdbInfoList 获取指标数据列表
-// func GetFutureGoodEdbInfoList(condition string, pars []interface{}) (list []*FutureGoodEdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_info WHERE 1=1 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += `ORDER BY future_good_edb_info_id DESC `
-// 	_, err = o.Raw(sql, pars).QueryRows(&list)
-// 	return
-// }
-
-// // GetAllFutureGoodEdbInfoList 获取指标数据列表
-// func GetAllFutureGoodEdbInfoList() (list []*FutureGoodEdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_info  ORDER BY future_good_edb_info_id DESC `
-// 	_, err = o.Raw(sql).QueryRows(&list)
-// 	return
-// }
-
-// // GetFutureGoodEdbInfoListByParentId 根据父级ID获取指标数据列表
-// func GetFutureGoodEdbInfoListByParentId(parentId int) (list []*FutureGoodEdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_info WHERE parent_id = ? or  future_good_edb_info_id = ? ORDER BY future_good_edb_info_id ASC `
-// 	_, err = o.Raw(sql, parentId, parentId).QueryRows(&list)
-// 	return
-// }
-
-// // AddFutureGoodEdbInfo 添加期货数据库指标
-// func AddFutureGoodEdbInfo(item *FutureGoodEdbInfo) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err := o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-// 	item.FutureGoodEdbInfoId = int(lastId)
-// 	return
-// }
-
-// // Update 更新指标基础信息
-// func (FutureGoodEdbInfo *FutureGoodEdbInfo) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(FutureGoodEdbInfo, cols...)
-// 	return
-// }
-
-// FutureGoodEdbInfoGroupListResp 期货指标数据列表数据返回
+
+
+
+
+
+
+
 type FutureGoodEdbInfoGroupListResp struct {
 	FutureGoodEdbInfoId   int
 	FutureGoodEdbInfoName string
 	Child                 []FutureGoodEdbInfoGroupListResp
 }
 
-// GetFutureGoodEdbInfoGroupList 获取分組指标数据列表
 func GetFutureGoodEdbInfoGroupList(condition string, pars []interface{}) (list []*FutureGoodEdbInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_info WHERE 1=1 `
@@ -196,33 +106,19 @@ func GetFutureGoodEdbInfoGroupList(condition string, pars []interface{}) (list [
 	return
 }
 
-// GetFutureGoodEdbInfoGroupList 获取分組指标数据列表
-// func GetFutureGoodEdbInfoGroupList(condition string, pars []interface{}) (list []*FutureGoodEdbInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_info WHERE 1=1 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += ` ORDER BY future_good_edb_info_id DESC `
-// 	_, err = o.Raw(sql, pars).QueryRows(&list)
-// 	return
-// }
-
-// BarChartInfoReq 柱方图预览请求数据
+
 type BarChartInfoReq struct {
 	EdbInfoIdList []BarChartInfoEdbItemReq `description:"指标信息"`
 	DateList      []BarChartInfoDateReq    `description:"日期配置"`
 	Sort          BarChartInfoSortReq      `description:"排序"`
 }
 
-// BarChartInfoEdbItemReq 柱方图预览请求数据(指标相关)
 type BarChartInfoEdbItemReq struct {
 	EdbInfoId int    `description:"指标ID"`
 	Name      string `description:"别名"`
 	Source    int    `description:"1:ETA图库;2:商品价格"`
 }
 
-// BarChartInfoDateReq 柱方图预览请求数据(日期相关)
 type BarChartInfoDateReq struct {
 	Type  int    `description:"配置类型"`
 	Date  string `description:"固定日期"`
@@ -231,7 +127,6 @@ type BarChartInfoDateReq struct {
 	Name  string `description:"别名"`
 }
 
-// BarChartInfoSortReq 柱方图预览请求数据(排序相关)
 type BarChartInfoSortReq struct {
 	Sort      int `description:"排序类型,0:默认,1:升序,2:降序"`
 	DateIndex int `description:"日期数据的下标,从0开始"`

+ 6 - 105
models/data_manage/future_good/future_good_edb_info_data.go

@@ -8,28 +8,7 @@ import (
 	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
-// FutureGoodEdbData 期货指标数据的表
-//
-//	type FutureGoodEdbData struct {
-//		FutureGoodEdbDataId int       `orm:"column(future_good_edb_data_id);pk"`
-//		FutureGoodEdbInfoId int       `description:"期货指标id"`
-//		FutureGoodEdbCode   string    `description:"期货指标code"`
-//		DataTime            time.Time `description:"数据日期"`
-//		TradeCode           string    `description:"证券代码"`
-//		Open                float64   `description:"开盘价"`
-//		High                float64   `description:"最高价"`
-//		Low                 float64   `description:"最低价"`
-//		Close               float64   `description:"收盘价"`
-//		Volume              float64   `description:"成交量"`
-//		Amt                 float64   `description:"成交额"`
-//		Oi                  float64   `description:"持仓量"`
-//		Settle              float64   `description:"结算价"`
-//		DataTimestamp       int64     `description:"数据日期时间戳"`
-//		ModifyTime          time.Time
-//		CreateTime          time.Time
-//	}
-
-// FutureGoodEdbData 期货指标数据的表
+
 type FutureGoodEdbData struct {
 	FutureGoodEdbDataId int       `gorm:"column:future_good_edb_data_id;primaryKey" description:"期货指标数据ID" orm:"column(future_good_edb_data_id);pk"`
 	FutureGoodEdbInfoId int       `gorm:"column:future_good_edb_info_id" description:"期货指标id"`
@@ -49,35 +28,12 @@ type FutureGoodEdbData struct {
 	CreateTime          time.Time `gorm:"column:create_time" description:"创建时间"`
 }
 
-// FutureGoodEdbDataListResp 期货指标数据列表数据返回
 type FutureGoodEdbDataListResp struct {
 	Paging *paging.PagingItem
 	List   []*FutureGoodEdbDataItem
 }
 
-// FutureGoodEdbDataItem 期货指标数据列表数据
-//
-//	type FutureGoodEdbDataItem struct {
-//		FutureGoodEdbDataId int     `orm:"column(future_good_edb_data_id);pk"`
-//		FutureGoodEdbInfoId int     `description:"期货指标id"`
-//		FutureGoodEdbCode   string  `description:"期货指标code"`
-//		FutureGoodEdbName   string  `description:"期货指标名称"`
-//		DataTime            string  `description:"数据日期"`
-//		TradeCode           string  `description:"证券代码"`
-//		Open                float64 `description:"开盘价"`
-//		High                float64 `description:"最高价"`
-//		Low                 float64 `description:"最低价"`
-//		Close               float64 `description:"收盘价"`
-//		Volume              float64 `description:"成交量"`
-//		Amt                 float64 `description:"成交额"`
-//		Oi                  float64 `description:"持仓量"`
-//		Settle              float64 `description:"结算价"`
-//		DataTimestamp       int64   `description:"数据日期时间戳"`
-//		ModifyTime          string
-//		CreateTime          string
-//	}
-
-// FutureGoodEdbDataItem 期货指标数据列表数据
+
 type FutureGoodEdbDataItem struct {
 	FutureGoodEdbDataId int     `gorm:"column:future_good_edb_data_id;primaryKey" description:"期货指标数据ID" orm:"column(future_good_edb_data_id);pk"`
 	FutureGoodEdbInfoId int     `gorm:"column:future_good_edb_info_id" description:"期货指标id"`
@@ -98,7 +54,6 @@ type FutureGoodEdbDataItem struct {
 	CreateTime          string  `gorm:"column:create_time" description:"创建时间"`
 }
 
-// GetFutureGoodEdbDataListCount 获取期货指标数据汇总数
 func GetFutureGoodEdbDataListCount(condition string, pars []interface{}) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT COUNT(1) AS count FROM future_good_edb_data WHERE 1=1 `
@@ -109,7 +64,6 @@ func GetFutureGoodEdbDataListCount(condition string, pars []interface{}) (count
 	return
 }
 
-// GetFutureGoodEdbDataList 获取期货指标数据列表
 func GetFutureGoodEdbDataList(condition string, pars []interface{}, startSize, pageSize int) (list []*FutureGoodEdbDataItem, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM future_good_edb_data WHERE 1=1 `
@@ -122,28 +76,7 @@ func GetFutureGoodEdbDataList(condition string, pars []interface{}, startSize, p
 	return
 }
 
-// GetFutureGoodEdbDataListCount 获取期货指标数据汇总数
-// func GetFutureGoodEdbDataListCount(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT COUNT(1) AS count FROM future_good_edb_data WHERE 1=1 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// // GetFutureGoodEdbDataList 获取期货指标数据列表
-// func GetFutureGoodEdbDataList(condition string, pars []interface{}, startSize, pageSize int) (list []*FutureGoodEdbDataItem, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM future_good_edb_data WHERE 1=1 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += `ORDER BY modify_time DESC LIMIT ?,?`
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
-// 	return
-// }
+
 
 type EdbDataList struct {
 	EdbDataId     int     `description:" 指标数据ID"`
@@ -191,38 +124,6 @@ func GetFutureGoodEdbDataListByIdsAndDate(futureGoodEdbInfoIds []int, startDate,
 	return
 }
 
-// func GetFutureGoodEdbDataListByDate(futureGoodEdbInfoId int, startDate, endDate string) (list []*FutureGoodEdbData, err error) {
-// 	var pars []interface{}
-// 	sql := `SELECT * FROM future_good_edb_data WHERE 1=1 AND future_good_edb_info_id = ? `
-// 	if startDate != "" {
-// 		sql += ` AND data_time>=? `
-// 		pars = append(pars, startDate)
-// 	}
-// 	if endDate != "" {
-// 		sql += ` AND data_time<=? `
-// 		pars = append(pars, endDate)
-// 	}
-
-// 	sql += ` ORDER BY data_time ASC `
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Raw(sql, futureGoodEdbInfoId, pars).QueryRows(&list)
-// 	return
-// }
-
-// func GetFutureGoodEdbDataListByIdsAndDate(futureGoodEdbInfoIds []int, startDate, endDate string) (list []*FutureGoodEdbData, err error) {
-// 	var pars []interface{}
-// 	sql := `SELECT * FROM future_good_edb_data WHERE 1=1 AND future_good_edb_info_id in (` + utils.GetOrmInReplace(len(futureGoodEdbInfoIds)) + `)  `
-// 	if startDate != "" {
-// 		sql += ` AND data_time>=? `
-// 		pars = append(pars, startDate)
-// 	}
-// 	if endDate != "" {
-// 		sql += ` AND data_time<=? `
-// 		pars = append(pars, endDate)
-// 	}
-
-// 	sql += ` ORDER BY data_time ASC `
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Raw(sql, futureGoodEdbInfoIds, pars).QueryRows(&list)
-// 	return
-// }
+
+
+

+ 0 - 3
models/data_manage/future_good/request/future_good_chart.go

@@ -10,7 +10,6 @@ type EditChartEnInfoReq struct {
 	UnitEn      string `description:"英文单位"`
 }
 
-// ChartInfoReq 图表预览请求数据
 type ChartInfoReq struct {
 	FutureGoodEdbInfoIdList []EdbInfoFromTag   `description:"指标信息"`
 	CalculateFormula        string             `description:"计算公式"`
@@ -21,14 +20,12 @@ type ChartInfoReq struct {
 	XDataList               []models.XData     `description:"横轴配置"`
 }
 
-// EdbInfoFromTag 计算指标的关联指标
 type EdbInfoFromTag struct {
 	EdbInfoId int    `description:"指标id"`
 	FromTag   string `description:"指标对应标签"`
 	MoveValue int    `description:"移动的值"`
 }
 
-// ChartInfoDateReq 图表的日期数据(日期相关)
 type ChartInfoDateReq struct {
 	Type  int    `description:"配置类型"`
 	Date  string `description:"固定日期"`

+ 0 - 3
models/data_manage/future_good/request/future_good_chart_classify.go

@@ -1,19 +1,16 @@
 package request
 
-// AddFutureGoodChartClassifyReq 添加excel分类请求
 type AddFutureGoodChartClassifyReq struct {
 	FutureGoodChartClassifyName string `description:"分类名称"`
 	ParentId                    int    `description:"父级id,第一级传0" json:"-"`
 	Level                       int    `description:"层级,第一级传0,其余传上一级的层级" json:"-"`
 }
 
-// EditFutureGoodChartClassifyReq 修改excel分类请求
 type EditFutureGoodChartClassifyReq struct {
 	FutureGoodChartClassifyName string `description:"分类名称"`
 	FutureGoodChartClassifyId   int    `description:"分类名称"`
 }
 
-// MoveFutureGoodChartClassifyReq 移动图表分类请求参数
 type MoveFutureGoodChartClassifyReq struct {
 	ClassifyId       int `description:"分类id"`
 	ParentClassifyId int `description:"父级分类id" json:"-"`

+ 0 - 1
models/data_manage/future_good/response/future_good_chart_profit.go

@@ -5,7 +5,6 @@ import (
 	"eta_gn/eta_chart_lib/models/data_manage/future_good/request"
 )
 
-// ProfitFutureGoodChartResp 商品利润图
 type ProfitFutureGoodChartResp struct {
 	XDataList    []models.XData
 	YDataList    []models.YData

+ 0 - 2
models/data_manage/line_equation/request/line_equation.go

@@ -1,6 +1,5 @@
 package request
 
-// LineChartInfoReq 线性拟合图表预览请求数据
 type LineChartInfoReq struct {
 	DateType       int    `description:"日期类型"`
 	StartDate      string `description:"开始日期"`
@@ -24,7 +23,6 @@ type AddChart struct {
 	LeftMax         string `description:"图表左侧最大值"`
 }
 
-// EditChartEnInfoReq 编辑图表英文信息
 type EditChartEnInfoReq struct {
 	ChartInfoId int    `description:"图表ID"`
 	ChartNameEn string `description:"英文图表名称"`

+ 0 - 8
models/data_manage/line_feature/request/line_feature.go

@@ -1,6 +1,5 @@
 package request
 
-// SaveMultipleGraphConfigReq 多图配置请求
 type SaveMultipleGraphConfigReq struct {
 	MultipleGraphConfigId int                   `description:"配置id"`
 	EdbInfoId             int                   `description:"指标"`
@@ -10,7 +9,6 @@ type SaveMultipleGraphConfigReq struct {
 	FrequencyDistribution FrequencyDistribution `description:"频率分布配置"`
 }
 
-// ConfigSave 数据库保存
 type ConfigSave struct {
 	Curve                 CurveConfig           `description:"曲线图配置"`
 	StandardDeviation     StandardDeviation     `description:"标准差配置"`
@@ -18,7 +16,6 @@ type ConfigSave struct {
 	FrequencyDistribution FrequencyDistribution `description:"频率分布配置"`
 }
 
-// CurveConfig 曲线图配置
 type CurveConfig struct {
 	DateType  int     `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
 	StartDate string  `description:"自定义开始日期"`
@@ -38,14 +35,12 @@ type Percentile struct {
 }
 
 type FrequencyDistribution struct {
-	//最近3月 最近6月 最近1年 最近2年 最近3年 最近5年 最近10年
 	DateType       int    `description:"日期类型:1:最近3月;2:最近6月;3:最近1年;4:最近2年;5:最近3年;6:最近5年;7:最近10年,8:自定义时间"`
 	StartDate      string `description:"自定义开始日期"`
 	EndDate        string `description:"自定义结束日期"`
 	FrequencyValue int    `description:"频段数,10/20"`
 }
 
-// LineChartInfoReq 线性拟合图表预览请求数据
 type LineChartInfoReq struct {
 	DateType       int    `description:"日期类型"`
 	StartDate      string `description:"开始日期"`
@@ -70,13 +65,11 @@ type AddChart struct {
 	ChartImage      string `description:"图表截图,复制的时候才用到" json:"-"`
 }
 
-// EditChartEnInfoReq 编辑图表英文信息
 type EditChartEnInfoReq struct {
 	ChartInfoId int    `description:"图表ID"`
 	ChartNameEn string `description:"英文图表名称"`
 }
 
-// SaveMultipleGraphChartReq 多图配置的单图保存请求
 type SaveMultipleGraphChartReq struct {
 	Source                int                   `description:"来源,1:曲线图,8:标准差图表;9:百分位图表;10:频率分布图表;"`
 	ChartName             string                `description:"图表名称"`
@@ -90,7 +83,6 @@ type SaveMultipleGraphChartReq struct {
 	IsSaveAs              bool                  `description:"是否另存为,true的话,就是另存为,不会建立与配置的关系"`
 }
 
-// SaveMultipleGraphEdbReq 多图配置的单指标保存请求
 type SaveMultipleGraphEdbReq struct {
 	EdbName    string `description:"指标名称"`
 	Frequency  string `description:"频度"`

+ 0 - 4
models/data_manage/line_feature/response/line_feature.go

@@ -2,7 +2,6 @@ package response
 
 import "eta_gn/eta_chart_lib/models"
 
-// LineFeatureDataResp 曲线图的一些数据返回
 type LineFeatureDataResp struct {
 	MaxData             float64
 	MinData             float64
@@ -21,7 +20,6 @@ type LineFeatureDataResp struct {
 	DataList            []models.EdbDataList
 }
 
-// FrequencyDistributionResp 频率分布图数据
 type FrequencyDistributionResp struct {
 	LeftMinValue  float64
 	LeftMaxValue  float64
@@ -30,7 +28,6 @@ type FrequencyDistributionResp struct {
 	DataList      []FrequencyDistributionData
 }
 
-// FrequencyDistributionData 频率分布的值
 type FrequencyDistributionData struct {
 	Name   string      `description:"别名"`
 	NameEn string      `description:"英文别名"`
@@ -41,7 +38,6 @@ type FrequencyDistributionData struct {
 	IsAxis int         `description:"1:左轴,0:右轴"`
 }
 
-// FrequencyDistributionYData 频率分布的实际数据
 type FrequencyDistributionYData struct {
 	X float64
 	Y float64

+ 0 - 48
models/data_manage/multiple_graph_config.go

@@ -5,22 +5,7 @@ import (
 	"time"
 )
 
-// MultipleGraphConfig 多图配置表
-//
-//	type MultipleGraphConfig struct {
-//		MultipleGraphConfigId int       `orm:"column(multiple_graph_config_id);pk"`
-//		EdbInfoIdA            int       `description:"指标A"`
-//		EdbInfoIdB            int       `description:"指标B"`
-//		Curve                 string    `description:"曲线图配置"`
-//		Correlation           string    `description:"相关性配置"`
-//		RollingCorrelation    string    `description:"滚动相关性配置"`
-//		SysUserId             int       `description:"操作人id"`
-//		SysUserRealName       string    `description:"操作人真实姓名"`
-//		ModifyTime            time.Time `description:"最近一次修改时间"`
-//		CreateTime            time.Time `description:"添加时间"`
-//	}
 
-// MultipleGraphConfig 多图配置表
 type MultipleGraphConfig struct {
 	MultipleGraphConfigId int       `gorm:"column:multiple_graph_config_id;primaryKey" description:"多图配置ID" orm:"column(multiple_graph_config_id);pk"`
 	EdbInfoIdA            int       `gorm:"column:edb_info_id_a" description:"指标A"`
@@ -34,59 +19,28 @@ type MultipleGraphConfig struct {
 	CreateTime            time.Time `gorm:"column:create_time" description:"添加时间"`
 }
 
-// AddMultipleGraphConfig 新增多图配置
 func AddMultipleGraphConfig(item *MultipleGraphConfig) (err error) {
 	o := global.DmSQL["data"]
-	// 表格信息入库
 	err = o.Create(item).Error
 	return
 }
 
-// Update 更新 基础信息
 func (item *MultipleGraphConfig) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(item).Select(cols).Updates(item).Error
 	return
 }
 
-// GetMultipleGraphConfigById 根据配置id获取配置
 func GetMultipleGraphConfigById(id int) (item *MultipleGraphConfig, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM multiple_graph_config WHERE multiple_graph_config_id = ? `
-	// 表格信息入库
 	err = o.Raw(sql, id).First(&item).Error
 	return
 }
 
-// AddMultipleGraphConfig 新增多图配置
-// func AddMultipleGraphConfig(item *MultipleGraphConfig) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-// 	item.MultipleGraphConfigId = int(lastId)
-// 	return
-// }
 
-// // Update 更新 基础信息
-// func (item *MultipleGraphConfig) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(item, cols...)
-// 	return
-// }
 
-// // GetMultipleGraphConfigById 根据配置id获取配置
-// func GetMultipleGraphConfigById(id int) (item *MultipleGraphConfig, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config WHERE multiple_graph_config_id = ? `
-// 	// 表格信息入库
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }
 
-// CurveConfig 曲线图配置
 type CurveConfig struct {
 	DateType    int     `description:"日期类型:1:00年至今,2:10年至今,3:15年至今,4:年初至今,5:自定义时间"`
 	StartDate   string  `description:"自定义开始日期"`
@@ -101,7 +55,6 @@ type CurveConfig struct {
 	LeadUnit    string  `description:"领先单位"`
 }
 
-// CorrelationConfig 相关性配置
 type CorrelationConfig struct {
 	LeadValue      int    `description:"领先期数"`
 	LeadUnit       string `description:"频度"`
@@ -109,7 +62,6 @@ type CorrelationConfig struct {
 	CalculateUnit  string `description:"计算频度"`
 }
 
-// RollingCorrelationConfig 滚动相关性配置
 type RollingCorrelationConfig struct {
 	LeadValue      int    `description:"领先期数"`
 	LeadUnit       string `description:"频度"`

+ 8 - 63
models/data_manage/multiple_graph_config_chart_mapping.go

@@ -5,18 +5,7 @@ import (
 	"time"
 )
 
-// MultipleGraphConfigChartMapping 图表与多图配置的关系表
-//
-//	type MultipleGraphConfigChartMapping struct {
-//		Id                    int       `orm:"column(id);pk"`
-//		MultipleGraphConfigId int       `description:"多图配置id"`
-//		ChartInfoId           int       `description:"图表id"`
-//		Source                int       `description:"来源,1:曲线图,2:相关性图;3:滚动相关性图1;4:滚动相关性图2;"`
-//		ModifyTime            time.Time `description:"最近一次修改时间"`
-//		CreateTime            time.Time `description:"添加时间"`
-//	}
-
-// MultipleGraphConfigChartMapping 图表与多图配置的关系表
+
 type MultipleGraphConfigChartMapping struct {
 	Id                    int       `gorm:"column:id;primaryKey" description:"主键ID" orm:"column(id);pk"`
 	MultipleGraphConfigId int       `gorm:"column:multiple_graph_config_id" description:"多图配置id"`
@@ -26,22 +15,18 @@ type MultipleGraphConfigChartMapping struct {
 	CreateTime            time.Time `gorm:"column:create_time" description:"添加时间"`
 }
 
-// AddMultipleGraphConfigChartMapping 新增多图配置
 func AddMultipleGraphConfigChartMapping(item *MultipleGraphConfigChartMapping) (err error) {
 	o := global.DmSQL["data"]
-	// 表格信息入库
 	err = o.Create(item).Error
 	return
 }
 
-// Update 更新 基础信息
 func (item *MultipleGraphConfigChartMapping) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(item).Select(cols).Updates(item).Error
 	return
 }
 
-// GetMultipleGraphConfigChartMappingByIdAndSource 根据配置id和来源获取关联关系
 func GetMultipleGraphConfigChartMappingByIdAndSource(configId, source int) (item *MultipleGraphConfigChartMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE multiple_graph_config_id = ? AND source = ? `
@@ -50,7 +35,6 @@ func GetMultipleGraphConfigChartMappingByIdAndSource(configId, source int) (item
 	return
 }
 
-// GetMultipleGraphConfigChartMappingByChartId 根据图表id和来源获取关联关系
 func GetMultipleGraphConfigChartMappingByChartId(chartId int) (item *MultipleGraphConfigChartMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE chart_info_id = ?  `
@@ -59,7 +43,6 @@ func GetMultipleGraphConfigChartMappingByChartId(chartId int) (item *MultipleGra
 	return
 }
 
-// GetMultipleGraphConfigChartMappingListById 根据配置id获取所有关联关系
 func GetMultipleGraphConfigChartMappingListById(configId int) (items []*MultipleGraphConfigChartMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE multiple_graph_config_id = ? `
@@ -68,48 +51,10 @@ func GetMultipleGraphConfigChartMappingListById(configId int) (items []*Multiple
 	return
 }
 
-// AddMultipleGraphConfigChartMapping 新增多图配置
-// func AddMultipleGraphConfigChartMapping(item *MultipleGraphConfigChartMapping) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-// 	item.Id = int(lastId)
-// 	return
-// }
-
-// // Update 更新 基础信息
-// func (item *MultipleGraphConfigChartMapping) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(item, cols...)
-// 	return
-// }
-
-// // GetMultipleGraphConfigChartMappingByIdAndSource 根据配置id和来源获取关联关系
-// func GetMultipleGraphConfigChartMappingByIdAndSource(configId, source int) (item *MultipleGraphConfigChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE multiple_graph_config_id = ? AND source = ? `
-// 	err = o.Raw(sql, configId, source).QueryRow(&item)
-
-// 	return
-// }
-
-// // GetMultipleGraphConfigChartMappingByChartId 根据图表id和来源获取关联关系
-// func GetMultipleGraphConfigChartMappingByChartId(chartId int) (item *MultipleGraphConfigChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE chart_info_id = ?  `
-// 	err = o.Raw(sql, chartId).QueryRow(&item)
-
-// 	return
-// }
-
-// // GetMultipleGraphConfigChartMappingListById 根据配置id获取所有关联关系
-// func GetMultipleGraphConfigChartMappingListById(configId int) (items []*MultipleGraphConfigChartMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config_chart_mapping WHERE multiple_graph_config_id = ? `
-// 	_, err = o.Raw(sql, configId).QueryRows(&items)
-
-// 	return
-// }
+
+
+
+
+
+
+

+ 7 - 61
models/data_manage/multiple_graph_config_edb_mapping.go

@@ -5,17 +5,7 @@ import (
 	"time"
 )
 
-// MultipleGraphConfigEdbMapping 指标与多图配置的关系表
-// type MultipleGraphConfigEdbMapping struct {
-// 	Id                    int       `orm:"column(id);pk"`
-// 	MultipleGraphConfigId int       `description:"多图配置id"`
-// 	EdbInfoId             int       `description:"指标id"`
-// 	Source                int       `description:"来源,1:曲线图,2:相关性图;3:滚动相关性图1;4:滚动相关性图2;"`
-// 	ModifyTime            time.Time `description:"最近一次修改时间"`
-// 	CreateTime            time.Time `description:"添加时间"`
-// }
-
-// MultipleGraphConfigEdbMapping 指标与多图配置的关系表
+
 type MultipleGraphConfigEdbMapping struct {
 	Id                    int       `gorm:"column:id;primaryKey" description:"主键ID" orm:"column(id);pk"`
 	MultipleGraphConfigId int       `gorm:"column:multiple_graph_config_id" description:"多图配置id"`
@@ -25,31 +15,25 @@ type MultipleGraphConfigEdbMapping struct {
 	CreateTime            time.Time `gorm:"column:create_time" description:"添加时间"`
 }
 
-// AddMultipleGraphConfigEdbMapping 新增多图配置
 func AddMultipleGraphConfigEdbMapping(item *MultipleGraphConfigEdbMapping) (err error) {
 	o := global.DmSQL["data"]
-	// 表格信息入库
 	err = o.Create(item).Error
 	return
 }
 
-// Update 更新 基础信息
 func (item *MultipleGraphConfigEdbMapping) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(item).Select(cols).Updates(item).Error
 	return
 }
 
-// GetMultipleGraphConfigEdbMappingByIdAndSource 根据配置id和来源获取关联关系
 func GetMultipleGraphConfigEdbMappingByIdAndSource(configId, source int) (item *MultipleGraphConfigEdbMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM multiple_graph_config_edb_mapping WHERE multiple_graph_config_id = ? AND source = ? `
-	// 表格信息入库
 	err = o.Raw(sql, configId, source).First(&item).Error
 	return
 }
 
-// GetMultipleGraphConfigEdbMappingListById 根据配置id获取所有关联关系
 func GetMultipleGraphConfigEdbMappingListById(configId int) (items []*MultipleGraphConfigEdbMapping, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM multiple_graph_config_edb_mapping WHERE multiple_graph_config_id = ? `
@@ -66,47 +50,9 @@ func GetMultipleGraphConfigEdbMappingListByIdAndSource(configId, source int) (it
 	return
 }
 
-// AddMultipleGraphConfigEdbMapping 新增多图配置
-// func AddMultipleGraphConfigEdbMapping(item *MultipleGraphConfigEdbMapping) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-// 	item.Id = int(lastId)
-// 	return
-// }
-
-// // Update 更新 基础信息
-// func (item *MultipleGraphConfigEdbMapping) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(item, cols...)
-// 	return
-// }
-
-// // GetMultipleGraphConfigEdbMappingByIdAndSource 根据配置id和来源获取关联关系
-// func GetMultipleGraphConfigEdbMappingByIdAndSource(configId, source int) (item *MultipleGraphConfigEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config_edb_mapping WHERE multiple_graph_config_id = ? AND source = ? `
-// 	// 表格信息入库
-// 	err = o.Raw(sql, configId, source).QueryRow(&item)
-// 	return
-// }
-
-// // GetMultipleGraphConfigEdbMappingListById 根据配置id获取所有关联关系
-// func GetMultipleGraphConfigEdbMappingListById(configId int) (items []*MultipleGraphConfigEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config_edb_mapping WHERE multiple_graph_config_id = ? `
-// 	_, err = o.Raw(sql, configId).QueryRows(&items)
-
-// 	return
-// }
-
-// func GetMultipleGraphConfigEdbMappingListByIdAndSource(configId, source int) (items []*MultipleGraphConfigEdbMapping, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM multiple_graph_config_edb_mapping WHERE multiple_graph_config_id = ? AND source = ? `
-// 	_, err = o.Raw(sql, configId, source).QueryRows(&items)
-
-// 	return
-// }
+
+
+
+
+
+

+ 0 - 132
models/data_manage/predict_edb_conf.go

@@ -7,17 +7,6 @@ import (
 	"time"
 )
 
-//	type PredictEdbConf struct {
-//		ConfigId         int       `orm:"column(config_id);pk" description:"规则id"`
-//		PredictEdbInfoId int       `orm:"column(predict_edb_info_id)" description:"预测指标id"`
-//		SourceEdbInfoId  int       `description:"来源指标id"`
-//		RuleType         int       `description:"预测规则,1:最新,2:固定值,3:同比,4:同差,5:环比,6:环差,7:N期移动均值,8:N期段线性外推值"`
-//		FixedValue       float64   `description:"固定值"`
-//		Value            string    `description:"配置的值"`
-//		EndDate          time.Time `description:"截止日期"`
-//		ModifyTime       time.Time `description:"修改时间"`
-//		CreateTime       time.Time `description:"添加时间"`
-//	}
 type PredictEdbConf struct {
 	ConfigId         int       `gorm:"column:config_id;primaryKey" description:"规则id" orm:"column(config_id);pk"`
 	PredictEdbInfoId int       `gorm:"column:predict_edb_info_id" description:"预测指标id"`
@@ -34,7 +23,6 @@ func (p *PredictEdbConf) TableName() string {
 	return "predict_edb_conf"
 }
 
-// GetPredictEdbConfById 根据预测指标id获取预测指标配置信息
 func GetPredictEdbConfById(edbInfoId int) (item *PredictEdbConf, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM predict_edb_conf WHERE predict_edb_info_id=? `
@@ -42,7 +30,6 @@ func GetPredictEdbConfById(edbInfoId int) (item *PredictEdbConf, err error) {
 	return
 }
 
-// GetPredictEdbConfBySourceEdbInfoId 根据来源指标id获取配置
 func GetPredictEdbConfBySourceEdbInfoId(sourceEdbInfoId int) (item *PredictEdbConf, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM predict_edb_conf WHERE source_edb_info_id=? `
@@ -50,7 +37,6 @@ func GetPredictEdbConfBySourceEdbInfoId(sourceEdbInfoId int) (item *PredictEdbCo
 	return
 }
 
-// GetPredictEdbConfCount 根据来源指标id获取被引用的次数
 func GetPredictEdbConfCount(sourceEdbInfoId int) (count int, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT COUNT(1) AS count FROM predict_edb_conf WHERE source_edb_info_id=? `
@@ -58,14 +44,12 @@ func GetPredictEdbConfCount(sourceEdbInfoId int) (count int, err error) {
 	return
 }
 
-// AddPredictEdbConf 添加预测指标规则
 func AddPredictEdbConf(item *PredictEdbConf) (lastId int64, err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(item).Error
 	return
 }
 
-// AddPredictEdb 添加预测指标
 func AddPredictEdb(item *EdbInfo, predictEdbConf *PredictEdbConf) (err error) {
 	o := global.DmSQL["data"]
 	tx := o.Begin()
@@ -79,13 +63,11 @@ func AddPredictEdb(item *EdbInfo, predictEdbConf *PredictEdbConf) (err error) {
 			_ = tx.Commit()
 		}
 	}()
-	// 新增预测指标
 	err = o.Create(item).Error
 	if err != nil {
 		return
 	}
 
-	// 新增预测指标配置
 	predictEdbConf.PredictEdbInfoId = item.EdbInfoId
 	err = o.Create(predictEdbConf).Error
 	if err != nil {
@@ -94,7 +76,6 @@ func AddPredictEdb(item *EdbInfo, predictEdbConf *PredictEdbConf) (err error) {
 	return
 }
 
-// EditPredictEdb 修改预测指标
 func EditPredictEdb(edbInfo *EdbInfo, predictEdbConf *PredictEdbConf, updateEdbInfoCol, updatePredictEdbConfCol []string) (err error) {
 	o := global.DmSQL["data"]
 	tx := o.Begin()
@@ -108,12 +89,10 @@ func EditPredictEdb(edbInfo *EdbInfo, predictEdbConf *PredictEdbConf, updateEdbI
 			_ = tx.Commit()
 		}
 	}()
-	// 修改预测指标
 	err = o.Model(edbInfo).Select(updateEdbInfoCol).Updates(edbInfo).Error
 	if err != nil {
 		return
 	}
-	// 修改预测指标配置
 	err = o.Model(predictEdbConf).Select(updatePredictEdbConfCol).Updates(predictEdbConf).Error
 	if err != nil {
 		return
@@ -121,7 +100,6 @@ func EditPredictEdb(edbInfo *EdbInfo, predictEdbConf *PredictEdbConf, updateEdbI
 	return
 }
 
-// GetPredictEdbInfoAllCalculate 根据基础预测指标id集合 获取 所有的普通指标列表数据
 func GetPredictEdbInfoAllCalculate(edbInfoIdList []int) (list []*EdbInfo, err error) {
 	num := len(edbInfoIdList)
 	if num <= 0 {
@@ -137,7 +115,6 @@ func GetPredictEdbInfoAllCalculate(edbInfoIdList []int) (list []*EdbInfo, err er
 	return
 }
 
-// GetPredictEdbConfListById 根据预测指标id获取预测指标配置信息列表
 func GetPredictEdbConfListById(edbInfoId int) (items []*PredictEdbConf, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM predict_edb_conf WHERE predict_edb_info_id=? ORDER BY config_id ASC`
@@ -145,120 +122,11 @@ func GetPredictEdbConfListById(edbInfoId int) (items []*PredictEdbConf, err erro
 	return
 }
 
-// GetPredictEdbConfById 根据预测指标id获取预测指标配置信息
-// func GetPredictEdbConfById(edbInfoId int) (item *PredictEdbConf, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM predict_edb_conf WHERE predict_edb_info_id=? `
-// 	err = o.Raw(sql, edbInfoId).QueryRow(&item)
-// 	return
-// }
 
-// // GetPredictEdbConfBySourceEdbInfoId 根据来源指标id获取配置
-// func GetPredictEdbConfBySourceEdbInfoId(sourceEdbInfoId int) (item *PredictEdbConf, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM predict_edb_conf WHERE source_edb_info_id=? `
-// 	err = o.Raw(sql, sourceEdbInfoId).QueryRow(&item)
-// 	return
-// }
 
-// // GetPredictEdbConfCount 根据来源指标id获取被引用的次数
-// func GetPredictEdbConfCount(sourceEdbInfoId int) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT COUNT(1) AS count FROM predict_edb_conf WHERE source_edb_info_id=? `
-// 	err = o.Raw(sql, sourceEdbInfoId).QueryRow(&count)
-// 	return
-// }
 
-// // AddPredictEdbConf 添加预测指标规则
-// func AddPredictEdbConf(item *PredictEdbConf) (lastId int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err = o.Insert(item)
-// 	return
-// }
 
-// // AddPredictEdb 添加预测指标
-// func AddPredictEdb(item *EdbInfo, predictEdbConf *PredictEdbConf) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	tx, err := o.Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			tmpErr := tx.Rollback()
-// 			if tmpErr != nil {
-// 				go alarm_msg.SendAlarmMsg("AddPredictEdb 事务回滚失败,Err:"+tmpErr.Error(), 3)
-// 			}
-// 		} else {
-// 			err = tx.Commit()
-// 		}
-// 	}()
-// 	// 新增预测指标
-// 	edbInfoId, err := o.Insert(item)
-// 	if err != nil {
-// 		return
-// 	}
-// 	item.EdbInfoId = int(edbInfoId)
 
-// 	// 新增预测指标配置
-// 	predictEdbConf.PredictEdbInfoId = item.EdbInfoId
-// 	_, err = o.Insert(predictEdbConf)
-// 	if err != nil {
-// 		return
-// 	}
-// 	return
-// }
 
-// // EditPredictEdb 修改预测指标
-// func EditPredictEdb(edbInfo *EdbInfo, predictEdbConf *PredictEdbConf, updateEdbInfoCol, updatePredictEdbConfCol []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	tx, err := o.Begin()
-// 	if err != nil {
-// 		return
-// 	}
-// 	defer func() {
-// 		if err != nil {
-// 			tmpErr := tx.Rollback()
-// 			if tmpErr != nil {
-// 				go alarm_msg.SendAlarmMsg("AddPredictEdb 事务回滚失败,Err:"+tmpErr.Error(), 3)
-// 			}
-// 		} else {
-// 			err = tx.Commit()
-// 		}
-// 	}()
-// 	// 修改预测指标
-// 	_, err = o.Update(edbInfo, updateEdbInfoCol...)
-// 	if err != nil {
-// 		return
-// 	}
-// 	// 修改预测指标配置
-// 	_, err = o.Update(predictEdbConf, updatePredictEdbConfCol...)
-// 	if err != nil {
-// 		return
-// 	}
-// 	return
-// }
 
-// // GetPredictEdbInfoAllCalculate 根据基础预测指标id集合 获取 所有的普通指标列表数据
-// func GetPredictEdbInfoAllCalculate(edbInfoIdList []int) (list []*EdbInfo, err error) {
-// 	num := len(edbInfoIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT b.* FROM predict_edb_conf AS a
-// 			 INNER JOIN edb_info AS b ON a.source_edb_info_id=b.edb_info_id
-//              WHERE a.predict_edb_info_id in (` + utils.GetOrmInReplace(num) + `)
-// 			 GROUP BY a.source_edb_info_id
-// 			 ORDER BY a.source_edb_info_id ASC `
-// 	_, err = o.Raw(sql, edbInfoIdList).QueryRows(&list)
-// 	return
-// }
 
-// // GetPredictEdbConfListById 根据预测指标id获取预测指标配置信息列表
-// func GetPredictEdbConfListById(edbInfoId int) (items []*PredictEdbConf, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM predict_edb_conf WHERE predict_edb_info_id=? ORDER BY config_id ASC`
-// 	_, err = o.Raw(sql, edbInfoId).QueryRows(&items)
-// 	return
-// }

+ 7 - 91
models/data_manage/predict_edb_conf_calculate_mapping.go

@@ -6,22 +6,6 @@ import (
 	"time"
 )
 
-// PredictEdbConfCalculateMapping 预测基础指标规则 与 计算预测指标关联关系表
-//
-//	type PredictEdbConfCalculateMapping struct {
-//		PredictEdbConfCalculateMappingId int       `orm:"column(predict_edb_conf_calculate_mapping_id);pk"`
-//		EdbInfoId                        int       `description:"指标id"`
-//		ConfigId                         int       `description:"配置id"`
-//		FromEdbInfoId                    int       `description:"基础指标id"`
-//		FromEdbCode                      string    `description:"基础指标编码"`
-//		FromEdbName                      string    `description:"基础指标名称"`
-//		FromSource                       int       `description:"基础指标来源"`
-//		FromSourceName                   string    `description:"基础指标来源名称"`
-//		FromTag                          string    `description:"来源指标标签"`
-//		Sort                             int       `description:"计算指标名称排序"`
-//		CreateTime                       time.Time `description:"创建时间"`
-//		ModifyTime                       time.Time `description:"修改时间"`
-//	}
 type PredictEdbConfCalculateMapping struct {
 	PredictEdbConfCalculateMappingId int       `gorm:"column:predict_edb_conf_calculate_mapping_id;primaryKey" description:"预测指标计算映射ID" orm:"column(predict_edb_conf_calculate_mapping_id);pk"`
 	EdbInfoId                        int       `gorm:"column:edb_info_id" description:"指标id"`
@@ -37,7 +21,6 @@ type PredictEdbConfCalculateMapping struct {
 	ModifyTime                       time.Time `gorm:"column:modify_time" description:"修改时间"`
 }
 
-// GetPredictEdbConfCalculateMappingListById 根据预测指标id获取预测指标配置的关联指标信息列表
 func GetPredictEdbConfCalculateMappingListById(edbInfoId int) (items []*PredictEdbConf, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM predict_edb_conf_calculate_mapping WHERE edb_info_id=? ORDER BY predict_edb_conf_calculate_mapping_id ASC`
@@ -45,7 +28,6 @@ func GetPredictEdbConfCalculateMappingListById(edbInfoId int) (items []*PredictE
 	return
 }
 
-// GetPredictEdbConfCalculateMappingListByConfigId 根据预测指标配置id获取预测指标配置的关联指标信息列表
 func GetPredictEdbConfCalculateMappingListByConfigId(edbInfoId, configId int) (items []*PredictEdbConf, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM predict_edb_conf_calculate_mapping WHERE edb_info_id=? AND config_id=? ORDER BY predict_edb_conf_calculate_mapping_id ASC`
@@ -53,40 +35,8 @@ func GetPredictEdbConfCalculateMappingListByConfigId(edbInfoId, configId int) (i
 	return
 }
 
-// GetPredictEdbConfCalculateMappingListById 根据预测指标id获取预测指标配置的关联指标信息列表
-// func GetPredictEdbConfCalculateMappingListById(edbInfoId int) (items []*PredictEdbConf, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM predict_edb_conf_calculate_mapping WHERE edb_info_id=? ORDER BY predict_edb_conf_calculate_mapping_id ASC`
-// 	_, err = o.Raw(sql, edbInfoId).QueryRows(&items)
-// 	return
-// }
-
-// // GetPredictEdbConfCalculateMappingListByConfigId 根据预测指标配置id获取预测指标配置的关联指标信息列表
-// func GetPredictEdbConfCalculateMappingListByConfigId(edbInfoId, configId int) (items []*PredictEdbConf, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM predict_edb_conf_calculate_mapping WHERE edb_info_id=? AND config_id=? ORDER BY predict_edb_conf_calculate_mapping_id ASC`
-// 	_, err = o.Raw(sql, edbInfoId, configId).QueryRows(&items)
-// 	return
-// }
-
-//	type PredictEdbConfCalculateMappingDetail struct {
-//		PredictEdbConfCalculateMappingId int       `orm:"column(predict_edb_conf_calculate_mapping_id);pk"`
-//		EdbInfoId                        int       `description:"指标id"`
-//		ConfigId                         int       `description:"配置id"`
-//		FromEdbInfoId                    int       `description:"基础指标id"`
-//		FromEdbCode                      string    `description:"基础指标编码"`
-//		FromEdbName                      string    `description:"基础指标名称"`
-//		FromSource                       int       `description:"基础指标来源"`
-//		FromSourceName                   string    `description:"基础指标来源名称"`
-//		FromTag                          string    `description:"来源指标标签"`
-//		Sort                             int       `description:"计算指标名称排序"`
-//		CreateTime                       time.Time `description:"创建时间"`
-//		ModifyTime                       time.Time `description:"修改时间"`
-//		StartDate                        string    `description:"开始日期"`
-//		EndDate                          string    `description:"结束日期"`
-//		EdbType                          int       `description:"指标类型:1:基础指标,2:计算指标"`
-//		EdbCode                          string    `description:"指标code"`
-//	}
+
+
 type PredictEdbConfCalculateMappingDetail struct {
 	PredictEdbConfCalculateMappingId int       `gorm:"column:predict_edb_conf_calculate_mapping_id;primaryKey" description:"预测指标计算映射ID" orm:"column(predict_edb_conf_calculate_mapping_id);pk"`
 	EdbInfoId                        int       `gorm:"column:edb_info_id" description:"指标id"`
@@ -106,7 +56,6 @@ type PredictEdbConfCalculateMappingDetail struct {
 	EdbCode                          string    `gorm:"column:edb_code" description:"指标code"`
 }
 
-// GetPredictEdbConfCalculateMappingDetailListById 根据配置id获取 配置关联指标信息
 func GetPredictEdbConfCalculateMappingDetailListById(edbInfoId int) (list []*PredictEdbConfCalculateMappingDetail, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT a.predict_edb_conf_calculate_mapping_id,a.edb_info_id,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type FROM predict_edb_conf_calculate_mapping AS a
@@ -117,7 +66,6 @@ func GetPredictEdbConfCalculateMappingDetailListById(edbInfoId int) (list []*Pre
 	return
 }
 
-// GetPredictEdbConfCalculateMappingDetailListByConfigId 根据配置id和指标id获取 配置关联指标信息
 func GetPredictEdbConfCalculateMappingDetailListByConfigId(edbInfoId, configId int) (list []*PredictEdbConfCalculateMappingDetail, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT a.predict_edb_conf_calculate_mapping_id,a.edb_info_id,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type FROM predict_edb_conf_calculate_mapping AS a
@@ -128,7 +76,6 @@ func GetPredictEdbConfCalculateMappingDetailListByConfigId(edbInfoId, configId i
 	return
 }
 
-// GetPredictEdbConfCalculateMappingDetailListByEdbInfoId 根据 关联指标id列表 来 获取 相关联的配置关联指标信息
 func GetPredictEdbConfCalculateMappingDetailListByEdbInfoId(fromEdbInfoIdList []int) (list []*PredictEdbConfCalculateMappingDetail, err error) {
 	num := len(fromEdbInfoIdList)
 	if num <= 0 {
@@ -143,39 +90,8 @@ func GetPredictEdbConfCalculateMappingDetailListByEdbInfoId(fromEdbInfoIdList []
 	return
 }
 
-// GetPredictEdbConfCalculateMappingDetailListById 根据配置id获取 配置关联指标信息
-// func GetPredictEdbConfCalculateMappingDetailListById(edbInfoId int) (list []*PredictEdbConfCalculateMappingDetail, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT a.predict_edb_conf_calculate_mapping_id,a.edb_info_id,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type FROM predict_edb_conf_calculate_mapping AS a
-// 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-// 			WHERE a.edb_info_id=? ORDER BY sort ASC `
-
-// 	_, err = o.Raw(sql, edbInfoId).QueryRows(&list)
-// 	return
-// }
-
-// // GetPredictEdbConfCalculateMappingDetailListByConfigId 根据配置id和指标id获取 配置关联指标信息
-// func GetPredictEdbConfCalculateMappingDetailListByConfigId(edbInfoId, configId int) (list []*PredictEdbConfCalculateMappingDetail, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT a.predict_edb_conf_calculate_mapping_id,a.edb_info_id,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type FROM predict_edb_conf_calculate_mapping AS a
-// 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-// 			WHERE a.edb_info_id=? AND a.config_id=?  ORDER BY sort ASC `
-
-// 	_, err = o.Raw(sql, edbInfoId, configId).QueryRows(&list)
-// 	return
-// }
-
-// // GetPredictEdbConfCalculateMappingDetailListByEdbInfoId 根据 关联指标id列表 来 获取 相关联的配置关联指标信息
-// func GetPredictEdbConfCalculateMappingDetailListByEdbInfoId(fromEdbInfoIdList []int) (list []*PredictEdbConfCalculateMappingDetail, err error) {
-// 	num := len(fromEdbInfoIdList)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT a.predict_edb_conf_calculate_mapping_id,a.edb_info_id,a.from_edb_info_id,a.from_edb_code,a.from_source,a.from_source_name,a.sort,a.create_time,a.modify_time,a.from_tag,b.edb_name_source as from_edb_name,b.start_date,b.end_date,b.edb_type,b.edb_code FROM predict_edb_conf_calculate_mapping AS a
-// 			INNER JOIN edb_info AS b ON a.from_edb_info_id=b.edb_info_id
-// 			WHERE a.edb_info_id in (` + utils.GetOrmInReplace(num) + `) GROUP BY a.edb_info_id ORDER BY sort ASC `
-
-// 	_, err = o.Raw(sql, fromEdbInfoIdList).QueryRows(&list)
-// 	return
-// }
+
+
+
+
+

+ 0 - 29
models/data_manage/predict_edb_rule_data.go

@@ -5,18 +5,6 @@ import (
 	"time"
 )
 
-// PredictEdbRuleData 预测指标,动态规则的计算数据
-//
-//	type PredictEdbRuleData struct {
-//		PredictEdbRuleDataId int `orm:"column(predict_edb_rule_data_id);pk"`
-//		EdbInfoId            int
-//		ConfigId             int
-//		DataTime             string
-//		Value                float64
-//		CreateTime           time.Time
-//		ModifyTime           time.Time
-//		DataTimestamp        int64
-//	}
 type PredictEdbRuleData struct {
 	PredictEdbRuleDataId int       `gorm:"column:predict_edb_rule_data_id;primaryKey" description:"预测指标动态规则计算数据ID" orm:"column(predict_edb_rule_data_id);pk"`
 	EdbInfoId            int       `gorm:"column:edb_info_id" description:"指标ID"`
@@ -28,7 +16,6 @@ type PredictEdbRuleData struct {
 	DataTimestamp        int64     `gorm:"column:data_timestamp" description:"数据时间戳"`
 }
 
-// GetPredictEdbRuleDataList 根据基础预测指标id集合 获取 所有的普通指标列表数据
 func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate string) (list []*PredictEdbRuleData, err error) {
 	o := global.DmSQL["data"]
 	var pars []interface{}
@@ -47,19 +34,3 @@ func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate strin
 	return
 }
 
-// func GetPredictEdbRuleDataList(edbInfoId, configId int, startDate, endDate string) (list []*PredictEdbRuleData, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	var pars []interface{}
-// 	sql := ` SELECT * FROM predict_edb_rule_data WHERE edb_info_id = ? AND config_id = ? `
-// 	if startDate != "" {
-// 		sql += ` AND data_time>=? `
-// 		pars = append(pars, startDate)
-// 	}
-// 	if endDate != "" {
-// 		sql += ` AND data_time<=? `
-// 		pars = append(pars, endDate)
-// 	}
-// 	sql += ` ORDER BY data_time ASC `
-// 	_, err = o.Raw(sql, edbInfoId, configId, pars).QueryRows(&list)
-// 	return
-// }

+ 0 - 51
models/db.go

@@ -1,64 +1,13 @@
 package models
 
-// import (
-// 	_ "github.com/go-sql-driver/mysql"
-// )
 
-// func init() {
 
-// 	_ = orm.RegisterDataBase("default", "mysql", utils.MYSQL_URL)
-// 	orm.SetMaxIdleConns("default", 50)
-// 	orm.SetMaxOpenConns("default", 100)
 
-// 	db, _ := orm.GetDB("default")
-// 	db.SetConnMaxLifetime(10 * time.Minute)
 
-// 	_ = orm.RegisterDataBase("data", "mysql", utils.MYSQL_URL_DATA)
-// 	orm.SetMaxIdleConns("data", 50)
-// 	orm.SetMaxOpenConns("data", 100)
 
-// 	data_db, _ := orm.GetDB("data")
-// 	data_db.SetConnMaxLifetime(10 * time.Minute)
 
-// 	orm.Debug = true
-// 	orm.DebugLog = orm.NewLog(utils.Binlog)
 
-// 	//注册对象
-// 	orm.RegisterModel(
-// 		new(data_manage.EdbInfo),
-// 		new(ShareChartRefreshLog),                       //分享图表刷新日志表
-// 		new(ExcelInfo),                                  //excel表格
-// 		new(data_manage.PredictEdbConf),                 //预测指标配置
-// 		new(data_manage.PredictEdbRuleData),             //预测指标配置生成的数据
-// 		new(data_manage.PredictEdbConfCalculateMapping), //预测指标关系表
-// 		new(data_manage.ChartInfoCorrelation),           // 图表相关性信息
-// 		new(FactorEdbSeriesCalculateDataQjjs),           // 因子指标系列-区间计算数据
-// 	)
-// 	// 期货数据库
-// 	initFutureGood()
 
-// 	// 初始化部分数据表变量(直接init会有顺序问题=_=!)
-// 	afterInitTable()
-// }
 
-// // initFutureGood 注册期货数据 数据表
-// func initFutureGood() {
-// 	//注册对象
-// 	orm.RegisterModel(
-// 		new(future_good.FutureGoodEdbInfo),         //期货指标表
-// 		new(future_good.FutureGoodEdbData),         //期货指标数据表
-// 		new(future_good.ChartInfoFutureGoodProfit), //期货利润图的扩展表
-// 	)
-// }
 
-// // afterInitTable
-// // @Description: 初始化表结构的的后置操作
-// // @author: Roc
-// // @datetime 2024-07-01 13:31:09
-// func afterInitTable() {
-// 	// 初始化指标来源配置
-// 	data_manage.InitEdbSourceVar()
 
-// 	// 初始化是否启用mongo配置
-// 	InitUseMongoConf()
-// }

+ 0 - 3
models/dm_base.go

@@ -2,15 +2,12 @@ package models
 
 import "eta_gn/eta_chart_lib/models/data_manage"
 
-// 达梦数据库初始化
 func AfterInitTable() {
 	afterInitTable()
 }
 
 func afterInitTable() {
-	// 初始化指标来源配置
 	data_manage.InitEdbSourceVar()
 
-	// 初始化是否启用mongo配置
 	InitUseMongoConf()
 }

+ 22 - 268
models/excel_info.go

@@ -7,26 +7,7 @@ import (
 	"time"
 )
 
-// ExcelInfo excel表格详情表
-// type ExcelInfo struct {
-// 	ExcelInfoId     int       `orm:"column(excel_info_id);pk"`
-// 	Source          int       `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
-// 	ExcelType       int       `description:"表格类型,1:指标列,2:日期列,默认:1"`
-// 	ExcelName       string    `description:"表格名称"`
-// 	UniqueCode      string    `description:"表格唯一编码"`
-// 	ExcelClassifyId int       `description:"表格分类id"`
-// 	SysUserId       int       `description:"操作人id"`
-// 	SysUserRealName string    `description:"操作人真实姓名"`
-// 	Content         string    `description:"表格内容"`
-// 	ExcelImage      string    `description:"表格图片"`
-// 	FileUrl         string    `description:"表格下载地址"`
-// 	Sort            int       `description:"排序字段,数字越小越排前面"`
-// 	IsDelete        int       `description:"是否删除,0:未删除,1:已删除"`
-// 	ModifyTime      time.Time `description:"最近修改日期"`
-// 	CreateTime      time.Time `description:"创建日期"`
-// }
-
-// ExcelInfo excel表格详情表
+
 type ExcelInfo struct {
 	ExcelInfoId     int       `gorm:"column:excel_info_id;primaryKey" description:"表格ID"`
 	Source          int       `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
@@ -49,33 +30,13 @@ func (e *ExcelInfo) TableName() string {
 	return "excel_info"
 }
 
-// Update 更新 excel表格基础信息
 func (excelInfo *ExcelInfo) Update(cols []string) (err error) {
 	o := global.DmSQL["data"]
 	err = o.Model(excelInfo).Select(cols).Updates(excelInfo).Error
 	return
 }
 
-// Update 更新 excel表格基础信息
-// func (excelInfo *ExcelInfo) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(excelInfo, cols...)
-// 	return
-// }
-
-//	type MyExcelInfoList struct {
-//		ExcelInfoId     int       `orm:"column(excel_info_id);pk"`
-//		ExcelName       string    `description:"表格名称"`
-//		UniqueCode      string    `description:"表格唯一编码"`
-//		ExcelClassifyId int       `description:"表格分类id"`
-//		SysUserId       int       `description:"操作人id"`
-//		SysUserRealName string    `description:"操作人真实姓名"`
-//		ExcelImage      string    `description:"表格图片"`
-//		FileUrl         string    `description:"表格下载地址"`
-//		Sort            int       `description:"排序字段,数字越小越排前面"`
-//		ModifyTime      time.Time `description:"最近修改日期"`
-//		CreateTime      time.Time `description:"创建日期"`
-//	}
+
 type MyExcelInfoList struct {
 	ExcelInfoId     int       `gorm:"column:excel_info_id;primaryKey" description:"表格ID" orm:"column(excel_info_id);pk"`
 	ExcelName       string    `gorm:"column:excel_name" description:"表格名称"`
@@ -90,23 +51,18 @@ type MyExcelInfoList struct {
 	CreateTime      time.Time `gorm:"column:create_time" description:"创建日期"`
 }
 
-// AddExcelInfo 新增表格
 func AddExcelInfo(excelInfo *ExcelInfo) (err error) {
 	o := global.DmSQL["data"]
-	// 表格信息入库
 	err = o.Create(excelInfo).Error
 	return
 }
 
-// EditExcelInfo 编辑表格
 func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string) (err error) {
 	o := global.DmSQL["data"]
-	// ETA表格信息变更
 	err = o.Model(excelInfo).Select(updateExcelInfoParams).Updates(excelInfo).Error
 	return
 }
 
-// GetExcelInfoById 根据id 获取eta表格详情
 func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
@@ -141,7 +97,6 @@ func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelI
 	return
 }
 
-// GetNextExcelInfo 根据分类id获取下一个excel表格
 func GetNextExcelInfo(classifyId int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT b.* FROM excel_classify AS a
@@ -153,7 +108,6 @@ func GetNextExcelInfo(classifyId int) (item *ExcelInfo, err error) {
 	return
 }
 
-// EditExcelInfoImage 修改excel表格的图片
 func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
 	o := global.DmSQL["data"]
 
@@ -167,7 +121,6 @@ func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
 	return
 }
 
-// GetExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
 func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfoView, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE unique_code=? AND is_delete=0 `
@@ -175,7 +128,6 @@ func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfoView, err error
 	return
 }
 
-// GetFirstExcelInfoByClassifyId 获取当前分类下,且排序数相同 的排序第一条的数据
 func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id=? AND is_delete=0 order by sort asc,excel_info_id asc limit 1`
@@ -183,7 +135,6 @@ func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error)
 	return
 }
 
-// UpdateExcelInfoSortByClassifyId 根据表格id更新排序
 func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string) (err error) {
 	o := global.DmSQL["data"]
 	sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? and sort > ? AND is_delete=0 `
@@ -194,132 +145,19 @@ func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, u
 	return
 }
 
-// AddExcelInfo 新增表格
-// func AddExcelInfo(excelInfo *ExcelInfo) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// 表格信息入库
-// 	lastId, err := o.Insert(excelInfo)
-// 	if err != nil {
-// 		return
-// 	}
-// 	excelInfo.ExcelInfoId = int(lastId)
-// 	return
-// }
-
-// // EditExcelInfo 编辑表格
-// func EditExcelInfo(excelInfo *ExcelInfo, updateExcelInfoParams []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	// ETA表格信息变更
-// 	_, err = o.Update(excelInfo, updateExcelInfoParams...)
-// 	return
-// }
-
-// // GetExcelInfoById 根据id 获取eta表格详情
-// func GetExcelInfoById(excelInfoId int) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// func GetExcelInfoViewById(excelInfoId int) (item *ExcelInfoView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id=? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// func GetExcelInfoCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// func GetExcelInfoByCondition(condition string, pars []interface{}) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// // GetNextExcelInfo 根据分类id获取下一个excel表格
-// func GetNextExcelInfo(classifyId int) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT b.* FROM excel_classify AS a
-// 			INNER JOIN excel_info AS b ON a.excel_classify_id=b.excel_classify_id
-// 			WHERE a.excel_classify_id>? AND is_delete=0
-// 			ORDER BY a.excel_classify_id ASC
-// 			LIMIT 1 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&item)
-// 	return
-// }
-
-// // EditExcelInfoImage 修改excel表格的图片
-// func EditExcelInfoImage(excelInfoId int, imageUrl string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-
-// 	sql := ` UPDATE  excel_info SET excel_image=?, modify_time = NOW() WHERE excel_info_id = ? AND is_delete=0 `
-// 	_, err = o.Raw(sql, imageUrl, excelInfoId).Exec()
-// 	if err != nil {
-// 		fmt.Println("EditExcelInfoImage Err:", err.Error())
-// 		return err
-// 	}
-
-// 	return
-// }
-
-// // GetExcelInfoByUniqueCode 根据unique_code来获取excel表格详情
-// func GetExcelInfoByUniqueCode(uniqueCode string) (item *ExcelInfoView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE unique_code=? AND is_delete=0 `
-// 	err = o.Raw(sql, uniqueCode).QueryRow(&item)
-// 	return
-// }
-
-// // GetFirstExcelInfoByClassifyId 获取当前分类下,且排序数相同 的排序第一条的数据
-// func GetFirstExcelInfoByClassifyId(classifyId int) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id=? AND is_delete=0 order by sort asc,excel_info_id asc limit 1`
-// 	err = o.Raw(sql, classifyId).QueryRow(&item)
-// 	return
-// }
-
-// // UpdateExcelInfoSortByClassifyId 根据表格id更新排序
-// func UpdateExcelInfoSortByClassifyId(classifyId, nowSort, prevExcelInfoId int, updateSort string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` update excel_info set sort = ` + updateSort + ` WHERE excel_classify_id=? and sort > ? AND is_delete=0 `
-// 	if prevExcelInfoId > 0 {
-// 		sql += ` or (excel_info_id > ` + fmt.Sprint(prevExcelInfoId) + ` and sort = ` + fmt.Sprint(nowSort) + `)`
-// 	}
-// 	_, err = o.Raw(sql, classifyId, nowSort).Exec()
-// 	return
-// }
-
-//	type ExcelInfoView struct {
-//		ExcelInfoId     int       `orm:"column(excel_info_id);pk"`
-//		Source          int       `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
-//		ExcelType       int       `description:"表格类型,1:指标列,2:日期列,默认:1"`
-//		ExcelName       string    `description:"表格名称"`
-//		UniqueCode      string    `description:"表格唯一编码"`
-//		ExcelClassifyId int       `description:"表格分类id"`
-//		SysUserId       int       `description:"操作人id"`
-//		SysUserRealName string    `description:"操作人真实姓名"`
-//		Content         string    `description:"表格内容"`
-//		ExcelImage      string    `description:"表格图片"`
-//		FileUrl         string    `description:"表格下载地址"`
-//		Sort            int       `description:"排序字段,数字越小越排前面"`
-//		IsDelete        int       `description:"是否删除,0:未删除,1:已删除" json:"-"`
-//		ModifyTime      time.Time `description:"最近修改日期"`
-//		CreateTime      time.Time `description:"创建日期"`
-//		SourcesFrom     string    `description:"图表来源"`
-//	}
+
+
+
+
+
+
+
+
+
+
+
+
+
 type ExcelInfoView struct {
 	ExcelInfoId     int       `gorm:"column:excel_info_id;primaryKey" description:"表格ID" orm:"column(excel_info_id);pk"`
 	Source          int       `gorm:"column:source" description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
@@ -339,7 +177,6 @@ type ExcelInfoView struct {
 	SourcesFrom     string    `gorm:"column:sources_from" description:"图表来源"`
 }
 
-// GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息
 func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *ExcelInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id = ? and excel_name=? AND is_delete=0 `
@@ -347,7 +184,6 @@ func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *Ex
 	return
 }
 
-// GetExcelInfoListByUniqueCodeSlice 根据表格编码获取表格列表数据
 func GetExcelInfoListByUniqueCodeSlice(uniqueCodeSlice []string) (total int64, items []*ExcelInfo, err error) {
 	num := len(uniqueCodeSlice)
 	if num <= 0 {
@@ -360,21 +196,18 @@ func GetExcelInfoListByUniqueCodeSlice(uniqueCodeSlice []string) (total int64, i
 	return
 }
 
-// GetExcelListByCondition 获取excel表格列表数据
 func GetExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
 	if condition != "" {
 		sql += condition
 	}
-	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
 	sql += " ORDER BY create_time DESC LIMIT ?,? "
 	pars = append(pars, startSize, pageSize)
 	err = o.Raw(sql, pars...).Scan(&item).Error
 	return
 }
 
-// GetNoContentExcelListByCondition 获取没有content的excel表格列表数据
 func GetNoContentExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT excel_info_id,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time
@@ -382,7 +215,6 @@ FROM excel_info WHERE 1=1 AND is_delete=0 `
 	if condition != "" {
 		sql += condition
 	}
-	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
 	sql += " ORDER BY create_time DESC LIMIT ?,? "
 	pars = append(pars, startSize, pageSize)
 	err = o.Raw(sql, pars...).Scan(&item).Error
@@ -399,7 +231,6 @@ func GetExcelListCountByCondition(condition string, pars []interface{}) (count i
 	return
 }
 
-// GetExcelViewInfoByExcelInfoId 根据excelInfoId 获取ETA表格详情
 func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM excel_info WHERE excel_info_id = ? AND is_delete=0 `
@@ -407,7 +238,6 @@ func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err
 	return
 }
 
-// GetExcelInfoCountByClassifyId 根据分类id获取名下表格数量
 func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
@@ -426,86 +256,10 @@ func GetExcelInfoListByCondition(condition string, pars []interface{}) (items []
 	return
 }
 
-// GetExcelInfoByClassifyIdAndName 根据分类id和表格名获取表格信息
-// func GetExcelInfoByClassifyIdAndName(classifyId int, excelName string) (item *ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_classify_id = ? and excel_name=? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId, excelName).QueryRow(&item)
-// 	return
-// }
-
-// // GetExcelInfoListByUniqueCodeSlice 根据表格编码获取表格列表数据
-// func GetExcelInfoListByUniqueCodeSlice(uniqueCodeSlice []string) (total int64, items []*ExcelInfo, err error) {
-// 	num := len(uniqueCodeSlice)
-// 	if num <= 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE unique_code in ("` + utils.GetOrmInReplace(num) + `") AND is_delete=0 `
-// 	total, err = o.Raw(sql, uniqueCodeSlice).QueryRows(&items)
-// 	return
-// }
-
-// // GetExcelListByCondition 获取excel表格列表数据
-// func GetExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
-// 	sql += " ORDER BY create_time DESC LIMIT ?,? "
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
-// 	return
-// }
-
-// // GetNoContentExcelListByCondition 获取没有content的excel表格列表数据
-// func GetNoContentExcelListByCondition(condition string, pars []interface{}, startSize, pageSize int) (item []*MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT excel_info_id,excel_name,unique_code,excel_classify_id,sys_user_id,sys_user_real_name,excel_image,file_url,sort,create_time,modify_time
-// FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	//sql += " ORDER BY sort ASC,chart_info_id DESC LIMIT ?,? "
-// 	sql += " ORDER BY create_time DESC LIMIT ?,? "
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&item)
-// 	return
-// }
-
-// func GetExcelListCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT COUNT(1) AS count FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// // GetExcelViewInfoByExcelInfoId 根据excelInfoId 获取ETA表格详情
-// func GetExcelViewInfoByExcelInfoId(excelInfoId int) (item *MyExcelInfoList, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE excel_info_id = ? AND is_delete=0 `
-// 	err = o.Raw(sql, excelInfoId).QueryRow(&item)
-// 	return
-// }
-
-// // GetExcelInfoCountByClassifyId 根据分类id获取名下表格数量
-// func GetExcelInfoCountByClassifyId(classifyId int) (total int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT count(1) total FROM excel_info WHERE excel_classify_id = ? AND is_delete=0 `
-// 	err = o.Raw(sql, classifyId).QueryRow(&total)
-// 	return
-// }
-
-// func GetExcelInfoListByCondition(condition string, pars []interface{}) (items []*ExcelInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM excel_info WHERE 1=1 AND is_delete=0 `
-// 	if condition != "" {
-// 		sql += condition
-// 	}
-// 	sql += ` ORDER BY sort asc, excel_info_id asc`
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
+
+
+
+
+
+
+

+ 0 - 70
models/excel_info_rule_mapping.go

@@ -5,25 +5,6 @@ import (
 	"time"
 )
 
-//	type ExcelInfoRuleMapping struct {
-//		ExcelInfoRuleMappingId int       `orm:"pk" description:"主键"`
-//		ExcelInfoId            int       `description:"Excel信息ID"`
-//		RuleType               int       `description:"规则类型"`
-//		LeftValue              string    `description:"左值"`
-//		LeftValueShow          string    `description:"左值前端显示"`
-//		LeftValueType          int       `description:"左值类型"`
-//		RightValue             string    `description:"右值"`
-//		RightValueShow         string    `description:"右值前端显示"`
-//		RightValueType         int       `description:"右值类型"`
-//		FontColor              string    `description:"字体颜色"`
-//		BackgroundColor        string    `description:"背景颜色"`
-//		Remark                 string    `description:"预设颜色说明"`
-//		RemarkEn               string    `description:"预设颜色英文说明"`
-//		Scope                  string    `description:"作用范围"`
-//		ScopeCoord             string    `description:"作用范围坐标"`
-//		ScopeShow              string    `description:"作用范围坐标前端显示"`
-//		CreateTime             time.Time `description:"创建时间"`
-//	}
 type ExcelInfoRuleMapping struct {
 	ExcelInfoRuleMappingId int       `gorm:"column:excel_info_rule_mapping_id;primaryKey" description:"主键"`
 	ExcelInfoId            int       `gorm:"column:excel_info_id" description:"Excel信息ID"`
@@ -48,25 +29,6 @@ func (e *ExcelInfoRuleMapping) TableName() string {
 	return "excel_info_rule_mapping"
 }
 
-// type ExcelInfoRuleMappingView struct {
-// 	ExcelInfoRuleMappingId int    `orm:"pk" description:"主键"`
-// 	ExcelInfoId            int    `description:"Excel信息ID"`
-// 	RuleType               int    `description:"规则类型:1-大于,2-小于,3-介于,4-等于,5-发生日期"`
-// 	LeftValue              string `description:"左值"`
-// 	LeftValueBack          string `description:"左值前端显示"`
-// 	LeftValueType          int    `description:"左值类型"`
-// 	RightValue             string `description:"右值"`
-// 	RightValueBack         string `description:"右值前端显示"`
-// 	RightValueType         int    `description:"右值类型"`
-// 	FontColor              string `description:"字体颜色"`
-// 	BackgroundColor        string `description:"背景颜色"`
-// 	Remark                 string `description:"预设颜色说明"`
-// 	RemarkEn               string `description:"预设颜色英文说明"`
-// 	Scope                  string `description:"作用范围"`
-// 	ScopeCoord             string `description:"作用范围坐标"`
-// 	ScopeShow              string `description:"作用范围坐标前端显示"`
-// 	CreateTime             string `description:"创建时间"`
-// }
 
 type ExcelInfoRuleMappingView struct {
 	ExcelInfoRuleMappingId int    `gorm:"column:excel_info_rule_mapping_id;primaryKey" description:"主键"`
@@ -101,7 +63,6 @@ func (e *ExcelInfoRuleMapping) Update(cols []string) (err error) {
 	return
 }
 
-// GetExcelRuleMappingByExcelInfoId 根据excelInfoId获取规则映射信息
 func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_id = ? ORDER BY create_time ASC`
@@ -109,7 +70,6 @@ func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView
 	return
 }
 
-// GetExcelRuleMappingById 根据主键Id获取规则映射信息
 func GetExcelRuleMappingById(id int) (item *ExcelInfoRuleMappingView, err error) {
 	o := global.DmSQL["data"]
 	sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
@@ -124,37 +84,7 @@ func DeleteExcelRuleMappingById(id int) (err error) {
 	return
 }
 
-// func (e *ExcelInfoRuleMapping) Insert() (insertId int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	insertId, err = o.Insert(e)
-// 	return
-// }
 
-// func (e *ExcelInfoRuleMapping) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(e, cols...)
-// 	return
-// }
 
-// // GetExcelRuleMappingByExcelInfoId 根据excelInfoId获取规则映射信息
-// func GetExcelRuleMappingByExcelInfoId(id int) (items []*ExcelInfoRuleMappingView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_id = ? ORDER BY create_time ASC`
-// 	_, err = o.Raw(sql, id).QueryRows(&items)
-// 	return
-// }
 
-// // GetExcelRuleMappingById 根据主键Id获取规则映射信息
-// func GetExcelRuleMappingById(id int) (item *ExcelInfoRuleMappingView, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `SELECT * FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }
 
-// func DeleteExcelRuleMappingById(id int) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := `DELETE FROM excel_info_rule_mapping WHERE excel_info_rule_mapping_id = ?`
-// 	_, err = o.Raw(sql, id).Exec()
-// 	return
-// }

+ 12 - 148
models/factor_edb_series_calculate_data_qjjs.go

@@ -8,18 +8,6 @@ import (
 	"time"
 )
 
-// FactorEdbSeriesCalculateDataQjjs 因子指标系列-区间计算数据表
-// type FactorEdbSeriesCalculateDataQjjs struct {
-// 	FactorEdbSeriesCalculateDataId int       `orm:"column(factor_edb_series_calculate_data_id);pk"`
-// 	FactorEdbSeriesId              int       `description:"因子指标系列ID"`
-// 	EdbInfoId                      int       `description:"指标ID"`
-// 	EdbCode                        string    `description:"指标编码"`
-// 	DataTime                       time.Time `description:"数据日期"`
-// 	Value                          float64   `description:"数据值"`
-// 	CreateTime                     time.Time `description:"创建时间"`
-// 	ModifyTime                     time.Time `description:"修改时间"`
-// 	DataTimestamp                  int64     `description:"数据日期时间戳"`
-// }
 
 type FactorEdbSeriesCalculateDataQjjs struct {
 	FactorEdbSeriesCalculateDataId int       `gorm:"column:factor_edb_series_calculate_data_id;primaryKey" description:"因子指标系列计算数据ID" orm:"column(factor_edb_series_calculate_data_id);pk"`
@@ -167,123 +155,17 @@ func (m *FactorEdbSeriesCalculateDataQjjs) GetPageItemsByCondition(condition str
 	return
 }
 
-// func (m *FactorEdbSeriesCalculateDataQjjs) Create() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	id, err := o.Insert(m)
-// 	if err != nil {
-// 		return
-// 	}
-// 	m.FactorEdbSeriesCalculateDataId = int(id)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) CreateMulti(items []*FactorEdbSeriesCalculateDataQjjs) (err error) {
-// 	if len(items) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.InsertMulti(500, items)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) Update(cols []string) (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Update(m, cols...)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) Remove() (err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	_, err = o.Raw(sql, m.FactorEdbSeriesCalculateDataId).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) MultiRemove(ids []int) (err error) {
-// 	if len(ids) == 0 {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s IN (%s)`, m.TableName(), m.Cols().PrimaryId, utils.GetOrmInReplace(len(ids)))
-// 	_, err = o.Raw(sql, ids).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) RemoveByCondition(condition string, pars []interface{}) (err error) {
-// 	if condition == "" {
-// 		return
-// 	}
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`DELETE FROM %s WHERE %s`, m.TableName(), condition)
-// 	_, err = o.Raw(sql, pars).Exec()
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) GetItemById(id int) (item *FactorEdbSeriesCalculateDataQjjs, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE %s = ? LIMIT 1`, m.TableName(), m.Cols().PrimaryId)
-// 	err = o.Raw(sql, id).QueryRow(&item)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) GetItemByCondition(condition string, pars []interface{}, orderRule string) (item *FactorEdbSeriesCalculateDataQjjs, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	order := ``
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT * FROM %s WHERE 1=1 %s %s LIMIT 1`, m.TableName(), condition, order)
-// 	err = o.Raw(sql, pars).QueryRow(&item)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) GetCountByCondition(condition string, pars []interface{}) (count int, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := fmt.Sprintf(`SELECT COUNT(1) FROM %s WHERE 1=1 %s`, m.TableName(), condition)
-// 	err = o.Raw(sql, pars).QueryRow(&count)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) GetItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string) (items []*FactorEdbSeriesCalculateDataQjjs, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars).QueryRows(&items)
-// 	return
-// }
-
-// func (m *FactorEdbSeriesCalculateDataQjjs) GetPageItemsByCondition(condition string, pars []interface{}, fieldArr []string, orderRule string, startSize, pageSize int) (items []*FactorEdbSeriesCalculateDataQjjs, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	fields := strings.Join(fieldArr, ",")
-// 	if len(fieldArr) == 0 {
-// 		fields = `*`
-// 	}
-// 	order := fmt.Sprintf(`ORDER BY %s DESC`, m.Cols().CreateTime)
-// 	if orderRule != "" {
-// 		order = ` ORDER BY ` + orderRule
-// 	}
-// 	sql := fmt.Sprintf(`SELECT %s FROM %s WHERE 1=1 %s %s LIMIT ?,?`, fields, m.TableName(), condition, order)
-// 	_, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
-// 	return
-// }
-
-// FactorEdbSeriesCalculateDataQjjsItem 因子指标系列-计算数据信息
-//
-//	type FactorEdbSeriesCalculateDataQjjsItem struct {
-//		DataId            int     `description:"数据ID"`
-//		FactorEdbSeriesId int     `description:"因子指标系列ID"`
-//		EdbInfoId         int     `description:"指标ID"`
-//		EdbCode           string  `description:"指标编码"`
-//		DataTime          string  `description:"数据日期"`
-//		Value             float64 `description:"数据值"`
-//	}
+
+
+
+
+
+
+
+
+
+
+
 type FactorEdbSeriesCalculateDataQjjsItem struct {
 	DataId            int     `gorm:"column:data_id;primaryKey" description:"数据ID"`
 	FactorEdbSeriesId int     `gorm:"column:factor_edb_series_id" description:"因子指标系列ID"`
@@ -322,22 +204,4 @@ func (m *FactorEdbSeriesCalculateDataQjjs) GetEdbDataList(seriesId int, edbInfoI
 	return
 }
 
-// func (m *FactorEdbSeriesCalculateDataQjjs) GetEdbDataList(seriesId int, edbInfoId int, startDate, endDate string) (list []*EdbDataList, err error) {
-// 	var pars []interface{}
-// 	sql := `SELECT factor_edb_series_calculate_data_id as edb_data_id  ,edb_info_id,data_time,value,data_timestamp FROM %s WHERE edb_info_id=? and factor_edb_series_id=? `
-// 	pars = append(pars, edbInfoId, seriesId)
-// 	if startDate != "" {
-// 		sql += ` AND data_time>=? `
-// 		pars = append(pars, startDate)
-// 	}
-// 	if endDate != "" {
-// 		sql += ` AND data_time<=? `
-// 		pars = append(pars, endDate)
-// 	}
-
-// 	sql += ` ORDER BY data_time ASC `
-// 	sql = fmt.Sprintf(sql, m.TableName())
-// 	o := orm.NewOrmUsingDB("data")
-// 	_, err = o.Raw(sql, pars).QueryRows(&list)
-// 	return
-// }
+

+ 0 - 5
models/handle_data.go

@@ -5,7 +5,6 @@ import (
 	"time"
 )
 
-// HandleDataByPreviousData 当前日期无值时,用上一个日期的数据补充当前日期的数据
 func HandleDataByPreviousData(edbInfoDataList []*EdbDataList, handleDataMap map[string]float64) (err error) {
 	if len(edbInfoDataList) < 2 {
 		return
@@ -15,25 +14,21 @@ func HandleDataByPreviousData(edbInfoDataList []*EdbDataList, handleDataMap map[
 	for _, v := range edbInfoDataList {
 		handleDataMap[v.DataTime] = v.Value
 
-		// 第一个数据就给过滤了,给后面的试用
 		if startEdbInfoData == nil {
 			startEdbInfoData = v
 			continue
 		}
 
-		// 获取两条数据之间相差的天数
 		startDataTime, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
 		currDataTime, _ := time.ParseInLocation(utils.FormatDate, v.DataTime, time.Local)
 		betweenHour := int(currDataTime.Sub(startDataTime).Hours())
 		betweenDay := betweenHour / 24
 
-		// 如果相差一天,那么过滤
 		if betweenDay <= 1 {
 			startEdbInfoData = v
 			continue
 		}
 
-		// 生成对应的值
 		{
 			for i := 1; i < betweenDay; i++ {
 				tmpDataTime := startDataTime.AddDate(0, 0, i)

+ 0 - 112
models/mgo/base_from_business_data.go

@@ -11,11 +11,8 @@ import (
 	"time"
 )
 
-// BaseFromBusinessData
-// @Description: 自有数据集合
 type BaseFromBusinessData struct {
 	ID primitive.ObjectID `json:"_id" bson:"_id,omitempty"` // 文档id
-	//ID string `json:"_id" bson:"_id" ` // 文档id
 	BaseFromBusinessIndexId int64     `json:"base_from_business_index_id" bson:"base_from_business_index_id"` // 指标id
 	IndexCode               string    `json:"index_code" bson:"index_code"`                                   // 指标编码
 	DataTime                time.Time `json:"data_time" bson:"data_time"`                                     // 数据日期
@@ -24,46 +21,19 @@ type BaseFromBusinessData struct {
 	ModifyTime              time.Time `json:"modify_time" bson:"modify_time"`                                 // 修改时间
 }
 
-// CollectionName
-// @Description:  获取集合名称
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:36
-// @return string
 func (m *BaseFromBusinessData) CollectionName() string {
 	return "base_from_business_data"
 }
 
-// DataBaseName
-// @Description: 获取数据库名称
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:33
-// @return string
 func (m *BaseFromBusinessData) DataBaseName() string {
 	return utils.MgoDataDbName
 }
 
-// GetCollection
-// @Description: 获取mongodb集合的句柄
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:33
-// @return string
 func (m *BaseFromBusinessData) GetCollection() *qmgo.Collection {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	return db.Collection(m.CollectionName())
 }
 
-// GetAllDataList
-// @Description: 根据条件获取所有数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:42:19
-// @param sort []string
-// @param whereParams interface{}
-// @return result []BaseFromBusinessData
-// @return err error
 func (m *BaseFromBusinessData) GetAllDataList(whereParams interface{}, sort []string) (result []*BaseFromBusinessData, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -90,15 +60,6 @@ func (m *BaseFromBusinessData) GetAllDataList(whereParams interface{}, sort []st
 	return
 }
 
-// GetLimitDataList
-// @Description: 根据条件获取指定数量数据列表
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-06 17:08:32
-// @param whereParams interface{}
-// @param size int64
-// @return result []*BaseFromBusinessData
-// @return err error
 func (m *BaseFromBusinessData) GetLimitDataList(whereParams interface{}, size int64, sort []string) (result []*BaseFromBusinessData, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -125,17 +86,6 @@ func (m *BaseFromBusinessData) GetLimitDataList(whereParams interface{}, size in
 	return
 }
 
-// GetPageDataList
-// @Description: 根据条件获取分页数据列表
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-07 10:21:07
-// @param whereParams interface{}
-// @param startSize int64
-// @param size int64
-// @param sort []string
-// @return result []*BaseFromBusinessData
-// @return err error
 func (m *BaseFromBusinessData) GetPageDataList(whereParams interface{}, startSize, size int64, sort []string) (result []*BaseFromBusinessData, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -162,14 +112,6 @@ func (m *BaseFromBusinessData) GetPageDataList(whereParams interface{}, startSiz
 	return
 }
 
-// GetCountDataList
-// @Description:  根据条件获取数据列表总数
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-07 10:29:00
-// @param whereParams interface{}
-// @return count int64
-// @return err error
 func (m *BaseFromBusinessData) GetCountDataList(whereParams interface{}) (count int64, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -187,13 +129,6 @@ func (m *BaseFromBusinessData) GetCountDataList(whereParams interface{}) (count
 	return
 }
 
-// BatchInsertData
-// @Description: 批量写入数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 14:22:18
-// @param dataList interface{}
-// @return err error
 func (m *BaseFromBusinessData) BatchInsertData(dataList interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -206,14 +141,6 @@ func (m *BaseFromBusinessData) BatchInsertData(dataList interface{}) (err error)
 	return
 }
 
-// UpdateDataByColl
-// @Description: 单条数据修改
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 15:01:51
-// @param whereParams interface{}
-// @param updateParams interface{}
-// @return err error
 func (m *BaseFromBusinessData) UpdateDataByColl(coll *qmgo.Collection, whereParams, updateParams interface{}) (err error) {
 	ctx := context.TODO()
 	err = coll.UpdateOne(ctx, whereParams, updateParams)
@@ -224,14 +151,6 @@ func (m *BaseFromBusinessData) UpdateDataByColl(coll *qmgo.Collection, wherePara
 	return
 }
 
-// UpdateData
-// @Description: 单条数据修改
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 15:01:51
-// @param whereParams interface{}
-// @param updateParams interface{}
-// @return err error
 func (m *BaseFromBusinessData) UpdateData(whereParams, updateParams interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -244,26 +163,15 @@ func (m *BaseFromBusinessData) UpdateData(whereParams, updateParams interface{})
 	return
 }
 
-// HandleData
-// @Description: 事务处理数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 10:40:20
-// @param addDataList []BaseAddFromBusinessData
-// @param updateDataList []BaseFromBusinessData
-// @return result interface{}
-// @return err error
 func (m *BaseFromBusinessData) HandleData(addDataList, updateDataList []BaseFromBusinessData) (result interface{}, err error) {
 
 	ctx := context.TODO()
 
 	callback := func(sessCtx context.Context) (interface{}, error) {
-		// 重要:确保事务中的每一个操作,都使用传入的sessCtx参数
 
 		db := utils.MgoDataCli.Database(m.DataBaseName())
 		coll := db.Collection(m.CollectionName())
 
-		// 插入数据
 		if len(addDataList) > 0 {
 			_, err = coll.InsertMany(sessCtx, addDataList)
 			if err != nil {
@@ -271,7 +179,6 @@ func (m *BaseFromBusinessData) HandleData(addDataList, updateDataList []BaseFrom
 			}
 		}
 
-		// 修改
 
 		if len(updateDataList) > 0 {
 			for _, v := range updateDataList {
@@ -290,14 +197,6 @@ func (m *BaseFromBusinessData) HandleData(addDataList, updateDataList []BaseFrom
 	return
 }
 
-// GetEdbInfoMaxAndMinInfo
-// @Description: 获取当前指标的最大最小值
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 17:15:39
-// @param whereParams interface{}
-// @return result EdbInfoMaxAndMinInfo
-// @return err error
 func (m *BaseFromBusinessData) GetEdbInfoMaxAndMinInfo(whereParams interface{}) (result EdbInfoMaxAndMinInfo, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -321,15 +220,6 @@ func (m *BaseFromBusinessData) GetEdbInfoMaxAndMinInfo(whereParams interface{})
 	return
 }
 
-// GetLatestValue
-// @Description: 获取当前指标的最新数据记录
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 17:16:15
-// @param whereParams interface{}
-// @param selectParam interface{}
-// @return latestValue LatestValue
-// @return err error
 func (m *BaseFromBusinessData) GetLatestValue(whereParams, selectParam interface{}) (latestValue LatestValue, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -343,8 +233,6 @@ func (m *BaseFromBusinessData) GetLatestValue(whereParams, selectParam interface
 		return
 	}
 
-	//var result interface{}
-	//err = coll.Find(ctx, whereParams).Select(selectParam).One(&result)
 	err = coll.Find(ctx, whereParams).Select(selectParam).One(&latestValue)
 
 	return

+ 0 - 18
models/mgo/common.go

@@ -6,25 +6,15 @@ import (
 	"time"
 )
 
-// BuildDateCondition
-// @Description:  构建日期查询条件
-// @author: Roc
-// @datetime 2024-06-03 09:41:19
-// @param start string
-// @param end string
-// @return condition bson.M
-// @return err error
 func BuildDateCondition(start, end string) (condition bson.M, err error) {
 	var startDateTime, endDateTime time.Time
 	if start != "" {
-		// 使用开始日期条件
 		startDateTime, err = time.ParseInLocation(utils.FormatDate, start, time.Local)
 		if err != nil {
 			return
 		}
 	}
 	if end != "" {
-		// 使用结束日期条件
 		endDateTime, err = time.ParseInLocation(utils.FormatDate, end, time.Local)
 		if err != nil {
 			return
@@ -35,14 +25,6 @@ func BuildDateCondition(start, end string) (condition bson.M, err error) {
 
 }
 
-// BuildDateTimeCondition
-// @Description: 构建日期查询条件
-// @author: Roc
-// @datetime 2024-06-03 09:47:32
-// @param startDateTime time.Time
-// @param endDateTime time.Time
-// @return condition bson.M
-// @return err error
 func BuildDateTimeCondition(startDateTime, endDateTime time.Time) (condition bson.M, err error) {
 	if !startDateTime.IsZero() && !endDateTime.IsZero() {
 		condition = bson.M{utils.DateConvMysqlConvMongo(">="): startDateTime, utils.DateConvMysqlConvMongo("<="): endDateTime}

+ 0 - 136
models/mgo/edb_data_business.go

@@ -11,8 +11,6 @@ import (
 	"time"
 )
 
-// EdbDataBusiness
-// @Description: 自有数据集合(指标库)
 type EdbDataBusiness struct {
 	ID            primitive.ObjectID `json:"_id" bson:"_id,omitempty" `            // 文档id
 	EdbInfoId     int                `json:"edb_info_id" bson:"edb_info_id"`       // 指标编码
@@ -24,46 +22,19 @@ type EdbDataBusiness struct {
 	DataTimestamp int64              `json:"data_timestamp" bson:"data_timestamp"` // 数据日期时间戳
 }
 
-// CollectionName
-// @Description:  获取集合名称
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:36
-// @return string
 func (m *EdbDataBusiness) CollectionName() string {
 	return "edb_data_business"
 }
 
-// DataBaseName
-// @Description: 获取数据库名称
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:33
-// @return string
 func (m *EdbDataBusiness) DataBaseName() string {
 	return utils.MgoDataDbName
 }
 
-// GetCollection
-// @Description: 获取mongodb集合的句柄
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:33
-// @return string
 func (m *EdbDataBusiness) GetCollection() *qmgo.Collection {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	return db.Collection(m.CollectionName())
 }
 
-// GetAllDataList
-// @Description: 根据条件获取所有数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:42:19
-// @param whereParams interface{}
-// @param sort []string
-// @return result []EdbDataBusiness
-// @return err error
 func (m *EdbDataBusiness) GetAllDataList(whereParams interface{}, sort []string) (result []*EdbDataBusiness, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -90,16 +61,6 @@ func (m *EdbDataBusiness) GetAllDataList(whereParams interface{}, sort []string)
 	return
 }
 
-// GetLimitDataList
-// @Description: 根据条件获取指定数量数据列表
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-06 17:08:32
-// @param whereParams interface{}
-// @param size int64
-// @param sort []string
-// @return result []*BaseFromBusinessData
-// @return err error
 func (m *EdbDataBusiness) GetLimitDataList(whereParams interface{}, size int64, sort []string) (result []*EdbDataBusiness, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -126,17 +87,6 @@ func (m *EdbDataBusiness) GetLimitDataList(whereParams interface{}, size int64,
 	return
 }
 
-// GetPageDataList
-// @Description: 根据条件获取分页数据列表
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-07 10:21:07
-// @param whereParams interface{}
-// @param startSize int64
-// @param size int64
-// @param sort []string
-// @return result []*EdbDataBusiness
-// @return err error
 func (m *EdbDataBusiness) GetPageDataList(whereParams interface{}, startSize, size int64, sort []string) (result []*EdbDataBusiness, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -163,14 +113,6 @@ func (m *EdbDataBusiness) GetPageDataList(whereParams interface{}, startSize, si
 	return
 }
 
-// GetCountDataList
-// @Description:  根据条件获取数据列表总数
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-07 10:29:00
-// @param whereParams interface{}
-// @return count int64
-// @return err error
 func (m *EdbDataBusiness) GetCountDataList(whereParams interface{}) (count int64, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -188,13 +130,6 @@ func (m *EdbDataBusiness) GetCountDataList(whereParams interface{}) (count int64
 	return
 }
 
-// BatchInsertData
-// @Description: 批量写入数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 14:22:18
-// @param dataList interface{}
-// @return err error
 func (m *EdbDataBusiness) BatchInsertData(dataList []EdbDataBusiness) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -202,13 +137,6 @@ func (m *EdbDataBusiness) BatchInsertData(dataList []EdbDataBusiness) (err error
 	return m.BatchInsertDataByColl(coll, dataList)
 }
 
-// BatchInsertDataByColl
-// @Description: 批量写入数据(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 14:22:18
-// @param dataList interface{}
-// @return err error
 func (m *EdbDataBusiness) BatchInsertDataByColl(coll *qmgo.Collection, dataList []EdbDataBusiness) (err error) {
 	ctx := context.TODO()
 	_, err = coll.InsertMany(ctx, dataList)
@@ -220,14 +148,6 @@ func (m *EdbDataBusiness) BatchInsertDataByColl(coll *qmgo.Collection, dataList
 	return
 }
 
-// UpdateData
-// @Description: 单条数据修改
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 15:01:51
-// @param whereParams interface{}
-// @param updateParams interface{}
-// @return err error
 func (m *EdbDataBusiness) UpdateData(whereParams, updateParams interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -235,14 +155,6 @@ func (m *EdbDataBusiness) UpdateData(whereParams, updateParams interface{}) (err
 	return m.UpdateDataByColl(coll, whereParams, updateParams)
 }
 
-// UpdateDataByColl
-// @Description: 单条数据修改(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 15:01:51
-// @param whereParams interface{}
-// @param updateParams interface{}
-// @return err error
 func (m *EdbDataBusiness) UpdateDataByColl(coll *qmgo.Collection, whereParams, updateParams interface{}) (err error) {
 	ctx := context.TODO()
 	err = coll.UpdateOne(ctx, whereParams, updateParams)
@@ -254,13 +166,6 @@ func (m *EdbDataBusiness) UpdateDataByColl(coll *qmgo.Collection, whereParams, u
 	return
 }
 
-// RemoveMany
-// @Description: 根据条件删除多条数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 13:17:02
-// @param whereParams interface{}
-// @return err error
 func (m *EdbDataBusiness) RemoveMany(whereParams interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -268,14 +173,6 @@ func (m *EdbDataBusiness) RemoveMany(whereParams interface{}) (err error) {
 	return m.RemoveManyByColl(coll, whereParams)
 }
 
-// RemoveManyByColl
-// @Description: 根据条件删除多条数据(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 13:18:42
-// @param coll *qmgo.Collection
-// @param whereParams interface{}
-// @return err error
 func (m *EdbDataBusiness) RemoveManyByColl(coll *qmgo.Collection, whereParams interface{}) (err error) {
 	ctx := context.TODO()
 	_, err = coll.RemoveAll(ctx, whereParams)
@@ -287,26 +184,15 @@ func (m *EdbDataBusiness) RemoveManyByColl(coll *qmgo.Collection, whereParams in
 	return
 }
 
-// HandleData
-// @Description: 事务处理数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 10:39:01
-// @param addDataList []AddEdbDataBusiness
-// @param updateDataList []EdbDataBusiness
-// @return result interface{}
-// @return err error
 func (m *EdbDataBusiness) HandleData(addDataList, updateDataList []EdbDataBusiness) (result interface{}, err error) {
 
 	ctx := context.TODO()
 
 	callback := func(sessCtx context.Context) (interface{}, error) {
-		// 重要:确保事务中的每一个操作,都使用传入的sessCtx参数
 
 		db := utils.MgoDataCli.Database(m.DataBaseName())
 		coll := db.Collection(m.CollectionName())
 
-		// 插入数据
 		if len(addDataList) > 0 {
 			_, err = coll.InsertMany(sessCtx, addDataList)
 			if err != nil {
@@ -314,7 +200,6 @@ func (m *EdbDataBusiness) HandleData(addDataList, updateDataList []EdbDataBusine
 			}
 		}
 
-		// 修改
 
 		if len(updateDataList) > 0 {
 			for _, v := range updateDataList {
@@ -333,7 +218,6 @@ func (m *EdbDataBusiness) HandleData(addDataList, updateDataList []EdbDataBusine
 	return
 }
 
-// EdbInfoMaxAndMinInfo 指标最新数据记录结构体
 type EdbInfoMaxAndMinInfo struct {
 	MinDate     time.Time `description:"最小日期" bson:"min_date"`
 	MaxDate     time.Time `description:"最大日期" bson:"max_date"`
@@ -344,14 +228,6 @@ type EdbInfoMaxAndMinInfo struct {
 	EndValue    float64   `description:"最新值" bson:"end_value"`
 }
 
-// GetEdbInfoMaxAndMinInfo
-// @Description: 获取当前指标的最大最小值
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 17:15:39
-// @param whereParams interface{}
-// @return result EdbInfoMaxAndMinInfo
-// @return err error
 func (m *EdbDataBusiness) GetEdbInfoMaxAndMinInfo(whereParams interface{}) (result EdbInfoMaxAndMinInfo, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -375,20 +251,10 @@ func (m *EdbDataBusiness) GetEdbInfoMaxAndMinInfo(whereParams interface{}) (resu
 	return
 }
 
-// LatestValue 指标最新数据记录结构体
 type LatestValue struct {
 	Value float64 `description:"值" bson:"value"`
 }
 
-// GetLatestValue
-// @Description: 获取当前指标的最新数据记录
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 17:16:15
-// @param whereParams interface{}
-// @param selectParam interface{}
-// @return latestValue LatestValue
-// @return err error
 func (m *EdbDataBusiness) GetLatestValue(whereParams, selectParam interface{}) (latestValue LatestValue, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -402,8 +268,6 @@ func (m *EdbDataBusiness) GetLatestValue(whereParams, selectParam interface{}) (
 		return
 	}
 
-	//var result interface{}
-	//err = coll.Find(ctx, whereParams).Select(selectParam).One(&result)
 	err = coll.Find(ctx, whereParams).Select(selectParam).One(&latestValue)
 
 	return

+ 2 - 179
models/mgo/edb_data_ths_hf.go

@@ -11,8 +11,6 @@ import (
 	"time"
 )
 
-// EdbDataThsHf
-// @Description: 同花顺高频集合(指标库)
 type EdbDataThsHf struct {
 	ID            primitive.ObjectID `json:"_id" bson:"_id,omitempty" `            // 文档id
 	EdbInfoId     int                `json:"edb_info_id" bson:"edb_info_id"`       // 指标ID
@@ -24,45 +22,19 @@ type EdbDataThsHf struct {
 	DataTimestamp int64              `json:"data_timestamp" bson:"data_timestamp"` // 数据日期时间戳
 }
 
-// CollectionName
-// @Description:  获取集合名称
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:36
-// @return string
 func (m *EdbDataThsHf) CollectionName() string {
 	return "edb_data_ths_hf"
 }
 
-// DataBaseName
-// @Description: 获取数据库名称
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:33
-// @return string
 func (m *EdbDataThsHf) DataBaseName() string {
 	return utils.MgoDataDbName
 }
 
-// GetCollection
-// @Description: 获取mongodb集合的句柄
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:41:33
-// @return string
 func (m *EdbDataThsHf) GetCollection() *qmgo.Collection {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	return db.Collection(m.CollectionName())
 }
 
-// GetItem
-// @Description: 根据条件获取单条数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-09 10:00:49
-// @param whereParams interface{}
-// @return item *EdbDataThsHf
-// @return err error
 func (m *EdbDataThsHf) GetItem(whereParams interface{}) (item *EdbDataThsHf, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -74,15 +46,6 @@ func (m *EdbDataThsHf) GetItem(whereParams interface{}) (item *EdbDataThsHf, err
 	return m.GetItemByColl(coll, whereParams)
 }
 
-// GetItemByColl
-// @Description: 根据条件获取单条数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-09 13:22:06
-// @param coll *qmgo.Collection
-// @param whereParams interface{}
-// @return item *EdbDataThsHf
-// @return err error
 func (m *EdbDataThsHf) GetItemByColl(coll *qmgo.Collection, whereParams interface{}) (item *EdbDataThsHf, err error) {
 	ctx := context.TODO()
 	if err != nil {
@@ -101,15 +64,6 @@ func (m *EdbDataThsHf) GetItemByColl(coll *qmgo.Collection, whereParams interfac
 	return
 }
 
-// GetAllDataList
-// @Description: 根据条件获取所有数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 13:42:19
-// @param whereParams interface{}
-// @param sort []string
-// @return result []EdbDataThsHf
-// @return err error
 func (m *EdbDataThsHf) GetAllDataList(whereParams interface{}, sort []string) (result []*EdbDataThsHf, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -136,16 +90,6 @@ func (m *EdbDataThsHf) GetAllDataList(whereParams interface{}, sort []string) (r
 	return
 }
 
-// GetLimitDataList
-// @Description: 根据条件获取指定数量数据列表
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-06 17:08:32
-// @param whereParams interface{}
-// @param size int64
-// @param sort []string
-// @return result []*BaseFromBusinessData
-// @return err error
 func (m *EdbDataThsHf) GetLimitDataList(whereParams interface{}, size int64, sort []string) (result []*EdbDataThsHf, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -172,17 +116,6 @@ func (m *EdbDataThsHf) GetLimitDataList(whereParams interface{}, size int64, sor
 	return
 }
 
-// GetPageDataList
-// @Description: 根据条件获取分页数据列表
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-07 10:21:07
-// @param whereParams interface{}
-// @param startSize int64
-// @param size int64
-// @param sort []string
-// @return result []*EdbDataThsHf
-// @return err error
 func (m *EdbDataThsHf) GetPageDataList(whereParams interface{}, startSize, size int64, sort []string) (result []*EdbDataThsHf, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -209,14 +142,6 @@ func (m *EdbDataThsHf) GetPageDataList(whereParams interface{}, startSize, size
 	return
 }
 
-// GetCountDataList
-// @Description:  根据条件获取数据列表总数
-// @author: Roc
-// @receiver m
-// @datetime 2024-05-07 10:29:00
-// @param whereParams interface{}
-// @return count int64
-// @return err error
 func (m *EdbDataThsHf) GetCountDataList(whereParams interface{}) (count int64, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -234,13 +159,6 @@ func (m *EdbDataThsHf) GetCountDataList(whereParams interface{}) (count int64, e
 	return
 }
 
-// InsertDataByColl
-// @Description: 写入单条数据(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 14:22:18
-// @param addData interface{}
-// @return err error
 func (m *EdbDataThsHf) InsertDataByColl(coll *qmgo.Collection, addData interface{}) (err error) {
 	ctx := context.TODO()
 	_, err = coll.InsertOne(ctx, addData)
@@ -252,14 +170,6 @@ func (m *EdbDataThsHf) InsertDataByColl(coll *qmgo.Collection, addData interface
 	return
 }
 
-// BatchInsertData
-// @Description: 批量写入数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 14:22:18
-// @param bulk int 每次请求保存的数据量
-// @param dataList []interface{}
-// @return err error
 func (m *EdbDataThsHf) BatchInsertData(bulk int, dataList []interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -267,15 +177,6 @@ func (m *EdbDataThsHf) BatchInsertData(bulk int, dataList []interface{}) (err er
 	return m.BatchInsertDataByColl(coll, bulk, dataList)
 }
 
-// BatchInsertDataByColl
-// @Description: 批量写入数据(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 14:22:18
-// @param coll *qmgo.Collection
-// @param bulk int 每次请求保存的数据量
-// @param dataList []interface{}
-// @return err error
 func (m *EdbDataThsHf) BatchInsertDataByColl(coll *qmgo.Collection, bulk int, dataList []interface{}) (err error) {
 	ctx := context.TODO()
 	dataNum := len(dataList)
@@ -283,7 +184,6 @@ func (m *EdbDataThsHf) BatchInsertDataByColl(coll *qmgo.Collection, bulk int, da
 		return
 	}
 
-	// 不设置每次保存切片数量大小,或者实际数据量小于设置的切片数量大小,那么就直接保存吧
 	if bulk <= 0 || dataNum <= bulk {
 		_, err = coll.InsertMany(ctx, dataList)
 		if err != nil {
@@ -293,7 +193,6 @@ func (m *EdbDataThsHf) BatchInsertDataByColl(coll *qmgo.Collection, bulk int, da
 		return
 	}
 
-	// 分批保存
 	i := 0
 	tmpAddDataList := make([]interface{}, 0)
 	for _, v := range dataList {
@@ -321,14 +220,6 @@ func (m *EdbDataThsHf) BatchInsertDataByColl(coll *qmgo.Collection, bulk int, da
 	return
 }
 
-// UpdateData
-// @Description: 单条数据修改
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 15:01:51
-// @param whereParams interface{}
-// @param updateParams interface{}
-// @return err error
 func (m *EdbDataThsHf) UpdateData(whereParams, updateParams interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -336,14 +227,6 @@ func (m *EdbDataThsHf) UpdateData(whereParams, updateParams interface{}) (err er
 	return m.UpdateDataByColl(coll, whereParams, updateParams)
 }
 
-// UpdateDataByColl
-// @Description: 单条数据修改(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-26 15:01:51
-// @param whereParams interface{}
-// @param updateParams interface{}
-// @return err error
 func (m *EdbDataThsHf) UpdateDataByColl(coll *qmgo.Collection, whereParams, updateParams interface{}) (err error) {
 	ctx := context.TODO()
 	err = coll.UpdateOne(ctx, whereParams, updateParams)
@@ -355,13 +238,6 @@ func (m *EdbDataThsHf) UpdateDataByColl(coll *qmgo.Collection, whereParams, upda
 	return
 }
 
-// RemoveMany
-// @Description: 根据条件删除多条数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 13:17:02
-// @param whereParams interface{}
-// @return err error
 func (m *EdbDataThsHf) RemoveMany(whereParams interface{}) (err error) {
 	db := utils.MgoDataCli.Database(m.DataBaseName())
 	coll := db.Collection(m.CollectionName())
@@ -369,14 +245,6 @@ func (m *EdbDataThsHf) RemoveMany(whereParams interface{}) (err error) {
 	return m.RemoveManyByColl(coll, whereParams)
 }
 
-// RemoveManyByColl
-// @Description: 根据条件删除多条数据(外部传入集合)
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 13:18:42
-// @param coll *qmgo.Collection
-// @param whereParams interface{}
-// @return err error
 func (m *EdbDataThsHf) RemoveManyByColl(coll *qmgo.Collection, whereParams interface{}) (err error) {
 	ctx := context.TODO()
 	_, err = coll.RemoveAll(ctx, whereParams)
@@ -388,26 +256,15 @@ func (m *EdbDataThsHf) RemoveManyByColl(coll *qmgo.Collection, whereParams inter
 	return
 }
 
-// HandleData
-// @Description: 事务处理数据
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 10:39:01
-// @param addDataList []AddEdbDataThsHf
-// @param updateDataList []EdbDataThsHf
-// @return result interface{}
-// @return err error
 func (m *EdbDataThsHf) HandleData(addDataList, updateDataList []EdbDataThsHf) (result interface{}, err error) {
 
 	ctx := context.TODO()
 
 	callback := func(sessCtx context.Context) (interface{}, error) {
-		// 重要:确保事务中的每一个操作,都使用传入的sessCtx参数
 
 		db := utils.MgoDataCli.Database(m.DataBaseName())
 		coll := db.Collection(m.CollectionName())
 
-		// 插入数据
 		if len(addDataList) > 0 {
 			_, err = coll.InsertMany(sessCtx, addDataList)
 			if err != nil {
@@ -415,7 +272,6 @@ func (m *EdbDataThsHf) HandleData(addDataList, updateDataList []EdbDataThsHf) (r
 			}
 		}
 
-		// 修改
 
 		if len(updateDataList) > 0 {
 			for _, v := range updateDataList {
@@ -434,25 +290,7 @@ func (m *EdbDataThsHf) HandleData(addDataList, updateDataList []EdbDataThsHf) (r
 	return
 }
 
-// EdbInfoMaxAndMinInfo 指标最新数据记录结构体
-//type EdbInfoMaxAndMinInfo struct {
-//	MinDate     time.Time `description:"最小日期" bson:"min_date"`
-//	MaxDate     time.Time `description:"最大日期" bson:"max_date"`
-//	MinValue    float64   `description:"最小值" bson:"min_value"`
-//	MaxValue    float64   `description:"最大值" bson:"max_value"`
-//	LatestValue float64   `description:"最新值" bson:"latest_value"`
-//	LatestDate  time.Time `description:"实际数据最新日期" bson:"latest_date"`
-//	EndValue    float64   `description:"最新值" bson:"end_value"`
-//}
-
-// GetEdbInfoMaxAndMinInfo
-// @Description: 获取当前指标的最大最小值
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 17:15:39
-// @param whereParams interface{}
-// @return result EdbInfoMaxAndMinInfo
-// @return err error
+
 func (m *EdbDataThsHf) GetEdbInfoMaxAndMinInfo(whereParams interface{}) (result EdbInfoMaxAndMinInfo, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -476,20 +314,7 @@ func (m *EdbDataThsHf) GetEdbInfoMaxAndMinInfo(whereParams interface{}) (result
 	return
 }
 
-// LatestValue 指标最新数据记录结构体
-//type LatestValue struct {
-//	Value float64 `description:"值" bson:"value"`
-//}
-
-// GetLatestValue
-// @Description: 获取当前指标的最新数据记录
-// @author: Roc
-// @receiver m
-// @datetime 2024-04-30 17:16:15
-// @param whereParams interface{}
-// @param selectParam interface{}
-// @return latestValue LatestValue
-// @return err error
+
 func (m *EdbDataThsHf) GetLatestValue(whereParams, selectParam interface{}) (latestValue LatestValue, err error) {
 	if utils.MgoDataCli == nil {
 		err = errors.New("mongodb连接失败")
@@ -503,8 +328,6 @@ func (m *EdbDataThsHf) GetLatestValue(whereParams, selectParam interface{}) (lat
 		return
 	}
 
-	//var result interface{}
-	//err = coll.Find(ctx, whereParams).Select(selectParam).One(&result)
 	err = coll.Find(ctx, whereParams).Select(selectParam).One(&latestValue)
 	return
 }

+ 0 - 32
models/mgo_base.go

@@ -20,25 +20,10 @@ func init() {
 		mgoCli := mgodb.MgoNewClient(mgoConfig)
 		utils.MgoDataCli = mgoCli
 		utils.MgoDataDbName = mgoConfig.Database
-		//result, err := TestMgoFindOne("data_ths", bson.M{"edbcode": "s0033227", "datatime": "2015-12-04"})
-		//fmt.Println(time.Now())
-		//result, err := TestMgoFindOne("data_wind", bson.M{"edbcode": "s0033227", "datatime": "2007-12-29"})
-		//fmt.Println(time.Now())
-		//
-		//fmt.Println(err)
-		//fmt.Println(result)
 	}
 
 }
 
-// TestMgoFindOne
-// @Description: 获取单条数据
-// @author: Roc
-// @datetime 2024-04-25 15:44:07
-// @param colName string 集合名词:`data_ths`
-// @param whereParams interface{} bson.M{"edbcode": "s0033227", "datatime": "2015-12-04"}
-// @return result interface{}
-// @return err error
 func TestMgoFindOne(colName string, whereParams interface{}) (result interface{}, err error) {
 	if colName == "" {
 		err = errors.New("集合名称不可为空")
@@ -55,27 +40,11 @@ func TestMgoFindOne(colName string, whereParams interface{}) (result interface{}
 		fmt.Println("MgoGetColl Err:", err.Error())
 		return
 	}
-	//err = coll.Find(ctx, whereParams).One(&result)
 	err = coll.Find(ctx, whereParams).All(&result)
 	return
 }
 
-// 创建集合
-//func MgoCreateCollection(collectionName string) (err error) {
-//	ctx := context.TODO()
-//
-//	mgoClient := mgodb.MgoNewClient()
-//
-//	defer func() {
-//		mgoClient.Close(ctx)
-//	}()
-//
-//	colName := collectionName
-//	err = mgoClient.Database("hz_data").CreateCollection(ctx, colName)
-//	return
-//}
 
-// 批量新增多条数据
 func MgoBatchInsertData(colName string, dataList interface{}) (err error) {
 	if colName == "" {
 		err = errors.New("集合名称不可为空")
@@ -98,7 +67,6 @@ func MgoBatchInsertData(colName string, dataList interface{}) (err error) {
 	return
 }
 
-// 插入单条数据
 func MgoInsertData(colName string, dataItem interface{}) (insertedID interface{}, err error) {
 	if colName == "" {
 		err = errors.New("集合名称不可为空")

+ 0 - 28
models/request/mixed_table.go

@@ -1,6 +1,5 @@
 package request
 
-// 单元格的数据类型
 const (
 	DateDT                   = iota + 1 //日期
 	EdbDT                               // 2 指标类型
@@ -12,27 +11,23 @@ const (
 	DateCalculateDataDT                 // 8 日期计算
 )
 
-// 单元格的日期类型类型
 const (
 	CustomDateT = iota //手动输入日期
 	SystemDateT        // 系统日期
 	EdbDateDT          // 导入指标日期(指标库的最新日期)
 )
 
-// 单元格的日期类型类型
 const (
 	SystemCurrDateT      = iota + 1 //系统当前日期
 	SystemCalculateDateT            // 系统日期计算后的日期
 	SystemFrequencyDateT            // 导入系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
 )
 
-// MixedTableReq 混合表格保存请求参数
 type MixedTableReq struct {
 	CellRelation string                    `description:"单元格关系"`
 	Data         [][]MixedTableCellDataReq `description:"混合表格单元格参数"`
 }
 
-// MixedTableCellDataReq 混合表格单元格参数
 type MixedTableCellDataReq struct {
 	Uid             string `description:"单元格唯一标识"`
 	DataType        int    `description:"数据类型,1:日期,2:指标,3:自定义文本,4:插值"`
@@ -56,25 +51,17 @@ type MixedTableCellDataReq struct {
 	} `json:"merData" description:"合并单元格"`
 }
 
-// CellRelationConf
-// @Description: 单元格的关系配置结构体
 type CellRelationConf struct {
 	CellRelation
-	//Type         int          `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
-	//Key          string       `json:"key" description:"单元格的唯一标识"`
 	RelationDate CellRelation `json:"relation_date"`
 	RelationEdb  CellRelation `json:"relation_edb"`
 }
 
-// CellRelation
-// @Description: 单元格的关系结构体
 type CellRelation struct {
 	Type int    `json:"type" description:"数据类型,跟MixedTableCellDataReq的DataType保持一致"`
 	Key  string `json:"key" description:"单元格的唯一标识"`
 }
 
-// SystemDateConf
-// @Description: 系统导入日期配置
 type SystemDateConf struct {
 	Source             int    `description:"类型,1:导入系统日期;2:导入系统日期计算后的日期;3:导入系统日期相关的指定频率"`
 	CalculateNum       int    `description:"计算频度的数量"`
@@ -83,8 +70,6 @@ type SystemDateConf struct {
 	Day                string `description:"指定日期"`
 }
 
-// CalculateConf
-// @Description: 计算公式
 type CalculateConf struct {
 	EdbInfoId     int         `description:"指标id"`
 	DataTime      string      `description:"所属日期,这个日期有传递的话,那么就取上下两期+自己的数据;没有传就默认最近5期的数据"`
@@ -96,30 +81,22 @@ type CalculateConf struct {
 	Source        int         `description:"1:累计值转月;2:累计值转季;3:同比值;4:同差值;5:N数值移动平均数计算;6:环比值;7:环差值;8:升频;9:降频;10:时间移位;11:超季节性;12:年化;13:累计值;14:累计值年初至今;15:指数修匀;16:日均值"`
 }
 
-// BaseCalculateConf
-// @Description: 基础计算公式(A+B)
 type BaseCalculateConf struct {
 	Formula             string         `description:"计算公式,默认是string,实际上还需要转成其他样式"`
 	RelationEdbInfoList []RelationCell `description:"关联单元格(计算公式中关联的单元格,用于计算的时候去匹配)"`
 }
 
-// RelationCell
-// @Description: 关联单元格的信息
 type RelationCell struct {
 	Tag string `description:"指标标签"`
 	Row string `description:"第几行"`
 	Key string `json:"key" description:"单元格的唯一标识"`
 }
 
-// EdbDateConf
-// @Description: 导入指标日期配置
 type EdbDateConf struct {
 	EdbInfoId int `description:"指标id"`
 	EdbDateChangeConf
 }
 
-// EdbDateExtraConf
-// @Description: 导入指标日期前移和日期变换
 type EdbDateChangeConf struct {
 	MoveForward int `description:"前移的期数"`
 	DateChange  []*EdbDateConfDateChange
@@ -134,31 +111,26 @@ type EdbDateConfDateChange struct {
 	ChangeType   int    `description:"日期变换类型1日期位移,2指定频率"`
 }
 
-// MixedDateCalculateReq 混合表格日期计算
 type MixedDateCalculateReq struct {
 	Formula  string                   `description:"计算公式"`
 	DateList []MixDateCalculateTagReq `description:"表格中的单元格"`
 }
 
-// MixDateCalculateConf 混合表格中的日期计算
 type MixDateCalculateConf struct {
 	Formula          string                `description:"计算公式"`
 	RelationCellList []MixDateCalculateTag `description:"表格中的单元格"`
 }
 
-// MixDateCalculateTag 混合表格中的日期计算的关联单元格
 type MixDateCalculateTag struct {
 	Uid string `description:"单元格唯一值"`
 	Tag string `description:"单元格对应标签"`
 }
 
-// MixDateCalculateTagReq 混合表格中的日期计算的关联单元格
 type MixDateCalculateTagReq struct {
 	Date string `description:"日期"`
 	Tag  string `description:"指标对应标签"`
 }
 
-// MixCellShowStyle 混合表格 单元格样式展示计算
 type MixCellShowStyle struct {
 	Pn              int         `description:"小数点位数增加或减少,正数表述增加,负数表示减少" json:"pn"`
 	Nt              string      `description:"变换类型:number 小数点位数改变,percent百分比," json:"nt"`

+ 0 - 7
models/response/excel_info.go

@@ -7,9 +7,7 @@ import (
 	"time"
 )
 
-// ExcelTableDetailResp  excel表格详情
 type ExcelTableDetailResp struct {
-	//ChartInfo   *ChartInfo
 	UniqueCode    string `description:"表格唯一code"`
 	Source        int    `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`
 	ExcelType     int    `description:"表格类型,1:指标列,2:日期列,默认:1"`
@@ -22,13 +20,10 @@ type ExcelTableDetailResp struct {
 	Config        ExcelTableDetailConfigResp
 }
 
-// ExcelTableDetailConfigResp
-// @Description: Excel表格的配置信息
 type ExcelTableDetailConfigResp struct {
 	FontSize int
 }
 
-// TableCellResp 单元格
 type TableCellResp struct {
 	DataType  int    `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算"`
 	DataTime  string `description:"所属日期"`
@@ -41,13 +36,11 @@ type TableDataItem struct {
 	Data      []request.ManualDataReq `description:"数据列表"`
 }
 
-// TableDetailResp  excel表格详情
 type TableDetailResp struct {
 	ExcelInfo models.ExcelInfo     `description:"表格基础信息"`
 	TableData request.TableDataReq `description:"表格内容"`
 }
 
-// ExcelInfoDetail excel表格详情(前端使用)
 type ExcelInfoDetail struct {
 	ExcelInfoId     int                  `orm:"column(excel_info_id);pk"`
 	Source          int                  `description:"表格来源,1:excel插件的表格,2:自定义表格,默认:1"`

+ 0 - 14
models/share_chart_refresh_log.go

@@ -5,14 +5,6 @@ import (
 	"time"
 )
 
-// ShareChartRefreshLog 分享图表的日志
-//
-//	type ShareChartRefreshLog struct {
-//		Id         int    `orm:"column(id);pk"`
-//		Ip         string `description:"来源ip"`
-//		ChartId    int    `description:"图表分类id"`
-//		CreateTime time.Time
-//	}
 type ShareChartRefreshLog struct {
 	Id         int       `gorm:"column:id;primaryKey" description:"主键ID" orm:"column(id);pk"`
 	Ip         string    `gorm:"column:ip" description:"来源IP"`
@@ -20,7 +12,6 @@ type ShareChartRefreshLog struct {
 	CreateTime time.Time `gorm:"column:create_time" description:"创建时间"`
 }
 
-// AddShareChartRefreshLog 添加日志
 func AddShareChartRefreshLog(item *ShareChartRefreshLog) (lastId int64, err error) {
 	o := global.DmSQL["data"]
 	err = o.Create(item).Error
@@ -28,8 +19,3 @@ func AddShareChartRefreshLog(item *ShareChartRefreshLog) (lastId int64, err erro
 	return
 }
 
-// func AddShareChartRefreshLog(item *ShareChartRefreshLog) (lastId int64, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	lastId, err = o.Insert(item)
-// 	return
-// }

+ 0 - 24
models/table.go

@@ -5,22 +5,6 @@ import (
 	"time"
 )
 
-//	type TableInfo struct {
-//		TableInfoId     int       `orm:"column(table_info_id);pk"`
-//		TableName       string    `description:"表格名称"`
-//		UniqueCode      string    `description:"表格唯一编码"`
-//		TableClassifyId int       `description:"表格分类id"`
-//		SysUserId       int       `description:"操作人id"`
-//		SysUserRealName string    `description:"操作人真实姓名"`
-//		StartDate       time.Time `description:"开始日期"`
-//		EdbInfoIds      string    `description:"指标id"`
-//		TableType       int       `description:"表格类型,1:指标+日期"`
-//		TableImage      string    `description:"图表图片"`
-//		Sort            int       `description:"排序字段,数字越小越排前面"`
-//		EdbEndDate      time.Time `description:"指标最后更新日期"`
-//		ModifyTime      time.Time
-//		CreateTime      time.Time
-//	}
 type TableInfo struct {
 	TableInfoId     int       `gorm:"column:table_info_id;primaryKey" description:"表格ID" orm:"column(table_info_id);pk"`
 	TableName       string    `gorm:"column:table_name" description:"表格名称"`
@@ -38,7 +22,6 @@ type TableInfo struct {
 	CreateTime      time.Time `gorm:"column:create_time" description:"创建时间"`
 }
 
-// GetTableInfoByUniqueCode 根据union_code 获取表格信息
 func GetTableInfoByUniqueCode(uniqueCode string) (item *TableInfo, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM table_info WHERE unique_code=? `
@@ -46,14 +29,7 @@ func GetTableInfoByUniqueCode(uniqueCode string) (item *TableInfo, err error) {
 	return
 }
 
-// func GetTableInfoByUniqueCode(uniqueCode string) (item *TableInfo, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	sql := ` SELECT * FROM table_info WHERE unique_code=? `
-// 	err = o.Raw(sql, uniqueCode).QueryRow(&item)
-// 	return
-// }
 
-// TableInfoDetailResp 表格详情返回
 type TableInfoDetailResp struct {
 	TableInfo     *TableInfo
 	TableDataList []*TableData

+ 0 - 9
models/table_data.go

@@ -27,7 +27,6 @@ type TableData struct {
 	CreateTime        time.Time `description:"创建时间" gorm:"column:create_time"`
 }
 
-// GetTableDataListByTableInfoId 根据表格id获取数据列表
 func GetTableDataListByTableInfoId(tableInfoId int) (items []*TableData, err error) {
 	o := global.DmSQL["data"]
 	sql := ` SELECT * FROM table_data WHERE table_info_id = ? order by sort asc `
@@ -35,13 +34,5 @@ func GetTableDataListByTableInfoId(tableInfoId int) (items []*TableData, err err
 	return
 }
 
-// func GetTableDataListByTableInfoId(tableInfoId int) (items []*TableData, err error) {
-// 	o := orm.NewOrmUsingDB("data")
-// 	pars := make([]interface{}, 0)
-// 	pars = append(pars, tableInfoId)
 
-// 	sql := ` SELECT * FROM table_data WHERE table_info_id = ? order by sort asc `
 
-// 	_, err = o.Raw(sql, tableInfoId).QueryRows(&items)
-// 	return
-// }

+ 86 - 86
routers/commentsRouter.go

@@ -7,102 +7,102 @@ import (
 
 func init() {
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartAuthController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartAuthController"],
-		beego.ControllerComments{
-			Method:           "ChartInfoDetail",
-			Router:           `/detail`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartAuthController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartAuthController"],
+        beego.ControllerComments{
+            Method: "ChartInfoDetail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "CommonChartInfoDetailFromUniqueCode",
-			Router:           `/common/detail`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "CommonChartInfoDetailFromUniqueCode",
+            Router: `/common/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "CorrelationChartInfoRefresh",
-			Router:           `/correlation/refresh`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "CorrelationChartInfoRefresh",
+            Router: `/correlation/refresh`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "ChartInfoDetail",
-			Router:           `/detail`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "ChartInfoDetail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "Collect",
-			Router:           `/dw/collect`,
-			AllowHTTPMethods: []string{"post"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "Collect",
+            Router: `/dw/collect`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "CollectCancel",
-			Router:           `/dw/collectCancel`,
-			AllowHTTPMethods: []string{"post"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "CollectCancel",
+            Router: `/dw/collectCancel`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "FutureGoodChartInfoRefresh",
-			Router:           `/future_good/refresh`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "FutureGoodChartInfoRefresh",
+            Router: `/future_good/refresh`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
-		beego.ControllerComments{
-			Method:           "ChartInfoRefresh",
-			Router:           `/refresh`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ChartController"],
+        beego.ControllerComments{
+            Method: "ChartInfoRefresh",
+            Router: `/refresh`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"],
-		beego.ControllerComments{
-			Method:           "GetTableDetail",
-			Router:           `/detail`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"],
+        beego.ControllerComments{
+            Method: "GetTableDetail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"],
-		beego.ControllerComments{
-			Method:           "Refresh",
-			Router:           `/refresh`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
-			Filters:          nil,
-			Params:           nil})
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:ExcelInfoController"],
+        beego.ControllerComments{
+            Method: "Refresh",
+            Router: `/refresh`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
 
-	beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:TableController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:TableController"],
-		beego.ControllerComments{
-			Method:           "TableInfoDetail",
-			Router:           `/detail`,
-			AllowHTTPMethods: []string{"get"},
-			MethodParams:     param.Make(),
+    beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:TableController"] = append(beego.GlobalControllerRouter["eta_gn/eta_chart_lib/controllers:TableController"],
+        beego.ControllerComments{
+            Method: "TableInfoDetail",
+            Router: `/detail`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
             Filters: nil,
             Params: nil})
 

+ 0 - 7
routers/router.go

@@ -1,10 +1,3 @@
-// @APIVersion 1.0.0
-// @Title beego Test API
-// @Description beego has a very cool tools to autogenerate documents for your API
-// @Contact astaxie@gmail.com
-// @TermsOfServiceUrl http://beego.me/
-// @License Apache 2.0
-// @LicenseUrl http://www.apache.org/licenses/LICENSE-2.0.html
 package routers
 
 import (

+ 0 - 5
services/alarm_msg/alarm_msg.go

@@ -6,11 +6,6 @@ import (
 	"github.com/rdlucklib/rdluck_tools/http"
 )
 
-// SendAlarmMsg
-// projectName-项目名称
-// runMode-运行模式
-// msgBody-消息内容
-// level:消息基本,1:提示消息,2:警告消息,3:严重错误信息,默认为1 提示消息
 func SendAlarmMsg(msgBody string, level int) {
 	if utils.AlarmMsgUrl == `` {
 		return

+ 0 - 77
services/data/base_edb_lib.go

@@ -11,7 +11,6 @@ import (
 	"strings"
 )
 
-// 新增指标数据
 func AddEdbData(source int, edbCode string) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["EdbCode"] = edbCode
@@ -65,7 +64,6 @@ func AddEdbData(source int, edbCode string) (resp *models.BaseResponse, err erro
 	return
 }
 
-// RefreshEdbData 刷新指标数据
 func RefreshEdbData(edbInfoId, source, subSource int, edbCode, startDate string) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["EdbCode"] = edbCode
@@ -74,73 +72,6 @@ func RefreshEdbData(edbInfoId, source, subSource int, edbCode, startDate string)
 	param["StartDate"] = startDate
 	urlStr := ``
 	switch source {
-	//case utils.DATA_SOURCE_THS:
-	//	switch subSource {
-	//	case utils.DATA_SUB_SOURCE_DATE:
-	//		urlStr = "ths/ds/refresh"
-	//	case utils.DATA_SUB_SOURCE_HIGH_FREQUENCY:
-	//		urlStr = "ths/hf/edb/refresh"
-	//	default:
-	//		urlStr = "ths/refresh"
-	//	}
-	//case utils.DATA_SOURCE_WIND:
-	//	if subSource == 0 {
-	//		urlStr = "wind/refresh"
-	//	} else {
-	//		urlStr = "wind/wsd/refresh"
-	//	}
-	//case utils.DATA_SOURCE_PB:
-	//	urlStr = "/pb/refresh"
-	//case utils.DATA_SOURCE_PB_FINANCE:
-	//	urlStr = "/pb_finance/refresh"
-	//case utils.DATA_SOURCE_MANUAL:
-	//	urlStr = "/manual/refresh"
-	//case utils.DATA_SOURCE_LZ:
-	//	urlStr = "/lz/refresh"
-	//case utils.DATA_SOURCE_YS:
-	//	urlStr = "/smm/refresh"
-	//case utils.DATA_SOURCE_GL:
-	//	urlStr = "/mysteel/refresh"
-	//case utils.DATA_SOURCE_ZZ:
-	//	urlStr = "/zz/refresh"
-	//case utils.DATA_SOURCE_DL:
-	//	urlStr = "/dl/refresh"
-	//case utils.DATA_SOURCE_SH:
-	//	urlStr = "/sh/refresh"
-	//case utils.DATA_SOURCE_CFFEX:
-	//	urlStr = "/cffex/refresh"
-	//case utils.DATA_SOURCE_SHFE:
-	//	urlStr = "/shfe/refresh"
-	//case utils.DATA_SOURCE_GIE:
-	//	urlStr = "/gie/refresh"
-	//case utils.DATA_SOURCE_LT:
-	//	urlStr = "/lt/refresh"
-	//case utils.DATA_SOURCE_COAL:
-	//	urlStr = "/coal/refresh"
-	//case utils.DATA_SOURCE_GOOGLE_TRAVEL:
-	//	urlStr = "google_travel/refresh"
-	//case utils.DATA_SOURCE_MYSTEEL_CHEMICAL:
-	//	urlStr = "mysteel_chemical/refresh"
-	//case utils.DATA_SOURCE_EIA_STEO:
-	//	urlStr = "eia_steo/refresh"
-	//case utils.DATA_SOURCE_PREDICT:
-	//	urlStr = "predict/refresh"
-	//case utils.DATA_SOURCE_COM_TRADE:
-	//	urlStr = "com_trade/refresh"
-	//case utils.DATA_SOURCE_SCI:
-	//	urlStr = "/sci/refresh"
-	//case utils.DATA_SOURCE_BAIINFO:
-	//	urlStr = "/baiinfo/refresh"
-	//case utils.DATA_SOURCE_NATIONAL_STATISTICS:
-	//	urlStr = "/national_statistics/refresh"
-	//case utils.DATA_SOURCE_FUBAO:
-	//	urlStr = "fubao/refresh"
-	//case utils.DATA_SOURCE_GFEX:
-	//	urlStr = "gz/refresh"
-	//case utils.DATA_SOURCE_ICPI:
-	//	urlStr = "icpi/refresh"
-	//case utils.DATA_SOURCE_SCI99:
-	//	urlStr = "sci99/refresh"
 	default:
 		edbSource := data_manage.GetEdbSourceBySourceId(source)
 		if edbSource != nil {
@@ -155,7 +86,6 @@ func RefreshEdbData(edbInfoId, source, subSource int, edbCode, startDate string)
 	return
 }
 
-// RefreshEdbCalculateData 刷新计算指标数据请求
 func RefreshEdbCalculateData(edbInfoId int, edbCode, startDate string) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["EdbCode"] = edbCode
@@ -165,7 +95,6 @@ func RefreshEdbCalculateData(edbInfoId int, edbCode, startDate string) (resp *mo
 	return
 }
 
-// RefreshPredictEdbCalculateData 刷新 预测计算指标 数据请求
 func RefreshPredictEdbCalculateData(edbInfoId int, edbCode, startDate string) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["EdbCode"] = edbCode
@@ -175,7 +104,6 @@ func RefreshPredictEdbCalculateData(edbInfoId int, edbCode, startDate string) (r
 	return
 }
 
-// BaseCalculateResp 拟合残差计算相关性的值返回
 type BaseCalculateResp struct {
 	Ret         int
 	Msg         string
@@ -187,14 +115,11 @@ type BaseCalculateResp struct {
 	IsAddLog    bool `json:"-" description:"true 新增操作日志,false 不新增操作日志" `
 }
 
-// BaseCalculateDataResp
-// @Description: 基础计算的返回结果
 type BaseCalculateDataResp struct {
 	DataMap  map[string]float64
 	DateList []string
 }
 
-// BaseCalculate 基础计算
 func BaseCalculate(param, lang string) (resp *BaseCalculateResp, err error) {
 	urlStr := "calculate/base"
 	_, resultByte, err := postAddEdbData(param, urlStr, lang)
@@ -205,7 +130,6 @@ func BaseCalculate(param, lang string) (resp *BaseCalculateResp, err error) {
 	return
 }
 
-// postRefreshEdbData 刷新指标数据
 func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *models.BaseResponse, err error) {
 	postUrl := utils.EDB_LIB_URL + urlStr
 	postData, err := json.Marshal(param)
@@ -223,7 +147,6 @@ func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *mode
 	return resp, nil
 }
 
-// postAddEdbData 新增指标数据
 func postAddEdbData(paramStr string, urlStr, lang string) (resp *models.BaseResponse, result []byte, err error) {
 	postUrl := utils.EDB_LIB_URL + urlStr
 	result, err = HttpPost(postUrl, paramStr, lang, "application/json")

+ 0 - 38
services/data/chart_extra_config.go

@@ -11,9 +11,7 @@ import (
 	"time"
 )
 
-// GetChartSectionCombineData 截面组合图的数据处理
 func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*models.ChartEdbInfoMapping, edbDataListMap map[int][]*models.EdbDataList, extraConfig models.ChartSectionAllExtraConf) (edbIdList []int, dataListResp models.ChartSectionCombineDataResp, err error) {
-	// 指标数据数组(10086:{"2022-12-02":100.01,"2022-12-01":102.3})
 	edbDataMap := make(map[int]map[string]float64)
 	for edbInfoId, edbDataList := range edbDataListMap {
 		edbDateData := make(map[string]float64)
@@ -23,15 +21,12 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 		edbDataMap[edbInfoId] = edbDateData
 	}
 
-	// edbIdList 指标展示顺序;x轴的指标顺序
 	edbIdList = make([]int, 0)
 	edbMappingMap := make(map[int]*models.ChartEdbInfoMapping)
 	for _, v := range mappingList {
 		edbIdList = append(edbIdList, v.EdbInfoId)
 		edbMappingMap[v.EdbInfoId] = v
 	}
-	// 确定好截面散点图返回的数据格式
-	// 获取所有的引用日期设置
 	dateConfListMap := make(map[string]*models.ChartSectionDateConfItem)
 	dateConfEdbIds := make([]int, 0)
 	for _, v := range extraConfig.DateConfList {
@@ -40,9 +35,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 		}
 		dateConfListMap[v.DateConfName] = v
 	}
-	// 遍历每个系列
-	// 遍历每个指标,根据选中的日期,进行日期变换得到最终的日期,根据最终的日期获取对应的值
-	// 组装数据
 	baseSeries := new(models.ChartSectionSeriesItem) //y轴的系列
 	var firstUnit, leftUnit, rightUnit, right2Unit *models.XData
 	var (
@@ -82,7 +74,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 				err = fmt.Errorf("指标%d的日期数据不存在", edbInfoId)
 				return
 			}
-			//日期变换处理,判断用指标的最新日期还是,直接获取引用日期
 			var findDate string
 			if edbConf.DateConfType == 0 {
 				if edbInfoId == 0 {
@@ -95,13 +86,11 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 					return
 				}
 			} else {
-				// 获取日期配置
 				dateConfItem, ok1 := dateConfListMap[edbConf.DateConfName]
 				if !ok1 {
 					err = fmt.Errorf("引用日期配置不存在")
 					return
 				}
-				// todo 根据日期变换得到最终日期
 				edbDataListTmp := make([]*models.EdbDataList, 0)
 				if dateConfItem.DateType == 0 {
 					if dateConfItem.EdbInfoId > 0 {
@@ -177,7 +166,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 			right2Unit = firstUnit
 		}
 
-		//处理上下限
 		var minData, maxData float64
 		for _, d := range seriesItem.DataList {
 			if minData > d {
@@ -210,8 +198,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 			}
 		}
 	}
-	// 处理横轴
-	// 遍历基准系列,判断有几个横轴名称
 	if baseSeries == nil {
 		err = fmt.Errorf("基准系列不存在")
 		return
@@ -233,7 +219,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 		defaultXDataMap[index] = tmp
 		defaultIndexXDataList = append(defaultIndexXDataList, index)
 	}
-	// 处理系列排序
 	if extraConfig.SortType > 0 {
 		newSeriesDataListMap, newSeriesNoDataIndexMap, newIndexXDataList := SortChartSeriesDataSet(baseSeries.SeriesName, baseSeries.DataList, baseSeries.NoDataEdbIndex, seriesDataListMap, seriesNoDataIndexMap, extraConfig.SortType)
 		for k, item := range extraConfig.SeriesList {
@@ -256,7 +241,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 			err = fmt.Errorf("单位不存在")
 			return
 		}
-		// 如果已经设置了横轴名称,则用设置的名称替换
 		if len(extraConfig.XDataList) > index {
 			newItem := extraConfig.XDataList[index]
 			if newItem.Name != "" {
@@ -317,7 +301,6 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 		dataListResp.Right2Max = strconv.FormatFloat(Right2Max, 'f', -1, 64)
 	}
 
-	// 查询引用日期里的指标信息
 	if len(dateConfEdbIds) > 0 {
 		dateConfEdbList, e := data_manage.GetEdbInfoByIdList(dateConfEdbIds)
 		if e != nil {
@@ -351,12 +334,10 @@ func GetChartSectionCombineData(chartInfo *models.ChartInfo, mappingList []*mode
 	return
 }
 
-// GetChartSectionSeriesDateByDateChange 获取日期变换后的日期edbInfoId 1指标日期,2 系统日期
 func GetChartSectionSeriesDateByDateChange(edbInfoId int, dataList []*models.EdbDataList, dateChange []*models.ChartSectionDateChange, moveForward int) (newDate string, err error) {
 	if edbInfoId > 0 { //指标日期
 		newDate = GetEdbDateByMoveForward(moveForward, dataList)
 	} else {
-		//系统日期
 		newDate = time.Now().Format(utils.FormatDate)
 	}
 	if newDate != "" && len(dateChange) > 0 {
@@ -376,7 +357,6 @@ func GetEdbDateByMoveForward(moveForward int, edbDataList []*models.EdbDataList)
 }
 
 func GetEdbDateByMoveForwardByDateList(moveForward int, dateList []string) (date string) {
-	// 根据日期进行排序
 	index := len(dateList) - 1 - moveForward
 	for k, v := range dateList {
 		if k == index {
@@ -387,7 +367,6 @@ func GetEdbDateByMoveForwardByDateList(moveForward int, dateList []string) (date
 	return
 }
 
-// HandleChartSectionSeriesDateChange 处理日期变换
 func HandleChartSectionSeriesDateChange(date string, dateChange []*models.ChartSectionDateChange) (newDate string, err error) {
 	newDate = date
 	if newDate != "" {
@@ -420,17 +399,7 @@ func HandleChartSectionSeriesDateChange(date string, dateChange []*models.ChartS
 	return
 }
 
-// handleSystemAppointDateT
-// @Description: 处理系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
-// @author: Roc
-// @datetime2023-10-27 09:31:35
-// @param Frequency string
-// @param Day string
-// @return date string
-// @return err error
-// @return errMsg string
 func handleSystemAppointDateT(currDate time.Time, appointDay, frequency string) (date string, err error, errMsg string) {
-	//currDate := time.Now()
 	switch frequency {
 	case "本周":
 		day := int(currDate.Weekday())
@@ -549,14 +518,12 @@ func handleSystemAppointDateT(currDate time.Time, appointDay, frequency string)
 	return
 }
 
-// sortTripleDataSet 以第一组数据为基准,排序之后,空数组的位置也要同步变更
 func SortChartSeriesDataSet(baseName string, baseDataList []float64, baseSeriesNoDataIndexList []int, dataListMap map[string][]float64, noDataListIndexMap map[string][]int, asc int) (newDataListMap map[string][]float64, newNoDataListIndexMap map[string][]int, newIndexXDataList []int) {
 	newDataListMap = make(map[string][]float64)
 	newNoDataListIndexMap = make(map[string][]int)
 
 	indices := make([]int, len(baseDataList))
 	newIndices := make([]int, len(baseDataList)-len(baseSeriesNoDataIndexList))
-	// 初始化indices
 	for i := range indices {
 		indices[i] = i
 	}
@@ -577,7 +544,6 @@ func SortChartSeriesDataSet(baseName string, baseDataList []float64, baseSeriesN
 			j += 1
 		}
 		newIndices = append(newIndices, baseSeriesNoDataIndexList...)
-		// 根据排序后的indices重新排列所有组的数据
 		for i, idx := range newIndices {
 			for k, _ := range dataListMap {
 				if _, ok := newDataListMap[k]; !ok {
@@ -595,10 +561,8 @@ func SortChartSeriesDataSet(baseName string, baseDataList []float64, baseSeriesN
 		newDataListMap = make(map[string][]float64)
 		newNoDataListIndexMap = make(map[string][]int)
 		baseDataList, _ = dataListMap[baseName]
-		//先把空的数据移动到最后面
 		indices = make([]int, len(baseDataList)-len(baseSeriesNoDataIndexList)) //空值不参与排序
 		newIndices = make([]int, len(baseDataList))                             //空值不参与排序
-		// 初始化indices
 		for i := range indices {
 			indices[i] = i
 		}
@@ -612,7 +576,6 @@ func SortChartSeriesDataSet(baseName string, baseDataList []float64, baseSeriesN
 		}
 	}
 	if asc == 1 {
-		// 使用sort.Sort进行排序
 		sort.Sort(models.ChartSectionSeriesValSortAsc(baseDataSortList))
 	} else {
 		sort.Sort(models.ChartSectionSeriesValSortDesc(baseDataSortList))
@@ -629,7 +592,6 @@ func SortChartSeriesDataSet(baseName string, baseDataList []float64, baseSeriesN
 			newIndices[i] = i
 		}
 	}
-	// 根据排序后的indices重新排列所有组的数据
 	for i, idx := range newIndices {
 		for k, _ := range dataListMap {
 			if _, ok := newDataListMap[k]; !ok {

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 164
services/data/chart_info.go


+ 0 - 25
services/data/chart_info_excel_balance.go

@@ -18,7 +18,6 @@ func GetBalanceExcelChartDetail(chartInfo *models.ChartInfo, mappingListTmp []*e
 	chartInfoId := chartInfo.ChartInfoId
 	resp = new(models.ChartInfoDetailResp)
 
-	// 获取主题样式
 	chartTheme, err := GetChartThemeConfig(chartInfo.ChartThemeId, 1, chartInfo.ChartType)
 	if err != nil {
 		errMsg = "获取失败"
@@ -86,9 +85,7 @@ func GetBalanceExcelChartDetail(chartInfo *models.ChartInfo, mappingListTmp []*e
 		chartInfo.StartDate = startDate
 		chartInfo.EndDate = endDate
 	}
-	// 图表额外数据参数
 	extraConfigStr := chartInfo.ExtraConfig
-	// 柱方图的一些配置
 	var barConfig data_manage.BarChartInfoReq
 	if chartInfo != nil && chartInfo.ChartType == 7 {
 		if chartInfo.BarConfig == `` {
@@ -104,12 +101,10 @@ func GetBalanceExcelChartDetail(chartInfo *models.ChartInfo, mappingListTmp []*e
 		}
 		extraConfigStr = chartInfo.BarConfig
 	}
-	// 获取表格数据
 
 	excelChartInfoDataShow := new(ExcelChartInfoDataShow)
 	excelChartInfoDataShow.DataListMap = dataListMap
 
-	// 获取图表中的指标数据
 	edbList, xEdbIdValue, yDataList, dataResp, e, msg := GetChartEdbDataV2(chartInfoId, chartType, calendar, startDate, endDate, mappingList, extraConfigStr, chartInfo.SeasonExtraConfig, excelChartInfoDataShow)
 	if e != nil {
 		err = fmt.Errorf("获取图表,指标数据失败,Err:%s", e.Error())
@@ -118,7 +113,6 @@ func GetBalanceExcelChartDetail(chartInfo *models.ChartInfo, mappingListTmp []*e
 	}
 
 	for _, v := range edbList {
-		// 指标别名
 		if barConfig.EdbInfoIdList != nil && len(barConfig.EdbInfoIdList) > 0 {
 			for _, reqEdb := range barConfig.EdbInfoIdList {
 				if v.EdbInfoId == reqEdb.EdbInfoId {
@@ -127,7 +121,6 @@ func GetBalanceExcelChartDetail(chartInfo *models.ChartInfo, mappingListTmp []*e
 			}
 		}
 	}
-	// 图表的指标来源
 	sourceNameList, sourceNameEnList := GetEdbSourceByEdbInfoIdList(edbList)
 
 	chartInfo.ChartSource = strings.Join(sourceNameList, ",")
@@ -142,13 +135,10 @@ func GetBalanceExcelChartDetail(chartInfo *models.ChartInfo, mappingListTmp []*e
 	return
 }
 
-// GetBalanceExcelEdbDataMapList 获取指标最后的基础数据
 func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate string, mappingList []*models.ChartEdbInfoMapping, seasonExtraConfig string, dataListMap map[int][]*models.EdbDataList) (edbDataListMap map[int][]*models.EdbDataList, edbList []*models.ChartEdbInfoMapping, err error) {
-	// 指标对应的所有数据
 	edbDataListMap = make(map[int][]*models.EdbDataList)
 
 	for _, v := range mappingList {
-		//fmt.Println("v:", v.EdbInfoId)
 		item := new(models.ChartEdbInfoMapping)
 		item.EdbInfoId = v.EdbInfoId
 		item.SourceName = v.SourceName
@@ -235,7 +225,6 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 					diffSeconds = 0
 				}
 
-				// 预测指标的开始日期也要偏移
 				{
 					day, tmpErr := utils.GetDaysBetween2Date(utils.FormatDate, startDate, startDateReal)
 					if tmpErr != nil {
@@ -253,7 +242,6 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 				startDateReal = startDate
 			}
 		}
-		//fmt.Println("line 1011 chart:", v.Source, v.EdbInfoId, startDateReal, endDate)
 		calendarPreYear := 0
 		if calendar == "农历" {
 			newStartDateReal, e := time.Parse(utils.FormatDate, startDateReal)
@@ -269,12 +257,10 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 		dataListTmp, ok := dataListMap[v.EdbInfoId]
 		if ok {
 			dataList = dataListTmp
-			// 对dataList 根据dataTimestamp 进行排序
 			sort.Slice(dataList, func(i, j int) bool {
 				return dataList[i].DataTimestamp < dataList[j].DataTimestamp
 			})
 		} else {
-			//err = errors.New(fmt.Sprint("获取失败,指标类型异常", v.EdbInfoId))
 			utils.FileLog.Info(fmt.Sprintf("获取失败,指标数据异常 %d", v.EdbInfoId))
 		}
 		if v.IsConvert == 1 {
@@ -283,14 +269,10 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 				for i, data := range dataList {
 					dataList[i].Value = data.Value * v.ConvertValue
 				}
-				//item.MaxData = item.MaxData * v.ConvertValue
-				//item.MinData = item.MinData * v.ConvertValue
 			case 2:
 				for i, data := range dataList {
 					dataList[i].Value = data.Value / v.ConvertValue
 				}
-				//item.MaxData = item.MaxData / v.ConvertValue
-				//item.MinData = item.MinData / v.ConvertValue
 			case 3:
 				for i, data := range dataList {
 					if data.Value <= 0 {
@@ -299,8 +281,6 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 					}
 					dataList[i].Value = math.Log(data.Value) / math.Log(v.ConvertValue)
 				}
-				//item.MaxData = math.Log(item.MaxData) / math.Log(v.ConvertValue)
-				//item.MinData = math.Log(item.MinData) / math.Log(v.ConvertValue)
 			}
 		}
 
@@ -316,7 +296,6 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 		if chartType == 2 {
 			latestDate, tmpErr := time.Parse(utils.FormatDate, v.LatestDate)
 			if tmpErr != nil {
-				//item.DataList = dataList
 				item.IsNullData = true
 				edbList = append(edbList, item)
 				continue
@@ -350,7 +329,6 @@ func GetBalanceExcelEdbDataMapList(chartInfoId, chartType int, calendar, startDa
 			}
 
 		} else if chartType == 7 || chartType == utils.CHART_TYPE_RADAR { //柱方图
-			//item.DataList = dataList
 		} else {
 			item.DataList = dataList
 		}
@@ -390,14 +368,12 @@ func getBalanceDataListStartDateAndValue(dataList []*models.EdbDataList) (startD
 
 func TransferChartEdbToEdbMappingFormat(chartInfoId, chartType int, mappingListTmp []*excel.ExcelChartEdb, dataListMap map[int][]*models.EdbDataList) (mappingList []*models.ChartEdbInfoMapping, err error) {
 	mappingList = make([]*models.ChartEdbInfoMapping, 0)
-	//循环组装映射关系
 	for _, v := range mappingListTmp {
 		dataList := make([]*models.EdbDataList, 0)
 		dataListTmp, ok := dataListMap[v.ExcelChartEdbId]
 		if ok {
 			dataList = dataListTmp
 		} else {
-			//err = errors.New(fmt.Sprint("获取失败,指标类型异常", v.ExcelChartEdbId))
 			utils.FileLog.Info(fmt.Sprintf("获取失败,指标数据异常 %d", v.ExcelChartEdbId))
 		}
 		startDateStr, endDateStr, _, endVal, maxValue, minValue := getBalanceDataListStartDateAndValue(dataList)
@@ -426,7 +402,6 @@ func TransferChartEdbToEdbMappingFormat(chartInfoId, chartType int, mappingListT
 			IsOrder:           v.IsOrder,
 			IsAxis:            v.IsAxis,
 			EdbInfoType:       v.EdbInfoType,
-			//EdbInfoCategoryType: 0,
 			LeadValue:         v.LeadValue,
 			LeadUnit:          v.LeadUnit,
 			LeadUnitEn:        "",

+ 0 - 7
services/data/chart_info_interface.go

@@ -13,14 +13,11 @@ type ChartInfoDataShow interface {
 type BaseChartInfoDataShow struct {
 }
 
-// GetEdbDataMapList 获取指标最后的基础数据
 func (e *BaseChartInfoDataShow) GetEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate string, mappingList []*models.ChartEdbInfoMapping, seasonExtraConfig string) (edbDataListMap map[int][]*models.EdbDataList, edbList []*models.ChartEdbInfoMapping, err error) {
-	// 指标对应的所有数据
 	edbDataListMap, edbList, err = GetEdbDataMapList(chartInfoId, chartType, calendar, startDate, endDate, mappingList, seasonExtraConfig)
 	return
 }
 
-// GetChartEdbMappingListByEdbInfoIdList 获取指标最后的基础数据
 func (e *BaseChartInfoDataShow) GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (mappingList []*models.ChartEdbInfoMapping, err error) {
 	mappingList, err = models.GetChartEdbMappingListByEdbInfoIdList(edbIdList)
 	return
@@ -31,16 +28,12 @@ type ExcelChartInfoDataShow struct {
 	MappingListTmp []*excel.ExcelChartEdb
 }
 
-// GetEdbDataMapList 获取指标最后的基础数据
 func (e *ExcelChartInfoDataShow) GetEdbDataMapList(chartInfoId, chartType int, calendar, startDate, endDate string, mappingList []*models.ChartEdbInfoMapping, seasonExtraConfig string) (edbDataListMap map[int][]*models.EdbDataList, edbList []*models.ChartEdbInfoMapping, err error) {
-	// 指标对应的所有数据
 	edbDataListMap, edbList, err = GetBalanceExcelEdbDataMapList(chartInfoId, chartType, calendar, startDate, endDate, mappingList, seasonExtraConfig, e.DataListMap)
 	return
 }
 
-// GetChartEdbMappingListByEdbInfoIdList 获取指标最后的基础数据
 func (e *ExcelChartInfoDataShow) GetChartEdbMappingListByEdbInfoIdList(edbIdList []int) (mappingList []*models.ChartEdbInfoMapping, err error) {
-	// 指标对应的所有数据
 	mappingList, err = TransferChartEdbToEdbMappingFormat(0, 0, e.MappingListTmp, e.DataListMap)
 	return
 }

+ 0 - 19
services/data/chart_theme.go

@@ -6,15 +6,6 @@ import (
 	"eta_gn/eta_chart_lib/utils"
 )
 
-// GetChartThemeConfig
-// @Description: 根据主题id获取主题信息,如果获取不到的话,那么就获取默认的主题
-// @author: Roc
-// @datetime 2023-12-19 14:31:17
-// @param chartThemeId int
-// @param chartType int
-// @param source int
-// @return chartTheme *chart_theme.ChartTheme
-// @return err error
 func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart_theme.ChartTheme, err error) {
 	chartTheme, err = chart_theme.GetChartThemeId(chartThemeId)
 	if err != nil && !utils.IsErrNoRow(err) {
@@ -23,9 +14,7 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 
 	err = nil
 
-	// 如果找到了,那么就返回
 	if chartTheme != nil && chartTheme.ChartThemeId > 0 {
-		// 兼容历史数据,加入新字段LineOptionList
 		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
 		if e == nil {
 			chartTheme.Config = newConfig
@@ -36,15 +25,12 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 		return
 	}
 
-	// 没有找到的话,那么就找默认的主题
 
-	// 查找主题类型id
 	chartThemeType, err := chart_theme.GetChartThemeTypeByChartTypeAndSource(chartType, source)
 	if err != nil {
 		return
 	}
 
-	// 寻找默认的主题id
 	chartTheme, err = chart_theme.GetChartThemeId(chartThemeType.DefaultChartThemeId)
 	if err != nil && !utils.IsErrNoRow(err) {
 		return
@@ -52,9 +38,7 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 
 	err = nil
 
-	// 如果找到了,那么就返回
 	if chartTheme != nil {
-		// 兼容历史数据,加入新字段LineOptionList
 		newConfig, e := ConvertOldChartOptions(chartTheme.Config)
 		if e == nil {
 			chartTheme.Config = newConfig
@@ -65,10 +49,8 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 		return
 	}
 
-	// 如果还是没找到,那就系统的主题id
 	chartTheme, err = chart_theme.GetSystemChartTheme(chartThemeType.ChartThemeTypeId)
 
-	// 兼容历史数据,加入新字段LineOptionList
 	newConfig, e := ConvertOldChartOptions(chartTheme.Config)
 	if e == nil {
 		chartTheme.Config = newConfig
@@ -79,7 +61,6 @@ func GetChartThemeConfig(chartThemeId, source, chartType int) (chartTheme *chart
 	return
 }
 
-// 兼容历史数据,加入新字段LineOptionList
 func ConvertOldChartOptions(config string) (newConfig string, err error) {
 	var oldTheme chart_theme.OldChartOptions
 

+ 2 - 88
services/data/correlation/chart_info.go

@@ -13,7 +13,6 @@ import (
 	"time"
 )
 
-// HandleDataByLinearRegression 线性方程插值法补全数据
 func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMap map[string]float64) (newList []*models.EdbDataList, err error) {
 	if len(originList) < 2 {
 		return
@@ -23,7 +22,6 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 	for _, v := range originList {
 		handleDataMap[v.DataTime] = v.Value
 
-		// 第一个数据就给过滤了,给后面的试用
 		if startEdbInfoData == nil {
 			startEdbInfoData = v
 			newList = append(newList, &models.EdbDataList{
@@ -33,13 +31,11 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 			continue
 		}
 
-		// 获取两条数据之间相差的天数
 		startDataTime, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
 		currDataTime, _ := time.ParseInLocation(utils.FormatDate, v.DataTime, time.Local)
 		betweenHour := int(currDataTime.Sub(startDataTime).Hours())
 		betweenDay := betweenHour / 24
 
-		// 如果相差一天,那么过滤
 		if betweenDay <= 1 {
 			startEdbInfoData = v
 			newList = append(newList, &models.EdbDataList{
@@ -49,7 +45,6 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 			continue
 		}
 
-		// 生成线性方程式
 		var a, b float64
 		{
 			coordinateData := make([]utils.Coordinate, 0)
@@ -71,7 +66,6 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 			}
 		}
 
-		// 生成对应的值
 		{
 			for i := 1; i < betweenDay; i++ {
 				tmpDataTime := startDataTime.AddDate(0, 0, i)
@@ -88,7 +82,6 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 			}
 		}
 
-		// 最后将自己赋值
 		newList = append(newList, &models.EdbDataList{
 			EdbDataId: v.EdbDataId,
 			DataTime:  v.DataTime,
@@ -100,7 +93,6 @@ func HandleDataByLinearRegression(originList []*models.EdbDataList, handleDataMa
 	return
 }
 
-// MoveDataDaysToNewDataList 平移指标数据生成新的数据序列
 func MoveDataDaysToNewDataList(dataList []*models.EdbDataList, moveDay int) (newDataList []models.EdbDataList, dateDataMap map[string]float64) {
 	dateMap := make(map[time.Time]float64)
 	var minDate, maxDate time.Time
@@ -117,7 +109,6 @@ func MoveDataDaysToNewDataList(dataList []*models.EdbDataList, moveDay int) (new
 		dateMap[currDate] = v.Value
 	}
 
-	// 处理领先、滞后数据
 	newDateMap := make(map[time.Time]float64)
 	for currDate, value := range dateMap {
 		newDate := currDate.AddDate(0, 0, moveDay)
@@ -126,14 +117,12 @@ func MoveDataDaysToNewDataList(dataList []*models.EdbDataList, moveDay int) (new
 	minDate = minDate.AddDate(0, 0, moveDay)
 	maxDate = maxDate.AddDate(0, 0, moveDay)
 
-	// 获取日期相差日
 	dayNum := utils.GetTimeSubDay(minDate, maxDate)
 
 	for i := 0; i <= dayNum; i++ {
 		currDate := minDate.AddDate(0, 0, i)
 		tmpValue, ok := newDateMap[currDate]
 		if !ok {
-			//找不到数据,那么就用前面的数据吧
 			if len(newDataList)-1 < 0 {
 				tmpValue = 0
 			} else {
@@ -150,7 +139,6 @@ func MoveDataDaysToNewDataList(dataList []*models.EdbDataList, moveDay int) (new
 	return
 }
 
-// GetChartEdbInfoFormat 相关性图表-获取指标信息
 func GetChartEdbInfoFormat(chartInfoId int, edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfoMapping) (edbList []*models.ChartEdbInfoMapping, err error) {
 	edbList = make([]*models.ChartEdbInfoMapping, 0)
 	if edbInfoMappingA == nil || edbInfoMappingB == nil {
@@ -195,7 +183,6 @@ func GetChartEdbInfoFormat(chartInfoId int, edbInfoMappingA, edbInfoMappingB *mo
 	return
 }
 
-// GetChartDataByEdbInfo 相关性图表-根据指标信息获取x轴和y轴
 func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfoMapping, leadValue int, leadUnit, startDate, endDate, extraConfig string) (xEdbIdValue []int, yDataList []models.YData, err error) {
 	xData := make([]int, 0)
 	yData := make([]float64, 0)
@@ -211,18 +198,12 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 		}
 	}
 
-	// 计算窗口,不包含第一天
 	startDateTime, _ := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
 	startDate = startDateTime.AddDate(0, 0, 1).Format(utils.FormatDate)
 
-	//// 2023-03-02 时间序列始终以指标B为基准, 始终是A进行平移
-	//baseEdbInfo := edbInfoMappingB
-	//changeEdbInfo := edbInfoMappingA
-	// 2023-03-17 时间序列始终以指标A为基准, 始终是B进行平移
 	baseEdbInfo := edbInfoMappingA
 	changeEdbInfo := edbInfoMappingB
 
-	// 获取时间基准指标在时间区间内的值
 	aDataList := make([]*models.EdbDataList, 0)
 	switch baseEdbInfo.EdbInfoCategoryType {
 	case 0:
@@ -234,7 +215,6 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 		return
 	}
 
-	// 获取变频指标所有日期的值, 插值法完善数据
 	bDataList := make([]*models.EdbDataList, 0)
 	switch changeEdbInfo.EdbInfoCategoryType {
 	case 0:
@@ -245,20 +225,12 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 		err = errors.New("指标change类型异常")
 		return
 	}
-	//changeDataMap := make(map[string]float64)
-	//newChangeDataList, e := HandleDataByLinearRegression(bDataList, changeDataMap)
-	//if e != nil {
-	//	err = fmt.Errorf("获取变频指标插值法Map失败, Err: %s", e.Error())
-	//	return
-	//}
-
-	// 2023-03-17 时间序列始终以指标A为基准, 始终是B进行平移
+
 	baseDataList := make([]*models.EdbDataList, 0)
 	baseDataMap := make(map[string]float64)
 	changeDataList := make([]*models.EdbDataList, 0)
 	changeDataMap := make(map[string]float64)
 
-	// 先把低频指标升频为高频
 	{
 		frequencyIntMap := map[string]int{
 			"日度": 1,
@@ -269,7 +241,6 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 			"年度": 6,
 		}
 
-		// 如果A指标是高频,那么就需要对B指标进行升频
 		if frequencyIntMap[edbInfoMappingA.Frequency] < frequencyIntMap[edbInfoMappingB.Frequency] {
 			tmpNewChangeDataList, e := HandleDataByLinearRegression(bDataList, changeDataMap)
 			if e != nil {
@@ -283,7 +254,6 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 			}
 
 		} else if frequencyIntMap[edbInfoMappingA.Frequency] > frequencyIntMap[edbInfoMappingB.Frequency] {
-			// 如果B指标是高频,那么就需要对A指标进行升频
 			tmpNewChangeDataList, e := HandleDataByLinearRegression(aDataList, baseDataMap)
 			if e != nil {
 				err = fmt.Errorf("获取变频指标插值法Map失败, Err: %s", e.Error())
@@ -308,7 +278,6 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 
 	}
 
-	// 计算不领先也不滞后时的相关系数
 	baseCalculateData := make([]float64, 0)
 	baseDataTimeArr := make([]string, 0)
 	for i := range baseDataList {
@@ -316,43 +285,17 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 		baseCalculateData = append(baseCalculateData, baseDataList[i].Value)
 	}
 
-	//zeroBaseData := make([]float64, 0)
-	//zeroCalculateData := make([]float64, 0)
-	//for i := range baseDataTimeArr {
-	//	tmpBaseVal, ok1 := baseDataMap[baseDataTimeArr[i]]
-	//	tmpCalculateVal, ok2 := changeDataMap[baseDataTimeArr[i]]
-	//	if ok1 && ok2 {
-	//		zeroBaseData = append(zeroBaseData, tmpBaseVal)
-	//		zeroCalculateData = append(zeroCalculateData, tmpCalculateVal)
-	//	}
-	//}
-	//if len(zeroBaseData) != len(zeroCalculateData) {
-	//	err = fmt.Errorf("相关系数两组序列元素数不一致, %d-%d", len(baseCalculateData), len(zeroCalculateData))
-	//	return
-	//}
-	//zeroRatio := utils.CalculateCorrelationByIntArr(zeroBaseData, zeroCalculateData)
-	//if leadValue == 0 {
-	//	yData = append(yData, zeroRatio)
-	//}
-
-	// 计算领先/滞后N期
+
 	if leadValue > 0 {
-		// 平移变频指标领先/滞后的日期(单位天)
 		moveUnitDays := utils.FrequencyDaysMap[leadUnit]
 
 		for i := range xData {
-			//if xData[i] == 0 {
-			//	yData = append(yData, zeroRatio)
-			//	continue
-			//}
 			xCalculateData := make([]float64, 0)
 			yCalculateData := make([]float64, 0)
 
-			// 平移指定天数
 			mDays := int(moveUnitDays) * xData[i]
 			_, dMap := MoveDataDaysToNewDataList(changeDataList, mDays)
 
-			// 取出对应的基准日期的值
 			for i2 := range baseDataTimeArr {
 				if yVal, ok := dMap[baseDataTimeArr[i2]]; ok {
 					xCalculateData = append(xCalculateData, baseCalculateData[i2])
@@ -360,19 +303,14 @@ func GetChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfo
 				}
 			}
 			if len(yCalculateData) <= 0 {
-				//err = fmt.Errorf("领先滞后相关系数两组序列元素数不一致, %d-%d", len(baseCalculateData), len(yCalculateData))
-				//return
-				// 领先滞后后,没有可以计算的数据了
 				continue
 			}
 
-			// 公式计算出领先/滞后频度对应点的相关性系数
 			ratio := utils.CalculateCorrelationByIntArr(xCalculateData, yCalculateData)
 			yData = append(yData, ratio)
 		}
 	}
 
-	// 图例
 	var extra data_manage.CorrelationChartInfoExtraConfig
 	legend := new(data_manage.CorrelationChartLegend)
 	if extraConfig != "" {
@@ -417,7 +355,6 @@ type RollingCorrelationChartDataResp struct {
 	DataList            []models.EdbDataList
 }
 
-// GetRollingCorrelationChartDataByEdbInfo 滚动相关性计算
 func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *models.ChartEdbInfoMapping, leadValue int, leadUnit string, calculateValue int, calculateUnit string, startDate, endDate, chartName, chartNameEn string) (dataResp RollingCorrelationChartDataResp, err error) {
 	dataResp = RollingCorrelationChartDataResp{
 		DataList:          make([]models.EdbDataList, 0),
@@ -434,14 +371,12 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 	}
 	dataList := make([]models.EdbDataList, 0)
 
-	// 计算窗口,不包含第一天
 	startDateTime, _ := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
 	startDate = startDateTime.AddDate(0, 0, 1).Format(utils.FormatDate)
 
 	baseEdbInfo := edbInfoMappingA
 	changeEdbInfo := edbInfoMappingB
 
-	// 获取时间基准指标在时间区间内的值
 	aDataList := make([]*models.EdbDataList, 0)
 	switch baseEdbInfo.EdbInfoCategoryType {
 	case 0:
@@ -453,7 +388,6 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 		return
 	}
 
-	// 获取变频指标所有日期的值, 插值法完善数据
 	bDataList := make([]*models.EdbDataList, 0)
 	switch changeEdbInfo.EdbInfoCategoryType {
 	case 0:
@@ -465,23 +399,17 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 		return
 	}
 
-	// 数据平移变频指标领先/滞后的日期(单位天)
-	// 2023-03-17 时间序列始终以指标A为基准, 始终是B进行平移
-	//baseDataList := make([]*models.EdbDataList, 0)
 	baseDataMap := make(map[string]float64)
 	changeDataList := make([]*models.EdbDataList, 0)
 	changeDataMap := make(map[string]float64)
 
-	// A指标不管三七二十一,先变个频再说
 	{
 		_, e := HandleDataByLinearRegression(aDataList, baseDataMap)
 		if e != nil {
 			err = fmt.Errorf("获取变频指标插值法Map失败, Err: %s", e.Error())
 			return
 		}
-		//baseDataList = tmpNewChangeDataList
 	}
-	// B指标不管三七二十一,先变个频再说
 	{
 		tmpNewChangeDataList, e := HandleDataByLinearRegression(bDataList, changeDataMap)
 		if e != nil {
@@ -490,15 +418,12 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 		}
 		changeDataList = tmpNewChangeDataList
 
-		// 平移下日期
 		moveUnitDays := utils.FrequencyDaysMap[leadUnit]
 		_, changeDataMap = MoveDataDaysToNewDataList(changeDataList, leadValue*moveUnitDays)
 	}
 
-	// 计算计算时,需要多少个日期内数据
 	calculateDay := utils.FrequencyDaysMap[calculateUnit] * calculateValue
 
-	// 计算 每个日期的相关性值
 	{
 		startDateTime, _ := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
 		if endDate == `` {
@@ -507,13 +432,11 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 		endDateTime, _ := time.ParseInLocation(utils.FormatDate, endDate, time.Local)
 		endDateTime = endDateTime.AddDate(0, 0, -(calculateDay - 1))
 
-		// 是否开始第一条数据
 		var isStart, isNotFirst bool
 		for currDay := startDateTime; !currDay.After(endDateTime); currDay = currDay.AddDate(0, 0, 1) {
 			yCalculateData := make([]float64, 0)
 			baseCalculateData := make([]float64, 0)
 
-			// 取出对应的基准日期的值
 			for i := 0; i < calculateDay; i++ {
 				iDay := currDay.AddDate(0, 0, i).Format(utils.FormatDate)
 
@@ -527,16 +450,13 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 				}
 			}
 
-			// 公式计算出领先/滞后频度对应点的相关性系数
 			var ratio float64
 			if len(baseCalculateData) > 0 {
 				ratio = utils.CalculateCorrelationByIntArr(baseCalculateData, yCalculateData)
 			} else {
-				// 没有数据的话,那就不返回
 				continue
 			}
 
-			// 过滤前面都是0的数据
 			{
 				if ratio != 0 {
 					isStart = true
@@ -549,7 +469,6 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 
 			dataTime := currDay.AddDate(0, 0, calculateDay-1)
 			dataList = append(dataList, models.EdbDataList{
-				//EdbDataId:     0,
 				EdbInfoId:     0,
 				DataTime:      dataTime.Format(utils.FormatDate),
 				DataTimestamp: dataTime.UnixNano() / 1e6,
@@ -575,12 +494,10 @@ func GetRollingCorrelationChartDataByEdbInfo(edbInfoMappingA, edbInfoMappingB *m
 	return
 }
 
-// GetFactorChartDataByChartId 获取多因子相关性图表数据
 func GetFactorChartDataByChartId(chartInfoId int, extraConfig string) (xEdbIdValue []int, yDataList []models.YData, err error) {
 	if chartInfoId <= 0 {
 		return
 	}
-	// 指标对应的图例
 	extra := new(data_manage.CorrelationChartInfoExtraConfig)
 	if extraConfig != "" {
 		if e := json.Unmarshal([]byte(extraConfig), extra); e != nil {
@@ -598,7 +515,6 @@ func GetFactorChartDataByChartId(chartInfoId int, extraConfig string) (xEdbIdVal
 
 	fmt.Println(chartInfoId)
 
-	// 获取图表引用到的系列指标
 	chartMappingOb := new(data_manage.FactorEdbSeriesChartMapping)
 	cond := fmt.Sprintf(" AND %s = ? AND %s = 1", chartMappingOb.Cols().ChartInfoId, chartMappingOb.Cols().EdbUsed)
 	pars := make([]interface{}, 0)
@@ -609,7 +525,6 @@ func GetFactorChartDataByChartId(chartInfoId int, extraConfig string) (xEdbIdVal
 		return
 	}
 
-	// 取出计算结果
 	yDataList = make([]models.YData, 0)
 	yDate := "0000-00-00"
 	for k, m := range chartMappings {
@@ -634,7 +549,6 @@ func GetFactorChartDataByChartId(chartInfoId int, extraConfig string) (xEdbIdVal
 		yData.SeriesEdb.SeriesId = m.FactorEdbSeriesId
 		yData.SeriesEdb.EdbInfoId = m.EdbInfoId
 
-		// 图例
 		s := fmt.Sprintf("%d-%d", m.FactorEdbSeriesId, m.EdbInfoId)
 		legend := legends[s]
 		if legend != nil {

+ 0 - 55
services/data/cross_variety/chart.go

@@ -12,7 +12,6 @@ import (
 	"time"
 )
 
-// ChartInfoResp 截面散点图数据
 type ChartInfoResp struct {
 	XName       string                         `description:"x轴名称"`
 	XNameEn     string                         `description:"x轴名称(英文)"`
@@ -29,7 +28,6 @@ type ChartInfoResp struct {
 	DataList    []SectionScatterSeriesItemResp `description:"数据列"`
 }
 
-// SectionScatterSeriesItemResp 系列的返回
 type SectionScatterSeriesItemResp struct {
 	Name                string            `description:"系列名"`
 	NameEn              string            `description:"系列名(英文)"`
@@ -37,7 +35,6 @@ type SectionScatterSeriesItemResp struct {
 	CoordinatePointData []CoordinatePoint `description:"趋势线的前后坐标点"`
 }
 
-// CoordinatePoint 坐标点
 type CoordinatePoint struct {
 	X          float64
 	Y          float64
@@ -49,17 +46,6 @@ type CoordinatePoint struct {
 	DaysAgo    int `description:"N天前的N值"`
 }
 
-// GetChartData
-// @Description: 获取跨品种分析图表数据
-// @author: Roc
-// @datetime 2023-11-24 09:42:59
-// @param chartInfoId int
-// @param config request.ChartConfigReq
-// @return edbList []*data_manage.ChartEdbInfoMapping
-// @return dataResp ChartInfoResp
-// @return err error
-// @return errMsg string
-// @return isSendEmail bool
 func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*models.ChartEdbInfoMapping, dataResp ChartInfoResp, err error, errMsg string, isSendEmail bool) {
 	moveUnitDays, ok := utils.FrequencyDaysMap[config.CalculateUnit]
 	if !ok {
@@ -71,7 +57,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 
 	isSendEmail = true
 
-	// 品种map
 	varietyMap := make(map[int]*cross_varietyModel.ChartVariety)
 	{
 		varietyList, tmpErr := cross_varietyModel.GetVarietyListByIdList(config.VarietyList)
@@ -84,7 +69,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 		}
 	}
 
-	// 标签m
 	var xTagInfo, yTagInfo *cross_varietyModel.ChartTag
 	{
 		tagList, tmpErr := cross_varietyModel.GetTagListByIdList([]int{config.TagX, config.TagY})
@@ -129,7 +113,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 		return
 	}
 
-	// 指标对应的所有数据
 	chartType := 1 //1:普通图,2:季节性图
 	calendar := "公历"
 	edbDataListMap, edbList, err := data.GetEdbDataMapList(chartInfoId, chartType, calendar, "", "", mappingList, "")
@@ -149,7 +132,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 		dateTypeMap[dateIndex] = dateConfig.DateType
 		daysAgoMap[dateIndex] = dateConfig.Num
 		for _, edbInfoMapping := range mappingList {
-			// 数据会是正序的
 			dataList, ok := edbDataListMap[edbInfoMapping.EdbInfoId]
 			if !ok {
 				continue
@@ -159,17 +141,14 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 			if lenData <= 0 {
 				continue
 			}
-			// 数据的开始索引
 			k := lenData - 1
 
-			// 数据的最晚日期
 			dataEndDateStr := dataList[k].DataTime
 			dataEndDate, tmpErr := time.ParseInLocation(utils.FormatDate, dataEndDateStr, time.Local)
 			if tmpErr != nil {
 				err = tmpErr
 				return
 			}
-			// 数据开始日期
 			endDateStr := ``
 			var endDate time.Time
 
@@ -185,7 +164,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 
 				for i := k; i >= 0; i-- {
 					tmpDateStr := dataList[i].DataTime
-					// 如果正好是这一天,那么就直接break了
 					if tmpEndDateStr == tmpDateStr {
 						k = i
 						endDateStr = tmpDateStr
@@ -198,7 +176,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 						err = tmpErr
 						return
 					}
-					// 如果这期的日期晚于选择的日期,那么继续遍历
 					if tmpDate.After(tmpEndDate) {
 						continue
 					}
@@ -224,7 +201,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 
 				for i := k; i >= 0; i-- {
 					strThisDate := dataList[i].DataTime
-					// 如果正好是这一天,那么就直接break了
 					if strFixDate == strThisDate {
 						k = i
 						endDateStr = strThisDate
@@ -232,7 +208,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 						currVal = dataList[i].Value
 						break
 					}
-					// 若固定日期无值, 则取固定日期之前, 能找到的第一个值(同上N天前的逻辑)
 					thisDate, e := time.ParseInLocation(utils.FormatDate, strThisDate, time.Local)
 					if e != nil {
 						err = fmt.Errorf("数据日期格式有误: %s", e.Error())
@@ -249,17 +224,14 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 				}
 			}
 
-			// 没有找到日期,那么就不处理
 			if endDateStr == `` || endDate.IsZero() {
 				continue
 			}
 
-			// 最早的日期
 			earliestDate := endDate.AddDate(0, 0, -config.CalculateValue*moveUnitDays)
 			earliestDateStr := earliestDate.Format(utils.FormatDate)
 
 			var percentVal float64 // 百分位计算值
-			// 百分位数据区间算法
 			if config.PercentType == utils.PercentCalculateTypeRange {
 				var minVal, maxVal float64
 				var isNotFirst bool // 是否是第一条数据
@@ -273,7 +245,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 					}
 
 					tmpDateStr := dataList[i].DataTime
-					// 如果正好是这一天,那么就直接break了
 					if earliestDateStr == tmpDateStr {
 						break
 					}
@@ -282,7 +253,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 						err = tmpErr
 						return
 					}
-					// 如果这期的日期早于选择的日期,那么继续停止遍历
 					if tmpDate.Before(earliestDate) {
 						continue
 					}
@@ -295,20 +265,14 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 					}
 				}
 
-				// 最大值等于最小值,说明计算结果无效
 				if maxVal == minVal {
 					continue
 				}
-				// 数据区间百分位=(现值-Min)/(Max-Min)
 				tmpV := (currVal - minVal) / (maxVal - minVal) * 100
 				percentVal, _ = decimal.NewFromFloat(tmpV).Round(4).Float64()
 			}
 
-			// 百分位数据个数算法
-			// 数据区间第一个和最后一个数据点的时间和数据分别为(T1,S1)(T2,S2); N=T1到T2指标数据个数, n=小于等于S2的数据个数
-			// 个数百分位=(n-1)/(N-1)
 			if config.PercentType == utils.PercentCalculateTypeNum {
-				// T1为earliestDate, T2为endDate, S2为currVal
 				var tinyN, bigN int
 				lastVal := decimal.NewFromFloat(currVal)
 				for i := k; i >= 0; i-- {
@@ -325,7 +289,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 						tinyN += 1
 					}
 				}
-				// N=1时说明计算无效
 				if bigN == 1 {
 					continue
 				}
@@ -334,14 +297,12 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 				percentVal, _ = numerator.Div(denominator).Round(4).Float64()
 			}
 
-			// key的生成(日期配置下标+指标id)
 			key := fmt.Sprint(dateIndex, "_", edbInfoMapping.EdbInfoId)
 			dataMap[key] = percentVal
 			dateMap[key] = endDateStr
 		}
 	}
 
-	// 返回数据处理
 	dataList := make([]SectionScatterSeriesItemResp, 0)
 	var xMinVal, xMaxVal, yMinVal, yMaxVal float64
 	var isNotFirst bool
@@ -413,7 +374,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 		})
 	}
 
-	// 处理颜色
 	colorMap := utils.GetColorMap()
 	for k, _ := range dataList {
 		if c, ok1 := colorMap[k]; ok1 {
@@ -436,7 +396,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 		DataList:    dataList,
 	}
 
-	// 去除返回指标中的数据信息,避免没必要的数据传输
 	for k, _ := range edbList {
 		edbList[k].DataList = nil
 	}
@@ -444,18 +403,6 @@ func GetChartData(chartInfoId int, config request.ChartConfigReq) (edbList []*mo
 	return
 }
 
-// GetXYEdbIdList
-// @Description: 根据标签id和品种获取指标列表信息
-// @author: Roc
-// @datetime 2023-11-27 14:31:23
-// @param tagX int
-// @param tagY int
-// @param varietyList []int
-// @return xVarietyEdbMap map[int]int
-// @return yVarietyEdbMap map[int]int
-// @return edbInfoIdList []int
-// @return errMsg string
-// @return err error
 func GetXYEdbIdList(tagX, tagY int, varietyList []int) (xVarietyEdbMap, yVarietyEdbMap map[int]int, edbInfoIdList []int, err error) {
 	edbInfoIdList = make([]int, 0)
 	xVarietyEdbMap = make(map[int]int)
@@ -476,11 +423,9 @@ func GetXYEdbIdList(tagX, tagY int, varietyList []int) (xVarietyEdbMap, yVariety
 		baseVarietyIdMap[v.ChartVarietyId] = v.ChartVarietyId
 	}
 
-	// 两个标签里面的品种并集
 	needVarietyIdMap := make(map[int]int)
 	for _, v := range yList {
 		if val, ok := baseVarietyIdMap[v.ChartVarietyId]; ok {
-			// 如果在 map2 中存在相同的键,则将键和值添加到结果中
 			needVarietyIdMap[v.ChartVarietyId] = val
 		}
 	}

+ 0 - 6
services/data/edb_data.go

@@ -6,11 +6,9 @@ import (
 	"time"
 )
 
-// GetEdbDataTbzForSeason 获取指标的同比值数据
 func GetEdbDataTbzForSeason(frequency string, tmpDataList []*models.EdbDataList, startDateTime time.Time) (dataList []*models.EdbDataList, minValue, maxValue float64, err error) {
 	dataList = make([]*models.EdbDataList, 0)
 
-	// 数据处理
 	var dateArr []string
 	dataMap := make(map[string]*models.EdbDataList)
 	for _, v := range tmpDataList {
@@ -19,24 +17,20 @@ func GetEdbDataTbzForSeason(frequency string, tmpDataList []*models.EdbDataList,
 	}
 	for _, av := range dateArr {
 		currentItem, ok := dataMap[av]
-		// 如果找不到当前日期的数据,那么终止当前循环,进入下一循环
 		if !ok {
 			continue
 		}
 		tmpItem := *currentItem
 		var isOk bool //是否计算出来结果
 
-		//当前日期
 		currentDate, tmpErr := time.ParseInLocation(utils.FormatDate, av, time.Local)
 		if tmpErr != nil {
 			err = tmpErr
 			return
 		}
-		// 如果存在开始日期,同时,当前日期早于开始日期,那么终止当前循环,进入下一循环
 		if !startDateTime.IsZero() && currentDate.Before(startDateTime) {
 			continue
 		}
-		//上一年的日期
 		preDate := currentDate.AddDate(-1, 0, 0)
 		preDateStr := preDate.Format(utils.FormatDate)
 		if findItem, ok := dataMap[preDateStr]; ok { //上一年同期找到

+ 0 - 200
services/data/edb_info.go

@@ -14,22 +14,14 @@ import (
 	"github.com/shopspring/decimal"
 )
 
-// EdbInfoRefreshAllFromBaseBak
-// @author Roc
-// @datetime 2022-09-16 11:04:44
-// @description 全部刷新指标(切换到edb_lib服务),将原有的单个指标刷新,调整为批量多个指标刷新
-// DeprecatedTime 2023-10-23 09:38:19废弃
-// Deprecated
 func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err error, errmsg string) {
 	defer func() {
 		if err != nil {
 			fmt.Println("EdbInfoRefreshAllFromBaseV2 Err:" + err.Error() + ";errmsg:" + errmsg)
 			go alarm_msg.SendAlarmMsg("EdbInfoRefreshFromBaseV2,Err"+err.Error()+";errMsg:"+errmsg, 3)
-			//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "EdbInfoRefreshFromBase:"+errmsg, utils.EmailSendToUsers)
 		}
 	}()
 
-	// 获取关联的基础指标
 	newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr, err, errmsg := getRefreshEdbInfoListByIds(edbInfoIdList)
 	if err != nil {
 		return
@@ -37,11 +29,7 @@ func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err err
 
 	var startDate string
 	for _, bv := range newBaseEdbInfoArr {
-		//source := bv.Source
-		//edbInfoId := bv.EdbInfoId
-		//edbCode := bv.EdbCode
 
-		//开始时间
 		startDate = utils.BaseEdbRefreshStartDate
 		if !refreshAll { //不是刷新所有数据,用结束时间减去对应期数作为起始日期去刷新
 			sDate := bv.EndDate
@@ -86,23 +74,9 @@ func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err err
 			return
 		}
 
-		//maxAndMinItem, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode)
-		//if err != nil {
-		//	if utils.IsErrNoRow() { //找不到数据,那么就进入到下一条数据做处理
-		//		continue
-		//	}
-		//	return err
-		//}
-		//if maxAndMinItem != nil {
-		//	err = data_manage.ModifyEdbInfoMaxAndMinInfo(edbInfoId, maxAndMinItem)
-		//	if err != nil {
-		//		return err
-		//	}
-		//}
 		fmt.Println("end newBaseEdbInfoArr:", bv, time.Now())
 	}
 
-	//刷新相关普通计算指标
 	for _, v := range calculateArr {
 		edbInfo := newCalculateMap[v]
 		if edbInfo == nil {
@@ -160,7 +134,6 @@ func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err err
 		}
 	}
 
-	//刷新相关预测计算指标
 	for _, v := range predictCalculateArr {
 		edbInfo := newPredictCalculateMap[v]
 		if edbInfo == nil {
@@ -218,7 +191,6 @@ func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err err
 		}
 	}
 
-	// 4、更新动态环差值
 	{
 		predictEdbInfoIdList := make([]int, 0)
 		for _, v := range newBasePredictEdbInfoArr {
@@ -249,7 +221,6 @@ func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err err
 		}
 	}
 
-	//5、刷新相关预测计算指标
 	for _, v := range predictCalculateArr {
 		edbInfo := newPredictCalculateMap[v]
 		if edbInfo == nil {
@@ -309,14 +280,12 @@ func EdbInfoRefreshAllFromBaseBak(edbInfoIdList []int, refreshAll bool) (err err
 	return
 }
 
-// getRefreshEdbInfoList 获取待更新的指标(普通基础指标、普通运算指标,预测运算指标)
 func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo, newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo, calculateArr, predictCalculateArr []int, err error, errMsg string) {
 	calculateList, err := data_manage.GetEdbInfoAllCalculateByEdbInfoIdList(edbInfoIdList)
 	if err != nil && !utils.IsErrNoRow(err) {
 		err = errors.New("GetEdbInfoAllCalculate Err:" + err.Error())
 		return
 	}
-	// 获取指标信息
 	edbInfoList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
 	if err != nil {
 		err = errors.New("GetEdbInfoAllCalGetEdbInfoByIdr:" + err.Error())
@@ -346,7 +315,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		}
 	}
 
-	// 计算指标
 	for _, v := range calculateList {
 		getBaseEdbInfoArr, getCalculateInfoArr, tmpErr := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
 		if tmpErr != nil {
@@ -369,7 +337,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 			case 0: //普通运算指标
 				calculateInfoArr = append(calculateInfoArr, tmpEdbInfo)
 			case 1: //预测运算指标
-				//predictCalculateInfoArr = append(predictCalculateInfoArr, tmpEdbInfo)
 				if tmpEdbInfo.EdbType == 1 { //预测普通指标
 					basePredictEdbInfoArr = append(basePredictEdbInfoArr, tmpEdbInfo)
 				} else {
@@ -389,7 +356,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		}
 	}
 
-	// 预测计算指标
 	for _, v := range predictCalculateInfoArr {
 		getBaseEdbInfoArr, getCalculateInfoArr, tmpErr := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
 		if tmpErr != nil {
@@ -408,7 +374,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 				} else {
 					predictCalculateInfoArr = append(predictCalculateInfoArr, tmpEdbInfo)
 				}
-				//basePredictEdbInfoArr = append(basePredictEdbInfoArr, tmpEdbInfo)
 			}
 		}
 
@@ -422,7 +387,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 				} else {
 					predictCalculateInfoArr = append(predictCalculateInfoArr, tmpEdbInfo)
 				}
-				//predictCalculateInfoArr = append(predictCalculateInfoArr, tmpEdbInfo)
 			}
 		}
 		switch v.EdbInfoType {
@@ -437,7 +401,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		}
 	}
 
-	// 第一次的计算指标map
 	newCalculateMap = make(map[int]*data_manage.EdbInfo)
 	for _, v := range calculateInfoArr {
 		if _, ok := newCalculateMap[v.EdbInfoId]; !ok {
@@ -446,7 +409,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		newCalculateMap[v.EdbInfoId] = v
 	}
 
-	// 基础预测指标
 	if len(basePredictEdbInfoArr) > 0 {
 		basePredictEdbInfoIdList := make([]int, 0)
 		for _, v := range basePredictEdbInfoArr {
@@ -464,14 +426,12 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 			case 1:
 				baseEdbInfoArr = append(baseEdbInfoArr, v)
 			case 2:
-				// 如果不在第一次里面,那么在第二次 刷新预测指标的时候 需要加进去
 				if _, ok := newCalculateMap[v.EdbInfoId]; !ok {
 					tmpCalculateList = append(tmpCalculateList, v)
 				}
 			}
 		}
 
-		// 这里是查询预测指标用到的 普通计算指标
 		for _, v := range tmpCalculateList {
 			getBaseEdbInfoArr, getCalculateInfoArr, tmpErr := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
 			if tmpErr != nil {
@@ -481,7 +441,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 				return
 			}
 
-			// 基础指标
 			for _, tmpEdbInfo := range getBaseEdbInfoArr {
 				switch tmpEdbInfo.EdbInfoType {
 				case 0: //普通基础指标
@@ -491,7 +450,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 				}
 			}
 
-			// 计算指标
 			for _, tmpEdbInfo := range getCalculateInfoArr {
 				switch tmpEdbInfo.EdbInfoType {
 				case 0: //普通运算指标
@@ -516,7 +474,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 			}
 		}
 
-		// 第二次计算指标的map
 		for _, v := range calculateInfoArr {
 			if _, ok := newCalculateMap[v.EdbInfoId]; !ok {
 				calculateArr = append(calculateArr, v.EdbInfoId)
@@ -525,7 +482,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		}
 	}
 
-	// 普通基础指标去重
 	newBaseEdbInfoArr = make([]*data_manage.EdbInfo, 0)
 	baseMap := make(map[int]int)
 	for _, v := range baseEdbInfoArr {
@@ -535,10 +491,8 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		baseMap[v.EdbInfoId] = v.EdbInfoId
 	}
 
-	// 普通计算指标的id
 	sort.Ints(calculateArr)
 
-	// 普通预测指标去重
 	newBasePredictEdbInfoArr = make([]*data_manage.EdbInfo, 0)
 	basePredictMap := make(map[int]int)
 	for _, v := range basePredictEdbInfoArr {
@@ -548,7 +502,6 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		basePredictMap[v.EdbInfoId] = v.EdbInfoId
 	}
 
-	// 预测计算指标去重
 	newPredictCalculateMap = make(map[int]*data_manage.EdbInfo)
 	for _, v := range predictCalculateInfoArr {
 		if _, ok := newPredictCalculateMap[v.EdbInfoId]; !ok {
@@ -556,21 +509,17 @@ func getRefreshEdbInfoListByIds(edbInfoIdList []int) (newBaseEdbInfoArr, newBase
 		}
 		newPredictCalculateMap[v.EdbInfoId] = v
 	}
-	// 预测计算指标的id
 	sort.Ints(predictCalculateArr)
 
 	return
 }
 
-// GetEdbSourceByEdbInfoIdList 获取关联指标的来源
 func GetEdbSourceByEdbInfoIdList(chartEdbInfoMappingList []*models.ChartEdbInfoMapping) (sourceNameList, sourceNameEnList []string) {
 	sourceNameList = make([]string, 0)
 	sourceNameEnList = make([]string, 0)
 	sourceMap := make(map[int]string)
 	for _, v := range chartEdbInfoMappingList {
-		// 指标类型:1:基础指标,2:计算指标
 		if v.EdbType == 2 || v.EdbInfoCategoryType == 1 {
-			//sourceMap[0] = "弘则研究"
 			baseEdbInfoArr, _, _ := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
 			for _, baseEdbInfo := range baseEdbInfoArr {
 				if baseEdbInfo.EdbInfoType == 0 { //普通指标才参与,预测指标不参与
@@ -594,10 +543,7 @@ func GetEdbSourceByEdbInfoIdList(chartEdbInfoMappingList []*models.ChartEdbInfoM
 		}
 		sourceNameEnList = append(sourceNameEnList, sourceNameEn)
 	}
-	//sourceNameList = append(sourceNameList, utils.ChartDefaultNameCn)
-	//sourceNameEnList = append(sourceNameEnList, utils.ChartDefaultNameEn)
 
-	// 图表来源
 	conf, e := models.GetBusinessConf()
 	if e != nil {
 		return
@@ -609,38 +555,19 @@ func GetEdbSourceByEdbInfoIdList(chartEdbInfoMappingList []*models.ChartEdbInfoM
 	return
 }
 
-// edbInfoRefreshAll
-//
-//	@Description: 指标刷新服务
-//	@author: Roc
-//	@datetime2023-10-23 11:04:30
-//	@param refreshAll bool
-//	@param newBaseEdbInfoArr []*data_manage.EdbInfo
-//	@param newBasePredictEdbInfoArr []*data_manage.EdbInfo
-//	@param newCalculateMap map[int]*data_manage.EdbInfo
-//	@param newPredictCalculateMap map[int]*data_manage.EdbInfo
-//	@param calculateArr []int
-//	@param predictCalculateArr []int
-//	@return err error
-//	@return errmsg string
 func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo, newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo, calculateArr, predictCalculateArr []int) (err error, errmsg string) {
 	defer func() {
 		if err != nil {
 			fmt.Println("EdbInfoRefreshAllFromBaseV2 Err:" + err.Error() + ";errmsg:" + errmsg)
 			go alarm_msg.SendAlarmMsg("EdbInfoRefreshFromBaseV2,Err"+err.Error()+";errMsg:"+errmsg, 3)
-			//go utils.SendEmail(utils.APPNAME+"【"+utils.RunMode+"】"+"失败提醒", "EdbInfoRefreshFromBase:"+errmsg, utils.EmailSendToUsers)
 		}
 	}()
 
 	var startDate string
 	for _, bv := range newBaseEdbInfoArr {
-		//source := bv.Source
-		//edbInfoId := bv.EdbInfoId
-		//edbCode := bv.EdbCode
 		if bv.StartDate == "0000-00-00" {
 			continue
 		}
-		//开始时间
 		startDate = utils.BaseEdbRefreshStartDate
 		if !refreshAll { // 非刷新所有数据,用结束时间减去对应期数作为起始日期去刷新
 			sDate := bv.EndDate
@@ -685,23 +612,9 @@ func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfo
 			return
 		}
 
-		//maxAndMinItem, err := data_manage.GetEdbInfoMaxAndMinInfo(source, edbCode)
-		//if err != nil {
-		//	if utils.IsErrNoRow() { //找不到数据,那么就进入到下一条数据做处理
-		//		continue
-		//	}
-		//	return err
-		//}
-		//if maxAndMinItem != nil {
-		//	err = data_manage.ModifyEdbInfoMaxAndMinInfo(edbInfoId, maxAndMinItem)
-		//	if err != nil {
-		//		return err
-		//	}
-		//}
 		fmt.Println("end newBaseEdbInfoArr:", bv, time.Now())
 	}
 
-	//刷新相关普通计算指标
 	for _, v := range calculateArr {
 		edbInfo := newCalculateMap[v]
 		if edbInfo == nil {
@@ -759,7 +672,6 @@ func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfo
 		}
 	}
 
-	//刷新相关预测计算指标
 	for _, v := range predictCalculateArr {
 		edbInfo := newPredictCalculateMap[v]
 		if edbInfo == nil {
@@ -817,7 +729,6 @@ func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfo
 		}
 	}
 
-	// 4、更新动态环差值
 	{
 		predictEdbInfoIdList := make([]int, 0)
 		for _, v := range newBasePredictEdbInfoArr {
@@ -848,7 +759,6 @@ func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfo
 		}
 	}
 
-	//5、刷新相关预测计算指标
 	for _, v := range predictCalculateArr {
 		edbInfo := newPredictCalculateMap[v]
 		if edbInfo == nil {
@@ -909,16 +819,6 @@ func edbInfoRefreshAll(refreshAll bool, newBaseEdbInfoArr, newBasePredictEdbInfo
 	return
 }
 
-// EdbInfoRefreshAllFromBaseV3
-//
-//	@Description: 全部刷新指标(切换到edb_lib服务)
-//	@author: Roc
-//	@datetime2023-10-23 09:57:55
-//	@param edbInfoIdList []int
-//	@param refreshAll bool
-//	@param isSync bool
-//	@return err error
-//	@return isAsync bool
 func EdbInfoRefreshAllFromBase(edbInfoIdList []int, refreshAll bool) (err error, errMsg string) {
 	defer func() {
 		if err != nil {
@@ -930,26 +830,21 @@ func EdbInfoRefreshAllFromBase(edbInfoIdList []int, refreshAll bool) (err error,
 	if err != nil {
 		return
 	}
-	// existEdbInfoIdMap 已经处理了的指标id map
 	existEdbInfoIdMap := make(map[int]int)
 
-	// 基础指标
 	newBaseEdbInfoArr := make([]*data_manage.EdbInfo, 0)
 	newBasePredictEdbInfoArr := make([]*data_manage.EdbInfo, 0)
 	newBaseMap := make(map[int]*data_manage.EdbInfo)
 	newPredictBaseMap := make(map[int]*data_manage.EdbInfo)
 
-	// 计算指标
 	newCalculateMap := make(map[int]*data_manage.EdbInfo)
 	newPredictCalculateMap := make(map[int]*data_manage.EdbInfo)
 	calculateArr := make([]int, 0)
 	predictCalculateArr := make([]int, 0)
 
-	// 获取关联指标
 	for _, traceEdbInfo := range traceEdbInfoList {
 		tmpBaseEdbInfoArr, tmpBasePredictEdbInfoArr, tmpCalculateMap, tmpPredictCalculateMap, _, _ := getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo, existEdbInfoIdMap)
 
-		// 普通基础指标
 		for _, edbInfo := range tmpBaseEdbInfoArr {
 			if _, ok := newBaseMap[edbInfo.EdbInfoId]; !ok {
 				if edbInfo.NoUpdate == 1 {
@@ -960,7 +855,6 @@ func EdbInfoRefreshAllFromBase(edbInfoIdList []int, refreshAll bool) (err error,
 			}
 		}
 
-		// 预测基础指标
 		for _, edbInfo := range tmpBasePredictEdbInfoArr {
 			if _, ok := newPredictBaseMap[edbInfo.EdbInfoId]; !ok {
 				newPredictBaseMap[edbInfo.EdbInfoId] = edbInfo
@@ -968,7 +862,6 @@ func EdbInfoRefreshAllFromBase(edbInfoIdList []int, refreshAll bool) (err error,
 			}
 		}
 
-		// 普通计算指标
 		for _, edbInfo := range tmpCalculateMap {
 			if _, ok := newCalculateMap[edbInfo.EdbInfoId]; !ok {
 				if edbInfo.NoUpdate == 1 {
@@ -979,7 +872,6 @@ func EdbInfoRefreshAllFromBase(edbInfoIdList []int, refreshAll bool) (err error,
 			}
 		}
 
-		// 预测计算指标
 		for _, edbInfo := range tmpPredictCalculateMap {
 			if _, ok := newPredictCalculateMap[edbInfo.EdbInfoId]; !ok {
 				newPredictCalculateMap[edbInfo.EdbInfoId] = edbInfo
@@ -988,39 +880,18 @@ func EdbInfoRefreshAllFromBase(edbInfoIdList []int, refreshAll bool) (err error,
 		}
 	}
 
-	// 普通计算指标的id
 	sort.Ints(calculateArr)
-	// 预测计算指标的id
 	sort.Ints(predictCalculateArr)
 
-	// 需要刷新的指标数量
 	totalEdbInfo := len(newBaseEdbInfoArr) + len(calculateArr) + len(predictCalculateArr) + len(newBasePredictEdbInfoArr)
 	if totalEdbInfo == 0 {
 		return
 	}
-	//if totalEdbInfo <= 20{
-	//	err,errMsg = edbInfoRefreshAll(refreshAll, newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr)
-	//} else {
-	//	go edbInfoRefreshAll(refreshAll, newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr)
-	//}
 	err, errMsg = edbInfoRefreshAll(refreshAll, newBaseEdbInfoArr, newBasePredictEdbInfoArr, newCalculateMap, newPredictCalculateMap, calculateArr, predictCalculateArr)
 
 	return
 }
 
-// getRefreshEdbInfoListByTraceEdbInfo
-//
-//	@Description: 根据溯源获取关联指标(去掉重复指标id)
-//	@author: Roc
-//	@datetime2023-10-23 11:22:50
-//	@param traceEdbInfo data_manage.TraceEdbInfoResp
-//	@param existEdbInfoIdMap map[int]int
-//	@return newBaseEdbInfoArr []*data_manage.EdbInfo
-//	@return newBasePredictEdbInfoArr []*data_manage.EdbInfo
-//	@return newCalculateMap map[int]*data_manage.EdbInfo
-//	@return newPredictCalculateMap map[int]*data_manage.EdbInfo
-//	@return calculateArr []int
-//	@return predictCalculateArr []int
 func getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo data_manage.TraceEdbInfoResp, existEdbInfoIdMap map[int]int) (newBaseEdbInfoArr, newBasePredictEdbInfoArr []*data_manage.EdbInfo, newCalculateMap, newPredictCalculateMap map[int]*data_manage.EdbInfo, calculateArr, predictCalculateArr []int) {
 	newBaseEdbInfoArr = make([]*data_manage.EdbInfo, 0)
 	newBasePredictEdbInfoArr = make([]*data_manage.EdbInfo, 0)
@@ -1037,7 +908,6 @@ func getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo data_manage.TraceEdbInfoRe
 	existEdbInfoIdMap[traceEdbInfo.EdbInfoId] = traceEdbInfo.EdbInfoId
 
 	switch traceEdbInfo.EdbInfoType {
-	//0-普通指标; 1-预测指标
 	case 0: // 0-普通指标
 		if traceEdbInfo.EdbType == 1 { //1-基础指标
 			newBaseEdbInfoArr = append(newBaseEdbInfoArr, traceEdbInfo.EdbInfo)
@@ -1077,14 +947,6 @@ func getRefreshEdbInfoListByTraceEdbInfo(traceEdbInfo data_manage.TraceEdbInfoRe
 	return
 }
 
-// TraceEdbInfoByEdbInfoIdList
-//
-//	@Description: 根据指标id列表返回指标追溯的列表
-//	@author: Roc
-//	@datetime2023-10-23 11:22:21
-//	@param edbInfoIdList []int
-//	@return traceEdbInfoList []data_manage.TraceEdbInfoResp
-//	@return err error
 func TraceEdbInfoByEdbInfoIdList(edbInfoIdList []int) (traceEdbInfoList []data_manage.TraceEdbInfoResp, err error) {
 	traceEdbInfoList = make([]data_manage.TraceEdbInfoResp, 0)
 	edbInfoList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
@@ -1099,14 +961,11 @@ func TraceEdbInfoByEdbInfoIdList(edbInfoIdList []int) (traceEdbInfoList []data_m
 
 	for _, edbInfo := range edbInfoList {
 		findIdMap[edbInfo.EdbInfoId] = edbInfo.EdbInfoId
-		//edbInfoRuleMap[edbInfoId] = getEdbRuleTitle(edbInfo)
 		traceEdbInfo := data_manage.TraceEdbInfoResp{
-			//EdbInfoId: edbInfo.EdbInfoId,
 			EdbInfoId:   edbInfo.EdbInfoId,
 			EdbInfoType: edbInfo.EdbInfoType,
 			EdbName:     edbInfo.EdbName,
 			EdbType:     edbInfo.EdbType,
-			//Source:      edbInfo.Source,
 			UniqueCode: edbInfo.UniqueCode,
 			ClassifyId: edbInfo.ClassifyId,
 			EdbInfo:    edbInfo,
@@ -1115,37 +974,9 @@ func TraceEdbInfoByEdbInfoIdList(edbInfoIdList []int) (traceEdbInfoList []data_m
 		traceEdbInfoList = append(traceEdbInfoList, traceEdbInfo)
 	}
 
-	//findEdbInfoIdList := make([]int, 0)
-	//for _, v := range findIdMap {
-	//	findEdbInfoIdList = append(findEdbInfoIdList, v)
-	//}
-	//findEdbInfoList, err := data_manage.GetEdbInfoByIdList(findEdbInfoIdList)
-	//if err != nil {
-	//	return
-	//}
-	//edbInfoMap := make(map[int]*data_manage.EdbInfo)
-	//for _, tmpEdbInfo := range findEdbInfoList {
-	//	edbInfoMap[tmpEdbInfo.EdbInfoId] = tmpEdbInfo
-	//}
-	//for k, traceEdbInfo := range traceEdbInfoList {
-	//	traceEdbInfoList[k], err = handleTraceEdbInfo(traceEdbInfo, 0, edbInfoMap, edbMappingMap)
-	//}
 	return
 }
 
-// traceEdbInfoByEdbInfoId
-//
-//	@Description: 指标追溯
-//	@author: Roc
-//	@datetime2023-10-23 11:21:54
-//	@param edbInfoId int
-//	@param traceEdbInfo data_manage.TraceEdbInfoResp
-//	@param edbInfoRuleMap map[int]string
-//	@param findIdMap map[int]int
-//	@param existMap map[int]data_manage.TraceEdbInfoResp
-//	@param edbMappingMap map[int][]*data_manage.EdbInfoCalculateMappingInfo
-//	@return child []data_manage.TraceEdbInfoResp
-//	@return err error
 func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInfoResp, edbInfoRuleMap map[int]string, findIdMap map[int]int, existMap map[int]data_manage.TraceEdbInfoResp, edbMappingMap map[int][]*data_manage.EdbInfoCalculateMappingInfo) (child []data_manage.TraceEdbInfoResp, err error) {
 	traceEdbInfo, ok := existMap[edbInfoId]
 	if ok {
@@ -1159,7 +990,6 @@ func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInf
 		return
 	}
 
-	// 指标信息map
 	edbInfoMap := make(map[int]*data_manage.EdbInfo)
 	if len(edbInfoMappingList) > 0 {
 		fromEdbInfoIdList := make([]int, 0)
@@ -1189,9 +1019,7 @@ func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInf
 			EdbInfo:     edbInfoMap[v.FromEdbInfoId],
 		}
 
-		// 计算指标/预测指标继续溯源
 		if edbInfoId != v.FromEdbInfoId && (v.FromEdbType == 2 || v.FromEdbInfoType == 1) {
-			// 查过了就不查了
 			if _, ok2 := findIdMap[tmpEdbInfoId]; !ok2 {
 				tmpTraceEdbInfo.Child, e = traceEdbInfoByEdbInfoId(tmpEdbInfoId, tmpTraceEdbInfo, edbInfoRuleMap, findIdMap, existMap, edbMappingMap)
 				if e != nil {
@@ -1207,7 +1035,6 @@ func traceEdbInfoByEdbInfoId(edbInfoId int, traceEdbInfo data_manage.TraceEdbInf
 	return
 }
 
-// GetEdbSourceByEdbInfoIdListForExcel 获取关联指标的来源
 func GetEdbSourceByEdbInfoIdListForExcel(edbInfoIdList []int) (sourceNameList, sourceNameEnList []string, err error) {
 	sourceNameList = make([]string, 0)
 	sourceNameEnList = make([]string, 0)
@@ -1218,9 +1045,7 @@ func GetEdbSourceByEdbInfoIdListForExcel(edbInfoIdList []int) (sourceNameList, s
 		return
 	}
 	for _, v := range edbInfoList {
-		// 指标类型:1:基础指标,2:计算指标
 		if v.EdbType == 2 {
-			//sourceMap[0] = "弘则研究"
 			baseEdbInfoArr, _, _ := data_manage.GetRefreshEdbInfoFromBase(v.EdbInfoId, v.Source)
 			for _, baseEdbInfo := range baseEdbInfoArr {
 				if baseEdbInfo.EdbInfoType == 0 { //普通指标才参与,预测指标不参与
@@ -1244,10 +1069,7 @@ func GetEdbSourceByEdbInfoIdListForExcel(edbInfoIdList []int) (sourceNameList, s
 		}
 		sourceNameEnList = append(sourceNameEnList, sourceNameEn)
 	}
-	//sourceNameList = append(sourceNameList, utils.ChartDefaultNameCn)
-	//sourceNameEnList = append(sourceNameEnList, utils.ChartDefaultNameEn)
 
-	// 图表来源
 	conf, e := models.GetBusinessConf()
 	if e != nil {
 		return
@@ -1259,7 +1081,6 @@ func GetEdbSourceByEdbInfoIdListForExcel(edbInfoIdList []int) (sourceNameList, s
 	return
 }
 
-// HandleDataByLinearRegressionToList 插值法补充数据(线性方程式)
 func HandleDataByLinearRegressionToList(edbInfoDataList []*models.EdbDataList, handleDataMap map[string]float64) (dataTimeList []string, valueList []float64, err error) {
 	if len(edbInfoDataList) < 2 {
 		return
@@ -1269,26 +1090,21 @@ func HandleDataByLinearRegressionToList(edbInfoDataList []*models.EdbDataList, h
 	for _, v := range edbInfoDataList {
 		handleDataMap[v.DataTime] = v.Value
 		dataTimeList = append(dataTimeList, v.DataTime)
-		// 第一个数据就给过滤了,给后面的试用
 		if startEdbInfoData == nil {
 			startEdbInfoData = v
-			//startEdbInfoData.DataTime = startEdbInfoData.DataTime[:5]+ "01-01"
 			continue
 		}
 
-		// 获取两条数据之间相差的天数
 		startDataTime, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
 		currDataTime, _ := time.ParseInLocation(utils.FormatDate, v.DataTime, time.Local)
 		betweenHour := int(currDataTime.Sub(startDataTime).Hours())
 		betweenDay := betweenHour / 24
 
-		// 如果相差一天,那么过滤
 		if betweenDay <= 1 {
 			startEdbInfoData = v
 			continue
 		}
 
-		// 生成线性方程式
 		var a, b float64
 		{
 			coordinateData := make([]utils.Coordinate, 0)
@@ -1310,7 +1126,6 @@ func HandleDataByLinearRegressionToList(edbInfoDataList []*models.EdbDataList, h
 			}
 		}
 
-		// 生成对应的值
 		{
 			for i := 1; i < betweenDay; i++ {
 				tmpDataTime := startDataTime.AddDate(0, 0, i)
@@ -1331,19 +1146,16 @@ func HandleDataByLinearRegressionToList(edbInfoDataList []*models.EdbDataList, h
 	return
 }
 
-// HandleDataByLinearRegressionToList 保证生成365个数据点的线性插值法
 func HandleDataByLinearRegressionToListV2(edbInfoDataList []*models.EdbDataList, handleDataMap map[string]float64) (dataTimeList []string, valueList []float64, err error) {
 	if len(edbInfoDataList) < 2 {
 		return
 	}
 
-	// 确保至少有两天数据来生成线性方程
 	if len(edbInfoDataList) < 2 {
 		err = errors.New("至少需要两天的数据来执行线性插值")
 		return
 	}
 
-	// 对数据按日期排序,确保顺序正确
 	sort.Slice(edbInfoDataList, func(i, j int) bool {
 		t1, _ := time.ParseInLocation(utils.FormatDate, edbInfoDataList[i].DataTime, time.Local)
 		t2, _ := time.ParseInLocation(utils.FormatDate, edbInfoDataList[j].DataTime, time.Local)
@@ -1353,21 +1165,17 @@ func HandleDataByLinearRegressionToListV2(edbInfoDataList []*models.EdbDataList,
 	startEdbInfoData := edbInfoDataList[0]
 	endEdbInfoData := edbInfoDataList[len(edbInfoDataList)-1]
 
-	// 计算起始和结束日期间实际的天数
 	startDate, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
 	endDate, _ := time.ParseInLocation(utils.FormatDate, endEdbInfoData.DataTime, time.Local)
 	actualDays := endDate.Sub(startDate).Hours() / 24
 
-	// 生成365个数据点,首先处理已有数据
 	for _, v := range edbInfoDataList {
 		handleDataMap[v.DataTime] = v.Value
 		dataTimeList = append(dataTimeList, v.DataTime)
 		valueList = append(valueList, v.Value)
 	}
 
-	// 如果已有数据跨越天数不足365天,则对缺失的日期进行线性插值
 	if actualDays < 365 {
-		// 使用已有数据点生成线性方程(这里简化处理,实际可能需更细致处理边界情况)
 		var a, b float64
 		coordinateData := []utils.Coordinate{
 			{X: 1, Y: startEdbInfoData.Value},
@@ -1379,7 +1187,6 @@ func HandleDataByLinearRegressionToListV2(edbInfoDataList []*models.EdbDataList,
 			return
 		}
 
-		// 对剩余日期进行插值
 		for i := 1; i < 365; i++ {
 			day := startDate.AddDate(0, 0, i)
 			if _, exists := handleDataMap[day.Format(utils.FormatDate)]; !exists {
@@ -1398,7 +1205,6 @@ func HandleDataByLinearRegressionToListV2(edbInfoDataList []*models.EdbDataList,
 	return
 }
 
-// HandleDataByLinearRegressionToListV3 插值法补充数据(线性方程式)-直接补充指标起始日期间的所有数据
 func HandleDataByLinearRegressionToListV3(edbInfoDataList []*models.EdbDataList, handleDataMap map[string]float64) (newEdbInfoDataList []*models.EdbDataList, dataTimeList []string, valueList []float64, err error) {
 	if len(edbInfoDataList) < 2 {
 		return
@@ -1409,26 +1215,21 @@ func HandleDataByLinearRegressionToListV3(edbInfoDataList []*models.EdbDataList,
 		handleDataMap[v.DataTime] = v.Value
 		newEdbInfoDataList = append(newEdbInfoDataList, v)
 		dataTimeList = append(dataTimeList, v.DataTime)
-		// 第一个数据就给过滤了,给后面的试用
 		if startEdbInfoData == nil {
 			startEdbInfoData = v
-			//startEdbInfoData.DataTime = startEdbInfoData.DataTime[:5]+ "01-01"
 			continue
 		}
 
-		// 获取两条数据之间相差的天数
 		startDataTime, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
 		currDataTime, _ := time.ParseInLocation(utils.FormatDate, v.DataTime, time.Local)
 		betweenHour := int(currDataTime.Sub(startDataTime).Hours())
 		betweenDay := betweenHour / 24
 
-		// 如果相差一天,那么过滤
 		if betweenDay <= 1 {
 			startEdbInfoData = v
 			continue
 		}
 
-		// 生成线性方程式
 		var a, b float64
 		{
 			coordinateData := make([]utils.Coordinate, 0)
@@ -1450,7 +1251,6 @@ func HandleDataByLinearRegressionToListV3(edbInfoDataList []*models.EdbDataList,
 			}
 		}
 
-		// 生成对应的值
 		{
 			for i := 1; i < betweenDay; i++ {
 				tmpDataTime := startDataTime.AddDate(0, 0, i)

+ 0 - 55
services/data/excel/balance_table.go

@@ -16,7 +16,6 @@ import (
 	"github.com/xuri/excelize/v2"
 )
 
-// 将表格信息转化成指标数据
 func GetBalanceExcelData(excelDetail *excel.ExcelInfo, lang string) (newDataMap map[int]map[int]request.MixedTableCellDataReq, allRows, allCols int, err error, errMsg string) {
 	var result request.MixedTableReq
 	err = json.Unmarshal([]byte(excelDetail.Content), &result)
@@ -51,9 +50,7 @@ func GetBalanceExcelData(excelDetail *excel.ExcelInfo, lang string) (newDataMap
 	return
 }
 
-// 根据chartInfoId获取单个图表信息
 func GetBalanceExcelChartSingle(chartInfoId, ChartEdbId int, lang string) (mappingListTmp []*excel.ExcelChartEdb, dataListMap map[int][]*models.EdbDataList, err error, errMsg string) {
-	// 相关联指标
 	if chartInfoId == 0 && ChartEdbId == 0 {
 		err = fmt.Errorf(" 获取图表,指标信息失败 Err:chartInfoId和ChartEdbId不能同时为空")
 		return
@@ -77,7 +74,6 @@ func GetBalanceExcelChartSingle(chartInfoId, ChartEdbId int, lang string) (mappi
 		err = fmt.Errorf(" 获取图表,指标信息失败 Err:%s", err.Error())
 		return
 	}
-	// 查询所有子表
 	excelInfoId := mappingListTmp[0].ExcelInfoId
 	excelInfo, err := excel.GetExcelInfoById(excelInfoId)
 	if err != nil {
@@ -92,7 +88,6 @@ func GetBalanceExcelChartSingle(chartInfoId, ChartEdbId int, lang string) (mappi
 	}
 	dataListMap = make(map[int][]*models.EdbDataList)
 	if excelInfo.BalanceType == 1 {
-		//查询库里是否有值
 		chartDataList, e := excel.GetExcelChartDataByChartInfoId(chartInfoId)
 		if e != nil {
 			err = fmt.Errorf(" 获取图表,指标信息失败 Err:%s", e.Error())
@@ -115,7 +110,6 @@ func GetBalanceExcelChartSingle(chartInfoId, ChartEdbId int, lang string) (mappi
 		return
 	}
 
-	// 获取图表详情
 	newExcelDataMap, excelAllRows, excelAllCols, err, errMsg := GetBalanceExcelData(excelInfo, lang)
 	if err != nil {
 		return
@@ -131,10 +125,8 @@ func GetBalanceExcelChartSingle(chartInfoId, ChartEdbId int, lang string) (mappi
 	return
 }
 
-// 将表格信息转化成指标数据
 func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTableCellDataListMap map[int]map[int]request.MixedTableCellDataReq, dataListMap map[int][]*models.EdbDataList, allRows, allCols int) (err error, errMsg string) {
 	var dateList, dataList []string
-	// 日期序列
 	{
 		_, startColumnName, endColumnName, startNum, endNum, isAll, isRow, isColumn, tmpErr := GetSheetStr(excelEdbMappingItem.DateSequence)
 		if tmpErr != nil {
@@ -144,15 +136,10 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 
 		startNum = startNum - 1
 		endNum = endNum - 1
-		// 选择行的数据
 		if isRow {
-			// 因为是选择一行的数据,所以开始行和结束行时一样的
-			//endNum = startNum - 1
 
-			// 开始列名、结束列
 			var startColumn, endColumn int
 			if isAll {
-				// 结束列(其实也就是整列的个数)
 				endColumn = allCols - 1
 			} else {
 				tmpStartColumn, tmpErr := excelize.ColumnNameToNumber(startColumnName)
@@ -172,14 +159,11 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 				endColumn = tmpEndColumn - 1
 			}
 
-			// 最大列数,如果设置的超过了最大列数,那么结束列就是最大列数
 			maxCol := allCols
 			if endColumn > maxCol {
 				endColumn = maxCol - 1
 			}
 
-			// 长度固定,避免一直申请内存空间
-			//dateList = make([]string, endColumn-startColumn+1)
 			dateList = make([]string, 0)
 			i := 0
 			for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
@@ -190,13 +174,11 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 					return
 				}
 				dateList = append(dateList, currCell.ShowValue)
-				//dateList[i] = currCell.ShowValue
 				i++
 			}
 
 		} else if isColumn { // 选择列的数据
 			if isAll {
-				// 选择一整列的话,结束行得根据实际情况调整(其实也就是整个sheet有多少行)
 				endNum = allRows - 1
 			}
 
@@ -208,13 +190,10 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 			}
 			startColumn = startColumn - 1
 
-			// 最大行数,如果设置的超过了最大行数,那么结束行就是最大行数
 			maxRow := allRows
 			if endNum > maxRow {
 				endNum = maxRow - 1
 			}
-			// 长度固定,避免一直申请内存空间
-			//dateList = make([]string, endNum-startNum+1)
 			dateList = make([]string, 0)
 			i := 0
 			for currRow := startNum; currRow <= endNum; currRow++ {
@@ -225,14 +204,12 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 					return
 				}
 				dateList = append(dateList, currCell.ShowValue)
-				//dateList[i] = currCell.ShowValue
 				i++
 			}
 		}
 
 	}
 
-	// 数据序列
 	{
 		_, startColumnName, endColumnName, startNum, endNum, isAll, isRow, isColumn, tmpErr := GetSheetStr(excelEdbMappingItem.DataSequence)
 		if tmpErr != nil {
@@ -242,12 +219,9 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 
 		startNum = startNum - 1
 		endNum = endNum - 1
-		// 选择行的数据
 		if isRow {
-			// 开始列名、结束列
 			var startColumn, endColumn int
 			if isAll {
-				// 结束列(其实也就是整列的个数)
 				endColumn = allCols - 1
 			} else {
 
@@ -268,13 +242,10 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 				endColumn = tmpEndColumn - 1
 			}
 
-			// 最大列数,如果设置的超过了最大列数,那么结束列就是最大列数
 			maxCol := allCols
 			if endColumn > maxCol {
 				endColumn = maxCol - 1
 			}
-			// 长度固定,避免一直申请内存空间
-			//dataList = make([]string, endColumn-startColumn+1)
 			dataList = make([]string, 0)
 			i := 0
 			for currColumn := startColumn; currColumn <= endColumn; currColumn++ {
@@ -285,13 +256,11 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 					return
 				}
 				dataList = append(dataList, currCell.ShowValue)
-				//dataList[i] = currCell.ShowValue
 				i++
 			}
 
 		} else if isColumn { // 选择列的数据
 			if isAll {
-				// 选择一整列的话,结束行得根据实际情况调整(其实也就是整个sheet有多少行)
 				endNum = allRows - 1
 			}
 
@@ -303,14 +272,11 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 			}
 			startColumn = startColumn - 1
 
-			// 最大行数,如果设置的超过了最大行数,那么结束行就是最大行数
 			maxRow := allRows
 			if endNum > maxRow {
 				endNum = maxRow - 1
 			}
 
-			// 长度固定,避免一直申请内存空间
-			//dataList = make([]string, endNum-startNum+1)
 			dataList = make([]string, 0)
 			i := 0
 			for currRow := startNum; currRow <= endNum; currRow++ {
@@ -321,17 +287,12 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 					return
 				}
 				dataList = append(dataList, currCell.ShowValue)
-				//dataList[i] = currCell.ShowValue
 				i++
 			}
 		}
 	}
 
-	//fmt.Println(dateList, dataList)
-	//fmt.Println("日期序列结束")
 
-	// 将excel中的日期、数据系列处理
-	//newDateList, newDataList, err, errMsg := excel2.HandleEdbSequenceVal(dateList, dataList)
 	newDateList, newDataList := dateList, dataList
 
 	newDataMap := make(map[int]float64, len(newDataList))
@@ -345,7 +306,6 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 			newDataMap[i] = val
 		}
 	}
-	//组装成excelEdbData
 	list := make([]*models.EdbDataList, 0)
 
 	for i, v := range newDateList {
@@ -353,7 +313,6 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 		if !ok {
 			continue
 		}
-		// todo 处理DataTimestamp
 		dataTime, e := time.ParseInLocation(utils.FormatDate, v, time.Local)
 		if e != nil {
 			err = errors.New("time.Parse Err:" + err.Error())
@@ -373,17 +332,7 @@ func GetBalanceExcelEdbData(excelEdbMappingItem *excel.ExcelChartEdb, newMixedTa
 	return
 }
 
-// GetSheetStr
-// @return sheetName string 用户选择的sheet名称
-// @return startColumnName string 用户选择的开始列名称
-// @return endColumnName string 用户选择的结束列名称
-// @return startNum int 用户选择的开始列单元格位置
-// @return endNum int 用户选择的结束列单元格位置
-// @return isAll bool 是否选择整行/列数据
-// @return isRow bool 是否选择行数据
-// @return isColumn bool 是否选择列数据
 func GetSheetStr(sequenceStr string) (sheetName, startColumnName, endColumnName string, startNum, endNum int, isAll, isRow, isColumn bool, err error) {
-	// 找出sheetName
 	tmpList := strings.Split(sequenceStr, "!")
 	if len(tmpList) != 2 {
 		err = errors.New("错误的公式,查找sheet异常:" + sequenceStr)
@@ -392,7 +341,6 @@ func GetSheetStr(sequenceStr string) (sheetName, startColumnName, endColumnName
 
 	sheetName = tmpList[0]
 
-	// 分离开始/结束单元格
 	tmpList = strings.Split(tmpList[1], ":")
 	if len(tmpList) != 2 {
 		err = errors.New("错误的公式,查找开始/结束单元格异常:" + sequenceStr)
@@ -416,7 +364,6 @@ func GetSheetStr(sequenceStr string) (sheetName, startColumnName, endColumnName
 	startColumnName = startList[1]
 	endColumnName = endList[1]
 
-	// 长度为2的话,那说明是整行或整列
 	if lenList == 2 {
 		isAll = true
 
@@ -438,13 +385,11 @@ func GetSheetStr(sequenceStr string) (sheetName, startColumnName, endColumnName
 			return
 		}
 
-		// 如果不能转成数字,那么就是整列
 		isColumn = true
 
 		return
 	}
 
-	// 确定行
 	startDeci, tmpErr1 := decimal.NewFromString(startList[2])
 	endDeci, tmpErr2 := decimal.NewFromString(endList[2])
 	if tmpErr1 != nil && tmpErr1 != tmpErr2 {

+ 0 - 876
services/data/excel/excel_info.go

@@ -14,7 +14,6 @@ import (
 	"time"
 )
 
-// GetFirstEdbDataList 获取第一列的数据
 func GetFirstEdbDataList(edbInfo *data_manage.EdbInfo, num int, manualDateList []string) (resultDataList []request.ManualDataReq, err error) {
 	var dataList []*models.EdbDataList
 	switch edbInfo.EdbInfoType {
@@ -28,7 +27,6 @@ func GetFirstEdbDataList(edbInfo *data_manage.EdbInfo, num int, manualDateList [
 		return
 	}
 
-	// 获取需要的期数
 	lenData := len(dataList)
 	if lenData <= 0 {
 		return
@@ -50,7 +48,6 @@ func GetFirstEdbDataList(edbInfo *data_manage.EdbInfo, num int, manualDateList [
 			return
 		}
 
-		// 遍历倒序后的日期,然后匹配在实际数据之后日期的个数
 		for _, tmpDateStr := range sortDateList {
 			tmpDate, tmpErr := time.ParseInLocation(utils.FormatDate, tmpDateStr, time.Local)
 			if tmpErr != nil {
@@ -67,7 +64,6 @@ func GetFirstEdbDataList(edbInfo *data_manage.EdbInfo, num int, manualDateList [
 
 	}
 
-	// 需要的期数减去手工数据的期数,这才是A列指标需要的数据
 	num = num - tmpManualDateNum
 	if num > lenData {
 		num = lenData
@@ -77,7 +73,6 @@ func GetFirstEdbDataList(edbInfo *data_manage.EdbInfo, num int, manualDateList [
 	for i := 1; i <= num; i++ {
 		dataTime, _ := time.ParseInLocation(utils.FormatDate, dataList[lenData-i].DataTime, time.Local)
 		dataType := 1
-		// 如果是预测指标,且当前值的日期,晚于实际日期,那么是预测值
 		if edbInfo.EdbInfoType == 1 && dataTime.After(latestDateTime) {
 			dataType = 5
 		}
@@ -94,7 +89,6 @@ func GetFirstEdbDataList(edbInfo *data_manage.EdbInfo, num int, manualDateList [
 	return
 }
 
-// GetOtherEdbDataList 获取其他列的数据
 func GetOtherEdbDataList(edbInfo *data_manage.EdbInfo, dateList []string) (resultDataList []request.ManualDataReq, err error) {
 	lenDate := len(dateList)
 	if lenDate <= 0 {
@@ -128,7 +122,6 @@ func GetOtherEdbDataList(edbInfo *data_manage.EdbInfo, dateList []string) (resul
 		return
 	}
 
-	// 获取日期内的数据(包含开始日期前一个日期,以及 结束日期后一个日期,目的为了做空日期时的 插值法兼容)
 	baseDataList := make([]*models.EdbDataList, 0)
 	var lastData *models.EdbDataList
 	var isInsert bool
@@ -144,7 +137,6 @@ func GetOtherEdbDataList(edbInfo *data_manage.EdbInfo, dateList []string) (resul
 			continue
 		}
 
-		// 如果是第一次写入数据
 		if !isInsert && lastData != nil {
 			baseDataList = append(baseDataList, lastData)
 		}
@@ -157,13 +149,11 @@ func GetOtherEdbDataList(edbInfo *data_manage.EdbInfo, dateList []string) (resul
 		isInsert = true
 	}
 
-	// 实际数据的日期map
 	realValMap := make(map[string]string)
 	for _, v := range baseDataList {
 		realValMap[v.DataTime] = v.DataTime
 	}
 
-	// 插值法处理
 	handleDataMap := make(map[string]float64)
 	err = data.HandleDataByLinearRegression(baseDataList, handleDataMap)
 	if err != nil {
@@ -171,14 +161,12 @@ func GetOtherEdbDataList(edbInfo *data_manage.EdbInfo, dateList []string) (resul
 	}
 
 	latestDateTime, _ := time.ParseInLocation(utils.FormatDate, edbInfo.LatestDate, time.Local)
-	// 对于不存在的数据做补充
 	for _, date := range sortDateList {
 		dataType := 1
 		if _, ok := realValMap[date]; !ok {
 			dataType = 2
 		} else {
 			dataTime, _ := time.ParseInLocation(utils.FormatDate, date, time.Local)
-			// 如果是预测指标,且当前值的日期,晚于实际日期,那么是预测值
 			if edbInfo.EdbInfoType == 1 && dataTime.After(latestDateTime) {
 				dataType = 5
 			}
@@ -201,7 +189,6 @@ func GetOtherEdbDataList(edbInfo *data_manage.EdbInfo, dateList []string) (resul
 	return
 }
 
-// GetFirstHistoryEdbDataList 获取指标的历史的数据
 func GetFirstHistoryEdbDataList(edbInfo *data_manage.EdbInfo, num int, endDate string) (resultDataList []request.ManualDataReq, err error) {
 	endDateTime, err := time.ParseInLocation(utils.FormatDate, endDate, time.Local)
 	if err != nil {
@@ -220,7 +207,6 @@ func GetFirstHistoryEdbDataList(edbInfo *data_manage.EdbInfo, num int, endDate s
 		return
 	}
 
-	// 获取需要的期数
 	lenData := len(dataList)
 	if lenData <= 0 {
 		return
@@ -242,7 +228,6 @@ func GetFirstHistoryEdbDataList(edbInfo *data_manage.EdbInfo, num int, endDate s
 	for i := 1; i <= num; i++ {
 		dataTime, _ := time.ParseInLocation(utils.FormatDate, dataList[lenData-i].DataTime, time.Local)
 		dataType := 1
-		// 如果是预测指标,且当前值的日期,晚于实际日期,那么是预测值
 		if edbInfo.EdbInfoType == 1 && dataTime.After(latestDateTime) {
 			dataType = 5
 		}
@@ -258,870 +243,9 @@ func GetFirstHistoryEdbDataList(edbInfo *data_manage.EdbInfo, num int, endDate s
 	return
 }
 
-//type TableDataConfig struct {
-//	EdbInfoIdList    []int                     `description:"指标id列表,从左至右,从上到下的顺序"`
-//	Sort             int                       `description:"日期排序,0:倒序,1:正序"`
-//	Data             []ManualData              `description:"数据列表"`
-//	Num              int                       `description:"实际数据需要列出来的期数"`
-//	RemoveDate       []string                  `description:"不展示的日期"`
-//	ManualDate       []string                  `description:"手动配置的日期(未来的日期)"`
-//	TableEdbInfoList []TableEdbInfo            `description:"表格内指标信息"`
-//	TextRowData      [][]request.ManualDataReq `description:"文本列表"`
-//}
-//
-//type TableEdbInfo struct {
-//	EdbInfoId    int    `description:"指标ID"`
-//	Tag          string `description:"标签"`
-//	EdbName      string `description:"指标名称"`
-//	EdbAliasName string `description:"指标别名"`
-//	Frequency    string `description:"频度"`
-//	Unit         string `description:"单位"`
-//}
-//
-//type ManualData struct {
-//	DataType            int                       `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算"`
-//	DataTime            string                    `description:"所属日期"`
-//	DataTimeType        int                       `description:"日期类型,1:实际日期;2:未来日期"`
-//	ShowValue           string                    `description:"展示值"`
-//	Value               string                    `description:"实际值(计算公式)"`
-//	EdbInfoId           int                       `description:"指标id"`
-//	Tag                 string                    `description:"下标"`
-//	RelationEdbInfoList []request.RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
-//}
-//
-//func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableDataConfig, err error) {
-//	// 指标数据
-//	tableDataConfig.EdbInfoIdList = reqData.EdbInfoIdList
-//	tableDataConfig.Sort = reqData.Sort
-//
-//	// 开始日期
-//	var startDate string
-//	// A列的指标id
-//	var firstEdbInfoId int
-//	// 手工操作的数据列
-//	manualDataList := make([]ManualData, 0)
-//	// 指标配置列表
-//	tableEdbInfoList := make([]TableEdbInfo, 0)
-//
-//	// 第一列的日期map
-//	firstDateMap := make(map[string]string)
-//	manualDateMap := make(map[string]string)
-//
-//	for _, v := range reqData.Data {
-//		// 指标信息
-//		tmpTableEdbInfo := TableEdbInfo{
-//			EdbInfoId:    v.EdbInfoId,
-//			Tag:          v.Tag,
-//			EdbName:      v.EdbName,
-//			EdbAliasName: v.EdbAliasName,
-//			Frequency:    v.Frequency,
-//			Unit:         v.Unit,
-//		}
-//		tableEdbInfoList = append(tableEdbInfoList, tmpTableEdbInfo)
-//
-//		// 确定数据A列
-//		if v.Tag == "A" {
-//			firstEdbInfoId = v.EdbInfoId
-//			lenData := len(v.Data)
-//			if lenData <= 0 {
-//				err = errors.New("A列不能为空")
-//				return
-//			}
-//			index := 0
-//			if reqData.Sort == 1 {
-//				// 倒序
-//				index = lenData - 1
-//			}
-//
-//			startDate = v.Data[index].DataTime
-//
-//			// 存在的日期列表
-//			for _, data := range v.Data {
-//				firstDateMap[data.DataTime] = data.DataTime
-//
-//				if data.DataTimeType == 2 {
-//					manualDateMap[data.DataTime] = data.DataTime
-//				}
-//			}
-//		}
-//
-//		for _, data := range v.Data {
-//			if data.DataType == 3 || data.DataType == 4 {
-//				tmpManualData := ManualData{
-//					DataType:            data.DataType,
-//					DataTime:            data.DataTime,
-//					DataTimeType:        data.DataTimeType,
-//					ShowValue:           data.ShowValue,
-//					Value:               data.Value,
-//					EdbInfoId:           v.EdbInfoId,
-//					Tag:                 v.Tag,
-//					RelationEdbInfoList: data.RelationEdbInfoList,
-//				}
-//				if data.DataType == 4 {
-//					tmpManualData.ShowValue = ``
-//				}
-//				manualDataList = append(manualDataList, tmpManualData)
-//			}
-//		}
-//	}
-//
-//	// 实际期数
-//	var num int
-//	removeDate := make([]string, 0)
-//
-//	// 获取期数
-//	{
-//		firstDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
-//		if tmpErr != nil {
-//			err = tmpErr
-//			return
-//		}
-//
-//		edbInfo, tmpErr := data_manage.GetEdbInfoById(firstEdbInfoId)
-//		if tmpErr != nil {
-//			err = tmpErr
-//			return
-//		}
-//
-//		var firstDataList []*models.EdbDataList
-//		switch edbInfo.EdbInfoType {
-//		case 0:
-//			firstDataList, err = models.GetEdbDataList(edbInfo.Source, edbInfo.SubSource, edbInfo.EdbInfoId, ``, ``)
-//		case 1:
-//			_, firstDataList, _, _, err, _ = data.GetPredictDataListByPredictEdbInfoId(edbInfo.EdbInfoId, ``, ``, false)
-//		default:
-//			err = errors.New(fmt.Sprint("获取失败,指标类型异常", edbInfo.EdbInfoType))
-//			return
-//		}
-//
-//		// 获取日期内的数据(包含开始日期前一个日期,以及 结束日期后一个日期,目的为了做空日期时的 插值法兼容)
-//		baseDataList := make([]*models.EdbDataList, 0)
-//		for _, data := range firstDataList {
-//			tmpDate := data.DataTime
-//			tmpDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, tmpDate, time.Local)
-//			if tmpErr != nil {
-//				err = tmpErr
-//				return
-//			}
-//			if tmpDateTime.Before(firstDateTime) {
-//				continue
-//			}
-//			baseDataList = append(baseDataList, data)
-//		}
-//
-//		// 开始日期到现在的实际期数
-//		num = len(baseDataList)
-//
-//		// 筛选出需要删除的日期
-//		for _, tmpData := range baseDataList {
-//			//firstDateMap{}
-//			if _, ok := firstDateMap[tmpData.DataTime]; !ok {
-//				removeDate = append(removeDate, tmpData.DataTime)
-//			}
-//		}
-//	}
-//
-//	tableDataConfig.Num = num
-//	tableDataConfig.RemoveDate = removeDate
-//	tableDataConfig.Data = manualDataList
-//	tableDataConfig.TableEdbInfoList = tableEdbInfoList
-//	tableDataConfig.TextRowData = reqData.TextRowData
-//
-//	return
-//}
-//
-//func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp request.TableDataReq, err error) {
-//	// 没有选择指标的情况下,直接返回吧
-//	if len(tableDataConfig.EdbInfoIdList) <= 0 {
-//		return
-//	}
-//
-//	// 实际期数没有的情况下,直接返回吧
-//	if tableDataConfig.Num <= 0 {
-//		return
-//	}
-//
-//	// 获取所有的指标信息
-//	edbInfoMap := make(map[int]*data_manage.EdbInfo)
-//	edbInfoIdList := make([]int, 0)
-//	// 标签与指标id的map
-//	tagEdbInfoIdMap := make(map[string]int)
-//	{
-//		for _, tableEdbInfo := range tableDataConfig.TableEdbInfoList {
-//			edbInfoIdList = append(edbInfoIdList, tableEdbInfo.EdbInfoId)
-//			tagEdbInfoIdMap[tableEdbInfo.Tag] = tableEdbInfo.EdbInfoId
-//		}
-//		edbInfoList, tmpErr := data_manage.GetEdbInfoByIdList(edbInfoIdList)
-//		if tmpErr != nil {
-//			err = tmpErr
-//			return
-//		}
-//		for _, v := range edbInfoList {
-//			edbInfoMap[v.EdbInfoId] = v
-//		}
-//	}
-//
-//	manualDateMap := make(map[string]string, 0)
-//	manualDateList := make([]string, 0)
-//	for _, v := range tableDataConfig.Data {
-//		if _, ok := manualDateMap[v.DataTime]; !ok {
-//			manualDateMap[v.DataTime] = v.DataTime
-//			manualDateList = append(manualDateList, v.DataTime)
-//		}
-//	}
-//
-//	// 寻找A列的数据列表
-//	firstEdbInfo, ok := edbInfoMap[tableDataConfig.TableEdbInfoList[0].EdbInfoId]
-//	if !ok {
-//		err = errors.New("找不到A列指标")
-//		return
-//	}
-//	baseFirstEdbInfoDataList, err := GetFirstEdbDataList(firstEdbInfo, tableDataConfig.Num, manualDateList)
-//	if err != nil {
-//		return
-//	}
-//	// A列找不到数据,那么就直接返回吧
-//	if len(baseFirstEdbInfoDataList) <= 0 {
-//		return
-//	}
-//
-//	firstEdbInfoDataList := make([]request.ManualDataReq, 0)
-//	if tableDataConfig.RemoveDate != nil && len(tableDataConfig.RemoveDate) > 0 {
-//		for _, v := range baseFirstEdbInfoDataList {
-//			if utils.InArrayByStr(tableDataConfig.RemoveDate, v.DataTime) {
-//				continue
-//			}
-//			firstEdbInfoDataList = append(firstEdbInfoDataList, v)
-//		}
-//	} else {
-//		firstEdbInfoDataList = baseFirstEdbInfoDataList
-//	}
-//	if len(firstEdbInfoDataList) <= 0 {
-//		return
-//	}
-//	// 实际数据的最后一天
-//	lastRealDateTime, err := time.ParseInLocation(utils.FormatDate, firstEdbInfoDataList[0].DataTime, time.Local)
-//	if err != nil {
-//		return
-//	}
-//
-//	dateMap := make(map[string]string)
-//	dateList := make([]string, 0)
-//	edbInfoIdDateDataMap := make(map[int]map[string]request.ManualDataReq)
-//	firstDateDataMap := make(map[string]request.ManualDataReq)
-//	for _, v := range firstEdbInfoDataList {
-//		dateList = append(dateList, v.DataTime)
-//		dateMap[v.DataTime] = v.DataTime
-//		firstDateDataMap[v.DataTime] = v
-//	}
-//
-//	// 将手工数据的日期填补进去(未来的日期,过去的就不管了)
-//	for _, manualData := range tableDataConfig.Data {
-//		if !utils.InArrayByStr(dateList, manualData.DataTime) {
-//			tmpDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, manualData.DataTime, time.Local)
-//			if tmpErr != nil {
-//				err = tmpErr
-//				return
-//			}
-//			if tmpDateTime.After(lastRealDateTime) {
-//				dateList = append(dateList, manualData.DataTime)
-//			}
-//		}
-//	}
-//
-//	edbInfoIdDateDataMap[firstEdbInfo.EdbInfoId] = firstDateDataMap
-//
-//	for k, edbInfoId := range tableDataConfig.EdbInfoIdList {
-//		if k == 0 {
-//			continue
-//		}
-//
-//		tmpEdbInfo, ok := edbInfoMap[edbInfoId]
-//		if !ok {
-//			err = errors.New("找不到A列指标")
-//			return
-//		}
-//		otherDataList, tmpErr := GetOtherEdbDataList(tmpEdbInfo, dateList)
-//		if tmpErr != nil {
-//			err = tmpErr
-//			return
-//		}
-//
-//		tmpDateDataMap := make(map[string]request.ManualDataReq)
-//		for _, v := range otherDataList {
-//			tmpDateDataMap[v.DataTime] = v
-//		}
-//		edbInfoIdDateDataMap[tmpEdbInfo.EdbInfoId] = tmpDateDataMap
-//	}
-//
-//	for _, v := range tableDataConfig.Data {
-//		tmpDate := v.DataTime
-//		if _, ok := dateMap[tmpDate]; !ok {
-//			dateMap[v.DataTime] = tmpDate
-//		}
-//
-//		edbInfoIdDateData, ok := edbInfoIdDateDataMap[v.EdbInfoId]
-//		if !ok {
-//			edbInfoIdDateData = make(map[string]request.ManualDataReq)
-//		}
-//
-//		// 判断是否存在该日期的数据(不存在,那么插入数据吧,存在就不管了)
-//		if _, ok = edbInfoIdDateData[tmpDate]; !ok {
-//			edbInfoIdDateData[tmpDate] = request.ManualDataReq{
-//				DataType:  v.DataType,
-//				DataTime:  v.DataTime,
-//				ShowValue: v.ShowValue,
-//				Value:     v.Value,
-//			}
-//		}
-//		edbInfoIdDateDataMap[v.EdbInfoId] = edbInfoIdDateData
-//	}
-//
-//	// 获取数据的日期排序
-//	sortDateTimeList := make([]time.Time, 0)
-//	{
-//		sortDateList := dateList
-//		if tableDataConfig.Sort == 1 {
-//			baseDateList := utils.StrArr{}
-//			baseDateList = append(baseDateList, sortDateList...)
-//			sort.Sort(baseDateList)
-//			sortDateList = append([]string{}, baseDateList...)
-//		} else {
-//			sort.Strings(sortDateList)
-//		}
-//		for _, v := range sortDateList {
-//			tmpDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, v, time.Local)
-//			if tmpErr != nil {
-//				err = tmpErr
-//				return
-//			}
-//			sortDateTimeList = append(sortDateTimeList, tmpDateTime)
-//		}
-//	}
-//
-//	// 数据处理,处理成表格的数据格式
-//	tableDataMap, textRowListDataResp := handleTable(tagEdbInfoIdMap, lastRealDateTime, sortDateTimeList, edbInfoIdDateDataMap, tableDataConfig.Data, tableDataConfig.TextRowData)
-//
-//	data := make([]request.EdbInfoData, 0)
-//	for _, tableEdbInfo := range tableDataConfig.TableEdbInfoList {
-//		tagEdbInfoIdMap[tableEdbInfo.Tag] = tableEdbInfo.EdbInfoId
-//
-//		manualDataReqList := make([]request.ManualDataReq, 0)
-//		tmpEdbInfoData := request.EdbInfoData{
-//			EdbInfoId:    tableEdbInfo.EdbInfoId,
-//			Tag:          tableEdbInfo.Tag,
-//			EdbName:      tableEdbInfo.EdbName,
-//			EdbAliasName: tableEdbInfo.EdbAliasName,
-//			Frequency:    tableEdbInfo.Frequency,
-//			Unit:         tableEdbInfo.Unit,
-//			Data:         manualDataReqList,
-//		}
-//
-//		edbInfo, ok := edbInfoMap[tableEdbInfo.EdbInfoId]
-//		if ok {
-//			tmpEdbInfoData.EdbName = edbInfo.EdbName
-//			tmpEdbInfoData.Frequency = edbInfo.Frequency
-//			tmpEdbInfoData.Unit = edbInfo.Unit
-//		}
-//
-//		for index, dateTime := range sortDateTimeList {
-//			dataTimeType := 1
-//			if dateTime.After(lastRealDateTime) {
-//				dataTimeType = 2
-//			}
-//			tmpDateTimeStr := dateTime.Format(utils.FormatDate)
-//
-//			rowData, ok := tableDataMap[index+1]
-//			if !ok {
-//				manualDataReqList = append(manualDataReqList, request.ManualDataReq{
-//					DataType:            3,
-//					DataTime:            tmpDateTimeStr,
-//					DataTimeType:        dataTimeType,
-//					ShowValue:           "",
-//					Value:               "",
-//					RelationEdbInfoList: nil,
-//				})
-//				continue
-//			}
-//
-//			tmpData, ok := rowData[tableEdbInfo.Tag]
-//			if !ok {
-//				manualDataReqList = append(manualDataReqList, request.ManualDataReq{
-//					DataType:            3,
-//					DataTime:            tmpDateTimeStr,
-//					DataTimeType:        dataTimeType,
-//					ShowValue:           "",
-//					Value:               "",
-//					RelationEdbInfoList: nil,
-//				})
-//				continue
-//			}
-//
-//			tmpData.DataTimeType = dataTimeType
-//			manualDataReqList = append(manualDataReqList, tmpData)
-//		}
-//
-//		tmpEdbInfoData.Data = manualDataReqList
-//
-//		data = append(data, tmpEdbInfoData)
-//	}
-//
-//	resultResp = request.TableDataReq{
-//		EdbInfoIdList: edbInfoIdList,
-//		Sort:          tableDataConfig.Sort,
-//		TextRowData:   textRowListDataResp,
-//		Data:          data,
-//	}
-//
-//	return
-//}
-//
-//func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sortDateTimeList []time.Time, edbInfoIdDateDataMap map[int]map[string]request.ManualDataReq, manualDataList []ManualData, textRowData [][]request.ManualDataReq) (tableDataMap map[int]map[string]request.ManualDataReq, textRowListDataResp [][]request.ManualDataReq) {
-//	tagList := make([]string, 0)
-//	for tag := range tagEdbInfoIdMap {
-//		tagList = append(tagList, tag)
-//	}
-//	sort.Strings(tagList)
-//
-//	tableDataMap = make(map[int]map[string]request.ManualDataReq) //行、列数据
-//
-//	// 日期与行的关系
-//	dateIndexMap := make(map[string]int)
-//
-//	for k, dateTime := range sortDateTimeList {
-//		rowDataMap := make(map[string]request.ManualDataReq)
-//
-//		dataTimeType := 1
-//		if dateTime.After(lastRealDateTime) {
-//			dataTimeType = 2
-//		}
-//
-//		tmpDateTimeStr := dateTime.Format(utils.FormatDate)
-//		dateIndexMap[tmpDateTimeStr] = k + 1
-//
-//		for _, tag := range tagList {
-//			edbInfoId, ok := tagEdbInfoIdMap[tag]
-//			if !ok { // 没有找到该指标的映射关系,那么就用空串填补
-//				rowDataMap[tag] = request.ManualDataReq{
-//					DataType:            3,
-//					DataTime:            tmpDateTimeStr,
-//					DataTimeType:        dataTimeType,
-//					ShowValue:           "",
-//					Value:               "",
-//					RelationEdbInfoList: nil,
-//				}
-//				continue
-//			}
-//
-//			// 获取指标的数据map
-//			dateDataMap, ok := edbInfoIdDateDataMap[edbInfoId]
-//			if !ok { // 没有找到该指标的数据,那么就用空串填补
-//				rowDataMap[tag] = request.ManualDataReq{
-//					DataType:            3,
-//					DataTime:            tmpDateTimeStr,
-//					DataTimeType:        dataTimeType,
-//					ShowValue:           "",
-//					Value:               "",
-//					RelationEdbInfoList: nil,
-//				}
-//				continue
-//			}
-//
-//			// 获取指标该日期的数据
-//			tmpData, ok := dateDataMap[tmpDateTimeStr]
-//			if !ok { // 该指标没有找到对应日期的数据,那么就用空串填补
-//				rowDataMap[tag] = request.ManualDataReq{
-//					DataType:            3,
-//					DataTime:            tmpDateTimeStr,
-//					DataTimeType:        dataTimeType,
-//					ShowValue:           "",
-//					Value:               "",
-//					RelationEdbInfoList: nil,
-//				}
-//				continue
-//			}
-//			tmpData.DataTimeType = dataTimeType
-//			rowDataMap[tag] = tmpData
-//		}
-//		tableDataMap[k+1] = rowDataMap
-//	}
-//
-//	// 替换手工设置的数据
-//	for _, manualData := range manualDataList {
-//		// 找不到该日期,说明这日期过期了,不处理
-//		index, ok := dateIndexMap[manualData.DataTime]
-//		if !ok {
-//			continue
-//		}
-//
-//		// 获取对应行的数据
-//		rowDataMap, ok := tableDataMap[index]
-//		if !ok {
-//			continue
-//		}
-//
-//		// 找到对应的单元格
-//		tmpData, ok := rowDataMap[manualData.Tag]
-//		if !ok {
-//			continue
-//		}
-//
-//		// 如果该单元格实际有数据(包含预测值),或者插值法补充了数据的话,那么就不用手动填入的数据
-//		if utils.InArrayByInt([]int{1, 2, 5}, tmpData.DataType) {
-//			continue
-//		}
-//
-//		// 手工填写的数字
-//		if tmpData.DataType == 3 {
-//			tmpData.ShowValue = manualData.ShowValue
-//			tmpData.Value = manualData.Value
-//			tableDataMap[index][manualData.Tag] = tmpData
-//
-//			//edbInfoIdDateDataMap[manualData.EdbInfoId][manualData.DataTime] = tmpData
-//			continue
-//		}
-//
-//		// 公式
-//		tmpData.DataType = manualData.DataType
-//		tmpData.ShowValue = ``
-//		tmpData.Value = manualData.Value
-//		tmpData.RelationEdbInfoList = manualData.RelationEdbInfoList
-//		tableDataMap[index][manualData.Tag] = tmpData
-//
-//	}
-//
-//	// 文本行的列表插入
-//	lenTableData := len(tableDataMap)
-//
-//	// 文本行第一列的数据列表(可能多行)
-//	firstColTextRowList := make([]request.ManualDataReq, 0)
-//	// 参与计算的文本行列表数据
-//	tmpTextRowList := make([][]request.ManualDataReq, 0)
-//	for k, textRowList := range textRowData {
-//		// 判断列数是否匹配,不匹配的话那么过滤
-//		if len(tagList)+1 != len(textRowList) {
-//			continue
-//		}
-//		rowDataMap := make(map[string]request.ManualDataReq)
-//		tmpTextRow := make([]request.ManualDataReq, 0)
-//		for index, textRow := range textRowList {
-//			// 移除第一列,因为第一列是日期列
-//			if index == 0 {
-//				firstColTextRowList = append(firstColTextRowList, textRow)
-//				continue
-//			}
-//			rowDataMap[tagList[index-1]] = textRow
-//			tmpTextRow = append(tmpTextRow, textRow)
-//		}
-//
-//		tableDataMap[lenTableData+k+1] = rowDataMap
-//		tmpTextRowList = append(tmpTextRowList, tmpTextRow)
-//	}
-//
-//	// 参与计算的单元格
-//	calculateCellMap := make(map[string]string)
-//
-//	// 计算手工填写的单元格
-//	for _, manualData := range manualDataList {
-//		// 找不到该日期,说明这日期过期了,不处理
-//		index, ok := dateIndexMap[manualData.DataTime]
-//		if !ok {
-//			continue
-//		}
-//
-//		// 获取对应行的数据
-//		rowDataMap, ok := tableDataMap[index]
-//		if !ok {
-//			continue
-//		}
-//
-//		// 找到对应的单元格
-//		colData, ok := rowDataMap[manualData.Tag]
-//		if !ok {
-//			continue
-//		}
-//
-//		// 如果该单元格不是计算公式的单元格,那么直接退出当前循环即可
-//		if colData.DataType != 4 {
-//			continue
-//		}
-//
-//		tagMap := make(map[string]float64)
-//		lenRelation := len(colData.RelationEdbInfoList)
-//		replaceNum := 0
-//		for _, relation := range colData.RelationEdbInfoList {
-//			relationCellTagName := strings.ToUpper(relation.Tag) + relation.Row
-//			valStr, tmpErr := getCalculateValue(tableDataMap, relation.Tag, relation.Row, calculateCellMap)
-//			if tmpErr != nil {
-//				continue
-//			}
-//			tmpValDecimal, tmpErr := decimal.NewFromString(valStr)
-//			if tmpErr != nil {
-//				continue
-//			}
-//			tagMap[relationCellTagName], _ = tmpValDecimal.Float64()
-//			replaceNum++
-//		}
-//
-//		// 如果替换的数据与关联的不一致,那么就退出当前循环
-//		if lenRelation != replaceNum {
-//			continue
-//		}
-//
-//		// 计算
-//		val, _, err := calculate(strings.ToUpper(colData.Value), tagMap)
-//		// 计算失败,退出循环
-//		if err != nil {
-//			continue
-//		}
-//		// 重新赋值
-//		colData.ShowValue = val
-//		tableDataMap[index][manualData.Tag] = colData
-//
-//	}
-//
-//	// 计算文本行的单元格
-//	for k, textRow := range tmpTextRowList {
-//		// 获取对应行的数据
-//		index := lenTableData + k + 1
-//		rowDataMap, ok := tableDataMap[index]
-//		if !ok {
-//			continue
-//		}
-//
-//		for colIndex := range textRow {
-//			currTag := tagList[colIndex]
-//			// 找到对应的单元格
-//			colData, ok := rowDataMap[currTag]
-//			if !ok {
-//				continue
-//			}
-//
-//			// 如果该单元格不是计算公式的单元格,那么直接退出当前循环即可
-//			if colData.DataType != 4 {
-//				continue
-//			}
-//
-//			tagMap := make(map[string]float64)
-//			lenRelation := len(colData.RelationEdbInfoList)
-//			replaceNum := 0
-//			for _, relation := range colData.RelationEdbInfoList {
-//				relationCellTagName := strings.ToUpper(relation.Tag) + relation.Row
-//				valStr, tmpErr := getCalculateValue(tableDataMap, relation.Tag, relation.Row, calculateCellMap)
-//				if tmpErr != nil {
-//					continue
-//				}
-//				tmpValDecimal, tmpErr := decimal.NewFromString(valStr)
-//				if tmpErr != nil {
-//					continue
-//				}
-//				tagMap[relationCellTagName], _ = tmpValDecimal.Float64()
-//				replaceNum++
-//			}
-//
-//			// 如果替换的数据与关联的不一致,那么就退出当前循环
-//			if lenRelation != replaceNum {
-//				continue
-//			}
-//
-//			// 计算
-//			val, _, err := calculate(strings.ToUpper(colData.Value), tagMap)
-//			// 计算失败,退出循环
-//			if err != nil {
-//				continue
-//			}
-//			// 重新赋值
-//			colData.ShowValue = val
-//			tableDataMap[index][currTag] = colData
-//		}
-//
-//	}
-//
-//	// 计算文本行第一列的数据值(多行)
-//	for k, colData := range firstColTextRowList {
-//		// 如果该单元格不是计算公式的单元格,那么直接退出当前循环即可
-//		if colData.DataType != 4 {
-//			continue
-//		}
-//
-//		tagMap := make(map[string]float64)
-//		lenRelation := len(colData.RelationEdbInfoList)
-//		replaceNum := 0
-//		for _, relation := range colData.RelationEdbInfoList {
-//			relationCellTagName := strings.ToUpper(relation.Tag) + relation.Row
-//			valStr, tmpErr := getCalculateValue(tableDataMap, relation.Tag, relation.Row, calculateCellMap)
-//			if tmpErr != nil {
-//				continue
-//			}
-//			tmpValDecimal, tmpErr := decimal.NewFromString(valStr)
-//			if tmpErr != nil {
-//				continue
-//			}
-//			tagMap[relationCellTagName], _ = tmpValDecimal.Float64()
-//			replaceNum++
-//		}
-//
-//		// 如果替换的数据与关联的不一致,那么就退出当前循环
-//		if lenRelation != replaceNum {
-//			continue
-//		}
-//
-//		// 计算
-//		val, _, err := calculate(strings.ToUpper(colData.Value), tagMap)
-//		// 计算失败,退出循环
-//		if err != nil {
-//			continue
-//		}
-//		// 重新赋值
-//		colData.ShowValue = val
-//		firstColTextRowList[k] = colData
-//	}
-//
-//	{
-//		// 文本行的数据处理返回
-//		textRowListDataResp = make([][]request.ManualDataReq, 0)
-//		newLenTableDataMap := len(tableDataMap)
-//		// 文本行的第一行所在的位置
-//		firstTextRow := lenTableData + 1
-//		for i := firstTextRow; i <= newLenTableDataMap; i++ {
-//			textRowDataResp := make([]request.ManualDataReq, 0)
-//
-//			textRowDataResp = append(textRowDataResp, firstColTextRowList[i-firstTextRow])
-//			for _, tmpTag := range tagList {
-//				textRowDataResp = append(textRowDataResp, tableDataMap[i][tmpTag])
-//			}
-//			textRowListDataResp = append(textRowListDataResp, textRowDataResp)
-//		}
-//
-//	}
-//
-//	return
-//}
-//
-//// getCalculateValue 获取公式计算的结果
-//func getCalculateValue(tableDataMap map[int]map[string]request.ManualDataReq, tag, row string, calculateCellMap map[string]string) (val string, err error) {
-//	rowInt, err := strconv.Atoi(row)
-//	if err != nil {
-//		return
-//	}
-//
-//	// 单元格的标签名
-//	cellTagName := strings.ToUpper(tag) + row
-//	val, ok := calculateCellMap[cellTagName]
-//	if ok {
-//		return
-//	}
-//
-//	// 查找行数据
-//	rowData, ok := tableDataMap[rowInt]
-//	if !ok {
-//		err = errors.New("查找" + row + "行的数据失败")
-//		return
-//	}
-//
-//	// 查找单元格数据
-//	colData, ok := rowData[tag]
-//	if !ok {
-//		err = errors.New("查找单元格" + tag + row + "的数据失败")
-//		return
-//	}
-//
-//	// 如果不是计算单元格
-//	if colData.DataType != 4 {
-//		val = colData.ShowValue
-//		return
-//	}
-//
-//	// 如果是计算单元格
-//	calculateCellMap[cellTagName] = ``
-//
-//	tagMap := make(map[string]float64)
-//	for _, relation := range colData.RelationEdbInfoList {
-//		relationCellTagName := strings.ToUpper(relation.Tag) + relation.Row
-//		valStr, tmpErr := getCalculateValue(tableDataMap, relation.Tag, relation.Row, calculateCellMap)
-//		if tmpErr != nil {
-//			err = tmpErr
-//			return
-//		}
-//		tmpValDecimal, tmpErr := decimal.NewFromString(valStr)
-//		if tmpErr != nil {
-//			err = tmpErr
-//			return
-//		}
-//		tagMap[relationCellTagName], _ = tmpValDecimal.Float64()
-//	}
-//
-//	// 计算
-//	val, _, err = calculate(strings.ToUpper(colData.Value), tagMap)
-//	if err != nil {
-//		return
-//	}
-//	// 重新赋值
-//	colData.ShowValue = val
-//	tableDataMap[rowInt][tag] = colData
-//	calculateCellMap[cellTagName] = val
-//
-//	return
-//}
-//
-//// calculate 公式计算
-//func calculate(calculateFormula string, TagMap map[string]float64) (calVal, errMsg string, err error) {
-//	if calculateFormula == "" {
-//		errMsg = "公式异常"
-//		err = errors.New(errMsg)
-//		return
-//	}
-//	calculateFormula = strings.TrimPrefix(calculateFormula, "=")
-//	calculateFormula = strings.Replace(calculateFormula, "(", "(", -1)
-//	calculateFormula = strings.Replace(calculateFormula, ")", ")", -1)
-//	calculateFormula = strings.Replace(calculateFormula, ",", ",", -1)
-//	calculateFormula = strings.Replace(calculateFormula, "。", ".", -1)
-//	calculateFormula = strings.Replace(calculateFormula, "%", "*0.01", -1)
-//
-//	formulaFormStr := utils.ReplaceFormula(TagMap, calculateFormula)
-//	//计算公式异常,那么就移除该指标
-//	if formulaFormStr == `` {
-//		errMsg = "公式异常"
-//		err = errors.New(errMsg)
-//		return
-//	}
-//
-//	expression := formula.NewExpression(formulaFormStr)
-//	calResult, err := expression.Evaluate()
-//	if err != nil {
-//		errMsg = "计算失败"
-//		err = errors.New("计算失败:Err:" + err.Error() + ";formulaStr:" + formulaFormStr)
-//		// 分母为0的报错
-//		if strings.Contains(err.Error(), "divide by zero") {
-//			errMsg = "分母不能为0"
-//			err = errors.New("分母不能为空,计算公式:" + formulaFormStr)
-//		}
-//		return
-//	}
-//	// 如果计算结果是NAN,那么就提示报错
-//	if calResult.IsNan() {
-//		errMsg = "计算失败"
-//		err = errors.New("计算失败:计算结果是:NAN;formulaStr:" + formulaFormStr)
-//		return
-//	}
-//	calVal = calResult.String()
-//
-//	// 转Decimal然后四舍五入
-//	valDecimal, err := decimal.NewFromString(calVal)
-//	if err != nil {
-//		errMsg = "计算失败"
-//		err = errors.New("计算失败,结果转 Decimal 失败:Err:" + err.Error() + ";formulaStr:" + formulaFormStr)
-//		return
-//	}
-//	calVal = valDecimal.Round(4).String()
-//
-//	return
-//}
 
-// GetExcelDetailInfoByExcelInfoId 根据表格id获取表格详情
 func GetExcelDetailInfoByExcelInfoId(uniqueCode, lang string) (excelDetail excel.ExcelInfoDetail, errMsg string, err error) {
 	errMsg = `获取失败`
-	//获取eta表格信息
 	excelInfo, err := excel.GetExcelInfoByUniqueCode(uniqueCode)
 	if err != nil {
 		err = errors.New("获取ETA表格信息失败,Err:" + err.Error())

+ 0 - 165
services/data/excel/mixed_table.go

@@ -18,8 +18,6 @@ import (
 	"github.com/yidane/formula"
 )
 
-// BaseCalculate
-// @Description: 指标数据计算请求
 type BaseCalculate struct {
 	DataList      []*models.EdbDataList
 	Frequency     string `description:"需要转换的频度"`
@@ -31,20 +29,16 @@ type BaseCalculate struct {
 	Source        int    `description:"1:累计值转月;2:累计值转季;3:同比值;4:同差值;5:N数值移动平均数计算;6:环比值;7:环差值;8:升频;9:降频;10:时间移位;11:超季节性;12:年化;13:累计值;14:累计值年初至今;15:指数修匀;16:日均值"`
 }
 
-// Cell
-// @Description: 单元格位置
 type Cell struct {
 	Column   int                           `description:"行"`
 	Row      int                           `description:"列"`
 	CellInfo request.MixedTableCellDataReq `description:"对应的单元格信息"`
 }
 
-// GetMixedTableCellData 获取混合表格数据
 func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (newMixedTableCellDataList [][]request.MixedTableCellDataReq, err error, errMsg string) {
 	cellRelationConf := mixedTableReq.CellRelation
 	config := mixedTableReq.Data
 
-	// 单元格关系配置x信息
 	cellRelationConfMap := make(map[string]request.CellRelationConf)
 	cellRelationConfList := make([]request.CellRelationConf, 0)
 	if cellRelationConf != `` {
@@ -58,25 +52,19 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 		}
 	}
 
-	// 找出所有的关联指标id
 	config, edbInfoIdList, _, err, errMsg := handleConfig(config)
 	if err != nil {
 		return
 	}
 
-	// 查询所有关联的指标信息
 	edbInfoList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
 	if err != nil {
 		return
 	}
 
-	// 指标信息map
 	edbInfoMap := make(map[int]*data_manage.EdbInfo)
-	// 日度指标数据map
 	edbDayDataListMap := make(map[int]map[string]float64)
-	// 月度指标数据map
 	edbMonthDataListMap := make(map[int]map[string]string)
-	// 日度指标数据map
 	edbDataListMap := make(map[int][]*models.EdbDataList)
 	for _, edbInfo := range edbInfoList {
 		edbInfoMap[edbInfo.EdbInfoId] = edbInfo
@@ -94,12 +82,9 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 		dateValMap := make(map[string]float64)
 		monthDateMap := make(map[string]string)
 		for _, tmpData := range dataList {
-			// 日度数据
 			dateValMap[tmpData.DataTime] = tmpData.Value
-			// 月度数据(取该月份的第一个数据)
 			yearMonth := strings.Join(strings.Split(tmpData.DataTime, "-")[0:2], "-")
 			if _, ok := monthDateMap[yearMonth]; !ok {
-				// 存最早的时间
 				monthDateMap[yearMonth] = tmpData.DataTime
 			}
 		}
@@ -108,22 +93,17 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 		edbDataListMap[edbInfo.EdbInfoId] = dataList
 	}
 
-	// 单元格实际绑定的信息map
 	cellDataRelationMap := make(map[string]request.MixedTableCellDataReq, 0)
 
-	// 处理指定指标的日期
 	for k, row := range config {
 		for i, cell := range row {
-			// 单元格是日期类型,且是日导入指标日期(指标库的最新日期)
 			if cell.DataType == request.DateDT && cell.DataTimeType == request.EdbDateDT {
-				// 指标id是在配置里面
 				var edbDateConfig request.EdbDateConf
 				err = json.Unmarshal([]byte(cell.Value), &edbDateConfig)
 				if err != nil {
 					return
 				}
 				if dataList, ok := edbDataListMap[edbDateConfig.EdbInfoId]; ok {
-					// todo 获取配置信息,根据配置信息进行日期变换, 是否需要更新当前记录,将历史记录逐渐转换成新的记录
 					var newDate string
 					newDate, err = GetEdbDateByMoveForward(config[k][i].Value, dataList)
 					if err != nil {
@@ -145,19 +125,15 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 		config[k] = row
 	}
 
-	// 指标计算的结果map
 	edbSourceDataMap := make(map[string]data.BaseCalculateDataResp)
 
-	// 单元格对应的key与他的值(只处理数据类型)
 	cellKeyVal := make(map[string]float64)
 
-	// 基础计算单元格的位置信息
 	calculateCellMap := make(map[string]Cell)
 	calculateChainList := make([]string, 0)
 	dateCalculateList := make([]string, 0)
 	showStyleList := make([]string, 0)
 
-	// 处理单元格中的数据类型(除去基础计算,因为这个是依赖于其他)
 	for k, row := range config {
 		for i, cell := range row {
 			switch cell.DataType {
@@ -170,30 +146,21 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 					cell.ShowValue = cell.Value
 				}
 			case request.InsertDataDT, request.PopInsertDataDT: // 数据类型
-				// 数值先清空
 				cell.ShowValue = ``
-				//cell.Value = ``
 
-				// 日期关系配置不存在,则默认最新数据
 				if relationConf, ok := cellRelationConfMap[cell.Uid]; ok { //表示表格日期
 					if relationConf.RelationDate.Key == `` {
-						// 日期关系配置未绑定
 						continue
 					}
-					// 配置
 					relationCell, ok := cellDataRelationMap[relationConf.RelationDate.Key]
 					if !ok {
-						// 找不到对应日期的单元格
 						continue
 					}
 
-					// 确实是找到了这个关联日期的单元格,那么通过日期重新获取数据值
 					tmpDateValMap := make(map[string]float64)
-					// 日度数据
 					if dateValMap, ok := edbDayDataListMap[cell.EdbInfoId]; ok {
 						tmpDateValMap = dateValMap
 					}
-					// todo 根据配置进行日期变换
 					relationDate := relationCell.DataTime
 					if strings.Contains(cell.Value, "{") {
 						relationDate, err = HandleMixTableDateChange(relationDate, cell.Value)
@@ -205,19 +172,14 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 					}
 
 					if val, ok2 := tmpDateValMap[relationDate]; ok2 {
-						//cell.ShowValue = fmt.Sprint(val)
 						cellKeyVal[cell.Uid] = val
 						cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 					}
 				} else {
-					// 如果不是取得一个关联的日期,那么就是指定日期
-					// 如果没有指定日期,则默认最新数据
 					if cell.DataTime == `` {
-						// 指标的最新日期
 						if dateValList, ok := edbDataListMap[cell.EdbInfoId]; ok {
 							tmpLenData := len(dateValList)
 							if tmpLenData > 0 {
-								//做期数前移动和日期变换
 								if !strings.Contains(cell.Value, "{") {
 									cell.Value = ""
 								}
@@ -247,18 +209,14 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 						tmpDateValMap := make(map[string]float64)
 						var newDate string
 						if len(tmpDateList) == 2 {
-							//月度数据
 							if dateMap, ok1 := edbMonthDataListMap[cell.EdbInfoId]; ok1 {
 								if d, ok2 := dateMap[cell.DataTime]; ok2 {
 									newDate = d
 								}
 							}
 						} else {
-							// 日度数据
 							newDate = cell.DataTime
 						}
-						// 日期变换后才能确定最后的时间
-						//做期数前移动和日期变换
 						if !strings.Contains(cell.Value, "{") {
 							cell.Value = ""
 						}
@@ -271,7 +229,6 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 						if dateValMap, ok3 := edbDayDataListMap[cell.EdbInfoId]; ok3 {
 							tmpDateValMap = dateValMap
 							if val, ok2 := tmpDateValMap[cell.DataTime]; ok2 {
-								//cell.ShowValue = fmt.Sprint(val)
 								cellKeyVal[cell.Uid] = val
 								cell.ShowValue = utils.FormatMixTableDataShowValue(val)
 							}
@@ -282,7 +239,6 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 				if cell.Value == `` {
 					continue
 				}
-				// 处理看下能否转成float,如果可以的话,说明这个也是可以参与计算的
 				tmpDeci, tmpErr := decimal.NewFromString(cell.Value)
 				if tmpErr == nil {
 					tmpVal, _ := tmpDeci.Float64()
@@ -293,24 +249,17 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 				calculateChainList = append(calculateChainList, cell.Uid)
 
 			case request.InsertEdbCalculateDataDT: // 插入指标系统计算公式生成的值
-				// 处理value的值
 				if !strings.Contains(cell.Value, "EdbInfoId") && cell.EdbInfoId > 0 {
 					cell.Value, _ = fixCalculateValueConfig(cell.Value, cell.EdbInfoId)
 					row[i] = cell
 				}
-				// 日期
 				var cellDateTime string
-				// 日期关系配置不存在,则默认最新数据
-				// 从绑定的单元格中获取数据的日期
 				if relationConf, ok := cellRelationConfMap[cell.Uid]; ok {
 					if relationConf.RelationDate.Key == `` {
-						// 日期关系配置未绑定
 						continue
 					}
-					// 配置
 					relationCell, ok := cellDataRelationMap[relationConf.RelationDate.Key]
 					if !ok {
-						// 找不到对应日期的单元格
 						continue
 					}
 					cellDateTime = relationCell.DataTime
@@ -321,7 +270,6 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 				key := utils.MD5(cell.Value)
 				respItemData, ok := edbSourceDataMap[key]
 				if !ok {
-					// 对应的配置值
 					var tmpConfig request.CalculateConf
 					err = json.Unmarshal([]byte(cell.Value), &tmpConfig)
 					if err != nil {
@@ -348,7 +296,6 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 						Source:        tmpConfig.Source,
 					}
 
-					// 调用指标库去更新
 					reqJson, tmpErr := json.Marshal(req2)
 					if tmpErr != nil {
 						utils.FileLog.Error(fmt.Sprintf("计算失败1,配置信息;%s;错误原因:%s", cell.Value, tmpErr.Error()))
@@ -366,15 +313,12 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 						continue
 					}
 
-					//tmpDataMap = respItem.Data.DataMap
-					// 计算结果存一份,万一存在重复的计算方式,那么省的重新计算一下
 					edbSourceDataMap[key] = respItem.Data
 					respItemData = respItem.Data
 				}
 				lenDataList := len(respItemData.DateList)
 				tmpDataMap = respItemData.DataMap
 				if cellDateTime == `` && lenDataList > 0 {
-					//判断是否需要做期数前移动
 					cellDateTime = respItemData.DateList[lenDataList-1]
 					cellDateTime, err = GetEdbDateByMoveForwardByDateList(cell.Value, respItemData.DateList)
 					if err != nil {
@@ -382,7 +326,6 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 						continue
 					}
 				}
-				// 进行日期变换
 				cellDateTime, err = HandleMixTableDateChange(cellDateTime, cell.Value)
 				if err != nil {
 					utils.FileLog.Error(fmt.Sprintf("日期变换失败,配置信息;%s, 日期:%s", cell.Value, cellDateTime))
@@ -397,14 +340,12 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 				}
 			case request.DateCalculateDataDT: //日期计算
 				dateCalculateList = append(dateCalculateList, cell.Uid)
-				// 遍历数组,根据公式进行计算,并将得到的结果放到对应的单元格中
 			}
 			row[i] = cell
 		}
 		config[k] = row
 	}
 
-	// 处理指定指标的日期
 	for k, row := range config {
 		for i, cell := range row {
 			calculateCellMap[cell.Uid] = Cell{
@@ -422,10 +363,8 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 		config[k] = row
 	}
 
-	// 公式链计算
 	if len(calculateChainList) > 0 {
 		for _, cellKey := range calculateChainList {
-			// 查找这个单元格的位置,直接map找了,而不是遍历整个单元格
 			cellPosition, ok := calculateCellMap[cellKey]
 			if !ok {
 				utils.FileLog.Error("找不到单元格位置:", cellKey)
@@ -454,13 +393,11 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 		}
 	}
 
-	// 日期计算
 	config, err, errMsg = handlerDateCalculate(dateCalculateList, calculateCellMap, config)
 	if err != nil {
 		return
 	}
 
-	// 格式化展示
 	config, err, errMsg = handleMixCellShowStyle(showStyleList, calculateCellMap, config)
 	if err != nil {
 		return
@@ -471,16 +408,13 @@ func GetMixedTableCellData(mixedTableReq request.MixedTableReq, lang string) (ne
 	return
 }
 
-// getCalculateValue 获取公式计算的结果
 func getCalculateValueByCell(calculateCellMap map[string]Cell, key string, cellKeyValMap map[string]float64) (val float64, has bool, err error, errMsg string) {
-	// 单元格的标签名
 	val, ok := cellKeyValMap[key]
 	if ok {
 		has = true
 		return
 	}
 
-	// 查找单元格数据
 	cell, ok := calculateCellMap[key]
 	if !ok {
 		err = errors.New("查找单元格" + key + "的数据失败")
@@ -489,15 +423,12 @@ func getCalculateValueByCell(calculateCellMap map[string]Cell, key string, cellK
 
 	colData := cell.CellInfo
 
-	// 如果不是基础计算单元格,直接返回
 	if colData.DataType != request.FormulateCalculateDataDT {
 		return
 	}
 
-	// 如果是计算单元格
 
 	tagList := make([]utils.CellPosition, 0)
-	// 计算单元格relationCellList
 	var relationCellList []request.RelationCell
 	if colData.Extra == `` {
 		err = errors.New(colData.Uid + "没有绑定关系")
@@ -509,7 +440,6 @@ func getCalculateValueByCell(calculateCellMap map[string]Cell, key string, cellK
 	}
 
 	for _, relation := range relationCellList {
-		//relationCellTagName := strings.ToUpper(relation.Tag) + relation.Row
 		tmpVal, _, tmpErr, tmpErrMsg := getCalculateValueByCell(calculateCellMap, relation.Key, cellKeyValMap)
 		if tmpErr != nil {
 			errMsg = tmpErrMsg
@@ -531,28 +461,16 @@ func getCalculateValueByCell(calculateCellMap map[string]Cell, key string, cellK
 		})
 	}
 
-	// 计算
 	val, errMsg, err = calculateByCellList(strings.ToUpper(colData.Value), tagList)
 	if err != nil {
 		return
 	}
-	// 重新赋值
 	has = true
 	cellKeyValMap[key] = val
 
 	return
 }
 
-// handleConfig
-// @Description: 处理混合表格配置
-// @author: Roc
-// @datetime2023-10-27 13:24:53
-// @param configList [][]request.MixedTableCellDataReq
-// @return newConfig [][]request.MixedTableCellDataReq
-// @return edbInfoIdList []int
-// @return dataEdbInfoIdList []int
-// @return err error
-// @return errMsg string
 func handleConfig(configList [][]request.MixedTableCellDataReq) (newConfig [][]request.MixedTableCellDataReq, edbInfoIdList []int, dataEdbInfoIdList []int, err error, errMsg string) {
 	edbInfoIdList = make([]int, 0)
 	dataEdbInfoIdList = make([]int, 0)
@@ -589,7 +507,6 @@ func handleConfig(configList [][]request.MixedTableCellDataReq) (newConfig [][]r
 				rowList[rk].ShowValue = date
 				rowList[rk].Value = newVal //兼容原有的历史数据中系统导入日期
 
-				// 指标日期类型的单元格需要额外将指标id取出来
 				if cell.DataTimeType == request.EdbDateDT {
 					var config request.EdbDateConf
 					err = json.Unmarshal([]byte(cell.Value), &config)
@@ -608,28 +525,10 @@ func handleConfig(configList [][]request.MixedTableCellDataReq) (newConfig [][]r
 	return
 }
 
-// HandleDate
-// @Description: 日期处理
-// @author: Roc
-// @datetime2023-10-27 09:37:02
-// @param dataTimeType int
-// @param val string
-// @return date string
-// @return err error
-// @return errMsg string
 func HandleDate(dataTimeType int, val string) (date string, newVal string, err error, errMsg string) {
 	return handleDate(dataTimeType, val)
 }
 
-// handleDate
-// @Description: 日期处理
-// @author: Roc
-// @datetime2023-10-27 09:36:49
-// @param dataTimeType int
-// @param val string
-// @return date string
-// @return err error
-// @return errMsg string
 func handleDate(dataTimeType int, val string) (date string, newVal string, err error, errMsg string) {
 	newVal = val
 	if val == `` {
@@ -673,15 +572,6 @@ func handleDate(dataTimeType int, val string) (date string, newVal string, err e
 	return
 }
 
-// handleSystemCalculateDateT
-// @Description: 处理系统日期计算后的日期
-// @author: Roc
-// @datetime2023-10-27 09:31:22
-// @param num int
-// @param frequency string
-// @return date string
-// @return err error
-// @return errMsg string
 func handleSystemCalculateDateT(num int, frequency string) (date string, err error, errMsg string) {
 	if err != nil {
 		return
@@ -699,17 +589,7 @@ func handleSystemCalculateDateT(num int, frequency string) (date string, err err
 	return
 }
 
-// handleSystemAppointDateT
-// @Description: 处理系统日期相关的指定频率(所在周/旬/月/季/半年/年的最后/最早一天)
-// @author: Roc
-// @datetime2023-10-27 09:31:35
-// @param Frequency string
-// @param Day string
-// @return date string
-// @return err error
-// @return errMsg string
 func handleSystemAppointDateT(currDate time.Time, appointDay, frequency string) (date string, err error, errMsg string) {
-	//currDate := time.Now()
 	switch frequency {
 	case "本周":
 		day := int(currDate.Weekday())
@@ -828,15 +708,6 @@ func handleSystemAppointDateT(currDate time.Time, appointDay, frequency string)
 	return
 }
 
-// calculateByCellList
-// @Description: 根据单元格来进行公式计算
-// @author: Roc
-// @datetime2023-11-14 16:17:38
-// @param calculateFormula string
-// @param tagList []utils.CellPosition
-// @return calVal string
-// @return errMsg string
-// @return err error
 func calculateByCellList(calculateFormula string, tagList []utils.CellPosition) (calVal float64, errMsg string, err error) {
 	if calculateFormula == "" {
 		errMsg = "公式异常"
@@ -871,7 +742,6 @@ func calculateByCellList(calculateFormula string, tagList []utils.CellPosition)
 	}
 
 	formulaFormStr := utils.ReplaceFormulaByCellList(list, calculateFormula)
-	//计算公式异常,那么就移除该指标
 	if formulaFormStr == `` {
 		errMsg = "公式异常"
 		err = errors.New(errMsg)
@@ -883,14 +753,12 @@ func calculateByCellList(calculateFormula string, tagList []utils.CellPosition)
 	if err != nil {
 		errMsg = "计算失败"
 		err = errors.New("计算失败:Err:" + err.Error() + ";formulaStr:" + formulaFormStr)
-		// 分母为0的报错
 		if strings.Contains(err.Error(), "divide by zero") {
 			errMsg = "分母不能为0"
 			err = errors.New("分母不能为空,计算公式:" + formulaFormStr)
 		}
 		return
 	}
-	// 如果计算结果是NAN,那么就提示报错
 	if calResult.IsNan() {
 		errMsg = "计算失败"
 		err = errors.New("计算失败:计算结果是:NAN;formulaStr:" + formulaFormStr)
@@ -901,7 +769,6 @@ func calculateByCellList(calculateFormula string, tagList []utils.CellPosition)
 		return
 	}
 
-	// 转Decimal然后四舍五入
 	calVal, _ = decimal.NewFromFloat(calVal).Round(4).Float64()
 
 	return
@@ -928,7 +795,6 @@ func GetEdbDateByMoveForwardByDateList(conf string, dateList []string) (date str
 		}
 		moveForward = edbDateConf.MoveForward
 	}
-	// 根据日期进行排序
 	index := len(dateList) - 1 - moveForward
 	for k, v := range dateList {
 		if k == index {
@@ -939,7 +805,6 @@ func GetEdbDateByMoveForwardByDateList(conf string, dateList []string) (date str
 	return
 }
 
-// HandleMixTableDateChange 处理表格中的日期变换
 func HandleMixTableDateChange(date, conf string) (newDate string, err error) {
 	newDate = date
 	if conf == "" {
@@ -982,14 +847,6 @@ func HandleMixTableDateChange(date, conf string) (newDate string, err error) {
 	return
 }
 
-// handleOldSystemDateT
-// @Description: 历史数据中的导入系统日期
-// @author: Roc
-// @datetime2023-10-27 09:36:21
-// @param confStr string
-// @return date string
-// @return err error
-// @return errMsg string
 func handleOldSystemDateT(confStr string) (newConf string, err error, errMsg string) {
 	newConf = confStr
 	var config request.SystemDateConf
@@ -1007,7 +864,6 @@ func handleOldSystemDateT(confStr string) (newConf string, err error, errMsg str
 	case request.SystemCurrDateT:
 		return
 	case request.SystemCalculateDateT:
-		// todo 是否直接更新该excel记录,
 		dateChange.Day = config.CalculateNum
 		dateChange.ChangeType = 1
 		dateChangeList = append(dateChangeList, dateChange)
@@ -1033,15 +889,12 @@ func handleOldSystemDateT(confStr string) (newConf string, err error, errMsg str
 		newConf = string(newConfByte)
 		return
 	default:
-		//errMsg = "错误的日期日期导入方式"
-		//err = errors.New(fmt.Sprint("错误的日期日期导入方式:", config.Source))
 		return
 	}
 
 	return
 }
 
-// handlerDateCalculate 处理日期计算
 func handlerDateCalculate(dateCalculateList []string, calculateCellMap map[string]Cell, oldConfig [][]request.MixedTableCellDataReq) (config [][]request.MixedTableCellDataReq, err error, errMsg string) {
 	config = oldConfig
 	if len(dateCalculateList) == 0 {
@@ -1049,7 +902,6 @@ func handlerDateCalculate(dateCalculateList []string, calculateCellMap map[strin
 	}
 	if len(dateCalculateList) > 0 {
 		for _, cellKey := range dateCalculateList {
-			// 查找这个单元格的位置,直接map找了,而不是遍历整个单元格
 			cellPosition, ok := calculateCellMap[cellKey]
 			if !ok {
 				utils.FileLog.Error("找不到单元格位置:", cellKey)
@@ -1076,7 +928,6 @@ func handlerDateCalculate(dateCalculateList []string, calculateCellMap map[strin
 	return
 }
 
-// DateCalculatePrepare 单个单元格的日期计算
 func DateCalculatePrepare(calculateCellMap map[string]Cell, config string) (val float64, err error, errMsg string) {
 	var edbDateConf request.MixDateCalculateConf
 	err = json.Unmarshal([]byte(config), &edbDateConf)
@@ -1090,7 +941,6 @@ func DateCalculatePrepare(calculateCellMap map[string]Cell, config string) (val
 	}
 	valMap := make(map[string]int)
 	for _, v := range edbDateConf.RelationCellList {
-		// 查找单元格数据
 		cell, ok := calculateCellMap[v.Uid]
 		if !ok {
 			err = fmt.Errorf("查找单元格:%s 的数据失败", v.Uid)
@@ -1098,19 +948,16 @@ func DateCalculatePrepare(calculateCellMap map[string]Cell, config string) (val
 		}
 		colData := cell.CellInfo
 
-		// 如果不是基础计算单元格,直接返回
 		_, err = time.ParseInLocation(utils.FormatDate, colData.ShowValue, time.Local)
 		if err != nil {
 			err = fmt.Errorf("%s 的单元格非日期类型, Err: %s", colData.ShowValue, err.Error())
 			return
 		}
-		// todo 把日期转换成excel里的天数
 		realDiffDay := utils.GetDaysDiff1900(colData.ShowValue)
 
 		valMap[strings.ToUpper(v.Tag)] = realDiffDay
 	}
 
-	// 计算
 	val, errMsg, err = DateCalculateFormula(valMap, strings.ToUpper(edbDateConf.Formula))
 	if err != nil {
 		return
@@ -1145,14 +992,12 @@ func DateCalculateFormula(valTagMap map[string]int, calculateFormula string) (ca
 	if err != nil {
 		errMsg = "计算失败"
 		err = errors.New("计算失败:Err:" + err.Error() + ";formulaStr:" + formulaFormStr)
-		// 分母为0的报错
 		if strings.Contains(err.Error(), "divide by zero") {
 			errMsg = "分母不能为0"
 			err = errors.New("分母不能为空,计算公式:" + formulaFormStr)
 		}
 		return
 	}
-	// 如果计算结果是NAN,那么就提示报错
 	if calResult.IsNan() {
 		errMsg = "计算失败"
 		err = errors.New("计算失败:计算结果是:NAN;formulaStr:" + formulaFormStr)
@@ -1163,13 +1008,11 @@ func DateCalculateFormula(valTagMap map[string]int, calculateFormula string) (ca
 		return
 	}
 
-	// 转Decimal然后四舍五入
 	calVal, _ = decimal.NewFromFloat(calVal).Round(4).Float64()
 
 	return
 }
 
-// handleMixCellShowStyle 处理混合表格中,显示计算的逻辑
 func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]Cell, oldConfig [][]request.MixedTableCellDataReq) (config [][]request.MixedTableCellDataReq, err error, errMsg string) {
 	config = oldConfig
 	if len(showStyleList) == 0 {
@@ -1177,7 +1020,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 	}
 	if len(showStyleList) > 0 {
 		for _, cellKey := range showStyleList {
-			// 查找这个单元格的位置,直接map找了,而不是遍历整个单元格
 			cellPosition, ok := calculateCellMap[cellKey]
 			if !ok {
 				utils.FileLog.Error("找不到单元格位置:", cellKey)
@@ -1186,7 +1028,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 
 			cell := config[cellPosition.Column][cellPosition.Row]
 			val := cell.ShowValue
-			// 如果没有showValue, 则使用value
 			if cell.ShowValue == "" {
 				_, err := strconv.ParseFloat(cell.Value, 64)
 				if err == nil {
@@ -1210,7 +1051,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 			}
 
 			if styleConf.Pn != 0 || styleConf.Nt != "" {
-				// 修复历史数据,没有保存小数位数,重置小数位数
 				if styleConf.Pn != 0 {
 					if styleConf.Decimal == nil {
 						styleConf.Decimal = new(int)
@@ -1237,7 +1077,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 			} else {
 				cell.ShowFormatValue = cell.ShowValue
 			}
-			// 前端传过来的json中有可能有glObj,需要去掉
 			styleConf.GlObj = nil
 			tmpStyleConf, err := json.Marshal(styleConf)
 			if err == nil {
@@ -1249,7 +1088,6 @@ func handleMixCellShowStyle(showStyleList []string, calculateCellMap map[string]
 	return
 }
 
-// changePointDecimalPlaces 小数点位数加减和百分比格式
 func changePointDecimalPlaces(str string, changeNum int, numberType string, isPercent bool) (newStr string) {
 	newStr = str
 	var decimalPlaces int
@@ -1259,7 +1097,6 @@ func changePointDecimalPlaces(str string, changeNum int, numberType string, isPe
 	} else {
 		decimalPlaces = len(newStr) - dotIndex - 1
 	}
-	// 把字符串转成浮点数
 	val, _ := strconv.ParseFloat(str, 64)
 	if isPercent {
 		if numberType == "number" { //百分数转成小数
@@ -1295,10 +1132,8 @@ func changePointDecimalPlaces(str string, changeNum int, numberType string, isPe
 		val, _ = decimal.NewFromFloat(val).Round(int32(decimalPlaces)).Float64()
 		newStr = strconv.FormatFloat(val, 'f', decimalPlaces, 64)
 	} else {
-		// 此处用%.f避免科学计数法, 从而导致后面出现很多位0
 		newStr = fmt.Sprintf("%.f", val)
 	}
-	// 计算小数位数
 	decimalPlaces = 0
 	dotIndex = strings.Index(newStr, ".") // 查找小数点的位置
 	if dotIndex == -1 {

+ 0 - 95
services/data/excel/time_table.go

@@ -17,8 +17,6 @@ import (
 	"github.com/yidane/formula"
 )
 
-// TableDataConfig
-// @Description: 表格配置
 type TableDataConfig struct {
 	EdbInfoIdList    []int                     `description:"指标id列表,从左至右,从上到下的顺序"`
 	Sort             int                       `description:"日期排序,0:倒序,1:正序"`
@@ -37,8 +35,6 @@ type DecimalConfig struct {
 	Decimal int    `description:"小数位数, 从左至右,从上到下的顺序"`
 }
 
-// TableEdbInfo
-// @Description: 表格指标信息
 type TableEdbInfo struct {
 	EdbInfoId    int    `description:"指标ID"`
 	Tag          string `description:"标签"`
@@ -50,8 +46,6 @@ type TableEdbInfo struct {
 	UnitEn       string `description:"英文单位"`
 }
 
-// ManualData
-// @Description: 手工文本配置
 type ManualData struct {
 	DataType            int                       `description:"数据类型,1:普通的,2:插值法,3:手动输入,4:公式计算"`
 	DataTime            string                    `description:"所属日期"`
@@ -63,22 +57,17 @@ type ManualData struct {
 	RelationEdbInfoList []request.RelationEdbInfo `description:"关联指标(计算公式中关联的指标,用于计算的时候去匹配)"`
 }
 
-// GetDataByTableDataConfig 根据数据配置获取表格数据
 func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp request.TableDataReq, err error) {
-	// 没有选择指标的情况下,直接返回吧
 	if len(tableDataConfig.EdbInfoIdList) <= 0 {
 		return
 	}
 
-	// 实际期数没有的情况下,直接返回吧
 	if tableDataConfig.Num <= 0 {
 		return
 	}
 
-	// 获取所有的指标信息
 	edbInfoMap := make(map[int]*data_manage.EdbInfo)
 	edbInfoIdList := make([]int, 0)
-	// 标签与指标id的map
 	tagEdbInfoIdMap := make(map[string]int)
 	{
 		for _, tableEdbInfo := range tableDataConfig.TableEdbInfoList {
@@ -104,7 +93,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 		}
 	}
 
-	// 寻找A列的数据列表
 	firstEdbInfo, ok := edbInfoMap[tableDataConfig.TableEdbInfoList[0].EdbInfoId]
 	if !ok {
 		err = errors.New("找不到A列指标")
@@ -114,7 +102,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 	if err != nil {
 		return
 	}
-	// A列找不到数据,那么就直接返回吧
 	if len(baseFirstEdbInfoDataList) <= 0 {
 		return
 	}
@@ -133,7 +120,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 	if len(firstEdbInfoDataList) <= 0 {
 		return
 	}
-	// 实际数据的最后一天
 	lastRealDateTime, err := time.ParseInLocation(utils.FormatDate, firstEdbInfoDataList[0].DataTime, time.Local)
 	if err != nil {
 		return
@@ -149,7 +135,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 		firstDateDataMap[v.DataTime] = v
 	}
 
-	// 将手工数据的日期填补进去(未来的日期,过去的就不管了)
 	for _, manualData := range tableDataConfig.Data {
 		if !utils.InArrayByStr(dateList, manualData.DataTime) {
 			tmpDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, manualData.DataTime, time.Local)
@@ -199,7 +184,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 			edbInfoIdDateData = make(map[string]request.ManualDataReq)
 		}
 
-		// 判断是否存在该日期的数据(不存在,那么插入数据吧,存在就不管了)
 		tmpManualData, ok := edbInfoIdDateData[tmpDate]
 		if !ok {
 			edbInfoIdDateData[tmpDate] = request.ManualDataReq{
@@ -221,7 +205,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 		edbInfoIdDateDataMap[v.EdbInfoId] = edbInfoIdDateData
 	}
 
-	// 获取数据的日期排序
 	sortDateTimeList := make([]time.Time, 0)
 	{
 		sortDateList := dateList
@@ -243,7 +226,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 		}
 	}
 
-	// 数据处理,处理成表格的数据格式
 	tableDataMap, textRowListDataResp := handleTable(tagEdbInfoIdMap, lastRealDateTime, sortDateTimeList, edbInfoIdDateDataMap, tableDataConfig.Data, tableDataConfig.TextRowData)
 
 	data := make([]request.EdbInfoData, 0)
@@ -270,8 +252,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 			tmpEdbInfoData.Frequency = edbInfo.Frequency
 			tmpEdbInfoData.Unit = edbInfo.Unit
 			tmpEdbInfoData.UnitEn = edbInfo.UnitEn
-			//tmpEdbInfoData.ClassifyId = edbInfo.ClassifyId
-			//tmpEdbInfoData.IsJoinPermission = edbInfo.IsJoinPermission
 		}
 
 		for index, dateTime := range sortDateTimeList {
@@ -316,10 +296,8 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 		data = append(data, tmpEdbInfoData)
 	}
 
-	// 处理一下数据格式
 	for _, d := range data {
 		for k2, d2 := range d.Data {
-			// 可能有ShowValue非数值, 转换一下报错则continue
 			vf, e := strconv.ParseFloat(d2.ShowValue, 64)
 			if e != nil {
 				continue
@@ -329,7 +307,6 @@ func GetDataByTableDataConfig(tableDataConfig TableDataConfig) (resultResp reque
 	}
 	for _, d := range textRowListDataResp {
 		for k2, d2 := range d {
-			// 可能有ShowValue非数值, 转换一下报错则continue
 			vf, e := strconv.ParseFloat(d2.ShowValue, 64)
 			if e != nil {
 				continue
@@ -395,9 +372,7 @@ func SetExcelShowValueByDecimalConfig(edbData []request.EdbInfoData, decimalConf
 	return edbData
 }
 
-// GetTableDataConfig 根据TableDataReq配置获取相关数据配置
 func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableDataConfig, err error) {
-	// 指标数据
 	tableDataConfig.EdbInfoIdList = reqData.EdbInfoIdList
 	tableDataConfig.Sort = reqData.Sort
 
@@ -406,21 +381,15 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 		return
 	}
 
-	// 开始日期
 	var startDate string
-	// A列的指标id
 	var firstEdbInfoId int
-	// 手工操作的数据列
 	manualDataList := make([]ManualData, 0)
-	// 指标配置列表
 	tableEdbInfoList := make([]TableEdbInfo, 0)
 
-	// 第一列的日期map
 	firstDateMap := make(map[string]string)
 	manualDateMap := make(map[string]string)
 
 	for _, v := range reqData.Data {
-		// 指标信息
 		tmpTableEdbInfo := TableEdbInfo{
 			EdbInfoId:    v.EdbInfoId,
 			Tag:          v.Tag,
@@ -433,7 +402,6 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 		}
 		tableEdbInfoList = append(tableEdbInfoList, tmpTableEdbInfo)
 
-		// 确定数据A列
 		if v.Tag == "A" {
 			firstEdbInfoId = v.EdbInfoId
 			lenData := len(v.Data)
@@ -443,13 +411,11 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 			}
 			index := 0
 			if reqData.Sort == 1 {
-				// 倒序
 				index = lenData - 1
 			}
 
 			startDate = v.Data[index].DataTime
 
-			// 存在的日期列表
 			for _, data := range v.Data {
 				firstDateMap[data.DataTime] = data.DataTime
 
@@ -479,12 +445,10 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 		}
 	}
 
-	// 总共需要的期数
 	num := len(reqData.Data[0].Data)
 
 	removeDate := make([]string, 0)
 
-	// 获取期数
 	{
 		firstDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, startDate, time.Local)
 		if tmpErr != nil {
@@ -511,7 +475,6 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 			return
 		}
 
-		// 获取日期内的数据(包含开始日期前一个日期,以及 结束日期后一个日期,目的为了做空日期时的 插值法兼容)
 		baseDataList := make([]*models.EdbDataList, 0)
 		for _, data := range firstDataList {
 			tmpDate := data.DataTime
@@ -526,9 +489,7 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 			baseDataList = append(baseDataList, data)
 		}
 
-		// 筛选出需要删除的日期
 		for _, tmpData := range baseDataList {
-			//firstDateMap{}
 			if _, ok := firstDateMap[tmpData.DataTime]; !ok {
 				removeDate = append(removeDate, tmpData.DataTime)
 			}
@@ -544,7 +505,6 @@ func GetTableDataConfig(reqData request.TableDataReq) (tableDataConfig TableData
 	return
 }
 
-// handleTable 表格数据处理
 func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sortDateTimeList []time.Time, edbInfoIdDateDataMap map[int]map[string]request.ManualDataReq, manualDataList []ManualData, textRowData [][]request.ManualDataReq) (tableDataMap map[int]map[string]request.ManualDataReq, textRowListDataResp [][]request.ManualDataReq) {
 	tagList := make([]string, 0)
 	for tag, _ := range tagEdbInfoIdMap {
@@ -554,7 +514,6 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 
 	tableDataMap = make(map[int]map[string]request.ManualDataReq) //行、列数据
 
-	// 日期与行的关系
 	dateIndexMap := make(map[string]int)
 
 	for k, dateTime := range sortDateTimeList {
@@ -582,7 +541,6 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 				continue
 			}
 
-			// 获取指标的数据map
 			dateDataMap, ok := edbInfoIdDateDataMap[edbInfoId]
 			if !ok { // 没有找到该指标的数据,那么就用空串填补
 				rowDataMap[tag] = request.ManualDataReq{
@@ -596,7 +554,6 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 				continue
 			}
 
-			// 获取指标该日期的数据
 			tmpData, ok := dateDataMap[tmpDateTimeStr]
 			if !ok { // 该指标没有找到对应日期的数据,那么就用空串填补
 				rowDataMap[tag] = request.ManualDataReq{
@@ -615,42 +572,34 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 		tableDataMap[k+1] = rowDataMap
 	}
 
-	// 替换手工设置的数据
 	for _, manualData := range manualDataList {
-		// 找不到该日期,说明这日期过期了,不处理
 		index, ok := dateIndexMap[manualData.DataTime]
 		if !ok {
 			continue
 		}
 
-		// 获取对应行的数据
 		rowDataMap, ok := tableDataMap[index]
 		if !ok {
 			continue
 		}
 
-		// 找到对应的单元格
 		tmpData, ok := rowDataMap[manualData.Tag]
 		if !ok {
 			continue
 		}
 
-		// 如果该单元格实际有数据(包含预测值),或者插值法补充了数据的话,那么就不用手动填入的数据
 		if utils.InArrayByInt([]int{1, 2, 5}, tmpData.DataType) {
 			continue
 		}
 
-		// 手工填写的数字
 		if tmpData.DataType == 3 {
 			tmpData.ShowValue = manualData.ShowValue
 			tmpData.Value = manualData.Value
 			tableDataMap[index][manualData.Tag] = tmpData
 
-			//edbInfoIdDateDataMap[manualData.EdbInfoId][manualData.DataTime] = tmpData
 			continue
 		}
 
-		// 公式
 		tmpData.DataType = manualData.DataType
 		tmpData.ShowValue = ``
 		tmpData.Value = manualData.Value
@@ -659,22 +608,17 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 
 	}
 
-	// 文本行的列表插入
 	lenTableData := len(tableDataMap)
 
-	// 文本行第一列的数据列表(可能多行)
 	firstColTextRowList := make([]request.ManualDataReq, 0)
-	// 参与计算的文本行列表数据
 	tmpTextRowList := make([][]request.ManualDataReq, 0)
 	for k, textRowList := range textRowData {
-		// 判断列数是否匹配,不匹配的话那么过滤
 		if len(tagList)+1 != len(textRowList) {
 			continue
 		}
 		rowDataMap := make(map[string]request.ManualDataReq)
 		tmpTextRow := make([]request.ManualDataReq, 0)
 		for index, textRow := range textRowList {
-			// 移除第一列,因为第一列是日期列
 			if index == 0 {
 				firstColTextRowList = append(firstColTextRowList, textRow)
 				continue
@@ -687,30 +631,24 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 		tmpTextRowList = append(tmpTextRowList, tmpTextRow)
 	}
 
-	// 参与计算的单元格
 	calculateCellMap := make(map[string]string)
 
-	// 计算手工填写的单元格
 	for _, manualData := range manualDataList {
-		// 找不到该日期,说明这日期过期了,不处理
 		index, ok := dateIndexMap[manualData.DataTime]
 		if !ok {
 			continue
 		}
 
-		// 获取对应行的数据
 		rowDataMap, ok := tableDataMap[index]
 		if !ok {
 			continue
 		}
 
-		// 找到对应的单元格
 		colData, ok := rowDataMap[manualData.Tag]
 		if !ok {
 			continue
 		}
 
-		// 如果该单元格不是计算公式的单元格,那么直接退出当前循环即可
 		if colData.DataType != 4 {
 			continue
 		}
@@ -732,26 +670,20 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 			replaceNum++
 		}
 
-		// 如果替换的数据与关联的不一致,那么就退出当前循环
 		if lenRelation != replaceNum {
 			continue
 		}
 
-		// 计算
 		val, _, err := calculate(strings.ToUpper(colData.Value), tagMap)
-		// 计算失败,退出循环
 		if err != nil {
 			continue
 		}
-		// 重新赋值
 		colData.ShowValue = val
 		tableDataMap[index][manualData.Tag] = colData
 
 	}
 
-	// 计算文本行的单元格
 	for k, textRow := range tmpTextRowList {
-		// 获取对应行的数据
 		index := lenTableData + k + 1
 		rowDataMap, ok := tableDataMap[index]
 		if !ok {
@@ -760,13 +692,11 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 
 		for colIndex, _ := range textRow {
 			currTag := tagList[colIndex]
-			// 找到对应的单元格
 			colData, ok := rowDataMap[currTag]
 			if !ok {
 				continue
 			}
 
-			// 如果该单元格不是计算公式的单元格,那么直接退出当前循环即可
 			if colData.DataType != 4 {
 				continue
 			}
@@ -788,27 +718,21 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 				replaceNum++
 			}
 
-			// 如果替换的数据与关联的不一致,那么就退出当前循环
 			if lenRelation != replaceNum {
 				continue
 			}
 
-			// 计算
 			val, _, err := calculate(strings.ToUpper(colData.Value), tagMap)
-			// 计算失败,退出循环
 			if err != nil {
 				continue
 			}
-			// 重新赋值
 			colData.ShowValue = val
 			tableDataMap[index][currTag] = colData
 		}
 
 	}
 
-	// 计算文本行第一列的数据值(多行)
 	for k, colData := range firstColTextRowList {
-		// 如果该单元格不是计算公式的单元格,那么直接退出当前循环即可
 		if colData.DataType != 4 {
 			continue
 		}
@@ -830,27 +754,21 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 			replaceNum++
 		}
 
-		// 如果替换的数据与关联的不一致,那么就退出当前循环
 		if lenRelation != replaceNum {
 			continue
 		}
 
-		// 计算
 		val, _, err := calculate(strings.ToUpper(colData.Value), tagMap)
-		// 计算失败,退出循环
 		if err != nil {
 			continue
 		}
-		// 重新赋值
 		colData.ShowValue = val
 		firstColTextRowList[k] = colData
 	}
 
 	{
-		// 文本行的数据处理返回
 		textRowListDataResp = make([][]request.ManualDataReq, 0)
 		newLenTableDataMap := len(tableDataMap)
-		// 文本行的第一行所在的位置
 		firstTextRow := lenTableData + 1
 		for i := firstTextRow; i <= newLenTableDataMap; i++ {
 			textRowDataResp := make([]request.ManualDataReq, 0)
@@ -867,41 +785,35 @@ func handleTable(tagEdbInfoIdMap map[string]int, lastRealDateTime time.Time, sor
 	return
 }
 
-// getCalculateValue 获取公式计算的结果
 func getCalculateValue(tableDataMap map[int]map[string]request.ManualDataReq, tag, row string, calculateCellMap map[string]string) (val string, err error) {
 	rowInt, err := strconv.Atoi(row)
 	if err != nil {
 		return
 	}
 
-	// 单元格的标签名
 	cellTagName := strings.ToUpper(tag) + row
 	val, ok := calculateCellMap[cellTagName]
 	if ok {
 		return
 	}
 
-	// 查找行数据
 	rowData, ok := tableDataMap[rowInt]
 	if !ok {
 		err = errors.New("查找" + row + "行的数据失败")
 		return
 	}
 
-	// 查找单元格数据
 	colData, ok := rowData[tag]
 	if !ok {
 		err = errors.New("查找单元格" + tag + row + "的数据失败")
 		return
 	}
 
-	// 如果不是计算单元格
 	if colData.DataType != 4 {
 		val = colData.ShowValue
 		return
 	}
 
-	// 如果是计算单元格
 	calculateCellMap[cellTagName] = ``
 
 	tagMap := make(map[string]float64)
@@ -920,12 +832,10 @@ func getCalculateValue(tableDataMap map[int]map[string]request.ManualDataReq, ta
 		tagMap[relationCellTagName], _ = tmpValDecimal.Float64()
 	}
 
-	// 计算
 	val, _, err = calculate(strings.ToUpper(colData.Value), tagMap)
 	if err != nil {
 		return
 	}
-	// 重新赋值
 	colData.ShowValue = val
 	tableDataMap[rowInt][tag] = colData
 	calculateCellMap[cellTagName] = val
@@ -933,7 +843,6 @@ func getCalculateValue(tableDataMap map[int]map[string]request.ManualDataReq, ta
 	return
 }
 
-// calculate 公式计算
 func calculate(calculateFormula string, TagMap map[string]float64) (calVal, errMsg string, err error) {
 	if calculateFormula == "" {
 		errMsg = "公式异常"
@@ -948,7 +857,6 @@ func calculate(calculateFormula string, TagMap map[string]float64) (calVal, errM
 	calculateFormula = strings.Replace(calculateFormula, "%", "*0.01", -1)
 
 	formulaFormStr := utils.ReplaceFormula(TagMap, calculateFormula)
-	//计算公式异常,那么就移除该指标
 	if formulaFormStr == `` {
 		errMsg = "公式异常"
 		err = errors.New(errMsg)
@@ -960,14 +868,12 @@ func calculate(calculateFormula string, TagMap map[string]float64) (calVal, errM
 	if err != nil {
 		errMsg = "计算失败"
 		err = errors.New("计算失败:Err:" + err.Error() + ";formulaStr:" + formulaFormStr)
-		// 分母为0的报错
 		if strings.Contains(err.Error(), "divide by zero") {
 			errMsg = "分母不能为0"
 			err = errors.New("分母不能为空,计算公式:" + formulaFormStr)
 		}
 		return
 	}
-	// 如果计算结果是NAN,那么就提示报错
 	if calResult.IsNan() {
 		errMsg = "计算失败"
 		err = errors.New("计算失败:计算结果是:NAN;formulaStr:" + formulaFormStr)
@@ -975,7 +881,6 @@ func calculate(calculateFormula string, TagMap map[string]float64) (calVal, errM
 	}
 	calVal = calResult.String()
 
-	// 转Decimal然后四舍五入
 	valDecimal, err := decimal.NewFromString(calVal)
 	if err != nil {
 		errMsg = "计算失败"

+ 0 - 4
services/data/future_good/base_future_good_lib.go

@@ -10,7 +10,6 @@ import (
 	"strings"
 )
 
-// AddEdbData 添加指标数据
 func AddEdbData(futureGoodEdbCode string) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["EdbCode"] = futureGoodEdbCode
@@ -19,7 +18,6 @@ func AddEdbData(futureGoodEdbCode string) (resp *models.BaseResponse, err error)
 	return
 }
 
-// RefreshEdbData 刷新指标数据
 func RefreshEdbData(futureGoodEdbInfoId int, futureGoodEdbCode, startDate string) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["FutureGoodEdbCode"] = futureGoodEdbCode
@@ -30,7 +28,6 @@ func RefreshEdbData(futureGoodEdbInfoId int, futureGoodEdbCode, startDate string
 	return
 }
 
-// RefreshEdbRelation 刷新商品期货指标相关的数据
 func RefreshEdbRelation(futureGoodEdbInfoId int) (resp *models.BaseResponse, err error) {
 	param := make(map[string]interface{})
 	param["FutureGoodEdbInfoId"] = futureGoodEdbInfoId
@@ -39,7 +36,6 @@ func RefreshEdbRelation(futureGoodEdbInfoId int) (resp *models.BaseResponse, err
 	return
 }
 
-// postRefreshEdbData 刷新指标数据
 func postRefreshEdbData(param map[string]interface{}, urlStr string) (resp *models.BaseResponse, err error) {
 	postUrl := utils.EDB_LIB_URL + urlStr
 	postData, err := json.Marshal(param)

+ 0 - 97
services/data/future_good/chart_info.go

@@ -15,7 +15,6 @@ import (
 	"time"
 )
 
-// GetChartEdbData 获取图表的指标数据
 func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMappingList []*models.ChartEdbInfoMapping, futureGoodEdbInfoMapping *models.ChartEdbInfoMapping, barChartInfoConf data_manage.FutureGoodBarChartInfoReq, needData bool) (barConfigEdbInfoIdList []data_manage.BarChartInfoEdbItemReq, edbList []*models.ChartEdbInfoMapping, xEdbIdValue []int, xDataList []data_manage.XData, yDataList []models.YData, err error) {
 	edbList = make([]*models.ChartEdbInfoMapping, 0)
 	barChartInfoDateList := barChartInfoConf.DateList
@@ -28,11 +27,8 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		return
 	}
 
-	// 指标对应的所有数据
 	edbDataListMap := make(map[int][]*models.EdbDataList)
 
-	// todo item
-	//item := new(models.ChartEdbInfoMapping)
 
 	if futureGoodEdbInfoMapping.Unit == `无` {
 		futureGoodEdbInfoMapping.Unit = ``
@@ -78,13 +74,11 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		futureGoodEdbInfoMapping.LeadUnitEn = data.GetLeadUnitEn(futureGoodEdbInfoMapping.LeadUnit)
 	}
 
-	//查询横轴配置项
 	xDataItemMap := make(map[int]data_manage.XData)
 	for k, v := range barChartInfoConf.XDataList {
 		xDataItemMap[k] = v
 	}
 
-	// 普通的指标数据
 	{
 		edbList = edbInfoMappingList
 
@@ -95,7 +89,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 				NameEn:    edbInfoMapping.EdbNameEn,
 				Source:    edbInfoMapping.Source,
 			}
-			// 如果有配置,则用配置中的指标名称替换
 			xItem, ok := xDataItemMap[k]
 			if ok && xItem.Name != "" {
 				tmp.Name = xItem.Name
@@ -106,13 +99,11 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		}
 	}
 
-	// 获取主力合约和最新日期
 	var zlFutureGoodEdbInfo *future_good2.FutureGoodEdbInfo
 	var latestDate string // 最新日期是这个
 	var regionType string // 交易所来源:“国内”,“海外”
 	var futureGoodEdbType int
 	{
-		// 寻找主力合约
 		zlFutureGoodEdbInfo, err = future_good2.GetFutureGoodEdbInfo(futureGoodEdbInfoMapping.EdbInfoId)
 		if err != nil {
 			return
@@ -120,7 +111,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		regionType = zlFutureGoodEdbInfo.RegionType
 		futureGoodEdbType = zlFutureGoodEdbInfo.FutureGoodEdbType
 
-		// 如果当前合约配置的 "画图时,日期来源的指标id" 并不是自己的话,那么就去查找对应配置的合约
 		if zlFutureGoodEdbInfo.DateSourceId != zlFutureGoodEdbInfo.FutureGoodEdbInfoId {
 			sourceDateFutureGoodEdbInfo, tmpErr := future_good2.GetFutureGoodEdbInfo(zlFutureGoodEdbInfo.DateSourceId)
 			if tmpErr != nil {
@@ -137,7 +127,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		}
 	}
 
-	// 获取期货指标以及期货数据
 	tmpFutureGoodEdbInfoList, err := future_good2.GetFutureGoodEdbInfoListByParentId(futureGoodEdbInfoMapping.EdbInfoId)
 	if err != nil {
 		return
@@ -199,7 +188,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 			NameEn:    fmt.Sprint("M+", v.Month),
 			Source:    newMappingInfo.Source,
 		}
-		// 判断如果有配置,需要替换为配置内容
 		xItem, ok := xDataItemMap[k]
 		if ok && xItem.Name != "" {
 			tmp.Name = xItem.Name
@@ -261,9 +249,7 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		return
 	}
 
-	// 获取数据
 
-	// 现货数据
 	for _, edbInfoMapping := range edbInfoMappingList {
 		dataList := make([]*models.EdbDataList, 0)
 		dataList, err = models.GetEdbDataList(edbInfoMapping.Source, edbInfoMapping.SubSource, edbInfoMapping.EdbInfoId, startDate, endDate)
@@ -271,8 +257,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 			return
 		}
 		edbDataListMap[edbInfoMapping.EdbInfoId] = dataList
-		// todo item
-		//item.DataList = dataList
 	}
 	futureEdbInfoIds := make([]int, 0)
 	for _, v := range futureGoodMappingList {
@@ -280,7 +264,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 	}
 	tmpDataListMap := make(map[int][]*future_good2.FutureGoodEdbData)
 	if len(futureEdbInfoIds) > 0 {
-		// 期货数据
 		tmpDataList, tmpErr := future_good2.GetFutureGoodEdbDataListByIdsAndDate(futureEdbInfoIds, startDate, endDate)
 		if tmpErr != nil {
 			err = tmpErr
@@ -329,16 +312,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		}
 	}
 
-	//yDataList =make([]models.YData,0)
-	//models.YData{
-	//	Date:           "",
-	//	Color:          "",
-	//	Name:           "",
-	//	NameEn:         "",
-	//	Value:          nil,
-	//	NoDataEdbList:  nil,
-	//	XEdbInfoIdList: nil,
-	//}
 	futureGoodEdbInfoIndexMap := make(map[int]int)
 	for index, v := range futureGoodEdbInfoList {
 		futureGoodEdbInfoIndexMap[v.FutureGoodEdbInfoId] = index
@@ -352,12 +325,10 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		valueList := make([]float64, 0)
 		noDataEdbIdMap := make(map[int]int)
 
-		// 所有的N值
 		for _, n := range tmpYData.M {
 			nMap[n] = n
 		}
 
-		// 基础指标
 		baseEdbIds := make([]int, 0)
 		for _, tmp := range edbInfoMappingList {
 			edbInfoIdList = append(edbInfoIdList, tmp.EdbInfoId)
@@ -380,7 +351,6 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 				noDataEdbIdMap[tmpEdbInfId] = tmpEdbInfId
 			}
 		}
-		//tmpYData.Value = valueList
 		tmpYData.NoDataEdbList = noDataEdbInfoIdList
 		yDataList[k] = tmpYData
 
@@ -388,9 +358,7 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 		tmpMaxIndex := lenEdbId - 1 // 当前数据的最大x轴的下标
 
 		for i := lenEdbId - 1; i >= 0; i-- {
-			// 如果没有在无数据的指标列表中找到,那么就找到了最大x轴的下标
 			if _, ok := noDataEdbIdMap[edbInfoIdList[i]]; !ok || utils.InArrayByInt(baseEdbIds, edbInfoIdList[i]) {
-				// 如果最大x轴的下标 小于 当前下标,那么就重新赋值
 				if maxIndex < i-1 {
 					maxIndex = i - 1
 				}
@@ -400,15 +368,12 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 			tmpMaxIndex = i - 1
 		}
 
-		// 如果最大x轴的下标 小于 当前下标,那么就重新赋值
 		if maxIndex < tmpMaxIndex {
 			maxIndex = tmpMaxIndex
 		}
 	}
 
-	//xEdbIdValue = xEdbIdValue[0:maxIndex]
 
-	// 找出所有的N值,并进行正序排列
 	nList := make([]int, 0)
 	for _, n := range nMap {
 		nList = append(nList, n)
@@ -439,10 +404,7 @@ func GetChartEdbData(chartInfoId int, startDate, endDate string, baseEdbInfoMapp
 	return
 }
 
-// BarChartData 获取数据
 func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMappingList []*models.ChartEdbInfoMapping, futureGoodMappingList []*future_good2.FutureGoodEdbInfo, edbDataListMap map[int][]*models.EdbDataList, barChartInfoDateList []data_manage.BarChartInfoDateReq, regionType, latestDate string) (edbIdList []int, yDataList []models.YData, err error) {
-	// 指标数据数组(10086:{"2022-12-02":100.01,"2022-12-01":102.3})
-	// 现货指标数据map
 	baseEdbDataMap := make(map[int]map[string]float64)
 	edbInfoMappingMap := make(map[int]struct{})
 	for _, v := range edbInfoMappingList {
@@ -458,7 +420,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 		}
 	}
 
-	// 期货指标数据map
 	futureGoodEdbDataMap := make(map[int]map[string]float64)
 	for edbInfoId, edbDataList := range edbDataListMap {
 		if _, ok := edbInfoMappingMap[edbInfoId]; ok {
@@ -471,7 +432,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 		futureGoodEdbDataMap[edbInfoId] = edbDateData
 	}
 
-	// edbIdList 指标展示顺序;x轴的指标顺序
 	edbIdList = make([]int, 0)
 	for _, v := range edbInfoMappingList {
 		edbIdList = append(edbIdList, v.EdbInfoId)
@@ -496,7 +456,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 		case 2: //近期几天
 			findDateTime = latestDateTime.AddDate(0, 0, -barChartInfoDate.Value)
 		case 3: // 固定日期
-			//寻找固定日期的数据
 			tmpFindDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, barChartInfoDate.Date, time.Local)
 			if tmpErr != nil {
 				err = tmpErr
@@ -517,14 +476,12 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 		noDataIdMap := make(map[int]int, 0) // 没有数据的指标map
 		xEdbInfoIdList := make([]int, 0)    // 当前数据的指标id列表
 
-		// 先找到基准日期
 		var realDateTime time.Time
 		realDateTime, findDataValue, isFind, tmpErr := GetNeedDateData(findDateTime, edbDataListMap[baseEdbInfoMapping.EdbInfoId], baseEdbDataMap[baseEdbInfoMapping.EdbInfoId], futureGoodEdbDataMap)
 		if tmpErr != nil {
 			err = tmpErr
 			return
 		}
-		// 处理其余现货指标
 		for _, v := range edbInfoMappingList {
 			if v.EdbInfoId == baseEdbInfoMapping.EdbInfoId {
 				findDataList = append(findDataList, findDataValue)
@@ -547,10 +504,7 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 			}
 			xEdbInfoIdList = append(xEdbInfoIdList, v.EdbInfoId)
 		}
-		//currMonth := findDateTime.Month() // 当前月份
-		//currYear := findDateTime.Year()   // 当前年份
 
-		// 用实际日期的月份作为基准,往前推12个月(2024-5-13 16:26:43修改)
 		currMonth := realDateTime.Month() // 当前月份
 		currYear := realDateTime.Year()   // 当前年份
 
@@ -584,12 +538,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 
 		for _, i := range indexList {
 			futureGoodMapping := futureGoodMappingList[i] // 当前的期货指标
-			//tmpRealDateTime, tmpFindDataValue, tmpIsFind, tmpErr := GetNeedDateData(findDateTime, edbDataListMap[futureGoodMapping.FutureGoodEdbInfoId], edbDataMap[futureGoodMapping.FutureGoodEdbInfoId])
-			//if tmpErr != nil {
-			//	err = tmpErr
-			//	return
-			//}
-			//tmpRealDateTime := findDateTime	// 按照配置找到的日期
 			tmpRealDateTime := realDateTime // 实际现货的日期
 			tmpFindDataValue, tmpIsFind := futureGoodEdbDataMap[futureGoodMapping.FutureGoodEdbInfoId][tmpRealDateTime.Format(utils.FormatDate)]
 			yDataMap[futureGoodMapping.FutureGoodEdbInfoId] = tmpFindDataValue
@@ -603,7 +551,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 				noDataIdList = append(noDataIdList, futureGoodMapping.FutureGoodEdbInfoId)
 				noDataIdMap[futureGoodMapping.FutureGoodEdbInfoId] = futureGoodMapping.FutureGoodEdbInfoId
 			}
-			// 当前期货合约的指标
 			xEdbInfoIdList = append(xEdbInfoIdList, futureGoodMapping.FutureGoodEdbInfoId)
 		}
 
@@ -627,7 +574,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 			yDate = maxDate.Format(utils.FormatDate)
 		}
 
-		// 数据处理,将没有数据的下标,赋值平均值
 		{
 			hasDataIndexList := make([]int, 0)
 			for dataK, edbInfoId := range xEdbInfoIdList {
@@ -643,10 +589,8 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 					preVal := findDataList[perK]            //上一个有数据的坐标的值
 					currVal := findDataList[currK]          //当前有数据的指标的值
 
-					// 环差值
 					hcValDeci := decimal.NewFromFloat(currVal).Sub(decimal.NewFromFloat(preVal)).Div(decimal.NewFromInt(int64(currK - perK)))
 					var tmpI int64
-					// 将两个中间的数据做平均值补全
 					for hcI := perK + 1; hcI < currK; hcI++ {
 						tmpI++
 						findDataList[hcI], _ = decimal.NewFromFloat(preVal).Add(hcValDeci.Mul(decimal.NewFromInt(tmpI))).RoundCeil(4).Float64()
@@ -672,7 +616,6 @@ func BarChartData(baseEdbInfoMapping *models.ChartEdbInfoMapping, edbInfoMapping
 	return
 }
 
-// handleResultData 处理成最终的结果数据
 func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDataList []models.YData, futureGoodEdbInfoList []*future_good2.FutureGoodEdbInfo, maxIndex int) (xDataList []data_manage.XData, newYDataList []models.YData, err error) {
 	xDataList = make([]data_manage.XData, 0)
 	newYDataList = yDataList
@@ -682,7 +625,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 			if i > maxIndex {
 				break
 			}
-			// todo x轴 内容调整
 			xDataList = append(xDataList, data_manage.XData{
 				Name:   fmt.Sprint("M+", i),
 				NameEn: fmt.Sprint("M+", i),
@@ -710,7 +652,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 			newYDataList[yIndex].Value = []float64{}
 			tmpNList := nList
 
-			//当前的主力合约
 			newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, yData.XEdbInfoIdList[0:baseEdbLen]...)
 			newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, yData.Value[0:baseEdbLen]...)
 
@@ -725,7 +666,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 						err = errors.New("找不到指标")
 						return
 					}
-					// 当前距离最早的日期相差的N数
 					if futureGoodEdbInfo.Month == n {
 						if needNum > 0 {
 							currVal := yData.Value[valIndex]
@@ -735,7 +675,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 							for tmpNum := 0; tmpNum < needNum; tmpNum++ {
 								newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, 0)
 
-								// 赋值平均值
 								tmpVal, _ := decimal.NewFromFloat(preVal).Add(hcValDeci.Mul(decimal.NewFromInt(int64(tmpNum + 1)))).RoundCeil(4).Float64()
 								newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, tmpVal)
 							}
@@ -785,9 +724,7 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 		findDateTime := v.ConfigDate
 		currMonth := findDateTime.Month() // 当前月份
 		currYear := findDateTime.Year()   // 当前年份
-		//v.XEdbInfoIdList
 		for edbInfoIndex, edbInfoId := range v.XEdbInfoIdList {
-			// 现货指标不处理
 			if edbInfoIndex <= baseEdbLen-1 {
 				continue
 			}
@@ -803,7 +740,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 
 	}
 
-	// 找出所有的N值,并进行正序排列
 	nList := make([]int, 0)
 	for _, n := range nMap {
 		nList = append(nList, n)
@@ -812,7 +748,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 		return nList[i] < nList[j]
 	})
 
-	//prevMonth := 1
 
 	for _, n := range nList {
 		xDataList = append(xDataList, data_manage.XData{
@@ -826,7 +761,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 		newYDataList[yIndex].Value = []float64{}
 		tmpNList := nList
 
-		//当前的主力合约
 		newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, yData.XEdbInfoIdList[0:baseEdbLen]...)
 		newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, yData.Value[0:baseEdbLen]...)
 
@@ -842,7 +776,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 					err = errors.New("找不到指标")
 					return
 				}
-				// 当前距离最早的日期相差的N数
 				divMonth := (futureGoodEdbInfo.Year-currDataTime.Year())*12 + (futureGoodEdbInfo.Month - int(currDataTime.Month()))
 				if divMonth == n {
 					if needNum > 0 {
@@ -853,7 +786,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 						for tmpNum := 0; tmpNum < needNum; tmpNum++ {
 							newYDataList[yIndex].XEdbInfoIdList = append(newYDataList[yIndex].XEdbInfoIdList, 0)
 
-							// 赋值平均值
 							tmpVal, _ := decimal.NewFromFloat(preVal).Add(hcValDeci.Mul(decimal.NewFromInt(int64(tmpNum + 1)))).RoundCeil(4).Float64()
 							newYDataList[yIndex].Value = append(newYDataList[yIndex].Value, tmpVal)
 						}
@@ -897,7 +829,6 @@ func handleResultData(regionType string, futureGoodEdbType, baseEdbLen int, yDat
 	return
 }
 
-// getFutureGoodEdbInfoList 获取适用的指标列表
 func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList []*future_good2.FutureGoodEdbInfo, barChartInfoDateList []data_manage.BarChartInfoDateReq) (earliestDateTime time.Time, futureGoodEdbInfoList []*future_good2.FutureGoodEdbInfo, err error) {
 	maxM := 36 //最大36期合约
 	futureGoodEdbInfoList = make([]*future_good2.FutureGoodEdbInfo, 0)
@@ -910,7 +841,6 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
 		case 2: //近期几天
 			findDateTime = latestDateTime.AddDate(0, 0, -barChartInfoDate.Value)
 		case 3: // 固定日期
-			//寻找固定日期的数据
 			tmpFindDateTime, tmpErr := time.ParseInLocation(utils.FormatDate, barChartInfoDate.Date, time.Local)
 			if tmpErr != nil {
 				err = tmpErr
@@ -935,16 +865,8 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
 			futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
 			continue
 		}
-		//海外的连续日期,目前
 		if v.FutureGoodEdbType == 2 {
 			if v.Month <= maxM {
-				//addMonth := int(earliestDateTime.Month()) + v.Month
-				//v.Year = earliestDateTime.Year() + addMonth/12
-				//realMonth := addMonth % 12
-				//if realMonth == 0 {
-				//	realMonth = 12
-				//}
-				//v.Month = realMonth
 				futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
 			}
 			continue
@@ -953,12 +875,10 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
 		if v.Year < earliestDateTime.Year() {
 			continue
 		}
-		// 小于等于当前年,那么就肯定是ok的
 		if v.Year <= earliestDateTime.Year() {
 			futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
 			continue
 		}
-		// 如果(当前年-最新日期的年份) * 12个月 + (当前月-最新日期的月份) 小于总月份
 		if (v.Year-earliestDateTime.Year())*12+(v.Month-int(earliestDateTime.Month())) <= maxM {
 			futureGoodEdbInfoList = append(futureGoodEdbInfoList, v)
 			continue
@@ -969,21 +889,16 @@ func getFutureGoodEdbInfoList(latestDateTime time.Time, tmpFutureGoodEdbInfoList
 	return
 }
 
-// GetNeedDateData 获取合约内需要的日期数据
 func GetNeedDateData(needDateTime time.Time, dataList []*models.EdbDataList, edbDataMap map[string]float64, allEdbDataMap map[int]map[string]float64) (findDateTime time.Time, findDataValue float64, isFind bool, err error) {
-	//dataList := edbDataListMap[edbInfoId] //指标的所有数据值
 	if len(dataList) <= 0 {
-		// 没有数据的指标id
 		return
 	}
 
-	//最早的日期
 	minDateTime, err := time.ParseInLocation(utils.FormatDate, dataList[0].DataTime, time.Local)
 	if err != nil {
 		return
 	}
 
-	// 该日期存在数据的期货指标的最小数量,目前是现货和期货各1个,总共2个
 	maxCount := 1
 
 	for tmpDateTime := needDateTime; tmpDateTime.After(minDateTime) || tmpDateTime.Equal(minDateTime); tmpDateTime = tmpDateTime.AddDate(0, 0, -1) {
@@ -993,7 +908,6 @@ func GetNeedDateData(needDateTime time.Time, dataList []*models.EdbDataList, edb
 			continue
 		}
 
-		// 该日期存在数据的指标数量
 		count := 0
 
 		for _, currEdbDataMap := range allEdbDataMap {
@@ -1006,13 +920,10 @@ func GetNeedDateData(needDateTime time.Time, dataList []*models.EdbDataList, edb
 			}
 		}
 
-		// 该日期存在数据的期货指标数量小于2个,那么要继续往前找
 		if count < maxCount {
 			continue
 		}
 
-		//如果能找到数据,那么就返回
-		// 数据为0,也直接返回,做无值处理
 		if tmpValue == 0 {
 			return
 		}
@@ -1025,10 +936,6 @@ func GetNeedDateData(needDateTime time.Time, dataList []*models.EdbDataList, edb
 	return
 }
 
-// FutureGoodChartInfoRefresh
-// @author Roc
-// @datetime 2023-2-2 18:44:46
-// @description 商品价格曲线图表刷新
 func FutureGoodChartInfoRefresh(chartInfoId int) (err error) {
 	var errMsg string
 	defer func() {
@@ -1047,26 +954,22 @@ func FutureGoodChartInfoRefresh(chartInfoId int) (err error) {
 	for _, edbInfoMapping := range edbInfoMappingList {
 		edbInfoIds = append(edbInfoIds, edbInfoMapping.EdbInfoId)
 	}
-	// 获取期货指标
 	futureGoodEdbInfoMapping, err := models.GetFutureGoodEdbChartEdbMapping(chartInfoId)
 	if err != nil {
 		errMsg = "获取需要刷新的商品期货指标失败:Err:" + err.Error()
 		return
 	}
 
-	// 获取期货指标以及期货数据
 	futureGoodEdbInfoList, err := future_good2.GetFutureGoodEdbInfoListByParentId(futureGoodEdbInfoMapping.EdbInfoId)
 	if err != nil {
 		return
 	}
 
-	// 批量刷新ETA指标
 	err, _ = data.EdbInfoRefreshAllFromBase(edbInfoIds, false)
 	if err != nil {
 		return
 	}
 
-	// 批量刷新期货指标
 	err = FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList, false)
 	if err != nil {
 		return

+ 0 - 6
services/data/future_good/future_edb_info.go

@@ -8,10 +8,6 @@ import (
 	"time"
 )
 
-// FutureGoodEdbInfoRefreshAllFromBase 批量刷新商品期货指标
-// @author Roc
-// @datetime 2022-09-16 11:04:44
-// @description 将原有的单个指标刷新,调整为批量多个指标刷新
 func FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList []*future_good.FutureGoodEdbInfo, refreshAll bool) (err error) {
 	var errMsg string
 	defer func() {
@@ -25,7 +21,6 @@ func FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList []*future_good.Fu
 		if bv.StartDate == "0000-00-00" {
 			continue
 		}
-		//开始时间
 		startDate = ``
 		if refreshAll { //刷新所有数据,用开始时间作为起始日期去刷新
 			sTime, err := time.Parse(utils.FormatDate, bv.StartDate)
@@ -54,7 +49,6 @@ func FutureGoodEdbInfoRefreshAllFromBase(futureGoodEdbInfoList []*future_good.Fu
 		}
 	}
 
-	// 刷新商品期货指标相关的数据
 	for _, bv := range futureGoodEdbInfoList {
 		if bv.ParentId == 0 {
 			RefreshEdbRelation(bv.FutureGoodEdbInfoId)

+ 0 - 6
services/data/handle_data.go

@@ -9,7 +9,6 @@ import (
 	"time"
 )
 
-// HandleDataByLinearRegression 插值法补充数据(线性方程式)
 func HandleDataByLinearRegression(edbInfoDataList []*models.EdbDataList, handleDataMap map[string]float64) (err error) {
 	if len(edbInfoDataList) < 2 {
 		return
@@ -19,25 +18,21 @@ func HandleDataByLinearRegression(edbInfoDataList []*models.EdbDataList, handleD
 	for _, v := range edbInfoDataList {
 		handleDataMap[v.DataTime] = v.Value
 
-		// 第一个数据就给过滤了,给后面的试用
 		if startEdbInfoData == nil {
 			startEdbInfoData = v
 			continue
 		}
 
-		// 获取两条数据之间相差的天数
 		startDataTime, _ := time.ParseInLocation(utils.FormatDate, startEdbInfoData.DataTime, time.Local)
 		currDataTime, _ := time.ParseInLocation(utils.FormatDate, v.DataTime, time.Local)
 		betweenHour := int(currDataTime.Sub(startDataTime).Hours())
 		betweenDay := betweenHour / 24
 
-		// 如果相差一天,那么过滤
 		if betweenDay <= 1 {
 			startEdbInfoData = v
 			continue
 		}
 
-		// 生成线性方程式
 		var a, b float64
 		{
 			coordinateData := make([]utils.Coordinate, 0)
@@ -59,7 +54,6 @@ func HandleDataByLinearRegression(edbInfoDataList []*models.EdbDataList, handleD
 			}
 		}
 
-		// 生成对应的值
 		{
 			for i := 1; i < betweenDay; i++ {
 				tmpDataTime := startDataTime.AddDate(0, 0, i)

+ 0 - 17
services/data/line_equation/chart_info.go

@@ -35,9 +35,7 @@ type LineEquationDataResp struct {
 	DataList            []models.EdbDataList
 }
 
-// GetChartEdbData 获取图表数据
 func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoReq, getAData, getBData, getR2Data bool) (edbList []*models.ChartEdbInfoMapping, dataResp LineEquationResp, err error, errMsg string) {
-	// 获取基本信息
 	mappingList, startDate, endDate, err, errMsg := getConfigData(lineChartInfoConfig)
 	if err != nil {
 		return
@@ -92,7 +90,6 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 	}
 
 	var baseEdbInfo *models.ChartEdbInfoMapping
-	// 获取确定以哪个指标的日期作为基准日期
 	{
 		var xEdbInfo, yEdbInfo *models.ChartEdbInfoMapping
 		for _, v := range mappingList {
@@ -113,7 +110,6 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 			return
 		}
 
-		// 时间截面规则:按照什么频率来取不同的截面的问题。原则是:按照X轴和Y轴所选择的第一个指标(X和Y分别有一个第一个指标),两个指标中,以低频的那个作为基准。如果X轴和Y轴是同频的,那以Y轴第一个指标的为准。
 		frequencyIntMap := map[string]int{
 			"日度": 1,
 			"周度": 2,
@@ -122,16 +118,13 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 			"季度": 5,
 			"年度": 6,
 		}
-		// 如果x是高频 或者 x与y是同频的,那么就是Y轴的第一个指标为主
 		if frequencyIntMap[xEdbInfo.Frequency] <= frequencyIntMap[yEdbInfo.Frequency] {
 			baseEdbInfo = yEdbInfo
 		} else {
-			// 否则是X轴的第一个指标是低频
 			baseEdbInfo = xEdbInfo
 		}
 	}
 
-	// 指标对应的所有数据
 	chartType := 1 //1:普通图,2:季节性图
 	calendar := "公历"
 	edbDataListMap, edbList, err := data.GetEdbDataMapList(chartInfoId, chartType, calendar, startDate, endDate, mappingList, "")
@@ -139,14 +132,11 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 		return
 	}
 
-	// 获取所有的日期
 	dateList := make([]string, 0)
 	for _, v := range edbDataListMap[baseEdbInfo.EdbInfoId] {
 		dateList = append(dateList, v.DataTime)
 	}
 
-	// 数据整理
-	// [日期][A指标id:值,B指标id:值]
 	dateEdbMap, err := handleData(baseEdbInfo.EdbInfoId, edbDataListMap)
 	if err != nil {
 		return
@@ -171,7 +161,6 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 		}
 		dataTime, _ := time.ParseInLocation(utils.FormatDate, date, time.Local)
 		timestamp := dataTime.UnixNano() / 1e6
-		// 只有存在两个坐标点的时候,才能去计算线性方程和R平方
 		if len(coordinateData) >= 2 {
 			a, b := utils.GetLinearResult(coordinateData)
 			if !math.IsNaN(a) && !math.IsNaN(b) && !math.IsInf(a, 0) && !math.IsInf(b, 0) {
@@ -219,7 +208,6 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 				}
 			}
 
-			// 计算R平方
 			if getR2Data {
 				tmpVal := utils.CalculationDecisive(coordinateData)
 				if math.IsNaN(tmpVal) || math.IsInf(tmpVal, 0) {
@@ -258,7 +246,6 @@ func GetChartEdbData(chartInfoId int, lineChartInfoConfig request.LineChartInfoR
 	return
 }
 
-// getConfigData 获取配置数据
 func getConfigData(lineChartInfoConfig request.LineChartInfoReq) (mappingList []*models.ChartEdbInfoMapping, startDate, endDate string, err error, errMsg string) {
 	dateType := lineChartInfoConfig.DateType
 	switch dateType {
@@ -269,7 +256,6 @@ func getConfigData(lineChartInfoConfig request.LineChartInfoReq) (mappingList []
 	case 3:
 		startDate = "2015-01-01"
 	case 4:
-		//startDate = strconv.Itoa(time.Now().Year()) + "-01-01"
 		startDate = "2021-01-01"
 	case 5:
 		startDate = lineChartInfoConfig.StartDate + "-01"
@@ -286,7 +272,6 @@ func getConfigData(lineChartInfoConfig request.LineChartInfoReq) (mappingList []
 		startDate = "2022-01-01"
 	}
 
-	//指标数据
 	edbInfoIdList := make([]int, 0)
 	{
 		edbInfoIdMap := make(map[int]int, 0)
@@ -310,12 +295,10 @@ func getConfigData(lineChartInfoConfig request.LineChartInfoReq) (mappingList []
 	return
 }
 
-// handleData 数据处理
 func handleData(baseEdbInfoId int, edbDataListMap map[int][]*models.EdbDataList) (dateEdbMap map[string]map[int]float64, err error) {
 	dateEdbMap = make(map[string]map[int]float64) // [日期][A指标id:值,B指标id:值]
 	for edbInfoId, edbDataList := range edbDataListMap {
 		if edbInfoId != baseEdbInfoId {
-			// 用上期的数据补充当期的数据处理
 			handleDataMap := make(map[string]float64)
 			err = models.HandleDataByPreviousData(edbDataList, handleDataMap)
 			if err != nil {

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio