Browse Source

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

Roc 11 months ago
parent
commit
ffff3bf5ab

+ 11 - 58
controllers/data_manage/correlation/correlation_chart_classify.go

@@ -8,7 +8,6 @@ import (
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
 	"eta/eta_api/utils"
-	"strconv"
 	"time"
 )
 
@@ -223,42 +222,15 @@ func (this *CorrelationChartClassifyController) AddChartClassify() {
 		return
 	}
 
-	source := utils.CHART_SOURCE_CORRELATION
-	count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, req.ParentId, source)
+	// 新增图表分类
+	_, err, errMsg, isSendEmail := data.AddChartClassify(req.ChartClassifyName, req.ParentId, req.Level, utils.CHART_SOURCE_CORRELATION, this.Lang, this.SysUser)
 	if err != nil {
-		br.Msg = "判断名称是否已存在失败"
-		br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-		return
-	}
-	if count > 0 {
-		br.Msg = "分类名称已存在,请重新输入"
-		br.IsSendEmail = false
-		return
-	}
-	//获取该层级下最大的排序数
-	maxSort, err := data_manage.GetChartClassifyMaxSort(req.ParentId, source)
-
-	classify := new(data_manage.ChartClassify)
-	//classify.ParentId = req.ParentId
-	classify.ParentId = 0
-	classify.ChartClassifyName = req.ChartClassifyName
-	classify.HasData = 0
-	classify.CreateTime = time.Now()
-	classify.ModifyTime = time.Now()
-	classify.SysUserId = this.SysUser.AdminId
-	classify.SysUserRealName = this.SysUser.RealName
-	classify.Level = req.Level + 1
-	timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
-	classify.UniqueCode = utils.MD5(utils.DATA_PREFIX + "_" + timestamp)
-	classify.Sort = maxSort + 1
-	classify.Source = source
-
-	_, err = data_manage.AddChartClassify(classify)
-	if err != nil {
-		br.Msg = "保存分类失败"
-		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "添加分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
+
 	br.Ret = 200
 	br.Msg = "添加成功"
 	br.Success = true
@@ -295,34 +267,15 @@ func (this *CorrelationChartClassifyController) EditChartClassify() {
 		return
 	}
 
-	item, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
+	// 编辑图表分类
+	_, err, errMsg, isSendEmail := data.EditChartClassify(req.ChartClassifyId, utils.CHART_SOURCE_CORRELATION, req.ChartClassifyName, this.Lang, this.SysUser)
 	if err != nil {
-		br.Msg = "保存失败"
-		br.Msg = "获取分类信息失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
 
-	source := utils.CHART_SOURCE_CORRELATION
-	if item.ChartClassifyName != req.ChartClassifyName {
-		count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, item.ParentId, source)
-		if err != nil {
-			br.Msg = "判断名称是否已存在失败"
-			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-			return
-		}
-		if count > 0 {
-			br.Msg = "分类名称已存在,请重新输入"
-			br.IsSendEmail = false
-			return
-		}
-
-		err = data_manage.EditChartClassify(req.ChartClassifyId, source, req.ChartClassifyName)
-		if err != nil {
-			br.Msg = "保存失败"
-			br.ErrMsg = "保存失败,Err:" + err.Error()
-			return
-		}
-	}
 	br.Ret = 200
 	br.Msg = "修改成功"
 	br.Success = true

+ 124 - 4
controllers/data_manage/correlation/correlation_chart_info.go

@@ -5,7 +5,7 @@ import (
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
 	"eta/eta_api/models/data_manage"
-	"eta/eta_api/models/data_manage/future_good/request"
+	"eta/eta_api/models/data_manage/correlation/request"
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
 	correlationServ "eta/eta_api/services/data/correlation"
@@ -165,7 +165,7 @@ func (this *CorrelationChartInfoController) Add() {
 		return
 	}
 
-	chartInfo, err, errMsg, isSendEmail := correlationServ.AddChartInfo(req, utils.CHART_SOURCE_CORRELATION, sysUser)
+	chartInfo, err, errMsg, isSendEmail := correlationServ.AddChartInfo(req, utils.CHART_SOURCE_CORRELATION, sysUser, this.Lang)
 	if err != nil {
 		br.Msg = "保存失败"
 		if errMsg != `` {
@@ -232,7 +232,7 @@ func (this *CorrelationChartInfoController) Edit() {
 		return
 	}
 
-	chartItem, err, errMsg, isSendEmail := correlationServ.EditChartInfo(req, sysUser)
+	chartItem, err, errMsg, isSendEmail := correlationServ.EditChartInfo(req, sysUser, this.Lang)
 	if err != nil {
 		br.Msg = "保存失败"
 		if errMsg != `` {
@@ -1134,7 +1134,7 @@ func (this *CorrelationChartInfoController) Copy() {
 		},
 	}
 
-	chartInfo, err, errMsg, isSendEmail := correlationServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, req.ChartClassifyId, req.ChartName, correlationChartInfoReq, oldChartInfo, sysUser)
+	chartInfo, err, errMsg, isSendEmail := correlationServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, req.ChartClassifyId, req.ChartName, correlationChartInfoReq, oldChartInfo, sysUser, this.Lang)
 
 	if err != nil {
 		br.Msg = "保存失败"
@@ -1701,3 +1701,123 @@ func (this *CorrelationChartInfoController) Newest() {
 	br.Msg = "获取成功"
 	br.Data = item
 }
+
+// BaseInfoEdit
+// @Title 编辑图表基础信息接口
+// @Description 编辑图表基础信息接口
+// @Param	request	body data_manage.EditChartInfoBaseReq true "type json string"
+// @Success Ret=200 编辑成功
+// @router /chart_info/base/edit [post]
+func (this *CorrelationChartInfoController) BaseInfoEdit() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req request.EditChartInfoBaseReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	req.ChartName = strings.Trim(req.ChartName, " ")
+	if req.ChartInfoId <= 0 {
+		br.Msg = "请选择图表"
+		return
+	}
+	if req.ChartName == "" {
+		br.Msg = "请输入图表名称"
+		return
+	}
+
+	chartItem, _, tips, e := correlationServ.GetChartAndCorrelationInfo(req.ChartInfoId)
+	if e != nil {
+		if tips != "" {
+			br.Msg = tips
+			return
+		}
+		br.Msg = "操作失败"
+		br.ErrMsg = "获取图表信息失败, Err: " + e.Error()
+		return
+	}
+
+	var condition string
+	var pars []interface{}
+
+	condition += " AND chart_info_id <> ? AND source = ? "
+	pars = append(pars, req.ChartInfoId, utils.CHART_SOURCE_CORRELATION)
+
+	switch this.Lang {
+	case utils.EnLangVersion:
+		condition += " AND chart_name_en = ? "
+	default:
+		condition += " AND chart_name = ? "
+	}
+	pars = append(pars, req.ChartName)
+	existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
+	if err != nil {
+		if err.Error() != utils.ErrNoRow() {
+			br.Msg = "判断英文图表名称是否存在失败"
+			br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
+			return
+		}
+	}
+	if err == nil && existItem.ChartInfoId > 0 {
+		br.Msg = existItem.ChartName + ":" + req.ChartName + "图表名称已存在"
+		return
+	}
+
+	switch this.Lang {
+	case utils.EnLangVersion:
+		chartItem.ChartNameEn = req.ChartName
+	default:
+		chartItem.ChartName = req.ChartName
+	}
+
+	chartItem.ModifyTime = time.Now().Local()
+	if e := chartItem.Update([]string{"ChartName", "ChartNameEn", "ModifyTime"}); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "更新图表信息失败, Err: " + e.Error()
+		return
+	}
+
+	//添加es数据
+	go data.EsAddOrEditChartInfo(chartItem.ChartInfoId)
+	//修改my eta es数据
+	go data.EsAddOrEditMyChartInfoByChartInfoId(chartItem.ChartInfoId)
+
+	//新增操作日志
+	{
+		chartLog := new(data_manage.ChartInfoLog)
+		chartLog.ChartName = chartItem.ChartName
+		chartLog.ChartInfoId = req.ChartInfoId
+		chartLog.ChartClassifyId = chartItem.ChartClassifyId
+		chartLog.SysUserId = sysUser.AdminId
+		chartLog.SysUserRealName = sysUser.RealName
+		chartLog.UniqueCode = chartItem.UniqueCode
+		chartLog.CreateTime = time.Now()
+		chartLog.Content = string(this.Ctx.Input.RequestBody)
+		chartLog.Status = "编辑相关性图表基础信息"
+		chartLog.Method = this.Ctx.Input.URL()
+		go data_manage.AddChartInfoLog(chartLog)
+	}
+
+	// 清除缓存
+	if utils.Re == nil && utils.Rc != nil {
+		_ = utils.Rc.Delete(utils.HZ_CHART_LIB_DETAIL + chartItem.UniqueCode) //图表分享链接缓存
+		_ = utils.Rc.Delete(data.GetChartInfoDataKey(req.ChartInfoId))
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "编辑成功"
+	br.IsAddLog = true
+}

+ 97 - 3
controllers/data_manage/cross_variety/chart_info.go

@@ -337,7 +337,8 @@ func (c *ChartInfoController) Add() {
 	}
 
 	// 添加图表
-	chartInfo, err, errMsg, isSendEmail := cross_variety.AddChartInfo(req, sysUser)
+	req.ChartNameEn = req.ChartName
+	chartInfo, err, errMsg, isSendEmail := cross_variety.AddChartInfo(req, sysUser, c.Lang)
 	if err != nil {
 		br.Msg = "保存失败"
 		if errMsg != `` {
@@ -404,7 +405,7 @@ func (c *ChartInfoController) Edit() {
 		return
 	}
 
-	chartItem, err, errMsg, isSendEmail := cross_variety.EditChartInfo(req, sysUser)
+	chartItem, err, errMsg, isSendEmail := cross_variety.EditChartInfo(req, sysUser, c.Lang)
 	if err != nil {
 		br.Msg = "保存失败"
 		if errMsg != `` {
@@ -808,9 +809,10 @@ func (c *ChartInfoController) Copy() {
 	config.Instructions = oldChartInfo.Instructions
 	config.MarkersLines = oldChartInfo.MarkersLines
 	config.MarkersAreas = oldChartInfo.MarkersAreas
+	config.ChartNameEn = oldChartInfo.ChartNameEn
 
 	// 添加图表
-	chartInfo, err, errMsg, isSendEmail := cross_variety.AddChartInfo(config, sysUser)
+	chartInfo, err, errMsg, isSendEmail := cross_variety.AddChartInfo(config, sysUser, c.Lang)
 	if err != nil {
 		br.Msg = "保存失败"
 		if errMsg != `` {
@@ -1806,3 +1808,95 @@ func (c *ChartInfoController) Save() {
 	br.Data = resp
 	br.IsAddLog = true
 }
+
+// BaseInfoEdit
+// @Title 编辑图表基础信息接口
+// @Description 编辑图表基础信息接口
+// @Param	request	body data_manage.EditChartBaseInfoReq true "type json string"
+// @Success Ret=200 编辑成功
+// @router /chart_info/base/edit [post]
+func (c *ChartInfoController) BaseInfoEdit() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		c.Data["json"] = br
+		c.ServeJSON()
+	}()
+	sysUser := c.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req request.EditChartBaseInfoReq
+	err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	req.ChartName = strings.Trim(req.ChartName, " ")
+	if req.ChartInfoId <= 0 {
+		br.Msg = "请选择图表"
+		return
+	}
+	if req.ChartName == "" {
+		br.Msg = "请输入图表名称"
+		return
+	}
+
+	//判断指标名称是否存在
+	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "图表已被删除,请刷新页面"
+			br.ErrMsg = "图表已被删除,请刷新页面"
+			return
+		}
+		br.Msg = "获取图表信息失败"
+		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
+		return
+	}
+
+	err = cross_varietyModels.EditChartBase(chartItem, req, c.Lang)
+	if err != nil {
+		br.Msg = "修改失败"
+		br.ErrMsg = "更新图表英文信息失败, Err: " + err.Error()
+		return
+	}
+
+	//添加es数据
+	go data.EsAddOrEditChartInfo(chartItem.ChartInfoId)
+	//修改my eta es数据
+	go data.EsAddOrEditMyChartInfoByChartInfoId(chartItem.ChartInfoId)
+
+	//指标 修改es信息
+	//go data.AddOrEditEdbInfoToEs(edbInfo.EdbInfoId)
+
+	//新增操作日志
+	{
+		chartLog := new(data_manage.ChartInfoLog)
+		chartLog.ChartName = chartItem.ChartName
+		chartLog.ChartInfoId = req.ChartInfoId
+		chartLog.ChartClassifyId = chartItem.ChartClassifyId
+		chartLog.SysUserId = sysUser.AdminId
+		chartLog.SysUserRealName = sysUser.RealName
+		chartLog.UniqueCode = chartItem.UniqueCode
+		chartLog.CreateTime = time.Now()
+		chartLog.Content = string(c.Ctx.Input.RequestBody)
+		chartLog.Status = "编辑跨品种分析图表基础信息"
+		chartLog.Method = c.Ctx.Input.URL()
+		go data_manage.AddChartInfoLog(chartLog)
+	}
+
+	// 清除缓存
+	if utils.Re == nil && utils.Rc != nil {
+		_ = utils.Rc.Delete(utils.HZ_CHART_LIB_DETAIL + chartItem.UniqueCode) //图表分享链接缓存
+		_ = utils.Rc.Delete(data.GetChartInfoDataKey(req.ChartInfoId))
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "编辑成功"
+	br.IsAddLog = true
+}

+ 5 - 24
controllers/data_manage/cross_variety/classify.go

@@ -135,34 +135,15 @@ func (c *ClassifyController) EditChartClassify() {
 		return
 	}
 
-	item, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
+	// 编辑图表分类
+	_, err, errMsg, isSendEmail := data.EditChartClassify(req.ChartClassifyId, utils.CHART_SOURCE_CROSS_HEDGING, req.ChartClassifyName, c.Lang, c.SysUser)
 	if err != nil {
-		br.Msg = "保存失败"
-		br.Msg = "获取分类信息失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
 
-	source := utils.CHART_SOURCE_CROSS_HEDGING
-	if item.ChartClassifyName != req.ChartClassifyName {
-		//count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, item.ParentId, source)
-		//if err != nil {
-		//	br.Msg = "判断名称是否已存在失败"
-		//	br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-		//	return
-		//}
-		//if count > 0 {
-		//	br.Msg = "分类名称已存在,请重新输入"
-		//	br.IsSendEmail = false
-		//	return
-		//}
-
-		err = data_manage.EditChartClassify(req.ChartClassifyId, source, req.ChartClassifyName)
-		if err != nil {
-			br.Msg = "保存失败"
-			br.ErrMsg = "保存失败,Err:" + err.Error()
-			return
-		}
-	}
 	br.Ret = 200
 	br.Msg = "修改成功"
 	br.Success = true

+ 8 - 2
controllers/data_manage/cross_variety/tag.go

@@ -59,6 +59,7 @@ func (c *TagController) Add() {
 	tag := &cross_variety.ChartTag{
 		ChartTagId:      0,
 		ChartTagName:    TagName,
+		ChartTagNameEn:  TagName,
 		SysUserId:       c.SysUser.AdminId,
 		SysUserRealName: c.SysUser.RealName,
 		ModifyTime:      time.Now(),
@@ -129,9 +130,14 @@ func (c *TagController) Edit() {
 	}
 
 	// 编辑
-	varietyInfo.ChartTagName = TagName
+	switch c.Lang {
+	case utils.EnLangVersion:
+		varietyInfo.ChartTagNameEn = TagName
+	default:
+		varietyInfo.ChartTagName = TagName
+	}
 	varietyInfo.ModifyTime = time.Now()
-	err = varietyInfo.Update([]string{"ChartTagName", "ModifyTime"})
+	err = varietyInfo.Update([]string{"ChartTagName", "ChartTagNameEn", "ModifyTime"})
 	if err != nil {
 		br.Msg = "修改标签失败"
 		br.ErrMsg = "修改标签失败,Err:" + err.Error()

+ 14 - 8
controllers/data_manage/cross_variety/variety.go

@@ -56,12 +56,13 @@ func (c *VarietyController) Add() {
 	}
 
 	variety := &cross_variety.ChartVariety{
-		ChartVarietyId:   0,
-		ChartVarietyName: varietyName,
-		SysUserId:        c.SysUser.AdminId,
-		SysUserRealName:  c.SysUser.RealName,
-		ModifyTime:       time.Now(),
-		CreateTime:       time.Now(),
+		ChartVarietyId:     0,
+		ChartVarietyName:   varietyName,
+		ChartVarietyNameEn: varietyName,
+		SysUserId:          c.SysUser.AdminId,
+		SysUserRealName:    c.SysUser.RealName,
+		ModifyTime:         time.Now(),
+		CreateTime:         time.Now(),
 	}
 	err = cross_variety.AddVariety(variety)
 	if err != nil {
@@ -128,9 +129,14 @@ func (c *VarietyController) Edit() {
 	}
 
 	// 编辑
-	varietyInfo.ChartVarietyName = varietyName
+	switch c.Lang {
+	case utils.EnLangVersion:
+		varietyInfo.ChartVarietyNameEn = varietyName
+	default:
+		varietyInfo.ChartVarietyName = varietyName
+	}
 	varietyInfo.ModifyTime = time.Now()
-	err = varietyInfo.Update([]string{"ChartVarietyName", "ModifyTime"})
+	err = varietyInfo.Update([]string{"ChartVarietyName", "ChartVarietyNameEn", "ModifyTime"})
 	if err != nil {
 		br.Msg = "修改品种失败"
 		br.ErrMsg = "修改品种失败,Err:" + err.Error()

+ 11 - 58
controllers/data_manage/line_equation/line_chart_classify.go

@@ -8,7 +8,6 @@ import (
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
 	"eta/eta_api/utils"
-	"strconv"
 	"time"
 )
 
@@ -205,42 +204,15 @@ func (this *LineEquationChartClassifyController) AddChartClassify() {
 		return
 	}
 
-	source := utils.CHART_SOURCE_LINE_EQUATION
-	count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, req.ParentId, source)
-	if err != nil {
-		br.Msg = "判断名称是否已存在失败"
-		br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-		return
-	}
-	if count > 0 {
-		br.Msg = "分类名称已存在,请重新输入"
-		br.IsSendEmail = false
-		return
-	}
-	//获取该层级下最大的排序数
-	maxSort, err := data_manage.GetChartClassifyMaxSort(req.ParentId, source)
-
-	classify := new(data_manage.ChartClassify)
-	//classify.ParentId = req.ParentId
-	classify.ParentId = 0
-	classify.ChartClassifyName = req.ChartClassifyName
-	classify.HasData = 0
-	classify.CreateTime = time.Now()
-	classify.ModifyTime = time.Now()
-	classify.SysUserId = this.SysUser.AdminId
-	classify.SysUserRealName = this.SysUser.RealName
-	classify.Level = req.Level + 1
-	timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
-	classify.UniqueCode = utils.MD5(utils.DATA_PREFIX + "_" + timestamp)
-	classify.Sort = maxSort + 1
-	classify.Source = source
-
-	_, err = data_manage.AddChartClassify(classify)
+	// 新增图表分类
+	_, err, errMsg, isSendEmail := data.AddChartClassify(req.ChartClassifyName, req.ParentId, req.Level, utils.CHART_SOURCE_LINE_EQUATION, this.Lang, this.SysUser)
 	if err != nil {
-		br.Msg = "保存分类失败"
-		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "添加分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
+
 	br.Ret = 200
 	br.Msg = "添加成功"
 	br.Success = true
@@ -277,34 +249,15 @@ func (this *LineEquationChartClassifyController) EditChartClassify() {
 		return
 	}
 
-	item, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
+	// 编辑图表分类
+	_, err, errMsg, isSendEmail := data.EditChartClassify(req.ChartClassifyId, utils.CHART_SOURCE_LINE_EQUATION, req.ChartClassifyName, this.Lang, this.SysUser)
 	if err != nil {
-		br.Msg = "保存失败"
-		br.Msg = "获取分类信息失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
 
-	source := utils.CHART_SOURCE_LINE_EQUATION
-	if item.ChartClassifyName != req.ChartClassifyName {
-		count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, item.ParentId, source)
-		if err != nil {
-			br.Msg = "判断名称是否已存在失败"
-			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-			return
-		}
-		if count > 0 {
-			br.Msg = "分类名称已存在,请重新输入"
-			br.IsSendEmail = false
-			return
-		}
-
-		err = data_manage.EditChartClassify(req.ChartClassifyId, source, req.ChartClassifyName)
-		if err != nil {
-			br.Msg = "保存失败"
-			br.ErrMsg = "保存失败,Err:" + err.Error()
-			return
-		}
-	}
 	br.Ret = 200
 	br.Msg = "修改成功"
 	br.Success = true

+ 123 - 2
controllers/data_manage/line_equation/line_chart_info.go

@@ -160,7 +160,7 @@ func (this *LineEquationChartInfoController) Save() {
 
 	resp := new(data_manage.AddChartInfoResp)
 	if req.MultipleGraphConfigId <= 0 {
-		batchAddChartList, err, errMsg, isSendEmail := line_equation.BatchAddChartInfo(req.BatchAddChart, req.ExtraConfig, sysUser)
+		batchAddChartList, err, errMsg, isSendEmail := line_equation.BatchAddChartInfo(req.BatchAddChart, req.ExtraConfig, sysUser, this.Lang)
 		if err != nil {
 			br.Msg = "保存失败"
 			if errMsg != `` {
@@ -1157,7 +1157,7 @@ func (this *LineEquationChartInfoController) Copy() {
 	})
 
 	resp := new(data_manage.AddChartInfoResp)
-	batchAddChartList, err, errMsg, isSendEmail := line_equation.BatchAddChartInfo(addChartList, lineChartInfoConf, sysUser)
+	batchAddChartList, err, errMsg, isSendEmail := line_equation.BatchAddChartInfo(addChartList, lineChartInfoConf, sysUser, this.Lang)
 	if err != nil {
 		br.Msg = "保存失败"
 		if errMsg != `` {
@@ -1664,3 +1664,124 @@ func (this *LineEquationChartInfoController) SearchByEs() {
 	br.Msg = "获取成功"
 	br.Data = resp
 }
+
+// BaseInfoEdit
+// @Title 编辑图表基础信息接口
+// @Description 编辑图表基础信息接口
+// @Param	request	body data_manage.EditChartBaseInfoReq true "type json string"
+// @Success Ret=200 编辑成功
+// @router /chart_info/base/edit [post]
+func (this *LineEquationChartInfoController) BaseInfoEdit() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req request.EditChartBaseInfoReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	req.ChartName = strings.Trim(req.ChartName, " ")
+	if req.ChartInfoId <= 0 {
+		br.Msg = "请选择图表"
+		return
+	}
+	if req.ChartName == "" {
+		br.Msg = "请输入英文图表名称"
+		return
+	}
+
+	//判断指标名称是否存在
+	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "图表已被删除,请刷新页面"
+			br.ErrMsg = "图表已被删除,请刷新页面"
+			return
+		}
+		br.Msg = "获取图表信息失败"
+		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
+		return
+	}
+
+	// 校验名称是否有重复
+	{
+		var condition string
+		var pars []interface{}
+		condition += " AND chart_info_id <> ? AND source = ? "
+		pars = append(pars, req.ChartInfoId, utils.CHART_SOURCE_LINE_EQUATION)
+		switch this.Lang {
+		case utils.EnLangVersion:
+			condition += "  AND chart_name_en = ? "
+		default:
+			condition += " AND chart_name = ? "
+		}
+		pars = append(pars, req.ChartName)
+		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
+		if err != nil {
+			if err.Error() != utils.ErrNoRow() {
+				br.Msg = "判断英文图表名称是否存在失败"
+				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
+				return
+			}
+		}
+		if err == nil && existItem.ChartInfoId > 0 {
+			br.Msg = existItem.ChartName + ":" + req.ChartName + "图表名称已存在"
+			return
+		}
+	}
+	switch this.Lang {
+	case utils.EnLangVersion:
+		chartItem.ChartNameEn = req.ChartName
+	default:
+		chartItem.ChartName = req.ChartName
+	}
+	chartItem.ModifyTime = time.Now().Local()
+	if e := chartItem.Update([]string{"ChartName", "ChartNameEn", "ModifyTime"}); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "更新图表信息失败, Err: " + e.Error()
+		return
+	}
+
+	//添加es数据
+	go data.EsAddOrEditChartInfo(chartItem.ChartInfoId)
+	//修改my eta es数据
+	go data.EsAddOrEditMyChartInfoByChartInfoId(chartItem.ChartInfoId)
+
+	//新增操作日志
+	{
+		chartLog := new(data_manage.ChartInfoLog)
+		chartLog.ChartName = chartItem.ChartName
+		chartLog.ChartInfoId = req.ChartInfoId
+		chartLog.ChartClassifyId = chartItem.ChartClassifyId
+		chartLog.SysUserId = sysUser.AdminId
+		chartLog.SysUserRealName = sysUser.RealName
+		chartLog.UniqueCode = chartItem.UniqueCode
+		chartLog.CreateTime = time.Now()
+		chartLog.Content = string(this.Ctx.Input.RequestBody)
+		chartLog.Status = "编辑拟合方程图表基础信息"
+		chartLog.Method = this.Ctx.Input.URL()
+		go data_manage.AddChartInfoLog(chartLog)
+	}
+
+	// 清除缓存
+	if utils.Re == nil && utils.Rc != nil {
+		_ = utils.Rc.Delete(utils.HZ_CHART_LIB_DETAIL + chartItem.UniqueCode) //图表分享链接缓存
+		_ = utils.Rc.Delete(data.GetChartInfoDataKey(req.ChartInfoId))
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "编辑成功"
+	br.IsAddLog = true
+}

+ 126 - 43
controllers/data_manage/line_feature/chart_info.go

@@ -753,7 +753,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 				RightMax:        fmt.Sprint(rightMaxVal),
 				ExtraConfig:     extraConfig,
 			}
-			chartInfo, err, errMsg, isSendEmail = lineFeatureServ.AddChartInfo(addChartReq, edbInfoMapping, chartSource, sysUser)
+			chartInfo, err, errMsg, isSendEmail = lineFeatureServ.AddChartInfo(addChartReq, edbInfoMapping, chartSource, sysUser, this.Lang)
 		} else {
 			editChartReq := data_manage.EditChartInfoReq{
 				ChartInfoId:     multipleGraphConfigChartMapping.ChartInfoId,
@@ -770,7 +770,7 @@ func (this *LineFeaturesChartInfoController) MultipleGraphConfigSaveChart() {
 				RightMax:        fmt.Sprint(rightMaxVal),
 				ExtraConfig:     extraConfig,
 			}
-			chartInfo, err, errMsg, isSendEmail = lineFeatureServ.EditChartInfo(editChartReq, edbInfoMapping, sysUser)
+			chartInfo, err, errMsg, isSendEmail = lineFeatureServ.EditChartInfo(editChartReq, edbInfoMapping, sysUser, this.Lang)
 			if err != nil {
 				br.Msg = "保存失败"
 				if errMsg != `` {
@@ -929,7 +929,7 @@ func CopyMultipleGraphConfigSaveChart(req request.SaveMultipleGraphChartReq, thi
 			return
 		}
 
-		chartInfo, err, errMsg, isSendEmail = lineFeatureServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, req.Source, req.ClassifyId, req.ChartName, edbInfoMapping, oldChartInfo, sysUser)
+		chartInfo, err, errMsg, isSendEmail = lineFeatureServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, req.Source, req.ClassifyId, req.ChartName, edbInfoMapping, oldChartInfo, sysUser, this.Lang)
 	}
 
 	if err != nil {
@@ -2252,7 +2252,7 @@ func (this *LineFeaturesChartInfoController) Copy() {
 	edbInfoMapping := edbMappingList[0]
 
 	// 批量设置图
-	chartInfo, err, errMsg, isSendEmail := lineFeatureServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, multipleGraphConfigChartMapping.Source, req.ChartClassifyId, req.ChartName, edbInfoMapping, oldChartInfo, sysUser)
+	chartInfo, err, errMsg, isSendEmail := lineFeatureServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, multipleGraphConfigChartMapping.Source, req.ChartClassifyId, req.ChartName, edbInfoMapping, oldChartInfo, sysUser, this.Lang)
 
 	if err != nil {
 		br.Msg = "复制失败"
@@ -2797,42 +2797,125 @@ func (this *LineFeaturesChartInfoController) SearchByEs() {
 	br.Data = resp
 }
 
-// fix 统计分析/统计特征的标准差、百分位图表时间范围与曲线图一致
-//func init() {
-//	condition := ` AND source in (7,8) `
-//	list, err := data_manage.GetChartInfoListByCondition(condition, []interface{}{}, 0, 1000)
-//	if err != nil {
-//		fmt.Println("err:", err)
-//		return
-//	}
-//
-//	for _, v := range list {
-//		item, tmpErr := data_manage.GetMultipleGraphConfigChartMappingByChartId(v.ChartInfoId)
-//		if tmpErr != nil {
-//			fmt.Println("tmpErr:", tmpErr)
-//			continue
-//		}
-//
-//		multipleGraphConfig, e := data_manage.GetMultipleGraphConfigById(item.MultipleGraphConfigId)
-//		if e != nil {
-//			fmt.Println("获取批量配置信息失败:", e)
-//			continue
-//		}
-//
-//		var configSave request.ConfigSave
-//		err = json.Unmarshal([]byte(multipleGraphConfig.Curve), &configSave)
-//		if err != nil {
-//			fmt.Println("格式化配置项失败,Err:" + err.Error())
-//			return
-//		}
-//
-//		v.StartDate = configSave.Curve.StartDate
-//		v.EndDate = configSave.Curve.EndDate
-//		v.DateType = configSave.Curve.DateType
-//		err = v.Update([]string{"StartDate", "EndDate", "DateType"})
-//
-//		if err != nil {
-//			fmt.Println(v.ChartInfoId, "修复历史数据失败:", err)
-//		}
-//	}
-//}
+// BaseInfoEdit
+// @Title 编辑图表基础信息接口
+// @Description 编辑图表基础信息接口
+// @Param	request	body data_manage.EditChartInfoBaseReq true "type json string"
+// @Success Ret=200 编辑成功
+// @router /chart_info/base/edit [post]
+func (this *LineFeaturesChartInfoController) BaseInfoEdit() {
+	br := new(models.BaseResponse).Init()
+	defer func() {
+		this.Data["json"] = br
+		this.ServeJSON()
+	}()
+	sysUser := this.SysUser
+	if sysUser == nil {
+		br.Msg = "请登录"
+		br.ErrMsg = "请登录,SysUser Is Empty"
+		br.Ret = 408
+		return
+	}
+	var req request.EditChartInfoBaseReq
+	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
+	if err != nil {
+		br.Msg = "参数解析异常!"
+		br.ErrMsg = "参数解析失败,Err:" + err.Error()
+		return
+	}
+	req.ChartName = strings.Trim(req.ChartName, " ")
+	if req.ChartInfoId <= 0 {
+		br.Msg = "请选择图表"
+		return
+	}
+	if req.ChartName == "" {
+		br.Msg = "请输入英文图表名称"
+		return
+	}
+
+	//判断指标名称是否存在
+	chartItem, err := data_manage.GetChartInfoById(req.ChartInfoId)
+	if err != nil {
+		if err.Error() == utils.ErrNoRow() {
+			br.Msg = "图表已被删除,请刷新页面"
+			br.ErrMsg = "图表已被删除,请刷新页面"
+			return
+		}
+		br.Msg = "获取图表信息失败"
+		br.ErrMsg = "获取图表信息失败,Err:" + err.Error()
+		return
+	}
+
+	// 校验名称是否有重复
+	{
+		var condition string
+		var pars []interface{}
+		condition += " AND chart_info_id <> ? AND source in (?,?,?) "
+		pars = append(pars, req.ChartInfoId, utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, utils.CHART_SOURCE_LINE_FEATURE_PERCENTILE, utils.CHART_SOURCE_LINE_FEATURE_FREQUENCY)
+
+		switch this.Lang {
+		case utils.EnLangVersion:
+			condition += " AND chart_name_en = ? "
+		default:
+			condition += " AND chart_name = ? "
+		}
+		pars = append(pars, req.ChartName)
+		existItem, err := data_manage.GetChartInfoByCondition(condition, pars)
+		if err != nil {
+			if err.Error() != utils.ErrNoRow() {
+				br.Msg = "判断英文图表名称是否存在失败"
+				br.ErrMsg = "判断英文图表名称是否存在失败,Err:" + err.Error()
+				return
+			}
+		}
+		if err == nil && existItem.ChartInfoId > 0 {
+			br.Msg = existItem.ChartName + ":" + req.ChartName + "图表名称已存在"
+			return
+		}
+	}
+
+	switch this.Lang {
+	case utils.EnLangVersion:
+		chartItem.ChartNameEn = req.ChartName
+	default:
+		chartItem.ChartName = req.ChartName
+	}
+	chartItem.ModifyTime = time.Now().Local()
+	if e := chartItem.Update([]string{"ChartName", "ChartNameEn", "ModifyTime"}); e != nil {
+		br.Msg = "操作失败"
+		br.ErrMsg = "更新图表信息失败, Err: " + e.Error()
+		return
+	}
+
+	//添加es数据
+	go data.EsAddOrEditChartInfo(chartItem.ChartInfoId)
+	//修改my eta es数据
+	go data.EsAddOrEditMyChartInfoByChartInfoId(chartItem.ChartInfoId)
+
+	//新增操作日志
+	{
+		chartLog := new(data_manage.ChartInfoLog)
+		chartLog.ChartName = chartItem.ChartName
+		chartLog.ChartInfoId = req.ChartInfoId
+		chartLog.ChartClassifyId = chartItem.ChartClassifyId
+		chartLog.SysUserId = sysUser.AdminId
+		chartLog.SysUserRealName = sysUser.RealName
+		chartLog.UniqueCode = chartItem.UniqueCode
+		chartLog.CreateTime = time.Now()
+		chartLog.Content = string(this.Ctx.Input.RequestBody)
+		chartLog.Status = "编辑统计特征图表基础信息"
+		chartLog.Method = this.Ctx.Input.URL()
+		go data_manage.AddChartInfoLog(chartLog)
+	}
+
+	// 清除缓存
+	if utils.Re == nil && utils.Rc != nil {
+		_ = utils.Rc.Delete(utils.HZ_CHART_LIB_DETAIL + chartItem.UniqueCode) //图表分享链接缓存
+		_ = utils.Rc.Delete(data.GetChartInfoDataKey(req.ChartInfoId))
+	}
+
+	br.Ret = 200
+	br.Success = true
+	br.Msg = "编辑成功"
+	br.IsAddLog = true
+}

+ 11 - 58
controllers/data_manage/line_feature/classify.go

@@ -8,7 +8,6 @@ import (
 	"eta/eta_api/models/system"
 	"eta/eta_api/services/data"
 	"eta/eta_api/utils"
-	"strconv"
 	"time"
 )
 
@@ -205,42 +204,15 @@ func (this *LineFeaturesChartClassifyController) AddChartClassify() {
 		return
 	}
 
-	source := utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION
-	count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, req.ParentId, source)
-	if err != nil {
-		br.Msg = "判断名称是否已存在失败"
-		br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-		return
-	}
-	if count > 0 {
-		br.Msg = "分类名称已存在,请重新输入"
-		br.IsSendEmail = false
-		return
-	}
-	//获取该层级下最大的排序数
-	maxSort, err := data_manage.GetChartClassifyMaxSort(req.ParentId, source)
-
-	classify := new(data_manage.ChartClassify)
-	//classify.ParentId = req.ParentId
-	classify.ParentId = 0
-	classify.ChartClassifyName = req.ChartClassifyName
-	classify.HasData = 0
-	classify.CreateTime = time.Now()
-	classify.ModifyTime = time.Now()
-	classify.SysUserId = this.SysUser.AdminId
-	classify.SysUserRealName = this.SysUser.RealName
-	classify.Level = req.Level + 1
-	timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
-	classify.UniqueCode = utils.MD5(utils.DATA_PREFIX + "_" + timestamp)
-	classify.Sort = maxSort + 1
-	classify.Source = source
-
-	_, err = data_manage.AddChartClassify(classify)
+	// 新增图表分类
+	_, err, errMsg, isSendEmail := data.AddChartClassify(req.ChartClassifyName, req.ParentId, req.Level, utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, this.Lang, this.SysUser)
 	if err != nil {
-		br.Msg = "保存分类失败"
-		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "添加分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
+
 	br.Ret = 200
 	br.Msg = "添加成功"
 	br.Success = true
@@ -277,34 +249,15 @@ func (this *LineFeaturesChartClassifyController) EditChartClassify() {
 		return
 	}
 
-	item, err := data_manage.GetChartClassifyById(req.ChartClassifyId)
+	// 编辑图表分类
+	_, err, errMsg, isSendEmail := data.EditChartClassify(req.ChartClassifyId, utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION, req.ChartClassifyName, this.Lang, this.SysUser)
 	if err != nil {
-		br.Msg = "保存失败"
-		br.Msg = "获取分类信息失败,Err:" + err.Error()
+		br.Msg = errMsg
+		br.ErrMsg = "保存分类失败,Err:" + err.Error()
+		br.IsSendEmail = isSendEmail
 		return
 	}
 
-	source := utils.CHART_SOURCE_LINE_FEATURE_STANDARD_DEVIATION
-	if item.ChartClassifyName != req.ChartClassifyName {
-		count, err := data_manage.GetChartClassifyCount(req.ChartClassifyName, item.ParentId, source)
-		if err != nil {
-			br.Msg = "判断名称是否已存在失败"
-			br.ErrMsg = "判断名称是否已存在失败,Err:" + err.Error()
-			return
-		}
-		if count > 0 {
-			br.Msg = "分类名称已存在,请重新输入"
-			br.IsSendEmail = false
-			return
-		}
-
-		err = data_manage.EditChartClassify(req.ChartClassifyId, source, req.ChartClassifyName)
-		if err != nil {
-			br.Msg = "保存失败"
-			br.ErrMsg = "保存失败,Err:" + err.Error()
-			return
-		}
-	}
 	br.Ret = 200
 	br.Msg = "修改成功"
 	br.Success = true

+ 3 - 3
controllers/data_manage/multiple_graph_config.go

@@ -851,7 +851,7 @@ func (this *ChartInfoController) MultipleGraphConfigSaveChart() {
 					Calendar:             "公历",
 					CorrelationChartInfo: correlationChartInfoReq,
 				}
-				chartInfo, err, errMsg, isSendEmail = correlationServ.AddChartInfo(addChartReq, chartSource, sysUser)
+				chartInfo, err, errMsg, isSendEmail = correlationServ.AddChartInfo(addChartReq, chartSource, sysUser, this.Lang)
 			} else {
 				editChartReq := data_manage.EditChartInfoReq{
 					ChartInfoId:          multipleGraphConfigChartMapping.ChartInfoId,
@@ -861,7 +861,7 @@ func (this *ChartInfoController) MultipleGraphConfigSaveChart() {
 					Calendar:             "公历",
 					CorrelationChartInfo: correlationChartInfoReq,
 				}
-				chartInfo, err, errMsg, isSendEmail = correlationServ.EditChartInfo(editChartReq, sysUser)
+				chartInfo, err, errMsg, isSendEmail = correlationServ.EditChartInfo(editChartReq, sysUser, this.Lang)
 				if err != nil {
 					br.Msg = "保存失败"
 					if errMsg != `` {
@@ -1092,7 +1092,7 @@ func CopyMultipleGraphConfigSaveChart(req request.SaveMultipleGraphChartReq, thi
 				},
 			}
 
-			chartInfo, err, errMsg, isSendEmail = correlationServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, req.ClassifyId, req.ChartName, correlationChartInfoReq, oldChartInfo, sysUser)
+			chartInfo, err, errMsg, isSendEmail = correlationServ.CopyChartInfo(multipleGraphConfigChartMapping.MultipleGraphConfigId, req.ClassifyId, req.ChartName, correlationChartInfoReq, oldChartInfo, sysUser, this.Lang)
 		}
 	default:
 		br.Msg = "错误的来源"

+ 1 - 1
models/data_manage/chart_info.go

@@ -13,7 +13,7 @@ import (
 
 type ChartInfo struct {
 	ChartInfoId       int    `orm:"column(chart_info_id);pk"`
-	ChartName         string `description:"来源名称"`
+	ChartName         string `description:"图表名称"`
 	ChartNameEn       string `description:"英文图表名称"`
 	ChartClassifyId   int    `description:"图表分类id"`
 	SysUserId         int

+ 15 - 0
models/data_manage/correlation/request/chart.go

@@ -0,0 +1,15 @@
+package request
+
+// EditChartEnInfoReq
+// @Description: 编辑图表英文信息请求
+type EditChartEnInfoReq struct {
+	ChartInfoId int    `description:"图表ID"`
+	ChartNameEn string `description:"英文图表名称"`
+}
+
+// EditChartInfoBaseReq
+// @Description: 编辑图表基础信息请求
+type EditChartInfoBaseReq struct {
+	ChartInfoId int    `description:"图表ID"`
+	ChartName   string `description:"英文图表名称"`
+}

+ 72 - 0
models/data_manage/cross_variety/chart_info_cross_variety.go

@@ -3,6 +3,7 @@ package cross_variety
 import (
 	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/data_manage/cross_variety/request"
+	"eta/eta_api/utils"
 	"fmt"
 	"github.com/beego/beego/v2/client/orm"
 	"strings"
@@ -262,3 +263,74 @@ func EditChartEn(chartInfo *data_manage.ChartInfo, req request.EditChartEnInfoRe
 
 	return
 }
+
+// EditChartBase
+// @Description: 修改图表基础信息
+// @author: Roc
+// @datetime 2023-11-28 21:17:27
+// @param chartInfo *data_manage.ChartInfo
+// @param req request.EditChartBaseInfoReq
+// @param lang string
+// @return err error
+func EditChartBase(chartInfo *data_manage.ChartInfo, req request.EditChartBaseInfoReq, lang string) (err error) {
+	o := orm.NewOrmUsingDB("data")
+	to, err := o.Begin()
+	if err != nil {
+		return
+	}
+	defer func() {
+		if err != nil {
+			_ = to.Rollback()
+		} else {
+			_ = to.Commit()
+		}
+	}()
+
+	// 更新图表信息
+	switch lang {
+	case utils.EnLangVersion:
+		chartInfo.ChartNameEn = req.ChartName
+	default:
+		chartInfo.ChartName = req.ChartName
+	}
+	chartInfo.ModifyTime = time.Now().Local()
+	_, err = to.Update(chartInfo, "ChartName", "ChartNameEn", "ModifyTime")
+	if err != nil {
+		fmt.Println("UPDATE  chart_info Err:", err.Error())
+		return err
+	}
+
+	// 更新标签名
+	for _, v := range req.TagList {
+		var sql string
+		switch lang {
+		case utils.EnLangVersion:
+			sql = `UPDATE chart_tag SET chart_tag_name_en = ?,modify_time= NOW() WHERE chart_tag_id = ? `
+		default:
+			sql = `UPDATE chart_tag SET chart_tag_name = ?,modify_time= NOW() WHERE chart_tag_id = ? `
+		}
+		if sql != `` {
+			_, err = o.Raw(sql, v.TagName, v.ChartTagId).Exec()
+			if err != nil {
+				return
+			}
+		}
+	}
+
+	// 更新品种名
+	for _, v := range req.VarietyList {
+		var sql string
+		switch lang {
+		case utils.EnLangVersion:
+			sql = `UPDATE chart_variety SET chart_variety_name_en = ?,modify_time= NOW() WHERE chart_variety_id = ? `
+		default:
+			sql = `UPDATE chart_variety SET chart_variety_name = ?,modify_time= NOW() WHERE chart_variety_id = ? `
+		}
+		_, err = o.Raw(sql, v.VarietyName, v.ChartVarietyId).Exec()
+		if err != nil {
+			return
+		}
+	}
+
+	return
+}

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

@@ -25,6 +25,7 @@ type ChartConfigDate struct {
 // @Description: 添加图表的请求
 type AddChartReq struct {
 	ChartName      string `description:"图表名称"`
+	ChartNameEn    string `description:"英文图表名称"`
 	XMin           string `description:"图表X轴最小值"`
 	XMax           string `description:"图表X轴最大值"`
 	LeftMin        string `description:"图表左侧最小值"`
@@ -92,3 +93,26 @@ type SaveChartReq struct {
 	LeftMin     string `description:"图表左侧最小值"`
 	LeftMax     string `description:"图表左侧最大值"`
 }
+
+// EditChartBaseInfoReq
+// @Description: 编辑图表基础信息
+type EditChartBaseInfoReq struct {
+	ChartInfoId int                  `description:"图表ID"`
+	ChartName   string               `description:"图表名称(根据语言版本不同而不同)"`
+	TagList     []TagNameBaseReq     `description:"标签名称"`
+	VarietyList []VarietyNameBaseReq `description:"标签名称"`
+}
+
+// TagNameBaseReq
+// @Description: 标签基础名称修改
+type TagNameBaseReq struct {
+	ChartTagId int    `json:"ChartTagId"`
+	TagName    string `description:"标签名称(根据语言版本不同而不同)"`
+}
+
+// VarietyNameBaseReq
+// @Description: 品种基础名称修改
+type VarietyNameBaseReq struct {
+	ChartVarietyId int    `json:"ChartVarietyId"`
+	VarietyName    string `description:"品种名称(根据语言版本不同而不同)"`
+}

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

@@ -36,3 +36,9 @@ type EditChartEnInfoReq struct {
 	ChartInfoId int    `description:"图表ID"`
 	ChartNameEn string `description:"英文图表名称"`
 }
+
+// EditChartBaseInfoReq 编辑图表基础信息
+type EditChartBaseInfoReq struct {
+	ChartInfoId int    `description:"图表ID"`
+	ChartName   string `description:"图表名称(根据当前语言版本不同而不同)"`
+}

+ 2 - 0
models/data_manage/line_feature/line_feature.go

@@ -67,6 +67,7 @@ func EditLineFeatureChartAndMapping(req *data_manage.EditChartInfoReq, edbInfoId
 	}()
 	var pars []interface{}
 	pars = append(pars, req.ChartName)
+	pars = append(pars, req.ChartNameEn)
 	pars = append(pars, edbInfoIdStr)
 	pars = append(pars, req.ChartClassifyId)
 	pars = append(pars, disabled)
@@ -75,6 +76,7 @@ func EditLineFeatureChartAndMapping(req *data_manage.EditChartInfoReq, edbInfoId
 	sql := ` UPDATE  chart_info
 			SET
 			  chart_name =?,
+			  chart_name_en =?,
               edb_info_ids=?,
 			  chart_classify_id = ?,
 			  modify_time = NOW(),

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

@@ -107,3 +107,9 @@ type SaveMultipleGraphEdbReq struct {
 	FrequencyDistribution FrequencyDistribution `description:"频率分布配置"`
 	IsSaveAs              bool                  `description:"是否另存为,true的话,就是另存为,不会建立与配置的关系"`
 }
+
+// EditChartInfoBaseReq 编辑图表基础信息
+type EditChartInfoBaseReq struct {
+	ChartInfoId int    `description:"图表ID"`
+	ChartName   string `description:"英文名称(根据当前语言版本不同而不同)"`
+}

+ 36 - 0
routers/commentsRouter.go

@@ -142,6 +142,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/correlation:CorrelationChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/correlation:CorrelationChartInfoController"],
+        beego.ControllerComments{
+            Method: "BaseInfoEdit",
+            Router: `/chart_info/base/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/correlation:CorrelationChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/correlation:CorrelationChartInfoController"],
         beego.ControllerComments{
             Method: "Copy",
@@ -250,6 +259,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/cross_variety:ChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/cross_variety:ChartInfoController"],
+        beego.ControllerComments{
+            Method: "BaseInfoEdit",
+            Router: `/chart_info/base/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/cross_variety:ChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/cross_variety:ChartInfoController"],
         beego.ControllerComments{
             Method: "Copy",
@@ -1348,6 +1366,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_equation:LineEquationChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_equation:LineEquationChartInfoController"],
+        beego.ControllerComments{
+            Method: "BaseInfoEdit",
+            Router: `/chart_info/base/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_equation:LineEquationChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_equation:LineEquationChartInfoController"],
         beego.ControllerComments{
             Method: "Copy",
@@ -1519,6 +1546,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_feature:LineFeaturesChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_feature:LineFeaturesChartInfoController"],
+        beego.ControllerComments{
+            Method: "BaseInfoEdit",
+            Router: `/chart_info/base/edit`,
+            AllowHTTPMethods: []string{"post"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_feature:LineFeaturesChartInfoController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/line_feature:LineFeaturesChartInfoController"],
         beego.ControllerComments{
             Method: "Copy",

+ 56 - 38
services/data/correlation/chart_info.go

@@ -647,7 +647,7 @@ func GetChartAndCorrelationInfo(chartInfoId int) (chartInfo *data_manage.ChartIn
 }
 
 // AddChartInfo 添加图表
-func AddChartInfo(req data_manage.AddChartInfoReq, source int, sysUser *system.Admin) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func AddChartInfo(req data_manage.AddChartInfoReq, source int, sysUser *system.Admin, lang string) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	req.ChartName = strings.Trim(req.ChartName, " ")
@@ -761,29 +761,39 @@ func AddChartInfo(req data_manage.AddChartInfoReq, source int, sysUser *system.A
 	}
 	edbInfoIdStr := strings.Join(edbInfoIdArrStr, ",")
 	var chartInfoId int
+
 	// 判断图表是否存在
-	var condition string
-	var pars []interface{}
-	condition += " AND chart_name=? AND source = ? "
-	pars = append(pars, req.ChartName, source)
-	count, err := data_manage.GetChartInfoCountByCondition(condition, pars)
-	if err != nil {
-		errMsg = "判断图表名称是否存在失败"
-		err = errors.New("判断图表名称是否存在失败,Err:" + err.Error())
-		return
-	}
+	{
+		var condition string
+		var pars []interface{}
+
+		switch lang {
+		case utils.EnLangVersion:
+			condition += " AND chart_name_en = ? AND source = ? "
+		default:
+			condition += " AND chart_name=? AND source = ? "
+		}
+		pars = append(pars, req.ChartName, source)
+		count, tmpErr := data_manage.GetChartInfoCountByCondition(condition, pars)
+		if tmpErr != nil {
+			errMsg = "判断图表名称是否存在失败"
+			err = errors.New("判断图表名称是否存在失败,Err:" + tmpErr.Error())
+			return
+		}
 
-	if count > 0 {
-		errMsg = "图表已存在,请重新填写"
-		err = errors.New(errMsg)
-		isSendEmail = false
-		return
+		if count > 0 {
+			errMsg = "图表已存在,请重新填写"
+			err = errors.New(errMsg)
+			isSendEmail = false
+			return
+		}
 	}
 
 	disableVal := data.CheckIsDisableChart(edbInfoIdArr)
 
 	chartInfo = new(data_manage.ChartInfo)
 	chartInfo.ChartName = req.ChartName
+	chartInfo.ChartNameEn = req.ChartName
 	chartInfo.EdbInfoIds = edbInfoIdStr
 	chartInfo.ChartClassifyId = req.ChartClassifyId
 	chartInfo.SysUserId = sysUser.AdminId
@@ -819,8 +829,8 @@ func AddChartInfo(req data_manage.AddChartInfoReq, source int, sysUser *system.A
 		mapItem.EdbInfoId = v.EdbInfoId
 		mapItem.CreateTime = time.Now()
 		mapItem.ModifyTime = time.Now()
-		timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
-		mapItem.UniqueCode = utils.MD5(utils.CHART_PREFIX + "_" + timestamp + "_" + strconv.Itoa(v.EdbInfoId))
+		edbTimestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
+		mapItem.UniqueCode = utils.MD5(utils.CHART_PREFIX + "_" + edbTimestamp + "_" + strconv.Itoa(v.EdbInfoId))
 		mapItem.IsOrder = true
 		mapItem.IsAxis = 1
 		mapItem.EdbInfoType = 1
@@ -910,7 +920,7 @@ func AddChartInfo(req data_manage.AddChartInfoReq, source int, sysUser *system.A
 }
 
 // EditChartInfo 编辑图表
-func EditChartInfo(req data_manage.EditChartInfoReq, sysUser *system.Admin) (chartItem *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func EditChartInfo(req data_manage.EditChartInfoReq, sysUser *system.Admin, lang string) (chartItem *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	chartItem, err = data_manage.GetChartInfoById(req.ChartInfoId)
@@ -1043,24 +1053,32 @@ func EditChartInfo(req data_manage.EditChartInfoReq, sysUser *system.Admin) (cha
 	edbInfoIdStr := strings.Join(edbInfoIdArrStr, ",")
 
 	//判断图表是否存在
-	var condition string
-	var pars []interface{}
-	condition += " AND chart_info_id <> ? "
-	pars = append(pars, req.ChartInfoId)
-	condition += " AND chart_name=? AND source = ? "
-	pars = append(pars, req.ChartName, chartItem.Source)
-	count, err := data_manage.GetChartInfoCountByCondition(condition, pars)
-	if err != nil {
-		errMsg = "判断图表名称是否存在失败"
-		err = errors.New("判断图表名称是否存在失败,Err:" + err.Error())
-		return
-	}
-	if count > 0 {
-		errMsg = "图表已存在,请重新填写"
-		err = errors.New(errMsg)
-		isSendEmail = false
-		return
+	{
+		var condition string
+		var pars []interface{}
+		condition += " AND chart_info_id <> ? "
+		pars = append(pars, req.ChartInfoId)
+		switch lang {
+		case utils.EnLangVersion:
+			condition += " AND chart_name_en = ? AND source = ? "
+		default:
+			condition += " AND chart_name=? AND source = ? "
+		}
+		pars = append(pars, req.ChartName, chartItem.Source)
+		count, tmpErr := data_manage.GetChartInfoCountByCondition(condition, pars)
+		if tmpErr != nil {
+			errMsg = "判断图表名称是否存在失败"
+			err = errors.New("判断图表名称是否存在失败,Err:" + tmpErr.Error())
+			return
+		}
+		if count > 0 {
+			errMsg = "图表已存在,请重新填写"
+			err = errors.New(errMsg)
+			isSendEmail = false
+			return
+		}
 	}
+
 	correlationChart := new(data_manage.ChartInfoCorrelation)
 	if e := correlationChart.GetItemById(chartItem.ChartInfoId); e != nil {
 		errMsg = "操作失败"
@@ -1145,7 +1163,7 @@ func EditChartInfo(req data_manage.EditChartInfoReq, sysUser *system.Admin) (cha
 }
 
 // CopyChartInfo 复制图表
-func CopyChartInfo(configId, classifyId int, chartName string, correlationChartInfoReq data_manage.CorrelationChartInfoReq, oldChartInfo *data_manage.ChartInfo, sysUser *system.Admin) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func CopyChartInfo(configId, classifyId int, chartName string, correlationChartInfoReq data_manage.CorrelationChartInfoReq, oldChartInfo *data_manage.ChartInfo, sysUser *system.Admin, lang string) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	configSource := 2
 	isSendEmail = true
 	// 获取相关性图的配置
@@ -1177,7 +1195,7 @@ func CopyChartInfo(configId, classifyId int, chartName string, correlationChartI
 		MarkersAreas:         oldChartInfo.MarkersAreas,
 	}
 	chartSource := utils.CHART_SOURCE_CORRELATION // 默认是相关性图
-	chartInfo, err, errMsg, isSendEmail = AddChartInfo(addChartReq, chartSource, sysUser)
+	chartInfo, err, errMsg, isSendEmail = AddChartInfo(addChartReq, chartSource, sysUser, lang)
 	if err != nil {
 		return
 	}

+ 14 - 19
services/data/cross_variety/chart.go

@@ -559,10 +559,11 @@ func GetXYEdbIdList(tagX, tagY int, varietyList []int) (xVarietyEdbMap, yVariety
 // @param req request.AddChartReq
 // @param sysUser *system.Admin
 // @return chartInfo *data_manage.ChartInfo
+// @return lang string
 // @return err error
 // @return errMsg string
 // @return isSendEmail bool
-func AddChartInfo(req request.AddChartReq, sysUser *system.Admin) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func AddChartInfo(req request.AddChartReq, sysUser *system.Admin, lang string) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	source := utils.CHART_SOURCE_CROSS_HEDGING
@@ -643,22 +644,10 @@ func AddChartInfo(req request.AddChartReq, sysUser *system.Admin) (chartInfo *da
 		// 分类没有,需要创建新的分类,那么err置空
 		err = nil
 
-		timestamp := strconv.FormatInt(time.Now().UnixNano(), 10)
-		chartClassify = &data_manage.ChartClassify{
-			ChartClassifyId:   0,
-			ChartClassifyName: sysUser.RealName,
-			ParentId:          0,
-			HasData:           0,
-			CreateTime:        time.Now(),
-			ModifyTime:        time.Now(),
-			SysUserId:         sysUser.AdminId,
-			SysUserRealName:   sysUser.RealName,
-			Level:             1,
-			UniqueCode:        utils.MD5(utils.DATA_PREFIX + "_" + timestamp),
-			Sort:              0,
-			Source:            source,
+		_, err, errMsg, isSendEmail = data.AddChartClassify(sysUser.RealName, 0, 1, source, lang, sysUser)
+		if err != nil {
+			return
 		}
-		_, err = data_manage.AddChartClassify(chartClassify)
 	}
 
 	// 数据校验(品种、标签、指标)
@@ -739,6 +728,7 @@ func AddChartInfo(req request.AddChartReq, sysUser *system.Admin) (chartInfo *da
 
 	chartInfo = new(data_manage.ChartInfo)
 	chartInfo.ChartName = req.ChartName
+	chartInfo.ChartNameEn = req.ChartNameEn
 	//chartInfo.EdbInfoIds = edbInfoIdStr
 	//chartInfo.ChartClassifyId = req.ChartClassifyId
 	chartInfo.SysUserId = sysUser.AdminId
@@ -820,7 +810,7 @@ func AddChartInfo(req request.AddChartReq, sysUser *system.Admin) (chartInfo *da
 // @return err error
 // @return errMsg string
 // @return isSendEmail bool
-func EditChartInfo(req request.EditChartReq, sysUser *system.Admin) (chartItem *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func EditChartInfo(req request.EditChartReq, sysUser *system.Admin, lang string) (chartItem *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	chartItem, err = data_manage.GetChartInfoById(req.ChartInfoId)
@@ -992,14 +982,19 @@ func EditChartInfo(req request.EditChartReq, sysUser *system.Admin) (chartItem *
 	//	return
 	//}
 
-	chartItem.ChartName = req.ChartName
+	switch lang {
+	case utils.EnLangVersion:
+		chartItem.ChartNameEn = req.ChartName
+	default:
+		chartItem.ChartName = req.ChartName
+	}
 	chartItem.ExtraConfig = string(extraConfigByte)
 	chartItem.ModifyTime = time.Now()
 	chartItem.LeftMin = req.LeftMin
 	chartItem.LeftMax = req.LeftMax
 	chartItem.XMin = req.XMin
 	chartItem.XMax = req.XMax
-	chartUpdateCols := []string{"ChartName", "ExtraConfig", "ModifyTime", "LeftMin", "LeftMax", "XMin", "XMax"}
+	chartUpdateCols := []string{"ChartName", "ChartNameEn", "ExtraConfig", "ModifyTime", "LeftMin", "LeftMax", "XMin", "XMax"}
 
 	// 跨品种分析配置
 	chartInfoCrossVariety, err := cross_varietyModel.GetChartInfoCrossVarietyByChartInfoId(chartItem.ChartInfoId)

+ 27 - 19
services/data/line_equation/chart_info.go

@@ -366,7 +366,7 @@ func handleData(baseEdbInfoId int, edbDataListMap map[int][]*data_manage.EdbData
 }
 
 // BatchAddChartInfo 批量添加图表
-func BatchAddChartInfo(batchAddChartReq []request.AddChart, lineChartInfoConfig request.LineChartInfoReq, sysUser *system.Admin) (batchAddChartList []line_equation.BatchAddChart, err error, errMsg string, isSendEmail bool) {
+func BatchAddChartInfo(batchAddChartReq []request.AddChart, lineChartInfoConfig request.LineChartInfoReq, sysUser *system.Admin, lang string) (batchAddChartList []line_equation.BatchAddChart, err error, errMsg string, isSendEmail bool) {
 	source := utils.CHART_SOURCE_LINE_EQUATION
 	// 获取需要
 	for k, v := range batchAddChartReq {
@@ -406,22 +406,30 @@ func BatchAddChartInfo(batchAddChartReq []request.AddChart, lineChartInfoConfig
 		}
 
 		// 判断图表是否存在
-		var condition string
-		var pars []interface{}
-		condition += " AND chart_name=? AND source = ? "
-		pars = append(pars, v.ChartName, source)
-		count, tmpErr := data_manage.GetChartInfoCountByCondition(condition, pars)
-		if tmpErr != nil {
-			errMsg = "判断图表名称是否存在失败"
-			err = errors.New("判断图表名称是否存在失败,Err:" + tmpErr.Error())
-			return
-		}
+		{
+			var condition string
+			var pars []interface{}
+			switch lang {
+			case utils.EnLangVersion:
+				condition += " AND chart_name_en = ? AND source = ? "
+			default:
+				condition += " AND chart_name = ? AND source = ? "
+			}
+			pars = append(pars, v.ChartName, source)
+			count, tmpErr := data_manage.GetChartInfoCountByCondition(condition, pars)
+			if tmpErr != nil {
+				errMsg = "判断图表名称是否存在失败"
+				err = errors.New("判断图表名称是否存在失败,Err:" + tmpErr.Error())
+				return
+			}
+
+			if count > 0 {
+				errMsg = "图表已存在,请重新填写"
+				err = errors.New(errMsg)
+				isSendEmail = false
+				return
+			}
 
-		if count > 0 {
-			errMsg = "图表已存在,请重新填写"
-			err = errors.New(errMsg)
-			isSendEmail = false
-			return
 		}
 	}
 
@@ -465,9 +473,9 @@ func BatchAddChartInfo(batchAddChartReq []request.AddChart, lineChartInfoConfig
 		}
 
 		chartInfo := &data_manage.ChartInfo{
-			ChartInfoId: 0,
-			ChartName:   v.ChartName,
-			//ChartNameEn:     v.ChartName,
+			ChartInfoId:     0,
+			ChartName:       v.ChartName,
+			ChartNameEn:     v.ChartName,
 			ChartClassifyId: v.ChartClassifyId,
 			SysUserId:       sysUser.AdminId,
 			SysUserRealName: sysUser.RealName,

+ 64 - 36
services/data/line_feature/chart_info.go

@@ -404,7 +404,7 @@ func GetFrequencyDistributionData(chartInfoId int, mappingInfo *data_manage.Char
 }
 
 // AddChartInfo 添加图表
-func AddChartInfo(req data_manage.AddChartInfoReq, edbInfoMapping *data_manage.ChartEdbInfoMapping, source int, sysUser *system.Admin) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func AddChartInfo(req data_manage.AddChartInfoReq, edbInfoMapping *data_manage.ChartEdbInfoMapping, source int, sysUser *system.Admin, lang string) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	req.ChartName = strings.Trim(req.ChartName, " ")
@@ -447,29 +447,39 @@ func AddChartInfo(req data_manage.AddChartInfoReq, edbInfoMapping *data_manage.C
 	}
 	edbInfoIdStr := strings.Join(edbInfoIdArrStr, ",")
 	var chartInfoId int
+
 	// 判断图表是否存在
-	var condition string
-	var pars []interface{}
-	condition += " AND chart_name=? AND source = ? "
-	pars = append(pars, req.ChartName, source)
-	count, err := data_manage.GetChartInfoCountByCondition(condition, pars)
-	if err != nil {
-		errMsg = "判断图表名称是否存在失败"
-		err = errors.New("判断图表名称是否存在失败,Err:" + err.Error())
-		return
-	}
+	{
+		var condition string
+		var pars []interface{}
+
+		switch lang {
+		case utils.EnLangVersion:
+			condition += " AND chart_name_en = ? AND source = ? "
+		default:
+			condition += " AND chart_name = ? AND source = ? "
+		}
+		pars = append(pars, req.ChartName, source)
+		count, tmpErr := data_manage.GetChartInfoCountByCondition(condition, pars)
+		if tmpErr != nil {
+			errMsg = "判断图表名称是否存在失败"
+			err = errors.New("判断图表名称是否存在失败,Err:" + tmpErr.Error())
+			return
+		}
 
-	if count > 0 {
-		errMsg = "图表已存在,请重新填写"
-		err = errors.New(errMsg)
-		isSendEmail = false
-		return
+		if count > 0 {
+			errMsg = "图表已存在,请重新填写"
+			err = errors.New(errMsg)
+			isSendEmail = false
+			return
+		}
 	}
 
 	disableVal := data.CheckIsDisableChart(edbInfoIdArr)
 
 	chartInfo = new(data_manage.ChartInfo)
 	chartInfo.ChartName = req.ChartName
+	chartInfo.ChartNameEn = req.ChartName
 	chartInfo.EdbInfoIds = edbInfoIdStr
 	chartInfo.ChartClassifyId = req.ChartClassifyId
 	chartInfo.SysUserId = sysUser.AdminId
@@ -525,7 +535,7 @@ func AddChartInfo(req data_manage.AddChartInfoReq, edbInfoMapping *data_manage.C
 }
 
 // EditChartInfo 编辑图表
-func EditChartInfo(req data_manage.EditChartInfoReq, edbInfoMapping *data_manage.ChartEdbInfoMapping, sysUser *system.Admin) (chartItem *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func EditChartInfo(req data_manage.EditChartInfoReq, edbInfoMapping *data_manage.ChartEdbInfoMapping, sysUser *system.Admin, lang string) (chartItem *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	chartItem, err = data_manage.GetChartInfoById(req.ChartInfoId)
@@ -591,28 +601,46 @@ func EditChartInfo(req data_manage.EditChartInfoReq, edbInfoMapping *data_manage
 	edbInfoIdStr := strings.Join(edbInfoIdArrStr, ",")
 
 	//判断图表是否存在
-	var condition string
-	var pars []interface{}
-	condition += " AND chart_info_id <> ? "
-	pars = append(pars, req.ChartInfoId)
-	condition += " AND chart_name=? AND source = ? "
-	pars = append(pars, req.ChartName, chartItem.Source)
-	count, err := data_manage.GetChartInfoCountByCondition(condition, pars)
-	if err != nil {
-		errMsg = "判断图表名称是否存在失败"
-		err = errors.New("判断图表名称是否存在失败,Err:" + err.Error())
-		return
-	}
-	if count > 0 {
-		errMsg = "图表已存在,请重新填写"
-		err = errors.New(errMsg)
-		isSendEmail = false
-		return
+	{
+		var condition string
+		var pars []interface{}
+		condition += " AND chart_info_id <> ? AND source = ?  "
+		pars = append(pars, req.ChartInfoId, chartItem.Source)
+
+		switch lang {
+		case utils.EnLangVersion:
+			condition += " AND chart_name_en = ?"
+		default:
+			condition += " AND chart_name=?"
+		}
+		pars = append(pars, req.ChartName)
+		count, tmpErr := data_manage.GetChartInfoCountByCondition(condition, pars)
+		if tmpErr != nil {
+			errMsg = "判断图表名称是否存在失败"
+			err = errors.New("判断图表名称是否存在失败,Err:" + tmpErr.Error())
+			return
+		}
+		if count > 0 {
+			errMsg = "图表已存在,请重新填写"
+			err = errors.New(errMsg)
+			isSendEmail = false
+			return
+		}
 	}
 
 	// 图表启用与否
 	disableVal := data.CheckIsDisableChart(edbInfoIdArr)
 
+	switch lang {
+	case utils.EnLangVersion:
+		if req.ChartNameEn == `` {
+			req.ChartNameEn = req.ChartName
+		}
+	default:
+		if req.ChartNameEn == `` {
+			req.ChartNameEn = chartItem.ChartNameEn
+		}
+	}
 	// 修改图表与指标mapping
 	err = line_feature.EditLineFeatureChartAndMapping(&req, edbInfoIdStr, "公历", req.DateType, disableVal, req.ExtraConfig)
 	if err != nil {
@@ -635,7 +663,7 @@ func EditChartInfo(req data_manage.EditChartInfoReq, edbInfoMapping *data_manage
 }
 
 // CopyChartInfo 复制图表
-func CopyChartInfo(configId, configSource, classifyId int, chartName string, edbInfoMapping *data_manage.ChartEdbInfoMapping, oldChartInfo *data_manage.ChartInfo, sysUser *system.Admin) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
+func CopyChartInfo(configId, configSource, classifyId int, chartName string, edbInfoMapping *data_manage.ChartEdbInfoMapping, oldChartInfo *data_manage.ChartInfo, sysUser *system.Admin, lang string) (chartInfo *data_manage.ChartInfo, err error, errMsg string, isSendEmail bool) {
 	isSendEmail = true
 
 	multipleGraphConfig, err := data_manage.GetMultipleGraphConfigById(configId)
@@ -663,7 +691,7 @@ func CopyChartInfo(configId, configSource, classifyId int, chartName string, edb
 		MarkersAreas:    oldChartInfo.MarkersAreas,
 	}
 	chartSource := oldChartInfo.Source // 默认是相关性图
-	chartInfo, err, errMsg, isSendEmail = AddChartInfo(addChartReq, edbInfoMapping, chartSource, sysUser)
+	chartInfo, err, errMsg, isSendEmail = AddChartInfo(addChartReq, edbInfoMapping, chartSource, sysUser, lang)
 	if err != nil {
 		return
 	}