作者 yangfu

统计修改

@@ -175,7 +175,7 @@ func (ptr *CooperationStatisticsService) cooperationModeStatistics(mode *domain. @@ -175,7 +175,7 @@ func (ptr *CooperationStatisticsService) cooperationModeStatistics(mode *domain.
175 return initStatistic, err 175 return initStatistic, err
176 } 176 }
177 undertakerRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext) 177 undertakerRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext)
178 - if _, undertakers, err = undertakerRepository.Find(map[string]interface{}{}); err != nil { 178 + if _, undertakers, err = undertakerRepository.Find(map[string]interface{}{"companyId": companyId, "orgId": orgId, "cooperationContractNumbers": contractNumbers}); err != nil {
179 return initStatistic, err 179 return initStatistic, err
180 } 180 }
181 for i := range undertakers { 181 for i := range undertakers {
@@ -96,7 +96,7 @@ func (ptr *CooperationStatisticsService) SearchContractDividends(queryOptions ma @@ -96,7 +96,7 @@ func (ptr *CooperationStatisticsService) SearchContractDividends(queryOptions ma
96 contracts, err = ptr.getUserContracts(request.UserBaseId, queryOptions) 96 contracts, err = ptr.getUserContracts(request.UserBaseId, queryOptions)
97 } else if request.OrgId > 0 { 97 } else if request.OrgId > 0 {
98 queryOptions["orgId"] = request.OrgId 98 queryOptions["orgId"] = request.OrgId
99 - contracts, err = ptr.getCompanyContracts(request.UserId, queryOptions) 99 + contracts, err = ptr.getCompanyContracts(request.OrgId, request.UserId, queryOptions)
100 } 100 }
101 if err != nil { 101 if err != nil {
102 return nil, err 102 return nil, err
@@ -154,12 +154,12 @@ func (ptr *CooperationStatisticsService) getUserContracts(userBaseId int64, quer @@ -154,12 +154,12 @@ func (ptr *CooperationStatisticsService) getUserContracts(userBaseId int64, quer
154 // getCompanyContracts 获取组织合约列表 154 // getCompanyContracts 获取组织合约列表
155 // 155 //
156 // p1 p1_desc 156 // p1 p1_desc
157 -func (ptr *CooperationStatisticsService) getCompanyContracts(userId int64, queryOptions map[string]interface{}) ([]*domain.CooperationContract, error) { 157 +func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64, queryOptions map[string]interface{}) ([]*domain.CooperationContract, error) {
158 var contracts = make([]*domain.CooperationContract, 0) 158 var contracts = make([]*domain.CooperationContract, 0)
159 if userId == 0 { 159 if userId == 0 {
160 return contracts, nil 160 return contracts, nil
161 } 161 }
162 - contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"userId": userId}) 162 + contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"orgId": orgId, "userId": userId})
163 if len(contractNumbers) == 0 { 163 if len(contractNumbers) == 0 {
164 return contracts, nil 164 return contracts, nil
165 } 165 }
@@ -196,6 +196,9 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map @@ -196,6 +196,9 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map
196 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 { 196 if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
197 query.Where("user_base_id = ? ", userBaseId) 197 query.Where("user_base_id = ? ", userBaseId)
198 } 198 }
  199 + if cooperationContractNumbers, ok := queryOptions["cooperationContractNumbers"]; ok && len(cooperationContractNumbers.([]string)) != 0 {
  200 + query.Where("cooperation_contract_number in (?)", pg.In(cooperationContractNumbers))
  201 + }
199 offsetLimitFlag := true 202 offsetLimitFlag := true
200 if offsetLimit, ok := queryOptions["offsetLimit"]; ok { 203 if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
201 offsetLimitFlag = offsetLimit.(bool) 204 offsetLimitFlag = offsetLimit.(bool)