...
|
...
|
@@ -184,7 +184,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD |
|
|
excelImport.DataFields = []excel.DataField{
|
|
|
{EnName: "userCode", CnName: "*用户编号"},
|
|
|
{EnName: "userName", CnName: "*用户姓名"},
|
|
|
{EnName: "organization", CnName: "*组织机构"},
|
|
|
{EnName: "org", CnName: "*组织机构"},
|
|
|
{EnName: "department", CnName: "*所属部门"},
|
|
|
{EnName: "phone", CnName: "*手机号"},
|
|
|
{EnName: "email", CnName: "邮箱"},
|
...
|
...
|
@@ -200,7 +200,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD |
|
|
CompanyId: importDataCommand.Operator.CompanyId,
|
|
|
UserType: domain.UserTypeEmployee,
|
|
|
UserCode: v["userCode"],
|
|
|
Org: v["organization"],
|
|
|
Org: v["org"],
|
|
|
Department: v["department"],
|
|
|
UserName: v["userName"],
|
|
|
Phone: v["phone"],
|
...
|
...
|
@@ -222,15 +222,7 @@ func (srv ExcelDataService) ImportCompanyUser(importDataCommand *command.ImportD |
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return srv.importResultWithHeader(map[string]interface{}{
|
|
|
"userCode": "*用户编号",
|
|
|
"userName": "*用户姓名",
|
|
|
"organization": "*组织机构",
|
|
|
"department": "*所属部门",
|
|
|
"phone": "*手机号",
|
|
|
"email": "邮箱",
|
|
|
"enableStatus": "状态",
|
|
|
}, result.FailRows, len(excelData)), nil
|
|
|
return srv.importResultWithHeader(excelImport.DataFields, result.FailRows, len(excelData)), nil
|
|
|
}
|
|
|
|
|
|
func (srv ExcelDataService) ImportOrganization(importDataCommand *command.ImportDataCommand) (interface{}, error) {
|
...
|
...
|
@@ -266,7 +258,7 @@ func (srv ExcelDataService) ImportOrganization(importDataCommand *command.Import |
|
|
}
|
|
|
|
|
|
// 导入结果
|
|
|
func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows []interface{}, totalRow int) interface{} {
|
|
|
func (srv ExcelDataService) importResultWithHeader(headers []excel.DataField, failRows []interface{}, totalRow int) interface{} {
|
|
|
var result = map[string]interface{}{
|
|
|
"successCount": 0,
|
|
|
"fail": struct{}{},
|
...
|
...
|
@@ -278,6 +270,13 @@ func (srv ExcelDataService) importResultWithHeader(header interface{}, failRows |
|
|
fail := map[string]interface{}{
|
|
|
"body": failRows,
|
|
|
}
|
|
|
var header = make([]map[string]string, 0)
|
|
|
for i := 0; i < len(headers); i++ {
|
|
|
item := headers[i]
|
|
|
header = append(header, map[string]string{
|
|
|
item.EnName: item.CnName,
|
|
|
})
|
|
|
}
|
|
|
fail["header"] = header
|
|
|
result["fail"] = fail
|
|
|
}
|
...
|
...
|
|