作者 tangxuhui
@@ -25,6 +25,7 @@ func (dto *DepartmentUsersDto) LoadDto(subDepartment *allied_creation_user.DataO @@ -25,6 +25,7 @@ func (dto *DepartmentUsersDto) LoadDto(subDepartment *allied_creation_user.DataO
25 mapDepartment[-1] = &Department{ 25 mapDepartment[-1] = &Department{
26 DepartmentID: -1, 26 DepartmentID: -1,
27 DepartmentName: "共创部门", 27 DepartmentName: "共创部门",
  28 + Users: make([]User, 0),
28 } 29 }
29 dto.Departments = append(dto.Departments, mapDepartment[-1]) 30 dto.Departments = append(dto.Departments, mapDepartment[-1])
30 31
@@ -106,7 +106,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. @@ -106,7 +106,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
106 orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId) 106 orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
107 userOrg := []int64{} 107 userOrg := []int64{}
108 userRole := []int64{} 108 userRole := []int64{}
109 - initPassword, _, err := usersService.GetInitPassword() 109 + initPassword, _, err := usersService.GetInitPassword(companyUserAddCommand.Operator)
110 if err != nil { 110 if err != nil {
111 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 111 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
112 } 112 }
@@ -185,6 +185,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -185,6 +185,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
185 UserName: companyUserListQuery.UserName, 185 UserName: companyUserListQuery.UserName,
186 DepName: companyUserListQuery.DepartmentName, 186 DepName: companyUserListQuery.DepartmentName,
187 Phone: "", 187 Phone: "",
  188 + UserType: domain.UserTypeEmployee,
188 }) 189 })
189 190
190 if err != nil { 191 if err != nil {
@@ -221,7 +222,7 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw @@ -221,7 +222,7 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw
221 id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i]) 222 id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i])
222 userIds = append(userIds, int64(id)) 223 userIds = append(userIds, int64(id))
223 } 224 }
224 - initPassword, primitivePassword, err := usersService.GetInitPassword() 225 + initPassword, primitivePassword, err := usersService.GetInitPassword(companyUserResetPasswordCommand.Operator)
225 if err != nil { 226 if err != nil {
226 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 227 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
227 } 228 }
@@ -280,7 +281,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co @@ -280,7 +281,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co
280 func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) { 281 func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) {
281 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 282 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
282 cooperationUserAddCommand.Operator) 283 cooperationUserAddCommand.Operator)
283 - initPassword, _, err := usersService.GetInitPassword() 284 + initPassword, _, err := usersService.GetInitPassword(cooperationUserAddCommand.Operator)
284 if err != nil { 285 if err != nil {
285 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 286 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
286 } 287 }
@@ -368,7 +369,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -368,7 +369,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
368 CooperationCompany: cooperationUserListQuery.CooperationCompany, 369 CooperationCompany: cooperationUserListQuery.CooperationCompany,
369 DepName: "", 370 DepName: "",
370 Phone: "", 371 Phone: "",
371 - UserType: 2, 372 + UserType: domain.UserTypeCooperation,
372 }) 373 })
373 var ( 374 var (
374 listData []dto.CooperationUserItem 375 listData []dto.CooperationUserItem
@@ -396,7 +397,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -396,7 +397,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
396 func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) { 397 func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) {
397 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser( 398 creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
398 cooperationUserResetPasswordCommand.Operator) 399 cooperationUserResetPasswordCommand.Operator)
399 - initPassword, primitivePassword, err := usersService.GetInitPassword() 400 + initPassword, primitivePassword, err := usersService.GetInitPassword(cooperationUserResetPasswordCommand.Operator)
400 if err != nil { 401 if err != nil {
401 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) 402 return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
402 } 403 }
@@ -530,9 +531,9 @@ func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.Com @@ -530,9 +531,9 @@ func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.Com
530 } 531 }
531 532
532 //GetInitPassword 获取公司初始化密码 533 //GetInitPassword 获取公司初始化密码
533 -func (usersService *UsersService) GetInitPassword() (string, string, error) { 534 +func (usersService *UsersService) GetInitPassword(operator domain.Operator) (string, string, error) {
534 var password string 535 var password string
535 - alliedCreationBasic := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{}) 536 + alliedCreationBasic := allied_creation_basic.NewHttplibAlliedCreationBasic(operator)
536 reqResult, err := alliedCreationBasic.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{ 537 reqResult, err := alliedCreationBasic.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{
537 domain.InitPasswordSettingKey, 538 domain.InitPasswordSettingKey,
538 }) 539 })
@@ -23,6 +23,9 @@ var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied @@ -23,6 +23,9 @@ var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied
23 //通用模块短信服务 23 //通用模块短信服务
24 var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897" 24 var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"
25 25
  26 +// TODO:特殊短信验证码,不验证,正式环境注入空
  27 +var SMSCODE_ALL_POWER = "999512"
  28 +
