20 lines
946 B
Go
20 lines
946 B
Go
package excel
|
|
|
|
import (
|
|
"electricity_bill_calc/model"
|
|
"io"
|
|
)
|
|
|
|
var meterReadingsRecognizers = []*ColumnRecognizer{
|
|
{Pattern: [][]string{{"表", "表计"}, {"编号"}}, Tag: "code", MatchIndex: -1, MustFill: true},
|
|
{Pattern: [][]string{{"抄表", "结束"}, {"时间", "日期"}}, Tag: "readAt", MatchIndex: -1, MustFill: true},
|
|
{Pattern: [][]string{{"用电", "有功", "表底", "底数"}, {"总", "量"}}, Tag: "overall", MatchIndex: -1, MustFill: true},
|
|
{Pattern: [][]string{{"有功", "表底", "底数"}, {"尖", "尖锋"}}, Tag: "critical", MatchIndex: -1},
|
|
{Pattern: [][]string{{"有功", "表底", "底数"}, {"峰"}}, Tag: "peak", MatchIndex: -1},
|
|
{Pattern: [][]string{{"有功", "表底", "底数"}, {"谷"}}, Tag: "valley", MatchIndex: -1},
|
|
}
|
|
|
|
func NewMeterReadingsExcelAnalyzer(file io.Reader) (*ExcelAnalyzer[model.ReadingImportRow], error) {
|
|
return NewExcelAnalyzer[model.ReadingImportRow](file, meterReadingsRecognizers)
|
|
}
|