...
|
...
|
@@ -2,13 +2,14 @@ package service |
|
|
|
|
|
import (
|
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"github.com/linmadan/egglib-go/utils/json"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_cooperation"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/infrastructure/service_gateway/allied_creation_user"
|
|
|
)
|
|
|
|
|
|
// 企业端统计 【25%】
|
|
|
// 企业端统计
|
|
|
type CompanyStatisticsService struct {
|
|
|
}
|
|
|
|
...
|
...
|
@@ -142,7 +143,44 @@ func (srv CompanyStatisticsService) CooperationDividendsStatistics(cmd *command. |
|
|
return 0, cooperationUsersStatistics, nil
|
|
|
}
|
|
|
|
|
|
// CooperationPersonStatistics TODO:共创人员统计(共创人员明细)
|
|
|
func (srv CompanyStatisticsService) CooperationPersonStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
|
|
|
return map[string]interface{}{}, nil
|
|
|
// CooperationPersonStatistics 共创人明细员统计(共创人员明细)
|
|
|
func (srv CompanyStatisticsService) CooperationPersonStatistics(cmd *command.CooperationPersonStatisticsCommand) (interface{}, error) {
|
|
|
gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cmd.Operator)
|
|
|
user, err := gatewayUser.UserGet(allied_creation_user.ReqGetUser{
|
|
|
UserId: cmd.UserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
cmd.Operator)
|
|
|
cooperationUserModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationUserModeStatistics, map[string]interface{}{
|
|
|
"userId": cmd.UserId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
var modeStatistics = struct {
|
|
|
CooperationTypes interface{} `json:"cooperationTypes"`
|
|
|
DividendsDetails interface{} `json:"dividendsDetails"`
|
|
|
OrderDetails interface{} `json:"orderDetails"`
|
|
|
}{}
|
|
|
|
|
|
if err := json.UnmarshalFromString(json.MarshalToString(cooperationUserModeStatistics), &modeStatistics); err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
var response = map[string]interface{}{
|
|
|
"userName": user.UserInfo.UserName,
|
|
|
"cooperationTime": user.CreatedAt.Unix() * 1000,
|
|
|
"cooperationTypes": modeStatistics.CooperationTypes,
|
|
|
"dividendsDetails": modeStatistics.DividendsDetails,
|
|
|
"orderDetails": modeStatistics.OrderDetails,
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"cooperationPersonStatistics": response,
|
|
|
}, nil
|
|
|
} |
...
|
...
|
|