作者 tangxuhui

文件结构更新

正在显示 48 个修改的文件 包含 466 行增加145 行删除
1 -{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego":1627475088561293500}  
  1 +{"D:\\workspaceGo\\src\\allied-creation-gateway\\pkg\\port\\beego":1627544330050447000}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 +)
  8 +
  9 +type MenuFavoriteCommand struct {
  10 + // 企业id
  11 + CompanyId int64 `json:"companyId" valid:"Required"`
  12 + // 对应菜单的id
  13 + MenuId []int64 `json:"menuId,omitempty"`
  14 +}
  15 +
  16 +func (menuFavoriteCommand *MenuFavoriteCommand) Valid(validation *validation.Validation) {
  17 + validation.SetError("CustomValid", "未实现的自定义认证")
  18 +}
  19 +
  20 +func (menuFavoriteCommand *MenuFavoriteCommand) ValidateCommand() error {
  21 + valid := validation.Validation{}
  22 + b, err := valid.Valid(menuFavoriteCommand)
  23 + if err != nil {
  24 + return err
  25 + }
  26 + if !b {
  27 + for _, validErr := range valid.Errors {
  28 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  29 + }
  30 + }
  31 + return nil
  32 +}
  1 +package command
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type MenuUpdateCommand struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 + // 企业id
  14 + CompanyId int64 `json:"companyId" valid:"Required"`
  15 + // 菜单编号
  16 + MenuId int64 `json:"menuId" valid:"Required"`
  17 + // 菜单名称
  18 + MenuName string `json:"menuName" valid:"Required"`
  19 + // 排序
  20 + Sort int `json:"sort" valid:"Required"`
  21 +}
  22 +
  23 +func (menuUpdateQuery *MenuUpdateCommand) Valid(validation *validation.Validation) {
  24 + validation.SetError("CustomValid", "未实现的自定义认证")
  25 +}
  26 +
  27 +func (menuUpdateQuery *MenuUpdateCommand) ValidateQuery() error {
  28 + valid := validation.Validation{}
  29 + b, err := valid.Valid(menuUpdateQuery)
  30 + if err != nil {
  31 + return err
  32 + }
  33 + if !b {
  34 + for _, validErr := range valid.Errors {
  35 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  36 + }
  37 + }
  38 + return nil
  39 +}
  1 +package query
  2 +
  3 +import (
  4 + "fmt"
  5 +
  6 + "github.com/beego/beego/v2/core/validation"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
  8 +)
  9 +
  10 +type MenuListQuery struct {
  11 + //操作人
  12 + Operator domain.Operator `json:"-"`
  13 +}
  14 +
  15 +func (menuListQuery *MenuListQuery) Valid(validation *validation.Validation) {
  16 +
  17 +}
  18 +
  19 +func (menuListQuery *MenuListQuery) ValidateQuery() error {
  20 + valid := validation.Validation{}
  21 + b, err := valid.Valid(menuListQuery)
  22 + if err != nil {
  23 + return err
  24 + }
  25 + if !b {
  26 + for _, validErr := range valid.Errors {
  27 + return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
  28 + }
  29 + }
  30 + return nil
  31 +}
  1 +package service
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/core/application"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/custommenu/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/custommenu/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
  8 +)
  9 +
  10 +// 用户菜单维护
  11 +type MenuService struct {
  12 +}
  13 +
  14 +// 设置收藏菜单
  15 +func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) {
  16 +
  17 + return nil, nil
  18 +}
  19 +
  20 +// 返回菜单列表
  21 +func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (interface{}, error) {
  22 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  23 + menuListQuery.Operator.CompanyId,
  24 + menuListQuery.Operator.OrgId,
  25 + menuListQuery.Operator.UserId)
  26 + result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
  27 + CompanyId: menuListQuery.Operator.CompanyId,
  28 + })
  29 + if err != nil {
  30 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  31 + }
  32 + return result, nil
  33 +}
  34 +
  35 +// 更新菜单
  36 +func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdateCommand) (interface{}, error) {
  37 + creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
  38 + menuUpdateCommand.Operator.CompanyId,
  39 + menuUpdateCommand.Operator.OrgId,
  40 + menuUpdateCommand.Operator.UserId)
  41 + _, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{
  42 + CompanyId: menuUpdateCommand.CompanyId,
  43 + MenuAlias: menuUpdateCommand.MenuName,
  44 + MenuId: int(menuUpdateCommand.MenuId),
  45 + Sort: menuUpdateCommand.Sort,
  46 + })
  47 + if err != nil {
  48 + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
  49 + }
  50 + return menuUpdateCommand, nil
  51 +}
  52 +
  53 +func NewMenuService(options map[string]interface{}) *MenuService {
  54 + newMenuService := &MenuService{}
  55 + return newMenuService
  56 +}
