|
@@ -48,7 +48,7 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getPrintingCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ /*ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
int personCost = random.nextInt(10, 100);
|
|
|
int personPaper = random.nextInt(10,20);
|
|
|
int personC = random.nextInt(15,100);
|
|
@@ -66,7 +66,18 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
objects.get(2).put("compare",compare);
|
|
|
|
|
|
objects.get(3).put("value",personNum);
|
|
|
- objects.get(3).put("compare",compare);
|
|
|
+ objects.get(3).put("compare",compare);*/
|
|
|
+ objects.get(0).put("value",10);
|
|
|
+ objects.get(0).put("compare",0.4);
|
|
|
+
|
|
|
+ objects.get(1).put("value",80);
|
|
|
+ objects.get(1).put("compare",0.4);
|
|
|
+
|
|
|
+ objects.get(2).put("value",80);
|
|
|
+ objects.get(2).put("compare",0.4);
|
|
|
+
|
|
|
+ objects.get(3).put("value",80);
|
|
|
+ objects.get(3).put("compare",0.4);
|
|
|
indeicator.setWorthAttention("今日人流高峰在9:00/17:00,记得提前做好应对喔");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -92,7 +103,7 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getBusCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ /* ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
int carCost = random.nextInt(10000, 1000000);
|
|
|
int carTimes = random.nextInt(10,80);
|
|
|
int carC = random.nextInt(150,500);
|
|
@@ -110,7 +121,18 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
objects.get(2).put("compare",compare);
|
|
|
|
|
|
objects.get(3).put("value",carHours);
|
|
|
- objects.get(3).put("compare",compare);
|
|
|
+ objects.get(3).put("compare",compare);*/
|
|
|
+ objects.get(0).put("value",100);
|
|
|
+ objects.get(0).put("compare",0.4);
|
|
|
+
|
|
|
+ objects.get(1).put("value",80);
|
|
|
+ objects.get(1).put("compare",0.4);
|
|
|
+
|
|
|
+ objects.get(2).put("value",80);
|
|
|
+ objects.get(2).put("compare",0.4);
|
|
|
+
|
|
|
+ objects.get(3).put("value",80);
|
|
|
+ objects.get(3).put("compare",0.4);
|
|
|
indeicator.setWorthAttention("增加20个公车数量");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -136,19 +158,35 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getFloorCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",60);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int stockCarbon = random.nextInt(10, 100);
|
|
|
+ int totalCarbon = random.nextInt(100,8000);
|
|
|
+ int areaCarbon = random.nextInt(10,800);
|
|
|
+ int personCarbon = random.nextInt(10,80);
|
|
|
+ while (areaCarbon>totalCarbon){
|
|
|
+ areaCarbon = random.nextInt(10,800);
|
|
|
+ }
|
|
|
+ while (personCarbon>totalCarbon){
|
|
|
+ personCarbon = random.nextInt(10,80);
|
|
|
+ }
|
|
|
+ int derCarbon = random.nextInt(10,80);
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
|
|
|
- objects.get(1).put("value",500);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
+ objects.get(0).put("value",stockCarbon);
|
|
|
|
|
|
- objects.get(2).put("value",380);
|
|
|
- objects.get(2).put("compare",0.4);
|
|
|
+ objects.get(1).put("value",totalCarbon);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",80);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(2).put("value",areaCarbon);
|
|
|
+ objects.get(2).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(3).put("value",personCarbon);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
objects.add(new JSONObject());
|
|
|
- objects.get(4).put("value",40);
|
|
|
- objects.get(4).put("compare",0.4);
|
|
|
+ objects.get(4).put("value",derCarbon);
|
|
|
+ objects.get(4).put("compare",compare);
|
|
|
|
|
|
indeicator.setWorthAttention("减少2辆车出行一周");
|
|
|
indeicator.setList(objects);
|
|
@@ -195,17 +233,29 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getVehicleCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",60);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int totalDistance = random.nextInt(50, 200);
|
|
|
+ int avgDistance = random.nextInt(5,100);
|
|
|
+ int avgHours = random.nextInt(1,10);
|
|
|
+ int avgCarbon = random.nextInt(50,500);
|
|
|
+ while (avgDistance>totalDistance){
|
|
|
+ avgDistance = random.nextInt(5,100);
|
|
|
+ }
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
|
|
|
- objects.get(1).put("value",50);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
+ objects.get(0).put("value",totalDistance);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value",5);
|
|
|
- objects.get(2).put("compare",0.4);
|
|
|
+ objects.get(1).put("value",avgDistance);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",80);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(2).put("value",avgHours);
|
|
|
+ objects.get(2).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(3).put("value",avgCarbon);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("减少2辆车出行一周");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -231,17 +281,31 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getPrintCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",60);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int totalPrint = random.nextInt(100, 1000);
|
|
|
+ int avgPrint = random.nextInt(50,500);
|
|
|
+ int avgPaper = random.nextInt(1,200);
|
|
|
+ int avgCartridge = random.nextInt(10,100);
|
|
|
+ while (avgCartridge>avgPaper){
|
|
|
+ avgCartridge = random.nextInt(10,100);
|
|
|
+ }
|
|
|
+ while (avgPrint>totalPrint){
|
|
|
+ avgPrint = random.nextInt(50,500);
|
|
|
+ }
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",totalPrint);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
|
|
|
- objects.get(1).put("value",50);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
+ objects.get(1).put("value",avgPrint);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value",500);
|
|
|
- objects.get(2).put("compare",0.4);
|
|
|
+ objects.get(2).put("value",avgPaper);
|
|
|
+ objects.get(2).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",80);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(3).put("value",avgCartridge);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("限制人均每天打印100张以内");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -283,17 +347,26 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getPhotovoltaicCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",60);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int reduPhotovoltaic = random.nextInt(1000, 10000);
|
|
|
+ int elecPhotovoltaic = random.nextInt(500,5000);
|
|
|
+ int savePhotovoltaic = random.nextInt(500,5000);
|
|
|
+ int subPhotovoltaic = random.nextInt(100,1000);
|
|
|
|
|
|
- objects.get(1).put("value",50);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",reduPhotovoltaic);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value",500);
|
|
|
- objects.get(2).put("compare",0.4);
|
|
|
+ objects.get(1).put("value",elecPhotovoltaic);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",80);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(2).put("value",savePhotovoltaic);
|
|
|
+ objects.get(2).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(3).put("value",subPhotovoltaic);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("建议扩大光伏发电面积");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -312,17 +385,28 @@ public class CarbonServiceImpl implements CarbonService {
|
|
|
public ReturnMsg getAnalyseCoreIndicators(IocDateParam iocDateParam) {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",98);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ int totalKwh = random.nextInt(10, 100);
|
|
|
+ int totalM = random.nextInt(10, 100);
|
|
|
+ int costCount = random.nextInt(1000, 5000);
|
|
|
+ int costAvg = random.nextInt(300, 1000);
|
|
|
+ while (costAvg>costCount){
|
|
|
+ costAvg = random.nextInt(300, 1000);
|
|
|
+ }
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",totalKwh);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
|
|
|
- objects.get(1).put("value",50);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
+ objects.get(1).put("value",totalM);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value",100);
|
|
|
- objects.get(2).put("compare",0.4);
|
|
|
+ objects.get(2).put("value",costCount);
|
|
|
+ objects.get(2).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",1000);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(3).put("value",costAvg);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("人均成本过高,请购买智能源服务");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|