...
|
...
|
@@ -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.UserIds {
|
|
|
id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[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
|
|
|
}
|
|
|
|
...
|
...
|
@@ -254,8 +274,9 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand * |
|
|
cooperationUserAddCommand.Operator.OrgId,
|
|
|
cooperationUserAddCommand.Operator.UserId)
|
|
|
result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
|
|
|
CompanyId: cooperationUserAddCommand.Operator.CompanyId,
|
|
|
CooperationCompany: cooperationUserAddCommand.CooperationCompany,
|
|
|
CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline, 0),
|
|
|
CooperationDeadline: time.Unix(cooperationUserAddCommand.CooperationDeadline/1000, 0),
|
|
|
Email: cooperationUserAddCommand.Email,
|
|
|
EnableStatus: cooperationUserAddCommand.EnableStatus,
|
|
|
UserCode: cooperationUserAddCommand.UsersCode,
|
...
|
...
|
@@ -265,6 +286,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 +305,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 +326,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 +352,16 @@ 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: "",
|
|
|
UserType: 2,
|
|
|
})
|
|
|
var (
|
|
|
listData []dto.CooperationUserItem
|
...
|
...
|
@@ -338,7 +372,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * |
|
|
item = dto.CooperationUserItem{
|
|
|
CooperationCompany: v.CooperationInfo.CooperationCompany,
|
|
|
UserId: strconv.Itoa(v.UserId),
|
|
|
CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(),
|
|
|
CooperationDeadline: v.CooperationInfo.CooperationDeadline.Format("2006-01-02"),
|
|
|
Phone: v.UserInfo.Phone,
|
|
|
EnableStatus: v.EnableStatus,
|
|
|
UserCode: v.UserCode,
|
...
|
...
|
@@ -357,11 +391,20 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe |
|
|
cooperationUserResetPasswordCommand.Operator.CompanyId,
|
|
|
cooperationUserResetPasswordCommand.Operator.OrgId,
|
|
|
cooperationUserResetPasswordCommand.Operator.UserId)
|
|
|
var userIds []int64
|
|
|
for i := range cooperationUserResetPasswordCommand.UserIds {
|
|
|
id, _ := strconv.Atoi(cooperationUserResetPasswordCommand.UserIds[i])
|
|
|
userIds = append(userIds, int64(id))
|
|
|
}
|
|
|
_, err := creationUserGateway.UserBatchResetPassword(allied_creation_user.ReqBatchResetPasswordUser{
|
|
|
Password: "", //TODO 填充密码
|
|
|
UserIds: cooperationUserResetPasswordCommand.UsersIds,
|
|
|
Password: "123456", //TODO 填充密码
|
|
|
UserIds: userIds,
|
|
|
})
|
|
|
return cooperationUserResetPasswordCommand, err
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
// TODO:返回消息提示 密码重置成功,初始密码为TL123456!
|
|
|
return "123456", err
|
|
|
}
|
|
|
|
|
|
// 编辑共创用户信息
|
...
|
...
|
@@ -371,17 +414,20 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom |
|
|
cooperationUserUpdateCommand.Operator.OrgId,
|
|
|
cooperationUserUpdateCommand.Operator.UserId)
|
|
|
_, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{
|
|
|
UserId: cooperationUserUpdateCommand.UsersId,
|
|
|
UserId: cooperationUserUpdateCommand.UserId,
|
|
|
CooperationCompany: cooperationUserUpdateCommand.CooperationCompany,
|
|
|
CooperationDeadline: time.Unix(cooperationUserUpdateCommand.CooperationDeadline, 0),
|
|
|
Email: cooperationUserUpdateCommand.Email,
|
|
|
EnableStatus: cooperationUserUpdateCommand.EnableStatus,
|
|
|
UserCode: cooperationUserUpdateCommand.UsersCode,
|
|
|
UserName: cooperationUserUpdateCommand.UsersName,
|
|
|
UserCode: cooperationUserUpdateCommand.UserCode,
|
|
|
UserName: cooperationUserUpdateCommand.UserName,
|
|
|
Avatar: cooperationUserUpdateCommand.Avatar,
|
|
|
OrgId: cooperationUserUpdateCommand.Operator.OrgId,
|
|
|
Phone: cooperationUserUpdateCommand.Phone,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
return cooperationUserUpdateCommand, err
|
|
|
}
|
|
|
|
...
|
...
|
@@ -401,7 +447,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 +477,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
|
...
|
...
|
|