@@ -4,9 +4,9 @@ import ( @@ -4,9 +4,9 @@ import (
4 "strconv" 4 "strconv"
5 5
6 "github.com/linmadan/egglib-go/core/application" 6 "github.com/linmadan/egglib-go/core/application"
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/command"  
8 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/dto"  
9 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/orgs/query" 7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/dto"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
11 ) 11 )
12 12
@@ -4,9 +4,9 @@ import ( @@ -4,9 +4,9 @@ import (
4 "strconv" 4 "strconv"
5 5
6 "github.com/linmadan/egglib-go/core/application" 6 "github.com/linmadan/egglib-go/core/application"
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/command"  
8 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/dto"  
9 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/roles/query" 7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/command"
  8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/dto"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/query"
10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 10 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
11 ) 11 )
12 12
@@ -10,6 +10,47 @@ type CompanyUserItem struct { @@ -10,6 +10,47 @@ type CompanyUserItem struct {
10 UserName string `json:"userName"` 10 UserName string `json:"userName"`
11 } 11 }
12 12
  13 +//CompanyUserInfo 用户数据详情
  14 +type CompanyUserInfo struct {
  15 + Email string `json:"email"`
  16 + Phone string `json:"phone"`
  17 + Avatar string `json:"avatar"`
  18 + EnableStatus int `json:"enableStatus"`
  19 + UsersCode string `json:"usersCode"`
  20 + UsersID string `json:"usersId"`
  21 + UsersName string `json:"usersName"`
  22 + OrgID string `json:"orgId"`
  23 + OrgName string `json:"orgName"`
  24 + DepartmentID string `json:"departmentId"`
  25 + DepartmentName string `json:"departmentName"`
  26 + UsersOrg []UserOrg `json:"usersOrg"`
  27 + UsersRole []UserRole `json:"usersRole"`
  28 +}
  29 +
  30 +type UserOrg struct {
  31 + OrgID string `json:"orgId"`
  32 + OrgName string `json:"orgName"`
  33 +}
  34 +
  35 +type UserRole struct {
  36 + RoleID string `json:"roleId"`
  37 + RoleName string `json:"roleName"`
  38 + OrgName string `json:"orgName"`
  39 +}
  40 +
  41 +type UserMenu struct {
  42 + Category string `json:"category"`
  43 + Code string `json:"code"`
  44 + Icon string `json:"icon"`
  45 + MenuAlias string `json:"menuAlias"`
  46 + MenuID int `json:"menuId"`
  47 + MenuName string `json:"menuName"`
  48 + MenuType string `json:"menuType"`
  49 + ParentID int `json:"parentId"`
  50 + Remark string `json:"remark"`
  51 + Sort int `json:"sort"`
  52 +}
  53 +
