实时车辆进出数据和今日车位统计中利用率修改
This commit is contained in:
parent
3021ea045a
commit
9306b3b653
@ -16,11 +16,13 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Tag(name = "大屏服务 - 停车场接口")
|
||||
@RestController
|
||||
@RequestMapping("/datacenter/h5/vehicleAccess")
|
||||
@ -99,16 +101,16 @@ public class VehicleAccessApi {
|
||||
parkingLotDataVO.setTotalParkingSpace(heartbeat.getSpaceCount());//车位总数
|
||||
parkingLotDataVO.setResidualTotal(residualStopNum);//余位总数
|
||||
// 计算利用率
|
||||
int useRatio = (parkingNum / residualStopNum) * 100;
|
||||
Double useRatio = Math.round(((parkingNum * 1.0 / heartbeat.getSpaceCount()) * 10000)) / 100.0;
|
||||
parkingLotDataVO.setUseRatio(useRatio);//总利用率
|
||||
|
||||
//设置区域停车场数据
|
||||
for (int i = 0; i < heartbeat.getAreaList().size(); i++) {
|
||||
AreaDataVO areaDataVO = new AreaDataVO();
|
||||
areaDataVO.setAreaName(heartbeat.getAreaList().get(i).getAreaName());
|
||||
areaDataVO.setParkingCount(heartbeat.getAreaList().get(i).getSpaceCount());
|
||||
areaDataVO.setLastSpaceCount(heartbeat.getAreaList().get(i).getLastSpaceCount());
|
||||
areaDataVO.setUseRatio((heartbeat.getAreaList().get(i).getLastSpaceCount() / heartbeat.getAreaList().get(i).getSpaceCount()) * 100);
|
||||
// 计算利用率
|
||||
areaDataVO.setUseRatio(Math.round((heartbeat.getAreaList().get(i).getLastSpaceCount() * 1.0 / heartbeat.getAreaList().get(i).getSpaceCount()) * 10000) / 100.0);
|
||||
parkingLotDataVO.getAreaDataVOList().add(areaDataVO);
|
||||
}
|
||||
|
||||
@ -322,7 +324,6 @@ public class VehicleAccessApi {
|
||||
revenueVO.setZfb(zfb);
|
||||
|
||||
|
||||
|
||||
return ResponseVO.success(200, "", revenueVO, 0);
|
||||
}
|
||||
|
||||
@ -334,6 +335,4 @@ public class VehicleAccessApi {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class AreaDataVO {
|
||||
|
||||
@ -15,5 +17,5 @@ public class AreaDataVO {
|
||||
private int lastSpaceCount;
|
||||
|
||||
//区域利用率
|
||||
private int useRatio;
|
||||
private Double useRatio;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.datacenter.controller.admin.vehicleaccess.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -30,7 +31,7 @@ public class ParkingLotDataVO {
|
||||
private int residualTotal;
|
||||
|
||||
//总利用率
|
||||
private int useRatio;
|
||||
private Double useRatio;
|
||||
|
||||
//区域停车场数据集合
|
||||
private List<AreaDataVO> areaDataVOList = new ArrayList<>();
|
||||
|
Loading…
Reference in New Issue
Block a user