作者 yangfu

fix bug

@@ -82,6 +82,9 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa @@ -82,6 +82,9 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa
82 if v, ok := queryOptions["userBaseId"]; ok && v.(int64) > 0 { 82 if v, ok := queryOptions["userBaseId"]; ok && v.(int64) > 0 {
83 query.Where(fmt.Sprintf(`participator->>'userBaseId'='%v' `, v)) 83 query.Where(fmt.Sprintf(`participator->>'userBaseId'='%v' `, v))
84 } 84 }
  85 + if v, ok := queryOptions["userId"]; ok && v.(int64) > 0 {
  86 + query.Where(fmt.Sprintf(`participator->>'userId'='%v' `, v))
  87 + }
85 if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 { 88 if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 {
86 query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v)) 89 query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v))
87 } 90 }
@@ -432,7 +432,7 @@ func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOpti @@ -432,7 +432,7 @@ func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOpti
432 } 432 }
433 433
434 // 3.分红支出 434 // 3.分红支出
435 - dividendsDetails, err := ptr.userModeDividend(request.OrgId, mapMode, mapModeContracts) 435 + dividendsDetails, err := ptr.userModeDividend(request.UserId, request.OrgId, mapMode, mapModeContracts)
436 if err != nil { 436 if err != nil {
437 return nil, err 437 return nil, err
438 } 438 }
@@ -449,14 +449,14 @@ func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOpti @@ -449,14 +449,14 @@ func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOpti
449 } 449 }
450 450
451 // 用户模式分红 451 // 用户模式分红
452 -func (ptr *CooperationStatisticsService) userModeDividend(orgId int64, mapMode map[string]*domain.CooperationMode, mapModeContracts map[string][]string) (interface{}, error) { 452 +func (ptr *CooperationStatisticsService) userModeDividend(userId, orgId int64, mapMode map[string]*domain.CooperationMode, mapModeContracts map[string][]string) (interface{}, error) {
453 creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext) 453 creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
454 var dividends dividendsExpenseByTypes = make([]dividendsExpenseByType, 0) 454 var dividends dividendsExpenseByTypes = make([]dividendsExpenseByType, 0)
455 var total float64 = 0 455 var total float64 = 0
456 for _, v := range mapMode { 456 for _, v := range mapMode {
457 numbers := mapModeContracts[v.CooperationModeNumber] 457 numbers := mapModeContracts[v.CooperationModeNumber]
458 var dividendsEstimate = &CreditAccountStatisticsResponse{} 458 var dividendsEstimate = &CreditAccountStatisticsResponse{}
459 - err := creditAccountDao.DividendsStatistics(map[string]interface{}{"orgId": orgId, "cooperationContractNumbers": numbers}, dividendsEstimate) 459 + err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userId": userId, "orgId": orgId, "cooperationContractNumbers": numbers}, dividendsEstimate)
460 if err != nil { 460 if err != nil {
461 return nil, err 461 return nil, err
462 } 462 }