作者 yangfu

企业统计修改

@@ -600,7 +600,7 @@ func (ptr *CooperationStatisticsService) CompanyPaymentHistoryStatistics(queryOp @@ -600,7 +600,7 @@ func (ptr *CooperationStatisticsService) CompanyPaymentHistoryStatistics(queryOp
600 600
601 // 按关联相关人过滤 601 // 按关联相关人过滤
602 var retMap = make([]interface{}, 0) 602 var retMap = make([]interface{}, 0)
603 - contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"userId": request.UserId}) 603 + contractNumbers, err := ptr.getUnderTakerContracts(map[string]interface{}{"userId": request.UserId})
604 if len(contractNumbers) == 0 { 604 if len(contractNumbers) == 0 {
605 return retMap, nil 605 return retMap, nil
606 } 606 }
@@ -649,7 +649,17 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query @@ -649,7 +649,17 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query
649 // 按关联相关人过滤 649 // 按关联相关人过滤
650 var contractNumbers []string 650 var contractNumbers []string
651 var err error 651 var err error
652 - if request.UserId > 0 { 652 + if request.UserBaseId > 0 {
  653 + var retMap = make([]interface{}, 0)
  654 + contractNumbers, err = ptr.getUnderTakerContracts(map[string]interface{}{"userId": request.UserId})
  655 + if len(contractNumbers) == 0 {
  656 + return retMap, nil
  657 + }
  658 + if err != nil {
  659 + return retMap, err
  660 + }
  661 + queryOptions["cooperationContractNumbers"] = contractNumbers
  662 + } else if request.UserId > 0 && request.OrgId > 0 {
653 var retMap = make([]interface{}, 0) 663 var retMap = make([]interface{}, 0)
654 contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"userId": request.UserId}) 664 contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"userId": request.UserId})
655 if len(contractNumbers) == 0 { 665 if len(contractNumbers) == 0 {
@@ -142,7 +142,7 @@ func (ptr *CooperationStatisticsService) getUserContracts(orgId, userBaseId int6 @@ -142,7 +142,7 @@ func (ptr *CooperationStatisticsService) getUserContracts(orgId, userBaseId int6
142 if userBaseId == 0 { 142 if userBaseId == 0 {
143 return contracts, nil 143 return contracts, nil
144 } 144 }
145 - contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"orgId": orgId, "userBaseId": userBaseId}) 145 + contractNumbers, err := ptr.getUnderTakerContracts(map[string]interface{}{"orgId": orgId, "userBaseId": userBaseId})
146 if len(contractNumbers) == 0 { 146 if len(contractNumbers) == 0 {
147 return contracts, nil 147 return contracts, nil
148 } 148 }
@@ -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.getRelevantContracts1(map[string]interface{}{"orgId": orgId, "userId": userId}) 166 + contractNumbers, err := ptr.getRelevantContracts(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 }
@@ -176,8 +176,8 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64 @@ -176,8 +176,8 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64
176 return contracts, err 176 return contracts, err
177 } 177 }
178 178
179 -//getRelevantContracts 获取相关人的合约  
180 -func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[string]interface{}) ([]string, error) { 179 +// getUnderTakerContracts 获取承接人的合约
  180 +func (ptr *CooperationStatisticsService) getUnderTakerContracts(queryOptions map[string]interface{}) ([]string, error) {
181 undertakerRepository, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext) 181 undertakerRepository, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext)
182 _, undertakers, err := undertakerRepository.Find(queryOptions) 182 _, undertakers, err := undertakerRepository.Find(queryOptions)
183 var numbers []string 183 var numbers []string
@@ -191,7 +191,7 @@ func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[s @@ -191,7 +191,7 @@ func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[s
191 } 191 }
192 192
193 //getRelevantContracts 获取相关人的合约 193 //getRelevantContracts 获取相关人的合约
194 -func (ptr *CooperationStatisticsService) getRelevantContracts1(queryOptions map[string]interface{}) ([]string, error) { 194 +func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[string]interface{}) ([]string, error) {
195 undertakerRepository, _ := repository.NewCooperationContractRelevantRepository(ptr.transactionContext) 195 undertakerRepository, _ := repository.NewCooperationContractRelevantRepository(ptr.transactionContext)
196 _, undertakers, err := undertakerRepository.Find(queryOptions) 196 _, undertakers, err := undertakerRepository.Find(queryOptions)
197 var numbers []string 197 var numbers []string
@@ -401,7 +401,7 @@ func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[st @@ -401,7 +401,7 @@ func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[st
401 return struct{}{}, err 401 return struct{}{}, err
402 } 402 }
403 } else if request.UserBaseId > 0 { 403 } else if request.UserBaseId > 0 {
404 - contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId}) 404 + contractNumbers, err = ptr.getUnderTakerContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId})
405 if err != nil { 405 if err != nil {
406 return struct{}{}, err 406 return struct{}{}, err
407 } 407 }
@@ -524,7 +524,7 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m @@ -524,7 +524,7 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
524 return struct{}{}, err 524 return struct{}{}, err
525 } 525 }
526 } else if request.UserBaseId > 0 { 526 } else if request.UserBaseId > 0 {
527 - contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId}) 527 + contractNumbers, err = ptr.getUnderTakerContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId})
528 if err != nil { 528 if err != nil {
529 return struct{}{}, err 529 return struct{}{}, err
530 } 530 }