statistics_person.go
2.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
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/infrastructure/service_gateway/allied_creation_cooperation"
)
// 个人端统计 【0%】
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())
//}
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 共创用户-共创企业统计
func (srv PersonStatisticsService) CompanyStatistics(userMenusCommand *command.CooperationPersonStatisticsCommand) (interface{}, error) {
var values []interface{}
values = append(values, map[string]interface{}{
"company": map[string]interface{}{
"companyId": 5,
"companyName": "机会平台",
},
"cooperationProjectCount": 10,
"cooperationContractCount": 5,
"dividendsRatio": 50,
"dividendsIncome": 10009965,
})
values = append(values, map[string]interface{}{
"company": map[string]interface{}{
"companyId": 6,
"companyName": "机会平台2",
},
"cooperationProjectCount": 10,
"cooperationContractCount": 5,
"dividendsRatio": 50,
"dividendsIncome": 10009965,
})
return map[string]interface{}{
"list": values,
}, nil
}
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
creationCooperationGateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
projectQuery.Operator)
result, err := creationCooperationGateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
PageNumber: projectQuery.PageNumber,
PageSize: projectQuery.PageSize,
})
if err != nil {
return 0, nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error())
}
return int64(result.Total), result.List, nil
}