13 type CooperationUserInfo struct { 54 type CooperationUserInfo struct {
14 UserId string `json:"userId"` 55 UserId string `json:"userId"`
15 //用户编号 56 //用户编号
@@ -11,7 +11,7 @@ type CompanyUserGetQuery struct { @@ -11,7 +11,7 @@ type CompanyUserGetQuery struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 用户编号 13 // 用户编号
14 - UsersId int64 `json:"usersId" valid:"Required"` 14 + UsersId string `json:"usersId" valid:"Required"`
15 } 15 }
16 16
17 func (companyUserGetQuery *CompanyUserGetQuery) Valid(validation *validation.Validation) { 17 func (companyUserGetQuery *CompanyUserGetQuery) Valid(validation *validation.Validation) {
@@ -11,7 +11,7 @@ type CooperationUserGetQuery struct { @@ -11,7 +11,7 @@ type CooperationUserGetQuery struct {
11 //操作人 11 //操作人
12 Operator domain.Operator `json:"-"` 12 Operator domain.Operator `json:"-"`
13 // 用户编号 13 // 用户编号
14 - UsersId int64 `json:"usersId" valid:"Required"` 14 + UsersId string `json:"usersId" valid:"Required"`
15 } 15 }
16 16
17 func (cooperationUserGetQuery *CooperationUserGetQuery) Valid(validation *validation.Validation) { 17 func (cooperationUserGetQuery *CooperationUserGetQuery) Valid(validation *validation.Validation) {
@@ -5,10 +5,9 @@ import ( @@ -5,10 +5,9 @@ import (
5 "time" 5 "time"
6 6
7 "github.com/linmadan/egglib-go/core/application" 7 "github.com/linmadan/egglib-go/core/application"
8 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/command"  
9 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/dto"  
10 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/query"  
11 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain" 8 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
  9 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/dto"
  10 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
12 11
13 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user" 12 "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
14 ) 13 )
@@ -23,24 +22,49 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp @@ -23,24 +22,49 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
23 companyUserGetQuery.Operator.CompanyId, 22 companyUserGetQuery.Operator.CompanyId,
24 companyUserGetQuery.Operator.OrgId, 23 companyUserGetQuery.Operator.OrgId,
25 companyUserGetQuery.Operator.UserId) 24 companyUserGetQuery.Operator.UserId)
26 - result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{  
27 - UserId: companyUserGetQuery.UsersId, 25 + userid, _ := strconv.Atoi(companyUserGetQuery.UsersId)
  26 + resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
  27 + UserId: userid,
28 }) 28 })
29 if err != nil { 29 if err != nil {
30 return nil, err 30 return nil, err
31 } 31 }
32 - user := domain.Users{  
33 - UserId: strconv.FormatInt(result.UserId, 10),  
34 - UserInfo: result.GetUserBase(),  
35 - Org: result.GetOrg(),  
36 - Department: result.GetDepartment(),  
37 - Company: nil,  
38 - UserOrg: result.GetUserOrg(),  
39 - UserRole: result.GetUserRole(), 32 + creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{})
  33 + var (
  34 + usersOrg []dto.UserOrg
  35 + userRole []dto.UserRole
  36 + )
  37 + for _, v := range resultUser.UserOrg {
  38 + usersOrg = append(usersOrg, dto.UserOrg{
  39 + OrgID: strconv.Itoa(v.OrgID),
  40 + OrgName: v.OrgName,
  41 + })
40 } 42 }
  43 + for _, v := range resultUser.UserRole {
  44 + userRole = append(userRole, dto.UserRole{
  45 + RoleID: strconv.Itoa(v.RoleID),
  46 + RoleName: v.RoleName,
  47 + OrgName: v.Ext.OrgName,
  48 + })
  49 + }
  50 + user := dto.CompanyUserInfo{
  51 + Email: resultUser.UserInfo.Email,
  52 + Phone: resultUser.UserInfo.Phone,
  53 + Avatar: resultUser.UserInfo.Avatar,
  54 + EnableStatus: resultUser.EnableStatus,
  55 + UsersCode: resultUser.UserCode,
  56 + UsersID: strconv.Itoa(resultUser.UserId),
  57 + UsersName: resultUser.UserInfo.UserName,
  58 + OrgID: strconv.Itoa(resultUser.Org.OrgId),
  59 + OrgName: resultUser.Org.OrgName,
  60 + DepartmentID: strconv.Itoa(resultUser.Department.DepartmentId),
  61 + DepartmentName: resultUser.Department.DepartmentName,
  62 + UsersOrg: usersOrg,
  63 + UsersRole: userRole,
  64 + }
  65 +
41 datas := map[string]interface{}{ 66 datas := map[string]interface{}{
42 "user": user, 67 "user": user,
43 - "userMenu": "", //TODO  
44 } 68 }
45 return datas, err 69 return datas, err
46 } 70 }
@@ -138,7 +162,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co @@ -138,7 +162,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
138 Phone: v.UserInfo.Phone, 162 Phone: v.UserInfo.Phone,
139 EnableStatus: v.EnableStatus, 163 EnableStatus: v.EnableStatus,
140 UserCode: v.UserCode, 164 UserCode: v.UserCode,
141 - UserId: strconv.FormatInt(v.UserId, 10), 165 + UserId: strconv.Itoa(v.UserId),
142 UserName: v.UserInfo.UserName, 166 UserName: v.UserInfo.UserName,
143 } 167 }
144 listData = append(listData, item) 168 listData = append(listData, item)
@@ -246,15 +270,16 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu @@ -246,15 +270,16 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
246 cooperationUserGetQuery.Operator.CompanyId, 270 cooperationUserGetQuery.Operator.CompanyId,
247 cooperationUserGetQuery.Operator.OrgId, 271 cooperationUserGetQuery.Operator.OrgId,
248 cooperationUserGetQuery.Operator.UserId) 272 cooperationUserGetQuery.Operator.UserId)
  273 + userId, _ := strconv.Atoi(cooperationUserGetQuery.UsersId)
