...
|
...
|
@@ -43,6 +43,95 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics |
|
|
}
|
|
|
|
|
|
// 模式列表
|
|
|
var modeStatistics = struct {
|
|
|
TotalCooperationModeStatistics interface{} `json:"totalCooperationModeStatistics"`
|
|
|
CooperationModeStatistics interface{} `json:"cooperationModeStatistics"`
|
|
|
CooperationModes interface{} `json:"cooperationModes"`
|
|
|
}{}
|
|
|
err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics)
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 项目概览统计
|
|
|
contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{
|
|
|
PageNumber: 1,
|
|
|
PageSize: 1,
|
|
|
CompanyId: cmd.Operator.CompanyId,
|
|
|
OrgId: cmd.Operator.OrgId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{
|
|
|
PageNumber: 1,
|
|
|
PageSize: 1,
|
|
|
CompanyId: cmd.Operator.CompanyId,
|
|
|
OrgId: cmd.Operator.OrgId,
|
|
|
Status: 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,
|
|
|
InEnableStatus: []int{domain.UserStatusEnable},
|
|
|
})
|
|
|
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": modeStatistics.CooperationModeStatistics,
|
|
|
"cooperationGoodsStatistics": cooperationGoodsStatistics,
|
|
|
"cooperationModes": modeStatistics.CooperationModes,
|
|
|
"totalCooperationModeStatistics": modeStatistics.TotalCooperationModeStatistics,
|
|
|
}, nil
|
|
|
}
|
|
|
|
|
|
// IndexStatistics 首页统计 (入口页面统计数据)
|
|
|
func (srv CompanyStatisticsService) IndexStatisticsBak(cmd *command.IndexStatisticsCommand) (interface{}, error) {
|
|
|
gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
cmd.Operator)
|
|
|
companyDividendsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyDividendsStatistics, map[string]interface{}{
|
|
|
"companyId": cmd.Operator.CompanyId,
|
|
|
"orgId": cmd.Operator.OrgId,
|
|
|
"action": 1, //当前月
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
cooperationModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationModeStatistics, map[string]interface{}{
|
|
|
"companyId": cmd.Operator.CompanyId,
|
|
|
"orgId": cmd.Operator.OrgId,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{
|
|
|
"companyId": cmd.Operator.CompanyId,
|
|
|
"orgId": cmd.Operator.OrgId,
|
|
|
"rankType": 1, //月榜
|
|
|
"top": 5,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
}
|
|
|
|
|
|
// 模式列表
|
|
|
var modeStatistics []CooperationModeStatistics
|
|
|
var responseModeStatistics []CooperationModeStatistics
|
|
|
var modeNumbers []string
|
...
|
...
|
|