...
|
...
|
@@ -18,11 +18,11 @@ import ( |
|
|
"time"
|
|
|
)
|
|
|
|
|
|
// 查询集合服务
|
|
|
// QuerySetService 查询集合服务
|
|
|
type QuerySetService struct {
|
|
|
}
|
|
|
|
|
|
// 修改状态
|
|
|
// ChangeStatus 修改状态
|
|
|
func (querySetService *QuerySetService) ChangeStatus(ctx *domain.Context, changeStatusCommand *command.ChangeStatusCommand) (interface{}, error) {
|
|
|
if err := changeStatusCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -48,7 +48,7 @@ func (querySetService *QuerySetService) ChangeStatus(ctx *domain.Context, change |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// 移动
|
|
|
// Copy 复制
|
|
|
func (querySetService *QuerySetService) Copy(ctx *domain.Context, copyCommand *command.CopyCommand) (interface{}, error) {
|
|
|
if err := copyCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -77,7 +77,7 @@ func (querySetService *QuerySetService) Copy(ctx *domain.Context, copyCommand *c |
|
|
return result, nil
|
|
|
}
|
|
|
|
|
|
// 创建查询集合服务
|
|
|
// CreateQuerySet 创建查询集合服务
|
|
|
func (querySetService *QuerySetService) CreateQuerySet(ctx *domain.Context, createQuerySetCommand *command.CreateQuerySetCommand) (interface{}, error) {
|
|
|
if err := createQuerySetCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -113,7 +113,7 @@ func (querySetService *QuerySetService) CreateQuerySet(ctx *domain.Context, crea |
|
|
return response, nil
|
|
|
}
|
|
|
|
|
|
// 依赖关系图
|
|
|
// DependencyGraph 依赖关系图
|
|
|
func (querySetService *QuerySetService) DependencyGraph(ctx *domain.Context, dependencyGraphQuery *query.DependencyGraphQuery) (interface{}, error) {
|
|
|
if err := dependencyGraphQuery.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -141,7 +141,7 @@ func (querySetService *QuerySetService) DependencyGraph(ctx *domain.Context, dep |
|
|
return data, nil
|
|
|
}
|
|
|
|
|
|
// 返回查询集合服务
|
|
|
// GetQuerySet 返回查询集合服务
|
|
|
func (querySetService *QuerySetService) GetQuerySet(ctx *domain.Context, getQuerySetQuery *query.GetQuerySetQuery) (interface{}, error) {
|
|
|
if err := getQuerySetQuery.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -173,7 +173,7 @@ func (querySetService *QuerySetService) GetQuerySet(ctx *domain.Context, getQuer |
|
|
return (&dto.QuerySetDetailDto{}).Load(querySet, tables.ToMap()), nil
|
|
|
}
|
|
|
|
|
|
// 返回查询集合服务列表
|
|
|
// ListQuerySet 返回查询集合服务列表
|
|
|
func (querySetService *QuerySetService) ListQuerySet(ctx *domain.Context, listQuerySetQuery *query.ListQuerySetQuery) (interface{}, error) {
|
|
|
if err := listQuerySetQuery.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -209,7 +209,7 @@ func (querySetService *QuerySetService) ListQuerySet(ctx *domain.Context, listQu |
|
|
}
|
|
|
}
|
|
|
|
|
|
// 移动
|
|
|
// Move 移动
|
|
|
func (querySetService *QuerySetService) Move(ctx *domain.Context, moveCommand *command.MoveCommand) (interface{}, error) {
|
|
|
if err := moveCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -236,7 +236,7 @@ func (querySetService *QuerySetService) Move(ctx *domain.Context, moveCommand *c |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// 移除查询集合服务
|
|
|
// RemoveQuerySet 移除查询集合服务
|
|
|
func (querySetService *QuerySetService) RemoveQuerySet(ctx *domain.Context, removeQuerySetCommand *command.RemoveQuerySetCommand) (interface{}, error) {
|
|
|
if err := removeQuerySetCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -275,7 +275,7 @@ func (querySetService *QuerySetService) RemoveQuerySet(ctx *domain.Context, remo |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// 重命名
|
|
|
// Rename 重命名
|
|
|
func (querySetService *QuerySetService) Rename(ctx *domain.Context, renameCommand *command.RenameCommand) (interface{}, error) {
|
|
|
if err := renameCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -302,7 +302,7 @@ func (querySetService *QuerySetService) Rename(ctx *domain.Context, renameComman |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// 返回查询集合服务列表
|
|
|
// SearchQuerySet 返回查询集合服务列表
|
|
|
func (querySetService *QuerySetService) SearchQuerySet(ctx *domain.Context, searchQuerySetQuery *query.SearchQuerySetQuery) (interface{}, error) {
|
|
|
if err := searchQuerySetQuery.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -311,12 +311,6 @@ func (querySetService *QuerySetService) SearchQuerySet(ctx *domain.Context, sear |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
}
|
|
|
//if err := transactionContext.StartTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//}
|
|
|
//defer func() {
|
|
|
// transactionContext.RollbackTransaction()
|
|
|
//}()
|
|
|
|
|
|
QuerySetRepository, _, _ := factory.FastPgQuerySet(transactionContext, 0)
|
|
|
options := utils.ObjectToMap(searchQuerySetQuery)
|
...
|
...
|
@@ -361,16 +355,13 @@ func (querySetService *QuerySetService) SearchQuerySet(ctx *domain.Context, sear |
|
|
|
|
|
var result = dto.NewQuerySetDtoList(querySets)
|
|
|
|
|
|
//if err := transactionContext.CommitTransaction(); err != nil {
|
|
|
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
//}
|
|
|
return map[string]interface{}{
|
|
|
"count": count,
|
|
|
"querySets": result,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// 更新查询集合服务
|
|
|
// UpdateQuerySet 更新查询集合服务
|
|
|
func (querySetService *QuerySetService) UpdateQuerySet(ctx *domain.Context, updateQuerySetCommand *command.UpdateQuerySetCommand) (interface{}, error) {
|
|
|
if err := updateQuerySetCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -396,7 +387,7 @@ func (querySetService *QuerySetService) UpdateQuerySet(ctx *domain.Context, upda |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// 更新查询集合服务
|
|
|
// RefreshQuerySet 更新查询集合服务
|
|
|
func (querySetService *QuerySetService) RefreshQuerySet(ctx *domain.Context, updateQuerySetCommand *command.RefreshQuerySetCommand) (interface{}, error) {
|
|
|
if err := updateQuerySetCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -426,6 +417,7 @@ func (querySetService *QuerySetService) RefreshQuerySet(ctx *domain.Context, upd |
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
// PreviewPrepare 预览准备
|
|
|
func (querySetService *QuerySetService) PreviewPrepare(ctx *domain.Context, updateQuerySetCommand *command.UpdateQuerySetCommand) (interface{}, error) {
|
|
|
if err := updateQuerySetCommand.ValidateCommand(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -455,6 +447,7 @@ func (querySetService *QuerySetService) PreviewPrepare(ctx *domain.Context, upda |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// CalculateItemPreview 计算项预览
|
|
|
func (querySetService *QuerySetService) CalculateItemPreview(ctx *domain.Context, q *query.CalculateItemPreviewQuery) (interface{}, error) {
|
|
|
if err := q.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
@@ -481,6 +474,7 @@ func (querySetService *QuerySetService) CalculateItemPreview(ctx *domain.Context |
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// CalculateItemExport 计算项导出
|
|
|
func (querySetService *QuerySetService) CalculateItemExport(ctx *domain.Context, q *query.CalculateItemPreviewQuery) (interface{}, error) {
|
|
|
if err := q.ValidateQuery(); err != nil {
|
|
|
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
|
...
|
...
|
|