company.go 2.4 KB
package service

import (
	"github.com/linmadan/egglib-go/core/application"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/command"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/web/company/query"
	"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
)

// 企业
type CompanyService struct {
}

// 创建企业
// func (companyService *CompanyService) CreateCompany(createCompanyCommand *command.CreateCompanyCommand) (interface{}, error) {
// 	return nil, nil
// }

// 返回企业
func (companyService *CompanyService) GetCompany(getCompanyQuery *query.GetCompanyQuery) (interface{}, error) {
	return nil, nil
}

// 返回企业列表
// func (companyService *CompanyService) ListCompany(listCompanyQuery *query.ListCompanyQuery) (interface{}, error) {
// 	return nil, nil
// }

// 返回自定义菜单列表(匹配有设置的菜单)
// func (companyService *CompanyService) ListCompanyCustomizeMenus(listCompanyCustomizeMenusCommand *command.ListCompanyCustomizeMenusCommand) (interface{}, error) {
// 	return nil, nil
// }

// 移除企业
// func (companyService *CompanyService) RemoveCompany(removeCompanyCommand *command.RemoveCompanyCommand) (interface{}, error) {
// 	return nil, nil
// }

// 更新企业
func (companyService *CompanyService) UpdateCompany(updateCompanyCommand *command.UpdateCompanyCommand) (interface{}, error) {
	creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(updateCompanyCommand.Operator)
	_, err := creationUserGateway.CompanyUpdate(allied_creation_user.ReqCompanyUpdate{
		CompanyId:   updateCompanyCommand.Operator.CompanyId,
		CompanyName: updateCompanyCommand.CompanyName,
		Address:     updateCompanyCommand.Address,
		SystemName:  updateCompanyCommand.SystemName,
		Logo:        updateCompanyCommand.Logo,
	})
	if err != nil {
		return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
	}
	return updateCompanyCommand, nil
}

// 更新自定义菜单
// func (companyService *CompanyService) UpdateCompanyCustomizeMenus(updateCompanyCustomizeMenusCommand *command.UpdateCompanyCustomizeMenusCommand) (interface{}, error) {
// 	return nil, nil
// }

func NewCompanyService(options map[string]interface{}) *CompanyService {
	newCompanyService := &CompanyService{}
	return newCompanyService
}