|
@@ -82,19 +82,34 @@ public class SpaceServiceImpl implements SpaceService {
|
|
|
public ReturnMsg getFloorCoreIndicators(IocParam iocParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- BuildingSpace buildingSpace = buildingSpaceMapper.getByTier(iocParam);
|
|
|
- String floorCode = iocParam.getFloorId()+"F";
|
|
|
- if(iocParam.getFloorId()<0){
|
|
|
- floorCode = "B"+Math.abs(iocParam.getFloorId());
|
|
|
+ BuildingSpace buildingSpace = null;
|
|
|
+ String floorCode = "";
|
|
|
+ BuildingFloor floor = null;
|
|
|
+ if(iocParam.getFloorId()==null){
|
|
|
+ buildingSpace = buildingSpaceMapper.getSumByTier();
|
|
|
+ }else{
|
|
|
+ buildingSpace = buildingSpaceMapper.getByTier(iocParam);
|
|
|
+ floorCode = iocParam.getFloorId()+"F";
|
|
|
+ if(iocParam.getFloorId()<0){
|
|
|
+ floorCode = "B"+Math.abs(iocParam.getFloorId());
|
|
|
+ }
|
|
|
+ floor = buildingFloorMapper.selectOne(new LambdaQueryWrapper<BuildingFloor>().eq(BuildingFloor::getCode,floorCode));
|
|
|
}
|
|
|
- BuildingFloor floor = buildingFloorMapper.selectOne(new LambdaQueryWrapper<BuildingFloor>().eq(BuildingFloor::getCode,floorCode));
|
|
|
Integer result =0;
|
|
|
Long totalStation = 0l;
|
|
|
+ List<BuildingRoom> rooms = null;
|
|
|
if(floor!=null){
|
|
|
- List<BuildingRoom> rooms = buildingRoomMapper.selectList(new LambdaQueryWrapper<BuildingRoom>().eq(BuildingRoom::getFloorId,floor.getId()));
|
|
|
+ rooms = buildingRoomMapper.selectList(new LambdaQueryWrapper<BuildingRoom>().eq(BuildingRoom::getFloorId,floor.getId()));
|
|
|
+ }else{
|
|
|
+ if(iocParam.getFloorId()==null){
|
|
|
+ rooms = buildingRoomMapper.selectList(null);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(rooms!=null){
|
|
|
List<Integer> ids = rooms.stream().map(BuildingRoom::getId).collect(Collectors.toList());
|
|
|
totalStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().in(BuildingStation::getRoomId,ids));
|
|
|
- Long usedStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().in(BuildingStation::getRoomId,ids).eq(BuildingStation::getStatus,2));
|
|
|
+ Long usedStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().in(BuildingStation::getRoomId,ids)
|
|
|
+ .eq(BuildingStation::getStatus,2));
|
|
|
// 创建一个数值格式化对象
|
|
|
NumberFormat numberFormat = NumberFormat.getInstance();
|
|
|
// 设置精确到小数点后2位
|
|
@@ -102,7 +117,6 @@ public class SpaceServiceImpl implements SpaceService {
|
|
|
if (totalStation>0) {
|
|
|
result = Integer.parseInt(numberFormat.format((float) usedStation / (float) totalStation * 100));
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
if (buildingSpace != null) {
|
|
|
objects.get(0).put("value",result);
|
|
@@ -110,18 +124,14 @@ public class SpaceServiceImpl implements SpaceService {
|
|
|
objects.get(2).put("value", buildingSpace.getWorkArea());
|
|
|
objects.get(3).put("value", buildingSpace.getMeetingArea());
|
|
|
objects.add(new JSONObject());
|
|
|
- objects.add(new JSONObject());
|
|
|
- objects.get(4).put("value", buildingSpace.getLeadArea());
|
|
|
- objects.get(5).put("value", buildingSpace.getOtherArea());
|
|
|
+ objects.get(4).put("value", buildingSpace.getOtherArea());
|
|
|
} else {
|
|
|
objects.get(0).put("value", result);
|
|
|
objects.get(1).put("value", totalStation);
|
|
|
objects.get(2).put("value", 0);
|
|
|
objects.get(3).put("value", 0);
|
|
|
objects.add(new JSONObject());
|
|
|
- objects.add(new JSONObject());
|
|
|
objects.get(4).put("value", 0);
|
|
|
- objects.get(5).put("value", 0);
|
|
|
}
|
|
|
|
|
|
indeicator.setList(objects);
|