作者 tangxuhui
... ... @@ -25,6 +25,7 @@ func (dto *DepartmentUsersDto) LoadDto(subDepartment *allied_creation_user.DataO
mapDepartment[-1] = &Department{
DepartmentID: -1,
DepartmentName: "共创部门",
Users: make([]User, 0),
}
dto.Departments = append(dto.Departments, mapDepartment[-1])
... ...
... ... @@ -106,7 +106,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
userOrg := []int64{}
userRole := []int64{}
initPassword, _, err := usersService.GetInitPassword()
initPassword, _, err := usersService.GetInitPassword(companyUserAddCommand.Operator)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ... @@ -185,6 +185,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
UserName: companyUserListQuery.UserName,
DepName: companyUserListQuery.DepartmentName,
Phone: "",
UserType: domain.UserTypeEmployee,
})
if err != nil {
... ... @@ -221,7 +222,7 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw
id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i])
userIds = append(userIds, int64(id))
}
initPassword, primitivePassword, err := usersService.GetInitPassword()
initPassword, primitivePassword, err := usersService.GetInitPassword(companyUserResetPasswordCommand.Operator)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ... @@ -280,7 +281,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co
func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserAddCommand.Operator)
initPassword, _, err := usersService.GetInitPassword()
initPassword, _, err := usersService.GetInitPassword(cooperationUserAddCommand.Operator)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ... @@ -368,7 +369,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
CooperationCompany: cooperationUserListQuery.CooperationCompany,
DepName: "",
Phone: "",
UserType: 2,
UserType: domain.UserTypeCooperation,
})
var (
listData []dto.CooperationUserItem
... ... @@ -396,7 +397,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserResetPasswordCommand.Operator)
initPassword, primitivePassword, err := usersService.GetInitPassword()
initPassword, primitivePassword, err := usersService.GetInitPassword(cooperationUserResetPasswordCommand.Operator)
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
... ... @@ -530,9 +531,9 @@ func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.Com
}
//GetInitPassword 获取公司初始化密码
func (usersService *UsersService) GetInitPassword() (string, string, error) {
func (usersService *UsersService) GetInitPassword(operator domain.Operator) (string, string, error) {
var password string
alliedCreationBasic := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
alliedCreationBasic := allied_creation_basic.NewHttplibAlliedCreationBasic(operator)
reqResult, err := alliedCreationBasic.SystemSettingGet(allied_creation_basic.ReqSystemSettingGet{
domain.InitPasswordSettingKey,
})
... ...
... ... @@ -23,6 +23,9 @@ var ALLIED_CREATION_COOPERATION_HOST = "http://localhost:8082" // "http://allied
//通用模块短信服务
var SMS_SERVE_HOST = "https://sms.fjmaimaimai.com:9897"
// TODO:特殊短信验证码,不验证,正式环境注入空
var SMSCODE_ALL_POWER = "999512"
func init() {
if os.Getenv("LOG_LEVEL") != "" {
LOG_LEVEL = os.Getenv("LOG_LEVEL")
... ... @@ -42,4 +45,7 @@ func init() {
if os.Getenv("HTTP_PORT") != "" {
HTTP_PORT, _ = strconv.Atoi(os.Getenv("HTTP_PORT"))
}
if os.Getenv("SMSCODE_ALL_POWER") != "" {
SMSCODE_ALL_POWER = os.Getenv("SMSCODE_ALL_POWER")
}
}
... ...
... ... @@ -10,7 +10,7 @@ import (
// SystemSetting 更新系统设置
func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSettingUpdate) (*DataSystemSettingUpdate, error) {
url := gateway.baseUrL + "/system-setting"
url := gateway.baseUrL + "/system-settings"
method := "PUT"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:更新系统设置。", map[string]interface{}{
... ... @@ -41,7 +41,7 @@ func (gateway HttplibAlliedCreationBasic) SystemSettingUpdate(param ReqSystemSet
// System-settingSearch 获取企业的系统设置列表
func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSettingSearch) (*DataSystemSettingSearch, error) {
url := gateway.baseUrL + "/system-setting/search"
url := gateway.baseUrL + "/system-settings/search"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:获取企业的系统设置列表。", map[string]interface{}{
... ... @@ -72,7 +72,7 @@ func (gateway HttplibAlliedCreationBasic) SystemSettingSearch(param ReqSystemSet
// SystemSettingGet 获取企业的系统设置项
func (gateway HttplibAlliedCreationBasic) SystemSettingGet(param ReqSystemSettingGet) (*DataSystemSettingGet, error) {
url := gateway.baseUrL + "/system-setting/get"
url := gateway.baseUrL + "/system-settings/get"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:获取企业的系统设置项。", map[string]interface{}{
... ...
... ... @@ -65,6 +65,9 @@ func (smsServe HttplibSmsServe) SendSms(phone string) error {
//CheckSmsCode 公共短信验证码服务 校验验证码
func (smsServe HttplibSmsServe) CheckSmsCode(phone string, code string) error {
if code == constant.SMSCODE_ALL_POWER {
return nil
}
url := smsServe.baseUrL + "/service/checkSmsCode"
method := "post"
req := smsServe.CreateRequest(url, method)
... ...
... ... @@ -88,10 +88,10 @@ func (controller *BaseController) GetOperator() domain.Operator {
}
// TODO:测试数据后期删除
if op.UserId == 0 {
op.UserId = 23
op.CompanyId = 23
op.OrgId = 45
op.UserBaseId = 23
op.UserId = 1
op.CompanyId = 1
op.OrgId = 1
op.UserBaseId = 1
}
// TODO:打印测试日志
log.Logger.Debug("operator " + json.MarshalToString(op))
... ...