作者 yangfu

企业统计修改

@@ -52,19 +52,13 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId @@ -52,19 +52,13 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId
52 52
53 // 2.相关合约统计 53 // 2.相关合约统计
54 cooperationContractRelevantRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext) 54 cooperationContractRelevantRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext)
55 - cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId, 55 + cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId,
56 "limit": 1}) 56 "limit": 1})
57 if err != nil { 57 if err != nil {
58 return nil, err 58 return nil, err
59 } 59 }
60 60
61 // 3.个人分红统计 61 // 3.个人分红统计
62 - type response struct {  
63 - Total float64 `json:"total"`  
64 - Accounting float64 `json:"accounting"`  
65 - Accounted float64 `json:"accounted"`  
66 - Paid float64 `json:"paid"`  
67 - }  
68 creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext) 62 creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
69 var allDividends = &CreditAccountStatisticsResponse{} 63 var allDividends = &CreditAccountStatisticsResponse{}
70 if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil { 64 if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil {
@@ -140,7 +140,7 @@ func (ptr *CooperationStatisticsService) getUserContracts(queryOptions map[strin @@ -140,7 +140,7 @@ func (ptr *CooperationStatisticsService) getUserContracts(queryOptions map[strin
140 if len(numbers) == 0 { 140 if len(numbers) == 0 {
141 return []*domain.CooperationContract{}, nil 141 return []*domain.CooperationContract{}, nil
142 } 142 }
143 - queryOptions["inCooperationContractNumber"] = numbers 143 + queryOptions["cooperationContractNumbers"] = numbers
144 contractRepository, _ := repository.NewCooperationContractRepository(ptr.transactionContext) 144 contractRepository, _ := repository.NewCooperationContractRepository(ptr.transactionContext)
145 _, contracts, err := contractRepository.Find(queryOptions) 145 _, contracts, err := contractRepository.Find(queryOptions)
146 return contracts, err 146 return contracts, err
@@ -442,8 +442,6 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -442,8 +442,6 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
442 if item.DividendsType == 1 { 442 if item.DividendsType == 1 {
443 order, err := dividendsOrderRepository.FindOne(map[string]interface{}{ 443 order, err := dividendsOrderRepository.FindOne(map[string]interface{}{
444 "dividendsOrderNumber": item.OrderOrReturnedOrderNum, 444 "dividendsOrderNumber": item.OrderOrReturnedOrderNum,
445 - "companyId": item.Company.CompanyId,  
446 - "orgId": item.Org.OrgId,  
447 }) 445 })
448 if err != nil { 446 if err != nil {
449 return nil, err 447 return nil, err
@@ -1132,6 +1132,9 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in @@ -1132,6 +1132,9 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
1132 if cooperationContractIds, ok := queryOptions["cooperationContractIds"]; ok && len(cooperationContractIds.([]int64)) != 0 { 1132 if cooperationContractIds, ok := queryOptions["cooperationContractIds"]; ok && len(cooperationContractIds.([]int64)) != 0 {
1133 query.Where("cooperation_contract_id in (?)", pg.In(cooperationContractIds)) 1133 query.Where("cooperation_contract_id in (?)", pg.In(cooperationContractIds))
1134 } 1134 }
  1135 + if cooperationContractNumbers, ok := queryOptions["cooperationContractNumbers"]; ok && len(cooperationContractNumbers.([]string)) != 0 {
  1136 + query.Where("cooperation_contract_number in (?)", pg.In(cooperationContractNumbers))
  1137 + }
1135 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 { 1138 if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
1136 query.Where("company->>'companyId' = '?'", companyId) 1139 query.Where("company->>'companyId' = '?'", companyId)
1137 } 1140 }