|
@@ -181,6 +181,86 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer |
|
@@ -181,6 +181,86 @@ func (srv PersonStatisticsService) CompanyStatistics(cmd *command.CooperationPer |
181
|
}, nil
|
181
|
}, nil
|
182
|
}
|
182
|
}
|
183
|
|
183
|
|
|
|
184
|
+// CompanyStatistics 共创用户-共创企业统计
|
|
|
185
|
+func (srv PersonStatisticsService) CompanyStatisticsV2(cmd *command.CooperationPersonStatisticsCommand) (interface{}, error) {
|
|
|
186
|
+
|
|
|
187
|
+ gateway := allied_creation_cooperation.NewHttplibAlliedCreationCooperation(
|
|
|
188
|
+ cmd.Operator)
|
|
|
189
|
+ var response = struct {
|
|
|
190
|
+ OrgIds []int `json:"orgIds"`
|
|
|
191
|
+ }{}
|
|
|
192
|
+ err := gateway.CooperationStatisticsWithObject(allied_creation_cooperation.PersonCooperationCompany, map[string]interface{}{
|
|
|
193
|
+ "userBaseId": cmd.Operator.UserBaseId,
|
|
|
194
|
+ }, &response)
|
|
|
195
|
+ if err != nil {
|
|
|
196
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
197
|
+ }
|
|
|
198
|
+ var companyList []int = response.OrgIds
|
|
|
199
|
+ if len(companyList) == 0 {
|
|
|
200
|
+ return map[string]interface{}{
|
|
|
201
|
+ "list": []struct{}{},
|
|
|
202
|
+ }, nil
|
|
|
203
|
+ }
|
|
|
204
|
+ result, err := gateway.CooperationStatistics(allied_creation_cooperation.CooperationCompanyStatistics, map[string]interface{}{
|
|
|
205
|
+ "userBaseId": cmd.Operator.UserBaseId,
|
|
|
206
|
+ "companyList": companyList,
|
|
|
207
|
+ })
|
|
|
208
|
+ if err != nil {
|
|
|
209
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
210
|
+ }
|
|
|
211
|
+
|
|
|
212
|
+ type cooperationCompanyStatisticsResponse struct {
|
|
|
213
|
+ // 当天统计的企业id
|
|
|
214
|
+ OrgId int64 `json:"orgId"`
|
|
|
215
|
+ // 共创项目数
|
|
|
216
|
+ CooperationProjectCount int64 `json:"cooperationProjectCount"`
|
|
|
217
|
+ // 共创合约数
|
|
|
218
|
+ CooperationContractCount int64 `json:"cooperationContractCount"`
|
|
|
219
|
+ // 分红占比
|
|
|
220
|
+ DividendsRatio float64 `json:"dividendsRatio"`
|
|
|
221
|
+ // 分红支出
|
|
|
222
|
+ DividendsIncome float64 `json:"dividendsIncome"`
|
|
|
223
|
+ // 企业信息
|
|
|
224
|
+ Company domain.Company `json:"company"`
|
|
|
225
|
+ }
|
|
|
226
|
+ var cooperationCompanyStatisticsResponses []cooperationCompanyStatisticsResponse
|
|
|
227
|
+ if err := json.UnmarshalFromString(json.MarshalToString(result), &cooperationCompanyStatisticsResponses); err != nil {
|
|
|
228
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
229
|
+ }
|
|
|
230
|
+ var values = make([]interface{}, 0)
|
|
|
231
|
+ gatewayUser := allied_creation_user.NewHttplibAlliedCreationUser(
|
|
|
232
|
+ cmd.Operator)
|
|
|
233
|
+ for i := range companyList {
|
|
|
234
|
+ for j := range cooperationCompanyStatisticsResponses {
|
|
|
235
|
+ if cooperationCompanyStatisticsResponses[j].OrgId == int64(companyList[i]) {
|
|
|
236
|
+ orgData, err := gatewayUser.OrgGet(allied_creation_user.ReqOrgGet{
|
|
|
237
|
+ OrgId: companyList[i],
|
|
|
238
|
+ })
|
|
|
239
|
+ if err != nil {
|
|
|
240
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
241
|
+ }
|
|
|
242
|
+ //orgData,err:= gatewayUser.CompanyGet(allied_creation_user.ReqCompanyGet{
|
|
|
243
|
+ // OrgId: companyList[i],
|
|
|
244
|
+ //})
|
|
|
245
|
+ if err != nil {
|
|
|
246
|
+ return nil, application.ThrowError(application.BUSINESS_ERROR, err.Error())
|
|
|
247
|
+ }
|
|
|
248
|
+ cooperationCompanyStatisticsResponses[j].Company = domain.Company{
|
|
|
249
|
+ CompanyID: orgData.OrgID,
|
|
|
250
|
+ CompanyName: orgData.OrgName,
|
|
|
251
|
+ //Logo: user.Company.Logo,
|
|
|
252
|
+ }
|
|
|
253
|
+ values = append(values, cooperationCompanyStatisticsResponses[j])
|
|
|
254
|
+ }
|
|
|
255
|
+ }
|
|
|
256
|
+
|
|
|
257
|
+ }
|
|
|
258
|
+
|
|
|
259
|
+ return map[string]interface{}{
|
|
|
260
|
+ "list": values,
|
|
|
261
|
+ }, nil
|
|
|
262
|
+}
|
|
|
263
|
+
|
184
|
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
|
264
|
// CooperationProjectRecommend TODO:其他公司按公开的项目查 猜你喜欢(共创项目)
|
185
|
func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
|
265
|
func (srv PersonStatisticsService) CooperationProjectRecommend(projectQuery *command.ListCooperationProjectQuery) (int64, interface{}, error) {
|
186
|
if projectQuery.Operator.UserBaseId > 0 {
|
266
|
if projectQuery.Operator.UserBaseId > 0 {
|