Просмотр исходного кода

[数据塔台][车流数据][修改历史流量]

release_toaliyun_real
gongbiao 7 лет назад
Родитель
Сommit
2f3dfe600c
1 измененных файлов: 9 добавлений и 8 удалений
  1. +9
    -8
      mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java

+ 9
- 8
mallinkService/src/main/java/com/iformall/service/impl/DataTowerServiceImpl.java Просмотреть файл

@@ -23,6 +23,9 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;




/**
* @author gongbiao
*/
@Service @Service
public class DataTowerServiceImpl implements DataTowerService { public class DataTowerServiceImpl implements DataTowerService {


@@ -179,26 +182,24 @@ public class DataTowerServiceImpl implements DataTowerService {
return m.get("carcount"); return m.get("carcount");
})); }));


TreeMap<Object, Object> historymap = new TreeMap<>();
for (String date : tjTimeList) { for (String date : tjTimeList) {
Object o = collect.get(date); Object o = collect.get(date);
if (o == null) { if (o == null) {
collect.put(date.substring(5).replace("-", "/"), 0L);
historymap.put(date.substring(5).replace("-", "/"), 0L);
} else { } else {
collect.put(date.substring(5).replace("-", "/"), o);
historymap.put(date.substring(5).replace("-", "/"), o);
} }
} }


TreeMap<Object, Object> historymap = new TreeMap<>();
historymap.putAll(collect);

Map<String, Object> datamap = new HashMap<>(); Map<String, Object> datamap = new HashMap<>();
datamap.put("history", historymap); datamap.put("history", historymap);


//今日车流量 //今日车流量
long todaycar = (long) collect.get(DateUtils.getSystemTime("MM/dd"));
long todaycar = (long) historymap.get(DateUtils.getSystemTime("MM/dd"));
datamap.put("todaycar", todaycar); datamap.put("todaycar", todaycar);
//环比 //环比
long yesterdaycar = (long) collect.get(tjTimeList.get(8 - 2).substring(5).replace("-", "/"));
long yesterdaycar = (long) historymap.get(tjTimeList.get(8 - 2).substring(5).replace("-", "/"));
if (yesterdaycar > 0) { if (yesterdaycar > 0) {
double hbd = (double) (todaycar - yesterdaycar) / yesterdaycar * 100; double hbd = (double) (todaycar - yesterdaycar) / yesterdaycar * 100;
double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double hb = new BigDecimal(hbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
@@ -208,7 +209,7 @@ public class DataTowerServiceImpl implements DataTowerService {
} }


//上周同期 //上周同期
long last = (long) collect.get(tjTimeList.get(0).substring(5).replace("-", "/"));
long last = (long) historymap.get(tjTimeList.get(0).substring(5).replace("-", "/"));
if (last > 0) { if (last > 0) {
double lasthbd = (double) (todaycar - last) / last * 100; double lasthbd = (double) (todaycar - last) / last * 100;
double lasthb = new BigDecimal(lasthbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); double lasthb = new BigDecimal(lasthbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();


Загрузка…
Отмена
Сохранить