...
|
...
|
@@ -5,7 +5,9 @@ import ( |
|
|
"github.com/linmadan/egglib-go/core/application"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/command"
|
|
|
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-gateway/pkg/application/mobile/cooperation/dto"
|
|
|
"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"
|
|
|
"math/rand"
|
|
|
"time"
|
|
|
)
|
...
|
...
|
@@ -48,10 +50,62 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics |
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 模式列表
|
|
|
models, err := gateway.CooperationModeList(allied_creation_cooperation.ReqCooperationModeList{
|
|
|
PageSize: 20,
|
|
|
PageNumber: 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var cooperationModes []interface{}
|
|
|
for i := range models.List {
|
|
|
item := models.List[i]
|
|
|
cooperationModes = append(cooperationModes, map[string]interface{}{
|
|
|
"cooperationModeId": item.CooperationModeId,
|
|
|
"cooperationModeName": item.CooperationModeName,
|
|
|
"cooperationModeNumber": item.CooperationModeNumber,
|
|
|
})
|
|
|
}
|
|
|
// 项目概览统计
|
|
|
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
|
|
|
PageNumber: 1,
|
|
|
PageSize: 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
|
|
|
PageNumber: 1,
|
|
|
PageSize: 1,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
cmd.Operator)
|
|
|
users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{
|
|
|
Limit: 1,
|
|
|
Offset: 0,
|
|
|
CompanyId: cmd.Operator.CompanyId,
|
|
|
OrganizationId: cmd.Operator.OrgId,
|
|
|
UserType: domain.UserTypeCooperation,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var projectOverviewStatistics = map[string]interface{}{
|
|
|
"contractSum": contracts.Grid.Total,
|
|
|
"cooperationUserCount": users.Count,
|
|
|
"projectSum": projects.Total,
|
|
|
}
|
|
|
|
|
|
return map[string]interface{}{
|
|
|
"projectOverviewStatistics": projectOverviewStatistics,
|
|
|
"currentMonthDividendsStatistics": companyDividendsStatistics,
|
|
|
"cooperationModeStatistics": cooperationModeStatistics,
|
|
|
"CooperationGoodsStatistics": cooperationGoodsStatistics,
|
|
|
"cooperationGoodsStatistics": cooperationGoodsStatistics,
|
|
|
"cooperationModes": cooperationModes,
|
|
|
}, nil
|
|
|
}
|
|
|
|
...
|
...
|
|