...
|
...
|
@@ -402,34 +402,47 @@ func (ptr *CooperationStatisticsService) DividendsStatistics(queryOptions map[st |
|
|
|
|
|
queryOptions["cooperationContractNumbers"] = contractNumbers
|
|
|
|
|
|
var allDividendsEstimate = &CreditAccountStatisticsResponse{}
|
|
|
var annualDividendsEstimate = &CreditAccountStatisticsResponse{}
|
|
|
var quarterDividendsEstimate = &CreditAccountStatisticsResponse{}
|
|
|
var allDividends = &CreditAccountStatisticsResponse{}
|
|
|
var annualDividends = &CreditAccountStatisticsResponse{}
|
|
|
var quarterDividends = &CreditAccountStatisticsResponse{}
|
|
|
|
|
|
dividendsEstimateDao, _ := dao.NewDividendsEstimateDao(ptr.transactionContext)
|
|
|
if len(contractNumbers) > 0 {
|
|
|
if err := dividendsEstimateDao.DividendsEstimateStatistics(queryOptions, allDividendsEstimate); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
if err := creditAccountDao.DividendsStatistics(queryOptions, allDividends); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
allDividends.Accounting = allDividends.Total - allDividends.Accounted
|
|
|
allDividendsEstimate.Paid = allDividends.Paid
|
|
|
|
|
|
queryOptions["beginTime"] = time.Date(time.Now().Year(), 1, 1, 0, 0, 0, 0, time.Local)
|
|
|
queryOptions["endTime"] = time.Date(time.Now().Year(), 1, 1, 0, 0, 0, 0, time.Local).AddDate(1, 0, 0)
|
|
|
if err := dividendsEstimateDao.DividendsEstimateStatistics(queryOptions, annualDividendsEstimate); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
if err := creditAccountDao.DividendsStatistics(queryOptions, annualDividends); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
annualDividends.Accounting = annualDividends.Total - annualDividends.Accounted
|
|
|
annualDividendsEstimate.Paid = annualDividends.Paid
|
|
|
|
|
|
queryOptions["beginTime"], queryOptions["endTime"] = quarterBeginEnd()
|
|
|
if err := dividendsEstimateDao.DividendsEstimateStatistics(queryOptions, quarterDividendsEstimate); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
if err := creditAccountDao.DividendsStatistics(queryOptions, quarterDividends); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
quarterDividends.Accounting = quarterDividends.Total - quarterDividends.Accounted
|
|
|
quarterDividendsEstimate.Paid = quarterDividends.Paid
|
|
|
}
|
|
|
|
|
|
ret := map[string]interface{}{
|
|
|
"allDividends": allDividends,
|
|
|
"annualDividends": annualDividends,
|
|
|
"quarterDividends": quarterDividends,
|
|
|
"allDividends": allDividendsEstimate.Round(2),
|
|
|
"annualDividends": annualDividendsEstimate.Round(2),
|
|
|
"quarterDividends": quarterDividendsEstimate.Round(2),
|
|
|
}
|
|
|
return ret, nil
|
|
|
}
|
...
|
...
|
@@ -454,7 +467,7 @@ func quarterBeginEnd() (time.Time, time.Time) { |
|
|
mEnd = 3
|
|
|
}
|
|
|
begin = time.Date(y, time.Month(mBegin), 1, 0, 0, 0, 0, time.Local)
|
|
|
end = time.Date(y, time.Month(mEnd), 1, 0, 0, 0, 0, time.Local)
|
|
|
end = time.Date(y, time.Month(mEnd), 1, 0, 0, 0, 0, time.Local).AddDate(0, 1, 0)
|
|
|
return begin, end
|
|
|
}
|
|
|
|
...
|
...
|
@@ -590,6 +603,15 @@ type CreditAccountStatisticsResponse struct { |
|
|
Unpaid float64 `json:"unpaid"`
|
|
|
}
|
|
|
|
|
|
func (credit *CreditAccountStatisticsResponse) Round(places int) *CreditAccountStatisticsResponse {
|
|
|
credit.Total = utils.Round(credit.Total, int32(places))
|
|
|
credit.Accounting = utils.Round(credit.Accounting, int32(places))
|
|
|
credit.Accounted = utils.Round(credit.Accounted, int32(places))
|
|
|
credit.Paid = utils.Round(credit.Paid, int32(places))
|
|
|
credit.Unpaid = utils.Round(credit.Unpaid, int32(places))
|
|
|
return credit
|
|
|
}
|
|
|
|
|
|
//getRelevantContracts 获取相关人的合约
|
|
|
func (ptr *CooperationStatisticsService) RelevantCooperationContractNumbers(queryOptions map[string]interface{}) (interface{}, error) {
|
|
|
var request = struct {
|
...
|
...
|
|