作者 tangxuhui
{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627896972308508600}
\ No newline at end of file
... ...
... ... @@ -10,13 +10,13 @@ import (
type CompanyUserUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
UsersId string `json:"usersId" valid:"Required"`
UsersId string `json:"userId" valid:"Required"`
// 用户编号
UsersCode string `json:"usersCode,omitempty"`
UsersCode string `json:"userCode,omitempty"`
// 用户名称
UsersName string `json:"usersName,omitempty"`
UsersName string `json:"userName,omitempty"`
// 组织机构id
OrganizationId string `json:"organizationId,omitempty"`
OrganizationId string `json:"orgId,omitempty"`
// 部门id
DepartmentId string `json:"departmentId,omitempty"`
// 启用状态(启用:1 禁用:2)
... ... @@ -26,11 +26,19 @@ type CompanyUserUpdateCommand struct {
// 邮箱
Email string `json:"email,omitempty"`
// 关联的组织机构
UsersOrg []string `json:"usersOrg,omitempty"`
UserOrg []Org `json:"userOrg,omitempty"`
// 关联的组织结构
UsersRole []string `json:"usersRole,omitempty"`
UserRole []Role `json:"userRole,omitempty"`
// 头像
Avator string `json:"avator,omitempty"`
Avatar string `json:"avatar,omitempty"`
}
type Org struct {
OrgId string `json:"orgId"`
}
type Role struct {
RoleId string `json:"roleId"`
}
func (companyUserUpdateCommand *CompanyUserUpdateCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -40,9 +40,9 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
var (
usersOrg []dto.UserOrg
userRole []dto.UserRole
userMenu []dto.UserMenu
usersOrg []dto.UserOrg = make([]dto.UserOrg, 0)
userRole []dto.UserRole = make([]dto.UserRole, 0)
userMenu []dto.UserMenu = make([]dto.UserMenu, 0)
)
for _, v := range resultMenu.Menus {
... ... @@ -223,18 +223,18 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw
func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *command.CompanyUserUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
companyUserUpdateCommand.Operator)
departmentId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId)
departmentId, _ := strconv.Atoi(companyUserUpdateCommand.DepartmentId)
orgId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId)
userOrg := []int64{}
userRole := []int64{}
for _, v := range companyUserUpdateCommand.UsersOrg {
id, err := strconv.Atoi(v)
for _, v := range companyUserUpdateCommand.UserOrg {
id, err := strconv.Atoi(v.OrgId)
if err == nil {
userOrg = append(userOrg, int64(id))
}
}
for _, v := range companyUserUpdateCommand.UsersRole {
id, err := strconv.Atoi(v)
for _, v := range companyUserUpdateCommand.UserRole {
id, err := strconv.Atoi(v.RoleId)
if err == nil {
userRole = append(userRole, int64(id))
}
... ... @@ -251,8 +251,8 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co
EnableStatus: companyUserUpdateCommand.EnableStatus,
UserName: companyUserUpdateCommand.UsersName,
Phone: companyUserUpdateCommand.Phone,
Avatar: companyUserUpdateCommand.Avator,
Email: companyUserUpdateCommand.Avator,
Avatar: companyUserUpdateCommand.Avatar,
Email: companyUserUpdateCommand.Email,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
... ...
... ... @@ -3,6 +3,7 @@ package allied_creation_user
import (
"encoding/json"
"fmt"
"strconv"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
... ... @@ -74,7 +75,7 @@ func (gateway HttplibAlliedCreationUser) UserCreate(param ReqCreateUser) (*DataC
//UserUpdate 更新用户
func (gateway HttplibAlliedCreationUser) UserUpdate(param ReqUpdateUser) (*DataUpdateUser, error) {
url := gateway.baseUrL + "/user"
url := gateway.baseUrL + "/user/" + strconv.Itoa(int(param.UserId))
method := "put"
req := gateway.CreateRequest(url, method)
//TODO traceID
... ...
... ... @@ -7,7 +7,7 @@ import (
func init() {
web.Router("/v1/web/users/company-user", &web_client.UsersController{}, "Post:CompanyUserAdd")
web.Router("/v1/web/users/company-user", &web_client.UsersController{}, "Put:CompanyUserUpdate")
web.Router("/v1/web/users/company-user/:userId", &web_client.UsersController{}, "Put:CompanyUserUpdate")
web.Router("/v1/web/users/company-user/search", &web_client.UsersController{}, "Post:CompanyUserList")
web.Router("/v1/web/users/company-user/:userId", &web_client.UsersController{}, "Get:CompanyUserGet")
web.Router("/v1/web/users/company-user/enable", &web_client.UsersController{}, "Put:CompanyUserEnable")
... ...