|
@@ -3,11 +3,14 @@ package controllers
|
|
|
import (
|
|
|
"encoding/json"
|
|
|
"eta/eta_chart_lib/models"
|
|
|
+ excel3 "eta/eta_chart_lib/models/data_manage/excel"
|
|
|
"eta/eta_chart_lib/models/request"
|
|
|
"eta/eta_chart_lib/models/response"
|
|
|
+ "eta/eta_chart_lib/services/data"
|
|
|
excel2 "eta/eta_chart_lib/services/data/excel"
|
|
|
"eta/eta_chart_lib/services/excel"
|
|
|
"eta/eta_chart_lib/utils"
|
|
|
+ "fmt"
|
|
|
"github.com/shopspring/decimal"
|
|
|
"time"
|
|
|
)
|
|
@@ -180,3 +183,45 @@ func (this *ExcelInfoController) GetTableDetail() {
|
|
|
br.Msg = "获取成功"
|
|
|
br.Data = resp
|
|
|
}
|
|
|
+
|
|
|
+func refreshBalanceTable(excelDetail *excel3.ExcelInfo) (err error) {
|
|
|
+
|
|
|
+ edbInfoIds := make([]int, 0)
|
|
|
+ edbInfoIdExist := make(map[int]bool)
|
|
|
+ var result request.MixedTableReq
|
|
|
+ err = json.Unmarshal([]byte(excelDetail.Content), &result)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("表格json转结构体失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ newData, tmpErr, _ := excel2.GetMixedTableCellData(result)
|
|
|
+ if tmpErr != nil {
|
|
|
+ err = tmpErr
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if len(newData) > 0 {
|
|
|
+ for _, t := range newData {
|
|
|
+ for _, v := range t {
|
|
|
+ if v.EdbInfoId > 0 && !edbInfoIdExist[v.EdbInfoId] {
|
|
|
+ edbInfoIdExist[v.EdbInfoId] = true
|
|
|
+ edbInfoIds = append(edbInfoIds, v.EdbInfoId)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 清除缓存
|
|
|
+ key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + excelDetail.UniqueCode
|
|
|
+ if utils.Re == nil {
|
|
|
+ _ = utils.Rc.Delete(key)
|
|
|
+ }
|
|
|
+
|
|
|
+ if len(edbInfoIds) > 0 {
|
|
|
+ err, _ = data.EdbInfoRefreshAllFromBase(edbInfoIds, false)
|
|
|
+ if err != nil {
|
|
|
+ err = fmt.Errorf("刷新混合表格数据失败, Err: " + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|