|
@@ -39,6 +39,7 @@ public class HomePageDataServiceImpl implements IHomePageDataService {
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
Double electricity = Math.random()*100+200;
|
|
|
map.put("name",deviceRegion.getRegionTitle());
|
|
|
+ map.put("tops", String.format("%.2f",electricity*(Math.random()*0.2+1)));
|
|
|
map.put("peaks", String.format("%.2f",electricity));
|
|
|
map.put("flat", String.format("%.2f",electricity*(Math.random()*0.2+0.7)));
|
|
|
map.put("valleys", String.format("%.2f",electricity*(Math.random()*0.2+0.5)));
|
|
@@ -77,66 +78,34 @@ public class HomePageDataServiceImpl implements IHomePageDataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, Long> fpvTime() {
|
|
|
- Date current = null;
|
|
|
- List<PeaksAndValleysTimeConfig> list = peaksAndValleysTimeConfigService.list();
|
|
|
- Long peaks = 0l;
|
|
|
- Long flat = 0l;
|
|
|
- Long valleys = 0l;
|
|
|
- try {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
|
|
|
- String date = format.format(new Date());
|
|
|
- current = format.parse(date);
|
|
|
- } catch (ParseException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- for (PeaksAndValleysTimeConfig config : list) {
|
|
|
- if(config.getStartTime().after(current)){
|
|
|
- if(config.getType().equals("0")){
|
|
|
- peaks += config.getEndTime().getTime()-config.getStartTime().getTime();
|
|
|
- }else if(config.getType().equals("1")){
|
|
|
- flat += config.getEndTime().getTime()-config.getStartTime().getTime();
|
|
|
- }else{
|
|
|
- valleys += config.getEndTime().getTime()-config.getStartTime().getTime();
|
|
|
- }
|
|
|
- }else if(config.getStartTime().before(current)&&config.getEndTime().after(current)){
|
|
|
- if(config.getType().equals("0")){
|
|
|
- peaks += config.getEndTime().getTime()-current.getTime();
|
|
|
- }else if(config.getType().equals("1")){
|
|
|
- flat += config.getEndTime().getTime()-current.getTime();
|
|
|
- }else{
|
|
|
- valleys += config.getEndTime().getTime()-current.getTime();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- Map<String, Long> res = new HashMap<>();
|
|
|
- res.put("peaks",peaks/60000);
|
|
|
- res.put("flat",flat/60000);
|
|
|
- res.put("valleys",valleys/60000);
|
|
|
+ public List<Map<String, String>> illegalMetering() {
|
|
|
+ List<DeviceRegion> list = deviceRegionService.list();
|
|
|
+ List<Map<String, String>> res = new ArrayList<>();
|
|
|
+ list.forEach(deviceRegion -> {
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("name",deviceRegion.getRegionTitle());
|
|
|
+ map.put("month",((int)(Math.random()*50+50))+"");
|
|
|
+ map.put("day",((int)(Math.random()*20))+"");
|
|
|
+ res.add(map);
|
|
|
+ });
|
|
|
return res;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String, String>> regionElectricityPercentage() {
|
|
|
- List<DeviceRegion> list = deviceRegionService.list();
|
|
|
- int per = 0;
|
|
|
- Map<String,Integer> map = new HashMap<>();
|
|
|
- while (per<100){
|
|
|
- int index = (int)(Math.random()*list.size());
|
|
|
- if(oConvertUtils.isNotEmpty(map.get(list.get(index).getRegionTitle()))){
|
|
|
- map.put(list.get(index).getRegionTitle(),map.get(list.get(index).getRegionTitle())+2);
|
|
|
- }else{
|
|
|
- map.put(list.get(index).getRegionTitle(),2);
|
|
|
- }
|
|
|
- per += 2;
|
|
|
- }
|
|
|
+ public List<Map<String, String>> rollingControl() {
|
|
|
List<Map<String, String>> res = new ArrayList<>();
|
|
|
- list.forEach(deviceRegion -> {
|
|
|
- Map<String,String> mapo = new HashMap<>();
|
|
|
- mapo.put("name",deviceRegion.getRegionTitle());
|
|
|
- mapo.put("value",map.get(deviceRegion.getRegionTitle())+"%");
|
|
|
- res.add(mapo);
|
|
|
+ String[] names = {"棒一","棒二","棒三","高线","板带"};
|
|
|
+ Arrays.asList(names).forEach(name -> {
|
|
|
+ Map<String, String> map = new HashMap<>();
|
|
|
+ Double electricity = Math.random()*100+200;
|
|
|
+ map.put("name",name);
|
|
|
+ map.put("tops", String.format("%.2f",electricity*(Math.random()*0.2+1)));
|
|
|
+ map.put("peaks", String.format("%.2f",electricity));
|
|
|
+ map.put("flat", String.format("%.2f",electricity*(Math.random()*0.2+0.7)));
|
|
|
+ map.put("valleys", String.format("%.2f",electricity*(Math.random()*0.2+0.5)));
|
|
|
+ res.add(map);
|
|
|
});
|
|
|
+
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -148,16 +117,19 @@ public class HomePageDataServiceImpl implements IHomePageDataService {
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
|
|
calendar.set(Calendar.MILLISECOND, 0);
|
|
|
Map<String, List> res = new HashMap<>();
|
|
|
+ List<Map<String,String>> tops = new ArrayList<>();
|
|
|
List<Map<String,String>> peaks = new ArrayList<>();
|
|
|
List<Map<String,String>> flat = new ArrayList<>();
|
|
|
List<Map<String,String>> valleys = new ArrayList<>();
|
|
|
for (int i = 0; i < 24; i++) {
|
|
|
calendar.set(Calendar.HOUR_OF_DAY, i);
|
|
|
Double electricity = Math.random()*100+200;
|
|
|
+ tops.add(getMap(calendar.getTime(),String.format("%.2f",electricity*(Math.random()*0.2+1))));
|
|
|
peaks.add(getMap(calendar.getTime(),String.format("%.2f",electricity)));
|
|
|
flat.add(getMap(calendar.getTime(),String.format("%.2f",electricity*(Math.random()*0.2+0.7))));
|
|
|
valleys.add(getMap(calendar.getTime(),String.format("%.2f",electricity*(Math.random()*0.2+0.5))));
|
|
|
}
|
|
|
+ res.put("tops",tops);
|
|
|
res.put("peaks",peaks);
|
|
|
res.put("flat",flat);
|
|
|
res.put("valleys",valleys);
|
|
@@ -187,14 +159,14 @@ public class HomePageDataServiceImpl implements IHomePageDataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<Map<String, String>> regionElectricityStats() {
|
|
|
+ public List<Map<String, String>> realDeviceRun() {
|
|
|
List<DeviceRegion> list = deviceRegionService.list();
|
|
|
List<Map<String, String>> res = new ArrayList<>();
|
|
|
if(oConvertUtils.listIsNotEmpty(list)){
|
|
|
list.forEach(deviceRegion -> {
|
|
|
Map<String,String> map = new HashMap<>();
|
|
|
map.put("name",deviceRegion.getRegionTitle());
|
|
|
- map.put("value",String.format("%.2f",Math.random()*150+100));
|
|
|
+ map.put("value",(int)(Math.random()*25+25)+"");
|
|
|
res.add(map);
|
|
|
});
|
|
|
}
|
|
@@ -202,11 +174,16 @@ public class HomePageDataServiceImpl implements IHomePageDataService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Map<String, String> fpvElectricityStats() {
|
|
|
- Map<String,String> res = new HashMap<>();
|
|
|
- res.put("peaks",String.format("%.2f",Math.random()*35+15));
|
|
|
- res.put("flat",String.format("%.2f",Math.random()*35+15));
|
|
|
- res.put("valleys",String.format("%.2f",Math.random()*35+15));
|
|
|
+ public List<Map<String, String>> electricityManage() {
|
|
|
+ List<Map<String, String>> res = new ArrayList<>();
|
|
|
+ String[] names = {"尖","峰","平","谷"};
|
|
|
+ Arrays.asList(names).forEach(name ->{
|
|
|
+ Map<String,String> map = new HashMap<>();
|
|
|
+ map.put("name",name);
|
|
|
+ map.put("yesterday",String.format("%.2f",Math.random()*35+15));
|
|
|
+ map.put("today",String.format("%.2f",Math.random()*35+15));
|
|
|
+ res.add(map);
|
|
|
+ });
|
|
|
return res;
|
|
|
}
|
|
|
|