|
@@ -332,14 +332,14 @@ func (c *ExcelInfoController) GetWorker() {
|
|
|
// @Param request body data_manage.AddChartInfoReq true "type json string"
|
|
|
// @Success 200 {object} data_manage.AddChartInfoResp
|
|
|
// @router /excel_info/balance/chart_add [post]
|
|
|
-func (this *ExcelInfoController) BalanceChartInfoAdd() {
|
|
|
+func (c *ExcelInfoController) BalanceChartInfoAdd() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
- this.Data["json"] = br
|
|
|
- this.ServeJSON()
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
}()
|
|
|
|
|
|
- sysUser := this.SysUser
|
|
|
+ sysUser := c.SysUser
|
|
|
if sysUser == nil {
|
|
|
br.Msg = "请登录"
|
|
|
br.ErrMsg = "请登录,SysUser Is Empty"
|
|
@@ -356,11 +356,11 @@ func (this *ExcelInfoController) BalanceChartInfoAdd() {
|
|
|
if !utils.Rc.SetNX(cacheKey, 1, 30*time.Second) {
|
|
|
deleteCache = false
|
|
|
br.Msg = "系统处理中,请稍后重试!"
|
|
|
- br.ErrMsg = "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(this.Ctx.Input.RequestBody)
|
|
|
+ br.ErrMsg = "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(c.Ctx.Input.RequestBody)
|
|
|
return
|
|
|
}
|
|
|
var req request.AddBalanceTableChartReq
|
|
|
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
br.Msg = "参数解析异常!"
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
@@ -397,9 +397,9 @@ func (this *ExcelInfoController) BalanceChartInfoAdd() {
|
|
|
chartLog.SysUserRealName = sysUser.RealName
|
|
|
chartLog.UniqueCode = chartInfo.UniqueCode
|
|
|
chartLog.CreateTime = time.Now()
|
|
|
- chartLog.Content = string(this.Ctx.Input.RequestBody)
|
|
|
+ chartLog.Content = string(c.Ctx.Input.RequestBody)
|
|
|
chartLog.Status = "新增图表"
|
|
|
- chartLog.Method = this.Ctx.Input.URI()
|
|
|
+ chartLog.Method = c.Ctx.Input.URI()
|
|
|
go data_manage.AddChartInfoLog(chartLog)
|
|
|
}
|
|
|
|
|
@@ -431,14 +431,14 @@ func (this *ExcelInfoController) BalanceChartInfoAdd() {
|
|
|
// @Param request body data_manage.AddChartInfoReq true "type json string"
|
|
|
// @Success 200 {object} data_manage.AddChartInfoResp
|
|
|
// @router /excel_info/balance/chart_edit [post]
|
|
|
-func (this *ExcelInfoController) BalanceChartInfoEdit() {
|
|
|
+func (c *ExcelInfoController) BalanceChartInfoEdit() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
- this.Data["json"] = br
|
|
|
- this.ServeJSON()
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
}()
|
|
|
|
|
|
- sysUser := this.SysUser
|
|
|
+ sysUser := c.SysUser
|
|
|
if sysUser == nil {
|
|
|
br.Msg = "请登录"
|
|
|
br.ErrMsg = "请登录,SysUser Is Empty"
|
|
@@ -455,11 +455,11 @@ func (this *ExcelInfoController) BalanceChartInfoEdit() {
|
|
|
if !utils.Rc.SetNX(cacheKey, 1, 30*time.Second) {
|
|
|
deleteCache = false
|
|
|
br.Msg = "系统处理中,请稍后重试!"
|
|
|
- br.ErrMsg = "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(this.Ctx.Input.RequestBody)
|
|
|
+ br.ErrMsg = "系统处理中,请稍后重试!" + sysUser.RealName + ";data:" + string(c.Ctx.Input.RequestBody)
|
|
|
return
|
|
|
}
|
|
|
var req request.AddBalanceTableChartReq
|
|
|
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
br.Msg = "参数解析异常!"
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
@@ -501,9 +501,9 @@ func (this *ExcelInfoController) BalanceChartInfoEdit() {
|
|
|
chartLog.SysUserRealName = sysUser.RealName
|
|
|
chartLog.UniqueCode = chartItem.UniqueCode
|
|
|
chartLog.CreateTime = time.Now()
|
|
|
- chartLog.Content = string(this.Ctx.Input.RequestBody)
|
|
|
+ chartLog.Content = string(c.Ctx.Input.RequestBody)
|
|
|
chartLog.Status = "编辑图表"
|
|
|
- chartLog.Method = this.Ctx.Input.URL()
|
|
|
+ chartLog.Method = c.Ctx.Input.URL()
|
|
|
go data_manage.AddChartInfoLog(chartLog)
|
|
|
}
|
|
|
|
|
@@ -608,14 +608,14 @@ func (c *ExcelInfoController) GetBalanceChartList() {
|
|
|
// @Param request body data_manage.DeleteChartClassifyReq true "type json string"
|
|
|
// @Success 200 Ret=200 删除成功
|
|
|
// @router /excel_info/balance/chart_del [post]
|
|
|
-func (this *ExcelInfoController) DeleteBalanceChart() {
|
|
|
+func (c *ExcelInfoController) DeleteBalanceChart() {
|
|
|
br := new(models.BaseResponse).Init()
|
|
|
defer func() {
|
|
|
- this.Data["json"] = br
|
|
|
- this.ServeJSON()
|
|
|
+ c.Data["json"] = br
|
|
|
+ c.ServeJSON()
|
|
|
}()
|
|
|
|
|
|
- sysUser := this.SysUser
|
|
|
+ sysUser := c.SysUser
|
|
|
if sysUser == nil {
|
|
|
br.Msg = "请登录"
|
|
|
br.ErrMsg = "请登录,SysUser Is Empty"
|
|
@@ -624,7 +624,7 @@ func (this *ExcelInfoController) DeleteBalanceChart() {
|
|
|
}
|
|
|
|
|
|
var req data_manage.DeleteChartClassifyReq
|
|
|
- err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
if err != nil {
|
|
|
br.Msg = "参数解析异常!"
|
|
|
br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
@@ -736,9 +736,9 @@ func (this *ExcelInfoController) DeleteBalanceChart() {
|
|
|
chartLog.SysUserRealName = sysUser.RealName
|
|
|
chartLog.UniqueCode = chartInfo.UniqueCode
|
|
|
chartLog.CreateTime = time.Now()
|
|
|
- chartLog.Content = string(this.Ctx.Input.RequestBody)
|
|
|
+ chartLog.Content = string(c.Ctx.Input.RequestBody)
|
|
|
chartLog.Status = "删除图表"
|
|
|
- chartLog.Method = this.Ctx.Input.URI()
|
|
|
+ chartLog.Method = c.Ctx.Input.URI()
|
|
|
go data_manage.AddChartInfoLog(chartLog)
|
|
|
}
|
|
|
}
|
|
@@ -747,3 +747,79 @@ func (this *ExcelInfoController) DeleteBalanceChart() {
|
|
|
br.Success = true
|
|
|
br.IsAddLog = true
|
|
|
}
|
|
|
+
|
|
|
+// BalanceSeasonChartLegendPreview
|
|
|
+// @Title 季节性图例预览接口
|
|
|
+// @Description 季节性图例预览接口
|
|
|
+// @Param request body request.BalanceSeasonChartLegendPreviewReq true "type json string"
|
|
|
+// @Success 200 {object} data_manage.BalanceSeasonChartLegendPreviewResp
|
|
|
+// @router /excel_info/balance/chartLegend/preview [post]
|
|
|
+func (c *ExcelInfoController) BalanceSeasonChartLegendPreview() {
|
|
|
+ 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
|
|
|
+ }
|
|
|
+
|
|
|
+ var req request.BalanceSeasonChartLegendPreviewReq
|
|
|
+ err := json.Unmarshal(c.Ctx.Input.RequestBody, &req)
|
|
|
+ if err != nil {
|
|
|
+ br.Msg = "参数解析异常!"
|
|
|
+ br.ErrMsg = "参数解析失败,Err:" + err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(req.DateArr) == 0 || len(req.DateArr) == 0 || len(req.DateArr) != len(req.DataArr) {
|
|
|
+ br.Msg = "请输入正确的日期和数据"
|
|
|
+ return
|
|
|
+ }
|
|
|
+ newDataMap := make(map[int]float64)
|
|
|
+ for i, v := range req.DataArr {
|
|
|
+ newDataMap[i] = v
|
|
|
+ }
|
|
|
+ //组装成excelEdbData
|
|
|
+ dataList := make([]*data_manage.EdbDataList, 0)
|
|
|
+
|
|
|
+ for i, v := range req.DateArr {
|
|
|
+ // todo 处理DataTimestamp
|
|
|
+ dataTime, e := time.ParseInLocation(utils.FormatDate, v, time.Local)
|
|
|
+ if e != nil {
|
|
|
+ br.Msg = "日期格式错误"
|
|
|
+ br.ErrMsg = v + "日期格式错误,Err:" + e.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ timestamp := dataTime.UnixNano() / 1e6
|
|
|
+ tmp := &data_manage.EdbDataList{
|
|
|
+ EdbDataId: i,
|
|
|
+ DataTime: v,
|
|
|
+ DataTimestamp: timestamp,
|
|
|
+ Value: newDataMap[i],
|
|
|
+ }
|
|
|
+ dataList = append(dataList, tmp)
|
|
|
+ }
|
|
|
+
|
|
|
+ list, err, errMsg := data.GetBalanceExcelSeasonChartLegendPreview(dataList, req.Calendar, req.SeasonExtraConfig)
|
|
|
+ if err != nil {
|
|
|
+ if errMsg != "" {
|
|
|
+ br.Msg = errMsg
|
|
|
+ } else {
|
|
|
+ br.Msg = "预览失败"
|
|
|
+ }
|
|
|
+ br.ErrMsg = err.Error()
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ ret := &data_manage.BalanceSeasonChartLegendPreviewResp{List: list}
|
|
|
+ br.Data = ret
|
|
|
+ br.Ret = 200
|
|
|
+ br.Success = true
|
|
|
+ br.Msg = "操作成功"
|
|
|
+}
|