作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway into dev

# Conflicts:
#	lastupdate.tmp
#	pkg/infrastructure/service_gateway/allied_creation_user/param_menu.go
正在显示 35 个修改的文件 包含 855 行增加166 行删除
{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627893638439130600}
\ No newline at end of file
{"F:\\go\\src\\allied-creation\\allied-creation-gateway\\pkg\\port\\beego\\routers":1627893928632951500}
\ No newline at end of file
... ...
... ... @@ -14,9 +14,7 @@ type MenuService struct {
// 创建菜单服务
func (menuService *MenuService) CreateMenu(createMenuCommand *command.CreateMenuCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
createMenuCommand.Operator.CompanyId,
createMenuCommand.Operator.OrgId,
createMenuCommand.Operator.UserId)
createMenuCommand.Operator)
result, err := creationUserGateway.MenusCreate(allied_creation_user.ReqMenus{
ParentId: createMenuCommand.ParentId,
MenuName: createMenuCommand.MenuName,
... ... @@ -37,9 +35,7 @@ func (menuService *MenuService) CreateMenu(createMenuCommand *command.CreateMenu
// 返回菜单服务
func (menuService *MenuService) GetMenu(getMenuQuery *query.GetMenuQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
getMenuQuery.Operator.CompanyId,
getMenuQuery.Operator.OrgId,
getMenuQuery.Operator.UserId)
getMenuQuery.Operator)
result, err := creationUserGateway.MenusGet(allied_creation_user.ReqMenusGet{
MenuId: getMenuQuery.MenuId,
})
... ... @@ -52,9 +48,7 @@ func (menuService *MenuService) GetMenu(getMenuQuery *query.GetMenuQuery) (inter
// 返回菜单服务列表
func (menuService *MenuService) ListMenu(listMenuQuery *query.ListMenuQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
listMenuQuery.Operator.CompanyId,
listMenuQuery.Operator.OrgId,
listMenuQuery.Operator.UserId)
listMenuQuery.Operator)
result, err := creationUserGateway.MenusSearch(allied_creation_user.ReqMenusSearch{
MenuCategory: listMenuQuery.MenuCategory,
ParentId: listMenuQuery.ParentId,
... ... @@ -75,9 +69,7 @@ func (menuService *MenuService) RemoveMenu(removeMenuCommand *command.RemoveMenu
// 更新菜单服务
func (menuService *MenuService) UpdateMenu(updateMenuCommand *command.UpdateMenuCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
updateMenuCommand.Operator.CompanyId,
updateMenuCommand.Operator.OrgId,
updateMenuCommand.Operator.UserId)
updateMenuCommand.Operator)
result, err := creationUserGateway.MenusUpdate(allied_creation_user.ReqMenusUpdate{
MenuId: updateMenuCommand.MenuId,
ParentId: updateMenuCommand.ParentId,
... ... @@ -99,9 +91,7 @@ func (menuService *MenuService) UpdateMenu(updateMenuCommand *command.UpdateMenu
// 批量删除菜单
func (menuService *MenuService) BatchDeleteMenu(batchDeleteMenu *command.BatchDeleteMenuCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
batchDeleteMenu.Operator.CompanyId,
batchDeleteMenu.Operator.OrgId,
batchDeleteMenu.Operator.UserId)
batchDeleteMenu.Operator)
result, err := creationUserGateway.MenusBatchDelete(allied_creation_user.ReqMenusBatchDelete{
MenuIds: batchDeleteMenu.MenuIds,
})
... ... @@ -114,9 +104,7 @@ func (menuService *MenuService) BatchDeleteMenu(batchDeleteMenu *command.BatchDe
// 批量启用菜单
func (menuService *MenuService) BatchEnableMenu(batchEnableMenu *command.BatchEnableMenuCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
batchEnableMenu.Operator.CompanyId,
batchEnableMenu.Operator.OrgId,
batchEnableMenu.Operator.UserId)
batchEnableMenu.Operator)
result, err := creationUserGateway.MenusBatchEnable(allied_creation_user.ReqMenusBatchEnable{
MenuIds: batchEnableMenu.MenuIds,
Status: batchEnableMenu.Status,
... ...
... ... @@ -4,6 +4,7 @@ import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/common/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
... ... @@ -17,7 +18,7 @@ func NewCommonService(options map[string]interface{}) *CommonService {
//GetDictionaryByCode 根据code获取字典数据
func (srv *CommonService) GetDictionaryByCode(getDictionaryQuery *query.GetDictionaryByCodeQuery) (interface{}, error) {
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic()
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(domain.Operator{})
result, err := creationBasicGateway.GetDictionarysByCode(allied_creation_basic.ReqGetDictionaryByCode{
DictCode: getDictionaryQuery.DictCode,
})
... ... @@ -33,7 +34,7 @@ func (srv *CommonService) CompanySignUp(signUpCommand *command.CompanySignUpComm
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
//校验验证码
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err := creationUserGateway.AuthCompanySignUp(allied_creation_user.ReqAuthCompanySignUp{
CompanyName: signUpCommand.CompanyName,
Contacts: signUpCommand.Contacts,
... ...
... ... @@ -10,6 +10,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/cache"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
)
// 组织管理
... ... @@ -26,6 +27,7 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{
case "signInPassword":
result, err = srv.SignInPassword(loginCommand.Phone, loginCommand.Password)
case "signInCaptcha":
result, err = srv.SignInCaptcha(loginCommand.Phone, loginCommand.Captcha)
default:
err = errors.New("登录方式无法解析")
}
... ... @@ -34,7 +36,7 @@ func (srv AuthService) AuthLogin(loginCommand *command.LoginCommand) (interface{
//SignInPassword 使用账号密码校验
func (srv AuthService) SignInPassword(account string, password string) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
_, err := creationUserGateway.AuthCheckPassword(allied_creation_user.ReqAuthCheckPassword{
Password: password,
Phone: account,
... ... @@ -60,7 +62,25 @@ func (srv AuthService) SignInPassword(account string, password string) (interfac
//SignInCaptcha 使用手机验证码登录
func (srv AuthService) SignInCaptcha(phone string, captcha string) (interface{}, error) {
return nil, nil
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
err := smsServeGateway.CheckSmsCode(phone, captcha)
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
ltoken := domain.LoginToken{
UserId: 0,
Account: phone,
Platform: domain.LoginPlatformApp,
CompanyId: 0,
}
authcode, err := ltoken.GenerateAuthCode()
if err != nil {
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
result := map[string]string{
"authCode": authcode,
}
return result, nil
}
//GetAuthAccessToken 获取令牌Token
... ... @@ -74,7 +94,7 @@ func (srv AuthService) GetAuthAccessToken(accessTokenCommand *command.AccessToke
return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
phone := ltoken.Account
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
userSeachResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Phone: phone,
})
... ... @@ -153,7 +173,7 @@ loopUser1:
}
}
}
//TODO
loginToken := domain.LoginToken{
UserId: currentAccess.UserId,
Account: currentAccess.Account,
... ... @@ -206,7 +226,7 @@ func (srv AuthService) RefreshAuthAccessToken(refreshTokenCommand *command.Refre
return nil, application.ThrowError(application.TRANSACTION_ERROR, "refreshToken 不可用,"+err.Error())
}
phone := ltoken.Account
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
userSeachResult, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Phone: phone,
})
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
)
type SendSmsCodeCommand struct {
Phone string `json:"phone" valid:"Required"`
}
func (orgAddCommand *SendSmsCodeCommand) Valid(validation *validation.Validation) {
}
func (orgAddCommand *SendSmsCodeCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(orgAddCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package service
import (
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/sms_serve"
)
type UserService struct {
}
//SendSmsCaptcha 发送验证码短信
func (srv UserService) SendSmsCaptcha(smsCodeCommand *command.SendSmsCodeCommand) error {
smsServeGateway := sms_serve.NewHttplibHttplibSmsServe()
err := smsServeGateway.SendSms(smsCodeCommand.Phone)
if err != nil {
return application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return nil
}
... ...
... ... @@ -7,6 +7,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
//更新自定义菜单
type MenuUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
... ...
... ... @@ -7,6 +7,7 @@ import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
//获取自定义菜单列表
type MenuListQuery struct {
//操作人
Operator domain.Operator `json:"-"`
... ...
... ... @@ -14,9 +14,8 @@ type MenuService struct {
// 设置收藏菜单
func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFavoriteCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuFavoriteCommand.Operator.CompanyId,
menuFavoriteCommand.Operator.OrgId,
menuFavoriteCommand.Operator.UserId)
menuFavoriteCommand.Operator,
)
result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
CompanyId: menuFavoriteCommand.Operator.CompanyId,
})
... ... @@ -29,9 +28,8 @@ func (menuService *MenuService) MenuFavorite(menuFavoriteCommand *command.MenuFa
// 返回菜单列表
func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuListQuery.Operator.CompanyId,
menuListQuery.Operator.OrgId,
menuListQuery.Operator.UserId)
menuListQuery.Operator,
)
result, err := creationUserGateway.CompanyGetCustomizeMenus(allied_creation_user.ReqCompanyGetCustomizeMenus{
CompanyId: menuListQuery.Operator.CompanyId,
MenuCategory: menuListQuery.MenuCategory,
... ... @@ -44,12 +42,11 @@ func (menuService *MenuService) MenuList(menuListQuery *query.MenuListQuery) (in
}, nil
}
// 更新菜单
// 更新自定义菜单
func (menuService *MenuService) MenuUpdate(menuUpdateCommand *command.MenuUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
menuUpdateCommand.Operator.CompanyId,
menuUpdateCommand.Operator.OrgId,
menuUpdateCommand.Operator.UserId)
menuUpdateCommand.Operator,
)
_, err := creationUserGateway.CompanySetCustomizeMenus(allied_creation_user.ReqCompanySetCustomizeMenus{
CompanyId: menuUpdateCommand.Operator.CompanyId,
MenuAlias: menuUpdateCommand.MenuAlias,
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type NoticeSettingAddCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// 消息对应的业务模块
Module string `json:"module" valid:"Required"`
// 业务环节
ModuleAction string `json:"moduleAction" valid:"Required"`
// 是否推送 【是:1】【否:2】
IsPush int `json:"isPush" valid:"Required"`
// 内容模板
Content string `json:"content" valid:"Required"`
}
func (noticeSettingUpdateQuery *NoticeSettingAddCommand) Valid(validation *validation.Validation) {
}
func (noticeSettingUpdateQuery *NoticeSettingAddCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(noticeSettingUpdateQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package command
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type NoticeSettingUpdateCommand struct {
//操作人
Operator domain.Operator `json:"-"`
// id
NoticeSettingId string `json:"noticeSetting"`
// 消息对应的业务模块
Module string `json:"module" valid:"Required"`
// 业务环节
ModuleAction string `json:"moduleAction" valid:"Required"`
// 是否推送 【是:1】【否:2】
IsPush int `json:"isPush" valid:"Required"`
// 内容模板
Content string `json:"content" valid:"Required"`
}
func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) Valid(validation *validation.Validation) {
}
func (noticeSettingUpdateQuery *NoticeSettingUpdateCommand) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(noticeSettingUpdateQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type NoticeSettingListQuery struct {
//操作人
Operator domain.Operator `json:"-"`
// 查询偏离量
PageNumber int `json:"pageNumber" valid:"Required"`
// 查询限制
PageSize int `json:"pageSize" valid:"Required"`
}
func (noticeSettingListCommand *NoticeSettingListQuery) Valid(validation *validation.Validation) {
}
func (noticeSettingListCommand *NoticeSettingListQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(noticeSettingListCommand)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package query
import (
"fmt"
"github.com/beego/beego/v2/core/validation"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
)
type NoticeSettingProfileQuery struct {
//操作人
Operator domain.Operator `json:"-"`
}
func (noticeSettingProfileQuery *NoticeSettingProfileQuery) Valid(validation *validation.Validation) {
}
func (noticeSettingProfileQuery *NoticeSettingProfileQuery) ValidateQuery() error {
valid := validation.Validation{}
b, err := valid.Valid(noticeSettingProfileQuery)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
... ...
package service
import (
"strconv"
"github.com/linmadan/egglib-go/core/application"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_basic"
)
// 推送消息配置
type NoticeSettingService struct {
}
//NoticeSettingList 推送消息配置列表
func (noticeSettingService *NoticeSettingService) NoticeSettingList(noticeSettingListQuery *query.NoticeSettingListQuery) (int64, interface{}, error) {
if err := noticeSettingListQuery.ValidateQuery(); err != nil {
return 0, nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingListQuery.Operator,
)
result, err := creationBasicGateway.NoticeSettingSearch(allied_creation_basic.ReqNoticeSettingSearch{
PageIndex: noticeSettingListQuery.PageNumber,
PageSize: noticeSettingListQuery.PageSize,
CompanyId: noticeSettingListQuery.Operator.CompanyId,
})
if err != nil {
return 0, nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return result.Count, result.NoticeSettings, nil
}
//NoticeSettingProfile 推送消息配置需求的参数候选项
func (noticeSettingService *NoticeSettingService) NoticeSettingProfile(noticeSettingProfileQuery *query.NoticeSettingProfileQuery) (interface{}, error) {
if err := noticeSettingProfileQuery.ValidateQuery(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
//TODO
return nil, nil
}
// NoticeSettingUpdate 更新配置
func (noticeSettingService *NoticeSettingService) NoticeSettingUpdate(noticeSettingUpdateCommand *command.NoticeSettingUpdateCommand) (interface{}, error) {
if err := noticeSettingUpdateCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingUpdateCommand.Operator,
)
noticeSettingID, _ := strconv.Atoi(noticeSettingUpdateCommand.NoticeSettingId)
_, err := creationBasicGateway.NoticeSettingUpdate(allied_creation_basic.ReqNoticeSettingUpdate{
NoticeSettingID: noticeSettingID,
CompanyID: int(noticeSettingUpdateCommand.Operator.CompanyId),
Content: noticeSettingUpdateCommand.Content,
IsPush: noticeSettingUpdateCommand.IsPush,
Module: noticeSettingUpdateCommand.Module,
ModuleAction: noticeSettingUpdateCommand.ModuleAction,
OrganizationID: int(noticeSettingUpdateCommand.Operator.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
return noticeSettingUpdateCommand, nil
}
// NoticeSettingUpdate 添加配置
func (noticeSettingService *NoticeSettingService) NoticeSettingAdd(noticeSettingAddCommand *command.NoticeSettingAddCommand) (interface{}, error) {
if err := noticeSettingAddCommand.ValidateCommand(); err != nil {
return nil, application.ThrowError(application.ARG_ERROR, err.Error())
}
creationBasicGateway := allied_creation_basic.NewHttplibAlliedCreationBasic(
noticeSettingAddCommand.Operator,
)
result, err := creationBasicGateway.NoticeSettingAdd(allied_creation_basic.ReqNoticeSettingAdd{
CompanyID: int(noticeSettingAddCommand.Operator.CompanyId),
Content: noticeSettingAddCommand.Content,
IsPush: noticeSettingAddCommand.IsPush,
Module: noticeSettingAddCommand.Module,
ModuleAction: noticeSettingAddCommand.ModuleAction,
OrganizationID: int(noticeSettingAddCommand.Operator.OrgId),
})
if err != nil {
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
}
data := struct {
NoticeSettingId int `json:"noticeSettingId"`
command.NoticeSettingAddCommand
}{
NoticeSettingId: result.NoticeSettingID,
NoticeSettingAddCommand: *noticeSettingAddCommand,
}
return data, nil
}
func NewNoticeSettingService(options map[string]interface{}) *NoticeSettingService {
newNoticeSettingService := &NoticeSettingService{}
return newNoticeSettingService
}
... ...
... ... @@ -17,9 +17,7 @@ type OrgsService struct {
// 创建组织管理
func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
orgAddCommand.Operator.CompanyId,
orgAddCommand.Operator.OrgId,
orgAddCommand.Operator.UserId)
orgAddCommand.Operator)
parentId, _ := strconv.Atoi(orgAddCommand.ParentId)
result, err := creationUserGateway.OrgCreate(allied_creation_user.ReqOrgCreate{
CompanyId: int(orgAddCommand.Operator.CompanyId),
... ... @@ -44,9 +42,7 @@ func (orgsService *OrgsService) OrgAdd(orgAddCommand *command.OrgAddCommand) (in
// 禁用、启用组织管理
func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
orgEnableCommand.Operator.CompanyId,
orgEnableCommand.Operator.OrgId,
orgEnableCommand.Operator.UserId)
orgEnableCommand.Operator)
orgId, _ := strconv.Atoi(orgEnableCommand.OrgId)
_, err := creationUserGateway.OrgEnable(allied_creation_user.ReqOrgEnable{
OrgId: orgId,
... ... @@ -61,9 +57,7 @@ func (orgsService *OrgsService) OrgEnable(orgEnableCommand *command.OrgEnableCom
// 返回组织管理
func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
orgGetQuery.Operator.CompanyId,
orgGetQuery.Operator.OrgId,
orgGetQuery.Operator.UserId)
orgGetQuery.Operator)
orgId, _ := strconv.Atoi(orgGetQuery.OrgId)
result, err := creationUserGateway.OrgGet(allied_creation_user.ReqOrgGet{
OrgId: orgId,
... ... @@ -85,9 +79,7 @@ func (orgsService *OrgsService) OrgGet(orgGetQuery *query.OrgGetQuery) (interfac
// 返回组织管理列表
func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
orgListQuery.Operator.CompanyId,
orgListQuery.Operator.OrgId,
orgListQuery.Operator.UserId)
orgListQuery.Operator)
parentOrgId, _ := strconv.Atoi(orgListQuery.ParentId)
result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
CompanyId: int(orgListQuery.Operator.CompanyId),
... ... @@ -123,9 +115,7 @@ func (orgsService *OrgsService) OrgList(orgListQuery *query.OrgListQuery) (inter
// 更新组织管理
func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
orgUpdateCommand.Operator.CompanyId,
orgUpdateCommand.Operator.OrgId,
orgUpdateCommand.Operator.UserId)
orgUpdateCommand.Operator)
parentId, _ := strconv.Atoi(orgUpdateCommand.ParentId)
orgId, _ := strconv.Atoi(orgUpdateCommand.OrgId)
_, err := creationUserGateway.OrgUpdate(allied_creation_user.ReqOrgUpdate{
... ... @@ -144,9 +134,7 @@ func (orgsService *OrgsService) OrgUpdate(orgUpdateCommand *command.OrgUpdateCom
// 返回组织管理
func (orgsService *OrgsService) OrgGetSubDepartment(orgGetQuery *query.OrgGetSubDepartmentQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
orgGetQuery.Operator.CompanyId,
orgGetQuery.Operator.OrgId,
orgGetQuery.Operator.UserId)
orgGetQuery.Operator)
orgId, _ := strconv.Atoi(orgGetQuery.OrgId)
result, err := creationUserGateway.OrgGetSubDepartment(allied_creation_user.ReqOrgGetSubDepartment{
OrgId: int64(orgId),
... ...
... ... @@ -17,9 +17,7 @@ type RolesService struct {
// 创建role
func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleAddCommand.Operator.CompanyId,
roleAddCommand.Operator.OrgId,
roleAddCommand.Operator.UserId)
roleAddCommand.Operator)
result, err := creationUserGateway.RoleCreate(allied_creation_user.ReqRoleCreate{
RoleName: roleAddCommand.RoleName,
Desc: roleAddCommand.Desc,
... ... @@ -40,9 +38,7 @@ func (rolesService *RolesService) RoleAdd(roleAddCommand *command.RoleAddCommand
// 编辑role
func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleUpdateCommand.Operator.CompanyId,
roleUpdateCommand.Operator.OrgId,
roleUpdateCommand.Operator.UserId)
roleUpdateCommand.Operator)
roleId, _ := strconv.Atoi(roleUpdateCommand.RoleId)
_, err := creationUserGateway.RoleUpdate(allied_creation_user.ReqRoleUpdate{
RoleId: int64(roleId),
... ... @@ -58,9 +54,7 @@ func (rolesService *RolesService) RoleEdit(roleUpdateCommand *command.RoleUpdate
// 返单个角色
func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleGetQuery.Operator.CompanyId,
roleGetQuery.Operator.OrgId,
roleGetQuery.Operator.UserId)
roleGetQuery.Operator)
roleId, _ := strconv.Atoi(roleGetQuery.RoleId)
roleData, err := creationUserGateway.RoleGet(allied_creation_user.ReqRoleGet{
RoleId: int64(roleId),
... ... @@ -91,9 +85,7 @@ func (rolesService *RolesService) RoleGet(roleGetQuery *query.RoleGetQuery) (int
// 返回role列表
func (rolesService *RolesService) RoleList(roleListQuery *query.RoleListQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleListQuery.Operator.CompanyId,
roleListQuery.Operator.OrgId,
roleListQuery.Operator.UserId)
roleListQuery.Operator)
roleList, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
Offset: (roleListQuery.PageNumber - 1) * roleListQuery.PageSize,
Limit: roleListQuery.PageSize,
... ... @@ -122,9 +114,7 @@ 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)
roleMenuBeforeEditQuery.Operator)
roleId, _ := strconv.Atoi(roleMenuBeforeEditQuery.RoleId)
roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
OrgId: roleMenuBeforeEditQuery.Operator.OrgId,
... ... @@ -151,9 +141,7 @@ func (rolesService *RolesService) RoleMenuBeforeEdit(roleMenuBeforeEditQuery *qu
// 编辑角色关联用户的前置准备数据
func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *query.RoleUserBeforeEditQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleUserBeforeEditQuery.Operator.CompanyId,
roleUserBeforeEditQuery.Operator.OrgId,
roleUserBeforeEditQuery.Operator.UserId)
roleUserBeforeEditQuery.Operator)
roleId, _ := strconv.Atoi(roleUserBeforeEditQuery.RoleId)
roles, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
OrgId: roleUserBeforeEditQuery.Operator.OrgId,
... ... @@ -192,9 +180,7 @@ func (rolesService *RolesService) RoleUserBeforeEdit(roleUserBeforeEditQuery *qu
// 角色编辑关联菜单权限
func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.RoleMenuEditCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleMenuEditCommand.Operator.CompanyId,
roleMenuEditCommand.Operator.OrgId,
roleMenuEditCommand.Operator.UserId)
roleMenuEditCommand.Operator)
roleId, _ := strconv.Atoi(roleMenuEditCommand.RoleId)
var menuIds []int64
for _, v := range roleMenuEditCommand.MenuId {
... ... @@ -216,9 +202,7 @@ func (rolesService *RolesService) RoleMenuEdit(roleMenuEditCommand *command.Role
// 移除role
func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemoveCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleRemoveCommand.Operator.CompanyId,
roleRemoveCommand.Operator.OrgId,
roleRemoveCommand.Operator.UserId)
roleRemoveCommand.Operator)
var roleIds []int64
for _, v := range roleRemoveCommand.RoleIds {
... ... @@ -239,9 +223,7 @@ func (rolesService *RolesService) RoleRemove(roleRemoveCommand *command.RoleRemo
// 角色添加关联用户
func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUserAddCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleUserAddCommand.Operator.CompanyId,
roleUserAddCommand.Operator.OrgId,
roleUserAddCommand.Operator.UserId)
roleUserAddCommand.Operator)
roleId, _ := strconv.Atoi(roleUserAddCommand.RoleId)
var userIds []int64
for _, v := range roleUserAddCommand.UserId {
... ... @@ -263,9 +245,7 @@ func (rolesService *RolesService) RoleUserAdd(roleUserAddCommand *command.RoleUs
// 角色添加关联用户
func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.RoleUserDeleteCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleUserDeleteCommand.Operator.CompanyId,
roleUserDeleteCommand.Operator.OrgId,
roleUserDeleteCommand.Operator.UserId)
roleUserDeleteCommand.Operator)
roleId, _ := strconv.Atoi(roleUserDeleteCommand.RoleId)
var userIds []int64
for _, v := range roleUserDeleteCommand.UserId {
... ... @@ -287,9 +267,7 @@ func (rolesService *RolesService) RoleUserDelete(roleUserDeleteCommand *command.
// 角色下关联用户的数据 (暂时不需要这个)
func (rolesService *RolesService) RoleUserInfo(roleUserInfoQuery *query.RoleUserInfoQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
roleUserInfoQuery.Operator.CompanyId,
roleUserInfoQuery.Operator.OrgId,
roleUserInfoQuery.Operator.UserId)
roleUserInfoQuery.Operator)
relatedUser, err := creationUserGateway.RoleGetRelatedUser(allied_creation_user.ReqRoleGetRelatedUser{
RoleId: roleUserInfoQuery.RoleId,
})
... ...
... ... @@ -8,6 +8,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/dto"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/users/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)
... ... @@ -24,9 +25,7 @@ func NewUsersService(options map[string]interface{}) *UsersService {
// 获取公司用户信息
func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.CompanyUserGetQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
companyUserGetQuery.Operator.CompanyId,
companyUserGetQuery.Operator.OrgId,
companyUserGetQuery.Operator.UserId)
companyUserGetQuery.Operator)
userid, _ := strconv.Atoi(companyUserGetQuery.UsersId)
resultUser, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
UserId: userid,
... ... @@ -98,9 +97,7 @@ func (usersService *UsersService) CompanyUserGet(companyUserGetQuery *query.Comp
// 创建公司用户信息
func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.CompanyUserAddCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
companyUserAddCommand.Operator.CompanyId,
companyUserAddCommand.Operator.OrgId,
companyUserAddCommand.Operator.UserId)
companyUserAddCommand.Operator)
departmentId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
orgId, _ := strconv.Atoi(companyUserAddCommand.OrgId)
userOrg := []int64{}
... ... @@ -148,9 +145,7 @@ func (usersService *UsersService) CompanyUserAdd(companyUserAddCommand *command.
// 启用禁用公司用户信息
func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *command.CompanyUserEnableCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
companyUserEnableCommand.Operator.CompanyId,
companyUserEnableCommand.Operator.OrgId,
companyUserEnableCommand.Operator.UserId)
companyUserEnableCommand.Operator)
var userIds []int64
for i := range companyUserEnableCommand.UsersIds {
... ... @@ -169,7 +164,7 @@ func (usersService *UsersService) CompanyUserEnable(companyUserEnableCommand *co
// 返回公司用户信息列表
func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.CompanyUserListQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Offset: (companyUserListQuery.PageNumber - 1) * companyUserListQuery.PageSize,
Limit: companyUserListQuery.PageSize,
... ... @@ -208,9 +203,7 @@ func (usersService *UsersService) CompanyUserList(companyUserListQuery *query.Co
// 批量重置密码
func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPasswordCommand *command.CompanyUserResetPasswordCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
companyUserResetPasswordCommand.Operator.CompanyId,
companyUserResetPasswordCommand.Operator.OrgId,
companyUserResetPasswordCommand.Operator.UserId)
companyUserResetPasswordCommand.Operator)
var userIds []int64
for i := range companyUserResetPasswordCommand.UserIds {
id, _ := strconv.Atoi(companyUserResetPasswordCommand.UserIds[i])
... ... @@ -229,9 +222,7 @@ func (usersService *UsersService) CompanyUserResetPassword(companyUserResetPassw
// 更新公司用户信息
func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *command.CompanyUserUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
companyUserUpdateCommand.Operator.CompanyId,
companyUserUpdateCommand.Operator.OrgId,
companyUserUpdateCommand.Operator.UserId)
companyUserUpdateCommand.Operator)
departmentId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId)
orgId, _ := strconv.Atoi(companyUserUpdateCommand.OrganizationId)
userOrg := []int64{}
... ... @@ -272,9 +263,7 @@ func (usersService *UsersService) CompanyUserUpdate(companyUserUpdateCommand *co
// 创建共创用户信息
func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *command.CooperationUserAddCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserAddCommand.Operator.CompanyId,
cooperationUserAddCommand.Operator.OrgId,
cooperationUserAddCommand.Operator.UserId)
cooperationUserAddCommand.Operator)
result, err := creationUserGateway.CooperatorUserCreate(allied_creation_user.ReqCreateCooperatorUser{
CompanyId: cooperationUserAddCommand.Operator.CompanyId,
CooperationCompany: cooperationUserAddCommand.CooperationCompany,
... ... @@ -304,9 +293,7 @@ func (usersService *UsersService) CooperationUserAdd(cooperationUserAddCommand *
// 启用禁用共创用户信息
func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCommand *command.CooperationUserEnableCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserEnableCommand.Operator.CompanyId,
cooperationUserEnableCommand.Operator.OrgId,
cooperationUserEnableCommand.Operator.UserId)
cooperationUserEnableCommand.Operator)
var userIds []int64
for i := range cooperationUserEnableCommand.UsersIds {
id, _ := strconv.Atoi(cooperationUserEnableCommand.UsersIds[i])
... ... @@ -325,9 +312,7 @@ func (usersService *UsersService) CooperationUserEnable(cooperationUserEnableCom
// 获取共创用户信息
func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *query.CooperationUserGetQuery) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserGetQuery.Operator.CompanyId,
cooperationUserGetQuery.Operator.OrgId,
cooperationUserGetQuery.Operator.UserId)
cooperationUserGetQuery.Operator)
userId, _ := strconv.Atoi(cooperationUserGetQuery.UserId)
result, err := creationUserGateway.UserGet(allied_creation_user.ReqGateUser{
UserId: userId,
... ... @@ -352,7 +337,7 @@ func (usersService *UsersService) CooperationUserGet(cooperationUserGetQuery *qu
// 返回共创用户信息列表
func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *query.CooperationUserListQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(0, 0, 0)
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(domain.Operator{})
result, err := creationUserGateway.UserSearch(allied_creation_user.ReqUserSearch{
Offset: (cooperationUserListQuery.PageNumber - 1) * cooperationUserListQuery.PageSize,
Limit: cooperationUserListQuery.PageSize,
... ... @@ -390,9 +375,7 @@ func (usersService *UsersService) CooperationUserList(cooperationUserListQuery *
// 批量重置密码
func (usersService *UsersService) CooperationUserResetPassword(cooperationUserResetPasswordCommand *command.CooperationUserResetPasswordCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserResetPasswordCommand.Operator.CompanyId,
cooperationUserResetPasswordCommand.Operator.OrgId,
cooperationUserResetPasswordCommand.Operator.UserId)
cooperationUserResetPasswordCommand.Operator)
var userIds []int64
for i := range cooperationUserResetPasswordCommand.UserIds {
id, _ := strconv.Atoi(cooperationUserResetPasswordCommand.UserIds[i])
... ... @@ -412,9 +395,7 @@ func (usersService *UsersService) CooperationUserResetPassword(cooperationUserRe
// 编辑共创用户信息
func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCommand *command.CooperationUserUpdateCommand) (interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
cooperationUserUpdateCommand.Operator.CompanyId,
cooperationUserUpdateCommand.Operator.OrgId,
cooperationUserUpdateCommand.Operator.UserId)
cooperationUserUpdateCommand.Operator)
_, err := creationUserGateway.CooperatorUserUpdate(allied_creation_user.ReqUpdateCooperatorUser{
UserId: cooperationUserUpdateCommand.UserId,
CooperationCompany: cooperationUserUpdateCommand.CooperationCompany,
... ... @@ -436,9 +417,7 @@ func (usersService *UsersService) CooperationUserUpdate(cooperationUserUpdateCom
//CompanyOrgSelector 获取公司组织的下拉列表
func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
selectorQuery.Operator.CompanyId,
selectorQuery.Operator.OrgId,
selectorQuery.Operator.UserId)
selectorQuery.Operator)
result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
CompanyId: int(selectorQuery.Operator.CompanyId),
DepName: selectorQuery.OrgName,
... ... @@ -470,9 +449,7 @@ func (usersService *UsersService) SelectorCompanyOrg(selectorQuery *query.Compan
//SelectorCompanyRole 获取公司角色的下拉列表
func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.CompanyRoleSelectorQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
selectorQuery.Operator.CompanyId,
selectorQuery.Operator.OrgId,
selectorQuery.Operator.UserId)
selectorQuery.Operator)
result, err := creationUserGateway.RoleSearch(allied_creation_user.ReqRoleSearch{
Limit: selectorQuery.PageSize,
Offset: (selectorQuery.PageNumber - 1) * selectorQuery.PageSize,
... ... @@ -500,9 +477,7 @@ func (usersService *UsersService) SelectorCompanyRole(selectorQuery *query.Compa
//CompanyOrgSelector 获取公司全组织部门的下拉列表
func (usersService *UsersService) SelectorCompanyOrgAll(selectorQuery *query.CompanyOrgSelectorQuery) (int64, interface{}, error) {
creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
selectorQuery.Operator.CompanyId,
selectorQuery.Operator.OrgId,
selectorQuery.Operator.UserId)
selectorQuery.Operator)
result, err := creationUserGateway.OrgSearch(allied_creation_user.ReqOrgSearch{
CompanyId: int(selectorQuery.Operator.CompanyId),
DepName: "",
... ...
... ... @@ -6,10 +6,15 @@ const SERVICE_NAME = "project"
var LOG_LEVEL = "debug"
//天联共创基础模块
var ALLIED_CREATION_BASIC_HOST = "http://localhost:8080"
//天联共创用户模块
var ALLIED_CREATION_USER_HOST = "http://localhost:8081"
//通用模块短信服务
var SMS_SERVE_HOST = "http://localhost:8081"
func init() {
if os.Getenv("LOG_LEVEL") != "" {
LOG_LEVEL = os.Getenv("LOG_LEVEL")
... ...
... ... @@ -3,9 +3,9 @@ package allied_creation_basic
import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
type HttplibAlliedCreationBasic struct {
... ... @@ -13,14 +13,17 @@ type HttplibAlliedCreationBasic struct {
baseUrL string
}
var alliedCreationBasicClient = &HttplibAlliedCreationBasic{
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
},
baseUrL: constant.ALLIED_CREATION_BASIC_HOST,
}
func NewHttplibAlliedCreationBasic(operator domain.Operator) *HttplibAlliedCreationBasic {
return &HttplibAlliedCreationBasic{
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
CompanyId: operator.CompanyId,
OrgId: operator.OrgId,
UserId: operator.UserId,
UserBaseId: operator.UserBaseId,
},
baseUrL: constant.ALLIED_CREATION_USER_HOST,
}
func NewHttplibAlliedCreationBasic() *HttplibAlliedCreationBasic {
return alliedCreationBasicClient
}
... ...
package allied_creation_basic
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"
)
// NoticeSettingUpdate 更新消息模板
func (gateway HttplibAlliedCreationBasic) NoticeSettingUpdate(param ReqNoticeSettingUpdate) (*DataNoticeSettingUpdate, error) {
url := gateway.baseUrL + "/notice-setting" + strconv.Itoa(param.NoticeSettingID)
method := "PUT"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:更新消息模板。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求更新消息模板失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取更新消息模板失败:%w", err)
}
log.Logger.Debug("获取基础模块请求数据:更新消息模板。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析更新消息模板:%w", err)
}
var data DataNoticeSettingUpdate
err = gateway.GetResponseData(result, &data)
return &data, err
}
// NoticeSettingAdd 添加化消息模板
func (gateway HttplibAlliedCreationBasic) NoticeSettingAdd(param ReqNoticeSettingAdd) (*DataNoticeSettingAdd, error) {
url := gateway.baseUrL + "/notice-setting"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:添加化消息模板。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求添加化消息模板失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取添加化消息模板失败:%w", err)
}
log.Logger.Debug("获取基础模块请求数据:添加化消息模板。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析添加化消息模板:%w", err)
}
var data DataNoticeSettingAdd
err = gateway.GetResponseData(result, &data)
return &data, err
}
// NoticeSettingGet 返回编排消息通知内容
func (gateway HttplibAlliedCreationBasic) NoticeSettingGet(param ReqNoticeSettingGet) (*DataNoticeSettingGet, error) {
url := gateway.baseUrL + "/notice-setting/" + strconv.Itoa(param.SettingId)
method := "GET"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:返回编排消息通知内容。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求返回编排消息通知内容失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取返回编排消息通知内容失败:%w", err)
}
log.Logger.Debug("获取基础模块请求数据:返回编排消息通知内容。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析返回编排消息通知内容:%w", err)
}
var data DataNoticeSettingGet
err = gateway.GetResponseData(result, &data)
return &data, err
}
// NoticeSettingSearch 返回编排消息通知内容列表
func (gateway HttplibAlliedCreationBasic) NoticeSettingSearch(param ReqNoticeSettingSearch) (*DataNoticeSettingSearch, error) {
url := gateway.baseUrL + "/notice-setting/search"
method := "POST"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向基础模块请求数据:返回编排消息通知内容列表。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return nil, fmt.Errorf("请求返回编排消息通知内容列表失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return nil, fmt.Errorf("获取返回编排消息通知内容列表失败:%w", err)
}
log.Logger.Debug("获取基础模块请求数据:返回编排消息通知内容列表。", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return nil, fmt.Errorf("解析返回编排消息通知内容列表:%w", err)
}
var data DataNoticeSettingSearch
err = gateway.GetResponseData(result, &data)
return &data, err
}
... ...
package allied_creation_basic
import "gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
//ReqGetDictionarysByCode 根据code获取字典数据
type ReqGetDictionaryByCode struct {
DictCode []string `json:"dictCode"`
}
//DataGetDictionarysByCode 根据code获取字典数据
type DataGetDictionaryByCode struct {
Dictionarys []domain.Dictionary `json:"dictionarys"`
}
package allied_creation_basic
//ReqGetDictionarysByCode 根据code获取字典数据
type ReqGetDictionaryByCode struct {
DictCode []string `json:"dictCode"`
}
//DataGetDictionarysByCode 根据code获取字典数据
type DataGetDictionaryByCode struct {
Dictionarys []struct {
// 字典编号 主键
DictionaryId int64 `json:"dictionaryId"`
// 字典编码
DictCode string `json:"dictCode"`
// 字典名称
DictName string `json:"dictName"`
// 备注信息
Describe string `json:"describe"`
// 字典值列表
DictItems []struct {
// 项编码
ItemCode string `json:"itemCode"`
// 项标签
ItemLabel string `json:"itemLabel"`
// 值
ItemValue string `json:"itemValue"`
// 是否可见【1:不可以】【2:可以】
IsShow int `json:"isShow"`
// 显示序号
Sort int `json:"sort"`
} `json:"dictItems"`
} `json:"dictionarys"`
}
... ...
package allied_creation_basic
//更新消息模板
type (
ReqNoticeSettingUpdate struct {
NoticeSettingID int `json:"noticeSettingId"`
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrganizationID int `json:"organizationId"`
}
DataNoticeSettingUpdate struct {
NoticeSettingID int `json:"noticeSettingId"`
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrganizationID int `json:"organizationId"`
}
)
//添加化消息模板
type (
ReqNoticeSettingAdd struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
OrganizationID int `json:"organizationId"`
}
DataNoticeSettingAdd struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId"`
OrganizationID int `json:"organizationId"`
}
)
//返回编排消息通知内容
type (
ReqNoticeSettingGet struct {
SettingId int `json:"settingId"`
}
DataNoticeSettingGet struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId"`
OrganizationID int `json:"organizationId"`
SysCode string `json:"sysCode"`
}
)
//返回编排消息通知内容列表
type (
ReqNoticeSettingSearch struct {
PageIndex int `json:"pageIndex"`
PageSize int `json:"pageSize"`
CompanyId int64 `json:"companyId"`
}
DataNoticeSettingSearch struct {
Count int64 `json:"count"`
NoticeSettings []struct {
CompanyID int `json:"companyId"`
Content string `json:"content"`
IsPush int `json:"isPush"`
Module string `json:"module"`
ModuleAction string `json:"moduleAction"`
NoticeSettingID int `json:"noticeSettingId"`
OrganizationID int `json:"organizationId"`
SysCode string `json:"sysCode"`
} `json:"noticeSettings"`
}
)
... ...
... ... @@ -4,6 +4,7 @@ import (
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
... ... @@ -13,14 +14,15 @@ type HttplibAlliedCreationUser struct {
baseUrL string
}
func NewHttplibAlliedCreationUser(companyId int64, orgId int64, userId int64) *HttplibAlliedCreationUser {
func NewHttplibAlliedCreationUser(operator domain.Operator) *HttplibAlliedCreationUser {
return &HttplibAlliedCreationUser{
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
CompanyId: companyId,
OrgId: orgId,
UserId: userId,
CompanyId: operator.CompanyId,
OrgId: operator.OrgId,
UserId: operator.UserId,
UserBaseId: operator.UserBaseId,
},
baseUrL: constant.ALLIED_CREATION_USER_HOST,
}
... ...
... ... @@ -73,7 +73,7 @@ func (gateway HttplibAlliedCreationUser) MenusUpdate(param ReqMenusUpdate) (*Dat
// MenusRemove 移除菜单
func (gateway HttplibAlliedCreationUser) MenusRemove(param ReqMenusRemove) (*DataMenusRemove, error) {
url := gateway.baseUrL + "/menus/" + strconv.FormatInt(param.RoleId, 10)
url := gateway.baseUrL + "/menus/" + strconv.FormatInt(param.MenuId, 10)
method := "delete"
req := gateway.CreateRequest(url, method)
log.Logger.Debug("向用户模块请求数据:移除菜单。", map[string]interface{}{
... ...
... ... @@ -3,7 +3,8 @@ package allied_creation_user
//更新我喜欢菜单列表
type (
ReqFavoriteMenusUpdate struct {
UserId int64
UserId int64 `json:"userId"`
FavoriteMenus []string `json:"favoriteMenus"`
}
DataFavoriteMenusUpdate struct {
... ... @@ -13,8 +14,8 @@ type (
//移除我收藏的菜单
type (
ReqFavoriteMenusRemove struct {
UserId int64
MenuCode string
UserId int64 `json:"userId"`
MenuCode string `json:"menuCode"`
}
DataFavoriteMenusRemove struct {
... ... @@ -24,9 +25,10 @@ type (
//获取我收藏的菜单
type (
ReqFavoriteMenusGet struct {
UserId int64
UserId int64 `json:"userId"`
}
DataFavoriteMenusGet struct {
FavoriteMenus []string `json:"favoriteMenus"`
}
)
... ...
... ... @@ -85,7 +85,7 @@ type (
//移除菜单
type (
ReqMenusRemove struct {
RoleId int64
MenuId int64
}
DataMenusRemove struct {
... ...
... ... @@ -36,7 +36,7 @@ type (
//移除组织
type (
ReqOrgRemove struct {
OrgId int64
OrgId int64 `json:"orgId"`
}
DataOrgRemove struct {
... ...
... ... @@ -36,7 +36,7 @@ type (
}
DataRoleSearch struct {
Count int64
Count int64 `json:"count"`
Roles []struct {
AccessMenus []Int64String `json:"accessMenus"`
CompanyID Int64String `json:"companyId"`
... ... @@ -87,8 +87,8 @@ type (
//分配角色给多个用户
type (
ReqRoleAssign struct {
RoleId int64
UserIds []int64
RoleId int64 `json:"roleId"`
UserIds []int64 `json:"userIds"`
}
DataRoleAssign struct {
... ...
... ... @@ -26,6 +26,7 @@ type BaseServiceGateway struct {
CompanyId int64
OrgId int64
UserId int64
UserBaseId int64
}
func (gateway BaseServiceGateway) CreateRequest(url string, method string) *httplib.BeegoHTTPRequest {
... ...
package sms_serve
import (
"encoding/json"
"fmt"
"time"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/log"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/constant"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway"
)
//公共短信服务模块
type HttplibSmsServe struct {
service_gateway.BaseServiceGateway
baseUrL string
}
func NewHttplibHttplibSmsServe() *HttplibSmsServe {
return &HttplibSmsServe{
BaseServiceGateway: service_gateway.BaseServiceGateway{
ConnectTimeout: 100 * time.Second,
ReadWriteTimeout: 30 * time.Second,
},
baseUrL: constant.ALLIED_CREATION_USER_HOST,
}
}
//SendSms 公共短信验证码服务 发送验证码
func (smsServe HttplibSmsServe) SendSms(phone string) error {
url := smsServe.baseUrL + "/service/sendSms"
method := "post"
req := smsServe.CreateRequest(url, method)
param := map[string]string{
"phone": phone,
}
log.Logger.Debug("向公共短信验证码服务请求数据:短信验证码接口。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return fmt.Errorf("请求公共短信验证码服务失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return fmt.Errorf("获取公共短信验证码服务失败:%w", err)
}
log.Logger.Debug("获取公共短信验证码服务请求数据", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return fmt.Errorf("解析更新组织:%w", err)
}
if result.Code != 0 {
return fmt.Errorf(result.Msg)
}
return nil
}
//CheckSmsCode 公共短信验证码服务 校验验证码
func (smsServe HttplibSmsServe) CheckSmsCode(phone string, code string) error {
url := smsServe.baseUrL + "/service/sendSms"
method := "post"
req := smsServe.CreateRequest(url, method)
param := map[string]string{
"phone": phone,
"code": code,
}
log.Logger.Debug("向公共短信验证码服务请求数据:短信验证码接口。", map[string]interface{}{
"api": method + ":" + url,
"param": param,
})
req, err := req.JSONBody(param)
if err != nil {
return fmt.Errorf("请求公共短信验证码服务失败:%w", err)
}
byteResult, err := req.Bytes()
if err != nil {
return fmt.Errorf("获取公共短信验证码服务失败:%w", err)
}
log.Logger.Debug("获取公共短信验证码服务请求数据", map[string]interface{}{
"result": string(byteResult),
})
var result service_gateway.GatewayResponse
err = json.Unmarshal(byteResult, &result)
if err != nil {
return fmt.Errorf("解析更新组织:%w", err)
}
if result.Code != 0 {
return fmt.Errorf(result.Msg)
}
return nil
}
... ...
package mobile_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/user/service"
)
type UserController struct {
baseController
}
func (controller *UserController) SendSmsCode() {
authService := service.UserService{}
smsCodeCmd := &command.SendSmsCodeCommand{}
err := controller.Unmarshal(smsCodeCmd)
if err != nil {
controller.Response(nil, err)
return
}
err = authService.SendSmsCaptcha(smsCodeCmd)
controller.Response(nil, err)
}
... ...
package web_client
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/command"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/query"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/noticesetting/service"
)
type NoticeSettingController struct {
baseController
}
func (controller *NoticeSettingController) NoticeSettingList() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingListQuery := &query.NoticeSettingListQuery{}
controller.Unmarshal(noticeSettingListQuery)
noticeSettingListQuery.Operator = controller.GetOperator()
cnt, data, err := noticeSettingService.NoticeSettingList(noticeSettingListQuery)
controller.returnPageListData(cnt, data, err, noticeSettingListQuery.PageNumber)
}
func (controller *NoticeSettingController) NoticeSettingProfile() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingProfileQuery := &query.NoticeSettingProfileQuery{}
noticeSettingProfileQuery.Operator = controller.GetOperator()
data, err := noticeSettingService.NoticeSettingProfile(noticeSettingProfileQuery)
controller.Response(data, err)
}
func (controller *NoticeSettingController) NoticeSettingUpdate() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingUpdateCommand := &command.NoticeSettingUpdateCommand{}
controller.Unmarshal(noticeSettingUpdateCommand)
noticeSettingUpdateCommand.Operator = controller.GetOperator()
data, err := noticeSettingService.NoticeSettingUpdate(noticeSettingUpdateCommand)
controller.Response(data, err)
}
func (controller *NoticeSettingController) NoticeSettingAdd() {
noticeSettingService := service.NewNoticeSettingService(nil)
noticeSettingAddCommand := &command.NoticeSettingAddCommand{}
controller.Unmarshal(noticeSettingAddCommand)
noticeSettingAddCommand.Operator = controller.GetOperator()
data, err := noticeSettingService.NoticeSettingAdd(noticeSettingAddCommand)
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/mobile_client"
)
func init() {
web.Router("/v1/app/users/smsCode", &mobile_client.UserController{}, "Post:SendSmsCode")
}
... ...
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/notice-setting/search", &web_client.NoticeSettingController{}, "Post:NoticeSettingList")
web.Router("/v1/web/notice-setting/profile", &web_client.NoticeSettingController{}, "Get:NoticeSettingProfile")
web.Router("/v1/web/notice-setting/", &web_client.NoticeSettingController{}, "Put:NoticeSettingUpdate")
}
... ...