作者 yangfu

企业统计修改

... ... @@ -52,19 +52,13 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId
// 2.相关合约统计
cooperationContractRelevantRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext)
cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId,
cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId,
"limit": 1})
if err != nil {
return nil, err
}
// 3.个人分红统计
type response struct {
Total float64 `json:"total"`
Accounting float64 `json:"accounting"`
Accounted float64 `json:"accounted"`
Paid float64 `json:"paid"`
}
creditAccountDao, _ := dao.NewCreditAccountDao(ptr.transactionContext)
var allDividends = &CreditAccountStatisticsResponse{}
if err := creditAccountDao.DividendsStatistics(map[string]interface{}{"userBaseId": userBaseId, "orgId": orgId}, allDividends); err != nil {
... ...
... ... @@ -140,7 +140,7 @@ func (ptr *CooperationStatisticsService) getUserContracts(queryOptions map[strin
if len(numbers) == 0 {
return []*domain.CooperationContract{}, nil
}
queryOptions["inCooperationContractNumber"] = numbers
queryOptions["cooperationContractNumbers"] = numbers
contractRepository, _ := repository.NewCooperationContractRepository(ptr.transactionContext)
_, contracts, err := contractRepository.Find(queryOptions)
return contracts, err
... ... @@ -442,8 +442,6 @@ func (ptr *CooperationStatisticsService) SearchDividendsEstimates(queryOptions m
if item.DividendsType == 1 {
order, err := dividendsOrderRepository.FindOne(map[string]interface{}{
"dividendsOrderNumber": item.OrderOrReturnedOrderNum,
"companyId": item.Company.CompanyId,
"orgId": item.Org.OrgId,
})
if err != nil {
return nil, err
... ...
... ... @@ -1132,6 +1132,9 @@ func (repository *CooperationContractRepository) Find(queryOptions map[string]in
if cooperationContractIds, ok := queryOptions["cooperationContractIds"]; ok && len(cooperationContractIds.([]int64)) != 0 {
query.Where("cooperation_contract_id in (?)", pg.In(cooperationContractIds))
}
if cooperationContractNumbers, ok := queryOptions["cooperationContractNumbers"]; ok && len(cooperationContractNumbers.([]string)) != 0 {
query.Where("cooperation_contract_number in (?)", pg.In(cooperationContractNumbers))
}
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
query.Where("company->>'companyId' = '?'", companyId)
}
... ...