正在显示
1 个修改的文件
包含
11 行增加
和
12 行删除
@@ -184,7 +184,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -184,7 +184,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
184 | excelImport.DataFields = []excel.DataField{ | 184 | excelImport.DataFields = []excel.DataField{ |
185 | {EnName: "userCode", CnName: "*用户编号"}, | 185 | {EnName: "userCode", CnName: "*用户编号"}, |
186 | {EnName: "userName", CnName: "*用户姓名"}, | 186 | {EnName: "userName", CnName: "*用户姓名"}, |
187 | - {EnName: "organization", CnName: "*组织机构"}, | 187 | + {EnName: "org", CnName: "*组织机构"}, |
188 | {EnName: "department", CnName: "*所属部门"}, | 188 | {EnName: "department", CnName: "*所属部门"}, |
189 | {EnName: "phone", CnName: "*手机号"}, | 189 | {EnName: "phone", CnName: "*手机号"}, |
190 | {EnName: "email", CnName: "邮箱"}, | 190 | {EnName: "email", CnName: "邮箱"}, |
@@ -200,7 +200,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -200,7 +200,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
200 | CompanyId: importDataCommand.Operator.CompanyId, | 200 | CompanyId: importDataCommand.Operator.CompanyId, |
201 | UserType: domain.UserTypeEmployee, | 201 | UserType: domain.UserTypeEmployee, |
202 | UserCode: v["userCode"], | 202 | UserCode: v["userCode"], |
203 | - Org: v["organization"], | 203 | + Org: v["org"], |
204 | Department: v["department"], | 204 | Department: v["department"], |
205 | UserName: v["userName"], | 205 | UserName: v["userName"], |
206 | Phone: v["phone"], | 206 | Phone: v["phone"], |
@@ -222,15 +222,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | @@ -222,15 +222,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD | ||
222 | if err != nil { | 222 | if err != nil { |
223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | 223 | return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) |
224 | } | 224 | } |
225 | - return srv.importResultWithHeader(map[string]interface{}{ | ||
226 | - "userCode": "*用户编号", | ||
227 | - "userName": "*用户姓名", | ||
228 | - "organization": "*组织机构", | ||
229 | - "department": "*所属部门", | ||
230 | - "phone": "*手机号", | ||
231 | - "email": "邮箱", | ||
232 | - "enableStatus": "状态", | ||
233 | - }, result.FailRows, len(excelData)), nil | 225 | + return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(excelData)), nil |
234 | } | 226 | } |
235 | 227 | ||
236 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { | 228 | func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) { |
@@ -266,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | @@ -266,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import | ||
266 | } | 258 | } |
267 | 259 | ||
268 | // 导入结果 | 260 | // 导入结果 |
269 | -func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows []interface{}, totalRow int) interface{} { | 261 | +func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, failRows []interface{}, totalRow int) interface{} { |
270 | var result = map[string]interface{}{ | 262 | var result = map[string]interface{}{ |
271 | "successCount": 0, | 263 | "successCount": 0, |
272 | "fail": struct{}{}, | 264 | "fail": struct{}{}, |
@@ -278,6 +270,13 @@ func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows | @@ -278,6 +270,13 @@ func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows | ||
278 | fail := map[string]interface{}{ | 270 | fail := map[string]interface{}{ |
279 | "body": failRows, | 271 | "body": failRows, |
280 | } | 272 | } |
273 | + var header = make([]map[string]string, 0) | ||
274 | + for i := 0; i < len(headers); i++ { | ||
275 | + item := headers[i] | ||
276 | + header = append(header, map[string]string{ | ||
277 | + item.EnName: item.CnName, | ||
278 | + }) | ||
279 | + } | ||
281 | fail["header"] = header | 280 | fail["header"] = header |
282 | result["fail"] = fail | 281 | result["fail"] = fail |
283 | } | 282 | } |
-
请 注册 或 登录 后发表评论