Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/character-l…
…ibrary-metadata-bastion into test
正在显示
1 个修改的文件
包含
13 行增加
和
17 行删除
| @@ -2,12 +2,13 @@ package domainService | @@ -2,12 +2,13 @@ package domainService | ||
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | "fmt" | 4 | "fmt" |
| 5 | + "strings" | ||
| 6 | + | ||
| 5 | "github.com/zeromicro/go-zero/core/collection" | 7 | "github.com/zeromicro/go-zero/core/collection" |
| 6 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain" | 8 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain" |
| 7 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/repository" | 9 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/repository" |
| 8 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/starrocks" | 10 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/starrocks" |
| 9 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/log" | 11 | "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/log" |
| 10 | - "strings" | ||
| 11 | ) | 12 | ) |
| 12 | 13 | ||
| 13 | const DefaultExpandNum = 1000 | 14 | const DefaultExpandNum = 1000 |
| @@ -26,7 +27,10 @@ func (ptr *QuerySetService) LoadCalculateSetData(ctx *domain.Context, qs *domain | @@ -26,7 +27,10 @@ func (ptr *QuerySetService) LoadCalculateSetData(ctx *domain.Context, qs *domain | ||
| 26 | // 加载Tables数据 | 27 | // 加载Tables数据 |
| 27 | q := queryComponents[0] | 28 | q := queryComponents[0] |
| 28 | cells := q.Layout.LayoutCells() | 29 | cells := q.Layout.LayoutCells() |
| 29 | - dataTables = ptr.LoadDataTables(ctx, cells) | 30 | + dataTables, err = ptr.LoadDataTables(ctx, cells) |
| 31 | + if err != nil { | ||
| 32 | + return nil, err | ||
| 33 | + } | ||
| 30 | // 设置数据 | 34 | // 设置数据 |
| 31 | dt := &DataLayoutDataTable{ | 35 | dt := &DataLayoutDataTable{ |
| 32 | DataTable: res, | 36 | DataTable: res, |
| @@ -160,7 +164,7 @@ func FastDataTable(options starrocks.QueryOptions) (*domain.DataTable, error) { | @@ -160,7 +164,7 @@ func FastDataTable(options starrocks.QueryOptions) (*domain.DataTable, error) { | ||
| 160 | return dataTable, nil | 164 | return dataTable, nil |
| 161 | } | 165 | } |
| 162 | 166 | ||
| 163 | -func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain.LayoutCell) map[int]*domain.DataTable { | 167 | +func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain.LayoutCell) (map[int]*domain.DataTable, error) { |
| 164 | var ( | 168 | var ( |
| 165 | dataTables = make(map[int]*domain.DataTable) | 169 | dataTables = make(map[int]*domain.DataTable) |
| 166 | tableRepository, _ = repository.NewTableRepository(ptr.transactionContext) | 170 | tableRepository, _ = repository.NewTableRepository(ptr.transactionContext) |
| @@ -175,22 +179,22 @@ func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain. | @@ -175,22 +179,22 @@ func (ptr *QuerySetService) LoadDataTables(ctx *domain.Context, cells []*domain. | ||
| 175 | if len(tableIds.KeysInt()) > 0 { | 179 | if len(tableIds.KeysInt()) > 0 { |
| 176 | _, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableIds": tableIds.KeysInt()}) | 180 | _, tables, err := tableRepository.Find(map[string]interface{}{"context": ctx, "tableIds": tableIds.KeysInt()}) |
| 177 | if err != nil { | 181 | if err != nil { |
| 178 | - return nil | 182 | + return nil, err |
| 179 | } | 183 | } |
| 180 | for _, t := range tables { | 184 | for _, t := range tables { |
| 181 | if _, ok := dataTables[t.TableId]; ok { | 185 | if _, ok := dataTables[t.TableId]; ok { |
| 182 | continue | 186 | continue |
| 183 | } | 187 | } |
| 184 | - dataTable, e := FastTable(t) | ||
| 185 | - if e != nil { | ||
| 186 | - log.Logger.Error(e.Error()) | ||
| 187 | - continue | 188 | + dataTable, err := FastTable(t) |
| 189 | + if err != nil { | ||
| 190 | + log.Logger.Error(err.Error()) | ||
| 191 | + return nil, fmt.Errorf("获取【%s】出现异常:%s", t.Name, err.Error()) | ||
| 188 | } | 192 | } |
| 189 | dataTable.Fields = t.DataFields | 193 | dataTable.Fields = t.DataFields |
| 190 | dataTables[t.TableId] = dataTable | 194 | dataTables[t.TableId] = dataTable |
| 191 | } | 195 | } |
| 192 | } | 196 | } |
| 193 | - return dataTables | 197 | + return dataTables, nil |
| 194 | } | 198 | } |
| 195 | 199 | ||
| 196 | func DataLayout(res *domain.DataTable, cells []*domain.LayoutCell) (*domain.DataTable, error) { | 200 | 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 | @@ -206,14 +210,6 @@ func DataLayout(res *domain.DataTable, cells []*domain.LayoutCell) (*domain.Data | ||
| 206 | } | 210 | } |
| 207 | cell := dt.unprocessed[0] | 211 | cell := dt.unprocessed[0] |
| 208 | dt.unprocessed = dt.unprocessed[1:] | 212 | dt.unprocessed = dt.unprocessed[1:] |
| 209 | - //blockData, length := dt.BlockData(cell) | ||
| 210 | - //if err := dt.Expand(cell, length); err != nil { | ||
| 211 | - // return nil, err | ||
| 212 | - //} | ||
| 213 | - //dt.addByLocation(cell, blockData) | ||
| 214 | - //blockData, length := dt.BlockData(cell) | ||
| 215 | - // 当前单元格子 影响其他格子坐标 | ||
| 216 | - //dt.changeUnProcessedLocation(cell, cell.Length) | ||
| 217 | if err := dt.Expand(cell, cell.Length); err != nil { | 213 | if err := dt.Expand(cell, cell.Length); err != nil { |
| 218 | return nil, err | 214 | return nil, err |
| 219 | } | 215 | } |
-
请 注册 或 登录 后发表评论