作者 yangfu

fix bug

... ... @@ -82,6 +82,9 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa
if v, ok := queryOptions["userBaseId"]; ok && v.(int64) > 0 {
query.Where(fmt.Sprintf(`participator->>'userBaseId'='%v' `, v))
}
if v, ok := queryOptions["userId"]; ok && v.(int64) > 0 {
query.Where(fmt.Sprintf(`participator->>'userId'='%v' `, v))
}
if v, ok := queryOptions["orgId"]; ok && v.(int64) > 0 {
query.Where(fmt.Sprintf(` org->>'orgId'= '%v'`, v))
}
... ...
... ... @@ -432,7 +432,7 @@ func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOpti
}
// 3.分红支出
dividendsDetails, err := ptr.userModeDividend(request.OrgId, mapMode, mapModeContracts)
dividendsDetails, err := ptr.userModeDividend(request.UserId, request.OrgId, mapMode, mapModeContracts)
if err != nil {
return nil, err
}
... ... @@ -449,14 +449,14 @@ func (ptr *CooperationStatisticsService) CooperationUserModeStatistics(queryOpti
}
// 用户模式分红
func (ptr *CooperationStatisticsService) userModeDividend(orgId int64, mapMode map[string]*domain.CooperationMode, mapModeContracts map[string][]string) (interface{}, error) {
func (ptr *CooperationStatisticsService) userModeDividend(userId, orgId int64, mapMode map[string]*domain.CooperationMode, mapModeContracts map[string][]string) (interface{}, error) {
creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
var dividends dividendsExpenseByTypes = make([]dividendsExpenseByType, 0)
var total float64 = 0
for _, v := range mapMode {
numbers := mapModeContracts[v.CooperationModeNumber]
var dividendsEstimate = &CreditAccountStatisticsResponse{}
err := creditAccountDao.DividendsStatistics(map[string]interface{}{"orgId": orgId, "cooperationContractNumbers": numbers}, dividendsEstimate)
err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userId": userId, "orgId": orgId, "cooperationContractNumbers": numbers}, dividendsEstimate)
if err != nil {
return nil, err
}
... ...