feat(report):已完成用户抄表记录的上传处理。

This commit is contained in:
徐涛
2022-08-23 10:27:41 +08:00
parent ba7af386c4
commit 1d60706108
6 changed files with 298 additions and 0 deletions

34
exceptions/batch_error.go Normal file
View File

@@ -0,0 +1,34 @@
package exceptions
import (
"electricity_bill_calc/excel"
"fmt"
)
type BatchError struct {
Errs []error
}
func NewBatchError() *BatchError {
return &BatchError{Errs: make([]error, 0)}
}
func (e *BatchError) AddError(errs ...error) {
e.Errs = append(e.Errs, errs...)
}
func (e BatchError) Len() int {
return len(e.Errs)
}
func NewBatchExcelAnalysisError(errs []excel.ExcelAnalysisError) *BatchError {
be := &BatchError{Errs: make([]error, 0)}
for _, e := range errs {
be.Errs = append(be.Errs, e)
}
return be
}
func (e BatchError) Error() string {
return fmt.Sprintf("存在批量错误,共 %d 个", len(e.Errs))
}