| | |
| | | import javax.persistence.*; |
| | | |
| | | @Table(name = "real_time_data_grid_min") |
| | | public class RealTimeDataGridMin { |
| | | @Id |
| | | private Integer id; |
| | | |
| | | @Column(name = "device_code") |
| | | private String deviceCode; |
| | | |
| | | private BigDecimal latitude; |
| | | |
| | | private BigDecimal longitude; |
| | | |
| | | private Float altitude; |
| | | |
| | | @Column(name = "data_time") |
| | | private Date dataTime; |
| | | |
| | | @Column(name = "create_time") |
| | | private Date createTime; |
| | | |
| | | @Column(name = "NO2") |
| | | private Float no2; |
| | | |
| | | @Column(name = "CO") |
| | | private Float co; |
| | | |
| | | @Column(name = "H2S") |
| | | private Float h2s; |
| | | |
| | | @Column(name = "SO2") |
| | | private Float so2; |
| | | |
| | | @Column(name = "O3") |
| | | private Float o3; |
| | | |
| | | @Column(name = "PM25") |
| | | private Float pm25; |
| | | |
| | | @Column(name = "PM10") |
| | | private Float pm10; |
| | | |
| | | private Float temperature; |
| | | |
| | | private Float humidity; |
| | | |
| | | @Column(name = "VOC") |
| | | private Float voc; |
| | | |
| | | @Column(name = "NOI") |
| | | private Float noi; |
| | | |
| | | private Float velocity; |
| | | |
| | | @Column(name = "wind_speed") |
| | | private Float windSpeed; |
| | | |
| | | @Column(name = "wind_direction") |
| | | private Float windDirection; |
| | | |
| | | private Float height; |
| | | |
| | | /** |
| | | * @return id |
| | | */ |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | /** |
| | | * @param id |
| | | */ |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | /** |
| | | * @return device_code |
| | | */ |
| | | public String getDeviceCode() { |
| | | return deviceCode; |
| | | } |
| | | |
| | | /** |
| | | * @param deviceCode |
| | | */ |
| | | public void setDeviceCode(String deviceCode) { |
| | | this.deviceCode = deviceCode == null ? null : deviceCode.trim(); |
| | | } |
| | | |
| | | /** |
| | | * @return latitude |
| | | */ |
| | | public BigDecimal getLatitude() { |
| | | return latitude; |
| | | } |
| | | |
| | | /** |
| | | * @param latitude |
| | | */ |
| | | public void setLatitude(BigDecimal latitude) { |
| | | this.latitude = latitude; |
| | | } |
| | | |
| | | /** |
| | | * @return longitude |
| | | */ |
| | | public BigDecimal getLongitude() { |
| | | return longitude; |
| | | } |
| | | |
| | | /** |
| | | * @param longitude |
| | | */ |
| | | public void setLongitude(BigDecimal longitude) { |
| | | this.longitude = longitude; |
| | | } |
| | | |
| | | /** |
| | | * @return altitude |
| | | */ |
| | | public Float getAltitude() { |
| | | return altitude; |
| | | } |
| | | |
| | | /** |
| | | * @param altitude |
| | | */ |
| | | public void setAltitude(Float altitude) { |
| | | this.altitude = altitude; |
| | | } |
| | | |
| | | /** |
| | | * @return data_time |
| | | */ |
| | | public Date getDataTime() { |
| | | return dataTime; |
| | | } |
| | | |
| | | /** |
| | | * @param dataTime |
| | | */ |
| | | public void setDataTime(Date dataTime) { |
| | | this.dataTime = dataTime; |
| | | } |
| | | |
| | | /** |
| | | * @return create_time |
| | | */ |
| | | public Date getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | /** |
| | | * @param createTime |
| | | */ |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | /** |
| | | * @return NO2 |
| | | */ |
| | | public Float getNo2() { |
| | | return no2; |
| | | } |
| | | |
| | | /** |
| | | * @param no2 |
| | | */ |
| | | public void setNo2(Float no2) { |
| | | this.no2 = no2; |
| | | } |
| | | |
| | | /** |
| | | * @return CO |
| | | */ |
| | | public Float getCo() { |
| | | return co; |
| | | } |
| | | |
| | | /** |
| | | * @param co |
| | | */ |
| | | public void setCo(Float co) { |
| | | this.co = co; |
| | | } |
| | | |
| | | /** |
| | | * @return H2S |
| | | */ |
| | | public Float getH2s() { |
| | | return h2s; |
| | | } |
| | | |
| | | /** |
| | | * @param h2s |
| | | */ |
| | | public void setH2s(Float h2s) { |
| | | this.h2s = h2s; |
| | | } |
| | | |
| | | /** |
| | | * @return SO2 |
| | | */ |
| | | public Float getSo2() { |
| | | return so2; |
| | | } |
| | | |
| | | /** |
| | | * @param so2 |
| | | */ |
| | | public void setSo2(Float so2) { |
| | | this.so2 = so2; |
| | | } |
| | | |
| | | /** |
| | | * @return O3 |
| | | */ |
| | | public Float getO3() { |
| | | return o3; |
| | | } |
| | | |
| | | /** |
| | | * @param o3 |
| | | */ |
| | | public void setO3(Float o3) { |
| | | this.o3 = o3; |
| | | } |
| | | |
| | | /** |
| | | * @return PM25 |
| | | */ |
| | | public Float getPm25() { |
| | | return pm25; |
| | | } |
| | | |
| | | /** |
| | | * @param pm25 |
| | | */ |
| | | public void setPm25(Float pm25) { |
| | | this.pm25 = pm25; |
| | | } |
| | | |
| | | /** |
| | | * @return PM10 |
| | | */ |
| | | public Float getPm10() { |
| | | return pm10; |
| | | } |
| | | |
| | | /** |
| | | * @param pm10 |
| | | */ |
| | | public void setPm10(Float pm10) { |
| | | this.pm10 = pm10; |
| | | } |
| | | |
| | | /** |
| | | * @return temperature |
| | | */ |
| | | public Float getTemperature() { |
| | | return temperature; |
| | | } |
| | | |
| | | /** |
| | | * @param temperature |
| | | */ |
| | | public void setTemperature(Float temperature) { |
| | | this.temperature = temperature; |
| | | } |
| | | |
| | | /** |
| | | * @return humidity |
| | | */ |
| | | public Float getHumidity() { |
| | | return humidity; |
| | | } |
| | | |
| | | /** |
| | | * @param humidity |
| | | */ |
| | | public void setHumidity(Float humidity) { |
| | | this.humidity = humidity; |
| | | } |
| | | |
| | | /** |
| | | * @return VOC |
| | | */ |
| | | public Float getVoc() { |
| | | return voc; |
| | | } |
| | | |
| | | /** |
| | | * @param voc |
| | | */ |
| | | public void setVoc(Float voc) { |
| | | this.voc = voc; |
| | | } |
| | | |
| | | /** |
| | | * @return NOI |
| | | */ |
| | | public Float getNoi() { |
| | | return noi; |
| | | } |
| | | |
| | | /** |
| | | * @param noi |
| | | */ |
| | | public void setNoi(Float noi) { |
| | | this.noi = noi; |
| | | } |
| | | |
| | | /** |
| | | * @return velocity |
| | | */ |
| | | public Float getVelocity() { |
| | | return velocity; |
| | | } |
| | | |
| | | /** |
| | | * @param velocity |
| | | */ |
| | | public void setVelocity(Float velocity) { |
| | | this.velocity = velocity; |
| | | } |
| | | |
| | | /** |
| | | * @return wind_speed |
| | | */ |
| | | public Float getWindSpeed() { |
| | | return windSpeed; |
| | | } |
| | | |
| | | /** |
| | | * @param windSpeed |
| | | */ |
| | | public void setWindSpeed(Float windSpeed) { |
| | | this.windSpeed = windSpeed; |
| | | } |
| | | |
| | | /** |
| | | * @return wind_direction |
| | | */ |
| | | public Float getWindDirection() { |
| | | return windDirection; |
| | | } |
| | | |
| | | /** |
| | | * @param windDirection |
| | | */ |
| | | public void setWindDirection(Float windDirection) { |
| | | this.windDirection = windDirection; |
| | | } |
| | | |
| | | /** |
| | | * @return height |
| | | */ |
| | | public Float getHeight() { |
| | | return height; |
| | | } |
| | | public class RealTimeDataGridMin extends BaseRealTimeData { |
| | | |
| | | /** |
| | | * @param height |
| | | */ |
| | | public void setHeight(Float height) { |
| | | this.height = height; |
| | | } |
| | | } |
| | |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface RealTimeDataGridMinMapper : MyMapper<RealTimeDataGridMin?> |
| | | interface RealTimeDataGridMinMapper : MyMapper<RealTimeDataGridMin> |
| | |
| | | |
| | | interface RealTimeDataService { |
| | | |
| | | fun getSecondData(deviceCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> |
| | | fun getSecondData(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, page, 5000).apply { |
| | | realTimeDataService.getSecondData(deviceCode, startTime, endTime, 0, page, 5000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |
| | |
| | | private var dateFormatter2 = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm") |
| | | private val fileExchange = FileExchange() |
| | | |
| | | override fun getSecondData(deviceCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> { |
| | | override fun getSecondData(deviceCode: String?, startTime: String?, endTime: String?, type: Int?, page: Int?, perPage: Int?): BaseResponse<List<DataVo>> { |
| | | val _perPage = perPage ?: 60 |
| | | val _page = page ?: 1 |
| | | val sTime = startTime?.let { dateFormatter.parse(it) } |
| | |
| | | pages = pageInfo.pages |
| | | } |
| | | UWDeviceType.GRID -> { |
| | | // 网格化监测秒级值 |
| | | if (type == null || type == 0) { |
| | | val pageInfo = PageHelper.startPage<RealTimeDataGrid>(_page, _perPage) |
| | | realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { |
| | | getSecondDataExample(this, deviceCode, sTime, eTime) |
| | |
| | | pageNum = pageInfo.pageNum |
| | | pages = pageInfo.pages |
| | | } |
| | | // 网格化监测分钟值 |
| | | else if (type == 1) { |
| | | val pageInfo = PageHelper.startPage<RealTimeDataGridMin>(_page, _perPage) |
| | | realTimeDataGridMinMapper.selectByExample(Example(RealTimeDataGridMin::class.java).apply { |
| | | getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | }).forEach { result.add(it.toDataVo()) } |
| | | pageNum = pageInfo.pageNum |
| | | pages = pageInfo.pages |
| | | } |
| | | } |
| | | else -> { |
| | | // 从原始数据表中获取数据 |
| | | val pageInfo = PageHelper.startPage<RealTimeData>(_page, _perPage) |
| | |
| | | |
| | | import com.flightfeather.uav.lightshare.service.RealTimeDataService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | |
| | |
| | | @RequestParam(value = "deviceCode", required = false) deviceCode: String?, |
| | | @RequestParam(value = "startTime", required = false) startTime: String?, |
| | | @RequestParam(value = "endTime", required = false) endTime: String?, |
| | | @ApiParam(value = "0: 秒级值; 1:分钟值", defaultValue = "0") @RequestParam(value = "type", required = false) type: Int?, |
| | | @RequestParam(value = "page", required = false) page: Int?, |
| | | @RequestParam(value = "perPage", required = false) perPage: Int? |
| | | ) = realTimeDataService.getSecondData(deviceCode, startTime, endTime, page, perPage) |
| | | ) = realTimeDataService.getSecondData(deviceCode, startTime, endTime, type, page, perPage) |
| | | |
| | | @GetMapping("/sec/next") |
| | | fun getNextData( |
| | |
| | | # password: cn.FLIGHTFEATHER |
| | | |
| | | # 线上服务器 |
| | | # url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | # username: dronemonitor |
| | | # password: dronemonitor_hackxrnomxm |
| | | url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | username: dronemonitor |
| | | password: dronemonitor_hackxrnomxm |
| | | |
| | | # 开发本地服务器 |
| | | # url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | |
| | | # password: 123456 |
| | | |
| | | # 开发远程服务器 |
| | | url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | username: remoteU1 |
| | | password: eSoF8DnzfGTlhAjE |
| | | # url: jdbc:mysql://47.100.191.150:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | # username: remoteU1 |
| | | # password: eSoF8DnzfGTlhAjE |
| | | hikari: |
| | | maximum-pool-size: 500 |
| | | minimum-idle: 20 |
| | |
| | | |
| | | @Test |
| | | fun foo2() { |
| | | val r = realTimeDataService.getSecondData(null, "2021-01-13 14:30:00", "2021-01-13 14:45:00", null, 10) |
| | | val r = realTimeDataService.getSecondData(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, 1, 30000).data |
| | | val data = realTimeDataService.getSecondData(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, page, 50000).apply { |
| | | realTimeDataService.getSecondData(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, 1, 30000).data |
| | | val data = realTimeDataService.getSecondData(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, 10000).apply { |
| | | realTimeDataService.getSecondData(deviceCode, it.first, it.second, page, 0, 10000).apply { |
| | | if (totalPage == -1) { |
| | | totalPage = head?.totalPage ?: 0 |
| | | } |