作者 yangfu

统计修改

... ... @@ -111,10 +111,10 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma
query.ColumnExpr(`sum((case when payment_status = 1 then settlement_amount else 0 end)) un_paid_amount`)
query.ColumnExpr(`max(participator->>'userId') user_id`)
query.ColumnExpr(`max(participator#>>'{userInfo,userName}') user_name`)
if _, ok := queryOptions["beginTime"]; ok && !queryOptions["beginTime"].(time.Time).IsZero() {
query.Where(`created_at>? `, queryOptions["beginTime"])
query.Where(`created_at<? `, queryOptions["endTime"])
}
//if _, ok := queryOptions["beginTime"]; ok && !queryOptions["beginTime"].(time.Time).IsZero() {
// query.Where(`created_at>? `, queryOptions["beginTime"])
// query.Where(`created_at<? `, queryOptions["endTime"])
//}
if v, ok := queryOptions["userBaseId"]; ok && v.(int64) > 0 {
query.Where(fmt.Sprintf(`participator->>'userBaseId'='%v' `, v))
}
... ... @@ -130,6 +130,12 @@ func (dao *CreditAccountDao) CooperationUsersDividendsStatistics(queryOptions ma
if v, ok := queryOptions["endTime"]; ok && !v.(time.Time).IsZero() {
query.Where("created_at < ?", v)
}
if v, ok := queryOptions["paymentBeginTime"]; ok && !(v.(time.Time).IsZero()) {
query.Where(`payment_time>=? `, queryOptions["paymentBeginTime"])
}
if v, ok := queryOptions["paymentEndTime"]; ok && !(v.(time.Time).IsZero()) {
query.Where(`payment_time<? `, queryOptions["paymentEndTime"])
}
if v, ok := queryOptions["cooperationContractNumbers"]; ok && len(v.([]string)) > 0 {
//query.Where("cooperation_contract_number in (?)", pg.In(v))
query.Where(domain.ConditionInContractNumbers(v.([]string)))
... ...
... ... @@ -590,8 +590,8 @@ func (ptr *CooperationStatisticsService) CompanyPaymentHistoryStatistics(queryOp
OrgId int64 `json:"orgId" valid:"Required"`
UserId int64 `json:"userId" valid:"Required"`
SortByActuallyPaidAmount int `json:"sortByActuallyPaidAmount" valid:"Required"`
BeginTime time.Time `json:"beginTime"`
EndTime time.Time `json:"endTime"`
PaymentBeginTime time.Time `json:"paymentBeginTime"`
PaymentEndTime time.Time `json:"paymentEndTime"`
}{}
if err := LoadQueryObject(queryOptions, &request); err != nil {
return nil, err
... ...
... ... @@ -150,8 +150,8 @@ func (ptr *CooperationStatisticsService) PersonCompanyPaymentHistoryStatistics(q
UserBaseId int64 `json:"userBaseId" valid:"Required"`
OrgId int64 `json:"orgId" valid:"Required"`
SortByActuallyPaidAmount int `json:"sortByActuallyPaidAmount" valid:"Required"`
BeginTime time.Time `json:"paymentBeginTime"`
EndTime time.Time `json:"paymentEndTime"`
PaymentBeginTime time.Time `json:"paymentBeginTime"`
PaymentEndTime time.Time `json:"paymentEndTime"`
}{}
if err := LoadQueryObject(queryOptions, &request); err != nil {
return nil, err
... ...