|
@@ -1270,6 +1270,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
|
}
|
|
|
|
|
|
var tableData excel.TableData
|
|
|
+ var excelSource, excelSourceEn string
|
|
|
switch excelInfo.Source {
|
|
|
case utils.EXCEL_DEFAULT:
|
|
|
luckySheetData, err := excel.GetLuckySheetData(excelInfo.Content)
|
|
@@ -1304,6 +1305,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList(result.EdbInfoIdList)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "自定义表格数据获取失败"
|
|
|
+ br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ excelSource = strings.Join(sourceNameList, ",")
|
|
|
+ excelSourceEn = strings.Join(sourceNameEnList, ",")
|
|
|
case utils.MIXED_TABLE:
|
|
|
var result request.MixedTableReq
|
|
|
err = json.Unmarshal([]byte(excelInfo.Content), &result)
|
|
@@ -1327,6 +1336,26 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
|
return
|
|
|
}
|
|
|
+ edbInfoIds := make([]int, 0)
|
|
|
+ edbInfoIdExist := make(map[int]bool)
|
|
|
+ if len(newResult) > 0 {
|
|
|
+ for _, t := range newResult {
|
|
|
+ for _, v := range t {
|
|
|
+ if v.EdbInfoId > 0 && !edbInfoIdExist[v.EdbInfoId] {
|
|
|
+ edbInfoIdExist[v.EdbInfoId] = true
|
|
|
+ edbInfoIds = append(edbInfoIds, v.EdbInfoId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList(edbInfoIds)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "自定义表格数据获取失败"
|
|
|
+ br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ excelSource = strings.Join(sourceNameList, ",")
|
|
|
+ excelSourceEn = strings.Join(sourceNameEnList, ",")
|
|
|
|
|
|
}
|
|
|
|
|
@@ -1349,12 +1378,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
|
}
|
|
|
|
|
|
resp := response.ExcelTableDetailResp{
|
|
|
- UniqueCode: excelInfo.UniqueCode,
|
|
|
- ExcelImage: excelInfo.ExcelImage,
|
|
|
- ExcelName: excelInfo.ExcelName,
|
|
|
- TableInfo: tableData,
|
|
|
- Config: config,
|
|
|
- SourcesFrom: excelInfo.SourcesFrom,
|
|
|
+ UniqueCode: excelInfo.UniqueCode,
|
|
|
+ ExcelImage: excelInfo.ExcelImage,
|
|
|
+ ExcelName: excelInfo.ExcelName,
|
|
|
+ TableInfo: tableData,
|
|
|
+ Config: config,
|
|
|
+ SourcesFrom: excelInfo.SourcesFrom,
|
|
|
+ ExcelSource: excelSource,
|
|
|
+ ExcelSourceEn: excelSourceEn,
|
|
|
}
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
@@ -1535,12 +1566,23 @@ func (c *ExcelInfoController) GetFirstEdbData() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{edbInfoId})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "自定义表格数据获取失败"
|
|
|
+ br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ excelSource := strings.Join(sourceNameList, ",")
|
|
|
+ excelSourceEn := strings.Join(sourceNameEnList, ",")
|
|
|
+
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = response.TableDataItem{
|
|
|
EdbInfoId: edbInfoId,
|
|
|
Data: dataList,
|
|
|
+ ExcelSource: excelSource,
|
|
|
+ ExcelSourceEn: excelSourceEn,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1603,12 +1645,23 @@ func (c *ExcelInfoController) GetOtherEdbData() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{req.EdbInfoId})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "自定义表格数据获取失败"
|
|
|
+ br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ excelSource := strings.Join(sourceNameList, ",")
|
|
|
+ excelSourceEn := strings.Join(sourceNameEnList, ",")
|
|
|
+
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = response.TableDataItem{
|
|
|
EdbInfoId: req.EdbInfoId,
|
|
|
Data: dataList,
|
|
|
+ ExcelSource: excelSource,
|
|
|
+ ExcelSourceEn: excelSourceEn,
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2530,3 +2583,52 @@ func (c *ExcelInfoController) GetBatchChartRefreshResult() {
|
|
|
br.Ret = 200
|
|
|
br.Success = true
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+// GetBatchChartRefreshResult
|
|
|
+// @Title 获取批量刷新表格结果
|
|
|
+// @Description 获取批量刷新表格结果
|
|
|
+// @Param EdbInfoId query int true "edb id"
|
|
|
+// @Success Ret=200 刷新成功
|
|
|
+// @router /excel_info/get_edb_source [get]
|
|
|
+func (c *ExcelInfoController) GetEdbSource() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+ edbInfoId, _ := c.GetInt("EdbInfoId")
|
|
|
+ if edbInfoId <= 0 {
|
|
|
+ br.Msg = "请选择指标"
|
|
|
+ br.ErrMsg = "请选择指标"
|
|
|
+ br.IsSendEmail = false
|
|
|
+ return
|
|
|
+ }
|
|
|
+ sourceNameList, sourceNameEnList, err := excel2.GetEdbSourceByEdbInfoIdList([]int{edbInfoId})
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "自定义表格数据获取失败"
|
|
|
+ br.ErrMsg = "自定义表格数据获取失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ excelSource := strings.Join(sourceNameList, ",")
|
|
|
+ excelSourceEn := strings.Join(sourceNameEnList, ",")
|
|
|
+
|
|
|
+ var resp struct {
|
|
|
+ ExcelSource string `description:"表格来源"`
|
|
|
+ ExcelSourceEn string `description:"表格来源(英文)"`
|
|
|
+ }
|
|
|
+
|
|
|
+ resp.ExcelSource = excelSource
|
|
|
+ resp.ExcelSourceEn = excelSourceEn
|
|
|
+
|
|
|
+ br.Data = resp
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+}
|