src/main/kotlin/com/flightfeather/uav/domain/entity/CompanyDevice.java
@@ -15,6 +15,36 @@ private String cdDeviceCode; /** * 设å¤ç±»åï¼0ï¼äº§çº¿ï¼1ï¼åå */ @Column(name = "CD_Type") private Integer cdType; /** * 设å¤ç±»ååç§° */ @Column(name = "CD_Type_Name") private String cdTypeName; /** * 设å¤çµæµçéå¼ï¼éç¨â;âåéä¸åçé */ @Column(name = "CD_Limits") private String cdLimits; /** * 设å¤çµæµä¸åçéä¸å¯¹åºçç¶æç¼å· */ @Column(name = "CD_Status") private String cdStatus; /** * 设å¤çµæµä¸åçéä¸å¯¹åºçç¶æåç§° */ @Column(name = "CD_Status_Name") private String cdStatusName; /** * @return CD_Id */ public Integer getCdId() { @@ -55,4 +85,94 @@ public void setCdDeviceCode(String cdDeviceCode) { this.cdDeviceCode = cdDeviceCode == null ? null : cdDeviceCode.trim(); } /** * è·å设å¤ç±»åï¼0ï¼äº§çº¿ï¼1ï¼åå * * @return CD_Type - 设å¤ç±»åï¼0ï¼äº§çº¿ï¼1ï¼åå */ public Integer getCdType() { return cdType; } /** * 设置设å¤ç±»åï¼0ï¼äº§çº¿ï¼1ï¼åå * * @param cdType 设å¤ç±»åï¼0ï¼äº§çº¿ï¼1ï¼åå */ public void setCdType(Integer cdType) { this.cdType = cdType; } /** * è·å设å¤ç±»ååç§° * * @return CD_Type_Name - 设å¤ç±»ååç§° */ public String getCdTypeName() { return cdTypeName; } /** * 设置设å¤ç±»ååç§° * * @param cdTypeName 设å¤ç±»ååç§° */ public void setCdTypeName(String cdTypeName) { this.cdTypeName = cdTypeName == null ? null : cdTypeName.trim(); } /** * è·å设å¤çµæµçéå¼ï¼éç¨â;âåéä¸åçé * * @return CD_Limits - 设å¤çµæµçéå¼ï¼éç¨â;âåéä¸åçé */ public String getCdLimits() { return cdLimits; } /** * 设置设å¤çµæµçéå¼ï¼éç¨â;âåéä¸åçé * * @param cdLimits 设å¤çµæµçéå¼ï¼éç¨â;âåéä¸åçé */ public void setCdLimits(String cdLimits) { this.cdLimits = cdLimits == null ? null : cdLimits.trim(); } /** * è·å设å¤çµæµä¸åçéä¸å¯¹åºçç¶æç¼å· * * @return CD_Status - 设å¤çµæµä¸åçéä¸å¯¹åºçç¶æç¼å· */ public String getCdStatus() { return cdStatus; } /** * 设置设å¤çµæµä¸åçéä¸å¯¹åºçç¶æç¼å· * * @param cdStatus 设å¤çµæµä¸åçéä¸å¯¹åºçç¶æç¼å· */ public void setCdStatus(String cdStatus) { this.cdStatus = cdStatus == null ? null : cdStatus.trim(); } /** * è·å设å¤çµæµä¸åçéä¸å¯¹åºçç¶æåç§° * * @return CD_Status_Name - 设å¤çµæµä¸åçéä¸å¯¹åºçç¶æåç§° */ public String getCdStatusName() { return cdStatusName; } /** * 设置设å¤çµæµä¸åçéä¸å¯¹åºçç¶æåç§° * * @param cdStatusName 设å¤çµæµä¸åçéä¸å¯¹åºçç¶æåç§° */ public void setCdStatusName(String cdStatusName) { this.cdStatusName = cdStatusName == null ? null : cdStatusName.trim(); } } src/main/kotlin/com/flightfeather/uav/lightshare/bean/ElectricVo.kt
@@ -7,9 +7,11 @@ var d1eB: Double = .0, var d1eC: Double = .0, var d1Status: String? = "0", var d1StatusName: String? = null, //åºæ°ååè£ ç½® var d2eA: Double = .0, var d2eB: Double = .0, var d2eC: Double = .0, var d2Status: String? = "0" var d2Status: String? = "0", var d2StatusName: String? = null ) src/main/kotlin/com/flightfeather/uav/lightshare/eunm/CarStatus.kt
ÎļþÒÑɾ³ý src/main/kotlin/com/flightfeather/uav/lightshare/eunm/CarType.kt
ÎļþÒÑɾ³ý src/main/kotlin/com/flightfeather/uav/lightshare/eunm/ElectricityType.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,12 @@ package com.flightfeather.uav.lightshare.eunm /** * @author riku * Date: 2019/9/26 */ enum class ElectricityType(val value: Int){ //äº§çº¿è®¾å¤ ProductionLine(0), //ååè®¾å¤ Purify(1) } src/main/kotlin/com/flightfeather/uav/lightshare/service/RealTimeDataService.kt
@@ -30,4 +30,9 @@ * åå¼è®¡ç®ï¼å°ç§çº§å¼æ¢ç®ä¸ºåéåå¼ */ fun averageData(): BaseResponse<String> /** * æ°æ®ä¼åï¼å¨æ°æ®é¢å¤çåºç¡ä¸åè¿ä¸æ¥æ°æ®ä¼å */ fun dataCalibration(): BaseResponse<String> } src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/ElectricityServiceImpl.kt
@@ -10,6 +10,7 @@ import com.flightfeather.uav.lightshare.bean.DataHead import com.flightfeather.uav.lightshare.bean.DataVo import com.flightfeather.uav.lightshare.bean.ElectricVo import com.flightfeather.uav.lightshare.eunm.ElectricityType import com.flightfeather.uav.lightshare.service.ElectricityService import com.flightfeather.uav.socket.bean.AirData import com.github.pagehelper.PageHelper @@ -102,22 +103,21 @@ createCriteria().andEqualTo("cdCompanyId", cId) }) //äº§çº¿é£æº var d1: String? = null var d1: CompanyDevice? = null //åºæ°ååè£ ç½® var d2: String? = null var d2: CompanyDevice? = null deviceCodeList.forEach { // FIXME: 2021/11/5 æ¤å¤ææ¶åæ»ï¼åç»ä¿®æ¹ if (it?.cdDeviceCode == "31011020210602" || it?.cdDeviceCode == "31011020210603") { d1 = it.cdDeviceCode }else if (it?.cdDeviceCode == "31011020210601" || it?.cdDeviceCode == "31011020210604") { d2 = it.cdDeviceCode if (it?.cdType == ElectricityType.ProductionLine.value) { d1 = it }else if (it?.cdType == ElectricityType.Purify.value) { d2 = it } } var pageInfo = PageHelper.startPage<ElectricMinuteValue>(p, perP) val dataList1 = electricMinuteValueMapper.selectByExample(Example(ElectricMinuteValue::class.java).apply { createCriteria().andEqualTo("mvStatCode", d1) createCriteria().andEqualTo("mvStatCode", d1?.cdDeviceCode) .apply { sTime?.let { andGreaterThanOrEqualTo("mvDataTime", it) } eTime?.let { andLessThanOrEqualTo("mvDataTime", it) } @@ -134,7 +134,7 @@ } pageInfo = PageHelper.startPage<ElectricMinuteValue>(p, perP) val dataList2 = electricMinuteValueMapper.selectByExample(Example(ElectricMinuteValue::class.java).apply { createCriteria().andEqualTo("mvStatCode", d2) createCriteria().andEqualTo("mvStatCode", d2?.cdDeviceCode) .apply { sTime?.let { andGreaterThanOrEqualTo("mvDataTime", it) } eTime?.let { andLessThanOrEqualTo("mvDataTime", it) } @@ -192,7 +192,9 @@ d1eA = d?.mvElectricityA ?: .0 d1eB = d?.mvElectricityB ?: .0 d1eC = d?.mvElectricityC ?: .0 d1Status = getStatus(d) val s = getStatus(d, d1) d1Status = s.first d1StatusName = s.second } dataList1.removeAt(0) } @@ -205,7 +207,9 @@ d2eA = d?.mvElectricityA ?: .0 d2eB = d?.mvElectricityB ?: .0 d2eC = d?.mvElectricityC ?: .0 d2Status = getStatus(d) val s = getStatus(d, d2) d2Status = s.first d2StatusName = s.second } dataList2.removeAt(0) } @@ -220,30 +224,21 @@ } // FIXME: 2021/11/5 æ¤å¤ææ¶åæ»ï¼åç»ä¿®æ¹ private fun getStatus(e: ElectricMinuteValue?): String { var values = listOf(1, 100) var status = listOf("0", "2", "3") private fun getStatus(e: ElectricMinuteValue?, d: CompanyDevice?): Pair<String, String> { var values = mutableListOf<Int>().apply { d?.cdLimits?.split(";")?.forEach { it.toIntOrNull()?.let { i -> add(i) } } } var status = d?.cdStatus?.split(";") ?: emptyList() var statusNames = d?.cdStatusName?.split(";") ?: emptyList() if (values.isEmpty()) values = mutableListOf(1, 100) if (status.isEmpty()) status = listOf("0", "2", "3") if (statusNames.isEmpty()) statusNames = listOf("å¾ æº", "è¿è¡", "è¶ è´è·") if (e == null) { return status.first() return Pair(status.first(), statusNames.first()) } when (e.mvStatCode) { "31011020210601" -> { values = listOf(1, 100) status = listOf("0", "2", "3") } "31011020210602" -> { values = listOf(13, 30) status = listOf("0", "2", "3") } "31011020210603" -> { values = listOf(1, 50, 80) status = listOf("0", "1", "2", "3") } "31011020210604" -> { values = listOf(15, 90, 125) status = listOf("0", "1", "2", "3") } } val electricityList = mutableListOf<Double>() electricityList.add(e.mvElectricityA) electricityList.add(e.mvElectricityB) @@ -252,9 +247,9 @@ val avg = electricityList.average() for (i in values.indices) { if (avg < values[i]) { return status[i] return Pair(status[i], statusNames[i]) } } return status.last() return Pair(status.last(), statusNames.last()) } } src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
@@ -317,4 +317,8 @@ return BaseResponse(count > 0, data = "æå ¥æ°æ®: ${count}æ¡") } override fun dataCalibration(): BaseResponse<String> { return BaseResponse(true) } } src/main/kotlin/com/flightfeather/uav/repository/impl/AirDataRepositoryImpl.kt
@@ -172,29 +172,29 @@ dataTransform(vo, d) /**************************************************************************/ // FIXME: 2021/11/8 é对åå²ç½æ ¼ååå§æ°æ®ï¼è¿è¡ä¸´æ¶æ ¡åå¤ç val dTime = LocalDateTime.ofInstant(d.dataTime?.toInstant(), ZoneId.systemDefault()) // CO: 2021.8.28 17:27èµ· *0.25 val coTime = LocalDateTime.of(2021, 8, 28, 17, 27, 0) if (dTime.isAfter(coTime)) { d.co = d.co?.times(0.25f) } // NO2 d.no2 = d.no2?.times(0.6f) // O3 d.o3 = abs(d.o3?.minus(d.no2?.div(2) ?: 0f) ?: 0f) * 1.5f // SO2: *0.2, 2021.8.29 6:00èµ· *0.08 val so2Time = LocalDateTime.of(2021, 8, 29, 6, 0, 0) d.so2 = if (dTime.isAfter(so2Time)) { d.so2?.times(0.08f) } else { d.so2?.times(0.2f) } // H2S d.h2s = d.h2s?.let { sqrt(it) * 2 } // val dTime = LocalDateTime.ofInstant(d.dataTime?.toInstant(), ZoneId.systemDefault()) // // CO: 2021.8.28 17:27èµ· *0.25 // val coTime = LocalDateTime.of(2021, 8, 28, 17, 27, 0) // if (dTime.isAfter(coTime)) { // d.co = d.co?.times(0.25f) // } // // // NO2 // d.no2 = d.no2?.times(0.6f) // // // O3 // d.o3 = abs(d.o3?.minus(d.no2?.div(2) ?: 0f) ?: 0f) * 1.5f // // // SO2: *0.2, 2021.8.29 6:00èµ· *0.08 // val so2Time = LocalDateTime.of(2021, 8, 29, 6, 0, 0) // d.so2 = if (dTime.isAfter(so2Time)) { // d.so2?.times(0.08f) // } else { // d.so2?.times(0.2f) // } // // // H2S // d.h2s = d.h2s?.let { sqrt(it) * 2 } /**************************************************************************/ realTimeDataGridMapper.insert(d) count++ src/main/resources/application.yml
@@ -7,9 +7,9 @@ # 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 @@ -17,9 +17,9 @@ # 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 src/main/resources/generator/generatorConfig.xml
@@ -48,7 +48,7 @@ <!-- <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="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="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"/>--> @@ -56,6 +56,6 @@ <!-- <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_min" domainObjectName="RealTimeDataGridMin" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> </context> </generatorConfiguration> src/main/resources/mapper/CompanyDeviceMapper.xml
@@ -8,11 +8,17 @@ <id column="CD_Id" jdbcType="INTEGER" property="cdId" /> <result column="CD_Company_Id" jdbcType="VARCHAR" property="cdCompanyId" /> <result column="CD_Device_Code" jdbcType="VARCHAR" property="cdDeviceCode" /> <result column="CD_Type" jdbcType="INTEGER" property="cdType" /> <result column="CD_Type_Name" jdbcType="VARCHAR" property="cdTypeName" /> <result column="CD_Limits" jdbcType="VARCHAR" property="cdLimits" /> <result column="CD_Status" jdbcType="VARCHAR" property="cdStatus" /> <result column="CD_Status_Name" jdbcType="VARCHAR" property="cdStatusName" /> </resultMap> <sql id="Base_Column_List"> <!-- WARNING - @mbg.generated --> CD_Id, CD_Company_Id, CD_Device_Code CD_Id, CD_Company_Id, CD_Device_Code, CD_Type, CD_Type_Name, CD_Limits, CD_Status, CD_Status_Name </sql> </mapper>