Browse Source

一类交调站综合查询 分方向

develop
lau572 3 months ago
parent
commit
9875e3694c
  1. 325
      zc-business/src/main/java/com/zc/business/domain/DcTrafficSpeedDirectionData.java
  2. 11
      zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeData.java
  3. 325
      zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeDirectionData.java
  4. 237
      zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSurveyDataServiceImpl.java
  5. 19
      zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml

325
zc-business/src/main/java/com/zc/business/domain/DcTrafficSpeedDirectionData.java

@ -0,0 +1,325 @@
package com.zc.business.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 一类交调数据对象(分方向) dc_traffic_survey_data
*
* @author liuwenge
* @date 2024-10-29
*/
public class DcTrafficSpeedDirectionData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 物联设备主键 */
private String iotDeviceId;
/** 方向1-上行,2-中,3-下行 */
private String direction;
/** 时间 */
@Excel(name = "时间")
private String time;
/** 中小客车平均地点车速 */
@Excel(name = "中小客车-菏泽")
private Integer inAndSmallAverageVehicleSpeedHZ;
/** 中小客车平均地点车速 */
@Excel(name = "中小客车-济南")
private Integer inAndSmallAverageVehicleSpeedJN;
/** 大客车平均地点车速 */
@Excel(name = "大客车-菏泽")
private Integer averageSpeedOfBusHZ;
/** 大客车平均地点车速 */
@Excel(name = "大客车-济南")
private Integer averageSpeedOfBusJN;
/** 小型货车平均地点车速 */
@Excel(name = "小型货车-菏泽")
private Integer smallTrucksAverageVehicleSpeedHZ;
/** 小型货车平均地点车速 */
@Excel(name = "小型货车-济南")
private Integer smallTrucksAverageVehicleSpeedJN;
/** 中型货车平均地点车速 */
@Excel(name = "中型货车-菏泽")
private Integer averageSpeedOfMediumSizeTrucksHZ;
/** 中型货车平均地点车速 */
@Excel(name = "中型货车-济南")
private Integer averageSpeedOfMediumSizeTrucksJN;
/** 大型货车平均地点车速 */
@Excel(name = "大型货车-菏泽")
private Integer averageSpeedOfLargeTrucksHZ;
/** 大型货车平均地点车速 */
@Excel(name = "大型货车-济南")
private Integer averageSpeedOfLargeTrucksJN;
/** 特大型货车平均地点车速 */
@Excel(name = "特大型货车-菏泽")
private Integer averageSpeedOfExtraLargeTrucksHZ;
/** 特大型货车平均地点车速 */
@Excel(name = "特大型货车-济南")
private Integer averageSpeedOfExtraLargeTrucksJN;
/** 集装箱车平均地点车速 */
@Excel(name = "集装箱车-菏泽")
private Integer averageSpeedOfContainerTruckHZ;
/** 集装箱车平均地点车速 */
@Excel(name = "集装箱车-济南")
private Integer averageSpeedOfContainerTruckJN;
/** 摩托车平均地点车速 */
@Excel(name = "摩托车-菏泽")
private Integer averageSpeedOfMotorcycleHZ;
/** 摩托车平均地点车速 */
@Excel(name = "摩托车-济南")
private Integer averageSpeedOfMotorcycleJN;
/** 拖拉机平均地点车速 */
@Excel(name = "拖拉机-菏泽")
private Integer averageSpeedOfTractorHZ;
/** 拖拉机平均地点车速 */
@Excel(name = "拖拉机-济南")
private Integer averageSpeedOfTractorJN;
/** 平均地点车速 */
@Excel(name = "平均车速-菏泽")
private Integer avgSpeedHZ;
/** 平均地点车速 */
@Excel(name = "平均车速-济南")
private Integer avgSpeedJN;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getIotDeviceId() {
return iotDeviceId;
}
public void setIotDeviceId(String iotDeviceId) {
this.iotDeviceId = iotDeviceId;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public Integer getInAndSmallAverageVehicleSpeedHZ() {
return inAndSmallAverageVehicleSpeedHZ;
}
public void setInAndSmallAverageVehicleSpeedHZ(Integer inAndSmallAverageVehicleSpeedHZ) {
this.inAndSmallAverageVehicleSpeedHZ = inAndSmallAverageVehicleSpeedHZ;
}
public Integer getInAndSmallAverageVehicleSpeedJN() {
return inAndSmallAverageVehicleSpeedJN;
}
public void setInAndSmallAverageVehicleSpeedJN(Integer inAndSmallAverageVehicleSpeedJN) {
this.inAndSmallAverageVehicleSpeedJN = inAndSmallAverageVehicleSpeedJN;
}
public Integer getAverageSpeedOfBusHZ() {
return averageSpeedOfBusHZ;
}
public void setAverageSpeedOfBusHZ(Integer averageSpeedOfBusHZ) {
this.averageSpeedOfBusHZ = averageSpeedOfBusHZ;
}
public Integer getAverageSpeedOfBusJN() {
return averageSpeedOfBusJN;
}
public void setAverageSpeedOfBusJN(Integer averageSpeedOfBusJN) {
this.averageSpeedOfBusJN = averageSpeedOfBusJN;
}
public Integer getSmallTrucksAverageVehicleSpeedHZ() {
return smallTrucksAverageVehicleSpeedHZ;
}
public void setSmallTrucksAverageVehicleSpeedHZ(Integer smallTrucksAverageVehicleSpeedHZ) {
this.smallTrucksAverageVehicleSpeedHZ = smallTrucksAverageVehicleSpeedHZ;
}
public Integer getSmallTrucksAverageVehicleSpeedJN() {
return smallTrucksAverageVehicleSpeedJN;
}
public void setSmallTrucksAverageVehicleSpeedJN(Integer smallTrucksAverageVehicleSpeedJN) {
this.smallTrucksAverageVehicleSpeedJN = smallTrucksAverageVehicleSpeedJN;
}
public Integer getAverageSpeedOfMediumSizeTrucksHZ() {
return averageSpeedOfMediumSizeTrucksHZ;
}
public void setAverageSpeedOfMediumSizeTrucksHZ(Integer averageSpeedOfMediumSizeTrucksHZ) {
this.averageSpeedOfMediumSizeTrucksHZ = averageSpeedOfMediumSizeTrucksHZ;
}
public Integer getAverageSpeedOfMediumSizeTrucksJN() {
return averageSpeedOfMediumSizeTrucksJN;
}
public void setAverageSpeedOfMediumSizeTrucksJN(Integer averageSpeedOfMediumSizeTrucksJN) {
this.averageSpeedOfMediumSizeTrucksJN = averageSpeedOfMediumSizeTrucksJN;
}
public Integer getAverageSpeedOfLargeTrucksHZ() {
return averageSpeedOfLargeTrucksHZ;
}
public void setAverageSpeedOfLargeTrucksHZ(Integer averageSpeedOfLargeTrucksHZ) {
this.averageSpeedOfLargeTrucksHZ = averageSpeedOfLargeTrucksHZ;
}
public Integer getAverageSpeedOfLargeTrucksJN() {
return averageSpeedOfLargeTrucksJN;
}
public void setAverageSpeedOfLargeTrucksJN(Integer averageSpeedOfLargeTrucksJN) {
this.averageSpeedOfLargeTrucksJN = averageSpeedOfLargeTrucksJN;
}
public Integer getAverageSpeedOfExtraLargeTrucksHZ() {
return averageSpeedOfExtraLargeTrucksHZ;
}
public void setAverageSpeedOfExtraLargeTrucksHZ(Integer averageSpeedOfExtraLargeTrucksHZ) {
this.averageSpeedOfExtraLargeTrucksHZ = averageSpeedOfExtraLargeTrucksHZ;
}
public Integer getAverageSpeedOfExtraLargeTrucksJN() {
return averageSpeedOfExtraLargeTrucksJN;
}
public void setAverageSpeedOfExtraLargeTrucksJN(Integer averageSpeedOfExtraLargeTrucksJN) {
this.averageSpeedOfExtraLargeTrucksJN = averageSpeedOfExtraLargeTrucksJN;
}
public Integer getAverageSpeedOfContainerTruckHZ() {
return averageSpeedOfContainerTruckHZ;
}
public void setAverageSpeedOfContainerTruckHZ(Integer averageSpeedOfContainerTruckHZ) {
this.averageSpeedOfContainerTruckHZ = averageSpeedOfContainerTruckHZ;
}
public Integer getAverageSpeedOfContainerTruckJN() {
return averageSpeedOfContainerTruckJN;
}
public void setAverageSpeedOfContainerTruckJN(Integer averageSpeedOfContainerTruckJN) {
this.averageSpeedOfContainerTruckJN = averageSpeedOfContainerTruckJN;
}
public Integer getAverageSpeedOfMotorcycleHZ() {
return averageSpeedOfMotorcycleHZ;
}
public void setAverageSpeedOfMotorcycleHZ(Integer averageSpeedOfMotorcycleHZ) {
this.averageSpeedOfMotorcycleHZ = averageSpeedOfMotorcycleHZ;
}
public Integer getAverageSpeedOfMotorcycleJN() {
return averageSpeedOfMotorcycleJN;
}
public void setAverageSpeedOfMotorcycleJN(Integer averageSpeedOfMotorcycleJN) {
this.averageSpeedOfMotorcycleJN = averageSpeedOfMotorcycleJN;
}
public Integer getAverageSpeedOfTractorHZ() {
return averageSpeedOfTractorHZ;
}
public void setAverageSpeedOfTractorHZ(Integer averageSpeedOfTractorHZ) {
this.averageSpeedOfTractorHZ = averageSpeedOfTractorHZ;
}
public Integer getAverageSpeedOfTractorJN() {
return averageSpeedOfTractorJN;
}
public void setAverageSpeedOfTractorJN(Integer averageSpeedOfTractorJN) {
this.averageSpeedOfTractorJN = averageSpeedOfTractorJN;
}
public Integer getAvgSpeedHZ() {
return avgSpeedHZ;
}
public void setAvgSpeedHZ(Integer avgSpeedHZ) {
this.avgSpeedHZ = avgSpeedHZ;
}
public Integer getAvgSpeedJN() {
return avgSpeedJN;
}
public void setAvgSpeedJN(Integer avgSpeedJN) {
this.avgSpeedJN = avgSpeedJN;
}
public DcTrafficSpeedDirectionData(){}
public DcTrafficSpeedDirectionData(Integer initData){
this.inAndSmallAverageVehicleSpeedHZ = initData;
this.inAndSmallAverageVehicleSpeedJN = initData;
this.averageSpeedOfBusHZ = initData;
this.averageSpeedOfBusJN = initData;
this.smallTrucksAverageVehicleSpeedHZ = initData;
this.smallTrucksAverageVehicleSpeedJN = initData;
this.averageSpeedOfMediumSizeTrucksHZ = initData;
this.averageSpeedOfMediumSizeTrucksJN = initData;
this.averageSpeedOfLargeTrucksHZ = initData;
this.averageSpeedOfLargeTrucksJN = initData;
this.averageSpeedOfExtraLargeTrucksHZ = initData;
this.averageSpeedOfExtraLargeTrucksJN = initData;
this.averageSpeedOfContainerTruckHZ = initData;
this.averageSpeedOfContainerTruckJN = initData;
this.averageSpeedOfMotorcycleHZ = initData;
this.averageSpeedOfMotorcycleJN = initData;
this.averageSpeedOfTractorHZ = initData;
this.averageSpeedOfTractorJN = initData;
this.avgSpeedHZ = initData;
this.avgSpeedJN = initData;
}
}

