...
|
...
|
@@ -130,7 +130,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. |
|
|
Phone: companyUserAddCommand.Phone,
|
|
|
Avatar: companyUserAddCommand.Avator,
|
|
|
Email: companyUserAddCommand.Avator,
|
|
|
Password: "", //TODO 填充密码
|
|
|
Password: "123456", //TODO 填充密码
|
|
|
})
|
|
|
|
|
|
data := struct {
|
...
|
...
|
@@ -149,10 +149,19 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co |
|
|
companyUserEnableCommand.Operator.CompanyId,
|
|
|
companyUserEnableCommand.Operator.OrgId,
|
|
|
companyUserEnableCommand.Operator.UserId)
|
|
|
|
|
|
var userIds []int64
|
|
|
for i := range companyUserEnableCommand.UsersIds {
|
|
|
id, _ := strconv.Atoi(companyUserEnableCommand.UsersIds[i])
|
|
|
userIds = append(userIds, int64(id))
|
|
|
}
|
|
|
_, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
|
|
UserIds: companyUserEnableCommand.UsersIds,
|
|
|
UserIds: userIds,
|
|
|
EnableStatus: companyUserEnableCommand.EnableStatus,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return companyUserEnableCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -171,7 +180,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co |
|
|
})
|
|
|
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
//数据转换
|
|
|
cnt := int64(result.Count)
|
...
|
...
|
@@ -200,10 +209,18 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw |
|
|
companyUserResetPasswordCommand.Operator.CompanyId,
|
|
|
companyUserResetPasswordCommand.Operator.OrgId,
|
|
|
companyUserResetPasswordCommand.Operator.UserId)
|
|
|
var userIds []int64
|
|
|
for i := range companyUserResetPasswordCommand.UsersIds {
|
|
|
id, _ := strconv.Atoi(companyUserResetPasswordCommand.UsersIds[i])
|
|
|
userIds = append(userIds, int64(id))
|
|
|
}
|
|
|
_, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{
|
|
|
Password: "", //TODO 填充密码
|
|
|
UserIds: companyUserResetPasswordCommand.UsersIds,
|
|
|
Password: "123456", //TODO 填充密码
|
|
|
UserIds: userIds,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return companyUserResetPasswordCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -244,6 +261,9 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co |
|
|
Avatar: companyUserUpdateCommand.Avator,
|
|
|
Email: companyUserUpdateCommand.Avator,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return companyUserUpdateCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -265,6 +285,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * |
|
|
Phone: cooperationUserAddCommand.Phone,
|
|
|
Password: "123456", //TODO 填充默认密码
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
data := struct {
|
|
|
UserId string `json:"userId"`
|
|
|
command.CooperationUserAddCommand
|
...
|
...
|
@@ -281,10 +304,18 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom |
|
|
cooperationUserEnableCommand.Operator.CompanyId,
|
|
|
cooperationUserEnableCommand.Operator.OrgId,
|
|
|
cooperationUserEnableCommand.Operator.UserId)
|
|
|
var userIds []int64
|
|
|
for i := range cooperationUserEnableCommand.UsersIds {
|
|
|
id, _ := strconv.Atoi(cooperationUserEnableCommand.UsersIds[i])
|
|
|
userIds = append(userIds, int64(id))
|
|
|
}
|
|
|
_, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
|
|
UserIds: cooperationUserEnableCommand.UsersIds,
|
|
|
UserIds: userIds,
|
|
|
EnableStatus: cooperationUserEnableCommand.EnableStatus,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return cooperationUserEnableCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -294,12 +325,12 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
|
|
cooperationUserGetQuery.Operator.CompanyId,
|
|
|
cooperationUserGetQuery.Operator.OrgId,
|
|
|
cooperationUserGetQuery.Operator.UserId)
|
|
|
userId, _ := strconv.Atoi(cooperationUserGetQuery.UsersId)
|
|
|
userId, _ := strconv.Atoi(cooperationUserGetQuery.UserId)
|
|
|
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
|
|
UserId: userId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
deadline := result.CooperationInfo.CooperationDeadline.Unix()
|
|
|
userInfo := dto.CooperationUserInfo{
|
...
|
...
|
@@ -320,14 +351,15 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu |
|
|
func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) {
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
|
|
|
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
|
|
|
Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
|
|
|
Limit: cooperationUserListQuery.PageSize,
|
|
|
CompanyId: cooperationUserListQuery.Operator.CompanyId,
|
|
|
OrganizationId: cooperationUserListQuery.Operator.OrgId,
|
|
|
DepartmentId: 0,
|
|
|
UserName: cooperationUserListQuery.UserName,
|
|
|
DepName: "",
|
|
|
Phone: "",
|
|
|
Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
|
|
|
Limit: cooperationUserListQuery.PageSize,
|
|
|
CompanyId: cooperationUserListQuery.Operator.CompanyId,
|
|
|
OrganizationId: cooperationUserListQuery.Operator.OrgId,
|
|
|
DepartmentId: 0,
|
|
|
UserName: cooperationUserListQuery.UserName,
|
|
|
CooperationCompany: cooperationUserListQuery.CooperationCompany,
|
|
|
DepName: "",
|
|
|
Phone: "",
|
|
|
})
|
|
|
var (
|
|
|
listData []dto.CooperationUserItem
|
...
|
...
|
@@ -361,6 +393,9 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe |
|
|
Password: "", //TODO 填充密码
|
|
|
UserIds: cooperationUserResetPasswordCommand.UsersIds,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return cooperationUserResetPasswordCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -382,6 +417,9 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom |
|
|
OrgId: cooperationUserUpdateCommand.Operator.OrgId,
|
|
|
Phone: cooperationUserUpdateCommand.Phone,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return cooperationUserUpdateCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -401,7 +439,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan |
|
|
ParentId: 0,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var (
|
|
|
dataList []dto.UserOrg
|
...
|
...
|
@@ -431,7 +469,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa |
|
|
RoleName: selectorQuery.RoleName,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
|
|
|
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var (
|
|
|
dataList []dto.UserRole
|
...
|
...
|
|