|
|
|
@@ -23,6 +23,9 @@ import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* @author gongbiao |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
public class DataTowerServiceImpl implements DataTowerService { |
|
|
|
|
|
|
|
@@ -179,26 +182,24 @@ public class DataTowerServiceImpl implements DataTowerService { |
|
|
|
return m.get("carcount"); |
|
|
|
})); |
|
|
|
|
|
|
|
TreeMap<Object, Object> historymap = new TreeMap<>(); |
|
|
|
for (String date : tjTimeList) { |
|
|
|
Object o = collect.get(date); |
|
|
|
if (o == null) { |
|
|
|
collect.put(date.substring(5).replace("-", "/"), 0L); |
|
|
|
historymap.put(date.substring(5).replace("-", "/"), 0L); |
|
|
|
} 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<>(); |
|
|
|
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); |
|
|
|
//环比 |
|
|
|
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) { |
|
|
|
double hbd = (double) (todaycar - yesterdaycar) / yesterdaycar * 100; |
|
|
|
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) { |
|
|
|
double lasthbd = (double) (todaycar - last) / last * 100; |
|
|
|
double lasthb = new BigDecimal(lasthbd).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue(); |
|
|
|
|