|
@@ -94,7 +94,12 @@ func (d *FilePreviewDto) Load(fileId int, m *domain.DataLoadDataTable, file *red |
|
@@ -94,7 +94,12 @@ func (d *FilePreviewDto) Load(fileId int, m *domain.DataLoadDataTable, file *red |
94
|
d.TableType = domain.ExcelTable.ToString()
|
94
|
d.TableType = domain.ExcelTable.ToString()
|
95
|
d.Fields = m.Fields
|
95
|
d.Fields = m.Fields
|
96
|
var fields []*domain.Field
|
96
|
var fields []*domain.Field
|
97
|
- mapData := domain.ToFieldData(m.Fields, m.Data, true)
|
97
|
+ mapData := domain.ToFieldData(m.Fields, formatData(m.Data, func(s string) string {
|
|
|
98
|
+ if s == "<NA>" {
|
|
|
99
|
+ return ""
|
|
|
100
|
+ }
|
|
|
101
|
+ return s
|
|
|
102
|
+ }), true)
|
98
|
d.Data = domain.GripData(mapData, int64(m.Total))
|
103
|
d.Data = domain.GripData(mapData, int64(m.Total))
|
99
|
d.PageNumber = m.PageNumber
|
104
|
d.PageNumber = m.PageNumber
|
100
|
|
105
|
|
|
@@ -115,6 +120,15 @@ func (ptr *PreviewDataTableService) GetFileId() int { |
|
@@ -115,6 +120,15 @@ func (ptr *PreviewDataTableService) GetFileId() int { |
115
|
return ptr.FileId
|
120
|
return ptr.FileId
|
116
|
}
|
121
|
}
|
117
|
|
122
|
|
|
|
123
|
+func formatData(data [][]string, f func(s string) string) [][]string {
|
|
|
124
|
+ for i := 0; i < len(data); i++ {
|
|
|
125
|
+ for j := 0; j < len(data[i]); j++ {
|
|
|
126
|
+ data[i][j] = f(data[i][j])
|
|
|
127
|
+ }
|
|
|
128
|
+ }
|
|
|
129
|
+ return data
|
|
|
130
|
+}
|
|
|
131
|
+
|
118
|
func NewLoadDataTableService(transactionContext *pgTransaction.TransactionContext) (*PreviewDataTableService, error) {
|
132
|
func NewLoadDataTableService(transactionContext *pgTransaction.TransactionContext) (*PreviewDataTableService, error) {
|
119
|
if transactionContext == nil {
|
133
|
if transactionContext == nil {
|
120
|
return nil, fmt.Errorf("transactionContext参数不能为nil")
|
134
|
return nil, fmt.Errorf("transactionContext参数不能为nil")
|