|
@@ -229,6 +229,7 @@ func (c *ExcelInfoController) Add() {
|
|
IsDelete: 0,
|
|
IsDelete: 0,
|
|
ModifyTime: time.Now(),
|
|
ModifyTime: time.Now(),
|
|
CreateTime: time.Now(),
|
|
CreateTime: time.Now(),
|
|
|
|
+ SourcesFrom: req.SourcesFrom,
|
|
}
|
|
}
|
|
|
|
|
|
excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
|
|
excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
|
|
@@ -732,13 +733,14 @@ func (c *ExcelInfoController) Edit() {
|
|
excelInfo.ExcelClassifyId = req.ExcelClassifyId
|
|
excelInfo.ExcelClassifyId = req.ExcelClassifyId
|
|
excelInfo.ExcelImage = req.ExcelImage
|
|
excelInfo.ExcelImage = req.ExcelImage
|
|
excelInfo.Content = content
|
|
excelInfo.Content = content
|
|
|
|
+ excelInfo.SourcesFrom = req.SourcesFrom
|
|
|
|
|
|
// 自动保存时不会传缩略图,也就不更新这个字段
|
|
// 自动保存时不会传缩略图,也就不更新这个字段
|
|
var updateExcelInfoParams []string
|
|
var updateExcelInfoParams []string
|
|
if req.ExcelImage != "" {
|
|
if req.ExcelImage != "" {
|
|
- updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "ExcelImage", "Content"}
|
|
|
|
|
|
+ updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "ExcelImage", "Content", "SourcesFrom"}
|
|
} else {
|
|
} else {
|
|
- updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content"}
|
|
|
|
|
|
+ updateExcelInfoParams = []string{"ModifyTime", "ExcelName", "ExcelType", "ExcelClassifyId", "Content", "SourcesFrom"}
|
|
}
|
|
}
|
|
|
|
|
|
excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
|
|
excelEdbMappingList := make([]*excel3.ExcelEdbMapping, 0)
|
|
@@ -1268,6 +1270,7 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
}
|
|
}
|
|
|
|
|
|
var tableData excel.TableData
|
|
var tableData excel.TableData
|
|
|
|
+ var excelSource, excelSourceEn string
|
|
switch excelInfo.Source {
|
|
switch excelInfo.Source {
|
|
case utils.EXCEL_DEFAULT:
|
|
case utils.EXCEL_DEFAULT:
|
|
luckySheetData, err := excel.GetLuckySheetData(excelInfo.Content)
|
|
luckySheetData, err := excel.GetLuckySheetData(excelInfo.Content)
|
|
@@ -1302,6 +1305,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
return
|
|
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:
|
|
case utils.MIXED_TABLE:
|
|
var result request.MixedTableReq
|
|
var result request.MixedTableReq
|
|
err = json.Unmarshal([]byte(excelInfo.Content), &result)
|
|
err = json.Unmarshal([]byte(excelInfo.Content), &result)
|
|
@@ -1319,12 +1330,32 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- tableData, err = excel.GetTableDataByMixedTableData(newResult)
|
|
|
|
|
|
+ tableData, err = excel.GetTableDataByMixedTableData(newResult, true)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
return
|
|
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, ",")
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1347,11 +1378,14 @@ func (c *ExcelInfoController) GetExcelTableData() {
|
|
}
|
|
}
|
|
|
|
|
|
resp := response.ExcelTableDetailResp{
|
|
resp := response.ExcelTableDetailResp{
|
|
- UniqueCode: excelInfo.UniqueCode,
|
|
|
|
- ExcelImage: excelInfo.ExcelImage,
|
|
|
|
- ExcelName: excelInfo.ExcelName,
|
|
|
|
- TableInfo: tableData,
|
|
|
|
- Config: config,
|
|
|
|
|
|
+ UniqueCode: excelInfo.UniqueCode,
|
|
|
|
+ ExcelImage: excelInfo.ExcelImage,
|
|
|
|
+ ExcelName: excelInfo.ExcelName,
|
|
|
|
+ TableInfo: tableData,
|
|
|
|
+ Config: config,
|
|
|
|
+ SourcesFrom: excelInfo.SourcesFrom,
|
|
|
|
+ ExcelSource: excelSource,
|
|
|
|
+ ExcelSourceEn: excelSourceEn,
|
|
}
|
|
}
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
@@ -1532,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.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "获取成功"
|
|
br.Msg = "获取成功"
|
|
br.Data = response.TableDataItem{
|
|
br.Data = response.TableDataItem{
|
|
- EdbInfoId: edbInfoId,
|
|
|
|
- Data: dataList,
|
|
|
|
|
|
+ EdbInfoId: edbInfoId,
|
|
|
|
+ Data: dataList,
|
|
|
|
+ ExcelSource: excelSource,
|
|
|
|
+ ExcelSourceEn: excelSourceEn,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1600,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.Ret = 200
|
|
br.Success = true
|
|
br.Success = true
|
|
br.Msg = "获取成功"
|
|
br.Msg = "获取成功"
|
|
br.Data = response.TableDataItem{
|
|
br.Data = response.TableDataItem{
|
|
- EdbInfoId: req.EdbInfoId,
|
|
|
|
- Data: dataList,
|
|
|
|
|
|
+ EdbInfoId: req.EdbInfoId,
|
|
|
|
+ Data: dataList,
|
|
|
|
+ ExcelSource: excelSource,
|
|
|
|
+ ExcelSourceEn: excelSourceEn,
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -2133,7 +2189,7 @@ func (c *ExcelInfoController) Download() {
|
|
br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
|
|
br.ErrMsg = "获取最新的数据失败,Err:" + err.Error()
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- tableData, err = excel.GetTableDataByMixedTableData(newResult)
|
|
|
|
|
|
+ tableData, err = excel.GetTableDataByMixedTableData(newResult, false)
|
|
if err != nil {
|
|
if err != nil {
|
|
br.Msg = "获取失败"
|
|
br.Msg = "获取失败"
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
br.ErrMsg = "转换成table失败,Err:" + err.Error()
|
|
@@ -2527,3 +2583,51 @@ func (c *ExcelInfoController) GetBatchChartRefreshResult() {
|
|
br.Ret = 200
|
|
br.Ret = 200
|
|
br.Success = true
|
|
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
|
|
|
|
+}
|