|
@@ -166,30 +166,11 @@ func (c *ExcelInfoController) DeleteBalanceChart() {
|
|
|
}
|
|
|
|
|
|
func refreshBalanceTable(excelDetail response.ExcelInfoDetail, lang string) (err error) {
|
|
|
- //查询所有子表
|
|
|
- cCondition := " AND parent_id = ? AND balance_type=0"
|
|
|
- var cPars []interface{}
|
|
|
- cPars = append(cPars, excelDetail.ExcelInfoId)
|
|
|
- childList, e := excel.GetExcelInfoListByCondition(cCondition, cPars)
|
|
|
- if e != nil {
|
|
|
- err = fmt.Errorf("获取子表失败 %s", err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
edbInfoIds := make([]int, 0)
|
|
|
edbInfoIdExist := make(map[int]bool)
|
|
|
- // 遍历
|
|
|
- for _, child := range childList {
|
|
|
- var result request.MixedTableReq
|
|
|
- err = json.Unmarshal([]byte(child.Content), &result)
|
|
|
- if err != nil {
|
|
|
- err = errors.New("表格json转结构体失败,Err:" + err.Error())
|
|
|
- return
|
|
|
- }
|
|
|
- newData, tmpErr, _ := excelService.GetMixedTableCellData(result, lang)
|
|
|
- if tmpErr != nil {
|
|
|
- err = tmpErr
|
|
|
- return
|
|
|
- }
|
|
|
+ if excelDetail.ParentId > 0 {
|
|
|
+ newResult := excelDetail.TableData.(request.MixedTableReq)
|
|
|
+ newData := newResult.Data
|
|
|
if len(newData) > 0 {
|
|
|
for _, t := range newData {
|
|
|
for _, v := range t {
|
|
@@ -202,15 +183,56 @@ func refreshBalanceTable(excelDetail response.ExcelInfoDetail, lang string) (err
|
|
|
}
|
|
|
|
|
|
// 清除缓存
|
|
|
- key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + child.UniqueCode
|
|
|
+ key := utils.HZ_CHART_LIB_EXCEL_TABLE_DETAIL + ":" + excelDetail.UniqueCode
|
|
|
if utils.Re == nil {
|
|
|
_ = utils.Rc.Delete(key)
|
|
|
}
|
|
|
+ } else {
|
|
|
+ //查询父表和子表
|
|
|
+ cCondition := " AND parent_id = ? AND balance_type=0"
|
|
|
+ var cPars []interface{}
|
|
|
+ cPars = append(cPars, excelDetail.ExcelInfoId)
|
|
|
+ childList, e := excel.GetExcelInfoListByCondition(cCondition, cPars)
|
|
|
+ if e != nil {
|
|
|
+ err = fmt.Errorf("获取子表失败 %s", err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 遍历
|
|
|
+ for _, child := range childList {
|
|
|
+ var result request.MixedTableReq
|
|
|
+ err = json.Unmarshal([]byte(child.Content), &result)
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New("表格json转结构体失败,Err:" + err.Error())
|
|
|
+ return
|
|
|
+ }
|
|
|
+ var newData [][]request.MixedTableCellDataReq
|
|
|
+ newData, err, _ = excelService.GetMixedTableCellData(result, lang)
|
|
|
+ if err != nil {
|
|
|
+ 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 + ":" + child.UniqueCode
|
|
|
+ if utils.Re == nil {
|
|
|
+ _ = utils.Rc.Delete(key)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if len(edbInfoIds) > 0 {
|
|
|
- e, _ = data.EdbInfoRefreshAllFromBaseV3(edbInfoIds, false, true, false)
|
|
|
- if e != nil {
|
|
|
+ err, _ = data.EdbInfoRefreshAllFromBaseV3(edbInfoIds, false, true, false)
|
|
|
+ if err != nil {
|
|
|
err = fmt.Errorf("刷新混合表格数据失败, Err: " + err.Error())
|
|
|
return
|
|
|
}
|