|
@@ -404,7 +404,7 @@ func GetFrequencyDistributionData(chartInfoId int, mappingInfo *data_manage.Char
|
|
|
}
|
|
|
|
|
|
|
|
|
-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
|
|
|
}
|
|
|
|
|
|
|
|
|
-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
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
-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
|
|
|
}
|