|
@@ -29,11 +29,11 @@ func (s lightingRateService) getData(method string, tenantId int, req model.Requ
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
- flag := 1 //按天
|
|
|
- flag2 := 0
|
|
|
+ flag := 1 //能耗请求类型:按天
|
|
|
+ flag2 := 0 //亮灯率请求类型:按天
|
|
|
if method == "month" {
|
|
|
- flag = 2 //按月
|
|
|
- flag2 = 1
|
|
|
+ flag = 2 //能耗请求类型:按天
|
|
|
+ flag2 = 1 //亮灯率请求类型:按月
|
|
|
}
|
|
|
//能耗
|
|
|
forLightEnergy := edge_service.ForLightEnergy{}
|
|
@@ -61,9 +61,9 @@ func (s lightingRateService) getData(method string, tenantId int, req model.Requ
|
|
|
//fmt.Printf("LightEnergys = %v", LightEnergys)
|
|
|
var months []string
|
|
|
if method == "month" {
|
|
|
- months = common.GetTimeMonths(req.StartTime, req.EndTime) //按月
|
|
|
+ months = common.GetTimeMonths(req.StartTime, req.EndTime) //时间范围 月
|
|
|
} else {
|
|
|
- months = common.GetTimeDays(req.StartTime, req.EndTime) //按天
|
|
|
+ months = common.GetTimeDays(req.StartTime, req.EndTime) //时间范围 天
|
|
|
}
|
|
|
//fmt.Printf("months = %v \n", months)
|
|
|
for _, month := range months {
|
|
@@ -76,7 +76,7 @@ func (s lightingRateService) getData(method string, tenantId int, req model.Requ
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //亮灯率
|
|
|
var lightingRate float64
|
|
|
var lightControlNum, lightingNum int
|
|
|
for _, rate := range lightRates {
|
|
@@ -90,7 +90,7 @@ func (s lightingRateService) getData(method string, tenantId int, req model.Requ
|
|
|
lightingNum += rate.Number //亮灯数
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+ //组合数据到前端接口展示
|
|
|
list = append(list, model.ResponseLightingRate{
|
|
|
CountTime: month,
|
|
|
EnergyNum: common.Decimal(monthEnergyNum),
|