作者 yangfu

统计修改

... ... @@ -175,7 +175,7 @@ func (ptr *CooperationStatisticsService) cooperationModeStatistics(mode *domain.
return initStatistic, err
}
undertakerRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext)
if _, undertakers, err = undertakerRepository.Find(map[string]interface{}{}); err != nil {
if _, undertakers, err = undertakerRepository.Find(map[string]interface{}{"companyId": companyId, "orgId": orgId, "cooperationContractNumbers": contractNumbers}); err != nil {
return initStatistic, err
}
for i := range undertakers {
... ...
... ... @@ -96,7 +96,7 @@ func (ptr *CooperationStatisticsService) SearchContractDividends(queryOptions ma
contracts, err = ptr.getUserContracts(request.UserBaseId, queryOptions)
} else if request.OrgId > 0 {
queryOptions["orgId"] = request.OrgId
contracts, err = ptr.getCompanyContracts(request.UserId, queryOptions)
contracts, err = ptr.getCompanyContracts(request.OrgId, request.UserId, queryOptions)
}
if err != nil {
return nil, err
... ... @@ -154,12 +154,12 @@ func (ptr *CooperationStatisticsService) getUserContracts(userBaseId int64, quer
// getCompanyContracts 获取组织合约列表
//
// p1 p1_desc
func (ptr *CooperationStatisticsService) getCompanyContracts(userId int64, queryOptions map[string]interface{}) ([]*domain.CooperationContract, error) {
func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64, queryOptions map[string]interface{}) ([]*domain.CooperationContract, error) {
var contracts = make([]*domain.CooperationContract, 0)
if userId == 0 {
return contracts, nil
}
contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"userId": userId})
contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"orgId": orgId, "userId": userId})
if len(contractNumbers) == 0 {
return contracts, nil
}
... ...
... ... @@ -196,6 +196,9 @@ func (repository *CooperationContractUndertakerRepository) Find(queryOptions map
if userBaseId, ok := queryOptions["userBaseId"]; ok && userBaseId.(int64) != 0 {
query.Where("user_base_id = ? ", userBaseId)
}
if cooperationContractNumbers, ok := queryOptions["cooperationContractNumbers"]; ok && len(cooperationContractNumbers.([]string)) != 0 {
query.Where("cooperation_contract_number in (?)", pg.In(cooperationContractNumbers))
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
offsetLimitFlag = offsetLimit.(bool)
... ...