|
@@ -89,6 +89,12 @@ func UpdateChart(chartInfoId int) (err error, errMsg string) {
|
|
|
err = fmt.Errorf("获取指标详情失败,Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
+ descriptionList, err, errMsg := getChartDescriptionWithAdminNameByChartInfoId(chartInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取图表简介失败"
|
|
|
+ err = fmt.Errorf("获取图表简介失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
req := new(eta_forum.ChartSaveLibReq)
|
|
|
req.ChartInfo = chartInfo
|
|
|
req.ChartInfo.ChartInfoId = chartInfo.ForumChartInfoId
|
|
@@ -98,6 +104,7 @@ func UpdateChart(chartInfoId int) (err error, errMsg string) {
|
|
|
req.EdbInfoCalculateMapping = edbMappingList
|
|
|
req.ChartSeries = chartSeriesList
|
|
|
req.ChartSeriesEdbMapping = chartSeriesEdbList
|
|
|
+ req.Description = descriptionList
|
|
|
// 查询创建者信息
|
|
|
creatorInfo, _ := models.GetSysUserById(chartInfo.SysUserId)
|
|
|
if creatorInfo != nil {
|
|
@@ -455,6 +462,12 @@ func UploadChart(chartInfoId int, description string, uploaderInfo *models.Admin
|
|
|
err = fmt.Errorf("获取指标详情失败,Err:" + err.Error())
|
|
|
return
|
|
|
}
|
|
|
+ descriptionList, err, errMsg := getChartDescriptionWithAdminNameByChartInfoId(chartInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取图表简介失败"
|
|
|
+ err = fmt.Errorf("获取图表简介失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
req := new(eta_forum.ChartSaveLibReq)
|
|
|
req.ChartInfo = chartInfo
|
|
@@ -462,7 +475,7 @@ func UploadChart(chartInfoId int, description string, uploaderInfo *models.Admin
|
|
|
req.EdbInfoList = edbInfoList
|
|
|
req.EdbInfoDataList = edbInfoDataList
|
|
|
req.EdbInfoCalculateMapping = edbMappingList
|
|
|
- req.Description = description
|
|
|
+ req.Description = descriptionList
|
|
|
req.ChartSeries = chartSeriesList
|
|
|
req.ChartSeriesEdbMapping = chartSeriesEdbList
|
|
|
|
|
@@ -505,3 +518,43 @@ func UploadChart(chartInfoId int, description string, uploaderInfo *models.Admin
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+func getChartDescriptionWithAdminNameByChartInfoId(chartInfoId int) (list []*models.ChartDescriptionReq, err error, errMsg string) {
|
|
|
+ descriptionList, err := models.GetChartDescriptionByChartInfoId(chartInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取图表简介失败"
|
|
|
+ err = fmt.Errorf("获取图表简介失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 查询创建者信息
|
|
|
+ adminIdList := make([]int, 0)
|
|
|
+ for _, v := range descriptionList {
|
|
|
+ adminIdList = append(adminIdList, v.SysUserId)
|
|
|
+ }
|
|
|
+ adminList, err := models.GetAdminListByIdList(adminIdList)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取创建者信息失败"
|
|
|
+ err = fmt.Errorf("获取创建者信息失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ adminMap := make(map[int]string)
|
|
|
+ for _, v := range adminList {
|
|
|
+ adminMap[v.AdminId] = v.AdminName
|
|
|
+ }
|
|
|
+ for _, v := range descriptionList {
|
|
|
+ adminName, ok := adminMap[v.SysUserId]
|
|
|
+ if !ok {
|
|
|
+ adminName = ""
|
|
|
+ }
|
|
|
+ list = append(list, &models.ChartDescriptionReq{
|
|
|
+ Id: v.Id,
|
|
|
+ ChartInfoId: v.ChartInfoId,
|
|
|
+ Description: v.Description,
|
|
|
+ AdminName: adminName,
|
|
|
+ SysUserId: v.SysUserId,
|
|
|
+ SysUserRealName: v.SysUserRealName,
|
|
|
+ ModifyTime: v.ModifyTime,
|
|
|
+ CreateTime: v.CreateTime,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|