作者 yangfu

企业统计修改

... ... @@ -600,7 +600,7 @@ func (ptr *CooperationStatisticsService) CompanyPaymentHistoryStatistics(queryOp
// 按关联相关人过滤
var retMap = make([]interface{}, 0)
contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"userId": request.UserId})
contractNumbers, err := ptr.getUnderTakerContracts(map[string]interface{}{"userId": request.UserId})
if len(contractNumbers) == 0 {
return retMap, nil
}
... ... @@ -649,7 +649,17 @@ func (ptr *CooperationStatisticsService) PaymentHistoryHistogramStatistics(query
// 按关联相关人过滤
var contractNumbers []string
var err error
if request.UserId > 0 {
if request.UserBaseId > 0 {
var retMap = make([]interface{}, 0)
contractNumbers, err = ptr.getUnderTakerContracts(map[string]interface{}{"userId": request.UserId})
if len(contractNumbers) == 0 {
return retMap, nil
}
if err != nil {
return retMap, err
}
queryOptions["cooperationContractNumbers"] = contractNumbers
} else if request.UserId > 0 && request.OrgId > 0 {
var retMap = make([]interface{}, 0)
contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"userId": request.UserId})
if len(contractNumbers) == 0 {
... ...
... ... @@ -142,7 +142,7 @@ func (ptr *CooperationStatisticsService) getUserContracts(orgId, userBaseId int6
if userBaseId == 0 {
return contracts, nil
}
contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"orgId": orgId, "userBaseId": userBaseId})
contractNumbers, err := ptr.getUnderTakerContracts(map[string]interface{}{"orgId": orgId, "userBaseId": userBaseId})
if len(contractNumbers) == 0 {
return contracts, nil
}
... ... @@ -163,7 +163,7 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64
if userId == 0 {
return contracts, nil
}
contractNumbers, err := ptr.getRelevantContracts1(map[string]interface{}{"orgId": orgId, "userId": userId})
contractNumbers, err := ptr.getRelevantContracts(map[string]interface{}{"orgId": orgId, "userId": userId})
if len(contractNumbers) == 0 {
return contracts, nil
}
... ... @@ -176,8 +176,8 @@ func (ptr *CooperationStatisticsService) getCompanyContracts(orgId, userId int64
return contracts, err
}
//getRelevantContracts 获取相关人的合约
func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[string]interface{}) ([]string, error) {
// getUnderTakerContracts 获取承接人的合约
func (ptr *CooperationStatisticsService) getUnderTakerContracts(queryOptions map[string]interface{}) ([]string, error) {
undertakerRepository, _ := dao.NewCooperationContractUndertakerDao(ptr.transactionContext)
_, undertakers, err := undertakerRepository.Find(queryOptions)
var numbers []string
... ... @@ -191,7 +191,7 @@ func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[s
}
//getRelevantContracts 获取相关人的合约
func (ptr *CooperationStatisticsService) getRelevantContracts1(queryOptions map[string]interface{}) ([]string, error) {
func (ptr *CooperationStatisticsService) getRelevantContracts(queryOptions map[string]interface{}) ([]string, error) {
undertakerRepository, _ := repository.NewCooperationContractRelevantRepository(ptr.transactionContext)
_, undertakers, err := undertakerRepository.Find(queryOptions)
var numbers []string
... ... @@ -401,7 +401,7 @@ func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[st
return struct{}{}, err
}
} else if request.UserBaseId > 0 {
contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId})
contractNumbers, err = ptr.getUnderTakerContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId})
if err != nil {
return struct{}{}, err
}
... ... @@ -524,7 +524,7 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
return struct{}{}, err
}
} else if request.UserBaseId > 0 {
contractNumbers, err = ptr.getRelevantContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId})
contractNumbers, err = ptr.getUnderTakerContracts(map[string]interface{}{"orgId": request.OrgId, "userBaseId": request.UserBaseId})
if err != nil {
return struct{}{}, err
}
... ...