1. 新增NO监测因子
2. 新增第三方数据接口数据获取相关模块
| | |
| | | <artifactId>httpmime</artifactId> |
| | | <version>4.5.14</version> |
| | | </dependency> |
| | | <!-- https://mvnrepository.com/artifact/javax.xml.ws/jaxws-api --> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>javax.xml.ws</groupId>--> |
| | | <!-- <artifactId>jaxws-api</artifactId>--> |
| | | <!-- <version>2.3.1</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <!– https://mvnrepository.com/artifact/org.apache.axis2/axis2-jaxws –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.axis2</groupId>--> |
| | | <!-- <artifactId>axis2-jaxws</artifactId>--> |
| | | <!-- <version>1.8.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <!– https://mvnrepository.com/artifact/org.apache.axis2/axis2-adb –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.axis2</groupId>--> |
| | | <!-- <artifactId>axis2-adb</artifactId>--> |
| | | <!-- <version>1.8.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- <!– https://mvnrepository.com/artifact/org.apache.axis2/axis2-transport-base –>--> |
| | | <!-- <dependency>--> |
| | | <!-- <groupId>org.apache.axis2</groupId>--> |
| | | <!-- <artifactId>axis2-transport-base</artifactId>--> |
| | | <!-- <version>1.8.2</version>--> |
| | | <!-- </dependency>--> |
| | | <!-- https://mvnrepository.com/artifact/org.apache.axis2/axis2-kernel --> |
| | | <dependency> |
| | | <groupId>org.apache.axis2</groupId> |
| | | <artifactId>axis2-kernel</artifactId> |
| | | <version>1.8.2</version> |
| | | </dependency> |
| | | |
| | | |
| | | </dependencies> |
| | | |
| | | <build> |
| | |
| | | fun default() = builder() |
| | | .withMain(FactorType.VOC) |
| | | .withSubs(listOf( |
| | | FactorType.H2S, |
| | | // FactorType.H2S, |
| | | FactorType.O3, |
| | | FactorType.PM25, |
| | | FactorType.PM10, |
| | | )) |
| | | .withMain(FactorType.H2S) |
| | | .withSubs(listOf( |
| | | FactorType.VOC, |
| | | FactorType.O3, |
| | | FactorType.PM25, |
| | | )) |
| | | // .withMain(FactorType.H2S) |
| | | // .withSubs(listOf( |
| | | // FactorType.VOC, |
| | | // FactorType.O3, |
| | | // FactorType.PM25, |
| | | // )) |
| | | .withMain(FactorType.O3) |
| | | .withSubs(listOf( |
| | | FactorType.VOC, |
| | | FactorType.H2S, |
| | | // FactorType.H2S, |
| | | FactorType.PM25, |
| | | FactorType.PM10, |
| | | )) |
| | | .withMain(FactorType.PM25) |
| | | .withSubs(listOf( |
| | | FactorType.VOC, |
| | | FactorType.H2S, |
| | | // FactorType.H2S, |
| | | FactorType.O3, |
| | | FactorType.PM10, |
| | | )) |
| | | .withMain(FactorType.PM10) |
| | | .withSubs(listOf( |
| | | FactorType.VOC, |
| | | // FactorType.H2S, |
| | | FactorType.O3, |
| | | FactorType.PM25, |
| | | )) |
| | | // .withSubs(listOf( |
| | | // FactorType.NO2, |
| | |
| | | // 夿ç¸é»æ°æ®æ¯å¦è¿ç»å¹¶ä¸æ¯å¦æ»¡è¶³å¼å¸¸å¤æ |
| | | if (!isContinue) { |
| | | checkResult(s) |
| | | it.sIndex = it.eIndex |
| | | it.startData = data |
| | | it.refreshAfterCheckResult(data) |
| | | } else { |
| | | if (hasException[f] == true) { |
| | | // ä¿®æ¹äºèµ·å§æ°æ®çä½ç½®,åæ´ä¸ºåºç°å¼å¸¸ç该å¼,è䏿¯åæ¥çåºç°å¼å¸¸çæ°æ®çåä¸ä¸ªå¼ |
| | |
| | | it.startData = data |
| | | } |
| | | it.existException = true |
| | | it.exceptionData.add(data) |
| | | } else { |
| | | checkResult(s) |
| | | it.refreshAfterCheckResult(data) |
| | | } |
| | | } |
| | | } |
| | |
| | | import com.flightfeather.uav.domain.entity.Mission |
| | | import com.flightfeather.uav.domain.repository.RealTimeDataRep |
| | | import com.flightfeather.uav.domain.repository.SegmentInfoRep |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | |
| | | val result = mutableListOf<ExceptionResult>() |
| | | taskList.forEach { it.init() } |
| | | // è½®è¯¢æ°æ®ï¼è®¡ç®å个å¼å¸¸ |
| | | realTimeDataRep.fetchData(mission.deviceCode, mission.startTime, mission.endTime).forEach { d -> |
| | | realTimeDataRep.fetchData(UWDeviceType.fromValue(mission.deviceType), |
| | | mission.deviceCode, |
| | | mission.startTime, |
| | | mission.endTime |
| | | ).forEach { d -> |
| | | taskList.forEach { it.onNextData(d) } |
| | | } |
| | | // å个å¼å¸¸åæåå«ç»æ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.biz.datafetch |
| | | |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | import com.flightfeather.uav.common.net.ShenXinService |
| | | import com.flightfeather.uav.domain.entity.Mission |
| | | import com.flightfeather.uav.domain.repository.MissionRep |
| | | import com.flightfeather.uav.domain.repository.RealTimeDataRep |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDate |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.concurrent.ConcurrentHashMap |
| | | |
| | | /** |
| | | * ç³æ¬£ç¯ä¿èµ°èªçæµæ°æ®è·å |
| | | * æ¯å°è®¾å¤åªæä¸ä¸ªçº¿ç¨ï¼ç¡®ä¿ä¸ä¼éå¤è·å |
| | | * @date 2024/8/23 |
| | | * @author feiyu02 |
| | | */ |
| | | @Component |
| | | class ShenXinDataFetch(private val missionRep: MissionRep, private val realTimeDataRep: RealTimeDataRep) { |
| | | |
| | | // è®¾å¤æ¯å¦æ£å¨è·åææ°æ°æ® |
| | | private val deviceStatusMap = ConcurrentHashMap<String, Boolean>() |
| | | // èµ°èªä»»å¡æ¯å¦æ£å¨è·åæ°æ® |
| | | private val missionStatusMap = ConcurrentHashMap<String, Boolean>() |
| | | /** |
| | | * è·åææ°çæ°æ® |
| | | * @param deviceType 设å¤ç±»å |
| | | * @param code 设å¤ç¼å· |
| | | */ |
| | | private fun fetchLatestData(deviceType: UWDeviceType, code: String) { |
| | | if (deviceStatusMap.containsKey(code)) { |
| | | // è®¾å¤æ£å¨è·å宿¶æ°æ®ï¼åç´æ¥è¿åï¼æ¾å¼æ¬æ¬¡è¯·æ± |
| | | if (deviceStatusMap[code] == true) { |
| | | return |
| | | } |
| | | // å¦åå¼å§è·åæ°æ®ï¼ä¿®æ¹ç¶æä¸ºtrue |
| | | else { |
| | | deviceStatusMap[code] = true |
| | | } |
| | | } |
| | | // å½è®¾å¤é¦æ¬¡è·åæ°æ®æ¶ï¼ç´æ¥å¼å§å¹¶ä¿®æ¹ç¶æä¸ºtrue |
| | | else { |
| | | deviceStatusMap[code] = true |
| | | } |
| | | |
| | | try { |
| | | val latestData = realTimeDataRep.fetchData(deviceType, code, null, null, null, 1, 1) |
| | | val st = if (latestData.isEmpty()) { |
| | | LocalDate.now().atStartOfDay() |
| | | } else { |
| | | LocalDateTime.ofInstant(latestData[0].dataTime?.toInstant(), ZoneId.systemDefault()).plusSeconds(1) |
| | | } |
| | | val data = ShenXinService.fetchData(code, st, LocalDateTime.now()) |
| | | realTimeDataRep.saveData(deviceType, data) |
| | | } finally { |
| | | // 设å¤å®ææ°æ®è·ååï¼ä¿®æ¹ç¶æä¸ºfalse |
| | | deviceStatusMap[code] = false |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åç»å®æ¶é´èå´å
çæ°æ® |
| | | */ |
| | | fun fetchLatestData(deviceType: UWDeviceType, code: String, sTime: LocalDateTime?, eTime: LocalDateTime?) { |
| | | if (sTime != null && eTime != null) { |
| | | val data = ShenXinService.fetchData(code, sTime, eTime) |
| | | realTimeDataRep.deleteData(deviceType, code, sTime, eTime) |
| | | realTimeDataRep.saveData(deviceType, data) |
| | | } else if (sTime == null && eTime == null) { |
| | | fetchLatestData(deviceType, code) |
| | | } else { |
| | | throw BizException("å¼å§åç»ææ¶é´éè¦é½çç¥æè
é½å¡«å") |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åä»»å¡çæææ°æ® |
| | | * @param mission ä»»å¡ä¿¡æ¯ |
| | | * @param forceUpdate 强å¶å°è·åçæ°æ®æ¿æ¢åæçæ°æ® |
| | | */ |
| | | fun fetchMissionData(mission: Mission, forceUpdate: Boolean = false) { |
| | | if (missionStatusMap.containsKey(mission.missionCode)) { |
| | | // èµ°èªä»»å¡æ£å¨è·åæ°æ®ï¼åç´æ¥è¿åï¼æ¾å¼æ¬æ¬¡è¯·æ± |
| | | if (missionStatusMap[mission.missionCode] == true) { |
| | | return |
| | | } |
| | | // å¦åå¼å§è·åæ°æ®ï¼ä¿®æ¹ç¶æä¸ºtrue |
| | | else { |
| | | missionStatusMap[mission.missionCode] = true |
| | | } |
| | | } |
| | | // å½èµ°èªä»»å¡é¦æ¬¡è·åæ°æ®æ¶ï¼ç´æ¥å¼å§å¹¶ä¿®æ¹ç¶æä¸ºtrue |
| | | else { |
| | | missionStatusMap[mission.missionCode] = true |
| | | } |
| | | |
| | | try { |
| | | val st = LocalDateTime.ofInstant(mission.startTime?.toInstant(), ZoneId.systemDefault()) |
| | | val et = LocalDateTime.ofInstant(mission.endTime?.toInstant(), ZoneId.systemDefault()) |
| | | val data = ShenXinService.fetchData(mission.deviceCode, st, et) |
| | | val type = UWDeviceType.fromValue(mission.deviceType) |
| | | val oldData = realTimeDataRep.fetchData(mission) |
| | | // å¤ææ°æ°æ®æ°æ®éæ¯å¦çäºæ§æ°æ®ï¼è¥ä¸ç¸çï¼åç®åè®¤ä¸ºæ°æ®æåå¨ï¼æè
设置äºå¼ºå¶æ´æ° |
| | | if (data.size != oldData.size || forceUpdate) { |
| | | if (oldData.isNotEmpty()) { |
| | | realTimeDataRep.deleteData(mission) |
| | | } |
| | | realTimeDataRep.saveData(type, data) |
| | | } |
| | | } finally { |
| | | // èµ°èªä»»å¡å®ææ°æ®è·ååï¼ä¿®æ¹ç¶æä¸ºfalse |
| | | missionStatusMap[mission.missionCode] = false |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åä»»å¡çæææ°æ® |
| | | * @param missionCode ä»»å¡ç¼å· |
| | | * @param forceUpdate 强å¶å°è·åçæ°æ®æ¿æ¢åæçæ°æ® |
| | | */ |
| | | fun fetchMissionData(missionCode: String, forceUpdate: Boolean = false) { |
| | | val mission = missionRep.findOne(missionCode) ?: throw BizException("ä»»å¡ä¸åå¨ï¼æ æ³è·åç¬¬ä¸æ¹æ°æ®") |
| | | fetchMissionData(mission, forceUpdate) |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | // 4. çææ¥å |
| | | val fileName = "report/" + "${mission.districtName}èµ°èªçæµæ¥å-${ |
| | | DateUtil.instance.dateToString(mission.startTime, DateUtil.DateStyle.YYYY_MM_DD) |
| | | }.doc" |
| | | }(${mission.missionCode}).doc" |
| | | val reportTemplate = ReportTemplate(templateName, filePath, fileName) |
| | | val param = getParam(mission, exceptions, summaries) |
| | | val params = reportTemplate.getParam(param) |
| | | GeneratePdfUtil.generateWord(params) |
| | | return fileName |
| | | return filePath + fileName |
| | | } |
| | | |
| | | private fun getParam(mission: Mission, exceptions: List<ExceptionResult>, summaries: List<Summary>): Param { |
| | |
| | | |
| | | /** |
| | | * é«å¾·å°å¾Webæå¡API |
| | | * Date: 2024/07/14 |
| | | */ |
| | | object AMapService { |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.common.net |
| | | |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | import com.flightfeather.uav.common.utils.DateUtil |
| | | import com.flightfeather.uav.domain.entity.BaseRealTimeData |
| | | import com.flightfeather.uav.domain.entity.Mission |
| | | import com.flightfeather.uav.domain.entity.RealTimeDataVehicle |
| | | import org.w3c.dom.Element |
| | | import java.math.BigDecimal |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.time.format.DateTimeFormatter |
| | | import java.util.* |
| | | import javax.xml.soap.Node |
| | | |
| | | /** |
| | | * ç³æ¬£ç¯ä¿èµ°èªçæµæ°æ®æ¥å£API |
| | | * Date: 2024/08/22 |
| | | */ |
| | | object ShenXinService { |
| | | |
| | | private const val USER = "user1" |
| | | private const val PW = "User1@jingan" |
| | | |
| | | // " |
| | | private val soapClient = SoapClient( |
| | | "http://tempuri.org/", |
| | | "http://180.169.129.106:9001/WebService.asmx?wsdl", |
| | | "WebService", "WebServiceSoap", "GetData", |
| | | "GetDataResponse" |
| | | ) |
| | | |
| | | data class DataParams( |
| | | val mn: String?, |
| | | val dtFrom: String?, |
| | | val dtTo: String?, |
| | | val compUser: String = USER, |
| | | val compPassword: String = PW, |
| | | ) { |
| | | fun toMap(): MutableMap<String?, String?> { |
| | | return mutableMapOf( |
| | | "compUser" to compUser, |
| | | "compPassword" to compPassword, |
| | | "mn" to mn, |
| | | "dtFrom" to dtFrom, |
| | | "dtTo" to dtTo, |
| | | ) |
| | | } |
| | | } |
| | | |
| | | fun fetchData(mission: Mission, updateTime: LocalDateTime): List<BaseRealTimeData> { |
| | | val et = LocalDateTime.ofInstant(mission.endTime.toInstant(), ZoneId.systemDefault()) |
| | | if (updateTime.isAfter(et)) return emptyList() |
| | | return fetchData(mission.deviceCode, updateTime, et) |
| | | } |
| | | |
| | | fun fetchData(deviceCode: String?, startTime: LocalDateTime, endTime:LocalDateTime): List<BaseRealTimeData> { |
| | | val st = startTime.format(DateTimeFormatter.ofPattern(DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS.value)) |
| | | val et = endTime.format(DateTimeFormatter.ofPattern(DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS.value)) |
| | | val param = DataParams(deviceCode, st, et) |
| | | val realTimeDataVehicleList = mutableListOf<BaseRealTimeData>() |
| | | soapClient.sendMessage(param.toMap())?.let { res -> |
| | | try { |
| | | // èç¹GetDataResult |
| | | val result = res.item(0).firstChild |
| | | // èç¹ReturnCodeï¼0表示æå |
| | | if (result.firstChild.textContent == "0") { |
| | | // println(result.childNodes.item(2).nodeName) |
| | | // èç¹ListInfoå
çæ°æ®å表 |
| | | val dataNodes = result.childNodes.item(2).childNodes |
| | | // éåæ¯ä¸ªDataInfoèç¹ï¼è½¬æ¢ä¸º [RealTimeDataVehicle] 对象 |
| | | for (i in 0 until dataNodes.length) { |
| | | val dataInfo = dataNodes.item(i) |
| | | if (dataInfo.nodeType == Element.ELEMENT_NODE) { |
| | | val element = dataInfo as Element |
| | | realTimeDataVehicleList.add(elementToRealTimeData(deviceCode, element)) |
| | | } |
| | | } |
| | | } |
| | | } catch (e: Exception) { |
| | | throw BizException("ç³æ¬£ç¯ä¿èµ°èªçæµæ°æ®æ¥å£è§£æå¤±è´¥", e) |
| | | } |
| | | } |
| | | return realTimeDataVehicleList |
| | | } |
| | | |
| | | /** |
| | | * DataInfo转æ¢ä¸ºRealTimeDataVehicle |
| | | */ |
| | | private fun elementToRealTimeData(deviceCode: String?, element: Element): BaseRealTimeData { |
| | | return BaseRealTimeData().apply { |
| | | this.deviceCode = deviceCode |
| | | no = toFloatBlank(element.getElementsByTagName("NO").item(0).textContent) |
| | | no2 = toFloatBlank(element.getElementsByTagName("NO2").item(0).textContent) |
| | | co = toFloatBlank(element.getElementsByTagName("CO").item(0).textContent) * 1000 |
| | | pm25 = toFloatBlank(element.getElementsByTagName("PM25").item(0).textContent) |
| | | pm10 = toFloatBlank(element.getElementsByTagName("PM10").item(0).textContent) |
| | | longitude = toBigDecimal(element.getElementsByTagName("Lon").item(0).textContent) |
| | | latitude = toBigDecimal(element.getElementsByTagName("Lat").item(0).textContent) |
| | | temperature = toFloatBlank(element.getElementsByTagName("Temperature").item(0).textContent) |
| | | velocity = toFloatBlank(element.getElementsByTagName("Speed").item(0).textContent) |
| | | windSpeed = toFloatBlank(element.getElementsByTagName("WindSpeed").item(0).textContent) |
| | | windDirection = toFloatBlank(element.getElementsByTagName("WindDirection").item(0).textContent) |
| | | dataTime = DateUtil.instance.StringToDate( |
| | | element.getElementsByTagName("PostTime").item(0).textContent, |
| | | DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS_EN) |
| | | createTime = Date() |
| | | } |
| | | } |
| | | |
| | | private fun toFloatBlank(str: String): Float { |
| | | val _str = str.trim() |
| | | return if (_str.isBlank()) { |
| | | 0f |
| | | } else { |
| | | _str.toFloat() |
| | | } |
| | | } |
| | | |
| | | private fun toBigDecimal(str: String): BigDecimal { |
| | | val _str = str.trim() |
| | | return if (_str.isBlank()) { |
| | | BigDecimal.ZERO |
| | | } else { |
| | | _str.toBigDecimal() |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.common.net |
| | | |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | import com.sun.xml.internal.ws.client.BindingProviderProperties |
| | | import com.sun.xml.internal.ws.developer.JAXWSProperties |
| | | import javax.xml.soap.* |
| | | import javax.xml.ws.Dispatch |
| | | import javax.xml.ws.Service |
| | | import org.w3c.dom.Document |
| | | import org.w3c.dom.NodeList |
| | | import java.net.URL |
| | | import javax.xml.namespace.QName |
| | | import javax.xml.ws.BindingProvider |
| | | import javax.xml.ws.BindingProvider.SOAPACTION_URI_PROPERTY |
| | | import javax.xml.ws.BindingProvider.SOAPACTION_USE_PROPERTY |
| | | import javax.xml.ws.soap.SOAPBinding |
| | | |
| | | |
| | | /** |
| | | * soap客æ·ç«¯ |
| | | * @date 2024/8/22 |
| | | * @author feiyu02 |
| | | */ |
| | | class SoapClient { |
| | | var nameSpace = "" //wsdlçå½åç©ºé´ |
| | | var wsdlUrl = "" //wsdlææ¡£å°å |
| | | var serviceName = "" //æå¡çåå |
| | | var portName = "" |
| | | var responseName = "" //@WebResultï¼æ³¨è§£ä¸çnameå¼ |
| | | var elementName = "" //é»è®¤æ¯è¦è®¿é®çæ¹æ³å 妿@WebMethod屿§nameæå¼ åæ¯è¯¥å¼ï¼å®é
è¿æ¯ä»¥wsdlææ¡£ä¸ºä¸» |
| | | var timeout = 20000 |
| | | |
| | | /** |
| | | * @param nameSpace |
| | | * @param wsdlUrl |
| | | * @param serviceName |
| | | * @param portName |
| | | * @param element |
| | | * @param responseName |
| | | */ |
| | | constructor( |
| | | nameSpace: String, wsdlUrl: String, |
| | | serviceName: String, portName: String, element: String, |
| | | responseName: String, |
| | | ) { |
| | | this.nameSpace = nameSpace |
| | | this.wsdlUrl = wsdlUrl |
| | | this.serviceName = serviceName |
| | | this.portName = portName |
| | | elementName = element |
| | | this.responseName = responseName |
| | | } |
| | | |
| | | /** |
| | | * @param nameSpace |
| | | * @param wsdlUrl |
| | | * @param serviceName |
| | | * @param portName |
| | | * @param element |
| | | * @param responseName |
| | | * @param timeOut æ¯«ç§ |
| | | */ |
| | | constructor( |
| | | nameSpace: String, wsdlUrl: String, |
| | | serviceName: String, portName: String, element: String, |
| | | responseName: String, timeOut: Int, |
| | | ) { |
| | | this.nameSpace = nameSpace |
| | | this.wsdlUrl = wsdlUrl |
| | | this.serviceName = serviceName |
| | | this.portName = portName |
| | | elementName = element |
| | | this.responseName = responseName |
| | | timeout = timeOut |
| | | } |
| | | |
| | | @Throws(Exception::class) |
| | | fun sendMessage(inMsg: Map<String?, String?>): NodeList? { |
| | | // å建URL对象 |
| | | var url: URL? = null |
| | | url = try { |
| | | URL(wsdlUrl) |
| | | } catch (e: Exception) { |
| | | throw BizException("soap:å建URL对象å¼å¸¸", e) |
| | | } |
| | | // å建æå¡(Service) |
| | | val sname = QName(nameSpace, serviceName) |
| | | val service: Service = Service.create(url, sname) |
| | | |
| | | // å建Dispatch对象 |
| | | var dispatch: Dispatch<SOAPMessage?>? = null |
| | | dispatch = try { |
| | | service.createDispatch(QName(nameSpace, portName), SOAPMessage::class.java, Service.Mode.MESSAGE) |
| | | } catch (e: Exception) { |
| | | throw BizException("soap:å建Dispatch对象å¼å¸¸", e) |
| | | } |
| | | |
| | | // å建SOAPMessage |
| | | return try { |
| | | //è¿å¥è¯å¾éè¦ï¼å¦åæ¥éæå¡å¨æªè½è¯å« HTTP 头 SOAPAction çå¼ |
| | | dispatch?.requestContext?.put(SOAPACTION_URI_PROPERTY, nameSpace + elementName) |
| | | dispatch?.requestContext?.put(SOAPACTION_USE_PROPERTY, true) |
| | | dispatch?.requestContext?.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, wsdlUrl.replace("?wsdl", "")) |
| | | val msg: SOAPMessage = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL).createMessage() |
| | | msg.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "UTF-8") |
| | | val envelope: SOAPEnvelope = msg.getSOAPPart().getEnvelope() |
| | | |
| | | |
| | | // å建SOAPHeader(䏿¯å¿
é) |
| | | // SOAPHeader header = envelope.getHeader(); |
| | | // if (header == null) |
| | | // header = envelope.addHeader(); |
| | | // QName hname = new QName(nameSpace, "username", "nn"); |
| | | // header.addHeaderElement(hname).setValue("huoyangege"); |
| | | |
| | | |
| | | // å建SOAPBody |
| | | val body: SOAPBody = envelope.getBody() |
| | | val ename = QName(nameSpace, elementName, "") |
| | | val ele: SOAPBodyElement = body.addBodyElement(ename) |
| | | // å¢å Bodyå
ç´ åå¼ |
| | | inMsg.forEach { (key, value) -> |
| | | ele.addChildElement(QName(nameSpace, key)).value = value |
| | | } |
| | | |
| | | // è¶
æ¶è®¾ç½® |
| | | dispatch?.requestContext?.put(BindingProviderProperties.CONNECT_TIMEOUT, timeout) |
| | | dispatch?.requestContext?.put(JAXWSProperties.REQUEST_TIMEOUT, timeout) |
| | | // éè¿Dispatchä¼ éæ¶æ¯,ä¼è¿åååºæ¶æ¯ |
| | | val response = dispatch?.invoke(msg) |
| | | |
| | | // ååºæ¶æ¯å¤ç,å°ååºçæ¶æ¯è½¬æ¢ä¸ºdoc对象 |
| | | val doc = response?.soapPart?.envelope?.body?.extractContentAsDocument() |
| | | // doc?.getElementsByTagName(responseName)?.item(0)?.textContent ?: "" |
| | | doc?.getElementsByTagName(responseName) |
| | | } catch (e: Exception) { |
| | | throw BizException("soap:æ¥å£è®¿é®å¼å¸¸", e) |
| | | } |
| | | } |
| | | } |
| | |
| | | @Column(name = "NOI") |
| | | var noi: Float? = null |
| | | |
| | | @Column(name = "NO") |
| | | var no: Float? = null |
| | | |
| | | var velocity: Float? = null |
| | | |
| | | @Column(name = "wind_speed") |
| | |
| | | package com.flightfeather.uav.domain.repository |
| | | |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | import com.flightfeather.uav.domain.entity.* |
| | | import com.flightfeather.uav.domain.mapper.RealTimeDataGridMapper |
| | | import com.flightfeather.uav.domain.mapper.RealTimeDataGridMinMapper |
| | |
| | | import com.github.pagehelper.PageHelper |
| | | import org.springframework.stereotype.Repository |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | |
| | | /** |
| | |
| | | private val realTimeDataGridMinMapper: RealTimeDataGridMinMapper, |
| | | ) { |
| | | |
| | | private fun getSecondDataExample(example: Example, deviceCode: String?, sTime: Date?, eTime: Date?) { |
| | | private val delegate = RealTimeDataRepDelegate(realTimeDataVehicleMapper, realTimeDataUavMapper, |
| | | realTimeDataGridMapper, realTimeDataGridMinMapper) |
| | | |
| | | fun fetchData( |
| | | deviceType: UWDeviceType?, deviceCode: String, sTime: Date? = null, eTime: Date? = null, type: Int? = 0, |
| | | page: Int? = null, perPage: Int? = null, |
| | | ): List<BaseRealTimeData> { |
| | | if (page != null && perPage != null) { |
| | | var pageInfo = PageHelper.startPage<BaseRealTimeData>(page, perPage) |
| | | } |
| | | return delegate.selectByDeviceType(deviceType, type) { example -> |
| | | example.createCriteria().apply { |
| | | deviceCode?.let { andEqualTo("deviceCode", it) } |
| | | andEqualTo("deviceCode", deviceCode) |
| | | sTime?.let { andGreaterThanOrEqualTo("dataTime", it) } |
| | | eTime?.let { andLessThanOrEqualTo("dataTime", it) } |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | fun fetchData( |
| | | deviceCode: String, |
| | | sTime: Date?, |
| | | eTime: Date?, |
| | | type: Int? = 0, |
| | | ): List<BaseRealTimeData> { |
| | | var result = listOf<BaseRealTimeData>() |
| | | when (UWDeviceType.getType(deviceCode)) { |
| | | UWDeviceType.VEHICLE -> { |
| | | result = realTimeDataVehicleMapper.selectByExample(Example(RealTimeDataVehicle::class.java).apply { |
| | | getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | }) |
| | | } |
| | | UWDeviceType.UAV -> { |
| | | result = realTimeDataUavMapper.selectByExample(Example(RealTimeDataUav::class.java).apply { |
| | | getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | }) |
| | | } |
| | | UWDeviceType.GRID -> { |
| | | // ç½æ ¼åçæµç§çº§å¼ |
| | | result = if (type == null || type == 0) { |
| | | realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { |
| | | getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | }) |
| | | } |
| | | // ç½æ ¼åçæµåéå¼ |
| | | else { |
| | | realTimeDataGridMinMapper.selectByExample(Example(RealTimeDataGridMin::class.java).apply { |
| | | getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | }) |
| | | } |
| | | } |
| | | else -> Unit |
| | | } |
| | | return result |
| | | |
| | | // var result = listOf<BaseRealTimeData>() |
| | | // when (deviceType) { |
| | | // UWDeviceType.VEHICLE -> { |
| | | // result = realTimeDataVehicleMapper.selectByExample(Example(RealTimeDataVehicle::class.java).apply { |
| | | // getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | // }) |
| | | // } |
| | | // UWDeviceType.UAV -> { |
| | | // result = realTimeDataUavMapper.selectByExample(Example(RealTimeDataUav::class.java).apply { |
| | | // getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | // }) |
| | | // } |
| | | // UWDeviceType.GRID -> { |
| | | // // ç½æ ¼åçæµç§çº§å¼ |
| | | // result = if (type == null || type == 0) { |
| | | // realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { |
| | | // getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | // }) |
| | | // } |
| | | // // ç½æ ¼åçæµåéå¼ |
| | | // else { |
| | | // realTimeDataGridMinMapper.selectByExample(Example(RealTimeDataGridMin::class.java).apply { |
| | | // getSecondDataExample(this, deviceCode, sTime, eTime) |
| | | // }) |
| | | // } |
| | | // } |
| | | // else -> Unit |
| | | // } |
| | | // return result |
| | | } |
| | | |
| | | fun fetchData(mission: Mission) = fetchData(mission.deviceCode, mission.startTime, mission.endTime) |
| | | fun fetchData(mission: Mission) = |
| | | fetchData(UWDeviceType.fromValue(mission.deviceType), mission.deviceCode, mission.startTime, mission.endTime) |
| | | |
| | | |
| | | fun saveData(deviceType: UWDeviceType?, data: List<BaseRealTimeData>, type: Int? = 0): Int { |
| | | return delegate.insertByDeviceType(deviceType, type, data) |
| | | // return when (deviceType) { |
| | | // UWDeviceType.UAV -> realTimeDataUavMapper.insertList(data as List<RealTimeDataUav>) |
| | | // UWDeviceType.VEHICLE -> realTimeDataVehicleMapper.insertList(data as List<RealTimeDataVehicle>) |
| | | // UWDeviceType.GRID -> realTimeDataGridMapper.insertList(data as List<RealTimeDataGrid>) |
| | | // UWDeviceType.BOAT -> 0 |
| | | // else -> 0 |
| | | // } |
| | | } |
| | | |
| | | fun deleteData(mission: Mission, type: Int? = 0): Int { |
| | | if (mission.deviceCode == null || mission.startTime == null || mission.endTime == null) { |
| | | throw BizException("è¦å é¤çèµ°èªä»»å¡ç¼ºå¤±è®¾å¤ç¼å·æéæ ·æ¶é´èå´ï¼æ æ³å é¤å¯¹åºçæµæ°æ®") |
| | | } |
| | | return deleteData(UWDeviceType.fromValue(mission.deviceType), |
| | | mission.deviceCode, |
| | | mission.startTime, |
| | | mission.endTime, type) |
| | | } |
| | | |
| | | fun deleteData(deviceType: UWDeviceType?, deviceCode: String, sTime: Date?, eTime: Date?, type: Int? = 0): Int { |
| | | return delegate.deleteByDeviceType(deviceType, type) { |
| | | it.createCriteria().apply { |
| | | andEqualTo("deviceCode", deviceCode) |
| | | andGreaterThanOrEqualTo("dataTime", sTime) |
| | | andLessThanOrEqualTo("dataTime", eTime) |
| | | } |
| | | } |
| | | } |
| | | |
| | | fun deleteData( |
| | | deviceType: UWDeviceType?, deviceCode: String, sTime: LocalDateTime?, eTime: LocalDateTime?, type: Int? = 0, |
| | | ): Int = deleteData(deviceType, deviceCode, |
| | | Date.from(sTime?.atZone(ZoneId.systemDefault())?.toInstant()), |
| | | Date.from(eTime?.atZone(ZoneId.systemDefault())?.toInstant()), |
| | | type |
| | | ) |
| | | |
| | | fun deleteData(deviceType: UWDeviceType?, data: List<BaseRealTimeData>, type: Int? = 0) { |
| | | delegate.deleteByDeviceType(deviceType, type, data) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.domain.repository |
| | | |
| | | import com.flightfeather.uav.domain.entity.* |
| | | import com.flightfeather.uav.domain.mapper.RealTimeDataGridMapper |
| | | import com.flightfeather.uav.domain.mapper.RealTimeDataGridMinMapper |
| | | import com.flightfeather.uav.domain.mapper.RealTimeDataUavMapper |
| | | import com.flightfeather.uav.domain.mapper.RealTimeDataVehicleMapper |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.util.* |
| | | |
| | | /** |
| | | * 宿¶èµ°èªæ°æ®æ°æ®åºç¸å
³æä½ä»£çç±» |
| | | * @date 2024/8/27 |
| | | * @author feiyu02 |
| | | */ |
| | | class RealTimeDataRepDelegate( |
| | | private val realTimeDataVehicleMapper: RealTimeDataVehicleMapper, |
| | | private val realTimeDataUavMapper: RealTimeDataUavMapper, |
| | | private val realTimeDataGridMapper: RealTimeDataGridMapper, |
| | | private val realTimeDataGridMinMapper: RealTimeDataGridMinMapper, |
| | | ) { |
| | | /** |
| | | * æ ¹æ®è®¾å¤ç±»åæ§è¡ä¸åæ°æ®åºæä½æ¥éª¤ |
| | | * å类设å¤ççæµæ°æ®è½åä¸åæ°æ®è¡¨åå¨ï¼ä½æ°æ®è¡¨ç»æç¸å |
| | | * @param deviceType 设å¤ç±»å |
| | | * @param type æ°æ®ç»è®¡å¨æï¼0ï¼ç§çº§å¼ï¼1ï¼åéå¼ |
| | | * @param callbacks é对ä¸åç±»åç设å¤å¯¹åºçä¸ååè°å½æ° |
| | | */ |
| | | private fun <T> byDeviceType(deviceType: UWDeviceType?, type: Int? = 0, vararg callbacks: () -> T): T? { |
| | | return when (deviceType) { |
| | | UWDeviceType.VEHICLE -> { |
| | | if (callbacks.isNotEmpty()) callbacks[0].invoke() else null |
| | | } |
| | | UWDeviceType.UAV -> { |
| | | if (callbacks.size > 1) callbacks[1].invoke() else null |
| | | } |
| | | UWDeviceType.GRID -> { |
| | | // ç½æ ¼åçæµç§çº§å¼ |
| | | if (type == null || type == 0) { |
| | | if (callbacks.size > 2) callbacks[2].invoke() else null |
| | | } |
| | | // ç½æ ¼åçæµåéå¼ |
| | | else { |
| | | if (callbacks.size > 3) callbacks[3].invoke() else null |
| | | } |
| | | } |
| | | else -> null |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * ç»ä¸çselectæ¹æ³ |
| | | * @param deviceType 设å¤ç±»å |
| | | * @param type æ°æ®ç»è®¡å¨æï¼0ï¼ç§çº§å¼ï¼1ï¼åéå¼ |
| | | * @param condition æ¥è¯¢æ¡ä»¶ |
| | | */ |
| | | fun selectByDeviceType( |
| | | deviceType: UWDeviceType?, type: Int? = 0, |
| | | condition: (example: Example) -> Unit, |
| | | ): List<BaseRealTimeData> { |
| | | return byDeviceType(deviceType, type, { |
| | | realTimeDataVehicleMapper.selectByExample(Example(RealTimeDataVehicle::class.java).apply { condition(this) }) |
| | | }, { |
| | | realTimeDataUavMapper.selectByExample(Example(RealTimeDataUav::class.java).apply { condition(this) }) |
| | | }, { |
| | | realTimeDataGridMapper.selectByExample(Example(RealTimeDataGrid::class.java).apply { condition(this) }) |
| | | }, { |
| | | realTimeDataGridMinMapper.selectByExample(Example(RealTimeDataGridMin::class.java).apply { condition(this) }) |
| | | }) ?: emptyList() |
| | | } |
| | | |
| | | /** |
| | | * ç»ä¸çinsertæ¹æ³ |
| | | * @param deviceType 设å¤ç±»å |
| | | * @param type æ°æ®ç»è®¡å¨æï¼0ï¼ç§çº§å¼ï¼1ï¼åéå¼ |
| | | * @param data æ°æ® |
| | | */ |
| | | fun insertByDeviceType(deviceType: UWDeviceType?, type: Int? = 0, data: List<BaseRealTimeData>): Int { |
| | | return byDeviceType(deviceType, type, { |
| | | realTimeDataVehicleMapper.insertList(data as List<RealTimeDataVehicle>) |
| | | }, { |
| | | realTimeDataUavMapper.insertList(data as List<RealTimeDataUav>) |
| | | }, { |
| | | realTimeDataGridMapper.insertList(data as List<RealTimeDataGrid>) |
| | | }, { |
| | | realTimeDataGridMinMapper.insertList(data as List<RealTimeDataGridMin>) |
| | | }) ?: 0 |
| | | } |
| | | |
| | | /** |
| | | * ç»ä¸çdeleteæ¹æ³ |
| | | * @param deviceType 设å¤ç±»å |
| | | * @param type æ°æ®ç»è®¡å¨æï¼0ï¼ç§çº§å¼ï¼1ï¼åéå¼ |
| | | * @param data æ°æ® |
| | | */ |
| | | fun deleteByDeviceType(deviceType: UWDeviceType?, type: Int? = 0, data: List<BaseRealTimeData>): Int { |
| | | return byDeviceType(deviceType, type, { |
| | | var count = 0 |
| | | data.forEach { count += realTimeDataVehicleMapper.delete(it as RealTimeDataVehicle) } |
| | | count |
| | | }, { |
| | | var count = 0 |
| | | data.forEach { count += realTimeDataUavMapper.delete(it as RealTimeDataUav) } |
| | | count |
| | | }, { |
| | | var count = 0 |
| | | data.forEach { count += realTimeDataGridMapper.delete(it as RealTimeDataGrid) } |
| | | count |
| | | }, { |
| | | var count = 0 |
| | | data.forEach { count += realTimeDataGridMinMapper.delete(it as RealTimeDataGridMin) } |
| | | count |
| | | }) ?: 0 |
| | | } |
| | | |
| | | /** |
| | | * ç»ä¸çdeleteæ¹æ³ |
| | | * @param deviceType 设å¤ç±»å |
| | | * @param type æ°æ®ç»è®¡å¨æï¼0ï¼ç§çº§å¼ï¼1ï¼åéå¼ |
| | | * @param condition æ¥è¯¢æ¡ä»¶ |
| | | */ |
| | | fun deleteByDeviceType(deviceType: UWDeviceType?, type: Int? = 0, condition: (example: Example) -> Unit,): Int { |
| | | return byDeviceType(deviceType, type, { |
| | | realTimeDataVehicleMapper.deleteByExample(Example(RealTimeDataVehicle::class.java).apply { condition(this) }) |
| | | }, { |
| | | realTimeDataUavMapper.deleteByExample(Example(RealTimeDataUav::class.java).apply { condition(this) }) |
| | | }, { |
| | | realTimeDataGridMapper.deleteByExample(Example(RealTimeDataGrid::class.java).apply { condition(this) }) |
| | | }, { |
| | | realTimeDataGridMinMapper.deleteByExample(Example(RealTimeDataGridMin::class.java).apply { condition(this) }) |
| | | }) ?: 0 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.lightshare.eunm |
| | | |
| | | /** |
| | | * ç¬¬ä¸æ¹æ°æ®æ¥å£æ è¯ |
| | | * @date 2024/8/26 |
| | | * @author feiyu02 |
| | | */ |
| | | enum class ThirdPartyLabel(val value: String) { |
| | | ShenXin("shenxin") |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.lightshare.service |
| | | |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * |
| | | * @date 2024/8/26 |
| | | * @author feiyu02 |
| | | */ |
| | | interface ThirdPartyService { |
| | | |
| | | /** |
| | | * è·åèµ°èªä»»å¡å¯¹åºçèå´å
çæ°æ® |
| | | * @param label æ¥å£æ ç¾ï¼è¡¨ææ¯åªä¸ªç¬¬ä¸æ¹æ°æ®æ¥å£ |
| | | * @param missionCode ä»»å¡ç¼å· |
| | | */ |
| | | fun fetchMissionData(label: String, missionCode: String): Boolean |
| | | |
| | | /** |
| | | * è·åè®¾å¤ææ°æ°æ® |
| | | * @param label æ¥å£æ ç¾ï¼è¡¨ææ¯åªä¸ªç¬¬ä¸æ¹æ°æ®æ¥å£ |
| | | * @param type 设å¤ç±»å |
| | | * @param deviceCode 设å¤ç¼å· |
| | | * @param startTime æ°æ®èµ·å§æ¶é´ |
| | | */ |
| | | fun fetchLatestData( |
| | | label: String, type: UWDeviceType, deviceCode: String, startTime: LocalDateTime?, endTime: LocalDateTime?, |
| | | ): Boolean |
| | | } |
| | |
| | | import com.github.pagehelper.PageHelper |
| | | import org.springframework.stereotype.Service |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.io.File |
| | | import java.util.* |
| | | import javax.servlet.http.HttpServletResponse |
| | | |
| | | @Service |
| | |
| | | return BaseResponse(true, head = DataHead(pageInfo.pageNum, pageInfo.pages),data = result) |
| | | } |
| | | |
| | | @Synchronized |
| | | override fun createMission(mission: Mission): BaseResponse<Boolean> { |
| | | missionMapper.selectByPrimaryKey(mission.missionCode)?.run { |
| | | return BaseResponse(false, "ä»»å¡ç¼å·å·²åå¨") |
| | |
| | | } |
| | | |
| | | override fun getReport(missionCode: String, response: HttpServletResponse) { |
| | | missionReport.execute(missionCode, FactorFilter.default()) |
| | | val path = missionReport.execute(missionCode, FactorFilter.default()) |
| | | val pathArr = path.split("/") |
| | | val file = File(path) |
| | | if (file.exists()) { |
| | | response.contentType = "application/vnd.ms-excel;charset=UTF-8" |
| | | val name = Base64.getEncoder().encodeToString(pathArr.last().toByteArray()) |
| | | response.setHeader("fileName", name) |
| | | response.outputStream.write(file.readBytes()) |
| | | } |
| | | return |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.lightshare.service.impl |
| | | |
| | | import com.flightfeather.uav.biz.datafetch.ShenXinDataFetch |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | import com.flightfeather.uav.lightshare.eunm.ThirdPartyLabel |
| | | import com.flightfeather.uav.lightshare.service.ThirdPartyService |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import org.springframework.stereotype.Service |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * |
| | | * @date 2024/8/26 |
| | | * @author feiyu02 |
| | | */ |
| | | @Service |
| | | class ThirdPartyServiceImpl(private val shenXinDataFetch: ShenXinDataFetch) : ThirdPartyService { |
| | | |
| | | override fun fetchMissionData(label: String, missionCode: String): Boolean { |
| | | when (label) { |
| | | ThirdPartyLabel.ShenXin.value -> { |
| | | shenXinDataFetch.fetchMissionData(missionCode) |
| | | return true |
| | | } |
| | | else -> throw BizException("ç¬¬ä¸æ¹æ¥å£æ è¯ä¸åå¨") |
| | | } |
| | | } |
| | | |
| | | override fun fetchLatestData( |
| | | label: String, type: UWDeviceType, deviceCode: String, startTime: LocalDateTime?, endTime: LocalDateTime?, |
| | | ): Boolean { |
| | | when (label) { |
| | | ThirdPartyLabel.ShenXin.value -> { |
| | | shenXinDataFetch.fetchLatestData(type, deviceCode, startTime, endTime) |
| | | return true |
| | | } |
| | | else -> throw BizException("ç¬¬ä¸æ¹æ¥å£æ è¯ä¸åå¨") |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.lightshare.web |
| | | |
| | | import com.fasterxml.jackson.annotation.JsonFormat |
| | | import com.flightfeather.uav.common.exception.BizException |
| | | import com.flightfeather.uav.lightshare.service.ThirdPartyService |
| | | import com.flightfeather.uav.socket.eunm.UWDeviceType |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import org.springframework.web.bind.annotation.GetMapping |
| | | import org.springframework.web.bind.annotation.RequestMapping |
| | | import org.springframework.web.bind.annotation.RequestParam |
| | | import org.springframework.web.bind.annotation.RestController |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * ç¬¬ä¸æ¹å¯¹æ¥ç¸å
³æ¥å£ï¼å
å« |
| | | * 1. ç³æ¬£ç¯ä¿èµ°èªæ°æ®ç¸å
³æ¥å£ |
| | | * @date 2024/8/26 |
| | | * @author feiyu02 |
| | | */ |
| | | @Api(tags = ["ç¬¬ä¸æ¹å¯¹æ¥ç¸å
³APIæ¥å£"]) |
| | | @RestController |
| | | @RequestMapping("air/thirdParty") |
| | | class ThirdPartyController(private val thirdPartyService: ThirdPartyService) { |
| | | |
| | | @ApiOperation(value = "æ ¹æ®ä»»å¡ä¿¡æ¯è·å对åºèå´å
çç¬¬ä¸æ¹èµ°èªæ°æ®") |
| | | @GetMapping("/data/fetch/mission") |
| | | fun fetchMissionData( |
| | | @RequestParam label: String, |
| | | @RequestParam missionCode: String, |
| | | ) = resPack { thirdPartyService.fetchMissionData(label, missionCode) } |
| | | |
| | | @ApiOperation(value = "è·å宿¶ææ°çç¬¬ä¸æ¹èµ°èªæ°æ®") |
| | | @GetMapping("/data/fetch/latest") |
| | | fun fetchLatestData( |
| | | @RequestParam label: String, |
| | | @RequestParam deviceType: String, |
| | | @RequestParam deviceCode: String, |
| | | @RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") startTime: LocalDateTime?, |
| | | @RequestParam(required = false) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") endTime: LocalDateTime?, |
| | | ) = resPack { |
| | | val type = UWDeviceType.fromValue(deviceType) ?: throw BizException("设å¤ç±»åä¸åå¨") |
| | | thirdPartyService.fetchLatestData(label, type, deviceCode, startTime, endTime) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.scheduler |
| | | |
| | | import org.slf4j.Logger |
| | | import org.slf4j.LoggerFactory |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.scheduling.annotation.Async |
| | | import org.springframework.scheduling.annotation.Scheduled |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDate |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * 宿¶ä»»å¡è°åº¦ |
| | | * ä¸ä¸ªcronè¡¨è¾¾å¼æè³å°6个ï¼ä¹å¯è½7ä¸ªï¼æç©ºæ ¼åéçæ¶é´å
ç´ ãæé¡ºåºä¾æ¬¡ä¸ºï¼ |
| | | * ç§ï¼0~59ï¼ |
| | | * åéï¼0~59ï¼ |
| | | * å°æ¶ï¼0~23ï¼ |
| | | * 天ï¼1~31ï¼ |
| | | * æï¼1~12ï¼ |
| | | * ææï¼1~7 1=SUN æ SUNï¼MONï¼TUEï¼WEDï¼THUï¼FRIï¼SATï¼ |
| | | */ |
| | | @Component |
| | | class ScheduleService( |
| | | @Value("\${mode}") |
| | | var mode: String, |
| | | ) { |
| | | val logger: Logger = LoggerFactory.getLogger(ScheduleService::class.java) |
| | | |
| | | // @Async |
| | | // @Scheduled(cron = "0 0 0 * * *") |
| | | fun eachDay() { |
| | | if (mode != "pro") return |
| | | logger.info("=====>>>>>æ¯æ¥ä»»å¡æ§è¡ {}", System.currentTimeMillis()) |
| | | |
| | | logger.info("=====>>>>>æ¯æ¥ä»»å¡ç»æ {}", System.currentTimeMillis()) |
| | | } |
| | | |
| | | // @Async |
| | | // @Scheduled(cron = "0 0 0 * * MON") |
| | | fun eachWeek() { |
| | | if (mode != "pro") return |
| | | logger.info("=====>>>>>æ¯å¨ä»»å¡æ§è¡ {}", System.currentTimeMillis()) |
| | | // æ§è¡ä¸å¨çèªè¯ä»»å¡ |
| | | |
| | | logger.info("=====>>>>>æ¯å¨ä»»å¡ç»æ {}", System.currentTimeMillis()) |
| | | } |
| | | |
| | | // @Async |
| | | // @Scheduled(cron = "0 0 0 1 * *") |
| | | fun eachStartOfMonth() { |
| | | if (mode != "pro") return |
| | | logger.info("=====>>>>>æ¯æ1å·ä»»å¡æ§è¡ {}", System.currentTimeMillis()) |
| | | |
| | | logger.info("=====>>>>>æ¯æ1å·ä»»å¡ç»æ {}", System.currentTimeMillis()) |
| | | } |
| | | |
| | | // @Async |
| | | // @Scheduled(cron = "0 0 0 2 * *") |
| | | fun eachMonth() { |
| | | if (mode != "pro") return |
| | | logger.info("=====>>>>>æ¯æ2å·ä»»å¡æ§è¡ {}", System.currentTimeMillis()) |
| | | |
| | | logger.info("=====>>>>>æ¯æ2å·ä»»å¡ç»æ {}", System.currentTimeMillis()) |
| | | } |
| | | } |
| | |
| | | /** |
| | | * æ ¹æ®è®¾å¤ç¼å·è·å设å¤ç±»å |
| | | */ |
| | | fun getType(deviceCode: String?): UWDeviceType? = when (deviceCode?.substring(0, 2)) { |
| | | fun getType(deviceCode: String?): UWDeviceType? = fromValue(deviceCode?.substring(0, 2)) |
| | | |
| | | fun fromValue(value: String?): UWDeviceType? = when (value) { |
| | | UAV.value -> UAV |
| | | VEHICLE.value -> VEHICLE |
| | | BOAT.value -> BOAT |
| | |
| | | |
| | | imgPath: target/ |
| | | filePath: target/ |
| | | mode: dev |
| | |
| | | spring: |
| | | datasource: |
| | | # çº¿ä¸æå¡å¨ 47 |
| | | 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 |
| | | |
| | | # çº¿ä¸æå¡å¨ 114 |
| | | # 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 |
| | | |
| | | # çº¿ä¸æå¡å¨ 114 |
| | | 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 |
| | | |
| | | springfox: |
| | | documentation: |
| | |
| | | |
| | | imgPath: D:/02product/10underway/images/ |
| | | filePath: D:/02product/10underway/files/ |
| | | mode: pro |
| | |
| | | # password: cn.FLIGHTFEATHER |
| | | |
| | | # è¿ç¨æå¡å¨ |
| | | 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://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | # 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: feiyu2024 |
| | | # password: eSoF8DnzfGTlhAjE |
| | | |
| | | url: jdbc:mysql://114.215.109.124:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false |
| | | username: remoteU1 |
| | | password: feiyu2024 |
| | | |
| | | springfox: |
| | | documentation: |
| | |
| | | |
| | | imgPath: C:/02product/10underway/images/ |
| | | filePath: C:/02product/10underway/files/ |
| | | mode: test |
| | |
| | | <!-- <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"/>--> |
| | | <!-- <table tableName="real_time_data_grid_opt" domainObjectName="RealTimeDataGridOpt" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="scene_info" domainObjectName="SceneInfo" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="segment_info" domainObjectName="SegmentInfo" enableCountByExample="false" |
| | | enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="segment_info" domainObjectName="SegmentInfo" enableCountByExample="false"--> |
| | | <!-- enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | </context> |
| | | </generatorConfiguration> |
| | |
| | | <result column="humidity" jdbcType="REAL" property="humidity" /> |
| | | <result column="VOC" jdbcType="REAL" property="voc" /> |
| | | <result column="NOI" jdbcType="REAL" property="noi" /> |
| | | <result column="NO" jdbcType="REAL" property="no" /> |
| | | <result column="velocity" jdbcType="REAL" property="velocity" /> |
| | | <result column="wind_speed" jdbcType="REAL" property="windSpeed" /> |
| | | <result column="wind_direction" jdbcType="REAL" property="windDirection" /> |
| | |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, device_code, latitude, longitude, altitude, data_time, create_time, NO2, CO, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, velocity, wind_speed, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, NO, velocity, wind_speed, |
| | | wind_directon, height |
| | | </sql> |
| | | </mapper> |
| | |
| | | <result column="humidity" jdbcType="REAL" property="humidity" /> |
| | | <result column="VOC" jdbcType="REAL" property="voc" /> |
| | | <result column="NOI" jdbcType="REAL" property="noi" /> |
| | | <result column="NO" jdbcType="REAL" property="no" /> |
| | | <result column="velocity" jdbcType="REAL" property="velocity" /> |
| | | <result column="wind_speed" jdbcType="REAL" property="windSpeed" /> |
| | | <result column="wind_direction" jdbcType="REAL" property="windDirection" /> |
| | |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, device_code, latitude, longitude, altitude, data_time, create_time, NO2, CO, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, velocity, wind_speed, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, NO, velocity, wind_speed, |
| | | wind_direction, height |
| | | </sql> |
| | | </mapper> |
| | |
| | | <result column="humidity" jdbcType="REAL" property="humidity" /> |
| | | <result column="VOC" jdbcType="REAL" property="voc" /> |
| | | <result column="NOI" jdbcType="REAL" property="noi" /> |
| | | <result column="NO" jdbcType="REAL" property="no" /> |
| | | <result column="velocity" jdbcType="REAL" property="velocity" /> |
| | | <result column="wind_speed" jdbcType="REAL" property="windSpeed" /> |
| | | <result column="wind_direction" jdbcType="REAL" property="windDirection" /> |
| | |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, device_code, latitude, longitude, altitude, data_time, create_time, NO2, CO, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, velocity, wind_speed, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, NO, velocity, wind_speed, |
| | | wind_direction, height |
| | | </sql> |
| | | </mapper> |
| | |
| | | <result column="humidity" jdbcType="REAL" property="humidity" /> |
| | | <result column="VOC" jdbcType="REAL" property="voc" /> |
| | | <result column="NOI" jdbcType="REAL" property="noi" /> |
| | | <result column="NO" jdbcType="REAL" property="no" /> |
| | | <result column="velocity" jdbcType="REAL" property="velocity" /> |
| | | <result column="wind_speed" jdbcType="REAL" property="windSpeed" /> |
| | | <result column="wind_direction" jdbcType="REAL" property="windDirection" /> |
| | |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, device_code, latitude, longitude, altitude, data_time, create_time, NO2, CO, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, velocity, wind_speed, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, NO, velocity, wind_speed, |
| | | wind_directon, height |
| | | </sql> |
| | | </mapper> |
| | |
| | | <result column="humidity" jdbcType="REAL" property="humidity" /> |
| | | <result column="VOC" jdbcType="REAL" property="voc" /> |
| | | <result column="NOI" jdbcType="REAL" property="noi" /> |
| | | <result column="NO" jdbcType="REAL" property="no" /> |
| | | <result column="velocity" jdbcType="REAL" property="velocity" /> |
| | | <result column="wind_speed" jdbcType="REAL" property="windSpeed" /> |
| | | <result column="wind_direction" jdbcType="REAL" property="windDirection" /> |
| | |
| | | WARNING - @mbg.generated |
| | | --> |
| | | id, device_code, latitude, longitude, altitude, data_time, create_time, NO2, CO, |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, velocity, wind_speed, |
| | | wind_directon, height |
| | | H2S, SO2, O3, PM25, PM10, temperature, humidity, VOC, NOI, NO, velocity, wind_speed, |
| | | wind_direction, height |
| | | </sql> |
| | | </mapper> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.flightfeather.uav.common.net |
| | | |
| | | import com.flightfeather.uav.domain.entity.Mission |
| | | import org.junit.Assert.* |
| | | import org.junit.Test |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | |
| | | class ShenXinServiceTest { |
| | | |
| | | @Test |
| | | fun fetchData() { |
| | | val mission = Mission().apply { |
| | | missionCode = "SHJA-20240813" |
| | | deviceType = "0a" |
| | | deviceCode = "TX105" |
| | | startTime = Date.from(LocalDateTime.of(2024, 8, 13, 11, 30, 0, 0).atZone(ZoneId.systemDefault()) |
| | | .toInstant()) |
| | | endTime = Date.from(LocalDateTime.of(2024, 8, 13, 17, 0, 0, 0).atZone(ZoneId.systemDefault()).toInstant()) |
| | | districtName = "éå®åº" |
| | | } |
| | | val date = LocalDateTime.of(2024, 8, 13, 15, 43, 0, 0) |
| | | val res = ShenXinService.fetchData(mission, date) |
| | | println(res) |
| | | } |
| | | } |
| | |
| | | |
| | | @Test |
| | | fun getReport() { |
| | | missionReport.execute("SH-CN-20240514", FactorFilter.default()) |
| | | missionReport.execute("SH-CN-20240723-01", FactorFilter.default()) |
| | | missionReport.execute("SH-CN-20240723-02", FactorFilter.default()) |
| | | } |
| | | } |