1. 新增NO监测因子
2. 新增第三方数据接口数据获取相关模块
| | |
| | | add(AirData().apply { setData(FactorType.WIND_SPEED, windSpeed) }) |
| | | add(AirData().apply { setData(FactorType.WIND_DIRECTION, windDirection) }) |
| | | add(AirData().apply { setData(FactorType.HEIGHT, height) }) |
| | | } |
| | | } |
| | | |
| | | fun getByFactorIndex(i: Int): Float? { |
| | | return when (i) { |
| | | 0 -> no2 |
| | | 1 -> co |
| | | 2 -> h2s |
| | | 3 -> so2 |
| | | 4 -> o3 |
| | | 5 -> pm25 |
| | | 6 -> pm10 |
| | | 7 -> voc |
| | | else -> null |
| | | add(AirData().apply { setData(FactorType.NO, no) }) |
| | | } |
| | | } |
| | | |
| | |
| | | FactorType.LNG -> longitude?.toFloat() |
| | | FactorType.LAT -> latitude?.toFloat() |
| | | FactorType.VELOCITY -> velocity |
| | | // FactorType.TIME -> noi |
| | | // FactorType.TIME -> dataTime?.time?.toFloat() |
| | | FactorType.WIND_SPEED -> windSpeed |
| | | FactorType.WIND_DIRECTION -> windDirection |
| | | FactorType.HEIGHT -> height |
| | | FactorType.NO -> no |
| | | else -> null |
| | | } |
| | | } |
| | |
| | | |
| | | //除风向外的其他因子采用算术平均法求取均值 |
| | | val tmpList = mutableListOf<AvgPair>() |
| | | repeat(17) { |
| | | repeat(18) { |
| | | tmpList.add(AvgPair(0f, 0)) |
| | | } |
| | | |
| | |
| | | this.c++ |
| | | } |
| | | } |
| | | tmpList[17].apply { |
| | | it.no?.let { |
| | | t += it |
| | | this.c++ |
| | | } |
| | | } |
| | | } |
| | | |
| | | return RealTimeDataGridMin().apply { |
| | |
| | | velocity = tmpList[14].avg() |
| | | windSpeed = tmpList[15].avg() |
| | | height = tmpList[16].avg() |
| | | no = tmpList[17].avg() |
| | | |
| | | if (c != 0) { |
| | | val avgU = u / c |
| | |
| | | private String districtName; |
| | | |
| | | /** |
| | | * 数据是否已经拉取入库 |
| | | */ |
| | | @Column(name = "data_pulled") |
| | | private Boolean dataPulled; |
| | | |
| | | /** |
| | | * @return mission_code |
| | | */ |
| | | public String getMissionCode() { |
| | |
| | | public void setDistrictName(String districtName) { |
| | | this.districtName = districtName == null ? null : districtName.trim(); |
| | | } |
| | | |
| | | /** |
| | | * 获取数据是否已经拉取入库 |
| | | * |
| | | * @return data_pulled - 数据是否已经拉取入库 |
| | | */ |
| | | public Boolean getDataPulled() { |
| | | return dataPulled; |
| | | } |
| | | |
| | | /** |
| | | * 设置数据是否已经拉取入库 |
| | | * |
| | | * @param dataPulled 数据是否已经拉取入库 |
| | | */ |
| | | public void setDataPulled(Boolean dataPulled) { |
| | | this.dataPulled = dataPulled; |
| | | } |
| | | } |
| | |
| | | |
| | | interface RealTimeDataService { |
| | | |
| | | fun getSecondData(deviceCode: String?, startTime: String?, endTime: String?, type: Int?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> |
| | | fun getSecondData( |
| | | deviceType: String?, deviceCode: String?, startTime: String?, endTime: String?, type: Int?, |
| | | page: Int?, perPage: Int?, |
| | | ): BaseResponse<List<DataVo>> |
| | | |
| | | fun getNextData(deviceCode: String, updateTime: String, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> |
| | | |
| | |
| | | var page = 1 |
| | | var totalPage = -1 |
| | | while (totalPage == -1 || page <= totalPage) { |
| | | realTimeDataService.getSecondData(deviceCode, startTime, endTime, 0, page, 5000).apply { |
| | | realTimeDataService.getSecondData(null, deviceCode, startTime, endTime, 0, page, 5000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |
| | |
| | | var c = 0//风向数据计数 |
| | | var windDirection = .0 // 平均风向角度 |
| | | while (totalPage == -1 || page <= totalPage) { |
| | | realTimeDataService.getSecondData(deviceCode, startTime, endTime, 0, page, 5000).apply { |
| | | realTimeDataService.getSecondData(null, deviceCode, startTime, endTime, 0, page, 5000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |
| | |
| | | private val fileExchange = FileExchange() |
| | | |
| | | override fun getSecondData( |
| | | deviceType: String?, |
| | | deviceCode: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | |
| | | var pages = 0 |
| | | val result = mutableListOf<DataVo>() |
| | | |
| | | when (UWDeviceType.getType(deviceCode)) { |
| | | val _deviceType = if (deviceType != null) { |
| | | UWDeviceType.fromValue(deviceType) |
| | | } else { |
| | | UWDeviceType.getType(deviceCode) |
| | | } |
| | | when (_deviceType) { |
| | | UWDeviceType.VEHICLE -> { |
| | | val pageInfo = PageHelper.startPage<RealTimeDataVehicle>(_page, _perPage) |
| | | realTimeDataVehicleMapper.selectByExample(Example(RealTimeDataVehicle::class.java).apply { |
| | |
| | | |
| | | @GetMapping("/sec") |
| | | fun getSecondData( |
| | | @RequestParam(value = "deviceType", required = false) deviceType: String?, |
| | | @RequestParam(value = "deviceCode", required = false) deviceCode: String?, |
| | | @RequestParam(value = "startTime", required = false) startTime: String?, |
| | | @RequestParam(value = "endTime", required = false) endTime: String?, |
| | |
| | | required = false) type: Int?, |
| | | @RequestParam(value = "page", required = false) page: Int?, |
| | | @RequestParam(value = "perPage", required = false) perPage: Int?, |
| | | ) = realTimeDataService.getSecondData(deviceCode, startTime, endTime, type, page, perPage) |
| | | ) = realTimeDataService.getSecondData(deviceType, deviceCode, startTime, endTime, type, page, perPage) |
| | | |
| | | @GetMapping("/sec/next") |
| | | fun getNextData( |
| | |
| | | TIME(15, "TIME", 6),//时间 |
| | | WIND_SPEED(16, "WIND_SPEED", 3), |
| | | WIND_DIRECTION(17, "WIND_DIRECTION", 2), |
| | | HEIGHT(18, "HEIGHT", 3); |
| | | HEIGHT(18, "HEIGHT", 3), |
| | | NO(19, "NO", 6); |
| | | |
| | | companion object { |
| | | |
| | |
| | | 5 -> PM25 |
| | | 6 -> PM10 |
| | | 7 -> VOC |
| | | 19 -> NO |
| | | else -> null |
| | | } |
| | | |
| | |
| | | WIND_SPEED.value -> WIND_SPEED |
| | | WIND_DIRECTION.value -> WIND_DIRECTION |
| | | HEIGHT.value -> HEIGHT |
| | | NO.value -> NO |
| | | else -> null |
| | | } |
| | | |
| | |
| | | WIND_SPEED.des -> WIND_SPEED |
| | | WIND_DIRECTION.des -> WIND_DIRECTION |
| | | HEIGHT.des -> HEIGHT |
| | | NO.des -> NO |
| | | else -> null |
| | | } |
| | | |
| | |
| | | * 获取监测因子的合理范围 |
| | | */ |
| | | fun getRange(type: FactorType): Pair<Double, Double>? = when (type) { |
| | | NO -> Pair(0.1, 1000.0) |
| | | NO2 -> Pair(0.1, 1000.0) |
| | | CO -> Pair(1.0, 5000.0) |
| | | H2S -> Pair(0.1, 1000.0) |
| | |
| | | * 不处理低于此值的值 |
| | | */ |
| | | fun getVMax(type: FactorType): Double? = when (type) { |
| | | NO -> 1.0 |
| | | NO2 -> 10.0 |
| | | CO -> 100.0 |
| | | H2S -> 10.0 |
| | |
| | | else -> null |
| | | } |
| | | |
| | | /** |
| | | * 因子连续数据上升合理幅度(倍数) |
| | | */ |
| | | fun getMultiplier(name: String?): Double { |
| | | getByName(name)?.let { |
| | | return getMultiplier(it) |
| | |
| | | </javaClientGenerator> |
| | | <!-- 要生成的表 tableName是数据库中的表名或视图名 domainObjectName是实体类名--> |
| | | <!-- <table tableName="air_real_time_data" domainObjectName="RealTimeData" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="mission" domainObjectName="Mission" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="el_minutevalue" domainObjectName="ElectricMinuteValue" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="el_company_device" domainObjectName="CompanyDevice" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="co_complaint" domainObjectName="Complaint" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="co_assessment" domainObjectName="Assessment" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="real_time_data_grid" domainObjectName="RealTimeDataGrid" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="real_time_data_uav" domainObjectName="RealTimeDataUav" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="real_time_data_vehicle" domainObjectName="RealTimeDataVehicle" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="real_time_data_vehicle" domainObjectName="RealTimeDataVehicle" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="device_info" domainObjectName="DeviceInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="factor_calibration" domainObjectName="FactorCalibration" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="real_time_data_grid_min" domainObjectName="RealTimeDataGridMin" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | |
| | | <result column="start_time" jdbcType="TIMESTAMP" property="startTime" /> |
| | | <result column="end_time" jdbcType="TIMESTAMP" property="endTime" /> |
| | | <result column="district_name" jdbcType="VARCHAR" property="districtName" /> |
| | | <result column="data_pulled" jdbcType="BIT" property="dataPulled" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List"> |
| | | <!-- |
| | | WARNING - @mbg.generated |
| | | --> |
| | | mission_code, device_type, device_code, start_time, end_time, district_name |
| | | mission_code, device_type, device_code, start_time, end_time, district_name, data_pulled |
| | | </sql> |
| | | </mapper> |
| | |
| | | |
| | | @Test |
| | | fun foo2() { |
| | | val r = realTimeDataService.getSecondData(null, "2021-01-13 14:30:00", "2021-01-13 14:45:00", 0, null, 10) |
| | | val r = realTimeDataService.getSecondData(null, null, "2021-01-13 14:30:00", "2021-01-13 14:45:00", 0, null, 10) |
| | | println(r) |
| | | } |
| | | |
| | |
| | | val dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") |
| | | val s = sTime.format(dateFormatter) |
| | | val e = eTime.format(dateFormatter) |
| | | val data = realTimeDataService.getSecondData(deviceCode, s, e, 0, 1, 30000).data |
| | | val data = realTimeDataService.getSecondData(null, deviceCode, s, e, 0, 1, 30000).data |
| | | data?.let { |
| | | process.process(it) |
| | | } |
| | |
| | | var totalPage = -1 |
| | | val dataList = mutableListOf<DataVo>() |
| | | while (totalPage == -1 || page <= totalPage) { |
| | | realTimeDataService.getSecondData(deviceCode, it.first, it.second, 0, page, 50000).apply { |
| | | realTimeDataService.getSecondData(null, deviceCode, it.first, it.second, 0, page, 50000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |
| | |
| | | val dateFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss") |
| | | val s = sTime.format(dateFormatter) |
| | | val e = eTime.format(dateFormatter) |
| | | val data = realTimeDataService.getSecondData(deviceCode, s, e, 0, 1, 30000).data |
| | | val data = realTimeDataService.getSecondData(null, deviceCode, s, e, 0, 1, 30000).data |
| | | |
| | | data?.let { |
| | | val dataList = ePWDataPrep.mDataPrep(it) |
| | |
| | | var page = 1 |
| | | var totalPage = -1 |
| | | while (totalPage == -1 || page <= totalPage) { |
| | | realTimeDataService.getSecondData(deviceCode, it.first, it.second, page, 0, 10000).apply { |
| | | realTimeDataService.getSecondData(null, deviceCode, it.first, it.second, page, 0, 10000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |