|
|
@ -4,6 +4,8 @@ import java.io.IOException; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
|
import java.text.ParseException; |
|
|
import java.text.ParseException; |
|
|
import java.text.SimpleDateFormat; |
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
import java.time.ZoneId; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
@ -70,6 +72,8 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
dataList = dcTrafficSurveyDataMapper.selectYear(dcTrafficSurveyData); |
|
|
dataList = dcTrafficSurveyDataMapper.selectYear(dcTrafficSurveyData); |
|
|
} else if (dcTrafficSurveyData.getType().equals("range")){ |
|
|
} else if (dcTrafficSurveyData.getType().equals("range")){ |
|
|
dataList = dcTrafficSurveyDataMapper.selectRange(dcTrafficSurveyData); |
|
|
dataList = dcTrafficSurveyDataMapper.selectRange(dcTrafficSurveyData); |
|
|
|
|
|
} else if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
dataList = dcTrafficSurveyDataMapper.selectWeek(dcTrafficSurveyData); |
|
|
} |
|
|
} |
|
|
Map<String,Map<String, Map<String, List<DcTrafficSurveyData>>>> groupedData = dataList.stream() |
|
|
Map<String,Map<String, Map<String, List<DcTrafficSurveyData>>>> groupedData = dataList.stream() |
|
|
.collect(Collectors.groupingBy( |
|
|
.collect(Collectors.groupingBy( |
|
|
@ -209,6 +213,8 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
dataList = dcTrafficSurveyDataMapper.selectYear(dcTrafficSurveyData); |
|
|
dataList = dcTrafficSurveyDataMapper.selectYear(dcTrafficSurveyData); |
|
|
} else if (dcTrafficSurveyData.getType().equals("range")){ |
|
|
} else if (dcTrafficSurveyData.getType().equals("range")){ |
|
|
dataList = dcTrafficSurveyDataMapper.selectRange(dcTrafficSurveyData); |
|
|
dataList = dcTrafficSurveyDataMapper.selectRange(dcTrafficSurveyData); |
|
|
|
|
|
} else if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
dataList = dcTrafficSurveyDataMapper.selectWeek(dcTrafficSurveyData); |
|
|
} |
|
|
} |
|
|
Map<String,Map<String, Map<String, List<DcTrafficSurveyData>>>> groupedData = dataList.stream() |
|
|
Map<String,Map<String, Map<String, List<DcTrafficSurveyData>>>> groupedData = dataList.stream() |
|
|
.collect(Collectors.groupingBy( |
|
|
.collect(Collectors.groupingBy( |
|
|
@ -281,6 +287,41 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
busRow.put("total",bus); |
|
|
busRow.put("total",bus); |
|
|
goodsCarRow.put("total",goodsCar); |
|
|
goodsCarRow.put("total",goodsCar); |
|
|
totalRow.put("total",total); |
|
|
totalRow.put("total",total); |
|
|
|
|
|
|
|
|
|
|
|
//查询周数据时,计算周平均、日均
|
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
LocalDate timestamp = dcTrafficSurveyData.getTimestamp().toInstant() |
|
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
//查询的是当年
|
|
|
|
|
|
if (now.getYear() == timestamp.getYear()){ |
|
|
|
|
|
int dayOfYear = now.getDayOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",bus / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCar / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",total / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
int weekCount = (dayOfYear - 1) / 7 + 1; |
|
|
|
|
|
row.put("avgWeek",total / weekCount); |
|
|
|
|
|
busRow.put("avgWeek",bus / weekCount); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCar / weekCount); |
|
|
|
|
|
totalRow.put("avgWeek",total / weekCount); |
|
|
|
|
|
} else { |
|
|
|
|
|
int dayOfYear = timestamp.lengthOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",bus / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCar / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",total / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
row.put("avgWeek",total / 53); |
|
|
|
|
|
busRow.put("avgWeek",bus / 53); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCar / 53); |
|
|
|
|
|
totalRow.put("avgWeek",total / 53); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
row.put(columnMap.get("key"),0); |
|
|
row.put(columnMap.get("key"),0); |
|
|
@ -320,6 +361,45 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
busRow.put("total",Integer.parseInt(busRow.get("total").toString()) + bus); |
|
|
busRow.put("total",Integer.parseInt(busRow.get("total").toString()) + bus); |
|
|
goodsCarRow.put("total",Integer.parseInt(goodsCarRow.get("total").toString()) + goodsCar); |
|
|
goodsCarRow.put("total",Integer.parseInt(goodsCarRow.get("total").toString()) + goodsCar); |
|
|
totalRow.put("total",Integer.parseInt(totalRow.get("total").toString()) + total); |
|
|
totalRow.put("total",Integer.parseInt(totalRow.get("total").toString()) + total); |
|
|
|
|
|
|
|
|
|
|
|
//查询周数据时,计算周平均、日均
|
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
LocalDate timestamp = dcTrafficSurveyData.getTimestamp().toInstant() |
|
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
|
|
|
|
|
|
int busTotal = Integer.parseInt(busRow.get("total").toString()); |
|
|
|
|
|
int goodsCarTotal = Integer.parseInt(goodsCarRow.get("total").toString()); |
|
|
|
|
|
int totalRowTotal = Integer.parseInt(totalRow.get("total").toString()); |
|
|
|
|
|
|
|
|
|
|
|
//查询的是当年
|
|
|
|
|
|
if (now.getYear() == timestamp.getYear()){ |
|
|
|
|
|
int dayOfYear = now.getDayOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",busTotal / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCarTotal / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",totalRowTotal / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
int weekCount = (dayOfYear - 1) / 7 + 1; |
|
|
|
|
|
row.put("avgWeek",total / weekCount); |
|
|
|
|
|
busRow.put("avgWeek",busTotal / weekCount); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCarTotal / weekCount); |
|
|
|
|
|
totalRow.put("avgWeek",totalRowTotal / weekCount); |
|
|
|
|
|
} else { |
|
|
|
|
|
int dayOfYear = timestamp.lengthOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",busTotal / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCarTotal / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",totalRowTotal / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
row.put("avgWeek",total / 53); |
|
|
|
|
|
busRow.put("avgWeek",busTotal / 53); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCarTotal / 53); |
|
|
|
|
|
totalRow.put("avgWeek",totalRowTotal / 53); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
row.put(columnMap.get("key"),0); |
|
|
row.put(columnMap.get("key"),0); |
|
|
@ -347,8 +427,12 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
Integer allTotal = Integer.valueOf(totalRow.get("total").toString()); |
|
|
Integer allTotal = Integer.valueOf(totalRow.get("total").toString()); |
|
|
if (allTotal > 0){ |
|
|
if (allTotal > 0){ |
|
|
busRatioRow.put("total",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
busRatioRow.put("total",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
|
|
|
busRatioRow.put("avgWeek",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
|
|
|
busRatioRow.put("avgDay",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
} else { |
|
|
} else { |
|
|
busRatioRow.put("total","0.00%"); |
|
|
busRatioRow.put("total","0.00%"); |
|
|
|
|
|
busRatioRow.put("avgWeek","0.00%"); |
|
|
|
|
|
busRatioRow.put("avgDay","0.00%"); |
|
|
} |
|
|
} |
|
|
rowList.add(busRatioRow); |
|
|
rowList.add(busRatioRow); |
|
|
|
|
|
|
|
|
@ -370,8 +454,12 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
Integer allGoodsCarTotal = Integer.valueOf(goodsCarRow.get("total").toString()); |
|
|
Integer allGoodsCarTotal = Integer.valueOf(goodsCarRow.get("total").toString()); |
|
|
if (allTotal > 0){ |
|
|
if (allTotal > 0){ |
|
|
goodsCarRatioRow.put("total",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
goodsCarRatioRow.put("total",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgWeek",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgDay",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
} else { |
|
|
} else { |
|
|
goodsCarRatioRow.put("total","0.00%"); |
|
|
goodsCarRatioRow.put("total","0.00%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgWeek","0.00%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgDay","0.00%"); |
|
|
} |
|
|
} |
|
|
rowList.add(goodsCarRatioRow); |
|
|
rowList.add(goodsCarRatioRow); |
|
|
|
|
|
|
|
|
@ -409,6 +497,34 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
} |
|
|
} |
|
|
row.put("total",total); |
|
|
row.put("total",total); |
|
|
totalRow.put("total",total); |
|
|
totalRow.put("total",total); |
|
|
|
|
|
|
|
|
|
|
|
//查询周数据时,计算周平均、日均
|
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
LocalDate timestamp = dcTrafficSurveyData.getTimestamp().toInstant() |
|
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询的是当年
|
|
|
|
|
|
if (now.getYear() == timestamp.getYear()){ |
|
|
|
|
|
int dayOfYear = now.getDayOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",total / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
int weekCount = (dayOfYear - 1) / 7 + 1; |
|
|
|
|
|
row.put("avgWeek",total / weekCount); |
|
|
|
|
|
totalRow.put("avgWeek",total / weekCount); |
|
|
|
|
|
} else { |
|
|
|
|
|
int dayOfYear = timestamp.lengthOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",total / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
row.put("avgWeek",total / 53); |
|
|
|
|
|
totalRow.put("avgWeek",total / 53); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} else { |
|
|
} else { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
row.put(columnMap.get("key"),0); |
|
|
row.put(columnMap.get("key"),0); |
|
|
@ -438,6 +554,37 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
} |
|
|
} |
|
|
row.put("total",total); |
|
|
row.put("total",total); |
|
|
totalRow.put("total",Integer.parseInt(totalRow.get("total").toString()) + total); |
|
|
totalRow.put("total",Integer.parseInt(totalRow.get("total").toString()) + total); |
|
|
|
|
|
|
|
|
|
|
|
//查询周数据时,计算周平均、日均
|
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
LocalDate timestamp = dcTrafficSurveyData.getTimestamp().toInstant() |
|
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
|
|
|
|
|
|
int totalRowTotal = Integer.parseInt(totalRow.get("total").toString()); |
|
|
|
|
|
|
|
|
|
|
|
//查询的是当年
|
|
|
|
|
|
if (now.getYear() == timestamp.getYear()){ |
|
|
|
|
|
int dayOfYear = now.getDayOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",totalRowTotal / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
int weekCount = (dayOfYear - 1) / 7 + 1; |
|
|
|
|
|
row.put("avgWeek",total / weekCount); |
|
|
|
|
|
totalRow.put("avgWeek",totalRowTotal / weekCount); |
|
|
|
|
|
} else { |
|
|
|
|
|
int dayOfYear = timestamp.lengthOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",totalRowTotal / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
row.put("avgWeek",total / 53); |
|
|
|
|
|
totalRow.put("avgWeek",totalRowTotal / 53); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else { |
|
|
} else { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
for (Map<String, String> columnMap : columnList) { |
|
|
row.put(columnMap.get("key"),0); |
|
|
row.put(columnMap.get("key"),0); |
|
|
@ -497,6 +644,38 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
busRow.put("total",bus); |
|
|
busRow.put("total",bus); |
|
|
goodsCarRow.put("total",goodsCar); |
|
|
goodsCarRow.put("total",goodsCar); |
|
|
totalRow.put("total",total); |
|
|
totalRow.put("total",total); |
|
|
|
|
|
|
|
|
|
|
|
//查询周数据时,计算周平均、日均
|
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
LocalDate timestamp = dcTrafficSurveyData.getTimestamp().toInstant() |
|
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
//查询的是当年
|
|
|
|
|
|
if (now.getYear() == timestamp.getYear()){ |
|
|
|
|
|
int dayOfYear = now.getDayOfYear(); |
|
|
|
|
|
busRow.put("avgDay",bus / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCar / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",total / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
int weekCount = (dayOfYear - 1) / 7 + 1; |
|
|
|
|
|
busRow.put("avgWeek",bus / weekCount); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCar / weekCount); |
|
|
|
|
|
totalRow.put("avgWeek",total / weekCount); |
|
|
|
|
|
} else { |
|
|
|
|
|
int dayOfYear = timestamp.lengthOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",bus / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCar / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",total / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
row.put("avgWeek",total / 53); |
|
|
|
|
|
busRow.put("avgWeek",bus / 53); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCar / 53); |
|
|
|
|
|
totalRow.put("avgWeek",total / 53); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//单个设备菏泽方向数据
|
|
|
//单个设备菏泽方向数据
|
|
|
@ -523,6 +702,45 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
busRow.put("total",Integer.parseInt(busRow.get("total").toString()) + bus); |
|
|
busRow.put("total",Integer.parseInt(busRow.get("total").toString()) + bus); |
|
|
goodsCarRow.put("total",Integer.parseInt(goodsCarRow.get("total").toString()) + goodsCar); |
|
|
goodsCarRow.put("total",Integer.parseInt(goodsCarRow.get("total").toString()) + goodsCar); |
|
|
totalRow.put("total",Integer.parseInt(totalRow.get("total").toString()) + total); |
|
|
totalRow.put("total",Integer.parseInt(totalRow.get("total").toString()) + total); |
|
|
|
|
|
|
|
|
|
|
|
//查询周数据时,计算周平均、日均
|
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
LocalDate timestamp = dcTrafficSurveyData.getTimestamp().toInstant() |
|
|
|
|
|
.atZone(ZoneId.systemDefault()) |
|
|
|
|
|
.toLocalDate(); |
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
|
|
|
|
|
|
int busTotal = Integer.parseInt(busRow.get("total").toString()); |
|
|
|
|
|
int goodsCarTotal = Integer.parseInt(goodsCarRow.get("total").toString()); |
|
|
|
|
|
int totalRowTotal = Integer.parseInt(totalRow.get("total").toString()); |
|
|
|
|
|
|
|
|
|
|
|
//查询的是当年
|
|
|
|
|
|
if (now.getYear() == timestamp.getYear()){ |
|
|
|
|
|
int dayOfYear = now.getDayOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",busTotal / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCarTotal / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",totalRowTotal / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
int weekCount = (dayOfYear - 1) / 7 + 1; |
|
|
|
|
|
row.put("avgWeek",total / weekCount); |
|
|
|
|
|
busRow.put("avgWeek",busTotal / weekCount); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCarTotal / weekCount); |
|
|
|
|
|
totalRow.put("avgWeek",totalRowTotal / weekCount); |
|
|
|
|
|
} else { |
|
|
|
|
|
int dayOfYear = timestamp.lengthOfYear(); |
|
|
|
|
|
row.put("avgDay",total / dayOfYear); |
|
|
|
|
|
busRow.put("avgDay",busTotal / dayOfYear); |
|
|
|
|
|
goodsCarRow.put("avgDay",goodsCarTotal / dayOfYear); |
|
|
|
|
|
totalRow.put("avgDay",totalRowTotal / dayOfYear); |
|
|
|
|
|
|
|
|
|
|
|
row.put("avgWeek",total / 53); |
|
|
|
|
|
busRow.put("avgWeek",busTotal / 53); |
|
|
|
|
|
goodsCarRow.put("avgWeek",goodsCarTotal / 53); |
|
|
|
|
|
totalRow.put("avgWeek",totalRowTotal / 53); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
//客车
|
|
|
//客车
|
|
|
@ -544,8 +762,12 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
Integer allTotal = Integer.valueOf(totalRow.get("total").toString()); |
|
|
Integer allTotal = Integer.valueOf(totalRow.get("total").toString()); |
|
|
if (allTotal > 0){ |
|
|
if (allTotal > 0){ |
|
|
busRatioRow.put("total",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
busRatioRow.put("total",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
|
|
|
busRatioRow.put("avgWeek",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
|
|
|
busRatioRow.put("avgDay",String.format("%.2f",(double) allBusTotal / allTotal * 100) + "%"); |
|
|
} else { |
|
|
} else { |
|
|
busRatioRow.put("total","0.00%"); |
|
|
busRatioRow.put("total","0.00%"); |
|
|
|
|
|
busRatioRow.put("avgWeek","0.00%"); |
|
|
|
|
|
busRatioRow.put("avgDay","0.00%"); |
|
|
} |
|
|
} |
|
|
rowList.add(busRatioRow); |
|
|
rowList.add(busRatioRow); |
|
|
|
|
|
|
|
|
@ -567,8 +789,12 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
Integer allGoodsCarTotal = Integer.valueOf(goodsCarRow.get("total").toString()); |
|
|
Integer allGoodsCarTotal = Integer.valueOf(goodsCarRow.get("total").toString()); |
|
|
if (allTotal > 0){ |
|
|
if (allTotal > 0){ |
|
|
goodsCarRatioRow.put("total",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
goodsCarRatioRow.put("total",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgWeek",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgDay",String.format("%.2f",(double) allGoodsCarTotal / allTotal * 100) + "%"); |
|
|
} else { |
|
|
} else { |
|
|
goodsCarRatioRow.put("total","0.00%"); |
|
|
goodsCarRatioRow.put("total","0.00%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgWeek","0.00%"); |
|
|
|
|
|
goodsCarRatioRow.put("avgDay","0.00%"); |
|
|
} |
|
|
} |
|
|
rowList.add(goodsCarRatioRow); |
|
|
rowList.add(goodsCarRatioRow); |
|
|
|
|
|
|
|
|
@ -588,6 +814,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -597,6 +827,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -606,6 +840,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -615,6 +853,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -624,6 +866,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -633,6 +879,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
//单个设备合计数据
|
|
|
//单个设备合计数据
|
|
|
@ -643,6 +893,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
} else if (dcTrafficSurveyData.getRowType().equals("2")) { |
|
|
} else if (dcTrafficSurveyData.getRowType().equals("2")) { |
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -652,6 +906,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -661,6 +919,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
//单个设备合计数据
|
|
|
//单个设备合计数据
|
|
|
@ -671,6 +933,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
} else { |
|
|
} else { |
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -680,6 +946,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -689,6 +959,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -698,6 +972,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
row = new HashMap<>(); |
|
|
row = new HashMap<>(); |
|
|
@ -707,6 +985,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
|
|
|
|
|
|
//单个设备合计数据
|
|
|
//单个设备合计数据
|
|
|
@ -717,6 +999,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
row.put(columnMap.get("key"), 0); |
|
|
row.put(columnMap.get("key"), 0); |
|
|
} |
|
|
} |
|
|
row.put("total", 0); |
|
|
row.put("total", 0); |
|
|
|
|
|
if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
row.put("avgWeek", 0); |
|
|
|
|
|
row.put("avgDay", 0); |
|
|
|
|
|
} |
|
|
rowList.add(row); |
|
|
rowList.add(row); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
@ -772,6 +1058,13 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
|
|
|
|
|
|
startCal.add(Calendar.DATE, 1); |
|
|
startCal.add(Calendar.DATE, 1); |
|
|
} |
|
|
} |
|
|
|
|
|
} else if (dcTrafficSurveyData.getType().equals("week")){ |
|
|
|
|
|
for (int i = 1; i <= 53; i++) { |
|
|
|
|
|
column = new HashMap<>(); |
|
|
|
|
|
column.put("label","第"+i+"周"); |
|
|
|
|
|
column.put("key",String.valueOf(i)); |
|
|
|
|
|
columnList.add(column); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
return columnList; |
|
|
return columnList; |
|
|
} |
|
|
} |
|
|
@ -903,6 +1196,11 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
dcTrafficVolumeDirectionData.setTractorTrafficVolumeJN(trafficVolumeData.getTractorTrafficVolume()); |
|
|
dcTrafficVolumeDirectionData.setTractorTrafficVolumeJN(trafficVolumeData.getTractorTrafficVolume()); |
|
|
dcTrafficVolumeDirectionData.setTrafficVolumeJN(trafficVolumeData.getTrafficVolume()); |
|
|
dcTrafficVolumeDirectionData.setTrafficVolumeJN(trafficVolumeData.getTrafficVolume()); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if ("5".equals(dcTrafficSurveyDataQueryParams.getType())){ |
|
|
|
|
|
dcTrafficVolumeDirectionData.setAvgDailyTrafficVolume(dcTrafficVolumeDirectionData.getAvgDailyTrafficVolume() + trafficVolumeData.getAvgDailyTrafficVolume()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
dcTrafficVolumeDirectionData.setAllTrafficVolume(dcTrafficVolumeDirectionData.getTrafficVolumeHZ()+dcTrafficVolumeDirectionData.getTrafficVolumeJN()); |
|
|
dcTrafficVolumeDirectionData.setAllTrafficVolume(dcTrafficVolumeDirectionData.getTrafficVolumeHZ()+dcTrafficVolumeDirectionData.getTrafficVolumeJN()); |
|
|
@ -910,6 +1208,7 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
result.add(dcTrafficVolumeDirectionData); |
|
|
result.add(dcTrafficVolumeDirectionData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//自然合计值
|
|
|
//自然合计值
|
|
|
DcTrafficVolumeDirectionData naturalTotal = new DcTrafficVolumeDirectionData(0); |
|
|
DcTrafficVolumeDirectionData naturalTotal = new DcTrafficVolumeDirectionData(0); |
|
|
naturalTotal.setTime("自然合计值"); |
|
|
naturalTotal.setTime("自然合计值"); |
|
|
@ -936,6 +1235,8 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
naturalTotal.setTrafficVolumeJN(naturalTotal.getTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getTrafficVolumeJN()); |
|
|
naturalTotal.setTrafficVolumeJN(naturalTotal.getTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getTrafficVolumeJN()); |
|
|
naturalTotal.setAllTrafficVolume(naturalTotal.getTrafficVolumeJN() + naturalTotal.getTrafficVolumeHZ()); |
|
|
naturalTotal.setAllTrafficVolume(naturalTotal.getTrafficVolumeJN() + naturalTotal.getTrafficVolumeHZ()); |
|
|
} |
|
|
} |
|
|
|
|
|
naturalTotal.setAvgDailyTrafficVolume(null); |
|
|
|
|
|
|
|
|
//折算值
|
|
|
//折算值
|
|
|
DcTrafficVolumeDirectionData conversionValue = new DcTrafficVolumeDirectionData(0); |
|
|
DcTrafficVolumeDirectionData conversionValue = new DcTrafficVolumeDirectionData(0); |
|
|
conversionValue.setTime("折算值"); |
|
|
conversionValue.setTime("折算值"); |
|
|
@ -972,6 +1273,7 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
conversionValue.getTractorTrafficVolumeJN(); |
|
|
conversionValue.getTractorTrafficVolumeJN(); |
|
|
conversionValue.setTrafficVolumeJN(trafficVolumeJN); |
|
|
conversionValue.setTrafficVolumeJN(trafficVolumeJN); |
|
|
conversionValue.setAllTrafficVolume(trafficVolumeHZ + trafficVolumeJN); |
|
|
conversionValue.setAllTrafficVolume(trafficVolumeHZ + trafficVolumeJN); |
|
|
|
|
|
conversionValue.setAvgDailyTrafficVolume(null); |
|
|
|
|
|
|
|
|
//自然平均值
|
|
|
//自然平均值
|
|
|
DcTrafficVolumeDirectionData naturalAvg = new DcTrafficVolumeDirectionData(0); |
|
|
DcTrafficVolumeDirectionData naturalAvg = new DcTrafficVolumeDirectionData(0); |
|
|
@ -1007,6 +1309,8 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
naturalAvg.getTractorTrafficVolumeJN(); |
|
|
naturalAvg.getTractorTrafficVolumeJN(); |
|
|
naturalAvg.setTrafficVolumeJN(naturalAvgTrafficVolumeJN); |
|
|
naturalAvg.setTrafficVolumeJN(naturalAvgTrafficVolumeJN); |
|
|
naturalAvg.setAllTrafficVolume(naturalAvgTrafficVolumeHZ + naturalAvgTrafficVolumeJN); |
|
|
naturalAvg.setAllTrafficVolume(naturalAvgTrafficVolumeHZ + naturalAvgTrafficVolumeJN); |
|
|
|
|
|
naturalAvg.setAvgDailyTrafficVolume(null); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//折算平均值
|
|
|
//折算平均值
|
|
|
DcTrafficVolumeDirectionData conversionAvg = new DcTrafficVolumeDirectionData(0); |
|
|
DcTrafficVolumeDirectionData conversionAvg = new DcTrafficVolumeDirectionData(0); |
|
|
@ -1042,8 +1346,17 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
conversionAvg.getTractorTrafficVolumeJN(); |
|
|
conversionAvg.getTractorTrafficVolumeJN(); |
|
|
conversionAvg.setTrafficVolumeJN(conversionAvgTrafficVolumeJN); |
|
|
conversionAvg.setTrafficVolumeJN(conversionAvgTrafficVolumeJN); |
|
|
conversionAvg.setAllTrafficVolume(conversionAvgTrafficVolumeHZ + conversionAvgTrafficVolumeJN); |
|
|
conversionAvg.setAllTrafficVolume(conversionAvgTrafficVolumeHZ + conversionAvgTrafficVolumeJN); |
|
|
|
|
|
conversionAvg.setAvgDailyTrafficVolume(null); |
|
|
|
|
|
|
|
|
|
|
|
if ("5".equals(dcTrafficSurveyDataQueryParams.getType())){ |
|
|
|
|
|
result = result.stream() |
|
|
|
|
|
.sorted(Comparator.comparingInt(d -> extractWeekNumber(d.getTime()))) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
calculateGrowthRates(result, dcTrafficSurveyDataQueryParams); |
|
|
|
|
|
} else { |
|
|
|
|
|
result = result.stream().sorted(Comparator.comparing(DcTrafficVolumeDirectionData::getTime)).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
result = result.stream().sorted(Comparator.comparing(DcTrafficVolumeDirectionData::getTime)).collect(Collectors.toList()); |
|
|
|
|
|
result.add(naturalTotal); |
|
|
result.add(naturalTotal); |
|
|
result.add(conversionValue); |
|
|
result.add(conversionValue); |
|
|
result.add(naturalAvg); |
|
|
result.add(naturalAvg); |
|
|
@ -1078,6 +1391,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
carTypeData.setGoodsCarRatioJN(String.format("%.2f", (double) carTypeData.getGoodsCarJN() / carTypeData.getTrafficVolumeJN() * 100) + "%"); |
|
|
carTypeData.setGoodsCarRatioJN(String.format("%.2f", (double) carTypeData.getGoodsCarJN() / carTypeData.getTrafficVolumeJN() * 100) + "%"); |
|
|
carTypeData.setTrafficVolumeRatioHZ(String.format("%.2f", (double) carTypeData.getTrafficVolumeHZ() / carTypeData.getAllTrafficVolume() * 100) + "%"); |
|
|
carTypeData.setTrafficVolumeRatioHZ(String.format("%.2f", (double) carTypeData.getTrafficVolumeHZ() / carTypeData.getAllTrafficVolume() * 100) + "%"); |
|
|
carTypeData.setTrafficVolumeRatioJN(String.format("%.2f", (double) carTypeData.getTrafficVolumeJN() / carTypeData.getAllTrafficVolume() * 100) + "%"); |
|
|
carTypeData.setTrafficVolumeRatioJN(String.format("%.2f", (double) carTypeData.getTrafficVolumeJN() / carTypeData.getAllTrafficVolume() * 100) + "%"); |
|
|
|
|
|
carTypeData.setAvgDailyTrafficVolume(dcTrafficVolumeDirectionData.getAvgDailyTrafficVolume()); |
|
|
|
|
|
carTypeData.setYoyGrowthRate(dcTrafficVolumeDirectionData.getYoyGrowthRate()); |
|
|
|
|
|
carTypeData.setMomGrowthRate(dcTrafficVolumeDirectionData.getMomGrowthRate()); |
|
|
|
|
|
|
|
|
carTypeResult.add(carTypeData); |
|
|
carTypeResult.add(carTypeData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1176,6 +1493,10 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
conversionAvg.getTractorTrafficVolume(); |
|
|
conversionAvg.getTractorTrafficVolume(); |
|
|
conversionAvg.setTrafficVolume(conversionAvgTrafficVolume); |
|
|
conversionAvg.setTrafficVolume(conversionAvgTrafficVolume); |
|
|
|
|
|
|
|
|
|
|
|
if ("5".equals(dcTrafficSurveyDataQueryParams.getType())){ |
|
|
|
|
|
calculateGrowthRatesForNonDirection(dcTrafficVolumeData, dcTrafficSurveyDataQueryParams); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
dcTrafficVolumeData.add(naturalTotal); |
|
|
dcTrafficVolumeData.add(naturalTotal); |
|
|
dcTrafficVolumeData.add(conversionValue); |
|
|
dcTrafficVolumeData.add(conversionValue); |
|
|
dcTrafficVolumeData.add(naturalAvg); |
|
|
dcTrafficVolumeData.add(naturalAvg); |
|
|
@ -1204,6 +1525,9 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
carTypeData.setBusRatio(String.format("%.2f", (double) carTypeData.getBus() / carTypeData.getTrafficVolume() * 100) + "%"); |
|
|
carTypeData.setBusRatio(String.format("%.2f", (double) carTypeData.getBus() / carTypeData.getTrafficVolume() * 100) + "%"); |
|
|
carTypeData.setGoodsCarRatio(String.format("%.2f", (double) carTypeData.getGoodsCar() / carTypeData.getTrafficVolume() * 100) + "%"); |
|
|
carTypeData.setGoodsCarRatio(String.format("%.2f", (double) carTypeData.getGoodsCar() / carTypeData.getTrafficVolume() * 100) + "%"); |
|
|
|
|
|
|
|
|
|
|
|
carTypeData.setAvgDailyTrafficVolume(dcTrafficVolumeDatum.getAvgDailyTrafficVolume()); |
|
|
|
|
|
carTypeData.setYoyGrowthRate(dcTrafficVolumeDatum.getYoyGrowthRate()); |
|
|
|
|
|
carTypeData.setMomGrowthRate(dcTrafficVolumeDatum.getMomGrowthRate()); |
|
|
carTypeResult.add(carTypeData); |
|
|
carTypeResult.add(carTypeData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -1264,7 +1588,13 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
result.add(dcTrafficSpeedDirectionData); |
|
|
result.add(dcTrafficSpeedDirectionData); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
result = result.stream().sorted(Comparator.comparing(DcTrafficSpeedDirectionData::getTime)).collect(Collectors.toList()); |
|
|
if ("5".equals(dcTrafficSurveyDataQueryParams.getType())){ |
|
|
|
|
|
result = result.stream() |
|
|
|
|
|
.sorted(Comparator.comparingInt(d -> extractWeekNumber(d.getTime()))) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
} else { |
|
|
|
|
|
result = result.stream().sorted(Comparator.comparing(DcTrafficSpeedDirectionData::getTime)).collect(Collectors.toList()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
DcTrafficSpeedDirectionData avgSpeed = new DcTrafficSpeedDirectionData(0); |
|
|
DcTrafficSpeedDirectionData avgSpeed = new DcTrafficSpeedDirectionData(0); |
|
|
avgSpeed.setTime("车速平均值"); |
|
|
avgSpeed.setTime("车速平均值"); |
|
|
@ -1390,7 +1720,158 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi |
|
|
return AjaxResult.success(dcTrafficSpeedData); |
|
|
return AjaxResult.success(dcTrafficSpeedData); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
private void calculateGrowthRates(List<DcTrafficVolumeDirectionData> currentData, DcTrafficSurveyDataQueryParams params) { |
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
calendar.setTime(params.getDate()); |
|
|
|
|
|
int currentYear = calendar.get(Calendar.YEAR); |
|
|
|
|
|
|
|
|
|
|
|
DcTrafficSurveyDataQueryParams yoyParams = new DcTrafficSurveyDataQueryParams(); |
|
|
|
|
|
yoyParams.setIotDeviceId(params.getIotDeviceId()); |
|
|
|
|
|
yoyParams.setType("5"); |
|
|
|
|
|
yoyParams.setDataType("1"); |
|
|
|
|
|
yoyParams.setDirection("2"); |
|
|
|
|
|
yoyParams.setCarType(params.getCarType()); |
|
|
|
|
|
|
|
|
|
|
|
Calendar yoyCalendar = Calendar.getInstance(); |
|
|
|
|
|
yoyCalendar.set(currentYear - 1, 0, 1); |
|
|
|
|
|
yoyParams.setDate(yoyCalendar.getTime()); |
|
|
|
|
|
|
|
|
|
|
|
List<DcTrafficVolumeData> yoyAllData = dcTrafficSurveyDataMapper.selectTrafficVolume(yoyParams); |
|
|
|
|
|
|
|
|
|
|
|
Map<Integer, Integer> yoyWeekMap = new HashMap<>(); |
|
|
|
|
|
for (DcTrafficVolumeData data : yoyAllData) { |
|
|
|
|
|
int weekNum = extractWeekNumber(data.getTime()); |
|
|
|
|
|
yoyWeekMap.put(weekNum, yoyWeekMap.getOrDefault(weekNum, 0) + data.getTrafficVolume()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (DcTrafficVolumeDirectionData current : currentData) { |
|
|
|
|
|
String weekStr = current.getTime(); |
|
|
|
|
|
int weekNum = extractWeekNumber(weekStr); |
|
|
|
|
|
|
|
|
|
|
|
DcTrafficSurveyDataQueryParams momParams = new DcTrafficSurveyDataQueryParams(); |
|
|
|
|
|
momParams.setIotDeviceId(params.getIotDeviceId()); |
|
|
|
|
|
momParams.setType("5"); |
|
|
|
|
|
momParams.setDataType("1"); |
|
|
|
|
|
momParams.setDirection("2"); |
|
|
|
|
|
momParams.setCarType(params.getCarType()); |
|
|
|
|
|
|
|
|
|
|
|
Calendar momCalendar = Calendar.getInstance(); |
|
|
|
|
|
momCalendar.setTime(params.getDate()); |
|
|
|
|
|
momCalendar.add(Calendar.WEEK_OF_YEAR, -1); |
|
|
|
|
|
momParams.setDate(momCalendar.getTime()); |
|
|
|
|
|
|
|
|
|
|
|
List<DcTrafficVolumeData> momData = dcTrafficSurveyDataMapper.selectTrafficVolume(momParams); |
|
|
|
|
|
|
|
|
|
|
|
Integer currentAllTrafficVolume = current.getAllTrafficVolume(); |
|
|
|
|
|
Integer yoyTrafficVolume = yoyWeekMap.getOrDefault(weekNum, 0); |
|
|
|
|
|
Integer momTrafficVolume = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (DcTrafficVolumeData data : momData) { |
|
|
|
|
|
String momWeekStr = data.getTime(); |
|
|
|
|
|
int momWeekNum = extractWeekNumber(momWeekStr); |
|
|
|
|
|
if (momWeekNum == weekNum - 1 || (weekNum == 1 && momWeekNum == 52)) { |
|
|
|
|
|
momTrafficVolume += data.getTrafficVolume(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (yoyTrafficVolume > 0) { |
|
|
|
|
|
double yoyRate = ((double)(currentAllTrafficVolume - yoyTrafficVolume) / yoyTrafficVolume) * 100; |
|
|
|
|
|
current.setYoyGrowthRate(String.format("%.2f", yoyRate) + "%"); |
|
|
|
|
|
} else { |
|
|
|
|
|
current.setYoyGrowthRate("-"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (momTrafficVolume > 0) { |
|
|
|
|
|
double momRate = ((double)(currentAllTrafficVolume - momTrafficVolume) / momTrafficVolume) * 100; |
|
|
|
|
|
current.setMomGrowthRate(String.format("%.2f", momRate) + "%"); |
|
|
|
|
|
} else { |
|
|
|
|
|
current.setMomGrowthRate("-"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
private void calculateGrowthRatesForNonDirection(List<DcTrafficVolumeData> currentData, DcTrafficSurveyDataQueryParams params) { |
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
calendar.setTime(params.getDate()); |
|
|
|
|
|
int currentYear = calendar.get(Calendar.YEAR); |
|
|
|
|
|
|
|
|
|
|
|
DcTrafficSurveyDataQueryParams yoyParams = new DcTrafficSurveyDataQueryParams(); |
|
|
|
|
|
yoyParams.setIotDeviceId(params.getIotDeviceId()); |
|
|
|
|
|
yoyParams.setType("5"); |
|
|
|
|
|
yoyParams.setDataType("1"); |
|
|
|
|
|
yoyParams.setDirection("2"); |
|
|
|
|
|
yoyParams.setCarType(params.getCarType()); |
|
|
|
|
|
|
|
|
|
|
|
Calendar yoyCalendar = Calendar.getInstance(); |
|
|
|
|
|
yoyCalendar.set(currentYear - 1, 0, 1); |
|
|
|
|
|
yoyParams.setDate(yoyCalendar.getTime()); |
|
|
|
|
|
|
|
|
|
|
|
List<DcTrafficVolumeData> yoyAllData = dcTrafficSurveyDataMapper.selectTrafficVolume(yoyParams); |
|
|
|
|
|
|
|
|
|
|
|
Map<Integer, Integer> yoyWeekMap = new HashMap<>(); |
|
|
|
|
|
for (DcTrafficVolumeData data : yoyAllData) { |
|
|
|
|
|
int weekNum = extractWeekNumber(data.getTime()); |
|
|
|
|
|
yoyWeekMap.put(weekNum, yoyWeekMap.getOrDefault(weekNum, 0) + data.getTrafficVolume()); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (DcTrafficVolumeData current : currentData) { |
|
|
|
|
|
String weekStr = current.getTime(); |
|
|
|
|
|
int weekNum = extractWeekNumber(weekStr); |
|
|
|
|
|
|
|
|
|
|
|
DcTrafficSurveyDataQueryParams momParams = new DcTrafficSurveyDataQueryParams(); |
|
|
|
|
|
momParams.setIotDeviceId(params.getIotDeviceId()); |
|
|
|
|
|
momParams.setType("5"); |
|
|
|
|
|
momParams.setDataType("1"); |
|
|
|
|
|
momParams.setDirection("2"); |
|
|
|
|
|
momParams.setCarType(params.getCarType()); |
|
|
|
|
|
|
|
|
|
|
|
Calendar momCalendar = Calendar.getInstance(); |
|
|
|
|
|
momCalendar.setTime(params.getDate()); |
|
|
|
|
|
momCalendar.add(Calendar.WEEK_OF_YEAR, -1); |
|
|
|
|
|
momParams.setDate(momCalendar.getTime()); |
|
|
|
|
|
|
|
|
|
|
|
List<DcTrafficVolumeData> momData = dcTrafficSurveyDataMapper.selectTrafficVolume(momParams); |
|
|
|
|
|
|
|
|
|
|
|
Integer currentTrafficVolume = current.getTrafficVolume(); |
|
|
|
|
|
Integer yoyTrafficVolume = yoyWeekMap.getOrDefault(weekNum, 0); |
|
|
|
|
|
Integer momTrafficVolume = 0; |
|
|
|
|
|
|
|
|
|
|
|
for (DcTrafficVolumeData data : momData) { |
|
|
|
|
|
String momWeekStr = data.getTime(); |
|
|
|
|
|
int momWeekNum = extractWeekNumber(momWeekStr); |
|
|
|
|
|
if (momWeekNum == weekNum - 1 || (weekNum == 1 && momWeekNum == 52)) { |
|
|
|
|
|
momTrafficVolume += data.getTrafficVolume(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (yoyTrafficVolume > 0) { |
|
|
|
|
|
double yoyRate = ((double)(currentTrafficVolume - yoyTrafficVolume) / yoyTrafficVolume) * 100; |
|
|
|
|
|
current.setYoyGrowthRate(String.format("%.2f", yoyRate) + "%"); |
|
|
|
|
|
} else { |
|
|
|
|
|
current.setYoyGrowthRate("-"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (momTrafficVolume > 0) { |
|
|
|
|
|
double momRate = ((double)(currentTrafficVolume - momTrafficVolume) / momTrafficVolume) * 100; |
|
|
|
|
|
current.setMomGrowthRate(String.format("%.2f", momRate) + "%"); |
|
|
|
|
|
} else { |
|
|
|
|
|
current.setMomGrowthRate("-"); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
private int getWeekNumber(Date date) { |
|
|
|
|
|
Calendar calendar = Calendar.getInstance(); |
|
|
|
|
|
calendar.setTime(date); |
|
|
|
|
|
return calendar.get(Calendar.WEEK_OF_YEAR); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private int extractWeekNumber(String weekStr) { |
|
|
|
|
|
try { |
|
|
|
|
|
String num = weekStr.replaceAll("[^0-9]", ""); |
|
|
|
|
|
return Integer.parseInt(num); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
return 0; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
@Override |
|
|
@Override |
|
|
public DcTrafficSurveyData formatTrafficSurveyData(DcTrafficSurveyData dcTrafficSurveyData,JSONArray directionData){ |
|
|
public DcTrafficSurveyData formatTrafficSurveyData(DcTrafficSurveyData dcTrafficSurveyData,JSONArray directionData){ |
|
|
Integer followingPercentage = 0; //跟车百分比
|
|
|
Integer followingPercentage = 0; //跟车百分比
|
|
|
|