作者 yangfu

分红预算修改

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