|
@@ -214,10 +214,24 @@ public class SpaceServiceImpl implements SpaceService {
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
- int siteUsed = random.nextInt(10, 100);
|
|
|
+ Integer result = 0;
|
|
|
+ Long totalStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().eq(BuildingStation::getIsDel,0));
|
|
|
+ Long usedStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().eq(BuildingStation::getIsDel,0).eq(BuildingStation::getStatus,2));
|
|
|
+ // 创建一个数值格式化对象
|
|
|
+ NumberFormat numberFormat = NumberFormat.getInstance();
|
|
|
+ // 设置精确到小数点后2位
|
|
|
+ numberFormat.setMaximumFractionDigits(0);
|
|
|
+ if (totalStation>0) {
|
|
|
+ result = Integer.parseInt(numberFormat.format((float) usedStation / (float) totalStation * 100));
|
|
|
+ }
|
|
|
+ Long flowStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().eq(BuildingStation::getIsDel,0).eq(BuildingStation::getIsBlock,1));
|
|
|
+
|
|
|
+ Long fixedStation = buildingStationMapper.selectCount(new LambdaQueryWrapper<BuildingStation>().eq(BuildingStation::getIsDel,0).eq(BuildingStation::getIsBlock,0));
|
|
|
+
|
|
|
+ // int siteUsed = random.nextInt(10, 100);
|
|
|
int meettingUsed = random.nextInt(10, 100);
|
|
|
- int flowCount = random.nextInt(100, 500);
|
|
|
- int fixedCount = random.nextInt(300, 1000);
|
|
|
+ /* int flowCount = random.nextInt(100, 500);
|
|
|
+ int fixedCount = random.nextInt(300, 1000);*/
|
|
|
int playCount = random.nextInt(100, 500);
|
|
|
int workCount = random.nextInt(300, 1000);
|
|
|
while (playCount > workCount) {
|
|
@@ -226,16 +240,16 @@ public class SpaceServiceImpl implements SpaceService {
|
|
|
float compare = (float) Math.random();
|
|
|
compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
|
|
|
- objects.get(0).put("value", siteUsed);
|
|
|
+ objects.get(0).put("value", result);
|
|
|
objects.get(0).put("compare", compare);
|
|
|
|
|
|
objects.get(1).put("value", meettingUsed);
|
|
|
objects.get(1).put("compare", compare);
|
|
|
|
|
|
- objects.get(2).put("value", flowCount);
|
|
|
+ objects.get(2).put("value", flowStation);
|
|
|
objects.get(2).put("compare", compare);
|
|
|
|
|
|
- objects.get(3).put("value", fixedCount);
|
|
|
+ objects.get(3).put("value", fixedStation);
|
|
|
objects.get(3).put("compare", compare);
|
|
|
objects.add(new JSONObject());
|
|
|
objects.get(4).put("value", playCount + "/" + workCount);
|