作者 yangfu

重构

正在显示 137 个修改的文件 包含 380 行增加923 行删除
package access
package service
import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/access"
)
type AccessService struct {
}
func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request *protocolx.CreateAccessRequest) (rsp interface{}, err error) {
func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request *command.CreateAccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateAccessResponse{}
rsp = &command.CreateAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -47,11 +48,11 @@ func (svr *AccessService) CreateAccess(header *protocol.RequestHeader, request *
return
}
func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request *protocolx.UpdateAccessRequest) (rsp interface{}, err error) {
func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request *command.UpdateAccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateAccessResponse{}
rsp = &command.UpdateAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -78,11 +79,11 @@ func (svr *AccessService) UpdateAccess(header *protocol.RequestHeader, request *
return
}
func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *protocolx.GetAccessRequest) (rsp interface{}, err error) {
func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *query.GetAccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetAccessResponse{}
rsp = &query.GetAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -104,11 +105,11 @@ func (svr *AccessService) GetAccess(header *protocol.RequestHeader, request *pro
return
}
func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request *protocolx.DeleteAccessRequest) (rsp interface{}, err error) {
func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request *command.DeleteAccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteAccessResponse{}
rsp = &command.DeleteAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -133,11 +134,11 @@ func (svr *AccessService) DeleteAccess(header *protocol.RequestHeader, request *
return
}
func (svr *AccessService) ListAccess(header *protocol.RequestHeader, request *protocolx.ListAccessRequest) (rsp interface{}, err error) {
func (svr *AccessService) ListAccess(header *protocol.RequestHeader, request *query.ListAccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListAccessResponse{}
rsp = &query.ListAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ...
package auth
package query
import "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
... ...
package auth
package service
import (
"encoding/json"
... ... @@ -7,25 +7,26 @@ import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/cache"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/cachex"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/auth"
"time"
)
type AuthService struct {
}
func (svr *AuthService) Login(header *protocol.RequestHeader, request *protocolx.LoginRequest) (rsp *protocolx.LoginResponse, err error) {
func (svr *AuthService) Login(header *protocol.RequestHeader, request *command.LoginRequest) (rsp *command.LoginResponse, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
UserRepository, _ = factory.CreateUserRepository(transactionContext)
)
rsp = &protocolx.LoginResponse{}
rsp = &command.LoginResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -63,11 +64,11 @@ func (svr *AuthService) Login(header *protocol.RequestHeader, request *protocolx
return
}
func (svr *AuthService) Logout(header *protocol.RequestHeader, request *protocolx.LogoutRequest) (rsp *protocolx.LogoutResponse, err error) {
func (svr *AuthService) Logout(header *protocol.RequestHeader, request *command.LogoutRequest) (rsp *command.LogoutResponse, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.LogoutResponse{}
rsp = &command.LogoutResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -83,12 +84,12 @@ func (svr *AuthService) Logout(header *protocol.RequestHeader, request *protocol
return
}
func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *protocolx.RefreshRequest) (rsp interface{}, err error) {
func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *command.RefreshRequest) (rsp interface{}, err error) {
var (
//transactionContext, _ = factory.CreateTransactionContext(nil)
)
//transactionContext.SetTransactionClose()
rsp = &protocolx.RefreshResponse{}
rsp = &command.RefreshResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -108,13 +109,13 @@ func (svr *AuthService) Refresh(header *protocol.RequestHeader, request *protoco
return
}
log.Debug(claim.Username, claim.Password, time.Unix(claim.ExpiresAt, 0))
rsp, err = svr.Login(header, &protocolx.LoginRequest{UserName: (claim.AddData["Phone"]).(string), Password: claim.Password})
rsp, err = svr.Login(header, &command.LoginRequest{UserName: (claim.AddData["Phone"]).(string), Password: claim.Password})
//err = transactionContext.CommitTransaction()
return
}
func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protocolx.ProfileRequest) (rsp interface{}, err error) {
func (svr *AuthService) Profile(header *protocol.RequestHeader, request *command.ProfileRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
UserRepository, _ = factory.CreateUserRepository(transactionContext)
... ... @@ -122,7 +123,7 @@ func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protoco
RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext)
AccessRepository, _ = factory.CreateAccessRepository(transactionContext)
)
rsp = &protocolx.ProfileResponse{}
rsp = &command.ProfileResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -167,11 +168,11 @@ func (svr *AuthService) Profile(header *protocol.RequestHeader, request *protoco
return
}
func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *protocolx.CaptchaInitRequest) (rsp interface{}, err error) {
func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *query.CaptchaInitRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CaptchaInitResponse{}
rsp = &query.CaptchaInitResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -203,12 +204,12 @@ func (svr *AuthService) CaptchaInit(header *protocol.RequestHeader, request *pro
return
}
func (svr *AuthService) ChangePassword(header *protocol.RequestHeader, request *protocolx.ChangePasswordRequest) (rsp *protocolx.ChangePasswordResponse, err error) {
func (svr *AuthService) ChangePassword(header *protocol.RequestHeader, request *command.ChangePasswordRequest) (rsp *command.ChangePasswordResponse, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
UserRepository, _ = factory.CreateUserRepository(transactionContext)
)
rsp = &protocolx.ChangePasswordResponse{}
rsp = &command.ChangePasswordResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ...
package client_version
package query
import (
"fmt"
... ... @@ -6,14 +6,16 @@ import (
)
type ListClientVersionRequest struct {
Offset int `json:"offset"`
Limit int `json:"limit"`
SearchByText string `json:"projectName,omitempty"` //按名称搜索
Offset int `json:"offset"`
Limit int `json:"limit"`
SearchByText string `json:"projectName,omitempty"` //按名称搜索
SortByCreateTime string `json:"sortByCreateTime`
}
func (ListClientVersionRequest *ListClientVersionRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(ListClientVersionRequest)
ListClientVersionRequest.SortByCreateTime = "desc"
if err != nil {
return err
}
... ...
package client_version
package service
import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/client_version"
"time"
)
type ClientVersionService struct {
}
func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHeader, request *protocolx.CreateClientVersionRequest) (rsp interface{}, err error) {
func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHeader, request *command.CreateClientVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateClientVersionResponse{}
rsp = &command.CreateClientVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -50,11 +51,11 @@ func (svr *ClientVersionService) CreateClientVersion(header *protocol.RequestHea
return
}
func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHeader, request *protocolx.UpdateClientVersionRequest) (rsp interface{}, err error) {
func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHeader, request *command.UpdateClientVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateClientVersionResponse{}
rsp = &command.UpdateClientVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -82,11 +83,11 @@ func (svr *ClientVersionService) UpdateClientVersion(header *protocol.RequestHea
return
}
func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader, request *protocolx.GetClientVersionRequest) (rsp interface{}, err error) {
func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader, request *query.GetClientVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetClientVersionResponse{}
rsp = &query.GetClientVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -109,11 +110,11 @@ func (svr *ClientVersionService) GetClientVersion(header *protocol.RequestHeader
return
}
func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHeader, request *protocolx.DeleteClientVersionRequest) (rsp interface{}, err error) {
func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHeader, request *command.DeleteClientVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteClientVersionResponse{}
rsp = &command.DeleteClientVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -139,11 +140,11 @@ func (svr *ClientVersionService) DeleteClientVersion(header *protocol.RequestHea
return
}
func (svr *ClientVersionService) ListClientVersion(header *protocol.RequestHeader, request *protocolx.ListClientVersionRequest) (rsp interface{}, err error) {
func (svr *ClientVersionService) ListClientVersion(header *protocol.RequestHeader, request *query.ListClientVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListClientVersionResponse{}
rsp = &query.ListClientVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ...
package menu
import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/menu"
"time"
)
type MenuService struct {
}
func (svr *MenuService) CreateMenu(header *protocol.RequestHeader, request *protocolx.CreateMenuRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateMenuResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
if err = transactionContext.StartTransaction(); err != nil {
log.Error(err)
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
newMenu := &domain.Menu{
MenuName: request.MenuName,
MenuCode: request.MenuCode,
Icon: request.Icon,
Sort: request.Sort,
Hidden: request.Hidden,
CreatedTime: time.Now(),
UpdateTime: time.Now(),
}
var MenuRepository, _ = factory.CreateMenuRepository(transactionContext)
if m, err := MenuRepository.Save(newMenu); err != nil {
return nil, err
} else {
rsp = m
}
err = transactionContext.CommitTransaction()
return
}
func (svr *MenuService) UpdateMenu(header *protocol.RequestHeader, request *protocolx.UpdateMenuRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateMenuResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
if err = transactionContext.StartTransaction(); err != nil {
log.Error(err)
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
var MenuRepository, _ = factory.CreateMenuRepository(transactionContext)
var menu *domain.Menu
if menu, err = MenuRepository.FindOne(common.ObjectToMap(request)); err != nil {
return
}
if err = menu.Update(common.ObjectToMap(request)); err != nil {
return
}
if menu, err = MenuRepository.Save(menu); err != nil {
return
}
err = transactionContext.CommitTransaction()
return
}
func (svr *MenuService) GetMenu(header *protocol.RequestHeader, request *protocolx.GetMenuRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetMenuResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
if err = transactionContext.StartTransaction(); err != nil {
log.Error(err)
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
var MenuRepository, _ = factory.CreateMenuRepository(transactionContext)
var menu *domain.Menu
if menu, err = MenuRepository.FindOne(common.ObjectToMap(request)); err != nil {
return
}
rsp = menu
err = transactionContext.CommitTransaction()
return
}
func (svr *MenuService) DeleteMenu(header *protocol.RequestHeader, request *protocolx.DeleteMenuRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteMenuResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
if err = transactionContext.StartTransaction(); err != nil {
log.Error(err)
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
var MenuRepository, _ = factory.CreateMenuRepository(transactionContext)
var menu *domain.Menu
if menu, err = MenuRepository.FindOne(common.ObjectToMap(request)); err != nil {
return
}
if menu, err = MenuRepository.Remove(menu); err != nil {
return
}
rsp = menu
err = transactionContext.CommitTransaction()
return
}
func (svr *MenuService) ListMenu(header *protocol.RequestHeader, request *protocolx.ListMenuRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListMenuResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
if err = transactionContext.StartTransaction(); err != nil {
log.Error(err)
return nil, err
}
defer func() {
transactionContext.RollbackTransaction()
}()
var MenuRepository, _ = factory.CreateMenuRepository(transactionContext)
var menu []*domain.Menu
var total int64
if total, menu, err = MenuRepository.Find(common.ObjectToMap(request)); err != nil {
return
}
rsp = map[string]interface{}{
"total": total,
"list": menu,
}
err = transactionContext.CommitTransaction()
return
}
func NewMenuService(options map[string]interface{}) *MenuService {
svr := &MenuService{}
return svr
}
package operator_log
package service
import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/operator_log"
)
type OperatorLogService struct {
}
func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader, request *protocolx.CreateOperatorLogRequest) (rsp interface{}, err error) {
func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader, request *command.CreateOperatorLogRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateOperatorLogResponse{}
rsp = &command.CreateOperatorLogResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -45,11 +46,11 @@ func (svr *OperatorLogService) CreateOperatorLog(header *protocol.RequestHeader,
return
}
func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader, request *protocolx.UpdateOperatorLogRequest) (rsp interface{}, err error) {
func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader, request *command.UpdateOperatorLogRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateOperatorLogResponse{}
rsp = &command.UpdateOperatorLogResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -77,11 +78,11 @@ func (svr *OperatorLogService) UpdateOperatorLog(header *protocol.RequestHeader,
return
}
func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, request *protocolx.GetOperatorLogRequest) (rsp interface{}, err error) {
func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, request *query.GetOperatorLogRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetOperatorLogResponse{}
rsp = &query.GetOperatorLogResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -104,11 +105,11 @@ func (svr *OperatorLogService) GetOperatorLog(header *protocol.RequestHeader, re
return
}
func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader, request *protocolx.DeleteOperatorLogRequest) (rsp interface{}, err error) {
func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader, request *command.DeleteOperatorLogRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteOperatorLogResponse{}
rsp = &command.DeleteOperatorLogResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -134,11 +135,11 @@ func (svr *OperatorLogService) DeleteOperatorLog(header *protocol.RequestHeader,
return
}
func (svr *OperatorLogService) ListOperatorLog(header *protocol.RequestHeader, request *protocolx.ListOperatorLogRequest) (rsp interface{}, err error) {
func (svr *OperatorLogService) ListOperatorLog(header *protocol.RequestHeader, request *query.ListOperatorLogRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListOperatorLogResponse{}
rsp = &query.ListOperatorLogResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ...
package project_module
package service
import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module"
"time"
)
type ProjectModuleService struct {
}
func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHeader, request *protocolx.CreateProjectModuleRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHeader, request *command.CreateProjectModuleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
ProjectModuleVersionRepository, _ = factory.CreateProjectModuleVersionRepository(transactionContext)
)
rsp = &protocolx.CreateProjectModuleResponse{}
rsp = &command.CreateProjectModuleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -65,11 +66,11 @@ func (svr *ProjectModuleService) CreateProjectModule(header *protocol.RequestHea
return
}
func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHeader, request *protocolx.UpdateProjectModuleRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHeader, request *command.UpdateProjectModuleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateProjectModuleResponse{}
rsp = &command.UpdateProjectModuleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -103,11 +104,11 @@ func (svr *ProjectModuleService) UpdateProjectModule(header *protocol.RequestHea
return
}
func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader, request *protocolx.GetProjectModuleRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader, request *query.GetProjectModuleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetProjectModuleResponse{}
rsp = &query.GetProjectModuleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -131,11 +132,11 @@ func (svr *ProjectModuleService) GetProjectModule(header *protocol.RequestHeader
return
}
func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHeader, request *protocolx.DeleteProjectModuleRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHeader, request *command.DeleteProjectModuleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteProjectModuleResponse{}
rsp = &command.DeleteProjectModuleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -164,7 +165,7 @@ func (svr *ProjectModuleService) DeleteProjectModule(header *protocol.RequestHea
return
}
func (svr *ProjectModuleService) ListProjectModule(header *protocol.RequestHeader, request *protocolx.ListProjectModuleRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleService) ListProjectModule(header *protocol.RequestHeader, request *query.ListProjectModuleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
... ...
package project_module_files
package service
import (
"bytes"
... ... @@ -6,11 +6,12 @@ import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_files"
"path/filepath"
"strconv"
"strings"
... ... @@ -20,12 +21,12 @@ import (
type ProjectModuleFilesService struct {
}
func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.CreateProjectModuleFilesRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol.RequestHeader, request *command.CreateProjectModuleFilesRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
ProjectModuleVersion, _ = factory.CreateProjectModuleVersionRepository(transactionContext)
)
rsp = &protocolx.CreateProjectModuleFilesResponse{}
rsp = &command.CreateProjectModuleFilesResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -63,12 +64,12 @@ func (svr *ProjectModuleFilesService) CreateProjectModuleFiles(header *protocol.
return
}
func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.UpdateProjectModuleFilesRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol.RequestHeader, request *command.UpdateProjectModuleFilesRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
ProjectModuleFilesDao, _ = dao.NewProjectModuleFilesDao(transactionContext)
)
rsp = &protocolx.UpdateProjectModuleFilesResponse{}
rsp = &command.UpdateProjectModuleFilesResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -134,11 +135,11 @@ func (svr *ProjectModuleFilesService) UpdateProjectModuleFiles(header *protocol.
return
}
func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.GetProjectModuleFilesRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.RequestHeader, request *query.GetProjectModuleFilesRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetProjectModuleFilesResponse{}
rsp = &query.GetProjectModuleFilesResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -160,11 +161,11 @@ func (svr *ProjectModuleFilesService) GetProjectModuleFiles(header *protocol.Req
return
}
func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.DeleteProjectModuleFilesRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol.RequestHeader, request *command.DeleteProjectModuleFilesRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteProjectModuleFilesResponse{}
rsp = &command.DeleteProjectModuleFilesResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -196,11 +197,11 @@ func (svr *ProjectModuleFilesService) DeleteProjectModuleFiles(header *protocol.
return
}
func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.RequestHeader, request *protocolx.ListProjectModuleFilesRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.RequestHeader, request *query.ListProjectModuleFilesRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListProjectModuleFilesResponse{}
rsp = &query.ListProjectModuleFilesResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -252,12 +253,12 @@ func (svr *ProjectModuleFilesService) ListProjectModuleFiles(header *protocol.Re
return
}
func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, request *protocolx.ImportRequest) (rsp *protocolx.ImportResponse, err error) {
func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, request *command.ImportRequest) (rsp *command.ImportResponse, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
ProjectModuleVersion, _ = factory.CreateProjectModuleVersionRepository(transactionContext)
)
rsp = &protocolx.ImportResponse{}
rsp = &command.ImportResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -325,11 +326,11 @@ func (svr *ProjectModuleFilesService) Import(header *protocol.RequestHeader, req
// ReviseTag
// 修订标签
func (svr *ProjectModuleFilesService) ReviseTag(header *protocol.RequestHeader, request *protocolx.ReviseTagRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleFilesService) ReviseTag(header *protocol.RequestHeader, request *command.ReviseTagRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ReviseTagResponse{}
rsp = &command.ReviseTagResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -427,11 +428,11 @@ func (svr *ProjectModuleFilesService) mkdirF(fileDir string, mid, vid, pid int64
func (svr *ProjectModuleFilesService) traverseModuleFiles(files []*domain.ProjectModuleFiles) interface{} {
retSlice := make([]*protocolx.ModuleFiles, 0)
retSlice := make([]*query.ModuleFiles, 0)
for i := range files {
if files[i].ParentId == 0 {
retSlice = append(retSlice, &protocolx.ModuleFiles{ModuleFile: protocolx.NewModuleFile(files[i]), List: make([]*protocolx.ModuleFiles, 0)})
retSlice = append(retSlice, &query.ModuleFiles{ModuleFile: query.NewModuleFile(files[i]), List: make([]*query.ModuleFiles, 0)})
continue
}
traverse(retSlice, files[i])
... ... @@ -439,17 +440,17 @@ func (svr *ProjectModuleFilesService) traverseModuleFiles(files []*domain.Projec
return retSlice
}
func traverse(list []*protocolx.ModuleFiles, file *domain.ProjectModuleFiles) {
func traverse(list []*query.ModuleFiles, file *domain.ProjectModuleFiles) {
for i := range list {
if list[i].Id == file.ParentId {
list[i].List = append(list[i].List, &protocolx.ModuleFiles{ModuleFile: protocolx.NewModuleFile(file), List: make([]*protocolx.ModuleFiles, 0)})
list[i].List = append(list[i].List, &query.ModuleFiles{ModuleFile: query.NewModuleFile(file), List: make([]*query.ModuleFiles, 0)})
return
}
traverse(list[i].List, file)
}
return
}
func changeLog(request *protocolx.UpdateProjectModuleFilesRequest, old *domain.ProjectModuleFiles) string {
func changeLog(request *command.UpdateProjectModuleFilesRequest, old *domain.ProjectModuleFiles) string {
buf := bytes.NewBuffer(nil)
if len(request.FileName) > 0 && request.FileName != old.FileName {
buf.WriteString("【文件名】修改为:" + request.FileName + "\n")
... ...
package project_module_version
package service
import (
"fmt"
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_version"
"strings"
"time"
)
... ... @@ -17,11 +18,11 @@ import (
type ProjectModuleVersionService struct {
}
func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.CreateProjectModuleVersionRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *protocol.RequestHeader, request *command.CreateProjectModuleVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateProjectModuleVersionResponse{}
rsp = &command.CreateProjectModuleVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -72,11 +73,11 @@ func (svr *ProjectModuleVersionService) CreateProjectModuleVersion(header *proto
return
}
func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.UpdateProjectModuleVersionRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *protocol.RequestHeader, request *command.UpdateProjectModuleVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateProjectModuleVersionResponse{}
rsp = &command.UpdateProjectModuleVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -112,11 +113,11 @@ func (svr *ProjectModuleVersionService) UpdateProjectModuleVersion(header *proto
return
}
func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.GetProjectModuleVersionRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol.RequestHeader, request *query.GetProjectModuleVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.GetProjectModuleVersionResponse{}
rsp = &query.GetProjectModuleVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -140,11 +141,11 @@ func (svr *ProjectModuleVersionService) GetProjectModuleVersion(header *protocol
return
}
func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.DeleteProjectModuleVersionRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *protocol.RequestHeader, request *command.DeleteProjectModuleVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteProjectModuleVersionResponse{}
rsp = &command.DeleteProjectModuleVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -175,11 +176,11 @@ func (svr *ProjectModuleVersionService) DeleteProjectModuleVersion(header *proto
return
}
func (svr *ProjectModuleVersionService) ListProjectModuleVersion(header *protocol.RequestHeader, request *protocolx.ListProjectModuleVersionRequest) (rsp interface{}, err error) {
func (svr *ProjectModuleVersionService) ListProjectModuleVersion(header *protocol.RequestHeader, request *query.ListProjectModuleVersionRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListProjectModuleVersionResponse{}
rsp = &query.ListProjectModuleVersionResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ...
package rbac
package service
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/dao"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/rbac"
)
type RbacService struct {
}
func (svr *RbacService) Access(header *protocol.RequestHeader, request *protocolx.AccessRequest) (rsp interface{}, err error) {
func (svr *RbacService) Access(header *protocol.RequestHeader, request *query.AccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.AccessResponse{}
rsp = &query.AccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -53,14 +54,14 @@ func (svr *RbacService) Access(header *protocol.RequestHeader, request *protocol
return
}
func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *protocolx.RoleAccessRequest) (rsp interface{}, err error) {
func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *query.RoleAccessRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext)
RoleRepository, _ = factory.CreateRoleRepository(transactionContext)
role *domain.Role
)
rsp = &protocolx.RoleAccessResponse{}
rsp = &query.RoleAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -89,14 +90,14 @@ func (svr *RbacService) RoleAccess(header *protocol.RequestHeader, request *prot
return
}
func (svr *RbacService) SetRoleAccess(header *protocol.RequestHeader, request *protocolx.SetRoleAccessRequest) (rsp *protocolx.SetRoleAccessResponse, err error) {
func (svr *RbacService) SetRoleAccess(header *protocol.RequestHeader, request *command.SetRoleAccessRequest) (rsp *command.SetRoleAccessResponse, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
AccessRepository, _ = factory.CreateAccessRepository(transactionContext)
RoleRepository, _ = factory.CreateRoleRepository(transactionContext)
RoleAccessDao, _ = dao.NewRoleAccessDao(transactionContext)
)
rsp = &protocolx.SetRoleAccessResponse{}
rsp = &command.SetRoleAccessResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ...
package role
package service
import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/role"
"time"
)
type RoleService struct {
}
func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *protocolx.CreateRoleRequest) (rsp interface{}, err error) {
func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *command.CreateRoleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateRoleResponse{}
rsp = &command.CreateRoleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ... @@ -52,11 +53,11 @@ func (svr *RoleService) CreateRole(header *protocol.RequestHeader, request *prot
return
}
func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *protocolx.UpdateRoleRequest) (rsp interface{}, err error) {
func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *command.UpdateRoleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateRoleResponse{}
rsp = &command.UpdateRoleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -94,12 +95,12 @@ func (svr *RoleService) UpdateRole(header *protocol.RequestHeader, request *prot
return
}
func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *protocolx.GetRoleRequest) (rsp interface{}, err error) {
func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *query.GetRoleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
transactionContext.SetTransactionClose()
rsp = &protocolx.GetRoleResponse{}
rsp = &query.GetRoleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -122,11 +123,11 @@ func (svr *RoleService) GetRole(header *protocol.RequestHeader, request *protoco
return
}
func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *protocolx.DeleteRoleRequest) (rsp interface{}, err error) {
func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *command.DeleteRoleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteRoleResponse{}
rsp = &command.DeleteRoleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
return
... ... @@ -156,11 +157,11 @@ func (svr *RoleService) DeleteRole(header *protocol.RequestHeader, request *prot
return
}
func (svr *RoleService) ListRole(header *protocol.RequestHeader, request *protocolx.ListRoleRequest) (rsp interface{}, err error) {
func (svr *RoleService) ListRole(header *protocol.RequestHeader, request *query.ListRoleRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.ListRoleResponse{}
rsp = &query.ListRoleResponse{}
if err = request.ValidateCommand(); err != nil {
err = protocol.NewCustomMessage(2, err.Error())
}
... ...
package user
package service
import (
"crypto/sha1"
... ... @@ -7,10 +7,11 @@ import (
"github.com/tiptok/gocomm/common"
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/factory"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/user"
"strings"
"time"
)
... ... @@ -18,11 +19,11 @@ import (
type UserService struct {
}
func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *protocolx.CreateUserRequest) (rsp interface{}, err error) {
func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *command.CreateUserRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.CreateUserResponse{}
rsp = &command.CreateUserResponse{}
if err = request.ValidateCommand(); err != nil {
err = application.ThrowError(application.ARG_ERROR, err.Error())
return
... ... @@ -52,7 +53,7 @@ func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *prot
}
}
if len(newUser.Passwd) == 0 {
newUser.Passwd = fmt.Sprintf("%x", sha1.Sum([]byte("123456")))
newUser.Passwd = fmt.Sprintf("%x", sha1.Sum([]byte("mmm123456")))
}
if m, e := UserRepository.Save(newUser); e != nil {
err = application.ThrowError(application.INTERNAL_SERVER_ERROR, e.Error())
... ... @@ -67,11 +68,11 @@ func (svr *UserService) CreateUser(header *protocol.RequestHeader, request *prot
return
}
func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *protocolx.UpdateUserRequest) (rsp interface{}, err error) {
func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *command.UpdateUserRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.UpdateUserResponse{}
rsp = &command.UpdateUserResponse{}
if err = request.ValidateCommand(); err != nil {
err = application.ThrowError(application.ARG_ERROR, err.Error())
return
... ... @@ -112,12 +113,12 @@ func (svr *UserService) UpdateUser(header *protocol.RequestHeader, request *prot
return
}
func (svr *UserService) GetUser(header *protocol.RequestHeader, request *protocolx.GetUserRequest) (rsp interface{}, err error) {
func (svr *UserService) GetUser(header *protocol.RequestHeader, request *query.GetUserRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
RoleRepository, _ = factory.CreateRoleRepository(transactionContext)
)
rsp = &protocolx.GetUserResponse{}
rsp = &query.GetUserResponse{}
if err = request.ValidateCommand(); err != nil {
err = application.ThrowError(application.ARG_ERROR, err.Error())
return
... ... @@ -152,11 +153,11 @@ func (svr *UserService) GetUser(header *protocol.RequestHeader, request *protoco
return
}
func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *protocolx.DeleteUserRequest) (rsp interface{}, err error) {
func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *command.DeleteUserRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
)
rsp = &protocolx.DeleteUserResponse{}
rsp = &command.DeleteUserResponse{}
if err = request.ValidateCommand(); err != nil {
err = application.ThrowError(application.ARG_ERROR, err.Error())
return
... ... @@ -187,12 +188,12 @@ func (svr *UserService) DeleteUser(header *protocol.RequestHeader, request *prot
return
}
func (svr *UserService) ListUser(header *protocol.RequestHeader, request *protocolx.ListUserRequest) (rsp interface{}, err error) {
func (svr *UserService) ListUser(header *protocol.RequestHeader, request *query.ListUserRequest) (rsp interface{}, err error) {
var (
transactionContext, _ = factory.CreateTransactionContext(nil)
RoleRepository, _ = factory.CreateRoleRepository(transactionContext)
)
rsp = &protocolx.ListUserResponse{}
rsp = &query.ListUserResponse{}
if err = request.ValidateCommand(); err != nil {
err = application.ThrowError(application.TRANSACTION_ERROR, err.Error())
return
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/access/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/access"
)
type AccessController struct {
... ... @@ -16,8 +17,8 @@ type AccessController struct {
func (this *AccessController) CreateAccess() {
var (
msg *protocol.ResponseMessage
svr = access.NewAccessService(nil)
request *protocolx.CreateAccessRequest
svr = service.NewAccessService(nil)
request *command.CreateAccessRequest
)
defer func() {
this.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (this *AccessController) CreateAccess() {
func (this *AccessController) UpdateAccess() {
var (
msg *protocol.ResponseMessage
svr = access.NewAccessService(nil)
request *protocolx.UpdateAccessRequest
svr = service.NewAccessService(nil)
request *command.UpdateAccessRequest
)
defer func() {
this.Resp(msg)
... ... @@ -62,8 +63,8 @@ func (this *AccessController) UpdateAccess() {
func (this *AccessController) GetAccess() {
var (
msg *protocol.ResponseMessage
svr = access.NewAccessService(nil)
request *protocolx.GetAccessRequest
svr = service.NewAccessService(nil)
request *query.GetAccessRequest
)
defer func() {
this.Resp(msg)
... ... @@ -85,8 +86,8 @@ func (this *AccessController) GetAccess() {
func (this *AccessController) DeleteAccess() {
var (
msg *protocol.ResponseMessage
svr = access.NewAccessService(nil)
request *protocolx.DeleteAccessRequest
svr = service.NewAccessService(nil)
request *command.DeleteAccessRequest
)
defer func() {
this.Resp(msg)
... ... @@ -108,8 +109,8 @@ func (this *AccessController) DeleteAccess() {
func (this *AccessController) ListAccess() {
var (
msg *protocol.ResponseMessage
svr = access.NewAccessService(nil)
request *protocolx.ListAccessRequest
svr = service.NewAccessService(nil)
request *query.ListAccessRequest
)
defer func() {
this.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/auth/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/auth"
)
type AuthController struct {
... ... @@ -16,8 +17,8 @@ type AuthController struct {
func (controller *AuthController) Login() {
var (
msg *protocol.ResponseMessage
svr = auth.NewAuthService(nil)
request *protocolx.LoginRequest
svr = service.NewAuthService(nil)
request *command.LoginRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (controller *AuthController) Login() {
func (controller *AuthController) Logout() {
var (
msg *protocol.ResponseMessage
svr = auth.NewAuthService(nil)
request *protocolx.LogoutRequest
svr = service.NewAuthService(nil)
request *command.LogoutRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -62,8 +63,8 @@ func (controller *AuthController) Logout() {
func (controller *AuthController) Refresh() {
var (
msg *protocol.ResponseMessage
svr = auth.NewAuthService(nil)
request = &protocolx.RefreshRequest{}
svr = service.NewAuthService(nil)
request = &command.RefreshRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -87,8 +88,8 @@ func (controller *AuthController) Refresh() {
func (controller *AuthController) Profile() {
var (
msg *protocol.ResponseMessage
svr = auth.NewAuthService(nil)
request = &protocolx.ProfileRequest{}
svr = service.NewAuthService(nil)
request = &command.ProfileRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -107,8 +108,8 @@ func (controller *AuthController) Profile() {
func (controller *AuthController) CaptchaInit() {
var (
msg *protocol.ResponseMessage
svr = auth.NewAuthService(nil)
request = &protocolx.CaptchaInitRequest{}
svr = service.NewAuthService(nil)
request = &query.CaptchaInitRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -127,8 +128,8 @@ func (controller *AuthController) CaptchaInit() {
func (controller *AuthController) ChangePassword() {
var (
msg *protocol.ResponseMessage
svr = auth.NewAuthService(nil)
request *protocolx.ChangePasswordRequest
svr = service.NewAuthService(nil)
request *command.ChangePasswordRequest
)
defer func() {
controller.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/client_version"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/clientVersion/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/client_version"
)
type ClientVersionController struct {
... ... @@ -16,8 +17,8 @@ type ClientVersionController struct {
func (controller *ClientVersionController) CreateClientVersion() {
var (
msg *protocol.ResponseMessage
svr = client_version.NewClientVersionService(nil)
request *protocolx.CreateClientVersionRequest
svr = service.NewClientVersionService(nil)
request *command.CreateClientVersionRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (controller *ClientVersionController) CreateClientVersion() {
func (controller *ClientVersionController) UpdateClientVersion() {
var (
msg *protocol.ResponseMessage
svr = client_version.NewClientVersionService(nil)
request = &protocolx.UpdateClientVersionRequest{}
svr = service.NewClientVersionService(nil)
request = &command.UpdateClientVersionRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -63,8 +64,8 @@ func (controller *ClientVersionController) UpdateClientVersion() {
func (controller *ClientVersionController) GetClientVersion() {
var (
msg *protocol.ResponseMessage
svr = client_version.NewClientVersionService(nil)
request = &protocolx.GetClientVersionRequest{}
svr = service.NewClientVersionService(nil)
request = &query.GetClientVersionRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -83,8 +84,8 @@ func (controller *ClientVersionController) GetClientVersion() {
func (controller *ClientVersionController) DeleteClientVersion() {
var (
msg *protocol.ResponseMessage
svr = client_version.NewClientVersionService(nil)
request = &protocolx.DeleteClientVersionRequest{}
svr = service.NewClientVersionService(nil)
request = &command.DeleteClientVersionRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -103,8 +104,8 @@ func (controller *ClientVersionController) DeleteClientVersion() {
func (controller *ClientVersionController) ListClientVersion() {
var (
msg *protocol.ResponseMessage
svr = client_version.NewClientVersionService(nil)
request = &protocolx.ListClientVersionRequest{}
svr = service.NewClientVersionService(nil)
request = &query.ListClientVersionRequest{}
)
defer func() {
controller.Resp(msg)
... ...
package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/menu"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/menu"
)
type MenuController struct {
BaseController
}
// CreateMenu
// CreateMenu execute command create Menu
func (this *MenuController) CreateMenu() {
var (
msg *protocol.ResponseMessage
svr = menu.NewMenuService(nil)
request *protocolx.CreateMenuRequest
)
defer func() {
this.Resp(msg)
}()
if err := this.JsonUnmarshal(&request); err != nil {
msg = protocol.NewResponseMessage(2, "")
return
}
header := this.GetRequestHeader(this.Ctx)
data, err := svr.CreateMenu(header, request)
if err != nil {
log.Error(err)
}
msg = protocol.NewResponseMessageData(data, err)
}
// UpdateMenu
// UpdateMenu execute command update Menu
func (this *MenuController) UpdateMenu() {
var (
msg *protocol.ResponseMessage
svr = menu.NewMenuService(nil)
request *protocolx.UpdateMenuRequest
)
defer func() {
this.Resp(msg)
}()
if err := this.JsonUnmarshal(&request); err != nil {
msg = protocol.NewResponseMessage(2, "")
return
}
header := this.GetRequestHeader(this.Ctx)
data, err := svr.UpdateMenu(header, request)
if err != nil {
log.Error(err)
}
msg = protocol.NewResponseMessageData(data, err)
}
// GetMenu
// GetMenu execute query get Menu
func (this *MenuController) GetMenu() {
var (
msg *protocol.ResponseMessage
svr = menu.NewMenuService(nil)
request *protocolx.GetMenuRequest
)
defer func() {
this.Resp(msg)
}()
if err := this.JsonUnmarshal(&request); err != nil {
msg = protocol.NewResponseMessage(2, "")
return
}
header := this.GetRequestHeader(this.Ctx)
data, err := svr.GetMenu(header, request)
if err != nil {
log.Error(err)
}
msg = protocol.NewResponseMessageData(data, err)
}
// DeleteMenu
// DeleteMenu execute command delete Menu
func (this *MenuController) DeleteMenu() {
var (
msg *protocol.ResponseMessage
svr = menu.NewMenuService(nil)
request *protocolx.DeleteMenuRequest
)
defer func() {
this.Resp(msg)
}()
if err := this.JsonUnmarshal(&request); err != nil {
msg = protocol.NewResponseMessage(2, "")
return
}
header := this.GetRequestHeader(this.Ctx)
data, err := svr.DeleteMenu(header, request)
if err != nil {
log.Error(err)
}
msg = protocol.NewResponseMessageData(data, err)
}
// ListMenu
// ListMenu execute query list Menu
func (this *MenuController) ListMenu() {
var (
msg *protocol.ResponseMessage
svr = menu.NewMenuService(nil)
request *protocolx.ListMenuRequest
)
defer func() {
this.Resp(msg)
}()
if err := this.JsonUnmarshal(&request); err != nil {
msg = protocol.NewResponseMessage(2, "")
return
}
header := this.GetRequestHeader(this.Ctx)
data, err := svr.ListMenu(header, request)
if err != nil {
log.Error(err)
}
msg = protocol.NewResponseMessageData(data, err)
}
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operator_log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/operatorLog/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/operator_log"
)
type OperatorLogController struct {
... ... @@ -16,8 +17,8 @@ type OperatorLogController struct {
func (controller *OperatorLogController) CreateOperatorLog() {
var (
msg *protocol.ResponseMessage
svr = operator_log.NewOperatorLogService(nil)
request *protocolx.CreateOperatorLogRequest
svr = service.NewOperatorLogService(nil)
request *command.CreateOperatorLogRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (controller *OperatorLogController) CreateOperatorLog() {
func (controller *OperatorLogController) UpdateOperatorLog() {
var (
msg *protocol.ResponseMessage
svr = operator_log.NewOperatorLogService(nil)
request *protocolx.UpdateOperatorLogRequest
svr = service.NewOperatorLogService(nil)
request *command.UpdateOperatorLogRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -62,8 +63,8 @@ func (controller *OperatorLogController) UpdateOperatorLog() {
func (controller *OperatorLogController) GetOperatorLog() {
var (
msg *protocol.ResponseMessage
svr = operator_log.NewOperatorLogService(nil)
request *protocolx.GetOperatorLogRequest
svr = service.NewOperatorLogService(nil)
request *query.GetOperatorLogRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -85,8 +86,8 @@ func (controller *OperatorLogController) GetOperatorLog() {
func (controller *OperatorLogController) DeleteOperatorLog() {
var (
msg *protocol.ResponseMessage
svr = operator_log.NewOperatorLogService(nil)
request *protocolx.DeleteOperatorLogRequest
svr = service.NewOperatorLogService(nil)
request *command.DeleteOperatorLogRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -108,8 +109,8 @@ func (controller *OperatorLogController) DeleteOperatorLog() {
func (controller *OperatorLogController) ListOperatorLog() {
var (
msg *protocol.ResponseMessage
svr = operator_log.NewOperatorLogService(nil)
request = &protocolx.ListOperatorLogRequest{}
svr = service.NewOperatorLogService(nil)
request = &query.ListOperatorLogRequest{}
)
defer func() {
controller.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModule/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module"
)
type ProjectModuleController struct {
... ... @@ -16,8 +17,8 @@ type ProjectModuleController struct {
func (controller *ProjectModuleController) CreateProjectModule() {
var (
msg *protocol.ResponseMessage
svr = project_module.NewProjectModuleService(nil)
request *protocolx.CreateProjectModuleRequest
svr = service.NewProjectModuleService(nil)
request *command.CreateProjectModuleRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (controller *ProjectModuleController) CreateProjectModule() {
func (controller *ProjectModuleController) UpdateProjectModule() {
var (
msg *protocol.ResponseMessage
svr = project_module.NewProjectModuleService(nil)
request *protocolx.UpdateProjectModuleRequest
svr = service.NewProjectModuleService(nil)
request *command.UpdateProjectModuleRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -63,8 +64,8 @@ func (controller *ProjectModuleController) UpdateProjectModule() {
func (controller *ProjectModuleController) GetProjectModule() {
var (
msg *protocol.ResponseMessage
svr = project_module.NewProjectModuleService(nil)
request = &protocolx.GetProjectModuleRequest{}
svr = service.NewProjectModuleService(nil)
request = &query.GetProjectModuleRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -83,8 +84,8 @@ func (controller *ProjectModuleController) GetProjectModule() {
func (controller *ProjectModuleController) DeleteProjectModule() {
var (
msg *protocol.ResponseMessage
svr = project_module.NewProjectModuleService(nil)
request = &protocolx.DeleteProjectModuleRequest{}
svr = service.NewProjectModuleService(nil)
request = &command.DeleteProjectModuleRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -103,8 +104,8 @@ func (controller *ProjectModuleController) DeleteProjectModule() {
func (controller *ProjectModuleController) ListProjectModule() {
var (
msg *protocol.ResponseMessage
svr = project_module.NewProjectModuleService(nil)
request = &protocolx.ListProjectModuleRequest{}
svr = service.NewProjectModuleService(nil)
request = &query.ListProjectModuleRequest{}
)
defer func() {
controller.Resp(msg)
... ...
... ... @@ -2,10 +2,11 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module_files"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleFiles/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/infrastructure/utils"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_files"
)
type ProjectModuleFilesController struct {
... ... @@ -17,8 +18,8 @@ type ProjectModuleFilesController struct {
func (controller *ProjectModuleFilesController) CreateProjectModuleFiles() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request *protocolx.CreateProjectModuleFilesRequest
svr = service.NewProjectModuleFilesService(nil)
request *command.CreateProjectModuleFilesRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -40,8 +41,8 @@ func (controller *ProjectModuleFilesController) CreateProjectModuleFiles() {
func (controller *ProjectModuleFilesController) UpdateProjectModuleFiles() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request *protocolx.UpdateProjectModuleFilesRequest
svr = service.NewProjectModuleFilesService(nil)
request *command.UpdateProjectModuleFilesRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -64,8 +65,8 @@ func (controller *ProjectModuleFilesController) UpdateProjectModuleFiles() {
func (controller *ProjectModuleFilesController) GetProjectModuleFiles() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request = &protocolx.GetProjectModuleFilesRequest{}
svr = service.NewProjectModuleFilesService(nil)
request = &query.GetProjectModuleFilesRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -84,8 +85,8 @@ func (controller *ProjectModuleFilesController) GetProjectModuleFiles() {
func (controller *ProjectModuleFilesController) DeleteProjectModuleFiles() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request = &protocolx.DeleteProjectModuleFilesRequest{}
svr = service.NewProjectModuleFilesService(nil)
request = &command.DeleteProjectModuleFilesRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -104,8 +105,8 @@ func (controller *ProjectModuleFilesController) DeleteProjectModuleFiles() {
func (controller *ProjectModuleFilesController) ListProjectModuleFiles() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request = &protocolx.ListProjectModuleFilesRequest{}
svr = service.NewProjectModuleFilesService(nil)
request = &query.ListProjectModuleFilesRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -130,8 +131,8 @@ func (controller *ProjectModuleFilesController) ListProjectModuleFiles() {
func (controller *ProjectModuleFilesController) Import() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request = &protocolx.ImportRequest{}
svr = service.NewProjectModuleFilesService(nil)
request = &command.ImportRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -141,7 +142,7 @@ func (controller *ProjectModuleFilesController) Import() {
request.ProjectModuleVersionId, _ = controller.GetInt64("projectModuleVersionId")
request.ParentId, _ = controller.GetInt64("parentId")
for _, v := range utils.ReadMultipartFormFile(controller.Ctx.Request.MultipartForm.File, 5*1024) {
request.ImportFiles = append(request.ImportFiles, protocolx.ImportFile{
request.ImportFiles = append(request.ImportFiles, command.ImportFile{
FileName: v.FileName,
FileContent: v.FileContent,
})
... ... @@ -158,8 +159,8 @@ func (controller *ProjectModuleFilesController) Import() {
func (controller *ProjectModuleFilesController) ReviseTag() {
var (
msg *protocol.ResponseMessage
svr = project_module_files.NewProjectModuleFilesService(nil)
request = &protocolx.ReviseTagRequest{}
svr = service.NewProjectModuleFilesService(nil)
request = &command.ReviseTagRequest{}
)
defer func() {
controller.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/project_module_version"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/projectModuleVersion/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/project_module_version"
)
type ProjectModuleVersionController struct {
... ... @@ -16,8 +17,8 @@ type ProjectModuleVersionController struct {
func (this *ProjectModuleVersionController) CreateProjectModuleVersion() {
var (
msg *protocol.ResponseMessage
svr = project_module_version.NewProjectModuleVersionService(nil)
request *protocolx.CreateProjectModuleVersionRequest
svr = service.NewProjectModuleVersionService(nil)
request *command.CreateProjectModuleVersionRequest
)
defer func() {
this.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (this *ProjectModuleVersionController) CreateProjectModuleVersion() {
func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() {
var (
msg *protocol.ResponseMessage
svr = project_module_version.NewProjectModuleVersionService(nil)
request *protocolx.UpdateProjectModuleVersionRequest
svr = service.NewProjectModuleVersionService(nil)
request *command.UpdateProjectModuleVersionRequest
)
defer func() {
this.Resp(msg)
... ... @@ -63,8 +64,8 @@ func (this *ProjectModuleVersionController) UpdateProjectModuleVersion() {
func (this *ProjectModuleVersionController) GetProjectModuleVersion() {
var (
msg *protocol.ResponseMessage
svr = project_module_version.NewProjectModuleVersionService(nil)
request = &protocolx.GetProjectModuleVersionRequest{}
svr = service.NewProjectModuleVersionService(nil)
request = &query.GetProjectModuleVersionRequest{}
)
defer func() {
this.Resp(msg)
... ... @@ -83,8 +84,8 @@ func (this *ProjectModuleVersionController) GetProjectModuleVersion() {
func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() {
var (
msg *protocol.ResponseMessage
svr = project_module_version.NewProjectModuleVersionService(nil)
request = &protocolx.DeleteProjectModuleVersionRequest{}
svr = service.NewProjectModuleVersionService(nil)
request = &command.DeleteProjectModuleVersionRequest{}
)
defer func() {
this.Resp(msg)
... ... @@ -103,8 +104,8 @@ func (this *ProjectModuleVersionController) DeleteProjectModuleVersion() {
func (this *ProjectModuleVersionController) ListProjectModuleVersion() {
var (
msg *protocol.ResponseMessage
svr = project_module_version.NewProjectModuleVersionService(nil)
request = &protocolx.ListProjectModuleVersionRequest{}
svr = service.NewProjectModuleVersionService(nil)
request = &query.ListProjectModuleVersionRequest{}
)
defer func() {
this.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/rbac/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/rbac"
)
type RbacController struct {
... ... @@ -16,8 +17,8 @@ type RbacController struct {
func (this *RbacController) Access() {
var (
msg *protocol.ResponseMessage
svr = rbac.NewRbacService(nil)
request *protocolx.AccessRequest
svr = service.NewRbacService(nil)
request *query.AccessRequest
)
defer func() {
this.Resp(msg)
... ... @@ -35,8 +36,8 @@ func (this *RbacController) Access() {
func (this *RbacController) RoleAccess() {
var (
msg *protocol.ResponseMessage
svr = rbac.NewRbacService(nil)
request = &protocolx.RoleAccessRequest{}
svr = service.NewRbacService(nil)
request = &query.RoleAccessRequest{}
)
defer func() {
this.Resp(msg)
... ... @@ -55,8 +56,8 @@ func (this *RbacController) RoleAccess() {
func (this *RbacController) SetRoleAccess() {
var (
msg *protocol.ResponseMessage
svr = rbac.NewRbacService(nil)
request *protocolx.SetRoleAccessRequest
svr = service.NewRbacService(nil)
request *command.SetRoleAccessRequest
)
defer func() {
this.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/role/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/role"
)
type RoleController struct {
... ... @@ -16,8 +17,8 @@ type RoleController struct {
func (this *RoleController) CreateRole() {
var (
msg *protocol.ResponseMessage
svr = role.NewRoleService(nil)
request *protocolx.CreateRoleRequest
svr = service.NewRoleService(nil)
request *command.CreateRoleRequest
)
defer func() {
this.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (this *RoleController) CreateRole() {
func (this *RoleController) UpdateRole() {
var (
msg *protocol.ResponseMessage
svr = role.NewRoleService(nil)
request *protocolx.UpdateRoleRequest
svr = service.NewRoleService(nil)
request *command.UpdateRoleRequest
)
defer func() {
this.Resp(msg)
... ... @@ -63,8 +64,8 @@ func (this *RoleController) UpdateRole() {
func (this *RoleController) GetRole() {
var (
msg *protocol.ResponseMessage
svr = role.NewRoleService(nil)
request = &protocolx.GetRoleRequest{}
svr = service.NewRoleService(nil)
request = &query.GetRoleRequest{}
)
defer func() {
this.Resp(msg)
... ... @@ -87,8 +88,8 @@ func (this *RoleController) GetRole() {
func (this *RoleController) DeleteRole() {
var (
msg *protocol.ResponseMessage
svr = role.NewRoleService(nil)
request = &protocolx.DeleteRoleRequest{}
svr = service.NewRoleService(nil)
request = &command.DeleteRoleRequest{}
)
defer func() {
this.Resp(msg)
... ... @@ -107,8 +108,8 @@ func (this *RoleController) DeleteRole() {
func (this *RoleController) ListRole() {
var (
msg *protocol.ResponseMessage
svr = role.NewRoleService(nil)
request *protocolx.ListRoleRequest
svr = service.NewRoleService(nil)
request *query.ListRoleRequest
)
defer func() {
this.Resp(msg)
... ...
... ... @@ -2,9 +2,10 @@ package controllers
import (
"github.com/tiptok/gocomm/pkg/log"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/command"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/query"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/application/user/service"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol"
protocolx "gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/protocol/user"
)
type UserController struct {
... ... @@ -16,8 +17,8 @@ type UserController struct {
func (controller *UserController) CreateUser() {
var (
msg *protocol.ResponseMessage
svr = user.NewUserService(nil)
request *protocolx.CreateUserRequest
svr = service.NewUserService(nil)
request *command.CreateUserRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -39,8 +40,8 @@ func (controller *UserController) CreateUser() {
func (controller *UserController) UpdateUser() {
var (
msg *protocol.ResponseMessage
svr = user.NewUserService(nil)
request *protocolx.UpdateUserRequest
svr = service.NewUserService(nil)
request *command.UpdateUserRequest
)
defer func() {
controller.Resp(msg)
... ... @@ -63,8 +64,8 @@ func (controller *UserController) UpdateUser() {
func (controller *UserController) GetUser() {
var (
msg *protocol.ResponseMessage
svr = user.NewUserService(nil)
request = &protocolx.GetUserRequest{}
svr = service.NewUserService(nil)
request = &query.GetUserRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -83,8 +84,8 @@ func (controller *UserController) GetUser() {
func (controller *UserController) DeleteUser() {
var (
msg *protocol.ResponseMessage
svr = user.NewUserService(nil)
request = &protocolx.DeleteUserRequest{}
svr = service.NewUserService(nil)
request = &command.DeleteUserRequest{}
)
defer func() {
controller.Resp(msg)
... ... @@ -103,8 +104,8 @@ func (controller *UserController) DeleteUser() {
func (controller *UserController) ListUser() {
var (
msg *protocol.ResponseMessage
svr = user.NewUserService(nil)
request = &protocolx.ListUserRequest{}
svr = service.NewUserService(nil)
request = &query.ListUserRequest{}
)
defer func() {
controller.Resp(msg)
... ...
package routers
import (
"github.com/astaxie/beego"
"gitlab.fjmaimaimai.com/mmm-go/godevp/pkg/port/beego/controllers"
)
func init() {
beego.Router("/v1/menu/", &controllers.MenuController{}, "POST:CreateMenu")
beego.Router("/v1/menu/:menuId", &controllers.MenuController{}, "PUT:UpdateMenu")
beego.Router("/v1/menu/:menuId", &controllers.MenuController{}, "GET:GetMenu")
beego.Router("/v1/menu/:menuId", &controllers.MenuController{}, "DELETE:DeleteMenu")
beego.Router("/v1/menu/", &controllers.MenuController{}, "GET:ListMenu")
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type CreateMenuRequest struct {
// 菜单名称
MenuName string `json:"menuName,omitempty"`
// 菜单编码
MenuCode string `json:"menuCode,omitempty"`
// 图标
Icon string `json:"icon,omitempty"`
// 排序
Sort int `json:"sort,omitempty"`
// 是否隐藏: 1:隐藏 0:显示
Hidden bool `json:"hidden,omitempty"`
}
func (CreateMenuRequest *CreateMenuRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(CreateMenuRequest)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type CreateMenuResponse struct {
}
func (CreateMenuResponse *CreateMenuResponse) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(CreateMenuResponse)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type DeleteMenuRequest struct {
// 唯一标识
Id int64 `json:"id,omitempty"`
}
func (DeleteMenuRequest *DeleteMenuRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(DeleteMenuRequest)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type DeleteMenuResponse struct {
}
func (DeleteMenuResponse *DeleteMenuResponse) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(DeleteMenuResponse)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type UpdateMenuRequest struct {
// 菜单名称
MenuName string `json:"menuName,omitempty"`
// 菜单编码
MenuCode string `json:"menuCode,omitempty"`
// 图标
Icon string `json:"icon,omitempty"`
// 排序
Sort int `json:"sort,omitempty"`
// 是否隐藏: 1:隐藏 0:显示
Hidden bool `json:"hidden,omitempty"`
}
func (UpdateMenuRequest *UpdateMenuRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(UpdateMenuRequest)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type UpdateMenuResponse struct {
}
func (UpdateMenuResponse *UpdateMenuResponse) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(UpdateMenuResponse)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type GetMenuRequest struct {
// 唯一标识
Id int64 `json:"id,omitempty"`
}
func (GetMenuRequest *GetMenuRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(GetMenuRequest)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type GetMenuResponse struct {
}
func (GetMenuResponse *GetMenuResponse) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(GetMenuResponse)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type ListMenuRequest struct {
}
func (ListMenuRequest *ListMenuRequest) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(ListMenuRequest)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}
package menu
import (
"fmt"
"github.com/astaxie/beego/validation"
)
type ListMenuResponse struct {
}
func (ListMenuResponse *ListMenuResponse) ValidateCommand() error {
valid := validation.Validation{}
b, err := valid.Valid(ListMenuResponse)
if err != nil {
return err
}
if !b {
for _, validErr := range valid.Errors {
return fmt.Errorf("%s %s", validErr.Key, validErr.Message)
}
}
return nil
}