正在显示
1 个修改的文件
包含
89 行增加
和
0 行删除
| @@ -43,6 +43,95 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | @@ -43,6 +43,95 @@ func (srv CompanyStatisticsService) IndexStatistics(cmd *command.IndexStatistics | ||
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | // 模式列表 | 45 | // 模式列表 |
| 46 | + var modeStatistics = struct { | ||
| 47 | + TotalCooperationModeStatistics interface{} `json:"totalCooperationModeStatistics"` | ||
| 48 | + CooperationModeStatistics interface{} `json:"cooperationModeStatistics"` | ||
| 49 | + CooperationModes interface{} `json:"cooperationModes"` | ||
| 50 | + }{} | ||
| 51 | + err = json.UnmarshalFromString(json.MarshalToString(cooperationModeStatistics), &modeStatistics) | ||
| 52 | + if err != nil { | ||
| 53 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + // 项目概览统计 | ||
| 57 | + contracts, err := gateway.CooperationContractSearch(allied_creation_cooperation.ReqCooperationContractSearch{ | ||
| 58 | + PageNumber: 1, | ||
| 59 | + PageSize: 1, | ||
| 60 | + CompanyId: cmd.Operator.CompanyId, | ||
| 61 | + OrgId: cmd.Operator.OrgId, | ||
| 62 | + }) | ||
| 63 | + if err != nil { | ||
| 64 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 65 | + } | ||
| 66 | + projects, err := gateway.CooperationProjectsSearch(allied_creation_cooperation.ReqCooperationProjectSearch{ | ||
| 67 | + PageNumber: 1, | ||
| 68 | + PageSize: 1, | ||
| 69 | + CompanyId: cmd.Operator.CompanyId, | ||
| 70 | + OrgId: cmd.Operator.OrgId, | ||
| 71 | + Status: 1, | ||
| 72 | + }) | ||
| 73 | + if err != nil { | ||
| 74 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 75 | + } | ||
| 76 | + gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser( | ||
| 77 | + cmd.Operator) | ||
| 78 | + users, err := gatewayUser.UserSearch(allied_creation_user.ReqUserSearch{ | ||
| 79 | + Limit: 1, | ||
| 80 | + Offset: 0, | ||
| 81 | + CompanyId: cmd.Operator.CompanyId, | ||
| 82 | + OrganizationId: cmd.Operator.OrgId, | ||
| 83 | + UserType: domain.UserTypeCooperation, | ||
| 84 | + InEnableStatus: []int{domain.UserStatusEnable}, | ||
| 85 | + }) | ||
| 86 | + if err != nil { | ||
| 87 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 88 | + } | ||
| 89 | + var projectOverviewStatistics = map[string]interface{}{ | ||
| 90 | + "contractSum": contracts.Grid.Total, | ||
| 91 | + "cooperationUserCount": users.Count, | ||
| 92 | + "projectSum": projects.Total, | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return map[string]interface{}{ | ||
| 96 | + "projectOverviewStatistics": projectOverviewStatistics, | ||
| 97 | + "currentMonthDividendsStatistics": companyDividendsStatistics, | ||
| 98 | + "cooperationModeStatistics": modeStatistics.CooperationModeStatistics, | ||
| 99 | + "cooperationGoodsStatistics": cooperationGoodsStatistics, | ||
| 100 | + "cooperationModes": modeStatistics.CooperationModes, | ||
| 101 | + "totalCooperationModeStatistics": modeStatistics.TotalCooperationModeStatistics, | ||
| 102 | + }, nil | ||
| 103 | +} | ||
| 104 | + | ||
| 105 | +// IndexStatistics 首页统计 (入口页面统计数据) | ||
| 106 | +func (srv CompanyStatisticsService) IndexStatisticsBak(cmd *command.IndexStatisticsCommand) (interface{}, error) { | ||
| 107 | + gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation( | ||
| 108 | + cmd.Operator) | ||
| 109 | + companyDividendsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CompanyDividendsStatistics, map[string]interface{}{ | ||
| 110 | + "companyId": cmd.Operator.CompanyId, | ||
| 111 | + "orgId": cmd.Operator.OrgId, | ||
| 112 | + "action": 1, //当前月 | ||
| 113 | + }) | ||
| 114 | + if err != nil { | ||
| 115 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 116 | + } | ||
| 117 | + cooperationModeStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationModeStatistics, map[string]interface{}{ | ||
| 118 | + "companyId": cmd.Operator.CompanyId, | ||
| 119 | + "orgId": cmd.Operator.OrgId, | ||
| 120 | + }) | ||
| 121 | + if err != nil { | ||
| 122 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 123 | + } | ||
| 124 | + cooperationGoodsStatistics, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationGoodsStatistics, map[string]interface{}{ | ||
| 125 | + "companyId": cmd.Operator.CompanyId, | ||
| 126 | + "orgId": cmd.Operator.OrgId, | ||
| 127 | + "rankType": 1, //月榜 | ||
| 128 | + "top": 5, | ||
| 129 | + }) | ||
| 130 | + if err != nil { | ||
| 131 | + return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error()) | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + // 模式列表 | ||
| 46 | var modeStatistics []CooperationModeStatistics | 135 | var modeStatistics []CooperationModeStatistics |
| 47 | var responseModeStatistics []CooperationModeStatistics | 136 | var responseModeStatistics []CooperationModeStatistics |
| 48 | var modeNumbers []string | 137 | var modeNumbers []string |
-
请 注册 或 登录 后发表评论