|
|
package service
|
|
|
|
|
|
import (
|
|
|
"strconv"
|
|
|
"time"
|
|
|
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
|
...
|
...
|
@@ -27,8 +30,15 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command. |
|
|
|
|
|
// 启用禁用公司用户信息
|
|
|
func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *command.CompanyUserEnableCommand) (interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
companyUserEnableCommand.Operator.CompanyId,
|
|
|
companyUserEnableCommand.Operator.OrgId,
|
|
|
companyUserEnableCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
|
|
UserIds: companyUserEnableCommand.UsersIds,
|
|
|
EnableStatus: companyUserEnableCommand.EnableStatus,
|
|
|
})
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 返回公司用户信息列表
|
...
|
...
|
@@ -71,8 +81,15 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co |
|
|
|
|
|
// 批量重置密码
|
|
|
func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPasswordCommand *command.CompanyUserResetPasswordCommand) (interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
companyUserResetPasswordCommand.Operator.CompanyId,
|
|
|
companyUserResetPasswordCommand.Operator.OrgId,
|
|
|
companyUserResetPasswordCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{
|
|
|
Password: "",
|
|
|
UserIds: companyUserResetPasswordCommand.UsersIds,
|
|
|
})
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 更新公司用户信息
|
...
|
...
|
@@ -83,19 +100,63 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co |
|
|
|
|
|
// 创建共创用户信息
|
|
|
func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cooperationUserAddCommand.Operator.CompanyId,
|
|
|
cooperationUserAddCommand.Operator.OrgId,
|
|
|
cooperationUserAddCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
|
|
|
CooperationCompany: cooperationUserAddCommand.CooperationCompany,
|
|
|
CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0),
|
|
|
Email: cooperationUserAddCommand.Email,
|
|
|
EnableStatus: cooperationUserAddCommand.EnableStatus,
|
|
|
UserCode: cooperationUserAddCommand.UsersCode,
|
|
|
UserName: cooperationUserAddCommand.UsersName,
|
|
|
Avatar: cooperationUserAddCommand.Avatar,
|
|
|
OrgId: cooperationUserAddCommand.Operator.OrgId,
|
|
|
Phone: cooperationUserAddCommand.Phone,
|
|
|
Password: "",
|
|
|
})
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 启用禁用共创用户信息
|
|
|
func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCommand *command.CooperationUserEnableCommand) (interface{}, error) {
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cooperationUserEnableCommand.Operator.CompanyId,
|
|
|
cooperationUserEnableCommand.Operator.OrgId,
|
|
|
cooperationUserEnableCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.UserBatchEnable(allied_creation_user.ReqBatchEnableUser{
|
|
|
UserIds: cooperationUserEnableCommand.UsersIds,
|
|
|
EnableStatus: cooperationUserEnableCommand.EnableStatus,
|
|
|
})
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 获取共创用户信息
|
|
|
func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *query.CooperationUserGetQuery) (interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cooperationUserGetQuery.Operator.CompanyId,
|
|
|
cooperationUserGetQuery.Operator.OrgId,
|
|
|
cooperationUserGetQuery.Operator.UserId)
|
|
|
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
|
|
|
UserId: cooperationUserGetQuery.UsersId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
deadline := result.CooperationInfo.CooperationDeadline.Unix()
|
|
|
userInfo := dto.CooperationUserInfo{
|
|
|
UserId: strconv.FormatInt(result.UserId, 10),
|
|
|
UserCode: result.UserCode,
|
|
|
EnableStatus: int32(result.EnableStatus),
|
|
|
CooperationCompany: result.CooperationInfo.CooperationCompany,
|
|
|
CooperationDeadline: deadline,
|
|
|
UserName: result.UserInfo.UserName,
|
|
|
Email: result.UserInfo.Email,
|
|
|
Phone: result.UserInfo.Phone,
|
|
|
Avatar: result.UserInfo.Avatar,
|
|
|
}
|
|
|
return userInfo, nil
|
|
|
}
|
|
|
|
|
|
// 返回共创用户信息列表
|
...
|
...
|
@@ -106,14 +167,36 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * |
|
|
|
|
|
// 批量重置密码
|
|
|
func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cooperationUserResetPasswordCommand.Operator.CompanyId,
|
|
|
cooperationUserResetPasswordCommand.Operator.OrgId,
|
|
|
cooperationUserResetPasswordCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{
|
|
|
Password: "",
|
|
|
UserIds: cooperationUserResetPasswordCommand.UsersIds,
|
|
|
})
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
// 编辑共创用户信息
|
|
|
func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCommand *command.CooperationUserUpdateCommand) (interface{}, error) {
|
|
|
|
|
|
return nil, nil
|
|
|
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cooperationUserUpdateCommand.Operator.CompanyId,
|
|
|
cooperationUserUpdateCommand.Operator.OrgId,
|
|
|
cooperationUserUpdateCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{
|
|
|
UserId: cooperationUserUpdateCommand.UsersId,
|
|
|
CooperationCompany: cooperationUserUpdateCommand.CooperationCompany,
|
|
|
CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0),
|
|
|
Email: cooperationUserUpdateCommand.Email,
|
|
|
EnableStatus: cooperationUserUpdateCommand.EnableStatus,
|
|
|
UserCode: cooperationUserUpdateCommand.UsersCode,
|
|
|
UserName: cooperationUserUpdateCommand.UsersName,
|
|
|
Avatar: cooperationUserUpdateCommand.Avatar,
|
|
|
OrgId: cooperationUserUpdateCommand.Operator.OrgId,
|
|
|
Phone: cooperationUserUpdateCommand.Phone,
|
|
|
})
|
|
|
return result, err
|
|
|
}
|
|
|
|
|
|
func NewUsersService(options map[string]interface{}) *UsersService {
|
...
|
...
|
|