|
@@ -9,8 +9,10 @@ import com.sky.ioc.tool.GeneralMethod;
|
|
|
import com.sky.ioc.tool.ReturnMsg;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.text.DecimalFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.ThreadLocalRandom;
|
|
|
|
|
|
/**
|
|
|
* TODO
|
|
@@ -24,16 +26,25 @@ public class EnergyServiceImpl implements EnergyService {
|
|
|
public ReturnMsg getElectricityCoreIndicators() {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",2000);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int todayElec = random.nextInt(25, 300);//今日用电
|
|
|
+ int personElec = random.nextInt(10,50);//人均
|
|
|
+ int top = random.nextInt(0,100);//同比上升
|
|
|
+ int totalElec = random.nextInt(500, 3000);
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
|
|
|
- objects.get(1).put("value",200);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
+ objects.get(0).put("value",totalElec);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
|
|
|
- objects.get(2).put("value",30);
|
|
|
+ objects.get(1).put("value",todayElec);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
|
|
|
- objects.get(3).put("value",80);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(2).put("value",top);
|
|
|
+
|
|
|
+ objects.get(3).put("value",personElec);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("用电成本月增速5%,主为动力用电");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -62,16 +73,24 @@ public class EnergyServiceImpl implements EnergyService {
|
|
|
public ReturnMsg getWaterCoreIndicators() {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",2000);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(1).put("value",200);
|
|
|
- objects.get(1).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(2).put("value",30);
|
|
|
-
|
|
|
- objects.get(3).put("value",20);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int todayWater = random.nextInt(25, 300);//今日
|
|
|
+ int personWater = random.nextInt(10,50);//人均
|
|
|
+ int top = random.nextInt(0,100);//同比上升
|
|
|
+ int totalWater = random.nextInt(500, 3000);
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",totalWater);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(1).put("value",todayWater);
|
|
|
+ objects.get(1).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(2).put("value",top);
|
|
|
+
|
|
|
+ objects.get(3).put("value",personWater);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("用水量低于行业标准20%");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -97,15 +116,23 @@ public class EnergyServiceImpl implements EnergyService {
|
|
|
public ReturnMsg getUseColdCoreIndicators() {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",2000);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(1).put("value",30);
|
|
|
-
|
|
|
- objects.get(2).put("value",80);
|
|
|
-
|
|
|
- objects.get(3).put("value",10);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int percentCold = random.nextInt(10, 100);
|
|
|
+ int personCold = random.nextInt(10,50);
|
|
|
+ int top = random.nextInt(0,100);//同比上升
|
|
|
+ int totalCold = random.nextInt(500, 3000);
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",totalCold);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(1).put("value",top);
|
|
|
+
|
|
|
+ objects.get(2).put("value",percentCold);
|
|
|
+
|
|
|
+ objects.get(3).put("value",personCold);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("本月用冷超过行业标准20%");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|
|
@@ -123,15 +150,23 @@ public class EnergyServiceImpl implements EnergyService {
|
|
|
public ReturnMsg getUseHeatCoreIndicators() {
|
|
|
Indeicator indeicator = new Indeicator();
|
|
|
List<JSONObject> objects = indeicator.getList();
|
|
|
- objects.get(0).put("value",2000);
|
|
|
- objects.get(0).put("compare",0.4);
|
|
|
-
|
|
|
- objects.get(1).put("value",30);
|
|
|
+ ThreadLocalRandom random = ThreadLocalRandom.current();
|
|
|
+ int percentHeat = random.nextInt(10, 100);
|
|
|
+ int personHeat = random.nextInt(10,50);
|
|
|
+ int top = random.nextInt(0,100);//同比上升
|
|
|
+ int totalHeat = random.nextInt(500, 3000);
|
|
|
+ float compare = (float) Math.random();
|
|
|
+ DecimalFormat decimalFormat = new DecimalFormat("#.0");
|
|
|
+ compare = Float.parseFloat(decimalFormat.format(compare));
|
|
|
+ objects.get(0).put("value",totalHeat);
|
|
|
+ objects.get(0).put("compare",compare);
|
|
|
+
|
|
|
+ objects.get(1).put("value",top);
|
|
|
|
|
|
objects.get(2).put("value",10);
|
|
|
|
|
|
- objects.get(3).put("value",10);
|
|
|
- objects.get(3).put("compare",0.4);
|
|
|
+ objects.get(3).put("value",personHeat);
|
|
|
+ objects.get(3).put("compare",compare);
|
|
|
indeicator.setWorthAttention("本月用热将超过行业标准20%");
|
|
|
indeicator.setList(objects);
|
|
|
return ReturnMsg.ok(indeicator);
|