作者 yangfu

Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/character-l…

…ibrary-metadata-bastion into test
... ... @@ -2,12 +2,13 @@ package domainService
import (
"fmt"
"strings"
"github.com/zeromicro/go-zero/core/collection"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/repository"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/starrocks"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/log"
"strings"
)
const DefaultExpandNum = 1000
... ... @@ -26,7 +27,10 @@ func (ptr *QuerySetService) LoadCalculateSetData(ctx *domain.Context, qs *domain
// 加载Tables数据
q := queryComponents[0]
cells := q.Layout.LayoutCells()
dataTables = ptr.LoadDataTables(ctx, cells)
dataTables, err = ptr.LoadDataTables(ctx, cells)
if err != nil {
return nil, err
}
// 设置数据
dt := &DataLayoutDataTable{
DataTable: res,
... ... @@ -160,7 +164,7 @@ func FastDataTable(options starrocks.QueryOptions) (*domain.DataTable, error) {
return dataTable, nil
}
func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain.LayoutCell) map[int]*domain.DataTable {
func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain.LayoutCell) (map[int]*domain.DataTable, error) {
var (
dataTables = make(map[int]*domain.DataTable)
tableRepository, _ = repository.NewTableRepository(ptr.transactionContext)
... ... @@ -175,22 +179,22 @@ func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain.
if len(tableIds.KeysInt()) > 0 {
_, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableIds": tableIds.KeysInt()})
if err != nil {
return nil
return nil, err
}
for _, t := range tables {
if _, ok := dataTables[t.TableId]; ok {
continue
}
dataTable, e := FastTable(t)
if e != nil {
log.Logger.Error(e.Error())
continue
dataTable, err := FastTable(t)
if err != nil {
log.Logger.Error(err.Error())
return nil, fmt.Errorf("获取【%s】出现异常:%s", t.Name, err.Error())
}
dataTable.Fields = t.DataFields
dataTables[t.TableId] = dataTable
}
}
return dataTables
return dataTables, nil
}
func DataLayout(res *domain.DataTable, cells []*domain.LayoutCell) (*domain.DataTable, error) {
... ... @@ -206,14 +210,6 @@ func DataLayout(res *domain.DataTable, cells []*domain.LayoutCell) (*domain.Data
}
cell := dt.unprocessed[0]
dt.unprocessed = dt.unprocessed[1:]
//blockData, length := dt.BlockData(cell)
//if err := dt.Expand(cell, length); err != nil {
// return nil, err
//}
//dt.addByLocation(cell, blockData)
//blockData, length := dt.BlockData(cell)
// 当前单元格子 影响其他格子坐标
//dt.changeUnProcessedLocation(cell, cell.Length)
if err := dt.Expand(cell, cell.Length); err != nil {
return nil, err
}
... ...