11
zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeData.java

@ -25,6 +25,9 @@ public class DcTrafficVolumeData extends BaseEntity
/** 物联设备主键 */
private String iotDeviceId;
/** 方向 */
private String direction;
/** 时间 */
@Excel(name = "时间")
private String time;
@ -85,6 +88,14 @@ public class DcTrafficVolumeData extends BaseEntity
this.iotDeviceId = iotDeviceId;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getTime() {
return time;
}

325
zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeDirectionData.java

@ -0,0 +1,325 @@
package com.zc.business.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 一类交调数据对象(区分方向) dc_traffic_survey_data
*
* @author liuwenge
* @date 2024-10-29
*/
public class DcTrafficVolumeDirectionData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 物联设备主键 */
private String iotDeviceId;
/** 方向 */
private String direction;
/** 时间 */
@Excel(name = "时间")
private String time;
/** 中小客车交通量 */
@Excel(name = "中小客车-菏泽")
private Integer trafficNumberOfInAndSmallHZ;
/** 中小客车交通量 */
@Excel(name = "中小客车-济南")
private Integer trafficNumberOfInAndSmallJN;
/** 大客车交通量 */
@Excel(name = "大客车-菏泽")
private Integer busTrafficVolumeHZ;
/** 大客车交通量 */
@Excel(name = "大客车-济南")
private Integer busTrafficVolumeJN;
/** 小型货车交通量 */
@Excel(name = "小型货车-菏泽")
private Integer trafficVolumeOfSmallTrucksHZ;
/** 小型货车交通量 */
@Excel(name = "小型货车-济南")
private Integer trafficVolumeOfSmallTrucksJN;
/** 中型货车交通量 */
@Excel(name = "中型货车-菏泽")
private Integer mediumTruckTrafficVolumeHZ;
/** 中型货车交通量 */
@Excel(name = "中型货车-济南")
private Integer mediumTruckTrafficVolumeJN;
/** 大型货车交通量 */
@Excel(name = "大型货车-菏泽")
private Integer largeTruckTrafficVolumeHZ;
/** 大型货车交通量 */
@Excel(name = "大型货车-济南")
private Integer largeTruckTrafficVolumeJN;
/** 特大型货车交通量 */
@Excel(name = "特大型货车-菏泽")
private Integer extraLargeTrucksTrafficVolumeHZ;
/** 特大型货车交通量 */
@Excel(name = "特大型货车-济南")
private Integer extraLargeTrucksTrafficVolumeJN;
/** 集装箱车交通量 */
@Excel(name = "集装箱车-菏泽")
private Integer containerTruckTrafficVolumeHZ;
/** 集装箱车交通量 */
@Excel(name = "集装箱车-济南")
private Integer containerTruckTrafficVolumeJN;
/** 摩托车交通量 */
@Excel(name = "摩托车-菏泽")
private Integer motorcycleTrafficVolumeHZ;
/** 摩托车交通量 */
@Excel(name = "摩托车-济南")
private Integer motorcycleTrafficVolumeJN;
/** 拖拉机交通量 */
@Excel(name = "拖拉机-菏泽")
private Integer tractorTrafficVolumeHZ;
/** 拖拉机交通量 */
@Excel(name = "拖拉机-济南")
private Integer tractorTrafficVolumeJN;
/** 合计 */
@Excel(name = "合计-菏泽")
private Integer trafficVolumeHZ;
/** 合计 */
@Excel(name = "合计-济南")
private Integer trafficVolumeJN;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getIotDeviceId() {
return iotDeviceId;
}
public void setIotDeviceId(String iotDeviceId) {
this.iotDeviceId = iotDeviceId;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
public Integer getTrafficNumberOfInAndSmallJN() {
return trafficNumberOfInAndSmallJN;
}
public void setTrafficNumberOfInAndSmallJN(Integer trafficNumberOfInAndSmallJN) {
this.trafficNumberOfInAndSmallJN = trafficNumberOfInAndSmallJN;
}
public Integer getTrafficNumberOfInAndSmallHZ() {
return trafficNumberOfInAndSmallHZ;
}
public void setTrafficNumberOfInAndSmallHZ(Integer trafficNumberOfInAndSmallHZ) {
this.trafficNumberOfInAndSmallHZ = trafficNumberOfInAndSmallHZ;
}
public Integer getBusTrafficVolumeJN() {
return busTrafficVolumeJN;
}
public void setBusTrafficVolumeJN(Integer busTrafficVolumeJN) {
this.busTrafficVolumeJN = busTrafficVolumeJN;
}
public Integer getBusTrafficVolumeHZ() {
return busTrafficVolumeHZ;
}
public void setBusTrafficVolumeHZ(Integer busTrafficVolumeHZ) {
this.busTrafficVolumeHZ = busTrafficVolumeHZ;
}
public Integer getTrafficVolumeOfSmallTrucksJN() {
return trafficVolumeOfSmallTrucksJN;
}
public void setTrafficVolumeOfSmallTrucksJN(Integer trafficVolumeOfSmallTrucksJN) {
this.trafficVolumeOfSmallTrucksJN = trafficVolumeOfSmallTrucksJN;
}
public Integer getTrafficVolumeOfSmallTrucksHZ() {
return trafficVolumeOfSmallTrucksHZ;
}
public void setTrafficVolumeOfSmallTrucksHZ(Integer trafficVolumeOfSmallTrucksHZ) {
this.trafficVolumeOfSmallTrucksHZ = trafficVolumeOfSmallTrucksHZ;
}
public Integer getMediumTruckTrafficVolumeJN() {
return mediumTruckTrafficVolumeJN;
}
public void setMediumTruckTrafficVolumeJN(Integer mediumTruckTrafficVolumeJN) {
this.mediumTruckTrafficVolumeJN = mediumTruckTrafficVolumeJN;
}
public Integer getMediumTruckTrafficVolumeHZ() {
return mediumTruckTrafficVolumeHZ;
}
public void setMediumTruckTrafficVolumeHZ(Integer mediumTruckTrafficVolumeHZ) {
this.mediumTruckTrafficVolumeHZ = mediumTruckTrafficVolumeHZ;
}
public Integer getLargeTruckTrafficVolumeJN() {
return largeTruckTrafficVolumeJN;
}
public void setLargeTruckTrafficVolumeJN(Integer largeTruckTrafficVolumeJN) {
this.largeTruckTrafficVolumeJN = largeTruckTrafficVolumeJN;
}
public Integer getLargeTruckTrafficVolumeHZ() {
return largeTruckTrafficVolumeHZ;
}
public void setLargeTruckTrafficVolumeHZ(Integer largeTruckTrafficVolumeHZ) {
this.largeTruckTrafficVolumeHZ = largeTruckTrafficVolumeHZ;
}
public Integer getExtraLargeTrucksTrafficVolumeJN() {
return extraLargeTrucksTrafficVolumeJN;
}
public void setExtraLargeTrucksTrafficVolumeJN(Integer extraLargeTrucksTrafficVolumeJN) {
this.extraLargeTrucksTrafficVolumeJN = extraLargeTrucksTrafficVolumeJN;
}
public Integer getExtraLargeTrucksTrafficVolumeHZ() {
return extraLargeTrucksTrafficVolumeHZ;
}
public void setExtraLargeTrucksTrafficVolumeHZ(Integer extraLargeTrucksTrafficVolumeHZ) {
this.extraLargeTrucksTrafficVolumeHZ = extraLargeTrucksTrafficVolumeHZ;
}
public Integer getContainerTruckTrafficVolumeJN() {
return containerTruckTrafficVolumeJN;
}
public void setContainerTruckTrafficVolumeJN(Integer containerTruckTrafficVolumeJN) {
this.containerTruckTrafficVolumeJN = containerTruckTrafficVolumeJN;
}
public Integer getContainerTruckTrafficVolumeHZ() {
return containerTruckTrafficVolumeHZ;
}
public void setContainerTruckTrafficVolumeHZ(Integer containerTruckTrafficVolumeHZ) {
this.containerTruckTrafficVolumeHZ = containerTruckTrafficVolumeHZ;
}
public Integer getMotorcycleTrafficVolumeJN() {
return motorcycleTrafficVolumeJN;
}
public void setMotorcycleTrafficVolumeJN(Integer motorcycleTrafficVolumeJN) {
this.motorcycleTrafficVolumeJN = motorcycleTrafficVolumeJN;
}
public Integer getMotorcycleTrafficVolumeHZ() {
return motorcycleTrafficVolumeHZ;
}
public void setMotorcycleTrafficVolumeHZ(Integer motorcycleTrafficVolumeHZ) {
this.motorcycleTrafficVolumeHZ = motorcycleTrafficVolumeHZ;
}
public Integer getTractorTrafficVolumeJN() {
return tractorTrafficVolumeJN;
}
public void setTractorTrafficVolumeJN(Integer tractorTrafficVolumeJN) {
this.tractorTrafficVolumeJN = tractorTrafficVolumeJN;
}
public Integer getTractorTrafficVolumeHZ() {
return tractorTrafficVolumeHZ;
}
public void setTractorTrafficVolumeHZ(Integer tractorTrafficVolumeHZ) {
this.tractorTrafficVolumeHZ = tractorTrafficVolumeHZ;
}
public Integer getTrafficVolumeJN() {
return trafficVolumeJN;
}
public void setTrafficVolumeJN(Integer trafficVolumeJN) {
this.trafficVolumeJN = trafficVolumeJN;
}
public Integer getTrafficVolumeHZ() {
return trafficVolumeHZ;
}
public void setTrafficVolumeHZ(Integer trafficVolumeHZ) {
this.trafficVolumeHZ = trafficVolumeHZ;
}
public DcTrafficVolumeDirectionData(){}
public DcTrafficVolumeDirectionData(Integer initData){
this.trafficNumberOfInAndSmallJN = initData;
this.trafficNumberOfInAndSmallHZ = initData;
this.busTrafficVolumeJN = initData;
this.busTrafficVolumeHZ = initData;
this.trafficVolumeOfSmallTrucksJN = initData;
this.trafficVolumeOfSmallTrucksHZ = initData;
this.mediumTruckTrafficVolumeJN = initData;
this.mediumTruckTrafficVolumeHZ = initData;
this.largeTruckTrafficVolumeJN = initData;
this.largeTruckTrafficVolumeHZ = initData;
this.extraLargeTrucksTrafficVolumeJN = initData;
this.extraLargeTrucksTrafficVolumeHZ = initData;
this.containerTruckTrafficVolumeJN = initData;
this.containerTruckTrafficVolumeHZ = initData;
this.motorcycleTrafficVolumeJN = initData;
this.motorcycleTrafficVolumeHZ = initData;
this.tractorTrafficVolumeJN = initData;
this.tractorTrafficVolumeHZ = initData;
this.trafficVolumeJN = initData;
this.trafficVolumeHZ = initData;
}
}

