作者 yangfu

分红预算修改

... ... @@ -58,7 +58,8 @@ func (dao *CreditAccountDao) DividendsStatistics(queryOptions map[string]interfa
creditAccount := new(models.CreditAccount)
query := dao.transactionContext.PgTx.Model(creditAccount)
query.ColumnExpr(`sum(settlement_amount) total`)
query.ColumnExpr(`sum((case when payment_status = 1 then actually_paid_amount else 0 end)) paid`)
query.ColumnExpr(`sum((case when payment_status = 2 then actually_paid_amount else 0 end)) paid`)
query.ColumnExpr(`sum((case when payment_status = 1 then settlement_amount else 0 end)) unpaid`)
query.ColumnExpr(`sum((case when settlement_time is not null then settlement_amount else 0 end)) accounted `)
if v, ok := queryOptions["beginTime"]; ok && !(v.(time.Time).IsZero()) {
query.Where(`created_at>? `, queryOptions["beginTime"])
... ...
... ... @@ -51,7 +51,7 @@ func (ptr *CooperationStatisticsService) cooperationCompanyStatistics(userBaseId
}
// 2.相关合约统计
cooperationContractRelevantRepository, _ := repository.NewCooperationContractRelevantRepository(ptr.transactionContext)
cooperationContractRelevantRepository, _ := repository.NewCooperationContractUndertakerRepository(ptr.transactionContext)
cooperationContractCount, _, err := cooperationContractRelevantRepository.Find(map[string]interface{}{"userBaseId": userBaseId,
"limit": 1})
if err != nil {
... ...
... ... @@ -488,4 +488,5 @@ type CreditAccountStatisticsResponse struct {
Accounting float64 `json:"accounting"`
Accounted float64 `json:"accounted"`
Paid float64 `json:"paid"`
Unpaid float64 `json:"unpaid"`
}
... ...