|
@@ -23,7 +23,7 @@ type UpdateChartToForumReq struct {
|
|
|
|
|
|
type ChartSaveLibReq struct {
|
|
|
ChartInfo *data_manage.ChartInfo
|
|
|
- Description string `description:"逻辑简述"`
|
|
|
+ Description []*data_manage.ChartDescriptionReq `description:"逻辑简述"`
|
|
|
EdbInfoList []*data_manage.EdbInfo
|
|
|
ChartThemeList []*chart_theme.ChartTheme
|
|
|
EdbInfoDataList []*AddEdbDataReq
|
|
@@ -133,13 +133,20 @@ func UploadChart(chartInfoId int, description string, uploaderInfo *system.Admin
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ descriptionList, err, errMsg := getChartDescriptionWithAdminNameByChartInfoId(chartInfoId)
|
|
|
+ if err != nil {
|
|
|
+ errMsg = "获取图表简介失败"
|
|
|
+ err = fmt.Errorf("获取图表简介失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
req := new(ChartSaveLibReq)
|
|
|
req.ChartInfo = chartInfo
|
|
|
req.ChartEdbMapping = chartMappingList
|
|
|
req.EdbInfoList = edbInfoList
|
|
|
req.EdbInfoDataList = edbInfoDataList
|
|
|
req.EdbInfoCalculateMapping = edbMappingList
|
|
|
- req.Description = description
|
|
|
+ req.Description = descriptionList
|
|
|
req.ChartSeries = chartSeriesList
|
|
|
req.ChartSeriesEdbMapping = chartSeriesEdbList
|
|
|
|
|
@@ -258,6 +265,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(ChartSaveLibReq)
|
|
|
req.ChartInfo = chartInfo
|
|
|
req.ChartInfo.ChartInfoId = chartInfo.ForumChartInfoId
|
|
@@ -267,6 +280,7 @@ func UpdateChart(chartInfoId int) (err error, errMsg string) {
|
|
|
req.EdbInfoCalculateMapping = edbMappingList
|
|
|
req.ChartSeries = chartSeriesList
|
|
|
req.ChartSeriesEdbMapping = chartSeriesEdbList
|
|
|
+ req.Description = descriptionList
|
|
|
|
|
|
creatorInfo, _ := system.GetSysAdminById(chartInfo.SysUserId)
|
|
|
if creatorInfo != nil {
|
|
@@ -875,3 +889,43 @@ func SetChartClassifyResourceStatusDown(chartClassifyInfo *data_manage.ChartClas
|
|
|
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+func getChartDescriptionWithAdminNameByChartInfoId(chartInfoId int) (list []*data_manage.ChartDescriptionReq, err error, errMsg string) {
|
|
|
+ descriptionList, err := data_manage.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 := system.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, &data_manage.ChartDescriptionReq{
|
|
|
+ ChartInfoId: v.ChartInfoId,
|
|
|
+ Description: v.Description,
|
|
|
+ AdminName: adminName,
|
|
|
+ SysUserId: v.SysUserId,
|
|
|
+ SysUserRealName: v.SysUserRealName,
|
|
|
+ ModifyTime: v.ModifyTime,
|
|
|
+ CreateTime: v.CreateTime,
|
|
|
+ })
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|