237
zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSurveyDataServiceImpl.java

@ -274,11 +274,155 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi
return AjaxResult.error("请选择时间类型");
} else if (StringUtils.isEmpty(dcTrafficSurveyDataQueryParams.getDataType())){
return AjaxResult.error("请选择数据类型");
} else if (StringUtils.isEmpty(dcTrafficSurveyDataQueryParams.getDirection())){
return AjaxResult.error("请选择方向");
}
if (dcTrafficSurveyDataQueryParams.getDataType().equals("1")){
//车流量
List<DcTrafficVolumeData> dcTrafficVolumeData = dcTrafficSurveyDataMapper.selectTrafficVolume(dcTrafficSurveyDataQueryParams);
if (dcTrafficVolumeData.size() > 0){
//判断是否区分方向
if (dcTrafficSurveyDataQueryParams.getDirection().equals("1")){
List<DcTrafficVolumeDirectionData> result = new ArrayList<>();
//区分方向时将两个方向的数据合并为一条
Map<String,List<DcTrafficVolumeData>> group = dcTrafficVolumeData.stream().collect(Collectors.groupingBy(DcTrafficVolumeData::getTime));
for (List<DcTrafficVolumeData> value : group.values()) {
DcTrafficVolumeDirectionData dcTrafficVolumeDirectionData = new DcTrafficVolumeDirectionData(0);
dcTrafficVolumeDirectionData.setIotDeviceId(value.get(0).getIotDeviceId());
dcTrafficVolumeDirectionData.setTime(value.get(0).getTime());
for (DcTrafficVolumeData trafficVolumeData : value) {
if (trafficVolumeData.getDirection().equals("1")){
dcTrafficVolumeDirectionData.setTrafficNumberOfInAndSmallHZ(trafficVolumeData.getTrafficNumberOfInAndSmall());
dcTrafficVolumeDirectionData.setBusTrafficVolumeHZ(trafficVolumeData.getBusTrafficVolume());
dcTrafficVolumeDirectionData.setTrafficVolumeOfSmallTrucksHZ(trafficVolumeData.getTrafficVolumeOfSmallTrucks());
dcTrafficVolumeDirectionData.setMediumTruckTrafficVolumeHZ(trafficVolumeData.getMediumTruckTrafficVolume());
dcTrafficVolumeDirectionData.setLargeTruckTrafficVolumeHZ(trafficVolumeData.getLargeTruckTrafficVolume());
dcTrafficVolumeDirectionData.setExtraLargeTrucksTrafficVolumeHZ(trafficVolumeData.getExtraLargeTrucksTrafficVolume());
dcTrafficVolumeDirectionData.setContainerTruckTrafficVolumeHZ(trafficVolumeData.getContainerTruckTrafficVolume());
dcTrafficVolumeDirectionData.setMotorcycleTrafficVolumeHZ(trafficVolumeData.getMotorcycleTrafficVolume());
dcTrafficVolumeDirectionData.setTractorTrafficVolumeHZ(trafficVolumeData.getTractorTrafficVolume());
dcTrafficVolumeDirectionData.setTrafficVolumeHZ(trafficVolumeData.getTrafficVolume());
} else if (trafficVolumeData.getDirection().equals("3")){
dcTrafficVolumeDirectionData.setTrafficNumberOfInAndSmallJN(trafficVolumeData.getTrafficNumberOfInAndSmall());
dcTrafficVolumeDirectionData.setBusTrafficVolumeJN(trafficVolumeData.getBusTrafficVolume());
dcTrafficVolumeDirectionData.setTrafficVolumeOfSmallTrucksJN(trafficVolumeData.getTrafficVolumeOfSmallTrucks());
dcTrafficVolumeDirectionData.setMediumTruckTrafficVolumeJN(trafficVolumeData.getMediumTruckTrafficVolume());
dcTrafficVolumeDirectionData.setLargeTruckTrafficVolumeJN(trafficVolumeData.getLargeTruckTrafficVolume());
dcTrafficVolumeDirectionData.setExtraLargeTrucksTrafficVolumeJN(trafficVolumeData.getExtraLargeTrucksTrafficVolume());
dcTrafficVolumeDirectionData.setContainerTruckTrafficVolumeJN(trafficVolumeData.getContainerTruckTrafficVolume());
dcTrafficVolumeDirectionData.setMotorcycleTrafficVolumeJN(trafficVolumeData.getMotorcycleTrafficVolume());
dcTrafficVolumeDirectionData.setTractorTrafficVolumeJN(trafficVolumeData.getTractorTrafficVolume());
dcTrafficVolumeDirectionData.setTrafficVolumeJN(trafficVolumeData.getTrafficVolume());
}
}
result.add(dcTrafficVolumeDirectionData);
}
//自然合计值
DcTrafficVolumeDirectionData naturalTotal = new DcTrafficVolumeDirectionData(0);
naturalTotal.setTime("自然合计值");
for (DcTrafficVolumeDirectionData dcTrafficVolumeDirectionDatum : result) {
naturalTotal.setTrafficNumberOfInAndSmallHZ(naturalTotal.getTrafficNumberOfInAndSmallHZ() + dcTrafficVolumeDirectionDatum.getTrafficNumberOfInAndSmallHZ());
naturalTotal.setTrafficNumberOfInAndSmallJN(naturalTotal.getTrafficNumberOfInAndSmallJN() + dcTrafficVolumeDirectionDatum.getTrafficNumberOfInAndSmallJN());
naturalTotal.setBusTrafficVolumeHZ(naturalTotal.getBusTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getBusTrafficVolumeHZ());
naturalTotal.setBusTrafficVolumeJN(naturalTotal.getBusTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getBusTrafficVolumeJN());
naturalTotal.setTrafficVolumeOfSmallTrucksHZ(naturalTotal.getTrafficVolumeOfSmallTrucksHZ() + dcTrafficVolumeDirectionDatum.getTrafficVolumeOfSmallTrucksHZ());
naturalTotal.setTrafficVolumeOfSmallTrucksJN(naturalTotal.getTrafficVolumeOfSmallTrucksJN() + dcTrafficVolumeDirectionDatum.getTrafficVolumeOfSmallTrucksJN());
naturalTotal.setMediumTruckTrafficVolumeHZ(naturalTotal.getMediumTruckTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getMediumTruckTrafficVolumeHZ());
naturalTotal.setMediumTruckTrafficVolumeJN(naturalTotal.getMediumTruckTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getMediumTruckTrafficVolumeJN());
naturalTotal.setLargeTruckTrafficVolumeHZ(naturalTotal.getLargeTruckTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getLargeTruckTrafficVolumeHZ());
naturalTotal.setLargeTruckTrafficVolumeJN(naturalTotal.getLargeTruckTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getLargeTruckTrafficVolumeJN());
naturalTotal.setExtraLargeTrucksTrafficVolumeHZ(naturalTotal.getExtraLargeTrucksTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getExtraLargeTrucksTrafficVolumeHZ());
naturalTotal.setExtraLargeTrucksTrafficVolumeJN(naturalTotal.getExtraLargeTrucksTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getExtraLargeTrucksTrafficVolumeJN());
naturalTotal.setContainerTruckTrafficVolumeHZ(naturalTotal.getContainerTruckTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getContainerTruckTrafficVolumeHZ());
naturalTotal.setContainerTruckTrafficVolumeJN(naturalTotal.getContainerTruckTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getContainerTruckTrafficVolumeJN());
naturalTotal.setMotorcycleTrafficVolumeHZ(naturalTotal.getMotorcycleTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getMotorcycleTrafficVolumeHZ());
naturalTotal.setMotorcycleTrafficVolumeJN(naturalTotal.getMotorcycleTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getMotorcycleTrafficVolumeJN());
naturalTotal.setTractorTrafficVolumeHZ(naturalTotal.getTractorTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getTractorTrafficVolumeHZ());
naturalTotal.setTractorTrafficVolumeJN(naturalTotal.getTractorTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getTractorTrafficVolumeJN());
naturalTotal.setTrafficVolumeHZ(naturalTotal.getTrafficVolumeHZ() + dcTrafficVolumeDirectionDatum.getTrafficVolumeHZ());
naturalTotal.setTrafficVolumeJN(naturalTotal.getTrafficVolumeJN() + dcTrafficVolumeDirectionDatum.getTrafficVolumeJN());
}
//折算值
DcTrafficVolumeDirectionData conversionValue = new DcTrafficVolumeDirectionData(0);
conversionValue.setTime("折算值");
conversionValue.setTrafficNumberOfInAndSmallHZ(naturalTotal.getTrafficNumberOfInAndSmallHZ());
conversionValue.setTrafficNumberOfInAndSmallJN(naturalTotal.getTrafficNumberOfInAndSmallJN());
conversionValue.setBusTrafficVolumeHZ((int) Math.round(naturalTotal.getBusTrafficVolumeHZ() * 1.5));
conversionValue.setBusTrafficVolumeJN((int) Math.round(naturalTotal.getBusTrafficVolumeJN() * 1.5));
conversionValue.setTrafficVolumeOfSmallTrucksHZ(naturalTotal.getTrafficVolumeOfSmallTrucksHZ());
conversionValue.setTrafficVolumeOfSmallTrucksJN(naturalTotal.getTrafficVolumeOfSmallTrucksJN());
conversionValue.setMediumTruckTrafficVolumeHZ((int) Math.round(naturalTotal.getMediumTruckTrafficVolumeHZ() * 1.5));
conversionValue.setMediumTruckTrafficVolumeJN((int) Math.round(naturalTotal.getMediumTruckTrafficVolumeJN() * 1.5));
conversionValue.setLargeTruckTrafficVolumeHZ(naturalTotal.getLargeTruckTrafficVolumeHZ() * 3);
conversionValue.setLargeTruckTrafficVolumeJN(naturalTotal.getLargeTruckTrafficVolumeJN() * 3);
conversionValue.setExtraLargeTrucksTrafficVolumeHZ(naturalTotal.getExtraLargeTrucksTrafficVolumeHZ() * 4);
conversionValue.setExtraLargeTrucksTrafficVolumeJN(naturalTotal.getExtraLargeTrucksTrafficVolumeJN() * 4);
conversionValue.setContainerTruckTrafficVolumeHZ(naturalTotal.getContainerTruckTrafficVolumeHZ() * 4);
conversionValue.setContainerTruckTrafficVolumeJN(naturalTotal.getContainerTruckTrafficVolumeJN() * 4);
conversionValue.setMotorcycleTrafficVolumeHZ(naturalTotal.getMotorcycleTrafficVolumeHZ());
conversionValue.setMotorcycleTrafficVolumeJN(naturalTotal.getMotorcycleTrafficVolumeJN());
conversionValue.setTractorTrafficVolumeHZ(naturalTotal.getTractorTrafficVolumeHZ());
conversionValue.setTractorTrafficVolumeJN(naturalTotal.getTractorTrafficVolumeJN());
Integer trafficVolumeHZ = conversionValue.getTrafficNumberOfInAndSmallHZ() + conversionValue.getBusTrafficVolumeHZ() +
conversionValue.getTrafficVolumeOfSmallTrucksHZ() + conversionValue.getMediumTruckTrafficVolumeHZ() +
conversionValue.getLargeTruckTrafficVolumeHZ() + conversionValue.getExtraLargeTrucksTrafficVolumeHZ() +
conversionValue.getContainerTruckTrafficVolumeHZ() + conversionValue.getMotorcycleTrafficVolumeHZ() +
conversionValue.getTractorTrafficVolumeHZ();
conversionValue.setTrafficVolumeHZ(trafficVolumeHZ);
Integer trafficVolumeJN = conversionValue.getTrafficNumberOfInAndSmallJN() + conversionValue.getBusTrafficVolumeJN() +
conversionValue.getTrafficVolumeOfSmallTrucksJN() + conversionValue.getMediumTruckTrafficVolumeJN() +
conversionValue.getLargeTruckTrafficVolumeJN() + conversionValue.getExtraLargeTrucksTrafficVolumeJN() +
conversionValue.getContainerTruckTrafficVolumeJN() + conversionValue.getMotorcycleTrafficVolumeJN() +
conversionValue.getTractorTrafficVolumeJN();
conversionValue.setTrafficVolumeJN(trafficVolumeJN);
//自然平均值
DcTrafficVolumeDirectionData naturalAvg = new DcTrafficVolumeDirectionData(0);
naturalAvg.setTime("自然平均值");
naturalAvg.setTrafficNumberOfInAndSmallHZ(naturalTotal.getTrafficNumberOfInAndSmallHZ() / result.size());
naturalAvg.setTrafficNumberOfInAndSmallJN(naturalTotal.getTrafficNumberOfInAndSmallJN() / result.size());
naturalAvg.setBusTrafficVolumeHZ(naturalTotal.getBusTrafficVolumeHZ() / result.size());
naturalAvg.setBusTrafficVolumeJN(naturalTotal.getBusTrafficVolumeJN() / result.size());
naturalAvg.setTrafficVolumeOfSmallTrucksHZ(naturalTotal.getTrafficVolumeOfSmallTrucksHZ() / result.size());
naturalAvg.setTrafficVolumeOfSmallTrucksJN(naturalTotal.getTrafficVolumeOfSmallTrucksJN() / result.size());
naturalAvg.setMediumTruckTrafficVolumeHZ(naturalTotal.getMediumTruckTrafficVolumeHZ() / result.size());
naturalAvg.setMediumTruckTrafficVolumeJN(naturalTotal.getMediumTruckTrafficVolumeJN() / result.size());
naturalAvg.setLargeTruckTrafficVolumeHZ(naturalTotal.getLargeTruckTrafficVolumeHZ() / result.size());
naturalAvg.setLargeTruckTrafficVolumeJN(naturalTotal.getLargeTruckTrafficVolumeJN() / result.size());
naturalAvg.setExtraLargeTrucksTrafficVolumeHZ(naturalTotal.getExtraLargeTrucksTrafficVolumeHZ() / result.size());
naturalAvg.setExtraLargeTrucksTrafficVolumeJN(naturalTotal.getExtraLargeTrucksTrafficVolumeJN() / result.size());
naturalAvg.setContainerTruckTrafficVolumeHZ(naturalTotal.getContainerTruckTrafficVolumeHZ() / result.size());
naturalAvg.setContainerTruckTrafficVolumeJN(naturalTotal.getContainerTruckTrafficVolumeJN() / result.size());
naturalAvg.setMotorcycleTrafficVolumeHZ(naturalTotal.getMotorcycleTrafficVolumeHZ() / result.size());
naturalAvg.setMotorcycleTrafficVolumeJN(naturalTotal.getMotorcycleTrafficVolumeJN() / result.size());
naturalAvg.setTractorTrafficVolumeHZ(naturalTotal.getTractorTrafficVolumeHZ() / result.size());
naturalAvg.setTractorTrafficVolumeJN(naturalTotal.getTractorTrafficVolumeJN() / result.size());
Integer naturalAvgTrafficVolumeHZ = naturalAvg.getTrafficNumberOfInAndSmallHZ() + naturalAvg.getBusTrafficVolumeHZ() +
naturalAvg.getTrafficVolumeOfSmallTrucksHZ() + naturalAvg.getMediumTruckTrafficVolumeHZ() +
naturalAvg.getLargeTruckTrafficVolumeHZ() + naturalAvg.getExtraLargeTrucksTrafficVolumeHZ() +
naturalAvg.getContainerTruckTrafficVolumeHZ() + naturalAvg.getMotorcycleTrafficVolumeHZ() +
naturalAvg.getTractorTrafficVolumeHZ();
naturalAvg.setTrafficVolumeHZ(naturalAvgTrafficVolumeHZ);
Integer naturalAvgTrafficVolumeJN = naturalAvg.getTrafficNumberOfInAndSmallJN() + naturalAvg.getBusTrafficVolumeJN() +
naturalAvg.getTrafficVolumeOfSmallTrucksJN() + naturalAvg.getMediumTruckTrafficVolumeJN() +
naturalAvg.getLargeTruckTrafficVolumeJN() + naturalAvg.getExtraLargeTrucksTrafficVolumeJN() +
naturalAvg.getContainerTruckTrafficVolumeJN() + naturalAvg.getMotorcycleTrafficVolumeJN() +
naturalAvg.getTractorTrafficVolumeJN();
naturalAvg.setTrafficVolumeJN(naturalAvgTrafficVolumeJN);
result = result.stream().sorted(Comparator.comparing(DcTrafficVolumeDirectionData::getTime)).collect(Collectors.toList());
result.add(naturalTotal);
result.add(conversionValue);
result.add(naturalAvg);
return AjaxResult.success(result);
} else if (dcTrafficSurveyDataQueryParams.getDirection().equals("2")){
//自然合计值
DcTrafficVolumeData naturalTotal = new DcTrafficVolumeData(0);
naturalTotal.setTime("自然合计值");
@ -337,12 +481,104 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi
dcTrafficVolumeData.add(conversionValue);
dcTrafficVolumeData.add(naturalAvg);
}
}
return AjaxResult.success(dcTrafficVolumeData);
} else {
//车速
List<DcTrafficSpeedData> dcTrafficSpeedData = dcTrafficSurveyDataMapper.selectSpeed(dcTrafficSurveyDataQueryParams);
if (dcTrafficSpeedData.size() > 0){
//判断是否区分方向
if (dcTrafficSurveyDataQueryParams.getDirection().equals("1")) {
List<DcTrafficSpeedDirectionData> result = new ArrayList<>();
//区分方向时将两个方向的数据合并为一条
Map<String, List<DcTrafficSpeedData>> group = dcTrafficSpeedData.stream().collect(Collectors.groupingBy(DcTrafficSpeedData::getTime));
for (List<DcTrafficSpeedData> value : group.values()) {
DcTrafficSpeedDirectionData dcTrafficSpeedDirectionData = new DcTrafficSpeedDirectionData(0);
dcTrafficSpeedDirectionData.setIotDeviceId(value.get(0).getIotDeviceId());
dcTrafficSpeedDirectionData.setTime(value.get(0).getTime());
for (DcTrafficSpeedData trafficSpeedData : value) {
if (trafficSpeedData.getDirection().equals("1")){
dcTrafficSpeedDirectionData.setInAndSmallAverageVehicleSpeedHZ(trafficSpeedData.getInAndSmallAverageVehicleSpeed());
dcTrafficSpeedDirectionData.setAverageSpeedOfBusHZ(trafficSpeedData.getAverageSpeedOfBus());
dcTrafficSpeedDirectionData.setSmallTrucksAverageVehicleSpeedHZ(trafficSpeedData.getSmallTrucksAverageVehicleSpeed());
dcTrafficSpeedDirectionData.setAverageSpeedOfMediumSizeTrucksHZ(trafficSpeedData.getAverageSpeedOfMediumSizeTrucks());
dcTrafficSpeedDirectionData.setAverageSpeedOfLargeTrucksHZ(trafficSpeedData.getAverageSpeedOfLargeTrucks());
dcTrafficSpeedDirectionData.setAverageSpeedOfExtraLargeTrucksHZ(trafficSpeedData.getAverageSpeedOfExtraLargeTrucks());
dcTrafficSpeedDirectionData.setAverageSpeedOfContainerTruckHZ(trafficSpeedData.getAverageSpeedOfContainerTruck());
dcTrafficSpeedDirectionData.setAverageSpeedOfMotorcycleHZ(trafficSpeedData.getAverageSpeedOfMotorcycle());
dcTrafficSpeedDirectionData.setAverageSpeedOfTractorHZ(trafficSpeedData.getAverageSpeedOfTractor());
dcTrafficSpeedDirectionData.setAvgSpeedHZ(trafficSpeedData.getAvgSpeed());
} else if (trafficSpeedData.getDirection().equals("3")){
dcTrafficSpeedDirectionData.setInAndSmallAverageVehicleSpeedJN(trafficSpeedData.getInAndSmallAverageVehicleSpeed());
dcTrafficSpeedDirectionData.setAverageSpeedOfBusJN(trafficSpeedData.getAverageSpeedOfBus());
dcTrafficSpeedDirectionData.setSmallTrucksAverageVehicleSpeedJN(trafficSpeedData.getSmallTrucksAverageVehicleSpeed());
dcTrafficSpeedDirectionData.setAverageSpeedOfMediumSizeTrucksJN(trafficSpeedData.getAverageSpeedOfMediumSizeTrucks());
dcTrafficSpeedDirectionData.setAverageSpeedOfLargeTrucksJN(trafficSpeedData.getAverageSpeedOfLargeTrucks());
dcTrafficSpeedDirectionData.setAverageSpeedOfExtraLargeTrucksJN(trafficSpeedData.getAverageSpeedOfExtraLargeTrucks());
dcTrafficSpeedDirectionData.setAverageSpeedOfContainerTruckJN(trafficSpeedData.getAverageSpeedOfContainerTruck());
dcTrafficSpeedDirectionData.setAverageSpeedOfMotorcycleJN(trafficSpeedData.getAverageSpeedOfMotorcycle());
dcTrafficSpeedDirectionData.setAverageSpeedOfTractorJN(trafficSpeedData.getAverageSpeedOfTractor());
dcTrafficSpeedDirectionData.setAvgSpeedJN(trafficSpeedData.getAvgSpeed());
}
}
result.add(dcTrafficSpeedDirectionData);
}
result = result.stream().sorted(Comparator.comparing(DcTrafficSpeedDirectionData::getTime)).collect(Collectors.toList());
DcTrafficSpeedDirectionData avgSpeed = new DcTrafficSpeedDirectionData(0);
avgSpeed.setTime("车速平均值");
for (DcTrafficSpeedDirectionData dcTrafficSpeedDatum : result) {
avgSpeed.setInAndSmallAverageVehicleSpeedHZ(avgSpeed.getInAndSmallAverageVehicleSpeedHZ() + dcTrafficSpeedDatum.getInAndSmallAverageVehicleSpeedHZ());
avgSpeed.setInAndSmallAverageVehicleSpeedJN(avgSpeed.getInAndSmallAverageVehicleSpeedJN() + dcTrafficSpeedDatum.getInAndSmallAverageVehicleSpeedJN());
avgSpeed.setAverageSpeedOfBusHZ(avgSpeed.getAverageSpeedOfBusHZ() + dcTrafficSpeedDatum.getAverageSpeedOfBusHZ());
avgSpeed.setAverageSpeedOfBusJN(avgSpeed.getAverageSpeedOfBusJN() + dcTrafficSpeedDatum.getAverageSpeedOfBusJN());
avgSpeed.setSmallTrucksAverageVehicleSpeedHZ(avgSpeed.getSmallTrucksAverageVehicleSpeedHZ() + dcTrafficSpeedDatum.getSmallTrucksAverageVehicleSpeedHZ());
avgSpeed.setSmallTrucksAverageVehicleSpeedJN(avgSpeed.getSmallTrucksAverageVehicleSpeedJN() + dcTrafficSpeedDatum.getSmallTrucksAverageVehicleSpeedJN());
avgSpeed.setAverageSpeedOfMediumSizeTrucksHZ(avgSpeed.getAverageSpeedOfMediumSizeTrucksHZ() + dcTrafficSpeedDatum.getAverageSpeedOfMediumSizeTrucksHZ());
avgSpeed.setAverageSpeedOfMediumSizeTrucksJN(avgSpeed.getAverageSpeedOfMediumSizeTrucksJN() + dcTrafficSpeedDatum.getAverageSpeedOfMediumSizeTrucksJN());
avgSpeed.setAverageSpeedOfLargeTrucksHZ(avgSpeed.getAverageSpeedOfLargeTrucksHZ() + dcTrafficSpeedDatum.getAverageSpeedOfLargeTrucksHZ());
avgSpeed.setAverageSpeedOfLargeTrucksJN(avgSpeed.getAverageSpeedOfLargeTrucksJN() + dcTrafficSpeedDatum.getAverageSpeedOfLargeTrucksJN());
avgSpeed.setAverageSpeedOfExtraLargeTrucksHZ(avgSpeed.getAverageSpeedOfExtraLargeTrucksHZ() + dcTrafficSpeedDatum.getAverageSpeedOfExtraLargeTrucksHZ());
avgSpeed.setAverageSpeedOfExtraLargeTrucksJN(avgSpeed.getAverageSpeedOfExtraLargeTrucksJN() + dcTrafficSpeedDatum.getAverageSpeedOfExtraLargeTrucksJN());
avgSpeed.setAverageSpeedOfContainerTruckHZ(avgSpeed.getAverageSpeedOfContainerTruckHZ() + dcTrafficSpeedDatum.getAverageSpeedOfContainerTruckHZ());
avgSpeed.setAverageSpeedOfContainerTruckJN(avgSpeed.getAverageSpeedOfContainerTruckJN() + dcTrafficSpeedDatum.getAverageSpeedOfContainerTruckJN());
avgSpeed.setAverageSpeedOfMotorcycleHZ(avgSpeed.getAverageSpeedOfMotorcycleHZ() + dcTrafficSpeedDatum.getAverageSpeedOfMotorcycleHZ());
avgSpeed.setAverageSpeedOfMotorcycleJN(avgSpeed.getAverageSpeedOfMotorcycleJN() + dcTrafficSpeedDatum.getAverageSpeedOfMotorcycleJN());
avgSpeed.setAverageSpeedOfTractorHZ(avgSpeed.getAverageSpeedOfTractorHZ() + dcTrafficSpeedDatum.getAverageSpeedOfTractorHZ());
avgSpeed.setAverageSpeedOfTractorJN(avgSpeed.getAverageSpeedOfTractorJN() + dcTrafficSpeedDatum.getAverageSpeedOfTractorJN());
avgSpeed.setAvgSpeedHZ(avgSpeed.getAvgSpeedHZ() + dcTrafficSpeedDatum.getAvgSpeedHZ());
avgSpeed.setAvgSpeedJN(avgSpeed.getAvgSpeedJN() + dcTrafficSpeedDatum.getAvgSpeedJN());
}
avgSpeed.setInAndSmallAverageVehicleSpeedHZ(avgSpeed.getInAndSmallAverageVehicleSpeedHZ() / result.size());
avgSpeed.setInAndSmallAverageVehicleSpeedJN(avgSpeed.getInAndSmallAverageVehicleSpeedJN() / result.size());
avgSpeed.setAverageSpeedOfBusHZ(avgSpeed.getAverageSpeedOfBusHZ() / result.size());
avgSpeed.setAverageSpeedOfBusJN(avgSpeed.getAverageSpeedOfBusJN() / result.size());
avgSpeed.setSmallTrucksAverageVehicleSpeedHZ(avgSpeed.getSmallTrucksAverageVehicleSpeedHZ() / result.size());
avgSpeed.setSmallTrucksAverageVehicleSpeedJN(avgSpeed.getSmallTrucksAverageVehicleSpeedJN() / result.size());
avgSpeed.setAverageSpeedOfMediumSizeTrucksHZ(avgSpeed.getAverageSpeedOfMediumSizeTrucksHZ() / result.size());
avgSpeed.setAverageSpeedOfMediumSizeTrucksJN(avgSpeed.getAverageSpeedOfMediumSizeTrucksJN() / result.size());
avgSpeed.setAverageSpeedOfLargeTrucksHZ(avgSpeed.getAverageSpeedOfLargeTrucksHZ() / result.size());
avgSpeed.setAverageSpeedOfLargeTrucksJN(avgSpeed.getAverageSpeedOfLargeTrucksJN() / result.size());
avgSpeed.setAverageSpeedOfExtraLargeTrucksHZ(avgSpeed.getAverageSpeedOfExtraLargeTrucksHZ() / result.size());
avgSpeed.setAverageSpeedOfExtraLargeTrucksJN(avgSpeed.getAverageSpeedOfExtraLargeTrucksJN() / result.size());
avgSpeed.setAverageSpeedOfContainerTruckHZ(avgSpeed.getAverageSpeedOfContainerTruckHZ() / result.size());
avgSpeed.setAverageSpeedOfContainerTruckJN(avgSpeed.getAverageSpeedOfContainerTruckJN() / result.size());
avgSpeed.setAverageSpeedOfMotorcycleHZ(avgSpeed.getAverageSpeedOfMotorcycleHZ() / result.size());
avgSpeed.setAverageSpeedOfMotorcycleJN(avgSpeed.getAverageSpeedOfMotorcycleJN() / result.size());
avgSpeed.setAverageSpeedOfTractorHZ(avgSpeed.getAverageSpeedOfTractorHZ() / result.size());
avgSpeed.setAverageSpeedOfTractorJN(avgSpeed.getAverageSpeedOfTractorJN() / result.size());
avgSpeed.setAvgSpeedHZ(avgSpeed.getAvgSpeedHZ() / result.size());
avgSpeed.setAvgSpeedJN(avgSpeed.getAvgSpeedJN() / result.size());
result.add(avgSpeed);
return AjaxResult.success(result);
} else {
DcTrafficSpeedData avgSpeed = new DcTrafficSpeedData(0);
avgSpeed.setTime("车速平均值");
for (DcTrafficSpeedData dcTrafficSpeedDatum : dcTrafficSpeedData) {
@ -370,6 +606,7 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi
avgSpeed.setAvgSpeed(avgSpeed.getAvgSpeed() / dcTrafficSpeedData.size());
dcTrafficSpeedData.add(avgSpeed);
}
}
return AjaxResult.success(dcTrafficSpeedData);
}
}

