|
@@ -402,34 +402,47 @@ func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[st |
|
@@ -402,34 +402,47 @@ func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[st |
402
|
|
402
|
|
403
|
queryOptions["cooperationContractNumbers"] = contractNumbers
|
403
|
queryOptions["cooperationContractNumbers"] = contractNumbers
|
404
|
|
404
|
|
|
|
405
|
+ var allDividendsEstimate = &CreditAccountStatisticsResponse{}
|
|
|
406
|
+ var annualDividendsEstimate = &CreditAccountStatisticsResponse{}
|
|
|
407
|
+ var quarterDividendsEstimate = &CreditAccountStatisticsResponse{}
|
405
|
var allDividends = &CreditAccountStatisticsResponse{}
|
408
|
var allDividends = &CreditAccountStatisticsResponse{}
|
406
|
var annualDividends = &CreditAccountStatisticsResponse{}
|
409
|
var annualDividends = &CreditAccountStatisticsResponse{}
|
407
|
var quarterDividends = &CreditAccountStatisticsResponse{}
|
410
|
var quarterDividends = &CreditAccountStatisticsResponse{}
|
408
|
|
411
|
|
|
|
412
|
+ dividendsEstimateDao, _ := dao.NewDividendsEstimateDao(ptr.transactionContext)
|
409
|
if len(contractNumbers) > 0 {
|
413
|
if len(contractNumbers) > 0 {
|
|
|
414
|
+ if err := dividendsEstimateDao.DividendsEstimateStatistics(queryOptions, allDividendsEstimate); err != nil {
|
|
|
415
|
+ return nil, err
|
|
|
416
|
+ }
|
410
|
if err := creditAccountDao.DividendsStatistics(queryOptions, allDividends); err != nil {
|
417
|
if err := creditAccountDao.DividendsStatistics(queryOptions, allDividends); err != nil {
|
411
|
return nil, err
|
418
|
return nil, err
|
412
|
}
|
419
|
}
|
413
|
- allDividends.Accounting = allDividends.Total - allDividends.Accounted
|
420
|
+ allDividendsEstimate.Paid = allDividends.Paid
|
414
|
|
421
|
|
415
|
queryOptions["beginTime"] = time.Date(time.Now().Year(), 1, 1, 0, 0, 0, 0, time.Local)
|
422
|
queryOptions["beginTime"] = time.Date(time.Now().Year(), 1, 1, 0, 0, 0, 0, time.Local)
|
416
|
queryOptions["endTime"] = time.Date(time.Now().Year(), 1, 1, 0, 0, 0, 0, time.Local).AddDate(1, 0, 0)
|
423
|
queryOptions["endTime"] = time.Date(time.Now().Year(), 1, 1, 0, 0, 0, 0, time.Local).AddDate(1, 0, 0)
|
|
|
424
|
+ if err := dividendsEstimateDao.DividendsEstimateStatistics(queryOptions, annualDividendsEstimate); err != nil {
|
|
|
425
|
+ return nil, err
|
|
|
426
|
+ }
|
417
|
if err := creditAccountDao.DividendsStatistics(queryOptions, annualDividends); err != nil {
|
427
|
if err := creditAccountDao.DividendsStatistics(queryOptions, annualDividends); err != nil {
|
418
|
return nil, err
|
428
|
return nil, err
|
419
|
}
|
429
|
}
|
420
|
- annualDividends.Accounting = annualDividends.Total - annualDividends.Accounted
|
430
|
+ annualDividendsEstimate.Paid = annualDividends.Paid
|
421
|
|
431
|
|
422
|
queryOptions["beginTime"], queryOptions["endTime"] = quarterBeginEnd()
|
432
|
queryOptions["beginTime"], queryOptions["endTime"] = quarterBeginEnd()
|
|
|
433
|
+ if err := dividendsEstimateDao.DividendsEstimateStatistics(queryOptions, quarterDividendsEstimate); err != nil {
|
|
|
434
|
+ return nil, err
|
|
|
435
|
+ }
|
423
|
if err := creditAccountDao.DividendsStatistics(queryOptions, quarterDividends); err != nil {
|
436
|
if err := creditAccountDao.DividendsStatistics(queryOptions, quarterDividends); err != nil {
|
424
|
return nil, err
|
437
|
return nil, err
|
425
|
}
|
438
|
}
|
426
|
- quarterDividends.Accounting = quarterDividends.Total - quarterDividends.Accounted
|
439
|
+ quarterDividendsEstimate.Paid = quarterDividends.Paid
|
427
|
}
|
440
|
}
|
428
|
|
441
|
|
429
|
ret := map[string]interface{}{
|
442
|
ret := map[string]interface{}{
|
430
|
- "allDividends": allDividends,
|
|
|
431
|
- "annualDividends": annualDividends,
|
|
|
432
|
- "quarterDividends": quarterDividends,
|
443
|
+ "allDividends": allDividendsEstimate.Round(2),
|
|
|
444
|
+ "annualDividends": annualDividendsEstimate.Round(2),
|
|
|
445
|
+ "quarterDividends": quarterDividendsEstimate.Round(2),
|
433
|
}
|
446
|
}
|
434
|
return ret, nil
|
447
|
return ret, nil
|
435
|
}
|
448
|
}
|
|
@@ -454,7 +467,7 @@ func quarterBeginEnd() (time.Time, time.Time) { |
|
@@ -454,7 +467,7 @@ func quarterBeginEnd() (time.Time, time.Time) { |
454
|
mEnd = 3
|
467
|
mEnd = 3
|
455
|
}
|
468
|
}
|
456
|
begin = time.Date(y, time.Month(mBegin), 1, 0, 0, 0, 0, time.Local)
|
469
|
begin = time.Date(y, time.Month(mBegin), 1, 0, 0, 0, 0, time.Local)
|
457
|
- end = time.Date(y, time.Month(mEnd), 1, 0, 0, 0, 0, time.Local)
|
470
|
+ end = time.Date(y, time.Month(mEnd), 1, 0, 0, 0, 0, time.Local).AddDate(0, 1, 0)
|
458
|
return begin, end
|
471
|
return begin, end
|
459
|
}
|
472
|
}
|
460
|
|
473
|
|
|
@@ -590,6 +603,15 @@ type CreditAccountStatisticsResponse struct { |
|
@@ -590,6 +603,15 @@ type CreditAccountStatisticsResponse struct { |
590
|
Unpaid float64 `json:"unpaid"`
|
603
|
Unpaid float64 `json:"unpaid"`
|
591
|
}
|
604
|
}
|
592
|
|
605
|
|
|
|
606
|
+func (credit *CreditAccountStatisticsResponse) Round(places int) *CreditAccountStatisticsResponse {
|
|
|
607
|
+ credit.Total = utils.Round(credit.Total, int32(places))
|
|
|
608
|
+ credit.Accounting = utils.Round(credit.Accounting, int32(places))
|
|
|
609
|
+ credit.Accounted = utils.Round(credit.Accounted, int32(places))
|
|
|
610
|
+ credit.Paid = utils.Round(credit.Paid, int32(places))
|
|
|
611
|
+ credit.Unpaid = utils.Round(credit.Unpaid, int32(places))
|
|
|
612
|
+ return credit
|
|
|
613
|
+}
|
|
|
614
|
+
|
593
|
//getRelevantContracts 获取相关人的合约
|
615
|
//getRelevantContracts 获取相关人的合约
|
594
|
func (ptr *CooperationStatisticsService) RelevantCooperationContractNumbers(queryOptions map[string]interface{}) (interface{}, error) {
|
616
|
func (ptr *CooperationStatisticsService) RelevantCooperationContractNumbers(queryOptions map[string]interface{}) (interface{}, error) {
|
595
|
var request = struct {
|
617
|
var request = struct {
|