mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 15:07:33 +08:00
code refactor
This commit is contained in:
@@ -114,6 +114,7 @@ func (c *feideeMymoneyAppTransactionDataCsvFileImporter) createNewFeideeMymoneyA
|
||||
continue
|
||||
} else {
|
||||
log.Warnf(ctx, "[feidee_mymoney_app_transaction_data_csv_file_importer.createNewFeideeMymoneyAppTransactionDataTable] read unexpected line before read file header, line content is %s", strings.Join(items, ","))
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +180,6 @@ func (c *feideeMymoneyAppTransactionDataCsvFileImporter) createNewFeideeMymoneyA
|
||||
}
|
||||
|
||||
data := make(map[datatable.TransactionDataTableColumn]string, 11)
|
||||
relatedId := ""
|
||||
|
||||
for columnType, columnName := range feideeMymoneyAppDataColumnNameMapping {
|
||||
if dataRow.HasData(columnName) {
|
||||
@@ -187,10 +187,6 @@ func (c *feideeMymoneyAppTransactionDataCsvFileImporter) createNewFeideeMymoneyA
|
||||
}
|
||||
}
|
||||
|
||||
if dataRow.HasData(feideeMymoneyAppTransactionRelatedIdColumnName) {
|
||||
relatedId = dataRow.GetData(feideeMymoneyAppTransactionRelatedIdColumnName)
|
||||
}
|
||||
|
||||
transactionType := data[datatable.TRANSACTION_DATA_TABLE_TRANSACTION_TYPE]
|
||||
|
||||
if transactionType == feideeMymoneyAppTransactionTypeModifyBalanceText || transactionType == feideeMymoneyAppTransactionTypeIncomeText || transactionType == feideeMymoneyAppTransactionTypeExpenseText {
|
||||
@@ -207,6 +203,12 @@ func (c *feideeMymoneyAppTransactionDataCsvFileImporter) createNewFeideeMymoneyA
|
||||
data[datatable.TRANSACTION_DATA_TABLE_RELATED_AMOUNT] = ""
|
||||
transactionDataTable.Add(data)
|
||||
} else if transactionType == feideeMymoneyAppTransactionTypeTransferInText || transactionType == feideeMymoneyAppTransactionTypeTransferOutText {
|
||||
relatedId := ""
|
||||
|
||||
if dataRow.HasData(feideeMymoneyAppTransactionRelatedIdColumnName) {
|
||||
relatedId = dataRow.GetData(feideeMymoneyAppTransactionRelatedIdColumnName)
|
||||
}
|
||||
|
||||
if relatedId == "" {
|
||||
log.Errorf(ctx, "[feidee_mymoney_app_transaction_data_csv_file_importer.createNewFeideeMymoneyAppTransactionDataTable] transfer transaction has blank related id in row \"%s\"", rowId)
|
||||
return nil, errs.ErrRelatedIdCannotBeBlank
|
||||
|
||||
Reference in New Issue
Block a user