作者 tangxuhui
正在显示 32 个修改的文件 包含 214 行增加90 行删除
{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627703189719007400}
\ No newline at end of file
{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627719981417605200}
\ No newline at end of file
... ...
... ... @@ -2,11 +2,14 @@ package command
import (
"fmt"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"github.com/beego/beego/v2/core/validation"
)
type MenuFavoriteCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 企业id
CompanyId int64 `json:"companyId" valid:"Required"`
// 对应菜单的id
... ...
... ... @@ -10,12 +10,12 @@ import (
type MenuUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 企业id
CompanyId int64 `json:"companyId" valid:"Required"`
// 菜单编号
MenuId int64 `json:"menuId" valid:"Required"`
// 菜单名称
MenuName string `json:"menuName" valid:"Required"`
// 菜单名称
MenuAlias string `json:"menuAlias" valid:"Required"`
// 排序
Sort int `json:"sort" valid:"Required"`
}
... ...
... ... @@ -10,6 +10,8 @@ import (
type MenuListQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 菜单类别 web app
MenuCategory string `json:"menuCategory"`
}
func (menuListQuery *MenuListQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -13,8 +13,17 @@ type MenuService struct {
// 设置收藏菜单
func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) {
return nil, nil
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuFavoriteCommand.Operator.CompanyId,
menuFavoriteCommand.Operator.OrgId,
menuFavoriteCommand.Operator.UserId)
result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
CompanyId: menuFavoriteCommand.Operator.CompanyId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
}
// 返回菜单列表
... ... @@ -24,12 +33,15 @@ func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (in
menuListQuery.Operator.OrgId,
menuListQuery.Operator.UserId)
result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
CompanyId: menuListQuery.Operator.CompanyId,
CompanyId: menuListQuery.Operator.CompanyId,
MenuCategory: menuListQuery.MenuCategory,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return result, nil
return map[string]interface{}{
"menus": result.Menus,
}, nil
}
// 更新菜单
... ... @@ -39,8 +51,8 @@ func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdate
menuUpdateCommand.Operator.OrgId,
menuUpdateCommand.Operator.UserId)
_, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{
CompanyId: menuUpdateCommand.CompanyId,
MenuAlias: menuUpdateCommand.MenuName,
CompanyId: menuUpdateCommand.Operator.CompanyId,
MenuAlias: menuUpdateCommand.MenuAlias,
MenuId: int(menuUpdateCommand.MenuId),
Sort: menuUpdateCommand.Sort,
})
... ...
... ... @@ -11,7 +11,7 @@ type OrgEnableCommand struct {
//操作人
Operator domain.Operator `json:"-"`
OrgId string `json:"orgId,omitempty"`
Status int `json:"status,omitempty"`
Status int `json:"orgStatus,omitempty"`
}
func (orgEnableCommand *OrgEnableCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -7,5 +7,5 @@ type OrgItem struct {
IsOrg int `json:"isOrg"`
OrgCode string `json:"orgCode"`
ParentDepName string `json:"parentDepName"`
OrgStatus int `json:"orgStatus"`
}
... ...
... ... @@ -12,7 +12,7 @@ type OrgListQuery struct {
Operator domain.Operator `json:"-"`
OrgCode string `json:"OrgCode"`
DepName string `json:"depName"`
ParentId int `json:"parentId"`
ParentId string `json:"parentId"`
}
func (orgListQuery *OrgListQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -88,6 +88,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter
orgListQuery.Operator.CompanyId,
orgListQuery.Operator.OrgId,
orgListQuery.Operator.UserId)
parentOrgId, _ := strconv.Atoi(orgListQuery.ParentId)
result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
CompanyId: int(orgListQuery.Operator.CompanyId),
DepName: orgListQuery.DepName,
... ... @@ -95,7 +96,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter
Limit: 0,
Offset: 0,
OrgCode: orgListQuery.OrgCode,
ParentId: orgListQuery.ParentId,
ParentId: parentOrgId,
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ... @@ -112,6 +113,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter
IsOrg: v.IsOrg,
OrgCode: v.OrgCode,
ParentDepName: v.Ext.ParentDepName,
OrgStatus: v.OrgStatus,
}
dataList = append(dataList, item)
}
... ... @@ -125,11 +127,13 @@ func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCom
orgUpdateCommand.Operator.OrgId,
orgUpdateCommand.Operator.UserId)
parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId)
_, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{
orgId, _ := strconv.Atoi(orgUpdateCommand.OrgId)
_, err := creationUserGateway.OrgUpdate(allied_creation_user.ReqOrgUpdate{
OrgId: int64(orgId),
IsOrg: orgUpdateCommand.IsOrg,
OrgCode: orgUpdateCommand.OrgCode,
OrgName: orgUpdateCommand.OrgName,
ParentId: parentId,
ParentId: int64(parentId),
})
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
... ...
... ... @@ -121,21 +121,31 @@ func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (
// 编辑角色关联权限菜单的前置准备数据
func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *query.RoleMenuBeforeEditQuery) (interface{}, error) {
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
// roleMenuBeforeEditQuery.Operator.CompanyId,
// roleMenuBeforeEditQuery.Operator.OrgId,
// roleMenuBeforeEditQuery.Operator.UserId)
//roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
//roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
// OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
// Limit: 999,
// RoleType: 1,
//})
//if err != nil {
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
//}
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleMenuBeforeEditQuery.Operator.CompanyId,
roleMenuBeforeEditQuery.Operator.OrgId,
roleMenuBeforeEditQuery.Operator.UserId)
roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
Limit: 999,
RoleType: 1,
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return nil, nil
menus, err := creationUserGateway.RoleGetAccessMenus(allied_creation_user.ReqRoleGetAccessMenus{
RoleId: int64(roleId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
result := map[string]interface{}{
"roles": roles.Roles,
"menus": menus.Menus,
}
return result, nil
}
// 编辑角色关联用户的前置准备数据
... ...
... ... @@ -11,7 +11,7 @@ type CompanyUserEnableCommand struct {
//操作人
Operator domain.Operator `json:"-"`
//用户id
UsersIds []int64 `json:"usersIds,omitempty"`
UsersIds []string `json:"usersIds,omitempty"`
// 启用状态(启用:1 禁用:2)
EnableStatus int `json:"enableStatus,omitempty"`
}
... ...
... ... @@ -10,7 +10,7 @@ import (
type CompanyUserResetPasswordCommand struct {
//操作人
Operator domain.Operator `json:"-"`
UsersIds []int64 `json:"usersIds" valid:"Required"`
UserIds []string `json:"userIds" valid:"Required"`
}
func (companyUserResetPasswordCommand *CompanyUserResetPasswordCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -11,9 +11,9 @@ type CooperationUserAddCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersCode string `json:"usersCode" valid:"Required"`
UsersCode string `json:"userCode" valid:"Required"`
// 用户姓名
UsersName string `json:"usersName" valid:"Required"`
UsersName string `json:"userName" valid:"Required"`
// 共创公司
CooperationCompany string `json:"cooperationCompany" valid:"Required"`
// 共创公司到期时间
... ...
... ... @@ -11,7 +11,7 @@ type CooperationUserEnableCommand struct {
//操作人
Operator domain.Operator `json:"-"`
//用户id
UsersIds []int64 `json:"usersIds,omitempty"`
UsersIds []string `json:"userIds,omitempty"`
// 启用状态(启用:1 禁用:2)
EnableStatus int `json:"enableStatus,omitempty"`
}
... ...
... ... @@ -10,7 +10,7 @@ import (
type CooperationUserResetPasswordCommand struct {
//操作人
Operator domain.Operator `json:"-"`
UsersIds []int64 `json:"usersIds" valid:"Required"`
UserIds []string `json:"userIds" valid:"Required"`
}
func (cooperationUserResetPasswordCommand *CooperationUserResetPasswordCommand) Valid(validation *validation.Validation) {
... ...
... ... @@ -11,11 +11,11 @@ type CooperationUserUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersId int64 `json:"usersId" valid:"Required"`
UserId int64 `json:"userId" valid:"Required"`
// 用户编号
UsersCode string `json:"usersCode" valid:"Required"`
UserCode string `json:"userCode" valid:"Required"`
// 用户姓名
UsersName string `json:"usersName" valid:"Required"`
UserName string `json:"userName" valid:"Required"`
// 共创公司
CooperationCompany string `json:"cooperationCompany" valid:"Required"`
// 共创公司到期时间
... ... @@ -23,7 +23,7 @@ type CooperationUserUpdateCommand struct {
// 启用状态(启用:1 禁用:2)
EnableStatus int `json:"enableStatus" valid:"Required"`
// 邮箱
Email string `json:"email" valid:"Required"`
Email string `json:"email"`
//头像
Avatar string `json:"avatar"`
... ...
... ... @@ -76,7 +76,7 @@ type CooperationUserInfo struct {
type CooperationUserItem struct {
CooperationCompany string `json:"cooperationCompany"`
UserId string `json:"userId"`
CooperationDeadline int64 `json:"cooperationDeadline"`
CooperationDeadline string `json:"cooperationDeadline"`
Phone string `json:"phone"`
EnableStatus int `json:"enableStatus"`
UserCode string `json:"userCode"`
... ...
... ... @@ -11,7 +11,7 @@ type CooperationUserGetQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 用户编号
UsersId string `json:"usersId" valid:"Required"`
UserId string `json:"userId" valid:"Required"`
}
func (cooperationUserGetQuery *CooperationUserGetQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -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
... ...
... ... @@ -197,7 +197,7 @@ func (gateway HttplibAlliedCreationUser) CompanySearch(param ReqCompanySearch) (
// CompanyGetCustomizeMenus 返回自定义菜单列表
func (gateway HttplibAlliedCreationUser) CompanyGetCustomizeMenus(param ReqCompanyGetCustomizeMenus) (*DataCompanyGetCustomizeMenus, error) {
url := gateway.baseUrL + "/company/" + strconv.FormatInt(param.CompanyId, 10) + "/customize-menus"
url := gateway.baseUrL + "/company/" + strconv.FormatInt(param.CompanyId, 10) + "/customize-menus?menuCategory=" + param.MenuCategory
method := "get"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向用户模块请求数据:返回自定义菜单列表。", map[string]interface{}{
... ...
... ... @@ -63,7 +63,9 @@ type (
//返回自定义菜单列表
type (
ReqCompanyGetCustomizeMenus struct {
CompanyId int64
CompanyId int64 `json:"companyId"`
// 菜单类别 web app
MenuCategory string `cname:"菜单类别" json:"menuCategory,omitempty"`
}
DataCompanyGetCustomizeMenus struct {
... ...
... ... @@ -19,6 +19,14 @@ type (
type (
ReqOrgUpdate struct {
OrgId int64
// 组织编码
OrgCode string `cname:"组织编码" json:"orgCode"`
// 组织名称
OrgName string `cname:"组织名称" json:"orgName"`
// 是否是组织(是:1 不是:2)
IsOrg int `cname:"是否是组织(是:1 不是:2)" json:"isOrg"`
// 父级ID
ParentId int64 `cname:"父级ID" json:"parentId" valid:"Required"`
}
DataOrgUpdate struct {
... ...
... ... @@ -38,10 +38,10 @@ type (
DataRoleSearch struct {
Count int64
Roles []struct {
AccessMenus []int `json:"accessMenus"`
CompanyID Int64String `json:"companyId"`
CreatedAt string `json:"createdAt"`
Desc string `json:"desc"`
AccessMenus []Int64String `json:"accessMenus"`
CompanyID Int64String `json:"companyId"`
CreatedAt string `json:"createdAt"`
Desc string `json:"desc"`
Ext struct {
DepName string `json:"depName"`
OrgName string `json:"orgName"`
... ... @@ -188,20 +188,20 @@ type (
DataRoleGetAccessMenus struct {
Menus []struct {
MenuID int `json:"menuId"`
ParentID int `json:"parentId"`
MenuName string `json:"menuName"`
MenuAlias string `json:"menuAlias"`
Code string `json:"code"`
AccessCode string `json:"accessCode,omitempty"`
MenuType string `json:"menuType"`
Icon string `json:"icon"`
Sort int `json:"sort"`
Remark string `json:"remark,omitempty"`
Category string `json:"category"`
IsPublish int `json:"isPublish"`
EnableStatus int `json:"enableStatus"`
ParentPath string `json:"parentPath,omitempty"`
MenuID Int64String `json:"menuId"`
ParentID Int64String `json:"parentId"`
MenuName string `json:"menuName"`
MenuAlias string `json:"menuAlias"`
Code string `json:"code"`
AccessCode string `json:"accessCode,omitempty"`
MenuType string `json:"menuType"`
Icon string `json:"icon"`
Sort int `json:"sort"`
Remark string `json:"remark,omitempty"`
Category string `json:"category"`
IsPublish int `json:"isPublish"`
EnableStatus int `json:"enableStatus"`
ParentPath string `json:"parentPath,omitempty"`
} `json:"menus"`
}
)
... ...
... ... @@ -72,10 +72,16 @@ type (
DepartmentId int64 `json:"departmentId"`
// 用户姓名
UserName string `json:"userName"`
// 共创公司
CooperationCompany string `cname:"共创公司" json:"cooperationCompany,omitempty"`
// 部门名称
DepName string `json:"depName"`
// 手机号码
Phone string `json:"phone"`
// 用户类型
UserType int `cname:"用户类型 1:普通用户 2:共创用户 1024:企业注册用户" json:"userType,omitempty"`
// 实时拉取数据 (获取最新的)
PullRealTime bool `cname:"拉取最新数据" json:"pullRealTime,omitempty"`
}
//DataUserSearch 搜索用户列表
... ... @@ -205,6 +211,8 @@ type (
//创建共创用户
type (
ReqCreateCooperatorUser struct {
// 企业ID
CompanyId int64 `cname:"企业ID" json:"companyId"`
// 共创公司
CooperationCompany string ` json:"cooperationCompany"`
// 共创到期时间
... ...
... ... @@ -13,6 +13,7 @@ type MenuController struct {
func (controller *MenuController) MenuList() {
menuService := service.NewMenuService(nil)
menuListQuery := &query.MenuListQuery{}
controller.Unmarshal(menuListQuery)
menuListQuery.Operator = controller.GetOperator()
data, err := menuService.MenuList(menuListQuery)
controller.Response(data, err)
... ... @@ -31,6 +32,7 @@ func (controller *MenuController) MenuFavorite() {
menuService := service.NewMenuService(nil)
menuFavoriteCommand := &command.MenuFavoriteCommand{}
controller.Unmarshal(menuFavoriteCommand)
menuFavoriteCommand.Operator = controller.GetOperator()
data, err := menuService.MenuFavorite(menuFavoriteCommand)
controller.Response(data, err)
}
... ...
... ... @@ -48,3 +48,12 @@ func (controller *OrgsController) OrgGet() {
data, err := orgsService.OrgGet(orgGetQuery)
controller.Response(data, err)
}
func (controller *OrgsController) OrgEnable() {
orgsService := service.NewOrgsService(nil)
orgEnableCommand := &command.OrgEnableCommand{}
controller.Unmarshal(orgEnableCommand)
orgEnableCommand.Operator = controller.GetOperator()
data, err := orgsService.OrgEnable(orgEnableCommand)
controller.Response(data, err)
}
... ...
... ... @@ -92,6 +92,8 @@ func (controller *RolesController) RoleMenuBeforeEdit() {
roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
roleMenuBeforeEditQuery.Operator = controller.GetOperator()
controller.Unmarshal(roleMenuBeforeEditQuery)
roleId := controller.GetString(":roleId")
roleMenuBeforeEditQuery.RoleId = roleId
data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
controller.Response(data, err)
}
... ...
... ... @@ -4,6 +4,7 @@ import (
"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/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service"
"strconv"
)
type UsersController struct {
... ... @@ -78,6 +79,8 @@ func (controller *UsersController) CooperationUserUpdate() {
usersService := service.NewUsersService(nil)
cooperationUserUpdateCommand := &command.CooperationUserUpdateCommand{}
controller.Unmarshal(cooperationUserUpdateCommand)
userId := controller.GetString(":userId")
cooperationUserUpdateCommand.UserId, _ = strconv.ParseInt(userId, 10, 64)
cooperationUserUpdateCommand.Operator = controller.GetOperator()
data, err := usersService.CooperationUserUpdate(cooperationUserUpdateCommand)
controller.Response(data, err)
... ... @@ -96,7 +99,7 @@ func (controller *UsersController) CooperationUserGet() {
usersService := service.NewUsersService(nil)
cooperationUserGetQuery := &query.CooperationUserGetQuery{}
userId := controller.GetString(":userId")
cooperationUserGetQuery.UsersId = userId
cooperationUserGetQuery.UserId = userId
cooperationUserGetQuery.Operator = controller.GetOperator()
data, err := usersService.CooperationUserGet(cooperationUserGetQuery)
controller.Response(data, err)
... ...
package routers
import (
"github.com/beego/beego/v2/server/web"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
)
func init() {
web.Router("/v1/web/menus/search", &web_client.MenuController{}, "Post:MenuList")
web.Router("/v1/web/menus", &web_client.MenuController{}, "Put:MenuUpdate")
web.Router("/v1/web/menus/favorite", &web_client.MenuController{}, "Put:MenuFavorite")
}
... ...
... ... @@ -10,4 +10,5 @@ func init() {
web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Put:OrgUpdate")
web.Router("/v1/web/orgs/search", &web_client.OrgsController{}, "Post:OrgList")
web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Get:OrgGet")
web.Router("/v1/web/orgs/enable", &web_client.OrgsController{}, "Post:OrgEnable")
}
... ...
... ... @@ -14,7 +14,7 @@ func init() {
web.Router("/v1/web/roles/role-user/assign", &web_client.RolesController{}, "Post:RoleUserAdd")
web.Router("/v1/web/roles/role-user/unassign", &web_client.RolesController{}, "Post:RoleUserDelete")
web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit")
web.Router("/v1/web/roles/role-menu/before-edit", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
web.Router("/v1/web/roles/role-menu/before-edit/:roleId", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit")
web.Router("/v1/web/roles/batch-delete", &web_client.RolesController{}, "Post:RoleDelete")
}
... ...
... ... @@ -13,7 +13,7 @@ func init() {
web.Router("/v1/web/users/company-user/enable", &web_client.UsersController{}, "Put:CompanyUserEnable")
web.Router("/v1/web/users/company-user/reset-password", &web_client.UsersController{}, "Put:CompanyUserResetPassword")
web.Router("/v1/web/users/cooperation-user", &web_client.UsersController{}, "Post:CooperationUserAdd")
web.Router("/v1/web/users/cooperation-user", &web_client.UsersController{}, "Put:CooperationUserUpdate")
web.Router("/v1/web/users/cooperation-user/:userId", &web_client.UsersController{}, "Put:CooperationUserUpdate")
web.Router("/v1/web/users/cooperation-user/search", &web_client.UsersController{}, "Post:CooperationUserList")
web.Router("/v1/web/users/cooperation-user/:userId", &web_client.UsersController{}, "Get:CooperationUserGet")
web.Router("/v1/web/users/cooperation-user/enable", &web_client.UsersController{}, "Put:CooperationUserEnable")
... ...