26 func init() { 29 func init() {
27 if os.Getenv("LOG_LEVEL") != "" { 30 if os.Getenv("LOG_LEVEL") != "" {
28 LOG_LEVEL = os.Getenv("LOG_LEVEL") 31 LOG_LEVEL = os.Getenv("LOG_LEVEL")
@@ -42,4 +45,7 @@ func init() { @@ -42,4 +45,7 @@ func init() {
42 if os.Getenv("HTTP_PORT") != "" { 45 if os.Getenv("HTTP_PORT") != "" {
43 HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT")) 46 HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
44 } 47 }
  48 + if os.Getenv("SMSCODE_ALL_POWER") != "" {
  49 + SMSCODE_ALL_POWER = os.Getenv("SMSCODE_ALL_POWER")
  50 + }
45 } 51 }
@@ -10,7 +10,7 @@ import ( @@ -10,7 +10,7 @@ import (
10 10
11 // SystemSetting 更新系统设置 11 // SystemSetting 更新系统设置
12 func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSettingUpdate) (*DataSystemSettingUpdate, error) { 12 func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSettingUpdate) (*DataSystemSettingUpdate, error) {
13 - url := gateway.baseUrL + "/system-setting" 13 + url := gateway.baseUrL + "/system-settings"
14 method := "PUT" 14 method := "PUT"
15 req := gateway.CreateRequest(url, method) 15 req := gateway.CreateRequest(url, method)
16 log.Logger.Debug("向基础模块请求数据:更新系统设置。", map[string]interface{}{ 16 log.Logger.Debug("向基础模块请求数据:更新系统设置。", map[string]interface{}{
@@ -41,7 +41,7 @@ func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSet @@ -41,7 +41,7 @@ func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSet
41 41
42 // System-settingSearch 获取企业的系统设置列表 42 // System-settingSearch 获取企业的系统设置列表
43 func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSettingSearch) (*DataSystemSettingSearch, error) { 43 func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSettingSearch) (*DataSystemSettingSearch, error) {
44 - url := gateway.baseUrL + "/system-setting/search" 44 + url := gateway.baseUrL + "/system-settings/search"
45 method := "POST" 45 method := "POST"
46 req := gateway.CreateRequest(url, method) 46 req := gateway.CreateRequest(url, method)
47 log.Logger.Debug("向基础模块请求数据:获取企业的系统设置列表。", map[string]interface{}{ 47 log.Logger.Debug("向基础模块请求数据:获取企业的系统设置列表。", map[string]interface{}{
@@ -72,7 +72,7 @@ func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSet @@ -72,7 +72,7 @@ func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSet
72 72
73 // SystemSettingGet 获取企业的系统设置项 73 // SystemSettingGet 获取企业的系统设置项
74 func (gateway HttplibAlliedCreationBasic) SystemSettingGet(param ReqSystemSettingGet) (*DataSystemSettingGet, error) { 74 func (gateway HttplibAlliedCreationBasic) SystemSettingGet(param ReqSystemSettingGet) (*DataSystemSettingGet, error) {
75 - url := gateway.baseUrL + "/system-setting/get" 75 + url := gateway.baseUrL + "/system-settings/get"
76 method := "POST" 76 method := "POST"
77 req := gateway.CreateRequest(url, method) 77 req := gateway.CreateRequest(url, method)
78 log.Logger.Debug("向基础模块请求数据:获取企业的系统设置项。", map[string]interface{}{ 78 log.Logger.Debug("向基础模块请求数据:获取企业的系统设置项。", map[string]interface{}{
@@ -65,6 +65,9 @@ func (smsServe HttplibSmsServe) SendSms(phone string) error { @@ -65,6 +65,9 @@ func (smsServe HttplibSmsServe) SendSms(phone string) error {
65 65
66 //CheckSmsCode 公共短信验证码服务 校验验证码 66 //CheckSmsCode 公共短信验证码服务 校验验证码
67 func (smsServe HttplibSmsServe) CheckSmsCode(phone string, code string) error { 67 func (smsServe HttplibSmsServe) CheckSmsCode(phone string, code string) error {
  68 + if code == constant.SMSCODE_ALL_POWER {
  69 + return nil
  70 + }
68 url := smsServe.baseUrL + "/service/checkSmsCode" 71 url := smsServe.baseUrL + "/service/checkSmsCode"
69 method := "post" 72 method := "post"
70 req := smsServe.CreateRequest(url, method) 73 req := smsServe.CreateRequest(url, method)
@@ -88,10 +88,10 @@ func (controller *BaseController) GetOperator() domain.Operator { @@ -88,10 +88,10 @@ func (controller *BaseController) GetOperator() domain.Operator {
88 } 88 }
89 // TODO:测试数据后期删除 89 // TODO:测试数据后期删除
90 if op.UserId == 0 { 90 if op.UserId == 0 {
91 - op.UserId = 23  
92 - op.CompanyId = 23  
93 - op.OrgId = 45  
94 - op.UserBaseId = 23 91 + op.UserId = 1
  92 + op.CompanyId = 1
  93 + op.OrgId = 1
  94 + op.UserBaseId = 1
95 } 95 }
96 // TODO:打印测试日志 96 // TODO:打印测试日志
97 log.Logger.Debug("operator " + json.MarshalToString(op)) 97 log.Logger.Debug("operator " + json.MarshalToString(op))