正在显示
4 个修改的文件
包含
26 行增加
和
0 行删除
@@ -61,6 +61,12 @@ func (fileService *FileService) CreateFile(ctx *domain.Context, createFileComman | @@ -61,6 +61,12 @@ func (fileService *FileService) CreateFile(ctx *domain.Context, createFileComman | ||
61 | oldFile.FileInfo = fileInfo | 61 | oldFile.FileInfo = fileInfo |
62 | oldFile.UpdatedAt = time.Now() | 62 | oldFile.UpdatedAt = time.Now() |
63 | newFile = oldFile | 63 | newFile = oldFile |
64 | + | ||
65 | + if err = factory.FastLog(transactionContext, domain.CommonLog, oldFile.FileId, &domainService.FileReplaceLog{ | ||
66 | + LogEntry: domain.NewLogEntry(oldFile.FileInfo.Name, domain.SourceFile.ToString(), domain.FileUpload, ctx), | ||
67 | + }); err != nil { | ||
68 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
69 | + } | ||
64 | } | 70 | } |
65 | 71 | ||
66 | file, err := fileRepository.Save(newFile) | 72 | file, err := fileRepository.Save(newFile) |
@@ -24,6 +24,7 @@ var ( | @@ -24,6 +24,7 @@ var ( | ||
24 | DeleteTable OperationType = "DeleteTable" // 表删除 | 24 | DeleteTable OperationType = "DeleteTable" // 表删除 |
25 | FileUpload OperationType = "FileUpload" // 文件上传 | 25 | FileUpload OperationType = "FileUpload" // 文件上传 |
26 | FileVerify OperationType = "FileVerify" // 文件校验 | 26 | FileVerify OperationType = "FileVerify" // 文件校验 |
27 | + FileReplace OperationType = "FileReplace" // 文件替换 | ||
27 | 28 | ||
28 | ExcelTableEdit OperationType = "ExcelTableEdit" // 文档表格编辑 | 29 | ExcelTableEdit OperationType = "ExcelTableEdit" // 文档表格编辑 |
29 | 30 | ||
@@ -58,6 +59,7 @@ var OperationTypeMap = map[string]string{ | @@ -58,6 +59,7 @@ var OperationTypeMap = map[string]string{ | ||
58 | DeleteTable.ToString(): "表删除", | 59 | DeleteTable.ToString(): "表删除", |
59 | FileUpload.ToString(): "文件上传", | 60 | FileUpload.ToString(): "文件上传", |
60 | FileVerify.ToString(): "文件校验", | 61 | FileVerify.ToString(): "文件校验", |
62 | + FileReplace.ToString(): "文件覆盖", | ||
61 | ExcelTableEdit.ToString(): "文档表格编辑", | 63 | ExcelTableEdit.ToString(): "文档表格编辑", |
62 | 64 | ||
63 | CreateSchema.ToString(): "新增方案", | 65 | CreateSchema.ToString(): "新增方案", |
@@ -82,6 +82,15 @@ func (ptr *FlushDataTableService) flushSourceFile(ctx *domain.Context, table *do | @@ -82,6 +82,15 @@ func (ptr *FlushDataTableService) flushSourceFile(ctx *domain.Context, table *do | ||
82 | if err != nil { | 82 | if err != nil { |
83 | return err | 83 | return err |
84 | } | 84 | } |
85 | + if len(files) > 0 { | ||
86 | + for _, existFile := range files { | ||
87 | + if err = FastLog(ptr.transactionContext, domain.CommonLog, file.FileId, &FileReplaceLog{ | ||
88 | + LogEntry: domain.NewLogEntry(existFile.FileInfo.Name, domain.VerifiedFile.ToString(), domain.FileUpload, ctx), | ||
89 | + }); err != nil { | ||
90 | + return err | ||
91 | + } | ||
92 | + } | ||
93 | + } | ||
85 | deleteFileService, _ := NewDeleteFileService(ptr.transactionContext) | 94 | deleteFileService, _ := NewDeleteFileService(ptr.transactionContext) |
86 | if err = deleteFileService.DeleteFiles(ctx, files...); err != nil { | 95 | if err = deleteFileService.DeleteFiles(ctx, files...); err != nil { |
87 | return err | 96 | return err |
@@ -127,6 +127,15 @@ func (l *FileVerifyLog) Content() string { | @@ -127,6 +127,15 @@ func (l *FileVerifyLog) Content() string { | ||
127 | return msg | 127 | return msg |
128 | } | 128 | } |
129 | 129 | ||
130 | +// FileReplaceLog 1.1文件已被覆盖 | ||
131 | +type FileReplaceLog struct { | ||
132 | + domain.LogEntry | ||
133 | +} | ||
134 | + | ||
135 | +func (l *FileReplaceLog) Content() string { | ||
136 | + return fmt.Sprintf("该文件已被覆盖") | ||
137 | +} | ||
138 | + | ||
130 | // GenerateMainTableLog 3.主表生成日志 | 139 | // GenerateMainTableLog 3.主表生成日志 |
131 | type GenerateMainTableLog struct { | 140 | type GenerateMainTableLog struct { |
132 | domain.LogEntry | 141 | domain.LogEntry |
-
请 注册 或 登录 后发表评论