249 result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{ 274 result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
250 - UserId: cooperationUserGetQuery.UsersId, 275 + UserId: userId,
251 }) 276 })
252 if err != nil { 277 if err != nil {
253 return nil, err 278 return nil, err
254 } 279 }
255 deadline := result.CooperationInfo.CooperationDeadline.Unix() 280 deadline := result.CooperationInfo.CooperationDeadline.Unix()
256 userInfo := dto.CooperationUserInfo{ 281 userInfo := dto.CooperationUserInfo{
257 - UserId: strconv.FormatInt(result.UserId, 10), 282 + UserId: strconv.Itoa(result.UserId),
258 UserCode: result.UserCode, 283 UserCode: result.UserCode,
259 EnableStatus: int32(result.EnableStatus), 284 EnableStatus: int32(result.EnableStatus),
260 CooperationCompany: result.CooperationInfo.CooperationCompany, 285 CooperationCompany: result.CooperationInfo.CooperationCompany,
@@ -288,14 +313,14 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery * @@ -288,14 +313,14 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
288 for _, v := range result.Users { 313 for _, v := range result.Users {
289 item = dto.CooperationUserItem{ 314 item = dto.CooperationUserItem{
290 CooperationCompany: v.CooperationInfo.CooperationCompany, 315 CooperationCompany: v.CooperationInfo.CooperationCompany,
291 - UserId: strconv.FormatInt(v.UserId, 10), 316 + UserId: strconv.Itoa(v.UserId),
292 CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(), 317 CooperationDeadline: v.CooperationInfo.CooperationDeadline.Unix(),
293 Phone: v.UserInfo.Phone, 318 Phone: v.UserInfo.Phone,
294 EnableStatus: v.EnableStatus, 319 EnableStatus: v.EnableStatus,
295 UserCode: v.UserCode, 320 UserCode: v.UserCode,
296 UserName: v.UserInfo.UserName, 321 UserName: v.UserInfo.UserName,
297 OrgName: v.Org.OrgName, 322 OrgName: v.Org.OrgName,
298 - OrgId: strconv.FormatInt(v.Org.OrgId, 10), 323 + OrgId: strconv.Itoa(v.Org.OrgId),
299 } 324 }
300 listData = append(listData, item) 325 listData = append(listData, item)
301 } 326 }
1 package domain 1 package domain
2 2
3 -const (  
4 - UsersStatusEnable int = 1  
5 - UsersStatusDisable int = 2  
6 -)  
7 -  
8 // 用户基础信息 3 // 用户基础信息
9 type Users struct { 4 type Users struct {
10 // 用户id 5 // 用户id
@@ -22,7 +22,10 @@ type ( @@ -22,7 +22,10 @@ type (
22 //更新自定义菜单 22 //更新自定义菜单
23 type ( 23 type (
24 ReqCompanySetCustomizeMenus struct { 24 ReqCompanySetCustomizeMenus struct {
25 - CompanyId int64 25 + CompanyId int64 `json:"companyId"`
  26 + MenuAlias string `json:"menuAlias"`
  27 + MenuId int `json:"menuId"`
  28 + Sort int `json:"sort"`
26 } 29 }
27 30
28 DataCompanySetCustomizeMenus struct { 31 DataCompanySetCustomizeMenus struct {
@@ -64,5 +67,18 @@ type ( @@ -64,5 +67,18 @@ type (
64 } 67 }
65 68
66 DataCompanyGetCustomizeMenus struct { 69 DataCompanyGetCustomizeMenus struct {
  70 + Menus []struct {
  71 + Code string `json:"code"`
  72 + EnableStatus float64 `json:"enableStatus"`
  73 + Icon string `json:"icon"`
  74 + MenuAlias string `json:"menuAlias"`
  75 + MenuID float64 `json:"menuId"`
  76 + MenuName string `json:"menuName"`
  77 + MenuType string `json:"menuType"`
  78 + ParentID float64 `json:"parentId"`
  79 + ParentMenuName string `json:"parentMenuName"`
  80 + Remark string `json:"remark"`
  81 + Sort float64 `json:"sort"`
  82 + } `json:"menus"`
67 } 83 }
68 ) 84 )
1 package allied_creation_user 1 package allied_creation_user
2 2
3 import ( 3 import (
4 - "strconv"  
5 "time" 4 "time"
6 -  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"  
8 ) 5 )
9 6
10 //################用户模块################## 7 //################用户模块##################
11 8
12 //单体用户详情数据 9 //单体用户详情数据
13 type UserDetail struct { 10 type UserDetail struct {
14 - UserId int64 `json:"userId"`  
15 - UserBaseId int64 `json:"userBaseId"` 11 + UserId int `json:"userId"`
  12 + UserBaseId int `json:"userBaseId"`
16 UserType int `json:"userType"` 13 UserType int `json:"userType"`
17 UserCode string `json:"userCode"` 14 UserCode string `json:"userCode"`
18 EnableStatus int `json:"enableStatus"` 15 EnableStatus int `json:"enableStatus"`
@@ -28,7 +25,7 @@ type UserDetail struct { @@ -28,7 +25,7 @@ type UserDetail struct {
28 Avatar string `json:"avatar"` 25 Avatar string `json:"avatar"`
29 } `json:"userInfo,omitempty"` 26 } `json:"userInfo,omitempty"`
30 Company *struct { 27 Company *struct {
31 - CompanyId int64 `json:"companyId"` 28 + CompanyId int `json:"companyId"`
32 CompanyName string `json:"companyName"` 29 CompanyName string `json:"companyName"`
33 Scale string `json:"scale"` 30 Scale string `json:"scale"`
34 IndustryCategory string `json:"industryCategory"` 31 IndustryCategory string `json:"industryCategory"`
@@ -36,23 +33,23 @@ type UserDetail struct { @@ -36,23 +33,23 @@ type UserDetail struct {
36 Status int64 `json:"status"` 33 Status int64 `json:"status"`
37 } `json:"company,omitempty"` 34 } `json:"company,omitempty"`
38 Org *struct { 35 Org *struct {
39 - OrgId int64 `json:"orgId"` 36 + OrgId int `json:"orgId"`
40 OrgCode string `json:"orgCode"` 37 OrgCode string `json:"orgCode"`
41 OrgName string `json:"orgName"` 38 OrgName string `json:"orgName"`
42 } `json:"org,omitempty"` 39 } `json:"org,omitempty"`
43 Department *struct { 40 Department *struct {
44 - DepartmentId int64 `json:"departmentId"` 41 + DepartmentId int `json:"departmentId"`
45 DepartmentName string `json:"departmentName"` 42 DepartmentName string `json:"departmentName"`
46 } `json:"department,omitempty"` 43 } `json:"department,omitempty"`
47 UserRole []struct { 44 UserRole []struct {
48 - RoleID int64 `json:"roleId"` 45 + RoleID int `json:"roleId"`
49 RoleName string `json:"roleName"` 46 RoleName string `json:"roleName"`
50 Ext struct { 47 Ext struct {
51 OrgName string `json:"orgName"` 48 OrgName string `json:"orgName"`
52 } `json:"ext,omitempty"` 49 } `json:"ext,omitempty"`
53 } `json:"userRole"` 50 } `json:"userRole"`
54 UserOrg []struct { 51 UserOrg []struct {
55 - OrgID int64 `json:"orgId"` 52 + OrgID int `json:"orgId"`
56 CreatedAt time.Time `json:"createdAt"` 53 CreatedAt time.Time `json:"createdAt"`
57 UpdatedAt time.Time `json:"updatedAt"` 54 UpdatedAt time.Time `json:"updatedAt"`
58 DeletedAt time.Time `json:"deletedAt"` 55 DeletedAt time.Time `json:"deletedAt"`
@@ -60,99 +57,6 @@ type UserDetail struct { @@ -60,99 +57,6 @@ type UserDetail struct {
60 } `json:"userOrg"` 57 } `json:"userOrg"`
61 } 58 }
62 59
63 -func (info *UserDetail) GetUserBase() *domain.UsersBase {  
64 - return &domain.UsersBase{  
65 - UserId: strconv.Itoa(int(info.UserId)),  
66 - UserBaseId: strconv.Itoa(int(info.UserBaseId)),  
67 - UserType: info.UserType,  
68 - EnableStatus: info.EnableStatus,  
69 - Phone: info.UserInfo.Phone,  
70 - UserCode: info.UserCode,  
71 - UserName: info.UserInfo.UserName,  
72 - Email: info.UserInfo.Email,  
73 - Avatar: info.UserInfo.Avatar,  
74 - CooperationCompany: info.CooperationInfo.CooperationCompany,  
75 - CooperationDeadline: info.CooperationInfo.CooperationDeadline,  
76 - }  
77 -}  
78 -  
79 -func (info *UserDetail) GetCompanyInfo() *domain.CompanyInfo {  
80 - if info.Company == nil {  
81 - return nil  
82 - }  
83 - return &domain.CompanyInfo{  
84 - CompanyId: strconv.Itoa(int(info.Company.CompanyId)),  
85 - CompanyName: info.Company.CompanyName,  
86 - Scale: info.Company.Scale,  
87 - Logo: "",  
88 - Address: "",  
89 - IndustryCategory: info.Company.IndustryCategory,  
90 - Contacts: "",  
91 - RegisteredTime: info.Company.RegisteredTime,  
92 - RegistStatus: info.Company.Status,  
93 - }  
94 -}  
95 -  
96 -func (info *UserDetail) GetDepartment() *domain.Department {  
97 - if info.Department == nil {  
98 - return nil  
99 - }  
100 - return &domain.Department{  
101 - OrgId: info.Department.DepartmentId,  
102 - OrgName: info.Org.OrgName,  
103 - OrgCode: "",  
104 - ParentId: 0,  
105 - }  
106 -}  
107 -  
108 -func (info *UserDetail) GetOrg() *domain.Orgs {  
109 - if info.Org == nil {  
110 - return nil  
111 - }  
112 - return &domain.Orgs{  
113 - OrgId: strconv.Itoa(int(info.Department.DepartmentId)),  
114 - OrgName: info.Org.OrgName,  
115 - OrgCode: "",  
116 - ParentId: 0,  
117 - }  
118 -}  
119 -  
120 -func (info *UserDetail) GetUserOrg() []domain.Orgs {  
121 - var (  
122 - userOrgs []domain.Orgs  
123 - userOrg domain.Orgs  
124 - )  
125 - for _, v := range info.UserOrg {  
126 - userOrg = domain.Orgs{  
127 - OrgId: strconv.FormatInt(v.OrgID, 10),  
128 - OrgName: v.OrgName,  
129 - OrgCode: "",  
130 - ParentId: 0,  
131 - }  
132 - userOrgs = append(userOrgs, userOrg)  
133 - }  
134 - return userOrgs  
135 -}  
136 -  
137 -func (info *UserDetail) GetUserRole() []domain.Roles {  
138 - var (  
139 - roles []domain.Roles  
140 - role domain.Roles  
141 - )  
142 - for _, v := range info.UserRole {  
143 - role = domain.Roles{  
144 - RoleId: strconv.FormatInt(v.RoleID, 10),  
145 - RoleName: v.RoleName,  
146 - // 用户的组织  
147 - Org: &domain.Orgs{  
148 - OrgName: v.RoleName,  
149 - },  
150 - }  
151 - roles = append(roles, role)  
152 - }  
153 - return roles  
154 -}  
155 -  
156 //搜索用户列表 60 //搜索用户列表
157 type ( 61 type (
158 ReqUserSearch struct { 62 ReqUserSearch struct {
@@ -259,7 +163,7 @@ type ( @@ -259,7 +163,7 @@ type (
259 //获取用户 163 //获取用户
260 type ( 164 type (
261 ReqGateUser struct { 165 ReqGateUser struct {
262 - UserId int64 `json:"userId"` 166 + UserId int `json:"userId"`
263 } 167 }
264 168
265 DataGateUser struct { 169 DataGateUser struct {
@@ -375,7 +279,7 @@ type ( @@ -375,7 +279,7 @@ type (
375 //返回用户有权限的菜单 279 //返回用户有权限的菜单
376 type ( 280 type (
377 ReqUserAccessMenus struct { 281 ReqUserAccessMenus struct {
378 - UserId int64 `json:"userId"` 282 + UserId int `json:"userId"`
379 } 283 }
380 DataUserAccessMenus struct { 284 DataUserAccessMenus struct {
381 } 285 }
  1 +package web_client
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/web/beego"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/orgs/service"
  8 +)
  9 +
  10 +type OrgsController struct {
  11 + beego.BaseController
  12 +}
  13 +
  14 +func (controller *OrgsController) OrgAdd() {
  15 + orgsService := service.NewOrgsService(nil)
  16 + orgAddCommand := &command.OrgAddCommand{}
  17 + controller.Unmarshal(orgAddCommand)
  18 + data, err := orgsService.OrgAdd(orgAddCommand)
  19 + controller.Response(data, err)
  20 +}
  21 +
  22 +func (controller *OrgsController) OrgUpdate() {
  23 + orgsService := service.NewOrgsService(nil)
  24 + orgUpdateCommand := &command.OrgUpdateCommand{}
  25 + controller.Unmarshal(orgUpdateCommand)
  26 + orgId := controller.GetString(":orgId")
  27 + orgUpdateCommand.OrgId = orgId
  28 + data, err := orgsService.OrgUpdate(orgUpdateCommand)
  29 + controller.Response(data, err)
  30 +}
  31 +
  32 +func (controller *OrgsController) OrgList() {
  33 + orgsService := service.NewOrgsService(nil)
  34 + orgListQuery := &query.OrgListQuery{}
  35 + data, err := orgsService.OrgList(orgListQuery)
  36 + controller.Response(data, err)
  37 +}
  38 +
  39 +func (controller *OrgsController) OrgGet() {
  40 + orgsService := service.NewOrgsService(nil)
  41 + orgGetQuery := &query.OrgGetQuery{}
  42 + orgId := controller.GetString(":orgId")
  43 + orgGetQuery.OrgId = orgId
  44 + data, err := orgsService.OrgGet(orgGetQuery)
  45 + controller.Response(data, err)
  46 +}
  1 +package web_client
  2 +
  3 +import (
  4 + "github.com/linmadan/egglib-go/web/beego"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/roles/service"
  8 +)
  9 +
  10 +type RolesController struct {
  11 + beego.BaseController
  12 +}
  13 +
  14 +func (controller *RolesController) returnPageListData(count int64, data interface{}, err error, pageNumber int) {
  15 + dataMap := map[string]interface{}{
  16 + "totalRow": count,
  17 + "pageNumber": pageNumber,
  18 + "list": data,
  19 + }
  20 + controller.Response(dataMap, err)
  21 +}
  22 +func (controller *RolesController) RoleAdd() {
  23 + rolesService := service.NewRolesService(nil)
  24 + roleAddCommand := &command.RoleAddCommand{}
  25 + controller.Unmarshal(roleAddCommand)
  26 + data, err := rolesService.RoleAdd(roleAddCommand)
  27 + controller.Response(data, err)
  28 +}
  29 +
  30 +func (controller *RolesController) RoleUpdate() {
  31 + rolesService := service.NewRolesService(nil)
  32 + roleUpdateCommand := &command.RoleUpdateCommand{}
  33 + controller.Unmarshal(roleUpdateCommand)
  34 + roleId := controller.GetString(":roleId")
  35 + roleUpdateCommand.RoleId = roleId
  36 + data, err := rolesService.RoleEdit(roleUpdateCommand)
  37 + controller.Response(data, err)
  38 +}
  39 +
  40 +func (controller *RolesController) RoleList() {
  41 + rolesService := service.NewRolesService(nil)
  42 + roleListQuery := &query.RoleListQuery{}
  43 + controller.Unmarshal(roleListQuery)
  44 + cnt, data, err := rolesService.RoleList(roleListQuery)
  45 + controller.returnPageListData(cnt, data, err, roleListQuery.PageNumber)
  46 +}
  47 +
  48 +func (controller *RolesController) RoleGet() {
  49 + rolesService := service.NewRolesService(nil)
  50 + roleGetQuery := &query.RoleGetQuery{}
  51 + roleId := controller.GetString(":roleId")
  52 + roleGetQuery.RoleId = roleId
  53 + data, err := rolesService.RoleGet(roleGetQuery)
  54 + controller.Response(data, err)
  55 +}
  56 +
  57 +func (controller *RolesController) RoleUserInfo() {
  58 + rolesService := service.NewRolesService(nil)
  59 + roleUserInfoQuery := &query.RoleUserInfoQuery{}
  60 + roleId, _ := controller.GetInt64(":roleId")
  61 + roleUserInfoQuery.RoleId = roleId
  62 + data, err := rolesService.RoleUserInfo(roleUserInfoQuery)
  63 + controller.Response(data, err)
  64 +}
  65 +
  66 +func (controller *RolesController) RoleUserAdd() {
  67 + rolesService := service.NewRolesService(nil)
  68 + roleUserAddQuery := &command.RoleUserAddCommand{}
  69 + controller.Unmarshal(roleUserAddQuery)
  70 + data, err := rolesService.RoleUserAdd(roleUserAddQuery)
  71 + controller.Response(data, err)
  72 +}
  73 +
  74 +func (controller *RolesController) RoleUserDelete() {
  75 + rolesService := service.NewRolesService(nil)
  76 + roleUserDeleteQuery := &command.RoleUserDeleteCommand{}
  77 + controller.Unmarshal(roleUserDeleteQuery)
  78 + data, err := rolesService.RoleUserDelete(roleUserDeleteQuery)
  79 + controller.Response(data, err)
  80 +}
  81 +
  82 +func (controller *RolesController) RoleUserBeforeEdit() {
  83 + rolesService := service.NewRolesService(nil)
  84 + roleUserBeforeEditQuery := &query.RoleUserBeforeEditQuery{}
  85 + data, err := rolesService.RoleUserBeforeEdit(roleUserBeforeEditQuery)
  86 + controller.Response(data, err)
  87 +}
  88 +
  89 +func (controller *RolesController) RoleMenuBeforeEdit() {
  90 + rolesService := service.NewRolesService(nil)
  91 + roleMenuBeforeEditQuery := &query.RoleMenuBeforeEditQuery{}
  92 + data, err := rolesService.RoleMenuBeforeEdit(roleMenuBeforeEditQuery)
  93 + controller.Response(data, err)
  94 +}
  95 +
  96 +func (controller *RolesController) RoleMenuEdit() {
  97 + rolesService := service.NewRolesService(nil)
  98 + roleMenuEditQuery := &command.RoleMenuEditCommand{}
  99 + controller.Unmarshal(roleMenuEditQuery)
  100 + roleId := controller.GetString(":roleId")
  101 + roleMenuEditQuery.RoleId = roleId
  102 + data, err := rolesService.RoleMenuEdit(roleMenuEditQuery)
  103 + controller.Response(data, err)
  104 +}
@@ -2,9 +2,9 @@ package web_client @@ -2,9 +2,9 @@ package web_client
2 2
3 import ( 3 import (
4 "github.com/linmadan/egglib-go/web/beego" 4 "github.com/linmadan/egglib-go/web/beego"
5 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/command"  
6 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/query"  
7 - "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/users/service" 5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/command"
  6 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
  7 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/service"
8 ) 8 )
9 9
10 type UsersController struct { 10 type UsersController struct {
@@ -47,7 +47,7 @@ func (controller *UsersController) CompanyUserList() { @@ -47,7 +47,7 @@ func (controller *UsersController) CompanyUserList() {
47 func (controller *UsersController) CompanyUserGet() { 47 func (controller *UsersController) CompanyUserGet() {
48 usersService := service.NewUsersService(nil) 48 usersService := service.NewUsersService(nil)
49 companyUserGetQuery := &query.CompanyUserGetQuery{} 49 companyUserGetQuery := &query.CompanyUserGetQuery{}
50 - userId, _ := controller.GetInt64(":userId") 50 + userId := controller.GetString(":userId")
51 companyUserGetQuery.UsersId = userId 51 companyUserGetQuery.UsersId = userId
52 data, err := usersService.CompanyUserGet(companyUserGetQuery) 52 data, err := usersService.CompanyUserGet(companyUserGetQuery)
53 controller.Response(data, err) 53 controller.Response(data, err)
@@ -96,7 +96,7 @@ func (controller *UsersController) CooperationUserList() { @@ -96,7 +96,7 @@ func (controller *UsersController) CooperationUserList() {
96 func (controller *UsersController) CooperationUserGet() { 96 func (controller *UsersController) CooperationUserGet() {
97 usersService := service.NewUsersService(nil) 97 usersService := service.NewUsersService(nil)
98 cooperationUserGetQuery := &query.CooperationUserGetQuery{} 98 cooperationUserGetQuery := &query.CooperationUserGetQuery{}
99 - userId, _ := controller.GetInt64(":userId") 99 + userId := controller.GetString(":userId")
100 cooperationUserGetQuery.UsersId = userId 100 cooperationUserGetQuery.UsersId = userId
101 data, err := usersService.CooperationUserGet(cooperationUserGetQuery) 101 data, err := usersService.CooperationUserGet(cooperationUserGetQuery)
102 controller.Response(data, err) 102 controller.Response(data, err)
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/orgs/", &web_client.OrgsController{}, "Post:OrgAdd")
  10 + web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Put:OrgUpdate")
  11 + web.Router("/v1/web/orgs/search", &web_client.OrgsController{}, "Post:OrgList")
  12 + web.Router("/v1/web/orgs/:orgId", &web_client.OrgsController{}, "Get:OrgGet")
  13 +}
  1 +package routers
  2 +
  3 +import (
  4 + "github.com/beego/beego/v2/server/web"
  5 + "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/port/beego/controllers/web_client"
  6 +)
  7 +
  8 +func init() {
  9 + web.Router("/v1/web/roles/", &web_client.RolesController{}, "Post:RoleAdd")
  10 + web.Router("/v1/web/roles/:roleId", &web_client.RolesController{}, "Put:RoleUpdate")
  11 + web.Router("/v1/web/roles/search", &web_client.RolesController{}, "Post:RoleList")
  12 + web.Router("/v1/web/roles/:roleId", &web_client.RolesController{}, "Get:RoleGet")
  13 + web.Router("/v1/web/roles/role-user/:roleId", &web_client.RolesController{}, "Get:RoleUserInfo")
  14 + web.Router("/v1/web/roles/role-user", &web_client.RolesController{}, "Post:RoleUserAdd")
  15 + web.Router("/v1/web/roles/role-user", &web_client.RolesController{}, "Delete:RoleUserDelete")
  16 + web.Router("/v1/web/roles/role-user/before-edit", &web_client.RolesController{}, "Get:RoleUserBeforeEdit")
  17 + web.Router("/v1/web/roles/role-menu/before-edit", &web_client.RolesController{}, "Get:RoleMenuBeforeEdit")
  18 + web.Router("/v1/web/roles/role-menu/:roleId", &web_client.RolesController{}, "Put:RoleMenuEdit")
  19 +}