forked from free-lancers/electricity_bill_calc_service
		
	fix(excel):修正部分文案,增加对于错误信息的JSON输出定义。
This commit is contained in:
		| @@ -25,9 +25,9 @@ type ExcelAnalyzer[T any] struct { | ||||
| } | ||||
|  | ||||
| type ExcelAnalysisError struct { | ||||
| 	Row int | ||||
| 	Col int | ||||
| 	Err error | ||||
| 	Row int   `json:"row"` | ||||
| 	Col int   `json:"col"` | ||||
| 	Err error `json:"error"` | ||||
| } | ||||
|  | ||||
| func NewColumnRecognizer(tag string, patterns ...string) ColumnRecognizer { | ||||
| @@ -137,7 +137,7 @@ func (a *ExcelAnalyzer[T]) Analysis(bean T) ([]T, []ExcelAnalysisError) { | ||||
| 							} else { | ||||
| 								v, err := strconv.Atoi(matchValue) | ||||
| 								if err != nil { | ||||
| 									errs = append(errs, ExcelAnalysisError{Row: rowIndex + 1, Col: recognizer.MatchIndex + 1, Err: fmt.Errorf("单元格内容应为不带小鼠的整数。%w", err)}) | ||||
| 									errs = append(errs, ExcelAnalysisError{Row: rowIndex + 1, Col: recognizer.MatchIndex + 1, Err: fmt.Errorf("单元格内容应为不带小数的整数。%w", err)}) | ||||
| 									actualField.SetInt(0) | ||||
| 								} else { | ||||
| 									actualField.SetInt(int64(v)) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user