...
|
...
|
@@ -3,7 +3,9 @@ package service |
|
|
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/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"
|
|
|
)
|
|
|
|
|
|
// 个人端统计 【0%】
|
...
|
...
|
@@ -11,27 +13,65 @@ type PersonStatisticsService struct { |
|
|
}
|
|
|
|
|
|
// IndexStatistics TODO:个人端 - 首页统计 (入口页面统计数据)
|
|
|
func (srv PersonStatisticsService) IndexStatistics(userMenusCommand *command.IndexStatisticsCommand) (interface{}, error) {
|
|
|
//creationUserGateway := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
// userMenusCommand.Operator)
|
|
|
//resultMenu, err := creationUserGateway.UserAccessMenus(allied_creation_user.ReqUserAccessMenus{
|
|
|
// UserId: int(userMenusCommand.Operator.UserId),
|
|
|
//})
|
|
|
//if err != nil {
|
|
|
// return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
//}
|
|
|
func (srv PersonStatisticsService) IndexStatistics(cmd *command.IndexStatisticsCommand) (interface{}, error) {
|
|
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
cmd.Operator)
|
|
|
// 项目概览统计
|
|
|
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
|
|
|
PageNumber: 1,
|
|
|
PageSize: 1,
|
|
|
UserBaseId: cmd.Operator.UserBaseId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
// 项目概览统计
|
|
|
stoppedContracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
|
|
|
PageNumber: 1,
|
|
|
PageSize: 1,
|
|
|
Status: 2,
|
|
|
UserBaseId: cmd.Operator.UserBaseId,
|
|
|
})
|
|
|
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,
|
|
|
UserType: domain.UserTypeCooperation,
|
|
|
UserBaseId: cmd.Operator.UserBaseId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
var overview = map[string]interface{}{
|
|
|
"contractSum": contracts.Grid.Total,
|
|
|
"contractStoppedSum": stoppedContracts.Grid.Total,
|
|
|
"companySum": users.Count,
|
|
|
}
|
|
|
return map[string]interface{}{
|
|
|
"overview": map[string]interface{}{
|
|
|
"contractSum": 60,
|
|
|
"contractStoppedSum": 70,
|
|
|
"companySum": 6,
|
|
|
},
|
|
|
"overview": overview,
|
|
|
"dividendStatistics": map[string]interface{}{
|
|
|
"dividendAmount": 9000,
|
|
|
"paidAmount": 2000,
|
|
|
"unPaidAmount": 7000,
|
|
|
},
|
|
|
}, nil
|
|
|
|
|
|
//return map[string]interface{}{
|
|
|
// "overview": map[string]interface{}{
|
|
|
// "contractSum": 60,
|
|
|
// "contractStoppedSum": 70,
|
|
|
// "companySum": 6,
|
|
|
// },
|
|
|
// "dividendStatistics": map[string]interface{}{
|
|
|
// "dividendAmount": 9000,
|
|
|
// "paidAmount": 2000,
|
|
|
// "unPaidAmount": 7000,
|
|
|
// },
|
|
|
//}, nil
|
|
|
}
|
|
|
|
|
|
// CompanyStatistics 共创用户-共创企业统计
|
...
|
...
|
|