作者 yangfu

Merge branch 'test'

正在显示 42 个修改的文件 包含 457 行增加253 行删除
... ... @@ -162,9 +162,6 @@ func AutoRemoveTemporaryTable(ctx context.Context) error {
return nil
}
}
//if err = dao.TableDeleteByTime(transactionContext.(*pgTransaction.TransactionContext), domain.TemporaryTable, begin, end); err != nil {
// return err
//}
if err = transactionContext.CommitTransaction(); err != nil {
return err
}
... ...
package service
import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/event/command"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/factory"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/api/digitalLib"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/domainService"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/log"
"math"
"time"
)
func (tableEventService *TableEventService) DigitalPlatformEventSubscribe(ctx *domain.Context, cmd *command.TableEventCommand) (interface{}, error) {
... ... @@ -15,12 +20,12 @@ func (tableEventService *TableEventService) DigitalPlatformEventSubscribe(ctx *d
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()
//}()
if err := transactionContext.StartTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
defer func() {
transactionContext.RollbackTransaction()
}()
var (
dataChanged = true
... ... @@ -31,29 +36,54 @@ func (tableEventService *TableEventService) DigitalPlatformEventSubscribe(ctx *d
tableId := 0
switch data.Type {
case domain.TableDataImportEvent, domain.TableDataEditEvent, domain.TableDeleteEvent:
// dataChanged = true
tableId = data.Table.TableId
case domain.QuerySetUpdateEvent:
case domain.QuerySetUpdateEvent, domain.QuerySetUpdateRenameEvent:
tableId = data.QuerySet.QuerySetInfo.BindTableId
// structChanged = true
if data.QuerySet.Status != domain.StatusOn {
return nil, nil
}
if !domain.AssertTableType(data.QuerySet.Type, domain.SchemaTable, domain.CalculateItem, domain.CalculateSet) {
return nil, nil
}
case domain.QuerySetUpdateStatusEvent:
tableId = data.QuerySet.QuerySetInfo.BindTableId
if !domain.AssertTableType(data.QuerySet.Type, domain.SchemaTable, domain.CalculateItem, domain.CalculateSet) {
return nil, nil
}
case domain.TableApplyOnEvent:
tableId = data.Table.TableId
dataChanged = false
case domain.QuerySetDeleteEvent:
tableId = data.Table.TableId
}
if tableId == 0 {
return nil, nil
}
var notifyData = struct {
DataChanged bool `json:"dataChanged"`
StructChanged bool `json:"structChanged"`
TableId int `json:"tableId"`
Event string `json:"event"`
TableAffectedList []int `json:"tableAffectedList"`
}{
var notifyData = NotifyData{
DataChanged: dataChanged,
StructChanged: structChanged,
TableId: tableId,
Event: data.Type.ToString(),
Metadata: cmd.EventTable.Metadata,
}
// tableId 相关联的
tableRepository, _, _ := factory.FastPgTable(transactionContext, 0)
tableRepository, table, _ := factory.FastPgTable(transactionContext, tableId)
if table == nil && data.Table != nil {
table = data.Table
notifyData.CompanyId = table.Context.CompanyId
}
if table != nil {
notifyData.TableType = domain.EnumsDescription(domain.ObjectTypeMap, table.TableType)
switch domain.TableType(table.TableType) {
case domain.MainTable, domain.SubTable, domain.SideTable:
notifyData.ObjectType = "导入模块"
case domain.SchemaTable, domain.SubProcessTable, domain.CalculateTable:
notifyData.ObjectType = "拆解模块"
case domain.CalculateItem, domain.CalculateSet:
notifyData.ObjectType = "计算模块"
}
}
_, tables, err := tableRepository.Find(map[string]interface{}{"context": data.Context, "tableTypesNotIn": []string{domain.TemporaryTable.ToString(), domain.ExcelTable.ToString()}})
if err != nil {
return nil, err
... ... @@ -63,22 +93,103 @@ func (tableEventService *TableEventService) DigitalPlatformEventSubscribe(ctx *d
tableDependTree := tableDependencyService.TableDependTree(tables, tableId)
tree := tableDependTree.Tree
//tableService := tableservice.NewTableService(nil)
querySetRepository, _, _ := factory.FastPgQuerySet(transactionContext, 0)
var mapTableQuerySet = make(map[int]*domain.QuerySet)
if len(tree) > 0 && cmd.EventTable.QuerySet != nil {
_, querySets, _ := querySetRepository.Find(map[string]interface{}{
"types": []string{domain.SchemaTable.ToString(), domain.CalculateItem.ToString(), domain.CalculateSet.ToString()},
"bindTableIds": tree,
"status": domain.StatusOn,
})
for _, q := range querySets {
mapTableQuerySet[q.QuerySetInfo.BindTableId] = q
}
}
for i := range tree {
cache.DefaultDataTableCacheService.DeleteDataTable(tree[i])
// fresh cache
//tableService.TablePreview(data.Context, &tablecommand.TablePreviewCommand{
// TableId: tree[i],
// ObjectType: domain.ObjectMetaTable,
// PageSize: 10000,
// PageNumber: 0,
// UseCache: true,
//})
table, ok := tableDependencyService.TableMap[tree[i]]
if !ok {
continue
}
if notifyData.CompanyId == 0 {
notifyData.CompanyId = table.Context.CompanyId
}
switch table.TableType {
case domain.MainTable.ToString(), domain.SubTable.ToString(), domain.SideTable.ToString():
if table.TableInfo != nil && table.TableInfo.ApplyOnModule&domain.ModuleDigitalCenter == 0 {
continue
}
break
case domain.SubProcessTable.ToString(), domain.CalculateTable.ToString():
continue
case domain.SchemaTable.ToString(), domain.CalculateSet.ToString(), domain.CalculateItem.ToString():
if querySet, ok := mapTableQuerySet[tree[i]]; !ok {
continue
} else {
// 不是当前的查询集。且状态为关闭的都补推送
if querySet.Status != domain.StatusOn && querySet.QuerySetInfo.BindTableId != 0 && querySet.QuerySetInfo.BindTableId != tableId {
continue
}
}
}
notifyData.TableAffectedList = append(notifyData.TableAffectedList, tree[i])
}
found := false
for _, id := range notifyData.TableAffectedList {
if id == tableId {
found = true
}
}
if !found {
notifyData.TableAffectedList = append(notifyData.TableAffectedList, tableId)
}
lib := digitalLib.NewDigitalLib(constant.DIGITAL_SERVER_HOST)
if _, err = lib.SyncNotice(digitalLib.RequestSyncNotice{Body: notifyData}); err != nil {
log.Logger.Error(fmt.Sprintf("通知数控失败:%s", err.Error()))
if t, ok := notifyData.Retry(); ok {
tableEventService.TimingWheel.SetTimer(notifyData.Key(), &notifyData, t)
log.Logger.Debug(fmt.Sprintf("通知数控重试 key:%s wait:%vs", notifyData.Key(), t.Seconds()))
}
//if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
//}
}
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil, nil
}
type NotifyData struct {
DataChanged bool `json:"dataChanged"` // 数据有变化
StructChanged bool `json:"structChanged"` // 结构有变化
TableId int `json:"tableId"` // 表ID
TableType string `json:"tableType"` // 表类型:导入模块(主表,副表,分表) 拆解模块(方案、子过程、计算表) 计算模块(计算项,计算集)
ObjectType string `json:"objectType"` // 导入模块、拆解模块、计算模块
CompanyId int `json:"companyId"` // 公司
Event string `json:"event"` // 事件名称
TableAffectedList []int `json:"tableAffectedList"` // 级联影响到的表
Metadata map[string]interface{} `json:"metadata"` // 元数据
sendRetry int
}
func (n *NotifyData) Key() string {
return fmt.Sprintf("delay:notify:table:%d", n.TableId)
}
func (n *NotifyData) Retry() (time.Duration, bool) {
n.sendRetry++
if n.sendRetry > 3 {
return n.Delay(), false
}
if n.sendRetry == 1 {
return n.Delay(), true
}
return n.Delay() * time.Duration(int(math.Pow(float64(2), float64(n.sendRetry)))), true
}
func (n *NotifyData) Delay() time.Duration {
return time.Second * 10
}
func (n *NotifyData) RetryTime() int {
return n.sendRetry
}
... ...
... ... @@ -5,17 +5,21 @@ import (
"fmt"
"github.com/linmadan/egglib-go/core/application"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
"github.com/zeromicro/go-zero/core/collection"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/event/command"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/factory"
tablecommand "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/command"
tableservice "gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/service"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/api/digitalLib"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/domainService"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/log"
"time"
)
type TableEventService struct {
TimingWheel *collection.TimingWheel
}
func (tableEventService *TableEventService) Handler(ctx *domain.Context, cmd *command.TableEventCommand) (interface{}, error) {
... ... @@ -37,6 +41,8 @@ func (tableEventService *TableEventService) Handler(ctx *domain.Context, cmd *co
tableId = data.Table.TableId
case domain.QuerySetUpdateEvent:
tableId = data.QuerySet.QuerySetInfo.BindTableId
default:
return nil, err
}
if tableId == 0 {
return nil, nil
... ... @@ -129,5 +135,25 @@ func (tableEventService *TableEventService) HandlerTableAffectedMarkToConflictSt
func NewTableEventService(options map[string]interface{}) *TableEventService {
svr := &TableEventService{}
delayNotifyTimingWheel, _ := collection.NewTimingWheel(time.Second, 10, svr.TimingWheelFunc)
svr.TimingWheel = delayNotifyTimingWheel
return svr
}
func (tableEventService *TableEventService) TimingWheelFunc(key, value interface{}) {
v, ok := value.(*NotifyData)
if !ok {
return
}
lib := digitalLib.NewDigitalLib("")
if _, err := lib.SyncNotice(digitalLib.RequestSyncNotice{Body: v}); err != nil {
log.Logger.Error(fmt.Sprintf("通知数控失败:%s", err.Error()))
if t, ok := v.Retry(); ok {
if err = tableEventService.TimingWheel.SetTimer(v.Key(), v, t); err == nil {
log.Logger.Debug(fmt.Sprintf("通知数控重试(%d) key:%s wait:%vs", v.RetryTime(), v.Key(), t.Seconds()))
return
}
}
}
tableEventService.TimingWheel.RemoveTimer(v.Key())
}
... ...
... ... @@ -23,9 +23,9 @@ func FastPgFile(transactionContext application.TransactionContext, id int) (doma
if id > 0 {
if mod, err = rep.FindOne(map[string]interface{}{"fileId": id}); err != nil {
if err == domain.ErrorNotFound {
return nil, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该文件不存在")
return rep, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该文件不存在")
}
return nil, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return rep, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
//if err = fastPgDataAuth(transactionContext, mod, options...); err != nil {
... ... @@ -52,9 +52,9 @@ func FastPgTable(transactionContext application.TransactionContext, id int) (dom
if id > 0 {
if mod, err = rep.FindOne(map[string]interface{}{"tableId": id}); err != nil {
if err == domain.ErrorNotFound {
return nil, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该表格不存在")
return rep, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该表格不存在")
}
return nil, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return rep, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
return rep, mod, err
... ... @@ -78,9 +78,9 @@ func FastPgLog(transactionContext application.TransactionContext, id int) (domai
if id > 0 {
if mod, err = rep.FindOne(map[string]interface{}{"logId": id}); err != nil {
if err == domain.ErrorNotFound {
return nil, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该日志不存在")
return rep, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该日志不存在")
}
return nil, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return rep, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
return rep, mod, err
... ... @@ -104,9 +104,9 @@ func FastPgMappingRule(transactionContext application.TransactionContext, id int
if id > 0 {
if mod, err = rep.FindOne(map[string]interface{}{"mappingRuleId": id}); err != nil {
if err == domain.ErrorNotFound {
return nil, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该匹配规则不存在")
return rep, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该匹配规则不存在")
}
return nil, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return rep, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
return rep, mod, err
... ... @@ -130,9 +130,9 @@ func FastPgQuerySet(transactionContext application.TransactionContext, id int) (
if id > 0 {
if mod, err = rep.FindOne(map[string]interface{}{"querySetId": id}); err != nil {
if err == domain.ErrorNotFound {
return nil, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该查询集合不存在")
return rep, nil, application.ThrowError(application.RES_NO_FIND_ERROR, "该查询集合不存在")
}
return nil, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return rep, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
}
return rep, mod, err
... ...
... ... @@ -91,9 +91,6 @@ type FileUpload struct {
}
func (fileService *FileService) DeleteAppTableFile(ctx *domain.Context, cmd *command.DeleteAppTableFileCommand) (interface{}, error) {
//if err := cmd.ValidateCommand(); err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, err.Error())
//}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -123,9 +120,6 @@ func (fileService *FileService) DeleteAppTableFile(ctx *domain.Context, cmd *com
}
func (fileService *FileService) AppTableFileAppendData(ctx *domain.Context, cmd *command.AppTableFileAppendDataCommand) (interface{}, error) {
//if err := cmd.ValidateCommand(); err != nil {
// return nil, application.ThrowError(application.ARG_ERROR, err.Error())
//}
transactionContext, err := factory.CreateTransactionContext(nil)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -277,7 +277,7 @@ func (fileService *FileService) AppendDataToTable(ctx *domain.Context, cmd *comm
return result, nil
}
// AppendDataToTable 追加数据
// AppendDataToTablePreflightCheck 追加数据预查
func (fileService *FileService) AppendDataToTablePreflightCheck(ctx *domain.Context, cmd *command.AppendDataToTableCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -352,41 +352,6 @@ func (fileService *FileService) ExportFile(ctx *domain.Context, cmd *command.Exp
if err != nil {
return nil, factory.FastError(err)
}
//filename := fmt.Sprintf("%v_%v.xlsx", file.FileInfo.Name, time.Now().Format("060102150405"))
//path := fmt.Sprintf("public/%v", filename)
//writerTo := excel.NewXLXSWriterTo(importer.Reader().Header().Columns, data)
//writerTo.ToInterfaces = domain.MakeToInterfaces(table.DataFields)
//if err := writerTo.Save(path); err != nil {
// return nil, factory.FastError(err)
//}
//
//var (
// config = utils.RouterConfig{
// OssEndPoint: "oss-cn-hangzhou.aliyuncs-internal.com",
// AccessKeyID: "LTAI4Fz1LUBW2fXp6QWaJHRS",
// AccessKeySecret: "aLZXwK8pgrs10Ws03qcN7NsrSXFVsg",
// BuckName: "byte-bank",
// }
// key = fmt.Sprintf("byte-bank/%v/%v", time.Now().Format("2006-01-02"), filename)
//)
//bucket, bucketErr := utils.NewBucket(config)
//if bucketErr == nil && bucket != nil {
// log.Logger.Info(fmt.Sprintf("end-point:%v key:%v", config.OssEndPoint, key))
// f, _ := os.Open(path)
// if err = utils.CreateObjects(bucket, utils.Object{
// Key: key,
// Value: f,
// }); err != nil {
// log.Logger.Error(err.Error())
// } else {
// response.Url = domain.ConvertInternalFileUrlToPublic(fmt.Sprintf("https://%v.%v/%v", config.BuckName, config.OssEndPoint, key))
// }
//}
//if len(response.Url) == 0 {
// response.Url = domain.DownloadUrl(filename)
//}
//response.FileName = file.FileInfo.Name
//response.Ext = domain.XLSX
if err := transactionContext.CommitTransaction(); err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -19,11 +19,11 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/utils"
)
// 文件服务
// FileService 文件服务
type FileService struct {
}
// 创建文件服务
// CreateFile 创建文件服务
func (fileService *FileService) CreateFile(ctx *domain.Context, createFileCommand *command.CreateFileCommand) (interface{}, error) {
if err := createFileCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -89,7 +89,7 @@ func (fileService *FileService) CreateFile(ctx *domain.Context, createFileComman
return struct{}{}, nil
}
// 返回文件服务
// GetFile 返回文件服务
func (fileService *FileService) GetFile(ctx *domain.Context, getFileQuery *query.GetFileQuery) (interface{}, error) {
if err := getFileQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -140,7 +140,7 @@ func (fileService *FileService) GetFile(ctx *domain.Context, getFileQuery *query
return response, nil
}
// 返回文件服务列表
// ListFile 返回文件服务列表
func (fileService *FileService) ListFile(listFileQuery *query.ListFileQuery) (interface{}, error) {
if err := listFileQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -218,7 +218,7 @@ func (fileService *FileService) SearchFile(listFileQuery *query.SearchFileQuery)
}, nil
}
// 返回文件服务列表
// SearchAppFile 返回文件服务列表
func (fileService *FileService) SearchAppFile(ctx *domain.Context, listFileQuery *query.SearchFileQuery) (interface{}, error) {
if err := listFileQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -338,7 +338,7 @@ func (fileService *FileService) GetAppFile(ctx *domain.Context, appKey string, f
}, nil
}
// 移除文件服务
// RemoveFile 移除文件服务
func (fileService *FileService) RemoveFile(ctx *domain.Context, removeFileCommand *command.RemoveFileCommand) (interface{}, error) {
if err := removeFileCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -379,7 +379,7 @@ func (fileService *FileService) RemoveFile(ctx *domain.Context, removeFileComman
return struct{}{}, nil
}
// 更新文件服务
// UpdateFile 更新文件服务
func (fileService *FileService) UpdateFile(updateFileCommand *command.UpdateFileCommand) (interface{}, error) {
if err := updateFileCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -422,7 +422,7 @@ func (fileService *FileService) UpdateFile(updateFileCommand *command.UpdateFile
}
}
// 取消校验中的文件
// CancelVerifyingFile 取消校验中的文件
func (fileService *FileService) CancelVerifyingFile(ctx *domain.Context, cmd *command.CancelVerifyingFileCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ...
... ... @@ -12,11 +12,9 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/utils"
)
// 日志服务
type LogService struct {
}
// 创建日志服务
func (logService *LogService) CreateLog(createLogCommand *command.CreateLogCommand) (interface{}, error) {
if err := createLogCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -56,7 +54,6 @@ func (logService *LogService) CreateLog(createLogCommand *command.CreateLogComma
}
}
// 返回日志服务
func (logService *LogService) GetLog(getLogQuery *query.GetLogQuery) (interface{}, error) {
if err := getLogQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -93,7 +90,6 @@ func (logService *LogService) GetLog(getLogQuery *query.GetLogQuery) (interface{
}
}
// 返回日志服务列表
func (logService *LogService) ListLog(listLogQuery *query.ListLogQuery) (interface{}, error) {
if err := listLogQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -129,7 +125,6 @@ func (logService *LogService) ListLog(listLogQuery *query.ListLogQuery) (interfa
}
}
// 移除日志服务
func (logService *LogService) RemoveLog(removeLogCommand *command.RemoveLogCommand) (interface{}, error) {
if err := removeLogCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -169,7 +164,6 @@ func (logService *LogService) RemoveLog(removeLogCommand *command.RemoveLogComma
}
}
// 搜索日志
func (logService *LogService) SearchLog(searchLogCommand *command.SearchLogCommand) (int64, interface{}, error) {
if err := searchLogCommand.ValidateCommand(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -204,7 +198,6 @@ func (logService *LogService) SearchLog(searchLogCommand *command.SearchLogComma
return count, result, nil
}
// 搜索日志
func (logService *LogService) VerifiedStepLog(searchLogCommand *command.SearchLogCommand) (int64, interface{}, error) {
if err := searchLogCommand.ValidateCommand(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -252,7 +245,6 @@ func (logService *LogService) VerifiedStepLog(searchLogCommand *command.SearchLo
}, nil
}
// 更新日志服务
func (logService *LogService) UpdateLog(updateLogCommand *command.UpdateLogCommand) (interface{}, error) {
if err := updateLogCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ...
... ... @@ -13,11 +13,11 @@ import (
"time"
)
// 匹配规则服务
// MappingRuleService 匹配规则服务
type MappingRuleService struct {
}
// 创建匹配规则服务
// CreateMappingRule 创建匹配规则服务
func (mappingRuleService *MappingRuleService) CreateMappingRule(ctx *domain.Context, cmd *command.CreateMappingRuleCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -81,7 +81,7 @@ func (mappingRuleService *MappingRuleService) CreateMappingRule(ctx *domain.Cont
return result, nil
}
// 返回匹配规则服务
// GetMappingRule 返回匹配规则服务
func (mappingRuleService *MappingRuleService) GetMappingRule(getMappingRuleQuery *query.GetMappingRuleQuery) (interface{}, error) {
if err := getMappingRuleQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -109,7 +109,7 @@ func (mappingRuleService *MappingRuleService) GetMappingRule(getMappingRuleQuery
return result, nil
}
// 返回匹配规则服务列表
// ListMappingRule 返回匹配规则服务列表
func (mappingRuleService *MappingRuleService) ListMappingRule(listMappingRuleQuery *query.ListMappingRuleQuery) (interface{}, error) {
if err := listMappingRuleQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -145,7 +145,7 @@ func (mappingRuleService *MappingRuleService) ListMappingRule(listMappingRuleQue
}
}
// 匹配规则预准备(新建规则)
// Prepare 匹配规则预准备(新建规则)
func (mappingRuleService *MappingRuleService) Prepare(prepareCommand *command.PrepareCommand) (interface{}, error) {
if err := prepareCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -182,7 +182,7 @@ func (mappingRuleService *MappingRuleService) Prepare(prepareCommand *command.Pr
return ruleDto, nil
}
// 移除匹配规则服务
// RemoveMappingRule 移除匹配规则服务
func (mappingRuleService *MappingRuleService) RemoveMappingRule(removeMappingRuleCommand *command.RemoveMappingRuleCommand) (interface{}, error) {
if err := removeMappingRuleCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -222,7 +222,7 @@ func (mappingRuleService *MappingRuleService) RemoveMappingRule(removeMappingRul
}{}, nil
}
// 搜索规则
// Search 搜索规则
func (mappingRuleService *MappingRuleService) Search(searchCommand *command.SearchCommand) (interface{}, error) {
if err := searchCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -259,7 +259,7 @@ func (mappingRuleService *MappingRuleService) Search(searchCommand *command.Sear
}, nil
}
// 更新匹配规则服务
// UpdateMappingRule 更新匹配规则服务
func (mappingRuleService *MappingRuleService) UpdateMappingRule(ctx *domain.Context, cmd *command.UpdateMappingRuleCommand) (interface{}, error) {
if err := cmd.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ...
... ... @@ -11,6 +11,7 @@ import (
"time"
)
// CalculateSetPreview 计算集预览
func (querySetService *QuerySetService) CalculateSetPreview(ctx *domain.Context, updateQuerySetCommand *command.UpdateQuerySetCommand) (interface{}, error) {
if err := updateQuerySetCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -50,6 +51,7 @@ func (querySetService *QuerySetService) CalculateSetPreview(ctx *domain.Context,
return response, nil
}
// CalculateSetExport 计算集导出
func (querySetService *QuerySetService) CalculateSetExport(ctx *domain.Context, updateQuerySetCommand *command.UpdateQuerySetCommand) (interface{}, error) {
if err := updateQuerySetCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
... ... @@ -79,10 +81,6 @@ func (querySetService *QuerySetService) CalculateSetExport(ctx *domain.Context,
}
var fields []string
//for i := range dataTable.Fields {
// fields = append(fields, dataTable.Fields[i].Name)
//}
filename := fmt.Sprintf("%v_%v.xlsx", querySet.Name, time.Now().Format("060102150405"))
path := fmt.Sprintf("public/%v", filename)
excelWriter := excel.NewXLXSWriterTo(fields, dataTable.Data)
... ...
... ... @@ -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())
... ...
... ... @@ -31,7 +31,6 @@ func (tableService *TableService) ExportDataTable(ctx *domain.Context, cmd *comm
}()
var table *domain.Table
//var mainTable *domain.Table
_, table, err = factory.FastPgTable(transactionContext, cmd.TableId)
if err != nil {
return nil, factory.FastError(err)
... ... @@ -92,7 +91,6 @@ func (tableService *TableService) ExportDataTableV2(ctx *domain.Context, cmd *co
}
defer locker.Release()
var table *domain.Table
//var mainTable *domain.Table
if cmd.ObjectType == domain.ObjectDBTable {
table = domain.DBTables[cmd.TableId]
if table == nil {
... ... @@ -120,7 +118,6 @@ func exportTableTo(ctx *domain.Context, cmd *command.TablePreviewCommand, table
var options = starrocks.QueryOptions{
TableName: table.SQLName,
Select: table.Fields(false),
//Table: table,
}
db := starrocks.DB
... ...
... ... @@ -105,12 +105,6 @@ func (tableService *TableService) RowsDelete(ctx *domain.Context, cmd *command.R
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()
//}()
var table *domain.Table
_, table, err = factory.FastPgTable(transactionContext, cmd.TableId)
... ... @@ -127,9 +121,6 @@ func (tableService *TableService) RowsDelete(ctx *domain.Context, cmd *command.R
}
options.SetCondition(cmd.Where.Conditions)
total, err := starrocks.WrapDeleteFuncWithDB(starrocks.DB)(options)
//if err := transactionContext.CommitTransaction(); err != nil {
// return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
//}
return map[string]interface{}{
"rowsAffected": total,
}, nil
... ...
... ... @@ -11,6 +11,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/application/table/query"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain/astexpr"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/domainService"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/redis"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/starrocks"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/utils"
... ... @@ -426,6 +427,9 @@ func (tableService *TableService) ApplyOn(ctx *domain.Context, cmd *command.Appl
} else {
table.TableInfo.SetApplyOn(cmd.Module)
}
defer func() {
domainService.AsyncEvent(domain.NewEventTable(ctx, domain.TableApplyOnEvent).WithTable(table).WithMetadata("module", cmd.Module))
}()
if !ctx.Access() {
for i := range cmd.Modules {
// 字库应用于数控目前限制在3万条记录以内,在字库的应用于数控按钮上增加判断,如果超过3万条,
... ...
... ... @@ -53,8 +53,7 @@ func (tableService *TableService) TableObjectSearch(searchQuery *query.SearchTab
_, querySets, _ := querySetRepository.Find(map[string]interface{}{"context": searchQuery.Context})
var (
querySetMapById = make(map[int]*domain.QuerySet)
// BindTableId , parentId
querySetMapById = make(map[int]*domain.QuerySet)
querySetMapByTableId = make(map[int]*domain.QuerySet)
)
if searchQuery.ReturnGroupItem {
... ... @@ -154,9 +153,6 @@ func filterTableByFilterRule(item *dto.TableObjectDto, searchQuery *query.Search
if rule.TableType == "*" && rule.Status > 0 && rule.Status != item.Status {
return true
}
//if rule.TableType == rule.TableType && rule.Status > 0 && rule.Status != item.Status {
// return true
//}
}
return false
}
... ...
... ... @@ -38,7 +38,7 @@ func (tableService *TableService) TablePreview(ctx *domain.Context, cmd *command
cacheMiss = true
}
}
response := &dto.TablePreviewDto{HiddenData: cmd.HiddenData}
response := &dto.TablePreviewDto{HiddenData: cmd.HiddenData, TableType: table.TableType, Name: table.Name, TableId: table.TableId}
if dataTable == nil {
switch table.TableType {
case domain.CalculateSet.ToString():
... ... @@ -52,8 +52,9 @@ func (tableService *TableService) TablePreview(ctx *domain.Context, cmd *command
if err != nil {
return nil, factory.FastError(err)
}
data, total := dataTable.FilterByWhere(cmd.Where)
response.Fields = dataTable.Fields
response.Data = domain.GripData(domain.ToFieldData(dataTable.Fields, pageData(cmd.Where.PageNumber, cmd.Where.PageSize, dataTable.Data), false), int64(len(dataTable.Data)))
response.Data = domain.GripData(domain.ToFieldData(dataTable.Fields, data, false), total)
default:
var options = starrocks.QueryOptions{
Table: table,
... ... @@ -76,8 +77,9 @@ func (tableService *TableService) TablePreview(ctx *domain.Context, cmd *command
} else {
switch table.TableType {
case domain.CalculateSet.ToString():
data, total := dataTable.FilterByWhere(cmd.Where)
response.Fields = dataTable.Fields
response.Data = domain.GripData(domain.ToFieldData(dataTable.Fields, pageData(cmd.Where.PageNumber, cmd.Where.PageSize, dataTable.Data), false), int64(len(dataTable.Data)))
response.Data = domain.GripData(domain.ToFieldData(dataTable.Fields, data, false), total)
default:
response.Load(table, dataTable, domain.ObjectMetaTable)
}
... ...
... ... @@ -14,12 +14,6 @@ var LOG_LEVEL = "debug"
var LOG_FILE = "app.log"
var PPROF_ON = true
//天联共创基础模块
//var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080" //"http://allied-creation-basic-dev.fjmaimaimai.com"
// 天联共创用户模块
var ALLIED_CREATION_USER_HOST = "http://localhost:8081" //"http://allied-creation-user-dev.fjmaimaimai.com"
var MMM_BYTE_BANK_HOST = "http://220.250.41.79:8301"
var METADATA_BASTION_HOST = "http://127.0.0.1:8080"
... ... @@ -30,31 +24,21 @@ var AUTH_SERVER_HOST = "http://digital-platform-dev.fjmaimaimai.com"
var OPEN_API_HOST = "http://mmm-open-api-test.fjmaimaimai.com"
// 数控服务域名地址
var DIGITAL_SERVER_HOST = "http://digitization-server-dev.fjmaimaimai.com"
var BLACK_LIST_USER int64
var BLACK_LIST_COMPANY int64
var WHITE_LIST_USERS []int
//var CUSTOMER_ACCOUNT = []int64{3129687560814592, 3129687690100739, 3492238958608384}
//const CUSTOMER_ACCOUNT_DELIMITER = ","
/***** 1.数据传输 *****/
//const HeaderCompanyId = "companyId"
//const HeaderUserId = "userId"
//const HeaderOrgId = "orgId"
//const HeaderOrgIds = "orgIds"
func init() {
LOG_LEVEL = Configurator.DefaultString("LOG_LEVEL", LOG_LEVEL)
//ALLIED_CREATION_BASIC_HOST = Configurator.DefaultString("ALLIED_CREATION_BASIC_HOST", ALLIED_CREATION_BASIC_HOST)
ALLIED_CREATION_USER_HOST = Configurator.DefaultString("ALLIED_CREATION_USER_HOST", ALLIED_CREATION_USER_HOST)
MMM_BYTE_BANK_HOST = Configurator.DefaultString("MMM_BYTE_BANK_HOST", MMM_BYTE_BANK_HOST)
METADATA_BASTION_HOST = Configurator.DefaultString("METADATA_BASTION_HOST", METADATA_BASTION_HOST)
BYTE_CORE_HOST = Configurator.DefaultString("BYTE_CORE_HOST", BYTE_CORE_HOST)
SERVICE_ENV = Configurator.DefaultString("SERVICE_ENV", SERVICE_ENV)
HTTP_PORT = Configurator.DefaultInt("HTTP_PORT", HTTP_PORT)
AUTH_SERVER_HOST = Configurator.DefaultString("AUTH_SERVER_HOST", AUTH_SERVER_HOST)
OPEN_API_HOST = Configurator.DefaultString("OPEN_API_HOST", OPEN_API_HOST)
SERVICE_NAME = fmt.Sprintf("%v-%v", SERVICE_NAME, SERVICE_ENV)
PPROF_ON = Configurator.DefaultBool("PPROF_ON", PPROF_ON)
CACHE_PREFIX = SERVICE_NAME + ":" + SERVICE_ENV
... ...
... ... @@ -3,5 +3,3 @@ package constant
var JWTSecretKey = "digital-platform"
var JWTExpiresIn = 60 * 60 * 24 //单位:秒
var JWTCacheExpiresIn = 60 * 60 * 24 //单位:秒
... ...
package domain
type ByteLibService interface {
// LoadDataTable 加载表数据
LoadDataTable(param ReqLoadDataTable) (*DataLoadDataTable, error)
// EditTable 编辑表结构(列重名,类型修改,列拆分 ...)
EditTable(param ReqEditDataTable) (*DataEditDataTable, error)
// SaveTable 编辑后进行表结构保存(底层生成一份新的excel文件)
SaveTable(param ReqSaveTable) (*DataSaveTable, error)
// GenerateTable 生成表 (主表)
GenerateTable(ctx *Context, param ReqGenerateTable) (*DataGenerateTable, error)
// CopyTable 复制表
CopyTable(param ReqCopyTable) (*DataCopyTable, error)
// AppendData 追加数据到指定表
AppendData(param ReqAppendData) (*DataAppendData, error)
// SplitTable 拆分表 (分表)
SplitTable(param ReqSplitTable) (*DataSplitTable, error)
// DeleteTable 删除表
DeleteTable(param ReqDeleteTable) (*DataDeleteTable, error)
// CancelFile 取消对表的操作
CancelFile(param ReqCancelFile) (*DataCancelFile, error)
// EditTableData 编辑表数据
EditTableData(param ReqEditTableData) (*DataEditTableData, error)
// FieldOptionalValues 字段可选值
FieldOptionalValues(param ReqFieldOptionalValues) (*DataFieldOptionalValues, error)
// FormulasGenerate 表达式生成 (底层生成视图)
FormulasGenerate(param ReqFormulasGenerate) (*DataFormulasGenerate, error)
// FormulasClear 表达式清除
FormulasClear(param ReqFormulasClear) (*DataFormulasClear, error)
}
... ...
package domain
import "strings"
import (
"strings"
)
type DataTable struct {
Fields []*Field `json:"fields"`
... ... @@ -113,7 +115,81 @@ func (t *DataTable) MatchFields(from []*Field) []*Field {
return from
}
func (t *DataTable) FilterByWhere(where Where) (response [][]string, length int64) {
pageNumber, pageSize := where.PageNumber, where.PageSize
response = make([][]string, 0)
wrapperFilters := func(data []string, next ...func([]string) bool) ([]string, bool) {
ok := true
for i := range next {
if !next[i](data) {
ok = false
}
if !ok {
break
}
}
if !ok {
return nil, false
}
return data, true
}
filterFuncList := make([]func([]string) bool, 0)
for _, c := range where.Conditions {
var index = 0
var filed *Field
for i, f := range t.Fields {
if f.Name == c.Field.Name {
index = i
filed = f
break
}
}
if filed == nil {
continue
}
if len(c.In) > 0 {
filterFuncList = append(filterFuncList, WithInFilter(c.In, index))
}
}
for _, data := range t.Data {
if v, ok := wrapperFilters(data, filterFuncList...); ok {
response = append(response, v)
}
}
length = int64(len(response))
response = pageData(pageNumber, pageSize, response)
return
}
type RangStruct struct {
Op string `json:"op"`
Val interface{} `json:"val"`
}
func pageData(pageNumber, pageSize int, data [][]string) [][]string {
if pageNumber == 0 || pageSize == 0 {
return data
}
offset := (pageNumber - 1) * pageSize
if len(data) < offset {
return [][]string{}
}
if len(data) < offset+pageSize {
pageSize = len(data) - offset
}
return data[offset : offset+pageSize]
}
func WithInFilter(in []interface{}, index int) func(data []string) bool {
return func(data []string) bool {
if len(data) < index {
return false
}
for _, item := range in {
if data[index] == item.(string) {
return true
}
}
return false
}
}
... ...
package domain
// FileTableService 文件表服务(导入模块)
type FileTableService interface {
// Preview 预览(Excel文件)
Preview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
// Edit 编辑表
Edit()
// Flush 保存编辑状态的表元数据
Flush(ctx *Context, fileId int, table *Table) (interface{}, error)
// DeleteFiles 批量删除文件
DeleteFiles(ctx *Context, files ...*File) error
// GenerateTable 生成主表
GenerateTable(ctx *Context, fileId int, tableName string) (interface{}, error)
}
// TableService 表服务
type TableService interface {
// Preview 预览
Preview(ctx *Context, tableId int, where Where) (interface{}, error)
// CopyTable 拷贝表
CopyTable(ctx *Context, tableId int, tableName string) (interface{}, error)
// DeleteTables 删除表
DeleteTables(ctx *Context, tables ...*Table) error
// AppendData 追加表数据
AppendData(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
// UpdateTableStruct 更新表结构(分表)
UpdateTableStruct(ctx *Context, tableId int, fields []*Field, name string) (interface{}, error)
// AddTableStruct 添加表结构(分表)
AddTableStruct(ctx *Context, parentTableId int, fields []*Field, name string) (interface{}, error)
}
// PreviewDataTableService 具体的表预览服务
type PreviewDataTableService interface {
// Preview 预览
Preview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
// RePreview 重新预览
RePreview(ctx *Context, fileId int, fields []*Field, where Where) (interface{}, error)
// CreateTemporaryFile 创建临时文件(计算集修改的时候,先创建临时文件,保存成功后覆盖原文件)
CreateTemporaryFile(ctx *Context, fileId int) (*File, error)
GetFileId() int
}
// EditDataTableService 编辑表数据(副表)
type EditDataTableService interface {
Edit(ctx *Context, param EditTableRequest) (*DataEditDataTable, error)
}
// FlushDataTableService 保存编辑状态的表
type FlushDataTableService interface {
Flush(ctx *Context, fileId int, table *Table) (interface{}, error)
}
// DeleteFileService 删除文件服务
type DeleteFileService interface {
DeleteFiles(ctx *Context, files ...*File) error
}
// GenerateMainTableService 生成主表服务
type GenerateMainTableService interface {
GenerateTable(ctx *Context, fileId int, tableName string) (interface{}, error)
}
// CopyDataTableService 拷贝表服务
type CopyDataTableService interface {
CopyTable(ctx *Context, tableId int, tableName string) (interface{}, error)
}
// DeleteDataTableService 删除表服务
type DeleteDataTableService interface {
DeleteTable(ctx *Context, tableId int) (interface{}, error)
DeleteTables(ctx *Context, tables ...*Table) error
}
// AppendDataToTableService 追加数据服务
type AppendDataToTableService interface {
AppendData(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
PreflightCheck(ctx *Context, fileId int, tableId int, mappingFields []*MappingField) (interface{}, error)
... ... @@ -56,10 +80,12 @@ type AppendDataToTableService interface {
/************************************/
// UpdateTableStructService 更新表结构服务(分表)
type UpdateTableStructService interface {
UpdateTableStruct(ctx *Context, tableId int, fields []*Field, name string) (interface{}, error)
}
// AddTableStructService 添加表结构服务(分表)
type AddTableStructService interface {
AddTableStruct(ctx *Context, parentTableId int, fields []*Field, name string) (*Table, error)
}
... ...
... ... @@ -14,25 +14,33 @@ const (
TableDeleteEvent EventType = "table.delete"
QuerySetUpdateEvent EventType = "table.query.set.update"
QuerySetUpdateRenameEvent EventType = "table.query.set.update.rename"
TableApplyOnEvent EventType = "table.apply-on"
QuerySetUpdateStatusEvent EventType = "table.query.set.update.status" // 禁用启用
QuerySetDeleteEvent EventType = "table.query.set.delete" // 删除
)
// EventTable 表事件
type EventTable struct {
Context *Context
Type EventType
Table *Table
QuerySet *QuerySet
Metadata map[string]interface{}
}
func NewEventTable(ctx *Context, t EventType) *EventTable {
return &EventTable{
Context: ctx,
Type: t,
Context: ctx,
Type: t,
Metadata: make(map[string]interface{}),
}
}
func (et *EventTable) WithContext(t *Context) *EventTable {
et.Context = t
return et
}
func (et *EventTable) WithType(t EventType) *EventTable {
et.Type = t
return et
... ... @@ -48,11 +56,17 @@ func (et *EventTable) WithQuerySet(t *QuerySet) *EventTable {
return et
}
func (et *EventTable) WithMetadata(key string, values interface{}) *EventTable {
et.Metadata[key] = values
return et
}
func (et *EventTable) ResolveEvent(e event.Event) {
et.Context = e.Get("Context").(*Context)
et.Type = e.Get("Type").(EventType)
et.Table = e.Get("Table").(*Table)
et.QuerySet = e.Get("QuerySet").(*QuerySet)
et.Metadata = e.Get("Metadata").(map[string]interface{})
}
func (et *EventTable) FireEvent() event.Event {
... ... @@ -61,5 +75,6 @@ func (et *EventTable) FireEvent() event.Event {
e["Type"] = et.Type
e["Table"] = et.Table
e["QuerySet"] = et.QuerySet
e["Metadata"] = et.Metadata
return event.MustFire(et.Type.ToString(), e)
}
... ...
... ... @@ -93,12 +93,10 @@ func (file *File) CopyTo(fileType FileType, ctx *Context) *File {
}
func (file *File) SetHeaderRow(headerRow int) *File {
//file.FileInfo.HeaderRow = headerRow
return file
}
func (file *File) SetContext(context *Context) *File {
//file.FileInfo.HeaderRow = headerRow
file.Context = context
return file
}
... ...
... ... @@ -176,3 +176,12 @@ func (tables Tables) ToMap() map[int]*Table {
}
return result
}
func AssertTableType(tableType string, types ...TableType) bool {
for _, item := range types {
if tableType == item.ToString() {
return true
}
}
return false
}
... ...
package digitalLib
import (
"github.com/beego/beego/v2/core/logs"
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/infrastructure/api"
"net/http"
"time"
)
type DigitalLib struct {
Token string
api.BaseServiceGateway
}
func (gateway *DigitalLib) WithToken(token string) *DigitalLib {
gateway.Token = token
return gateway
}
func (gateway *DigitalLib) DefaultHeader() http.Header {
var header = make(map[string][]string)
header["x-mmm-accesstoken"] = []string{gateway.Token}
return header
}
func NewDigitalLib(host string) *DigitalLib {
gt := api.NewBaseServiceGateway(host)
gt.ConnectTimeout = 360 * time.Second
gt.ReadWriteTimeout = 360 * time.Second
gt.Interceptor = func(msg string) {
//log.Logger.Info(msg)
logs.Debug(msg)
}
gt.ServiceName = "【数控中心】"
return &DigitalLib{
BaseServiceGateway: gt,
}
}
func (gateway *DigitalLib) SyncNotice(param RequestSyncNotice) (*DataSyncNotice, error) {
url := gateway.Host() + "/api/sync/notice"
method := "post"
var data DataSyncNotice
err := gateway.FastDoRequest(url, method, param.Body, &data, api.WithHeader(gateway.DefaultHeader()))
if err != nil {
return nil, err
}
return &data, nil
}
... ...
package digitalLib
type RequestSyncNotice struct {
Body interface{}
}
type DataSyncNotice struct{}
... ...
... ... @@ -14,6 +14,8 @@ type ByteCoreService struct {
TempDataTable map[int]*domain.DataLoadDataTable
}
// ByteCore 字库底层核心
// 主表、拆分、数据读取等功能
var ByteCore domain.ByteLibService = &WrapByteCoreService{} //&ByteCoreService{}
var _ domain.ByteLibService = (*ByteCoreService)(nil)
... ...
... ... @@ -7,6 +7,7 @@ import (
"time"
)
// AsyncEvent 同步事件
func AsyncEvent(e *domain.EventTable) {
go func() {
defer func() {
... ... @@ -17,6 +18,6 @@ func AsyncEvent(e *domain.EventTable) {
e.FireEvent()
}()
log.Logger.Info("开始事件..." + e.Type.ToString())
time.Sleep(time.Millisecond * 400)
time.Sleep(time.Millisecond * 10)
log.Logger.Info("结束事件..." + e.Type.ToString())
}
... ...
... ... @@ -14,7 +14,7 @@ type PreviewDataTableService struct {
transactionContext *pgTransaction.TransactionContext
}
// RePreview 重新预览
// RePreview 重新预览,表头重置时,前端调用重新预览接口,重置缓存的表头行号
func (ptr *PreviewDataTableService) RePreview(ctx *domain.Context, fileId int, fields []*domain.Field, where domain.Where) (interface{}, error) {
fileRepository, _ := repository.NewFileRepository(ptr.transactionContext)
file, err := fileRepository.FindOne(map[string]interface{}{"fileId": fileId})
... ...
... ... @@ -14,6 +14,7 @@ type PGLogService struct {
transactionContext *pgTransaction.TransactionContext
}
// NewPGLogService 服务操作日志记录
func NewPGLogService(transactionContext *pgTransaction.TransactionContext) (*PGLogService, error) {
if transactionContext == nil {
return nil, fmt.Errorf("transactionContext参数不能为nil")
... ... @@ -24,6 +25,7 @@ func NewPGLogService(transactionContext *pgTransaction.TransactionContext) (*PGL
}
}
// FastLog 快速记录日志
func FastLog(transactionContext *pgTransaction.TransactionContext, logType domain.LogType, sourceId int, logEntry Log) error {
logService, _ := NewPGLogService(transactionContext)
return logService.Log(logType, sourceId, logEntry)
... ...
... ... @@ -21,6 +21,7 @@ var (
ErrFieldsNotMatch = func(table string) error { return fmt.Errorf("[%v]字段数量不一致或类型不匹配", table) }
)
// QuerySetService 查询集服务,对拆分、计算模块数据集合的处理
type QuerySetService struct {
transactionContext *pgTransaction.TransactionContext
}
... ... @@ -958,6 +959,10 @@ func (ptr *QuerySetService) ChangeStatus(ctx *domain.Context, querySetId int, st
if _, err = tableRepository.Save(table); err != nil {
return err
}
defer func() {
AsyncEvent(domain.NewEventTable(ctx, domain.QuerySetUpdateStatusEvent).WithTable(table).WithQuerySet(qs).WithMetadata("status", status))
}()
}
return nil
}
... ... @@ -1075,6 +1080,7 @@ func (ptr *QuerySetService) Delete(ctx *domain.Context, querySetId int) error {
}
starrocks.DropView(starrocks.DB, t.SQLName)
}
AsyncEvent(domain.NewEventTable(ctx, domain.QuerySetDeleteEvent).WithQuerySet(querySets[i]).WithTable(t))
}
}
// 2.底层清理
... ...
... ... @@ -5,6 +5,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain/astexpr"
)
// LoadCalculateItemData 加载计算项数据,实时计算某个列的值
func (ptr *QuerySetService) LoadCalculateItemData(ctx *domain.Context, t *domain.Table, formula *domain.FieldFormulaExpr) (*domain.DataTable, error) {
var (
res = &domain.DataTable{}
... ...
... ... @@ -15,6 +15,7 @@ import (
const DefaultExpandNum = 1000
const MaxExpandNum = 5000
// LoadCalculateSetData 加载计算集数据,根据排列规则,动态进行集合数据排列,返回一个二维表
func (ptr *QuerySetService) LoadCalculateSetData(ctx *domain.Context, qs *domain.QuerySet, queryComponents []*domain.QueryComponent) (*domain.DataTable, error) {
var (
res = &domain.DataTable{}
... ...
... ... @@ -21,6 +21,7 @@ func NewAddTableStructService(transactionContext *pgTransaction.TransactionConte
}
}
// AddTableStruct 添加表结构(新建分表)
func (ptr *AddTableStructService) AddTableStruct(ctx *domain.Context, parentTableId int, fields []*domain.Field, name string) (*domain.Table, error) {
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
mainTable, err := tableRepository.FindOne(map[string]interface{}{"tableId": parentTableId})
... ...
... ... @@ -73,6 +73,7 @@ func (ptr *DeleteDataTableService) DeleteTables(ctx *domain.Context, tables ...*
if _, err := tableRepository.Remove(t); err != nil {
return err
}
AsyncEvent(domain.NewEventTable(ctx, domain.TableDeleteEvent).WithTable(t))
tableIds = append(tableIds, t.TableId)
}
// delete log
... ...
... ... @@ -43,6 +43,9 @@ func NewCircleDependError(t *domain.Table, qs *domain.QuerySet) CircleDependErro
}
}
// TableDependencyService 表依赖服务
// 查询表所有的依赖关系
// 判断是否循环依赖
type TableDependencyService struct {
transactionContext *pgTransaction.TransactionContext
DetectedCycleCallBack func()
... ... @@ -330,6 +333,9 @@ func NewTableDependTree(tree []int, tableMap map[int]*domain.Table) TableDependT
Edges: make([]TableEdge, 0),
Tree: tree,
}
if len(tree) == 0 || tableMap == nil {
return dependTree
}
for _, node := range tree {
t, ok := tableMap[node]
... ... @@ -348,11 +354,14 @@ func NewTableDependTree(tree []int, tableMap map[int]*domain.Table) TableDependT
return dependTree
}
func NewTableNode(table *domain.Table) TableNode {
if table == nil {
return TableNode{}
}
return TableNode{
TableId: table.TableId,
Type: table.TableType,
Name: table.Name,
DependencyTables: table.TableInfo.DependencyTables,
DependencyTables: table.DependencyTables(),
}
}
func NewTableEdge(table *domain.Table, dependTable *domain.Table) TableEdge {
... ...
... ... @@ -23,6 +23,7 @@ func NewTableEditDataService(transactionContext *pgTransaction.TransactionContex
}
}
// RowEdit 行数据编辑
func (ptr *TableEditDataService) RowEdit(ctx *domain.Context, request domain.EditDataRequest) (interface{}, error) {
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
var table *domain.Table = request.Table
... ... @@ -57,11 +58,6 @@ func (ptr *TableEditDataService) RowEdit(ctx *domain.Context, request domain.Edi
if err = starrocks.BatchDelete(starrocks.DB, table.SQLName, request.RemoveList); err != nil {
return nil, err
}
//for _, l := range request.RemoveList {
// if e := ptr.remove(ctx, table, l, request.Where); e != nil {
// log.Logger.Error(e.Error())
// }
//}
}
for _, l := range request.UpdateList {
if e := ptr.update(ctx, table, l, request.Where); e != nil {
... ...
... ... @@ -24,6 +24,7 @@ func NewUpdateTableStructService(transactionContext *pgTransaction.TransactionCo
}
}
// UpdateTableStruct 更新表结构
func (ptr *UpdateTableStructService) UpdateTableStruct(ctx *domain.Context, tableId int, fields []*domain.Field, name string) (interface{}, error) {
tableRepository, _ := repository.NewTableRepository(ptr.transactionContext)
table, err := tableRepository.FindOne(map[string]interface{}{"tableId": tableId})
... ... @@ -80,16 +81,10 @@ func (ptr *UpdateTableStructService) UpdateTableStruct(ctx *domain.Context, tabl
if _, err = ByteCore.SplitTable(domain.ReqSplitTable{FromTable: mainTable, ToSubTable: table}); err != nil {
return nil, err
}
//var tablesAffected []TableNode
//if len(adds) > 0 {
// tablesAffected, _ = DependencyTables(ptr.transactionContext, ctx, tableId)
//}
//return map[string]interface{}{
// "tablesAffected": tablesAffected,
//}, nil
return struct{}{}, nil
}
// DependencyTables 依赖的表列表
func DependencyTables(ptr *pgTransaction.TransactionContext, context *domain.Context, tableId int) ([]TableNode, error) {
ret := make([]TableNode, 0)
// tableId 相关联的
... ... @@ -140,29 +135,6 @@ func DependencyTables(ptr *pgTransaction.TransactionContext, context *domain.Con
return ret, nil
}
//func MappingFields(mainTable *domain.Table, fields []*domain.Field) []*domain.Field {
// tableFields := mainTable.Fields(false)
// tableFieldsMap := (domain.Fields)(tableFields).ToMap()
// for i := range fields {
// f := fields[i]
// if v, ok := tableFieldsMap[f.Name]; ok {
// fields[i].Name = v.Name
// fields[i].SQLName = v.SQLName
// fields[i].Index = v.Index
// fields[i].SQLType = v.SQLType
// fields[i].Description = f.Description
// fields[i].Flag = v.Flag
// } else {
// if f.Flag == domain.ManualField && f.Index == 0 {
// mainTable.DataFieldIndex += 1
// fields[i] = DataField(f.Name, f.SQLType, domain.ManualField, mainTable.DataFieldIndex)
// fields[i].Description = f.Description
// }
// }
// }
// return fields
//}
func MappingFieldsV2(mainTable *domain.Table, fields []*domain.Field) []*domain.Field {
tableFields := mainTable.Fields(false)
tableFieldsMap := (domain.Fields)(tableFields).ToMap()
... ... @@ -179,7 +151,6 @@ func MappingFieldsV2(mainTable *domain.Table, fields []*domain.Field) []*domain.
builder.NewDataField(v.Name, v.SQLType, v.Flag)
} else {
if f.Flag == domain.ManualField {
//mainTable.DataFieldIndex += 1
fields[i] = builder.NewDataField(f.Name, f.SQLType, domain.ManualField)
fields[i].Description = f.Description
}
... ...
... ... @@ -14,9 +14,6 @@ func Insert(db *gorm.DB, tableName string, fields []*domain.FieldValue) error {
value := map[string]interface{}{}
for _, f := range fields {
if f.Field.Flag == domain.PKField && f.Value == "" {
//continue
//id, _ := uuid.NewUUID()
// idString := id.String()
// 需要调用分布式id生成
id, _ := utils.NewSnowflakeId()
idString := fmt.Sprintf("%d", id)
... ... @@ -24,8 +21,6 @@ func Insert(db *gorm.DB, tableName string, fields []*domain.FieldValue) error {
}
value[f.Field.SQLName] = f.TypeValue()
}
//tx := db.Table(tableName).Create(value)
//return tx.Error
sql := db.ToSQL(func(tx *gorm.DB) *gorm.DB {
return tx.Table(tableName).Create(value)
})
... ... @@ -45,8 +40,6 @@ func Update(db *gorm.DB, tableName string, fields []*domain.FieldValue) error {
if pk == nil && pk.Value != "" && pk.TypeValue() != nil {
return fmt.Errorf("主键不能为空")
}
//tx := db.Table(tableName).Where("? = ?", pk.Field.SQLName, pk.Value).Updates(value)
//return tx.Error
sql := db.ToSQL(func(tx *gorm.DB) *gorm.DB {
return tx.Table(tableName).Create(value)
})
... ... @@ -64,8 +57,6 @@ func Delete(db *gorm.DB, tableName string, fields []*domain.FieldValue) error {
if pk == nil {
return fmt.Errorf("主键不能为空")
}
//tx := db.Table(tableName).Delete("? = ?", pk.Field.SQLName, pk.Value)
//return tx.Error
sql := db.ToSQL(func(tx *gorm.DB) *gorm.DB {
return tx.Table(tableName).Delete("? = ?", pk.Field.SQLName, pk.Value)
})
... ...
... ... @@ -222,9 +222,6 @@ func (c Condition) CastTypeByField(f *domain.Field, t string) string {
}
func formatFiled(f *domain.Field) string {
//if f.SQLType == domain.Float.ToString() || f.SQLType == domain.DECIMAL279.ToString() {
// return castTypeAlias(f.SQLName, domain.DECIMALV2.ToString())
//}
return f.SQLName
}
... ... @@ -346,15 +343,6 @@ func WrapDeleteFuncWithDB(db *gorm.DB) func(QueryOptions) (int64, error) {
return func(params QueryOptions) (int64, error) {
query := db.Table(params.TableName)
queryWithoutLimitOffset(query, params)
//if params.Offset > 0 {
// query.Offset(params.Offset)
//}
//if params.Limit > 0 {
// query.Limit(params.Limit)
//}
//if params.Context != nil {
// query.Where(fmt.Sprintf("context->>'companyId'='%v'", params.Context.CompanyId))
//}
rows, err := query.Rows()
defer rows.Close()
if err != nil {
... ...
... ... @@ -34,17 +34,6 @@ func Init() error {
}
func Test() {
//var result [][]interface{}
//query := DB.Raw("select * from sales_performance_area_belongs").Select(&result)
//if query.Error != nil {
// log.Logger.Error(query.Error.Error())
//}
//if len(result) > 0 {
//
//}
//rows, err := DB.Raw("select * from sales_performance_area_belongs").Rows()
rows, err := DB.Table("sales_performance_area_categorys").Rows()
if err != nil {
log.Logger.Error(err.Error())
... ...
... ... @@ -15,4 +15,7 @@ func RegisterEvent() {
event.On(domain.TableDeleteEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
event.On(domain.QuerySetUpdateEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
event.On(domain.QuerySetUpdateRenameEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
event.On(domain.QuerySetUpdateStatusEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
event.On(domain.TableApplyOnEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
event.On(domain.QuerySetDeleteEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
}
... ...