19
zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml

@ -61,6 +61,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where DATE_FORMAT(`timestamp`,'%Y') = DATE_FORMAT(#{timestamp},'%Y')
GROUP BY iot_device_id,direction,times
</select>
<select id="selectTrafficVolume" resultType="com.zc.business.domain.DcTrafficVolumeData">
select
<choose>
@ -73,7 +74,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<when test="type != null and type == '3'.toString">
date_format(`timestamp`, '%Y-%m')
</when>
</choose> time,sum(traffic_volume) trafficVolume ,
</choose> time,direction,
sum(traffic_volume) trafficVolume ,
sum(traffic_number_of_in_and_small) trafficNumberOfInAndSmall,
sum(bus_traffic_volume) busTrafficVolume,
sum(traffic_volume_of_small_trucks) trafficVolumeOfSmallTrucks,
@ -97,19 +99,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type == '3'.toString">
and DATE_FORMAT(`timestamp`,'%Y') = DATE_FORMAT(#{date},'%Y')
</if>
<if test="direction != null and direction != ''">
and direction = #{direction}
</if>
</where>
GROUP BY time
<if test="direction != null and direction == '1'.toString">,direction</if>
</select>
<select id="selectSpeed" resultType="com.zc.business.domain.DcTrafficSpeedData">
select *,
round((t1.inAndSmallAverageVehicleSpeed + t1.averageSpeedOfBus + t1.smallTrucksAverageVehicleSpeed +
t1.averageSpeedOfMediumSizeTrucks + t1.averageSpeedOfLargeTrucks + t1.averageSpeedOfExtraLargeTrucks +
t1.averageSpeedOfContainerTruck + t1.averageSpeedOfMotorcycle + t1.averageSpeedOfTractor) / 9, 0) avgSpeed
from
(select
(select direction,
<choose>
<when test="type != null and type == '1'.toString">
date_format(`timestamp`, '%Y-%m-%d %H')
@ -144,11 +146,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="type != null and type == '3'.toString">
and DATE_FORMAT(`timestamp`,'%Y') = DATE_FORMAT(#{date},'%Y')
</if>
<if test="direction != null and direction != ''">
and direction = #{direction}
</if>
</where>
GROUP BY time) t1
GROUP BY time
<if test="direction != null and direction == '1'.toString">,direction</if>
) t1
</select>
<insert id="insertDcTrafficSurveyData" parameterType="DcTrafficSurveyData" useGeneratedKeys="true" keyProperty="id">

Loading…
Cancel
Save