作者 yangfu

企业统计修改

@@ -163,7 +163,7 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64 @@ -163,7 +163,7 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64
163 if userId == 0 { 163 if userId == 0 {
164 return contracts, nil 164 return contracts, nil
165 } 165 }
166 - contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"orgId": orgId, "userId": userId}) 166 + contractNumbers, err := ptr.getRelevantContracts1(map[string]interface{}{"orgId": orgId, "userId": userId})
167 if len(contractNumbers) == 0 { 167 if len(contractNumbers) == 0 {
168 return contracts, nil 168 return contracts, nil
169 } 169 }
@@ -190,6 +190,20 @@ func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[s @@ -190,6 +190,20 @@ func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[s
190 return numbers, err 190 return numbers, err
191 } 191 }
192 192
  193 +//getRelevantContracts 获取相关人的合约
  194 +func (ptr *CooperationStatisticsService) getRelevantContracts1(queryOptions map[string]interface{}) ([]string, error) {
  195 + undertakerRepository, _ := repository.NewCooperationContractRelevantRepository(ptr.transactionContext)
  196 + _, undertakers, err := undertakerRepository.Find(queryOptions)
  197 + var numbers []string
  198 + for i := range undertakers {
  199 + numbers = append(numbers, undertakers[i].CooperationContractNumber)
  200 + }
  201 + if len(numbers) == 0 {
  202 + return []string{}, nil
  203 + }
  204 + return numbers, err
  205 +}
  206 +
193 // getContractsDividendsEstimate 合约分红预算 207 // getContractsDividendsEstimate 合约分红预算
194 func (ptr *CooperationStatisticsService) getContractsDividendsEstimate(numbers []string) (map[string]*domain.DividendsEstimate, error) { 208 func (ptr *CooperationStatisticsService) getContractsDividendsEstimate(numbers []string) (map[string]*domain.DividendsEstimate, error) {
195 var estimates []*domain.DividendsEstimate 209 var estimates []*domain.DividendsEstimate