|
|
package adaptor
|
|
|
|
|
|
type UserAdaptor struct {
|
|
|
}
|
|
|
|
|
|
func (adaptor *UserAdaptor) ToRelevant() {
|
|
|
|
|
|
}
|
|
|
|
|
|
func (adaptor *UserAdaptor) ToReferrer() {
|
|
|
|
|
|
}
|
|
|
|
|
|
func (adaptor *UserAdaptor) ToSalesman() {
|
|
|
|
|
|
}
|
|
|
|
|
|
func (adaptor *UserAdaptor) ToUndertaker() {
|
|
|
import (
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/service_gateway"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/service_gateway/translator"
|
|
|
)
|
|
|
|
|
|
type UserAdaptor struct {
|
|
|
}
|
|
|
|
|
|
func (adaptor *UserAdaptor) ToOperator() {
|
|
|
|
|
|
func (adaptor *UserAdaptor) ToParticipator(companyId int64, orgId int64, userId int64, aRoleName string) (interface{}, error) {
|
|
|
userServiceGateway := service_gateway.NewHttplibUserServiceGateway()
|
|
|
response, err := userServiceGateway.GetUser(companyId, orgId, userId)
|
|
|
userTranslator := &translator.UserTranslator{}
|
|
|
if err != nil {
|
|
|
return struct{}{}, err
|
|
|
}
|
|
|
if response["code"] == 200 {
|
|
|
switch aRoleName {
|
|
|
case "Relevant":
|
|
|
relevant, err := userTranslator.ToRelevantFromRepresentation(response)
|
|
|
if err != nil {
|
|
|
return struct{}{}, err
|
|
|
}
|
|
|
return relevant, nil
|
|
|
case "Referrer":
|
|
|
referrer, err := userTranslator.ToReferrerFromRepresentation(response)
|
|
|
if err != nil {
|
|
|
return struct{}{}, err
|
|
|
}
|
|
|
return referrer, nil
|
|
|
case "Salesman":
|
|
|
salesman, err := userTranslator.ToSalesmanFromRepresentation(response)
|
|
|
if err != nil {
|
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
return salesman, nil
|
|
|
case "Undertaker":
|
|
|
undertaker, err := userTranslator.ToUndertakerFromRepresentation(response)
|
|
|
if err != nil {
|
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
return undertaker, nil
|
|
|
case "Operator":
|
|
|
operator, err := userTranslator.ToOperatorFromRepresentation(response)
|
|
|
if err != nil {
|
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
return operator, nil
|
|
|
}
|
|
|
}
|
|
|
return struct{}{}, nil
|
|
|
}
|
|
|
|
|
|
func (adaptor *UserAdaptor) UserInMenu() {
|
...
|
...
|
|