forked from free-lancers/electricity_bill_calc_service
fix(#22):修复无法获取报表的总览信息错误
This commit is contained in:
@@ -11,6 +11,7 @@ import (
|
||||
"electricity_bill_calc/types"
|
||||
"electricity_bill_calc/vo"
|
||||
"log"
|
||||
"strconv"
|
||||
|
||||
"github.com/gofiber/fiber/v2"
|
||||
"github.com/jinzhu/copier"
|
||||
@@ -246,8 +247,26 @@ func getReportSummary(c *fiber.Ctx) error {
|
||||
reportLog.Error("未找到核算报表的总览信息")
|
||||
return result.NotFound("未找到核算报表的总览信息。")
|
||||
}
|
||||
var summaryResponse vo.ParkSummaryResponse
|
||||
copier.Copy(&summaryResponse, report)
|
||||
summaryResponse := vo.ParkSummaryResponse{
|
||||
ReportId: report.ReportId,
|
||||
OverallDisplay: vo.ConsumptionDisplay{
|
||||
AmountStr: strconv.FormatFloat(report.Overall.Amount.InexactFloat64(), 'f', -1, 64),
|
||||
FeeStr: strconv.FormatFloat(report.Overall.Fee.InexactFloat64(), 'f', -1, 64),
|
||||
PriceStr: strconv.FormatFloat(report.Overall.Price.InexactFloat64(), 'f', -1, 64),
|
||||
ProportionStr: strconv.FormatFloat(report.Overall.Proportion.InexactFloat64(), 'f', -1, 64),
|
||||
},
|
||||
Area: report.OverallArea,
|
||||
BasicFee: report.BasicFee,
|
||||
PooledBasicFeeByAmount: report.AuthorizeLoss.Amount,
|
||||
PooledBasicFeeByArea: report.BasicPooledPriceArea.Decimal,
|
||||
AdjustFee: report.AdjustFee,
|
||||
PooledAdjustFeeByAmount: report.AdjustPooledPriceConsumption.Decimal,
|
||||
PooledAdjustFeeByArea: report.AdjustPooledPriceArea.Decimal,
|
||||
Consumption: report.ConsumptionFee.Decimal,
|
||||
Loss: report.Loss.Decimal,
|
||||
LossRate: report.LossFee.Decimal,
|
||||
}
|
||||
//copier.Copy(&summaryResponse, report)
|
||||
return result.Success(
|
||||
"已经获取到核算报表的总览信息。",
|
||||
fiber.Map{"summary": summaryResponse},
|
||||
|
Reference in New Issue
Block a user