diff --git a/zc-business/src/main/java/com/zc/business/controller/DcObservationStationController.java b/zc-business/src/main/java/com/zc/business/controller/DcObservationStationController.java new file mode 100644 index 00000000..8ee63e1b --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/controller/DcObservationStationController.java @@ -0,0 +1,109 @@ +package com.zc.business.controller; + +import java.util.List; +import java.util.Map; +import javax.servlet.http.HttpServletResponse; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import com.ruoyi.common.annotation.Log; +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.enums.BusinessType; +import com.zc.business.domain.DcObservationStation; +import com.zc.business.service.IDcObservationStationService; +import com.ruoyi.common.utils.poi.ExcelUtil; +import com.ruoyi.common.core.page.TableDataInfo; + +/** + * 观测站信息Controller + * + * @author ruoyi + * @date 2024-12-09 + */ +@RestController +@RequestMapping("/dcObservationStation") +public class DcObservationStationController extends BaseController +{ + @Autowired + private IDcObservationStationService dcObservationStationService; + + /** + * 查询观测站信息列表 + */ + @GetMapping("/list") + public TableDataInfo list(DcObservationStation dcObservationStation) + { + startPage(); + List list = dcObservationStationService.selectDcObservationStationList(dcObservationStation); + return getDataTable(list); + } + + /** + * 导出观测站信息列表 + */ + @Log(title = "观测站信息", businessType = BusinessType.EXPORT) + @PostMapping("/export") + public void export(HttpServletResponse response, DcObservationStation dcObservationStation) + { + List list = dcObservationStationService.selectDcObservationStationList(dcObservationStation); + ExcelUtil util = new ExcelUtil<>(DcObservationStation.class); + util.exportExcel(response, list, "观测站信息数据"); + } + + /** + * 获取观测站信息详细信息 + */ + @GetMapping(value = "/{id}") + public AjaxResult getInfo(@PathVariable("id") Long id) + { + return AjaxResult.success(dcObservationStationService.selectDcObservationStationById(id)); + } + + /** + * 新增观测站信息 + */ + @Log(title = "观测站信息", businessType = BusinessType.INSERT) + @PostMapping + public AjaxResult add(@RequestBody DcObservationStation dcObservationStation) + { + return toAjax(dcObservationStationService.insertDcObservationStation(dcObservationStation)); + } + + /** + * 修改观测站信息 + */ + @Log(title = "观测站信息", businessType = BusinessType.UPDATE) + @PutMapping + public AjaxResult edit(@RequestBody DcObservationStation dcObservationStation) + { + return toAjax(dcObservationStationService.updateDcObservationStation(dcObservationStation)); + } + + /** + * 删除观测站信息 + */ + @Log(title = "观测站信息", businessType = BusinessType.DELETE) + @DeleteMapping("/{ids}") + public AjaxResult remove(@PathVariable Long[] ids) + { + return toAjax(dcObservationStationService.deleteDcObservationStationByIds(ids)); + } + + /** + * 查询所有观测站 + */ + @Log(title = "查询所有观测站", businessType = BusinessType.DELETE) + @PostMapping("/selectAllStation") + public List> selectAllStation() + { + return dcObservationStationService.selectAllStation(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/controller/DcTrafficSurveyDataController.java b/zc-business/src/main/java/com/zc/business/controller/DcTrafficSurveyDataController.java index d899bb6b..1cb44f4d 100644 --- a/zc-business/src/main/java/com/zc/business/controller/DcTrafficSurveyDataController.java +++ b/zc-business/src/main/java/com/zc/business/controller/DcTrafficSurveyDataController.java @@ -11,7 +11,8 @@ import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; -import com.zc.business.domain.DcDevice; +import com.ruoyi.system.domain.SysLogininfor; +import com.zc.business.domain.*; import com.zc.business.enums.UniversalEnum; import com.zc.common.core.httpclient.exception.HttpException; import io.swagger.v3.oas.annotations.Parameter; @@ -34,7 +35,6 @@ import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.common.enums.BusinessType; -import com.zc.business.domain.DcTrafficSurveyData; import com.zc.business.service.IDcTrafficSurveyDataService; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.core.page.TableDataInfo; @@ -85,16 +85,41 @@ public class DcTrafficSurveyDataController extends BaseController Object data = JSON.parseObject(dcDeviceController.queryDeviceProperties(dcDevice.getIotDeviceId(), propertyId, props).get("data").toString()).get("data"); JSONArray dataArray = JSON.parseArray(data.toString()); - + if (dataArray == null || dataArray.size() < 1){ + break; + } Integer hezeTotal = 0; Integer jinanTotal = 0; + //一小时内所有的车道数据 + JSONArray lanesData = new JSONArray(); for (Object o : dataArray) { JSONObject jsonObject = JSON.parseObject(o.toString()); JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); hezeTotal += Integer.parseInt(formatValue.get("1").toString()); jinanTotal += Integer.parseInt(formatValue.get("3").toString()); + + //车道数据 + JSONArray lanes = formatValue.getJSONArray("lanes"); + lanesData.addAll(lanes); } + // 转换类型 以便使用stream + List lanesList = lanesData.toJavaList(JSONObject.class); + Map dataList = lanesList.stream() + .collect(Collectors.groupingBy( + item -> item.getString("laneNumber").substring(0, 1), // 提取 laneNumber 的第一个字符作为 key + Collectors.mapping(item -> item, + Collectors.collectingAndThen( + Collectors.toList(), + list -> { // 然后将 List 转换为 JSONArray + JSONArray jsonArray = new JSONArray(); + jsonArray.addAll(list); + return jsonArray; + } + ) + ) + )); + //菏泽方向数据 DcTrafficSurveyData hezeData = new DcTrafficSurveyData(); hezeData.setIotDeviceId(dcDevice.getIotDeviceId()); @@ -102,7 +127,6 @@ public class DcTrafficSurveyDataController extends BaseController hezeData.setDirection("1"); hezeData.setTimestamp(lastHourStart); hezeData.setTrafficVolume(Long.valueOf(hezeTotal)); - batchData.add(hezeData); //济南方向数据 DcTrafficSurveyData jinanData = new DcTrafficSurveyData(); jinanData.setIotDeviceId(dcDevice.getIotDeviceId()); @@ -110,6 +134,15 @@ public class DcTrafficSurveyDataController extends BaseController jinanData.setDirection("3"); jinanData.setTimestamp(lastHourStart); jinanData.setTrafficVolume(Long.valueOf(jinanTotal)); + //各方向车道级数据 + if (dataList != null && dataList.size() > 0){ + JSONArray hezeLanesData = dataList.get("1"); + dcTrafficSurveyDataService.formatTrafficSurveyData(hezeData,hezeLanesData); + JSONArray jinanLanesData = dataList.get("3"); + dcTrafficSurveyDataService.formatTrafficSurveyData(jinanData,jinanLanesData); + } + + batchData.add(hezeData); batchData.add(jinanData); } @@ -260,4 +293,37 @@ public class DcTrafficSurveyDataController extends BaseController { return toAjax(dcTrafficSurveyDataService.deleteDcTrafficSurveyDataByIds(ids)); } + + /** + * 综合查询 + */ + @PostMapping("/selectComprehensiveData") + public AjaxResult selectComprehensiveData(@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams){ + return dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams); + } + @PostMapping("/exportComprehensiveData") + public void exportComprehensiveData(HttpServletResponse response,@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams) + { + AjaxResult ajaxResult = dcTrafficSurveyDataService.selectComprehensiveData(dcTrafficSurveyDataQueryParams); + if (ajaxResult.get("code").equals(UniversalEnum.TWO_HUNDRED.getNumber())) { + if (dcTrafficSurveyDataQueryParams.getDataType().equals("1")){ + List dcTrafficVolumeData = (List) ajaxResult.get("data"); + ExcelUtil util = new ExcelUtil<>(DcTrafficVolumeData.class); + util.exportExcel(response, dcTrafficVolumeData, "综合查询"); + } else { + List dcTrafficSpeedData = (List) ajaxResult.get("data"); + ExcelUtil util = new ExcelUtil<>(DcTrafficSpeedData.class); + util.exportExcel(response, dcTrafficSpeedData, "综合查询"); + } + } + } + + /** + * 实时数据 小时数据 + */ + @PostMapping("/selectRealTimeData") + public AjaxResult selectRealTimeData(@RequestBody DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams) throws IOException, HttpException { + return dcTrafficSurveyDataService.selectRealTimeData(dcTrafficSurveyDataQueryParams); + } + } diff --git a/zc-business/src/main/java/com/zc/business/domain/DcObservationStation.java b/zc-business/src/main/java/com/zc/business/domain/DcObservationStation.java new file mode 100644 index 00000000..138782f4 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcObservationStation.java @@ -0,0 +1,671 @@ +package com.zc.business.domain; + +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; + +/** + * 观测站信息对象 dc_observation_station + * + * @author ruoyi + * @date 2024-12-09 + */ +public class DcObservationStation extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** id */ + private Long id; + + /** 物联id */ + @Excel(name = "物联id") + private String iotDeviceId; + + /** 年份 */ + @Excel(name = "年份") + private String year; + + /** 观测站标识 */ + @Excel(name = "观测站标识") + private String sign; + + /** 出临行政区划代码 */ + @Excel(name = "出临行政区划代码") + private String regionCode; + + /** 观测站编号 */ + @Excel(name = "观测站编号") + private String code; + + /** 观测站名称 */ + @Excel(name = "观测站名称") + private String name; + + /** 观测站类型 */ + @Excel(name = "观测站类型") + private String type; + + /** 站点桩号 */ + @Excel(name = "站点桩号") + private String stakeMark; + + /** 起点桩号 */ + @Excel(name = "起点桩号") + private String stakeMarkStart; + + /** 止点桩号 */ + @Excel(name = "止点桩号") + private String stakeMarkEnd; + + /** 观测里程 */ + @Excel(name = "观测里程") + private String observationMileage; + + /** 比重起点桩号 */ + @Excel(name = "比重起点桩号") + private String proportionStakeMarkStart; + + /** 比重止点桩号 */ + @Excel(name = "比重止点桩号") + private String proportionStakeMarkEnd; + + /** 比重观测里程 */ + @Excel(name = "比重观测里程") + private String proportionMileage; + + /** 起点名称 */ + @Excel(name = "起点名称") + private String startName; + + /** 止点名称 */ + @Excel(name = "止点名称") + private String endName; + + /** 调查方法 */ + @Excel(name = "调查方法") + private String investigationMethods; + + /** 车道数量 */ + @Excel(name = "车道数量") + private String lanesNum; + + /** 技术等级 */ + @Excel(name = "技术等级") + private String technicalLevel; + + /** 技术等级唯一 */ + @Excel(name = "技术等级唯一",readConverterExp = "0=否,1=是") + private String uniqueTechnicalLevel; + + /** 路面类型 */ + @Excel(name = "路面类型") + private String roadSurfaceType; + + /** 路面宽度 */ + @Excel(name = "路面宽度") + private String roadWidth; + + /** 设计速度 */ + @Excel(name = "设计速度") + private String speed; + + /** 基准通行能力 */ + @Excel(name = "基准通行能力") + private String benchmarkTrafficCapacity; + + /** 地貌 */ + @Excel(name = "地貌") + private String landforms; + + /** 供电方式 */ + @Excel(name = "供电方式") + private String powerSupplyMode; + + /** 通讯方式 */ + @Excel(name = "通讯方式") + private String communicationMethod; + + /** 调查人员数量 */ + @Excel(name = "调查人员数量") + private String numberOfInvestigators; + + /** 建站日期 */ + @JsonFormat(pattern = "yyyy-MM-dd") + @Excel(name = "建站日期", width = 30, dateFormat = "yyyy-MM-dd") + private Date dateOfWebsiteEstablishment; + + /** 经度 */ + @Excel(name = "经度") + private String longitude; + + /** 纬度 */ + @Excel(name = "纬度") + private String latitude; + + /** 路线标识 */ + @Excel(name = "路线标识") + private String routeSignage; + + /** 路线编号 */ + @Excel(name = "路线编号") + private String routeCode; + + /** 路线名称 */ + @Excel(name = "路线名称") + private String routeName; + + /** 路线类型 */ + @Excel(name = "路线类型") + private String routeType; + + /** 路线简称 */ + @Excel(name = "路线简称") + private String routeAbbreviation; + + /** 路线业务编号 */ + @Excel(name = "路线业务编号") + private String routeBusinessNumber; + + /** 行政区划代码 */ + @Excel(name = "行政区划代码") + private String regionalismCode; + + /** 行政区划名称 */ + @Excel(name = "行政区划名称") + private String regionalismName; + + /** 行政区划简称 */ + @Excel(name = "行政区划简称") + private String regionalismAbbreviation; + + /** 机构标识 */ + @Excel(name = "机构标识") + private String institutionIdentification; + + /** 上级机构标识 */ + @Excel(name = "上级机构标识") + private String superiorOrganizationIdentification; + + /** 管理机构编号 */ + @Excel(name = "管理机构编号") + private String managementOrganizationNumber; + + /** 管理机构名称 */ + @Excel(name = "管理机构名称") + private String nameOfManagementOrganization; + + /** 管理机构类型 */ + @Excel(name = "管理机构类型") + private String typeOfManagementOrganization; + + public void setId(Long id) + { + this.id = id; + } + + public Long getId() + { + return id; + } + + public String getIotDeviceId() { + return iotDeviceId; + } + + public void setIotDeviceId(String iotDeviceId) { + this.iotDeviceId = iotDeviceId; + } + + public void setYear(String year) + { + this.year = year; + } + + public String getYear() + { + return year; + } + public void setSign(String sign) + { + this.sign = sign; + } + + public String getSign() + { + return sign; + } + public void setRegionCode(String regionCode) + { + this.regionCode = regionCode; + } + + public String getRegionCode() + { + return regionCode; + } + public void setCode(String code) + { + this.code = code; + } + + public String getCode() + { + return code; + } + public void setName(String name) + { + this.name = name; + } + + public String getName() + { + return name; + } + public void setType(String type) + { + this.type = type; + } + + public String getType() + { + return type; + } + public void setStakeMark(String stakeMark) + { + this.stakeMark = stakeMark; + } + + public String getStakeMark() + { + return stakeMark; + } + public void setStakeMarkStart(String stakeMarkStart) + { + this.stakeMarkStart = stakeMarkStart; + } + + public String getStakeMarkStart() + { + return stakeMarkStart; + } + public void setStakeMarkEnd(String stakeMarkEnd) + { + this.stakeMarkEnd = stakeMarkEnd; + } + + public String getStakeMarkEnd() + { + return stakeMarkEnd; + } + public void setObservationMileage(String observationMileage) + { + this.observationMileage = observationMileage; + } + + public String getObservationMileage() + { + return observationMileage; + } + public void setProportionStakeMarkStart(String proportionStakeMarkStart) + { + this.proportionStakeMarkStart = proportionStakeMarkStart; + } + + public String getProportionStakeMarkStart() + { + return proportionStakeMarkStart; + } + public void setProportionStakeMarkEnd(String proportionStakeMarkEnd) + { + this.proportionStakeMarkEnd = proportionStakeMarkEnd; + } + + public String getProportionStakeMarkEnd() + { + return proportionStakeMarkEnd; + } + public void setProportionMileage(String proportionMileage) + { + this.proportionMileage = proportionMileage; + } + + public String getProportionMileage() + { + return proportionMileage; + } + public void setStartName(String startName) + { + this.startName = startName; + } + + public String getStartName() + { + return startName; + } + public void setEndName(String endName) + { + this.endName = endName; + } + + public String getEndName() + { + return endName; + } + public void setInvestigationMethods(String investigationMethods) + { + this.investigationMethods = investigationMethods; + } + + public String getInvestigationMethods() + { + return investigationMethods; + } + public void setLanesNum(String lanesNum) + { + this.lanesNum = lanesNum; + } + + public String getLanesNum() + { + return lanesNum; + } + public void setTechnicalLevel(String technicalLevel) + { + this.technicalLevel = technicalLevel; + } + + public String getTechnicalLevel() + { + return technicalLevel; + } + public void setUniqueTechnicalLevel(String uniqueTechnicalLevel) + { + this.uniqueTechnicalLevel = uniqueTechnicalLevel; + } + + public String getUniqueTechnicalLevel() + { + return uniqueTechnicalLevel; + } + public void setRoadSurfaceType(String roadSurfaceType) + { + this.roadSurfaceType = roadSurfaceType; + } + + public String getRoadSurfaceType() + { + return roadSurfaceType; + } + public void setRoadWidth(String roadWidth) + { + this.roadWidth = roadWidth; + } + + public String getRoadWidth() + { + return roadWidth; + } + public void setSpeed(String speed) + { + this.speed = speed; + } + + public String getSpeed() + { + return speed; + } + public void setBenchmarkTrafficCapacity(String benchmarkTrafficCapacity) + { + this.benchmarkTrafficCapacity = benchmarkTrafficCapacity; + } + + public String getBenchmarkTrafficCapacity() + { + return benchmarkTrafficCapacity; + } + public void setLandforms(String landforms) + { + this.landforms = landforms; + } + + public String getLandforms() + { + return landforms; + } + public void setPowerSupplyMode(String powerSupplyMode) + { + this.powerSupplyMode = powerSupplyMode; + } + + public String getPowerSupplyMode() + { + return powerSupplyMode; + } + public void setCommunicationMethod(String communicationMethod) + { + this.communicationMethod = communicationMethod; + } + + public String getCommunicationMethod() + { + return communicationMethod; + } + public void setNumberOfInvestigators(String numberOfInvestigators) + { + this.numberOfInvestigators = numberOfInvestigators; + } + + public String getNumberOfInvestigators() + { + return numberOfInvestigators; + } + public void setDateOfWebsiteEstablishment(Date dateOfWebsiteEstablishment) + { + this.dateOfWebsiteEstablishment = dateOfWebsiteEstablishment; + } + + public Date getDateOfWebsiteEstablishment() + { + return dateOfWebsiteEstablishment; + } + public void setLongitude(String longitude) + { + this.longitude = longitude; + } + + public String getLongitude() + { + return longitude; + } + public void setLatitude(String latitude) + { + this.latitude = latitude; + } + + public String getLatitude() + { + return latitude; + } + public void setRouteSignage(String routeSignage) + { + this.routeSignage = routeSignage; + } + + public String getRouteSignage() + { + return routeSignage; + } + public void setRouteCode(String routeCode) + { + this.routeCode = routeCode; + } + + public String getRouteCode() + { + return routeCode; + } + public void setRouteName(String routeName) + { + this.routeName = routeName; + } + + public String getRouteName() + { + return routeName; + } + public void setRouteType(String routeType) + { + this.routeType = routeType; + } + + public String getRouteType() + { + return routeType; + } + public void setRouteAbbreviation(String routeAbbreviation) + { + this.routeAbbreviation = routeAbbreviation; + } + + public String getRouteAbbreviation() + { + return routeAbbreviation; + } + public void setRouteBusinessNumber(String routeBusinessNumber) + { + this.routeBusinessNumber = routeBusinessNumber; + } + + public String getRouteBusinessNumber() + { + return routeBusinessNumber; + } + public void setRegionalismCode(String regionalismCode) + { + this.regionalismCode = regionalismCode; + } + + public String getRegionalismCode() + { + return regionalismCode; + } + public void setRegionalismName(String regionalismName) + { + this.regionalismName = regionalismName; + } + + public String getRegionalismName() + { + return regionalismName; + } + public void setRegionalismAbbreviation(String regionalismAbbreviation) + { + this.regionalismAbbreviation = regionalismAbbreviation; + } + + public String getRegionalismAbbreviation() + { + return regionalismAbbreviation; + } + public void setInstitutionIdentification(String institutionIdentification) + { + this.institutionIdentification = institutionIdentification; + } + + public String getInstitutionIdentification() + { + return institutionIdentification; + } + public void setSuperiorOrganizationIdentification(String superiorOrganizationIdentification) + { + this.superiorOrganizationIdentification = superiorOrganizationIdentification; + } + + public String getSuperiorOrganizationIdentification() + { + return superiorOrganizationIdentification; + } + public void setManagementOrganizationNumber(String managementOrganizationNumber) + { + this.managementOrganizationNumber = managementOrganizationNumber; + } + + public String getManagementOrganizationNumber() + { + return managementOrganizationNumber; + } + public void setNameOfManagementOrganization(String nameOfManagementOrganization) + { + this.nameOfManagementOrganization = nameOfManagementOrganization; + } + + public String getNameOfManagementOrganization() + { + return nameOfManagementOrganization; + } + public void setTypeOfManagementOrganization(String typeOfManagementOrganization) + { + this.typeOfManagementOrganization = typeOfManagementOrganization; + } + + public String getTypeOfManagementOrganization() + { + return typeOfManagementOrganization; + } + + @Override + public String toString() { + return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) + .append("id", getId()) + .append("year", getYear()) + .append("sign", getSign()) + .append("regionCode", getRegionCode()) + .append("code", getCode()) + .append("name", getName()) + .append("type", getType()) + .append("stakeMark", getStakeMark()) + .append("stakeMarkStart", getStakeMarkStart()) + .append("stakeMarkEnd", getStakeMarkEnd()) + .append("observationMileage", getObservationMileage()) + .append("proportionStakeMarkStart", getProportionStakeMarkStart()) + .append("proportionStakeMarkEnd", getProportionStakeMarkEnd()) + .append("proportionMileage", getProportionMileage()) + .append("startName", getStartName()) + .append("endName", getEndName()) + .append("investigationMethods", getInvestigationMethods()) + .append("lanesNum", getLanesNum()) + .append("technicalLevel", getTechnicalLevel()) + .append("uniqueTechnicalLevel", getUniqueTechnicalLevel()) + .append("roadSurfaceType", getRoadSurfaceType()) + .append("roadWidth", getRoadWidth()) + .append("speed", getSpeed()) + .append("benchmarkTrafficCapacity", getBenchmarkTrafficCapacity()) + .append("landforms", getLandforms()) + .append("powerSupplyMode", getPowerSupplyMode()) + .append("communicationMethod", getCommunicationMethod()) + .append("numberOfInvestigators", getNumberOfInvestigators()) + .append("dateOfWebsiteEstablishment", getDateOfWebsiteEstablishment()) + .append("longitude", getLongitude()) + .append("latitude", getLatitude()) + .append("remark", getRemark()) + .append("updateTime", getUpdateTime()) + .append("routeSignage", getRouteSignage()) + .append("routeCode", getRouteCode()) + .append("routeName", getRouteName()) + .append("routeType", getRouteType()) + .append("routeAbbreviation", getRouteAbbreviation()) + .append("routeBusinessNumber", getRouteBusinessNumber()) + .append("regionalismCode", getRegionalismCode()) + .append("regionalismName", getRegionalismName()) + .append("regionalismAbbreviation", getRegionalismAbbreviation()) + .append("institutionIdentification", getInstitutionIdentification()) + .append("superiorOrganizationIdentification", getSuperiorOrganizationIdentification()) + .append("managementOrganizationNumber", getManagementOrganizationNumber()) + .append("nameOfManagementOrganization", getNameOfManagementOrganization()) + .append("typeOfManagementOrganization", getTypeOfManagementOrganization()) + .toString(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcTrafficSpeedData.java b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSpeedData.java new file mode 100644 index 00000000..1d4bacea --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSpeedData.java @@ -0,0 +1,201 @@ +package com.zc.business.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 一类交调数据对象 dc_traffic_survey_data + * + * @author liuwenge + * @date 2024-10-29 + */ +public class DcTrafficSpeedData 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 inAndSmallAverageVehicleSpeed; + + /** 大客车平均地点车速 */ + @Excel(name = "大客车") + private Integer averageSpeedOfBus; + + /** 小型货车平均地点车速 */ + @Excel(name = "小型货车") + private Integer smallTrucksAverageVehicleSpeed; + + /** 中型货车平均地点车速 */ + @Excel(name = "中型货车") + private Integer averageSpeedOfMediumSizeTrucks; + + /** 大型货车平均地点车速 */ + @Excel(name = "大型货车") + private Integer averageSpeedOfLargeTrucks; + + /** 特大型货车平均地点车速 */ + @Excel(name = "特大型货车") + private Integer averageSpeedOfExtraLargeTrucks; + + /** 集装箱车平均地点车速 */ + @Excel(name = "集装箱车") + private Integer averageSpeedOfContainerTruck; + + /** 摩托车平均地点车速 */ + @Excel(name = "摩托车") + private Integer averageSpeedOfMotorcycle; + + /** 拖拉机平均地点车速 */ + @Excel(name = "拖拉机") + private Integer averageSpeedOfTractor; + + /** 平均地点车速 */ + @Excel(name = "平均车速") + private Integer avgSpeed; + + 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 getInAndSmallAverageVehicleSpeed() { + return inAndSmallAverageVehicleSpeed; + } + + public void setInAndSmallAverageVehicleSpeed(Integer inAndSmallAverageVehicleSpeed) { + this.inAndSmallAverageVehicleSpeed = inAndSmallAverageVehicleSpeed; + } + + public Integer getAverageSpeedOfBus() { + return averageSpeedOfBus; + } + + public void setAverageSpeedOfBus(Integer averageSpeedOfBus) { + this.averageSpeedOfBus = averageSpeedOfBus; + } + + public Integer getSmallTrucksAverageVehicleSpeed() { + return smallTrucksAverageVehicleSpeed; + } + + public void setSmallTrucksAverageVehicleSpeed(Integer smallTrucksAverageVehicleSpeed) { + this.smallTrucksAverageVehicleSpeed = smallTrucksAverageVehicleSpeed; + } + + public Integer getAverageSpeedOfMediumSizeTrucks() { + return averageSpeedOfMediumSizeTrucks; + } + + public void setAverageSpeedOfMediumSizeTrucks(Integer averageSpeedOfMediumSizeTrucks) { + this.averageSpeedOfMediumSizeTrucks = averageSpeedOfMediumSizeTrucks; + } + + public Integer getAverageSpeedOfLargeTrucks() { + return averageSpeedOfLargeTrucks; + } + + public void setAverageSpeedOfLargeTrucks(Integer averageSpeedOfLargeTrucks) { + this.averageSpeedOfLargeTrucks = averageSpeedOfLargeTrucks; + } + + public Integer getAverageSpeedOfExtraLargeTrucks() { + return averageSpeedOfExtraLargeTrucks; + } + + public void setAverageSpeedOfExtraLargeTrucks(Integer averageSpeedOfExtraLargeTrucks) { + this.averageSpeedOfExtraLargeTrucks = averageSpeedOfExtraLargeTrucks; + } + + public Integer getAverageSpeedOfContainerTruck() { + return averageSpeedOfContainerTruck; + } + + public void setAverageSpeedOfContainerTruck(Integer averageSpeedOfContainerTruck) { + this.averageSpeedOfContainerTruck = averageSpeedOfContainerTruck; + } + + public Integer getAverageSpeedOfMotorcycle() { + return averageSpeedOfMotorcycle; + } + + public void setAverageSpeedOfMotorcycle(Integer averageSpeedOfMotorcycle) { + this.averageSpeedOfMotorcycle = averageSpeedOfMotorcycle; + } + + public Integer getAverageSpeedOfTractor() { + return averageSpeedOfTractor; + } + + public void setAverageSpeedOfTractor(Integer averageSpeedOfTractor) { + this.averageSpeedOfTractor = averageSpeedOfTractor; + } + + public Integer getAvgSpeed() { + return avgSpeed; + } + + public void setAvgSpeed(Integer avgSpeed) { + this.avgSpeed = avgSpeed; + } + + + public DcTrafficSpeedData(){} + + public DcTrafficSpeedData(Integer initData){ + this.inAndSmallAverageVehicleSpeed = initData; + this.averageSpeedOfBus = initData; + this.smallTrucksAverageVehicleSpeed = initData; + this.averageSpeedOfMediumSizeTrucks = initData; + this.averageSpeedOfLargeTrucks = initData; + this.averageSpeedOfExtraLargeTrucks = initData; + this.averageSpeedOfContainerTruck = initData; + this.averageSpeedOfMotorcycle = initData; + this.averageSpeedOfTractor = initData; + this.avgSpeed = initData; + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyData.java b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyData.java index 705dbdb0..5a17f849 100644 --- a/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyData.java +++ b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyData.java @@ -33,14 +33,79 @@ public class DcTrafficSurveyData extends BaseEntity private String direction; /** 采集时间 */ - @JsonFormat(pattern = "yyyy-MM-dd") - @Excel(name = "采集时间", width = 30, dateFormat = "yyyy-MM-dd") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @Excel(name = "采集时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss") private Date timestamp; /** 车流量 */ @Excel(name = "车流量") private Long trafficVolume; + /** 跟车百分比 */ + private Integer followingPercentage; + + /** 时间占有率 */ + private Integer timeOccupancyRate; + + /** 平均车头间距 */ + private Integer averageHeadway; + + /** 中小客车交通量 */ + private Integer trafficNumberOfInAndSmall; + + /** 中小客车平均地点车速 */ + private Integer inAndSmallAverageVehicleSpeed; + + /** 大客车交通量 */ + private Integer busTrafficVolume; + + /** 大客车平均地点车速 */ + private Integer averageSpeedOfBus; + + /** 小型货车交通量 */ + private Integer trafficVolumeOfSmallTrucks; + + /** 小型货车平均地点车速 */ + private Integer smallTrucksAverageVehicleSpeed; + + /** 中型货车交通量 */ + private Integer mediumTruckTrafficVolume; + + /** 中型货车平均地点车速 */ + private Integer averageSpeedOfMediumSizeTrucks; + + /** 大型货车交通量 */ + private Integer largeTruckTrafficVolume; + + /** 大型货车平均地点车速 */ + private Integer averageSpeedOfLargeTrucks; + + /** 特大型货车平均地点车速 */ + private Integer averageSpeedOfExtraLargeTrucks; + + /** 特大型货车交通量 */ + private Integer extraLargeTrucksTrafficVolume; + + /** 集装箱车交通量 */ + private Integer containerTruckTrafficVolume; + + /** 集装箱车平均地点车速 */ + private Integer averageSpeedOfContainerTruck; + + /** 摩托车交通量 */ + private Integer motorcycleTrafficVolume; + + /** 摩托车平均地点车速 */ + private Integer averageSpeedOfMotorcycle; + + /** 拖拉机交通量 */ + private Integer tractorTrafficVolume; + + /** 拖拉机平均地点车速 */ + private Integer averageSpeedOfTractor; + + private Integer avgSpeed; + private String type; private String times; @@ -100,6 +165,174 @@ public class DcTrafficSurveyData extends BaseEntity return trafficVolume; } + public Integer getFollowingPercentage() { + return followingPercentage; + } + + public void setFollowingPercentage(Integer followingPercentage) { + this.followingPercentage = followingPercentage; + } + + public Integer getTimeOccupancyRate() { + return timeOccupancyRate; + } + + public void setTimeOccupancyRate(Integer timeOccupancyRate) { + this.timeOccupancyRate = timeOccupancyRate; + } + + public Integer getAverageHeadway() { + return averageHeadway; + } + + public void setAverageHeadway(Integer averageHeadway) { + this.averageHeadway = averageHeadway; + } + + public Integer getTrafficNumberOfInAndSmall() { + return trafficNumberOfInAndSmall; + } + + public void setTrafficNumberOfInAndSmall(Integer trafficNumberOfInAndSmall) { + this.trafficNumberOfInAndSmall = trafficNumberOfInAndSmall; + } + + public Integer getInAndSmallAverageVehicleSpeed() { + return inAndSmallAverageVehicleSpeed; + } + + public void setInAndSmallAverageVehicleSpeed(Integer inAndSmallAverageVehicleSpeed) { + this.inAndSmallAverageVehicleSpeed = inAndSmallAverageVehicleSpeed; + } + + public Integer getBusTrafficVolume() { + return busTrafficVolume; + } + + public void setBusTrafficVolume(Integer busTrafficVolume) { + this.busTrafficVolume = busTrafficVolume; + } + + public Integer getAverageSpeedOfBus() { + return averageSpeedOfBus; + } + + public void setAverageSpeedOfBus(Integer averageSpeedOfBus) { + this.averageSpeedOfBus = averageSpeedOfBus; + } + + public Integer getTrafficVolumeOfSmallTrucks() { + return trafficVolumeOfSmallTrucks; + } + + public void setTrafficVolumeOfSmallTrucks(Integer trafficVolumeOfSmallTrucks) { + this.trafficVolumeOfSmallTrucks = trafficVolumeOfSmallTrucks; + } + + public Integer getSmallTrucksAverageVehicleSpeed() { + return smallTrucksAverageVehicleSpeed; + } + + public void setSmallTrucksAverageVehicleSpeed(Integer smallTrucksAverageVehicleSpeed) { + this.smallTrucksAverageVehicleSpeed = smallTrucksAverageVehicleSpeed; + } + + public Integer getMediumTruckTrafficVolume() { + return mediumTruckTrafficVolume; + } + + public void setMediumTruckTrafficVolume(Integer mediumTruckTrafficVolume) { + this.mediumTruckTrafficVolume = mediumTruckTrafficVolume; + } + + public Integer getAverageSpeedOfMediumSizeTrucks() { + return averageSpeedOfMediumSizeTrucks; + } + + public void setAverageSpeedOfMediumSizeTrucks(Integer averageSpeedOfMediumSizeTrucks) { + this.averageSpeedOfMediumSizeTrucks = averageSpeedOfMediumSizeTrucks; + } + + public Integer getLargeTruckTrafficVolume() { + return largeTruckTrafficVolume; + } + + public void setLargeTruckTrafficVolume(Integer largeTruckTrafficVolume) { + this.largeTruckTrafficVolume = largeTruckTrafficVolume; + } + + public Integer getAverageSpeedOfLargeTrucks() { + return averageSpeedOfLargeTrucks; + } + + public void setAverageSpeedOfLargeTrucks(Integer averageSpeedOfLargeTrucks) { + this.averageSpeedOfLargeTrucks = averageSpeedOfLargeTrucks; + } + + public Integer getAverageSpeedOfExtraLargeTrucks() { + return averageSpeedOfExtraLargeTrucks; + } + + public void setAverageSpeedOfExtraLargeTrucks(Integer averageSpeedOfExtraLargeTrucks) { + this.averageSpeedOfExtraLargeTrucks = averageSpeedOfExtraLargeTrucks; + } + + public Integer getExtraLargeTrucksTrafficVolume() { + return extraLargeTrucksTrafficVolume; + } + + public void setExtraLargeTrucksTrafficVolume(Integer extraLargeTrucksTrafficVolume) { + this.extraLargeTrucksTrafficVolume = extraLargeTrucksTrafficVolume; + } + + public Integer getContainerTruckTrafficVolume() { + return containerTruckTrafficVolume; + } + + public void setContainerTruckTrafficVolume(Integer containerTruckTrafficVolume) { + this.containerTruckTrafficVolume = containerTruckTrafficVolume; + } + + public Integer getAverageSpeedOfContainerTruck() { + return averageSpeedOfContainerTruck; + } + + public void setAverageSpeedOfContainerTruck(Integer averageSpeedOfContainerTruck) { + this.averageSpeedOfContainerTruck = averageSpeedOfContainerTruck; + } + + public Integer getMotorcycleTrafficVolume() { + return motorcycleTrafficVolume; + } + + public void setMotorcycleTrafficVolume(Integer motorcycleTrafficVolume) { + this.motorcycleTrafficVolume = motorcycleTrafficVolume; + } + + public Integer getAverageSpeedOfMotorcycle() { + return averageSpeedOfMotorcycle; + } + + public void setAverageSpeedOfMotorcycle(Integer averageSpeedOfMotorcycle) { + this.averageSpeedOfMotorcycle = averageSpeedOfMotorcycle; + } + + public Integer getTractorTrafficVolume() { + return tractorTrafficVolume; + } + + public void setTractorTrafficVolume(Integer tractorTrafficVolume) { + this.tractorTrafficVolume = tractorTrafficVolume; + } + + public Integer getAverageSpeedOfTractor() { + return averageSpeedOfTractor; + } + + public void setAverageSpeedOfTractor(Integer averageSpeedOfTractor) { + this.averageSpeedOfTractor = averageSpeedOfTractor; + } + public String getType() { return type; } @@ -116,6 +349,14 @@ public class DcTrafficSurveyData extends BaseEntity this.times = times; } + public Integer getAvgSpeed() { + return avgSpeed; + } + + public void setAvgSpeed(Integer avgSpeed) { + this.avgSpeed = avgSpeed; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyDataQueryParams.java b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyDataQueryParams.java new file mode 100644 index 00000000..a079d000 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcTrafficSurveyDataQueryParams.java @@ -0,0 +1,76 @@ +package com.zc.business.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 一类交调数据对象 dc_traffic_survey_data + * + * @author liuwenge + * @date 2024-10-29 + */ +public class DcTrafficSurveyDataQueryParams extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** 物联设备主键 */ + private String iotDeviceId; + + /** 方向1-上行,2-中,3-下行 */ + private String direction; + + /** 时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date date; + + /** 类型 (1:日, 2:月, 3:年) */ + private String type; + + /** 数据类型 (1:流量, 2:车速) */ + private String dataType; + + 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 Date getDate() { + return date; + } + + public void setDate(Date date) { + this.date = date; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } +} diff --git a/zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeData.java b/zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeData.java new file mode 100644 index 00000000..2d754aec --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/domain/DcTrafficVolumeData.java @@ -0,0 +1,190 @@ +package com.zc.business.domain; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import com.ruoyi.common.utils.StringUtils; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.util.Date; + +/** + * 一类交调数据对象 dc_traffic_survey_data + * + * @author liuwenge + * @date 2024-10-29 + */ +public class DcTrafficVolumeData extends BaseEntity +{ + private static final long serialVersionUID = 1L; + + /** $column.columnComment */ + private Long id; + + /** 物联设备主键 */ + private String iotDeviceId; + + /** 时间 */ + @Excel(name = "时间") + private String time; + + /** 中小客车交通量 */ + @Excel(name = "中小客车") + private Integer trafficNumberOfInAndSmall; + + /** 大客车交通量 */ + @Excel(name = "大客车") + private Integer busTrafficVolume; + + /** 小型货车交通量 */ + @Excel(name = "小型货车") + private Integer trafficVolumeOfSmallTrucks; + + /** 中型货车交通量 */ + @Excel(name = "中型货车") + private Integer mediumTruckTrafficVolume; + + /** 大型货车交通量 */ + @Excel(name = "大型货车") + private Integer largeTruckTrafficVolume; + + /** 特大型货车交通量 */ + @Excel(name = "特大型货车") + private Integer extraLargeTrucksTrafficVolume; + + /** 集装箱车交通量 */ + @Excel(name = "集装箱车") + private Integer containerTruckTrafficVolume; + + /** 摩托车交通量 */ + @Excel(name = "摩托车") + private Integer motorcycleTrafficVolume; + + /** 拖拉机交通量 */ + @Excel(name = "拖拉机") + private Integer tractorTrafficVolume; + + /** 合计 */ + @Excel(name = "合计") + private Integer trafficVolume; + + 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 getTime() { + return time; + } + + public void setTime(String time) { + this.time = time; + } + + public Integer getTrafficNumberOfInAndSmall() { + return trafficNumberOfInAndSmall; + } + + public void setTrafficNumberOfInAndSmall(Integer trafficNumberOfInAndSmall) { + this.trafficNumberOfInAndSmall = trafficNumberOfInAndSmall; + } + + public Integer getBusTrafficVolume() { + return busTrafficVolume; + } + + public void setBusTrafficVolume(Integer busTrafficVolume) { + this.busTrafficVolume = busTrafficVolume; + } + + public Integer getTrafficVolumeOfSmallTrucks() { + return trafficVolumeOfSmallTrucks; + } + + public void setTrafficVolumeOfSmallTrucks(Integer trafficVolumeOfSmallTrucks) { + this.trafficVolumeOfSmallTrucks = trafficVolumeOfSmallTrucks; + } + + public Integer getMediumTruckTrafficVolume() { + return mediumTruckTrafficVolume; + } + + public void setMediumTruckTrafficVolume(Integer mediumTruckTrafficVolume) { + this.mediumTruckTrafficVolume = mediumTruckTrafficVolume; + } + + public Integer getLargeTruckTrafficVolume() { + return largeTruckTrafficVolume; + } + + public void setLargeTruckTrafficVolume(Integer largeTruckTrafficVolume) { + this.largeTruckTrafficVolume = largeTruckTrafficVolume; + } + + public Integer getExtraLargeTrucksTrafficVolume() { + return extraLargeTrucksTrafficVolume; + } + + public void setExtraLargeTrucksTrafficVolume(Integer extraLargeTrucksTrafficVolume) { + this.extraLargeTrucksTrafficVolume = extraLargeTrucksTrafficVolume; + } + + public Integer getContainerTruckTrafficVolume() { + return containerTruckTrafficVolume; + } + + public void setContainerTruckTrafficVolume(Integer containerTruckTrafficVolume) { + this.containerTruckTrafficVolume = containerTruckTrafficVolume; + } + + public Integer getMotorcycleTrafficVolume() { + return motorcycleTrafficVolume; + } + + public void setMotorcycleTrafficVolume(Integer motorcycleTrafficVolume) { + this.motorcycleTrafficVolume = motorcycleTrafficVolume; + } + + public Integer getTractorTrafficVolume() { + return tractorTrafficVolume; + } + + public void setTractorTrafficVolume(Integer tractorTrafficVolume) { + this.tractorTrafficVolume = tractorTrafficVolume; + } + + public Integer getTrafficVolume() { + return trafficVolume; + } + + public void setTrafficVolume(Integer trafficVolume) { + this.trafficVolume = trafficVolume; + } + + public DcTrafficVolumeData(){} + + public DcTrafficVolumeData(Integer initData){ + this.trafficNumberOfInAndSmall = initData; + this.busTrafficVolume = initData; + this.trafficVolumeOfSmallTrucks = initData; + this.mediumTruckTrafficVolume = initData; + this.largeTruckTrafficVolume = initData; + this.extraLargeTrucksTrafficVolume = initData; + this.containerTruckTrafficVolume = initData; + this.motorcycleTrafficVolume = initData; + this.tractorTrafficVolume = initData; + this.trafficVolume = initData; + } +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcObservationStationMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcObservationStationMapper.java new file mode 100644 index 00000000..6c90ac50 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/mapper/DcObservationStationMapper.java @@ -0,0 +1,65 @@ +package com.zc.business.mapper; + +import java.util.List; +import java.util.Map; + +import com.zc.business.domain.DcObservationStation; + +/** + * 观测站信息Mapper接口 + * + * @author ruoyi + * @date 2024-12-09 + */ +public interface DcObservationStationMapper +{ + /** + * 查询观测站信息 + * + * @param id 观测站信息主键 + * @return 观测站信息 + */ + public DcObservationStation selectDcObservationStationById(Long id); + + /** + * 查询观测站信息列表 + * + * @param dcObservationStation 观测站信息 + * @return 观测站信息集合 + */ + List selectDcObservationStationList(DcObservationStation dcObservationStation); + + /** + * 新增观测站信息 + * + * @param dcObservationStation 观测站信息 + * @return 结果 + */ + int insertDcObservationStation(DcObservationStation dcObservationStation); + + /** + * 修改观测站信息 + * + * @param dcObservationStation 观测站信息 + * @return 结果 + */ + int updateDcObservationStation(DcObservationStation dcObservationStation); + + /** + * 删除观测站信息 + * + * @param id 观测站信息主键 + * @return 结果 + */ + int deleteDcObservationStationById(Long id); + + /** + * 批量删除观测站信息 + * + * @param ids 需要删除的数据主键集合 + * @return 结果 + */ + int deleteDcObservationStationByIds(Long[] ids); + + List> selectAllStation(); +} diff --git a/zc-business/src/main/java/com/zc/business/mapper/DcTrafficSurveyDataMapper.java b/zc-business/src/main/java/com/zc/business/mapper/DcTrafficSurveyDataMapper.java index 0a94df6b..e89300ca 100644 --- a/zc-business/src/main/java/com/zc/business/mapper/DcTrafficSurveyDataMapper.java +++ b/zc-business/src/main/java/com/zc/business/mapper/DcTrafficSurveyDataMapper.java @@ -1,9 +1,9 @@ package com.zc.business.mapper; import java.util.List; +import java.util.Map; -import com.zc.business.domain.DcDevice; -import com.zc.business.domain.DcTrafficSurveyData; +import com.zc.business.domain.*; /** * 一类交调数据Mapper接口 @@ -68,4 +68,8 @@ public interface DcTrafficSurveyDataMapper List selectDeviceList(); int batchInsert(List batchData); + + List selectTrafficVolume(DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams); + + List selectSpeed(DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams); } diff --git a/zc-business/src/main/java/com/zc/business/service/IDcObservationStationService.java b/zc-business/src/main/java/com/zc/business/service/IDcObservationStationService.java new file mode 100644 index 00000000..97925d16 --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/IDcObservationStationService.java @@ -0,0 +1,65 @@ +package com.zc.business.service; + +import java.util.List; +import java.util.Map; + +import com.zc.business.domain.DcObservationStation; + +/** + * 观测站信息Service接口 + * + * @author ruoyi + * @date 2024-12-09 + */ +public interface IDcObservationStationService +{ + /** + * 查询观测站信息 + * + * @param id 观测站信息主键 + * @return 观测站信息 + */ + public DcObservationStation selectDcObservationStationById(Long id); + + /** + * 查询观测站信息列表 + * + * @param dcObservationStation 观测站信息 + * @return 观测站信息集合 + */ + List selectDcObservationStationList(DcObservationStation dcObservationStation); + + /** + * 新增观测站信息 + * + * @param dcObservationStation 观测站信息 + * @return 结果 + */ + int insertDcObservationStation(DcObservationStation dcObservationStation); + + /** + * 修改观测站信息 + * + * @param dcObservationStation 观测站信息 + * @return 结果 + */ + int updateDcObservationStation(DcObservationStation dcObservationStation); + + /** + * 批量删除观测站信息 + * + * @param ids 需要删除的观测站信息主键集合 + * @return 结果 + */ + int deleteDcObservationStationByIds(Long[] ids); + + /** + * 删除观测站信息信息 + * + * @param id 观测站信息主键 + * @return 结果 + */ + int deleteDcObservationStationById(Long id); + + List> selectAllStation(); +} diff --git a/zc-business/src/main/java/com/zc/business/service/IDcTrafficSurveyDataService.java b/zc-business/src/main/java/com/zc/business/service/IDcTrafficSurveyDataService.java index 78838bbc..697fbb75 100644 --- a/zc-business/src/main/java/com/zc/business/service/IDcTrafficSurveyDataService.java +++ b/zc-business/src/main/java/com/zc/business/service/IDcTrafficSurveyDataService.java @@ -1,10 +1,14 @@ package com.zc.business.service; +import java.io.IOException; import java.util.List; +import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.core.domain.AjaxResult; import com.zc.business.domain.DcDevice; import com.zc.business.domain.DcTrafficSurveyData; +import com.zc.business.domain.DcTrafficSurveyDataQueryParams; +import com.zc.common.core.httpclient.exception.HttpException; /** * 一类交调数据Service接口 @@ -77,4 +81,23 @@ public interface IDcTrafficSurveyDataService * @return 结果 */ int batchInsert(List batchData); + + + /** + * 综合查询 + * + * @param dcTrafficSurveyDataQueryParams + * @return 结果 + */ + AjaxResult selectComprehensiveData(DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams); + + DcTrafficSurveyData formatTrafficSurveyData(DcTrafficSurveyData dcTrafficSurveyData, JSONArray directionData); + + /** + * 实时数据 + * + * @param dcTrafficSurveyDataQueryParams + * @return 结果 + */ + AjaxResult selectRealTimeData(DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams) throws IOException, HttpException; } diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcObservationStationServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcObservationStationServiceImpl.java new file mode 100644 index 00000000..5d1669cc --- /dev/null +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcObservationStationServiceImpl.java @@ -0,0 +1,102 @@ +package com.zc.business.service.impl; + +import java.util.List; +import java.util.Map; + +import com.ruoyi.common.utils.DateUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.zc.business.mapper.DcObservationStationMapper; +import com.zc.business.domain.DcObservationStation; +import com.zc.business.service.IDcObservationStationService; + +/** + * 观测站信息Service业务层处理 + * + * @author ruoyi + * @date 2024-12-09 + */ +@Service +public class DcObservationStationServiceImpl implements IDcObservationStationService +{ + @Autowired + private DcObservationStationMapper dcObservationStationMapper; + + /** + * 查询观测站信息 + * + * @param id 观测站信息主键 + * @return 观测站信息 + */ + @Override + public DcObservationStation selectDcObservationStationById(Long id) + { + return dcObservationStationMapper.selectDcObservationStationById(id); + } + + /** + * 查询观测站信息列表 + * + * @param dcObservationStation 观测站信息 + * @return 观测站信息 + */ + @Override + public List selectDcObservationStationList(DcObservationStation dcObservationStation) + { + return dcObservationStationMapper.selectDcObservationStationList(dcObservationStation); + } + + /** + * 新增观测站信息 + * + * @param dcObservationStation 观测站信息 + * @return 结果 + */ + @Override + public int insertDcObservationStation(DcObservationStation dcObservationStation) + { + return dcObservationStationMapper.insertDcObservationStation(dcObservationStation); + } + + /** + * 修改观测站信息 + * + * @param dcObservationStation 观测站信息 + * @return 结果 + */ + @Override + public int updateDcObservationStation(DcObservationStation dcObservationStation) + { + dcObservationStation.setUpdateTime(DateUtils.getNowDate()); + return dcObservationStationMapper.updateDcObservationStation(dcObservationStation); + } + + /** + * 批量删除观测站信息 + * + * @param ids 需要删除的观测站信息主键 + * @return 结果 + */ + @Override + public int deleteDcObservationStationByIds(Long[] ids) + { + return dcObservationStationMapper.deleteDcObservationStationByIds(ids); + } + + /** + * 删除观测站信息信息 + * + * @param id 观测站信息主键 + * @return 结果 + */ + @Override + public int deleteDcObservationStationById(Long id) + { + return dcObservationStationMapper.deleteDcObservationStationById(id); + } + + @Override + public List> selectAllStation(){ + return dcObservationStationMapper.selectAllStation(); + } +} diff --git a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSurveyDataServiceImpl.java b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSurveyDataServiceImpl.java index c9a35c5f..04f5d768 100644 --- a/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSurveyDataServiceImpl.java +++ b/zc-business/src/main/java/com/zc/business/service/impl/DcTrafficSurveyDataServiceImpl.java @@ -1,14 +1,23 @@ package com.zc.business.service.impl; +import java.io.IOException; +import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; +import cn.hutool.core.date.DateUtil; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; import com.ruoyi.common.core.domain.AjaxResult; -import com.zc.business.domain.DcDevice; +import com.ruoyi.common.utils.StringUtils; +import com.zc.business.controller.DcDeviceController; +import com.zc.business.domain.*; +import com.zc.business.enums.UniversalEnum; +import com.zc.common.core.httpclient.exception.HttpException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.zc.business.mapper.DcTrafficSurveyDataMapper; -import com.zc.business.domain.DcTrafficSurveyData; import com.zc.business.service.IDcTrafficSurveyDataService; /** @@ -22,6 +31,8 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi { @Autowired private DcTrafficSurveyDataMapper dcTrafficSurveyDataMapper; + @Autowired + private DcDeviceController dcDeviceController; /** * 查询一类交调数据 @@ -245,4 +256,414 @@ public class DcTrafficSurveyDataServiceImpl implements IDcTrafficSurveyDataServi public int batchInsert(List batchData){ return dcTrafficSurveyDataMapper.batchInsert(batchData); } + + /** + * 综合查询 + * + * @param dcTrafficSurveyDataQueryParams + * @return 结果 + */ + @Override + public AjaxResult selectComprehensiveData(DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams){ + + if (StringUtils.isEmpty(dcTrafficSurveyDataQueryParams.getIotDeviceId())){ + return AjaxResult.error("请选择设备"); + } else if (dcTrafficSurveyDataQueryParams.getDate() == null){ + return AjaxResult.error("请选择查询时间"); + } else if (StringUtils.isEmpty(dcTrafficSurveyDataQueryParams.getType())){ + return AjaxResult.error("请选择时间类型"); + } else if (StringUtils.isEmpty(dcTrafficSurveyDataQueryParams.getDataType())){ + return AjaxResult.error("请选择数据类型"); + } + + if (dcTrafficSurveyDataQueryParams.getDataType().equals("1")){ + List dcTrafficVolumeData = dcTrafficSurveyDataMapper.selectTrafficVolume(dcTrafficSurveyDataQueryParams); + if (dcTrafficVolumeData.size() > 0){ + //自然合计值 + DcTrafficVolumeData naturalTotal = new DcTrafficVolumeData(0); + naturalTotal.setTime("自然合计值"); + for (DcTrafficVolumeData dcTrafficVolumeDatum : dcTrafficVolumeData) { + naturalTotal.setTrafficNumberOfInAndSmall(naturalTotal.getTrafficNumberOfInAndSmall() + dcTrafficVolumeDatum.getTrafficNumberOfInAndSmall()); + naturalTotal.setBusTrafficVolume(naturalTotal.getBusTrafficVolume() + dcTrafficVolumeDatum.getBusTrafficVolume()); + naturalTotal.setTrafficVolumeOfSmallTrucks(naturalTotal.getTrafficVolumeOfSmallTrucks() + dcTrafficVolumeDatum.getTrafficVolumeOfSmallTrucks()); + naturalTotal.setMediumTruckTrafficVolume(naturalTotal.getMediumTruckTrafficVolume() + dcTrafficVolumeDatum.getMediumTruckTrafficVolume()); + naturalTotal.setLargeTruckTrafficVolume(naturalTotal.getLargeTruckTrafficVolume() + dcTrafficVolumeDatum.getLargeTruckTrafficVolume()); + naturalTotal.setExtraLargeTrucksTrafficVolume(naturalTotal.getExtraLargeTrucksTrafficVolume() + dcTrafficVolumeDatum.getExtraLargeTrucksTrafficVolume()); + naturalTotal.setContainerTruckTrafficVolume(naturalTotal.getContainerTruckTrafficVolume() + dcTrafficVolumeDatum.getContainerTruckTrafficVolume()); + naturalTotal.setMotorcycleTrafficVolume(naturalTotal.getMotorcycleTrafficVolume() + dcTrafficVolumeDatum.getMotorcycleTrafficVolume()); + naturalTotal.setTractorTrafficVolume(naturalTotal.getTractorTrafficVolume() + dcTrafficVolumeDatum.getTractorTrafficVolume()); + naturalTotal.setTrafficVolume(naturalTotal.getTrafficVolume() + dcTrafficVolumeDatum.getTrafficVolume()); + } + //折算值 + DcTrafficVolumeData conversionValue = new DcTrafficVolumeData(0); + conversionValue.setTime("折算值"); + conversionValue.setTrafficNumberOfInAndSmall(naturalTotal.getTrafficNumberOfInAndSmall()); + conversionValue.setBusTrafficVolume((int) Math.round(naturalTotal.getBusTrafficVolume() * 1.5)); + conversionValue.setTrafficVolumeOfSmallTrucks(naturalTotal.getTrafficVolumeOfSmallTrucks()); + conversionValue.setMediumTruckTrafficVolume((int) Math.round(naturalTotal.getMediumTruckTrafficVolume() * 1.5)); + conversionValue.setLargeTruckTrafficVolume(naturalTotal.getLargeTruckTrafficVolume() * 3); + conversionValue.setExtraLargeTrucksTrafficVolume(naturalTotal.getExtraLargeTrucksTrafficVolume() * 4); + conversionValue.setContainerTruckTrafficVolume(naturalTotal.getContainerTruckTrafficVolume() * 4); + conversionValue.setMotorcycleTrafficVolume(naturalTotal.getMotorcycleTrafficVolume()); + conversionValue.setTractorTrafficVolume(naturalTotal.getTractorTrafficVolume()); + + Integer trafficVolume = conversionValue.getTrafficNumberOfInAndSmall() + conversionValue.getBusTrafficVolume() + + conversionValue.getTrafficVolumeOfSmallTrucks() + conversionValue.getMediumTruckTrafficVolume() + + conversionValue.getLargeTruckTrafficVolume() + conversionValue.getExtraLargeTrucksTrafficVolume() + + conversionValue.getContainerTruckTrafficVolume() + conversionValue.getMotorcycleTrafficVolume() + + conversionValue.getTractorTrafficVolume(); + conversionValue.setTrafficVolume(trafficVolume); + + //自然平均值 + DcTrafficVolumeData naturalAvg = new DcTrafficVolumeData(0); + naturalAvg.setTime("自然平均值"); + naturalAvg.setTrafficNumberOfInAndSmall(naturalTotal.getTrafficNumberOfInAndSmall() / dcTrafficVolumeData.size()); + naturalAvg.setBusTrafficVolume(naturalTotal.getBusTrafficVolume() / dcTrafficVolumeData.size()); + naturalAvg.setTrafficVolumeOfSmallTrucks(naturalTotal.getTrafficVolumeOfSmallTrucks() / dcTrafficVolumeData.size()); + naturalAvg.setMediumTruckTrafficVolume(naturalTotal.getMediumTruckTrafficVolume() / dcTrafficVolumeData.size()); + naturalAvg.setLargeTruckTrafficVolume(naturalTotal.getLargeTruckTrafficVolume() / dcTrafficVolumeData.size()); + naturalAvg.setExtraLargeTrucksTrafficVolume(naturalTotal.getExtraLargeTrucksTrafficVolume() / dcTrafficVolumeData.size()); + naturalAvg.setContainerTruckTrafficVolume(naturalTotal.getContainerTruckTrafficVolume() / dcTrafficVolumeData.size()); + naturalAvg.setMotorcycleTrafficVolume(naturalTotal.getMotorcycleTrafficVolume() / dcTrafficVolumeData.size()); + naturalAvg.setTractorTrafficVolume(naturalTotal.getTractorTrafficVolume() / dcTrafficVolumeData.size()); + Integer naturalAvgTrafficVolume = naturalAvg.getTrafficNumberOfInAndSmall() + naturalAvg.getBusTrafficVolume() + + naturalAvg.getTrafficVolumeOfSmallTrucks() + naturalAvg.getMediumTruckTrafficVolume() + + naturalAvg.getLargeTruckTrafficVolume() + naturalAvg.getExtraLargeTrucksTrafficVolume() + + naturalAvg.getContainerTruckTrafficVolume() + naturalAvg.getMotorcycleTrafficVolume() + + naturalAvg.getTractorTrafficVolume(); + naturalAvg.setTrafficVolume(naturalAvgTrafficVolume); + + dcTrafficVolumeData.add(naturalTotal); + dcTrafficVolumeData.add(conversionValue); + dcTrafficVolumeData.add(naturalAvg); + } + + return AjaxResult.success(dcTrafficVolumeData); + + } else { + List dcTrafficSpeedData = dcTrafficSurveyDataMapper.selectSpeed(dcTrafficSurveyDataQueryParams); + if (dcTrafficSpeedData.size() > 0){ + DcTrafficSpeedData avgSpeed = new DcTrafficSpeedData(0); + avgSpeed.setTime("车速平均值"); + for (DcTrafficSpeedData dcTrafficSpeedDatum : dcTrafficSpeedData) { + avgSpeed.setInAndSmallAverageVehicleSpeed(avgSpeed.getInAndSmallAverageVehicleSpeed() + dcTrafficSpeedDatum.getInAndSmallAverageVehicleSpeed()); + avgSpeed.setAverageSpeedOfBus(avgSpeed.getAverageSpeedOfBus() + dcTrafficSpeedDatum.getAverageSpeedOfBus()); + avgSpeed.setSmallTrucksAverageVehicleSpeed(avgSpeed.getSmallTrucksAverageVehicleSpeed() + dcTrafficSpeedDatum.getSmallTrucksAverageVehicleSpeed()); + avgSpeed.setAverageSpeedOfMediumSizeTrucks(avgSpeed.getAverageSpeedOfMediumSizeTrucks() + dcTrafficSpeedDatum.getAverageSpeedOfMediumSizeTrucks()); + avgSpeed.setAverageSpeedOfLargeTrucks(avgSpeed.getAverageSpeedOfLargeTrucks() + dcTrafficSpeedDatum.getAverageSpeedOfLargeTrucks()); + avgSpeed.setAverageSpeedOfExtraLargeTrucks(avgSpeed.getAverageSpeedOfExtraLargeTrucks() + dcTrafficSpeedDatum.getAverageSpeedOfExtraLargeTrucks()); + avgSpeed.setAverageSpeedOfContainerTruck(avgSpeed.getAverageSpeedOfContainerTruck() + dcTrafficSpeedDatum.getAverageSpeedOfContainerTruck()); + avgSpeed.setAverageSpeedOfMotorcycle(avgSpeed.getAverageSpeedOfMotorcycle() + dcTrafficSpeedDatum.getAverageSpeedOfMotorcycle()); + avgSpeed.setAverageSpeedOfTractor(avgSpeed.getAverageSpeedOfTractor() + dcTrafficSpeedDatum.getAverageSpeedOfTractor()); + avgSpeed.setAvgSpeed(avgSpeed.getAvgSpeed() + dcTrafficSpeedDatum.getAvgSpeed()); + } + + avgSpeed.setInAndSmallAverageVehicleSpeed(avgSpeed.getInAndSmallAverageVehicleSpeed() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfBus(avgSpeed.getAverageSpeedOfBus() / dcTrafficSpeedData.size()); + avgSpeed.setSmallTrucksAverageVehicleSpeed(avgSpeed.getSmallTrucksAverageVehicleSpeed() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfMediumSizeTrucks(avgSpeed.getAverageSpeedOfMediumSizeTrucks() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfLargeTrucks(avgSpeed.getAverageSpeedOfLargeTrucks() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfExtraLargeTrucks(avgSpeed.getAverageSpeedOfExtraLargeTrucks() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfContainerTruck(avgSpeed.getAverageSpeedOfContainerTruck() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfMotorcycle(avgSpeed.getAverageSpeedOfMotorcycle() / dcTrafficSpeedData.size()); + avgSpeed.setAverageSpeedOfTractor(avgSpeed.getAverageSpeedOfTractor() / dcTrafficSpeedData.size()); + avgSpeed.setAvgSpeed(avgSpeed.getAvgSpeed() / dcTrafficSpeedData.size()); + dcTrafficSpeedData.add(avgSpeed); + } + return AjaxResult.success(dcTrafficSpeedData); + } + } + + @Override + public DcTrafficSurveyData formatTrafficSurveyData(DcTrafficSurveyData dcTrafficSurveyData,JSONArray directionData){ + Integer followingPercentage = 0; //跟车百分比 + Integer followingPercentageCount = 0; //跟车百分比统计次数 + + Integer timeOccupancyRate = 0;//时间占有率 + Integer timeOccupancyRateCount = 0;//时间占有率统计次数 + + Integer averageHeadway = 0;//平均车头间距 + Integer averageHeadwayCount = 0;//平均车头间距统计次数 + + Integer trafficNumberOfInAndSmall = 0;//中小客车交通量 + Integer inAndSmallAverageVehicleSpeed = 0;//中小客车平均地点车速 + Integer inAndSmallAverageVehicleSpeedCount = 0;//中小客车平均地点车速统计次数 + + Integer busTrafficVolume = 0;//大客车交通量 + Integer averageSpeedOfBus = 0;//大客车平均地点车速 + Integer averageSpeedOfBusCount = 0;//大客车平均地点车速统计次数 + + Integer trafficVolumeOfSmallTrucks = 0;//小型货车交通量 + Integer smallTrucksAverageVehicleSpeed = 0;//小型货车平均地点车速 + Integer smallTrucksAverageVehicleSpeedCount = 0;//小型货车平均地点车速统计次数 + + Integer mediumTruckTrafficVolume = 0;//中型货车交通量 + Integer averageSpeedOfMediumSizeTrucks = 0; //中型货车平均地点车速 + Integer averageSpeedOfMediumSizeTrucksCount = 0; //中型货车平均地点车速统计次数 + + Integer largeTruckTrafficVolume = 0;//大型货车交通量 + Integer averageSpeedOfLargeTrucks = 0; //大型货车平均地点车速 + Integer averageSpeedOfLargeTrucksCount = 0; //大型货车平均地点车速统计次数 + + Integer extraLargeTrucksTrafficVolume = 0; //特大型货车交通量 + Integer averageSpeedOfExtraLargeTrucks = 0;//特大型货车平均地点车速 + Integer averageSpeedOfExtraLargeTrucksCount = 0; //特大型货车平均地点车速统计次数 + + Integer containerTruckTrafficVolume = 0;//集装箱车交通量 + Integer averageSpeedOfContainerTruck = 0;//集装箱车平均地点车速 + Integer averageSpeedOfContainerTruckCount = 0;//集装箱车平均地点车速统计次数 + + Integer motorcycleTrafficVolume = 0;//摩托车交通量 + Integer averageSpeedOfMotorcycle = 0;//摩托车平均地点车速 + Integer averageSpeedOfMotorcycleCount = 0;//摩托车平均地点车速统计次数 + + Integer tractorTrafficVolume = 0;//拖拉机交通量 + Integer averageSpeedOfTractor = 0;//拖拉机平均地点车速 + Integer averageSpeedOfTractorCount = 0;//拖拉机平均地点车速统计次数 + + for (Object directionDatum : directionData) { + JSONObject laneData = (JSONObject) directionDatum; + if (laneData.getInteger("followingPercentage") > 0){ + followingPercentage += laneData.getInteger("followingPercentage"); + followingPercentageCount++; + } + if (laneData.getInteger("timeOccupancyRate") > 0) { + timeOccupancyRate += laneData.getInteger("timeOccupancyRate"); + timeOccupancyRateCount++; + } + if (laneData.getInteger("averageHeadway") > 0) { + averageHeadway += laneData.getInteger("averageHeadway"); + averageHeadwayCount++; + } + if (laneData.getInteger("trafficNumberOfInAndSmall") > 0) { + trafficNumberOfInAndSmall += laneData.getInteger("trafficNumberOfInAndSmall"); + inAndSmallAverageVehicleSpeed += laneData.getInteger("inAndSmallAverageVehicleSpeed"); + inAndSmallAverageVehicleSpeedCount++; + } + if (laneData.getInteger("busTrafficVolume") > 0) { + busTrafficVolume += laneData.getInteger("busTrafficVolume"); + averageSpeedOfBus += laneData.getInteger("averageSpeedOfBus"); + averageSpeedOfBusCount++; + } + if (laneData.getInteger("trafficVolumeOfSmallTrucks") > 0) { + trafficVolumeOfSmallTrucks += laneData.getInteger("trafficVolumeOfSmallTrucks"); + smallTrucksAverageVehicleSpeed += laneData.getInteger("smallTrucksAverageVehicleSpeed"); + smallTrucksAverageVehicleSpeedCount++; + } + if (laneData.getInteger("mediumTruckTrafficVolume") > 0) { + mediumTruckTrafficVolume += laneData.getInteger("mediumTruckTrafficVolume"); + averageSpeedOfMediumSizeTrucks += laneData.getInteger("averageSpeedOfMediumSizeTrucks"); + averageSpeedOfMediumSizeTrucksCount++; + } + if (laneData.getInteger("largeTruckTrafficVolume") > 0) { + largeTruckTrafficVolume += laneData.getInteger("largeTruckTrafficVolume"); + averageSpeedOfLargeTrucks += laneData.getInteger("averageSpeedOfLargeTrucks"); + averageSpeedOfLargeTrucksCount++; + } + if (laneData.getInteger("extraLargeTrucksTrafficVolume") > 0) { + extraLargeTrucksTrafficVolume += laneData.getInteger("extraLargeTrucksTrafficVolume"); + averageSpeedOfExtraLargeTrucks += laneData.getInteger("averageSpeedOfExtraLargeTrucks"); + averageSpeedOfExtraLargeTrucksCount++; + } + if (laneData.getInteger("containerTruckTrafficVolume") > 0) { + containerTruckTrafficVolume += laneData.getInteger("containerTruckTrafficVolume"); + averageSpeedOfContainerTruck += laneData.getInteger("averageSpeedOfContainerTruck"); + averageSpeedOfContainerTruckCount++; + } + if (laneData.getInteger("motorcycleTrafficVolume") > 0) { + motorcycleTrafficVolume += laneData.getInteger("motorcycleTrafficVolume"); + averageSpeedOfMotorcycle += laneData.getInteger("averageSpeedOfMotorcycle"); + averageSpeedOfMotorcycleCount++; + } + if (laneData.getInteger("tractorTrafficVolume") > 0) { + tractorTrafficVolume += laneData.getInteger("tractorTrafficVolume"); + averageSpeedOfTractor += laneData.getInteger("averageSpeedOfTractor"); + averageSpeedOfTractorCount++; + } + } + + Integer avgSpeed = 0; + Integer avgSpeedCount = 0; + + //计算跟车百分比、时间占有率、车头间距、车速平均值 + if (followingPercentageCount > 0){ + followingPercentage = followingPercentage / followingPercentageCount; + } + if (timeOccupancyRateCount > 0){ + timeOccupancyRate = timeOccupancyRate / timeOccupancyRateCount; + } + if (averageHeadwayCount > 0){ + averageHeadway = averageHeadway / averageHeadwayCount; + } + if (inAndSmallAverageVehicleSpeedCount > 0){ + inAndSmallAverageVehicleSpeed = inAndSmallAverageVehicleSpeed / inAndSmallAverageVehicleSpeedCount; + avgSpeed += inAndSmallAverageVehicleSpeed; + avgSpeedCount++; + } + if (averageSpeedOfBusCount > 0){ + averageSpeedOfBus = averageSpeedOfBus /averageSpeedOfBusCount; + avgSpeed += averageSpeedOfBus; + avgSpeedCount++; + } + if (smallTrucksAverageVehicleSpeedCount > 0){ + smallTrucksAverageVehicleSpeed = smallTrucksAverageVehicleSpeed / smallTrucksAverageVehicleSpeedCount; + avgSpeed += smallTrucksAverageVehicleSpeed; + avgSpeedCount++; + } + if (averageSpeedOfMediumSizeTrucksCount > 0){ + averageSpeedOfMediumSizeTrucks = averageSpeedOfMediumSizeTrucks / averageSpeedOfMediumSizeTrucksCount; + avgSpeed += averageSpeedOfMediumSizeTrucks; + avgSpeedCount++; + } + if (averageSpeedOfLargeTrucksCount > 0){ + averageSpeedOfLargeTrucks = averageSpeedOfLargeTrucks / averageSpeedOfLargeTrucksCount; + avgSpeed += averageSpeedOfLargeTrucks; + avgSpeedCount++; + } + if (averageSpeedOfExtraLargeTrucksCount > 0){ + averageSpeedOfExtraLargeTrucks = averageSpeedOfExtraLargeTrucks / averageSpeedOfExtraLargeTrucksCount; + avgSpeed += averageSpeedOfExtraLargeTrucks; + avgSpeedCount++; + } + if (averageSpeedOfContainerTruckCount > 0){ + averageSpeedOfContainerTruck = averageSpeedOfContainerTruck / averageSpeedOfContainerTruckCount; + avgSpeed += averageSpeedOfContainerTruck; + avgSpeedCount++; + } + if (averageSpeedOfMotorcycleCount > 0){ + averageSpeedOfMotorcycle = averageSpeedOfMotorcycle / averageSpeedOfMotorcycleCount; + avgSpeed += averageSpeedOfMotorcycle; + avgSpeedCount++; + } + if (averageSpeedOfTractorCount > 0){ + averageSpeedOfTractor = averageSpeedOfTractor / averageSpeedOfTractorCount; + avgSpeed += averageSpeedOfTractor; + avgSpeedCount++; + } + + + //方向级平均车速 + if(avgSpeedCount > 0){ + avgSpeed = avgSpeed / avgSpeedCount; + } + + dcTrafficSurveyData.setFollowingPercentage(followingPercentage); + dcTrafficSurveyData.setTimeOccupancyRate(timeOccupancyRate); + dcTrafficSurveyData.setAverageHeadway(averageHeadway); + dcTrafficSurveyData.setTrafficNumberOfInAndSmall(trafficNumberOfInAndSmall); + dcTrafficSurveyData.setInAndSmallAverageVehicleSpeed(inAndSmallAverageVehicleSpeed); + dcTrafficSurveyData.setBusTrafficVolume(busTrafficVolume); + dcTrafficSurveyData.setAverageSpeedOfBus(averageSpeedOfBus); + dcTrafficSurveyData.setTrafficVolumeOfSmallTrucks(trafficVolumeOfSmallTrucks); + dcTrafficSurveyData.setSmallTrucksAverageVehicleSpeed(smallTrucksAverageVehicleSpeed); + dcTrafficSurveyData.setMediumTruckTrafficVolume(mediumTruckTrafficVolume); + dcTrafficSurveyData.setAverageSpeedOfMediumSizeTrucks(averageSpeedOfMediumSizeTrucks); + dcTrafficSurveyData.setLargeTruckTrafficVolume(largeTruckTrafficVolume); + dcTrafficSurveyData.setAverageSpeedOfLargeTrucks(averageSpeedOfLargeTrucks); + dcTrafficSurveyData.setAverageSpeedOfExtraLargeTrucks(averageSpeedOfExtraLargeTrucks); + dcTrafficSurveyData.setExtraLargeTrucksTrafficVolume(extraLargeTrucksTrafficVolume); + dcTrafficSurveyData.setContainerTruckTrafficVolume(containerTruckTrafficVolume); + dcTrafficSurveyData.setAverageSpeedOfContainerTruck(averageSpeedOfContainerTruck); + dcTrafficSurveyData.setMotorcycleTrafficVolume(motorcycleTrafficVolume); + dcTrafficSurveyData.setAverageSpeedOfMotorcycle(averageSpeedOfMotorcycle); + dcTrafficSurveyData.setTractorTrafficVolume(tractorTrafficVolume); + dcTrafficSurveyData.setAverageSpeedOfTractor(averageSpeedOfTractor); + dcTrafficSurveyData.setAvgSpeed(avgSpeed); + + return dcTrafficSurveyData; + + } + + /** + * 实时数据 + * + * @param dcTrafficSurveyDataQueryParams + * @return 结果 + */ + @Override + public AjaxResult selectRealTimeData(DcTrafficSurveyDataQueryParams dcTrafficSurveyDataQueryParams) throws IOException, HttpException { + HashMap props = new HashMap<>(); + // 设置查询条件的键为“timestamp$BTW”,表示时间戳在一定范围内 + props.put("terms[0].column", "timestamp$BTW"); + ArrayList dateList = new ArrayList<>(); + // 计算当天的起止时间 + Date start = DateUtil.beginOfDay(dcTrafficSurveyDataQueryParams.getDate()); + Date end = DateUtil.endOfDay(dcTrafficSurveyDataQueryParams.getDate()); + // 将上一个小时的开始和结束时间添加到列表 + dateList.add(DateUtil.format(start, "yyyy-MM-dd HH:mm:ss")); + dateList.add(DateUtil.format(end, "yyyy-MM-dd HH:mm:ss")); + // 将日期列表以逗号分隔并设置为查询条件的值 + props.put("terms[0].value", String.join(UniversalEnum.COMMA.getValue(), dateList)); + props.put("paging", false); + props.put("sorts[0].order", "asc"); + props.put("sorts[0].name", "timestamp"); + + String propertyId = "01"; //功能码 + + + Object data = JSON.parseObject(dcDeviceController.queryDeviceProperties(dcTrafficSurveyDataQueryParams.getIotDeviceId(), propertyId, props).get("data").toString()).get("data"); + JSONArray dataArray = JSON.parseArray(data.toString()); + if (dataArray == null || dataArray.size() < 1){ + return AjaxResult.success(); + } + + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); + + List> result = new ArrayList<>(); + for (Object o : dataArray) { + JSONObject jsonObject = JSON.parseObject(o.toString()); + long timestamp = jsonObject.getLongValue("timestamp"); + Date date = new Date(timestamp); + String formattedTime = sdf.format(date); + + Map hashMap = new HashMap<>(); + hashMap.put("timestamp", formattedTime); + + + JSONObject formatValue = JSON.parseObject(jsonObject.get("formatValue").toString()); + + DcTrafficSurveyData hezeData = new DcTrafficSurveyData(); + hezeData.setTimestamp(date); + hezeData.setTrafficVolume(Long.parseLong(formatValue.get("1").toString())); + + + DcTrafficSurveyData jinanData = new DcTrafficSurveyData(); + jinanData.setTimestamp(date); + jinanData.setTrafficVolume(Long.parseLong(formatValue.get("3").toString())); + + //车道数据 + JSONArray lanes = formatValue.getJSONArray("lanes"); + // 转换类型 以便使用stream + List lanesList = lanes.toJavaList(JSONObject.class); + Map dataList = lanesList.stream() + .collect(Collectors.groupingBy( + item -> item.getString("laneNumber").substring(0, 1), // 提取 laneNumber 的第一个字符作为 key + Collectors.mapping(item -> item, + Collectors.collectingAndThen( + Collectors.toList(), + list -> { // 然后将 List 转换为 JSONArray + JSONArray jsonArray = new JSONArray(); + jsonArray.addAll(list); + return jsonArray; + } + ) + ) + )); + if (dataList != null && dataList.size() > 0){ + JSONArray hezeLanesData = dataList.get("1"); + formatTrafficSurveyData(hezeData,hezeLanesData); + JSONArray jinanLanesData = dataList.get("3"); + formatTrafficSurveyData(jinanData,jinanLanesData); + } + + Map dataItem = new HashMap<>(); + dataItem.put("time",formattedTime); + dataItem.put("heze",hezeData); + dataItem.put("jinan",jinanData); + + result.add(dataItem); + + } + return AjaxResult.success(result); + } } diff --git a/zc-business/src/main/resources/mapper/business/DcObservationStationMapper.xml b/zc-business/src/main/resources/mapper/business/DcObservationStationMapper.xml new file mode 100644 index 00000000..2d6c001c --- /dev/null +++ b/zc-business/src/main/resources/mapper/business/DcObservationStationMapper.xml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select id, year, sign, region_code, code, iot_device_id, name, type, stake_mark, stake_mark_start, stake_mark_end, observation_mileage, proportion_stake_mark_start, proportion_stake_mark_end, proportion_mileage, start_name, end_name, investigation_methods, lanes_num, technical_level, unique_technical_level, road_surface_type, road_width, speed, benchmark_traffic_capacity, landforms, power_supply_mode, communication_method, number_of_investigators, date_of_website_establishment, longitude, latitude, remark, update_time, route_signage, route_code, route_name, route_type, route_abbreviation, route_business_number, regionalism_code, regionalism_name, regionalism_abbreviation, institution_identification, superior_organization_identification, management_organization_number, name_of_management_organization, type_of_management_organization from dc_observation_station + + + + + + + + + insert into dc_observation_station + + id, + year, + sign, + region_code, + code, + iot_device_id, + name, + type, + stake_mark, + stake_mark_start, + stake_mark_end, + observation_mileage, + proportion_stake_mark_start, + proportion_stake_mark_end, + proportion_mileage, + start_name, + end_name, + investigation_methods, + lanes_num, + technical_level, + unique_technical_level, + road_surface_type, + road_width, + speed, + benchmark_traffic_capacity, + landforms, + power_supply_mode, + communication_method, + number_of_investigators, + date_of_website_establishment, + longitude, + latitude, + remark, + update_time, + route_signage, + route_code, + route_name, + route_type, + route_abbreviation, + route_business_number, + regionalism_code, + regionalism_name, + regionalism_abbreviation, + institution_identification, + superior_organization_identification, + management_organization_number, + name_of_management_organization, + type_of_management_organization, + + + #{id}, + #{year}, + #{sign}, + #{regionCode}, + #{code}, + #{iotDeviceId}, + #{name}, + #{type}, + #{stakeMark}, + #{stakeMarkStart}, + #{stakeMarkEnd}, + #{observationMileage}, + #{proportionStakeMarkStart}, + #{proportionStakeMarkEnd}, + #{proportionMileage}, + #{startName}, + #{endName}, + #{investigationMethods}, + #{lanesNum}, + #{technicalLevel}, + #{uniqueTechnicalLevel}, + #{roadSurfaceType}, + #{roadWidth}, + #{speed}, + #{benchmarkTrafficCapacity}, + #{landforms}, + #{powerSupplyMode}, + #{communicationMethod}, + #{numberOfInvestigators}, + #{dateOfWebsiteEstablishment}, + #{longitude}, + #{latitude}, + #{remark}, + #{updateTime}, + #{routeSignage}, + #{routeCode}, + #{routeName}, + #{routeType}, + #{routeAbbreviation}, + #{routeBusinessNumber}, + #{regionalismCode}, + #{regionalismName}, + #{regionalismAbbreviation}, + #{institutionIdentification}, + #{superiorOrganizationIdentification}, + #{managementOrganizationNumber}, + #{nameOfManagementOrganization}, + #{typeOfManagementOrganization}, + + + + + update dc_observation_station + + year = #{year}, + sign = #{sign}, + region_code = #{regionCode}, + code = #{code}, + iot_device_id = #{iotDeviceId}, + name = #{name}, + type = #{type}, + stake_mark = #{stakeMark}, + stake_mark_start = #{stakeMarkStart}, + stake_mark_end = #{stakeMarkEnd}, + observation_mileage = #{observationMileage}, + proportion_stake_mark_start = #{proportionStakeMarkStart}, + proportion_stake_mark_end = #{proportionStakeMarkEnd}, + proportion_mileage = #{proportionMileage}, + start_name = #{startName}, + end_name = #{endName}, + investigation_methods = #{investigationMethods}, + lanes_num = #{lanesNum}, + technical_level = #{technicalLevel}, + unique_technical_level = #{uniqueTechnicalLevel}, + road_surface_type = #{roadSurfaceType}, + road_width = #{roadWidth}, + speed = #{speed}, + benchmark_traffic_capacity = #{benchmarkTrafficCapacity}, + landforms = #{landforms}, + power_supply_mode = #{powerSupplyMode}, + communication_method = #{communicationMethod}, + number_of_investigators = #{numberOfInvestigators}, + date_of_website_establishment = #{dateOfWebsiteEstablishment}, + longitude = #{longitude}, + latitude = #{latitude}, + remark = #{remark}, + update_time = #{updateTime}, + route_signage = #{routeSignage}, + route_code = #{routeCode}, + route_name = #{routeName}, + route_type = #{routeType}, + route_abbreviation = #{routeAbbreviation}, + route_business_number = #{routeBusinessNumber}, + regionalism_code = #{regionalismCode}, + regionalism_name = #{regionalismName}, + regionalism_abbreviation = #{regionalismAbbreviation}, + institution_identification = #{institutionIdentification}, + superior_organization_identification = #{superiorOrganizationIdentification}, + management_organization_number = #{managementOrganizationNumber}, + name_of_management_organization = #{nameOfManagementOrganization}, + type_of_management_organization = #{typeOfManagementOrganization}, + + where id = #{id} + + + + delete from dc_observation_station where id = #{id} + + + + delete from dc_observation_station where id in + + #{id} + + + \ No newline at end of file diff --git a/zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml b/zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml index 0f550b30..b6c2a292 100644 --- a/zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml +++ b/zc-business/src/main/resources/mapper/business/DcTrafficSurveyDataMapper.xml @@ -61,6 +61,95 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where DATE_FORMAT(`timestamp`,'%Y') = DATE_FORMAT(#{timestamp},'%Y') GROUP BY iot_device_id,direction,times + + insert into dc_traffic_survey_data @@ -88,6 +177,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" direction, timestamp, traffic_volume, + following_percentage, + time_occupancy_rate, + average_headway, + traffic_number_of_in_and_small, + in_and_small_average_vehicle_speed, + bus_traffic_volume, + average_speed_of_bus, + traffic_volume_of_small_trucks, + small_trucks_average_vehicle_speed, + medium_truck_traffic_volume, + average_speed_of_medium_size_trucks, + large_truck_traffic_volume, + average_speed_of_large_trucks, + average_speed_of_extra_large_trucks, + extra_large_trucks_traffic_volume, + container_truck_traffic_volume, + average_speed_of_container_truck, + motorcycle_traffic_volume, + average_speed_of_motorcycle, + tractor_traffic_volume, + average_speed_of_tractor, #{dcTrafficSurveyData.iotDeviceId}, @@ -95,6 +205,27 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{dcTrafficSurveyData.direction}, #{dcTrafficSurveyData.timestamp}, #{dcTrafficSurveyData.trafficVolume}, + #{dcTrafficSurveyData.followingPercentage}, + #{dcTrafficSurveyData.timeOccupancyRate}, + #{dcTrafficSurveyData.averageHeadway}, + #{dcTrafficSurveyData.trafficNumberOfInAndSmall}, + #{dcTrafficSurveyData.inAndSmallAverageVehicleSpeed}, + #{dcTrafficSurveyData.busTrafficVolume}, + #{dcTrafficSurveyData.averageSpeedOfBus}, + #{dcTrafficSurveyData.trafficVolumeOfSmallTrucks}, + #{dcTrafficSurveyData.smallTrucksAverageVehicleSpeed}, + #{dcTrafficSurveyData.mediumTruckTrafficVolume}, + #{dcTrafficSurveyData.averageSpeedOfMediumSizeTrucks}, + #{dcTrafficSurveyData.largeTruckTrafficVolume}, + #{dcTrafficSurveyData.averageSpeedOfLargeTrucks}, + #{dcTrafficSurveyData.averageSpeedOfExtraLargeTrucks}, + #{dcTrafficSurveyData.extraLargeTrucksTrafficVolume}, + #{dcTrafficSurveyData.containerTruckTrafficVolume}, + #{dcTrafficSurveyData.averageSpeedOfContainerTruck}, + #{dcTrafficSurveyData.motorcycleTrafficVolume}, + #{dcTrafficSurveyData.averageSpeedOfMotorcycle}, + #{dcTrafficSurveyData.tractorTrafficVolume}, + #{dcTrafficSurveyData.averageSpeedOfTractor},