From 01eae19a4870033e879a3faa6749eece92926cab Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 26 一月 2024 17:10:55 +0800
Subject: [PATCH] 1. 新增多项yml配置文件 2. 新增导入静安监测数据功能模块(未完成)
---
src/main/kotlin/com/flightfeather/uav/lightshare/bean/ElectricDailyInfo.kt | 2
src/main/kotlin/com/flightfeather/uav/common/utils/ExcelUtil.kt | 123 ++++++++++++++------
src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt | 7 +
src/main/kotlin/com/flightfeather/uav/common/utils/FileExchange.kt | 62 ++++++++++
src/main/kotlin/com/flightfeather/uav/lightshare/service/RealTimeDataService.kt | 2
src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt | 3
src/main/resources/application-pro.yml | 7 +
src/main/resources/application-test.yml | 20 +++
pom.xml | 24 ++++
src/main/kotlin/com/flightfeather/uav/lightshare/web/BaseResPack.kt | 27 ++++
src/test/kotlin/com/flightfeather/uav/Test.kt | 9
src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt | 2
src/main/kotlin/com/flightfeather/uav/common/exception/ResponseErrorException.kt | 13 ++
src/main/resources/application-dev.yml | 7 +
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt | 4
src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt | 6
src/main/resources/application.yml | 27 ----
17 files changed, 269 insertions(+), 76 deletions(-)
diff --git a/pom.xml b/pom.xml
index 11f104f..6634aee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -260,6 +260,30 @@
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>dev</id>
+ <properties>
+ <profileActive>dev</profileActive>
+ </properties>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ </profile>
+ <profile>
+ <id>pro</id>
+ <properties>
+ <profileActive>pro</profileActive>
+ </properties>
+ </profile>
+ <profile>
+ <id>test</id>
+ <properties>
+ <profileActive>test</profileActive>
+ </properties>
+ </profile>
+ </profiles>
+
<!--渚濊禆涓嬭浇鍦板潃-->
<repositories>
<repository>
diff --git a/src/main/kotlin/com/flightfeather/uav/common/exception/ResponseErrorException.kt b/src/main/kotlin/com/flightfeather/uav/common/exception/ResponseErrorException.kt
new file mode 100644
index 0000000..bf8dd9e
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/common/exception/ResponseErrorException.kt
@@ -0,0 +1,13 @@
+package com.flightfeather.uav.common.exception
+
+/**
+ * 鍏佽鎺ュ彛杩斿洖鐨勪笟鍔″眰闈㈢殑閿欒
+ */
+class ResponseErrorException : Exception {
+ constructor():super()
+ constructor(message: String) : super(message)
+ constructor(message: String, cause: Throwable) : super(message, cause)
+ constructor(cause: Throwable) : super(cause)
+ constructor(message: String, cause: Throwable, enableSuppression: Boolean, writableStackTrace: Boolean)
+ : super(message, cause, enableSuppression, writableStackTrace)
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/common/utils/ExcelUtil.kt b/src/main/kotlin/com/flightfeather/uav/common/utils/ExcelUtil.kt
index 0eb806e..5d2a37b 100644
--- a/src/main/kotlin/com/flightfeather/uav/common/utils/ExcelUtil.kt
+++ b/src/main/kotlin/com/flightfeather/uav/common/utils/ExcelUtil.kt
@@ -1,8 +1,16 @@
package com.flightfeather.uav.common.utils
-import org.apache.poi.hssf.usermodel.HSSFWorkbook
+import com.flightfeather.uav.common.exception.ResponseErrorException
+import org.apache.poi.ss.usermodel.Row
import org.apache.poi.ss.util.CellRangeAddress
import org.apache.poi.xssf.streaming.SXSSFWorkbook
+import org.apache.poi.xssf.usermodel.XSSFRow
+import org.apache.poi.xssf.usermodel.XSSFWorkbook
+import org.jetbrains.kotlin.incremental.isJavaFile
+import java.io.ByteArrayInputStream
+import java.io.File
+import java.io.FileInputStream
+import java.io.InputStream
import java.time.LocalDate
import java.util.*
import kotlin.math.max
@@ -16,16 +24,44 @@
private const val isLog = false
class MyCell(
- var text: String,
- var rowSpan: Int = 1,
- var colSpan: Int = 1,
- var fontColor: Short? = null
+ var text: String,
+ var rowSpan: Int = 1,
+ var colSpan: Int = 1,
+ var fontColor: Short? = null,
)
+
+ /**
+ * 璇诲彇鏂囦欢
+ * @param file 瑕佽鍙栫殑鏂囦欢
+ * @param headerCheck 鏂囦欢棣栬妫�鏌ュ洖璋�
+ * @param onRow 鍗曡鍐呭鍥炶皟锛屼粠绗簩琛屽紑濮�
+ */
+ fun read(file: File, headerCheck: (header: XSSFRow) -> Boolean, onRow: (row: Row) -> Unit): Boolean {
+ if (!file.exists() || !file.isFile) throw ResponseErrorException("it's not a normal file!")
+ if (!file.extension.equals("xls", ignoreCase = true) || !file.extension.equals("xlsx", ignoreCase = true)) {
+ throw ResponseErrorException("file's extension name should be xls or xlsx!")
+ }
+ return read(FileInputStream(file), headerCheck, onRow)
+ }
+
+ fun read(input: InputStream, headerCheck: (header: XSSFRow) -> Boolean, onRow: (row: Row) -> Unit): Boolean {
+ val workbook = XSSFWorkbook(input)
+ val sheet1 = workbook.getSheetAt(0)
+ val header = sheet1.getRow(sheet1.topRow.toInt())
+ return if (headerCheck(header)) {
+ // 鑾峰彇杩唬鍣ㄥ苟鍘婚櫎绗竴琛屾爣棰�
+ val iterator = sheet1.rowIterator().also { it.next() }
+ iterator.forEach { onRow(it) }
+ true
+ } else {
+ false
+ }
+ }
/**
* 鑷姩澶勭悊琛屽悎骞舵暟鎹�
*/
- fun write2(heads: List<String>, contents: List<Array<Any>>, workbook: SXSSFWorkbook, sheetName:String) {
+ fun write2(heads: List<String>, contents: List<Array<Any>>, workbook: SXSSFWorkbook, sheetName: String) {
val sheet = workbook.createSheet(sheetName)
@@ -52,31 +88,31 @@
var rowspan = maxRow//鍚堝苟鐨勮鐨勮法搴�
val c =
- if (cell is Array<*>) {
- //褰撴暟鎹负鏁扮粍鏃讹紝闇�瑕佹牴鎹渶澶ц鏁伴噸鏂拌绠楄鍗曞厓鏍肩殑琛岃法搴�
- arrayMap[i] = cell
- rowspan = maxRow / if (cell.size == 0) 1 else cell.size
- val c = cell[0]
- if (c is MyCell) {
- rowspan = c.rowSpan
- }
- if (rowspan > 1) {
- log("鍚堝苟1-1锛�$rowIndex;${rowIndex + rowspan - 1};$i")
- sheet.addMergedRegion(CellRangeAddress(rowIndex, rowIndex + rowspan - 1, i, i))
- }
- if (cell.isEmpty()) {
- ""
- } else {
- cell[0]
- }
- } else {
- //褰撴暟鎹笉鏄暟缁勬椂锛岄渶瑕佹寜鏈�澶ц鏁板悎骞跺崟鍏冩牸
- if (rowspan > 1) {
- log("鍚堝苟1-2锛�$rowIndex;${rowIndex + rowspan - 1};$i")
- sheet.addMergedRegion(CellRangeAddress(rowIndex, rowIndex + rowspan - 1, i, i))
- }
- cell
+ if (cell is Array<*>) {
+ //褰撴暟鎹负鏁扮粍鏃讹紝闇�瑕佹牴鎹渶澶ц鏁伴噸鏂拌绠楄鍗曞厓鏍肩殑琛岃法搴�
+ arrayMap[i] = cell
+ rowspan = maxRow / if (cell.size == 0) 1 else cell.size
+ val c = cell[0]
+ if (c is MyCell) {
+ rowspan = c.rowSpan
}
+ if (rowspan > 1) {
+ log("鍚堝苟1-1锛�$rowIndex;${rowIndex + rowspan - 1};$i")
+ sheet.addMergedRegion(CellRangeAddress(rowIndex, rowIndex + rowspan - 1, i, i))
+ }
+ if (cell.isEmpty()) {
+ ""
+ } else {
+ cell[0]
+ }
+ } else {
+ //褰撴暟鎹笉鏄暟缁勬椂锛岄渶瑕佹寜鏈�澶ц鏁板悎骞跺崟鍏冩牸
+ if (rowspan > 1) {
+ log("鍚堝苟1-2锛�$rowIndex;${rowIndex + rowspan - 1};$i")
+ sheet.addMergedRegion(CellRangeAddress(rowIndex, rowIndex + rowspan - 1, i, i))
+ }
+ cell
+ }
when (c) {
is MyCell -> {
rows.createCell(i).setCellValue(c.text)
@@ -107,7 +143,7 @@
if (c is MyCell) {
rowspan = c.rowSpan
}
- val _c = array[i-1]
+ val _c = array[i - 1]
if (_c is MyCell) {
lastRowSpan = _c.rowSpan
}
@@ -153,9 +189,15 @@
/**
* 鑷姩澶勭悊琛屽悎骞舵暟鎹�
*/
- fun write(heads: List<Array<String>>, contents: List<Array<Any>>, workbook: SXSSFWorkbook, sheetName: String = "sheet1", row: Int = 0): Int {
+ fun write(
+ heads: List<Array<String>>,
+ contents: List<Array<Any>>,
+ workbook: SXSSFWorkbook,
+ sheetName: String = "sheet1",
+ row: Int = 0,
+ ): Int {
- val sheet = workbook.getSheet(sheetName)?: workbook.createSheet(sheetName)
+ val sheet = workbook.getSheet(sheetName) ?: workbook.createSheet(sheetName)
// println("sheet: $sheetName")
var rowIndex = row
@@ -195,7 +237,10 @@
}
if (rowspan > 1 || colSpan > 1) {
log("鍚堝苟1-1锛�$rowIndex;${rowIndex + rowspan - 1};$col")
- sheet.addMergedRegion(CellRangeAddress(rowIndex, rowIndex + rowspan - 1, col, col + colSpan - 1))
+ sheet.addMergedRegion(CellRangeAddress(rowIndex,
+ rowIndex + rowspan - 1,
+ col,
+ col + colSpan - 1))
}
if (cell.isEmpty()) {
""
@@ -210,7 +255,10 @@
}
if (rowspan > 1 || colSpan > 1) {
log("鍚堝苟1-2锛�$rowIndex;${rowIndex + rowspan - 1};$col")
- sheet.addMergedRegion(CellRangeAddress(rowIndex, rowIndex + rowspan - 1, col, col + colSpan - 1))
+ sheet.addMergedRegion(CellRangeAddress(rowIndex,
+ rowIndex + rowspan - 1,
+ col,
+ col + colSpan - 1))
}
cell
}
@@ -272,7 +320,10 @@
}
if (rowspan > 1 || colSpan > 1) {
log("鍚堝苟2锛�${index};${index + rowspan - 1};${map.key}")
- sheet.addMergedRegion(CellRangeAddress(index, index + rowspan - 1, map.key, map.key + colSpan - 1))
+ sheet.addMergedRegion(CellRangeAddress(index,
+ index + rowspan - 1,
+ map.key,
+ map.key + colSpan - 1))
}
when (c) {
diff --git a/src/main/kotlin/com/flightfeather/uav/common/utils/FileExchange.kt b/src/main/kotlin/com/flightfeather/uav/common/utils/FileExchange.kt
index 380b3dd..efc4c36 100644
--- a/src/main/kotlin/com/flightfeather/uav/common/utils/FileExchange.kt
+++ b/src/main/kotlin/com/flightfeather/uav/common/utils/FileExchange.kt
@@ -1,6 +1,7 @@
package com.flightfeather.uav.common.utils
import com.alibaba.fastjson.JSONObject
+import com.flightfeather.uav.common.exception.ResponseErrorException
import com.flightfeather.uav.domain.entity.RealTimeData
import com.flightfeather.uav.socket.bean.AirData
import org.apache.poi.hssf.usermodel.HSSFWorkbook
@@ -13,7 +14,7 @@
import java.util.*
/**
- * 鏃犱汉鑸归噰闆嗘暟鎹牸寮忚浆鎹�
+ * 閲囬泦鏁版嵁鏍煎紡杞崲
*/
class FileExchange {
@@ -27,6 +28,55 @@
private val format = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
}
+ fun exchangeJinanData(file: File) {
+ val headers = listOf(
+ "longitude",
+ "latitude",
+ "data_time",
+ "NO2",
+ "CO",
+ "H2S",
+ "SO2",
+ "O3",
+ "PM25",
+ "PM10",
+ "temperature",
+ "humidity",
+ "VOC",
+ "NOI",
+ "velocity",
+ "wind_speed",
+ "wind_direction"
+ )
+ try {
+ ExcelUtil.read(file, headerCheck = {
+ val cellIterator = it.cellIterator()
+ val headIterator = headers.iterator()
+ while (headIterator.hasNext()) {
+ val head = headIterator.next()
+ if (cellIterator.hasNext()) {
+ val cellText = cellIterator.next().stringCellValue
+ if (!cellText.equals(head)) {
+ throw ResponseErrorException("鏂囦欢鏍煎紡閿欒, 琛ㄥご[${head}]搴旇涓篬${cellText}]")
+ }
+ } else {
+ throw ResponseErrorException("鏂囦欢鏍煎紡閿欒, 琛ㄥご[${head}]缂哄け")
+ }
+ }
+ true
+ }, onRow = {
+ it.cellIterator().forEach {
+ it.numericCellValue
+ }
+ })
+ } catch (e: Exception) {
+ throw ResponseErrorException("excel鏂囦欢鍐呭閿欒锛屾暟鎹浆鎹㈠け璐ワ紒", e)
+ }
+ }
+
+ /**
+ * 杞崲鏃犱汉鑸圭殑姘磋川鐩戞祴鏁版嵁
+ */
fun exchangeBoatData(deviceCode: String, file: InputStream): List<RealTimeData> {
val workbook = HSSFWorkbook(file)
val sheet = workbook.getSheetAt(0)
@@ -205,7 +255,15 @@
val filePath = "e:/$fileName"
val out = FileOutputStream(File(filePath))
- val heads = listOf("id", "device_code", "latitude", "longitude", "altitude", "height", "factors", "data_time", "create_time")
+ val heads = listOf("id",
+ "device_code",
+ "latitude",
+ "longitude",
+ "altitude",
+ "height",
+ "factors",
+ "data_time",
+ "create_time")
val contents = mutableListOf<Array<Any>>()
for (i in 1..sheet.lastRowNum) {
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ElectricDailyInfo.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ElectricDailyInfo.kt
index 665551a..720c349 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ElectricDailyInfo.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/bean/ElectricDailyInfo.kt
@@ -200,8 +200,8 @@
fun getResult() {
// 鐢ㄧ數閲�
plPower = round(plPower * 100) / 100
- pfPower = round(pfPower * 100) / 100
+ pfPower = round(pfPower * 100) / 100
// 寮�鍏虫椂闂存牸寮忓寲
plRTimeStr = DateUtil.instance.dateToString(plRTime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS)
plETimeStr = DateUtil.instance.dateToString(plETime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_SS)
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/RealTimeDataService.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/RealTimeDataService.kt
index 07ab15e..a9627b1 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/RealTimeDataService.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/RealTimeDataService.kt
@@ -16,6 +16,8 @@
fun importData(file: MultipartFile): BaseResponse<DataImportResult>
+ fun importJinanData(file: MultipartFile): BaseResponse<DataImportResult>
+
fun outToWorkbook(deviceCode: String, startTime: String, endTime: String): SXSSFWorkbook
fun outToExcel(deviceCode: String, startTime: String, endTime: String, response: HttpServletResponse): HttpServletResponse
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
index 5264b8e..54815f4 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/RealTimeDataServiceImpl.kt
@@ -173,6 +173,10 @@
return BaseResponse(true, data = DataImportResult(""))
}
+ override fun importJinanData(file: MultipartFile): BaseResponse<DataImportResult> {
+ TODO("Not yet implemented")
+ }
+
override fun outToWorkbook(deviceCode: String, startTime: String, endTime: String): SXSSFWorkbook {
val sTime = dateFormatter.parse(startTime)
val eTime = dateFormatter.parse(endTime)
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/BaseResPack.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/BaseResPack.kt
new file mode 100644
index 0000000..c0fb761
--- /dev/null
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/BaseResPack.kt
@@ -0,0 +1,27 @@
+package com.flightfeather.uav.lightshare.web
+
+import com.flightfeather.uav.common.exception.ResponseErrorException
+import com.flightfeather.uav.lightshare.bean.BaseResponse
+import com.flightfeather.uav.lightshare.bean.DataHead
+
+
+/**
+ * 鍖呰鎺ュ彛杩斿洖缁撴灉
+ */
+fun resPack(service: () -> Any?): BaseResponse<Any> {
+ return try {
+ val res = service()
+ if (res is Pair<*, *>) {
+ val head = res.first
+ if (head is DataHead) {
+ BaseResponse(true, head = head, data = res.second)
+ } else {
+ BaseResponse(true, data = res)
+ }
+ } else {
+ BaseResponse(true, data = res)
+ }
+ } catch (e: ResponseErrorException) {
+ BaseResponse(false, message = e.message ?: "")
+ }
+}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt
index def38ec..6831444 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/web/RealTimeDataController.kt
@@ -2,6 +2,7 @@
import com.flightfeather.uav.lightshare.service.RealTimeDataService
import io.swagger.annotations.Api
+import io.swagger.annotations.ApiOperation
import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
import org.springframework.web.multipart.MultipartFile
@@ -33,4 +34,10 @@
fun importData(
@RequestPart("excel") file: MultipartFile
) = realTimeDataService.importData(file)
+
+ @ApiOperation(value = "瀵煎叆闈欏畨鍖虹敓鎬佺幆澧冪洃娴嬬珯鐨勮蛋琛屾暟鎹�")
+ @PostMapping("/import/jinan")
+ fun importJinanData(
+ @RequestPart("excel") file: MultipartFile
+ ) = realTimeDataService.importJinanData(file)
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
index 3539828..2af8a49 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/epw/EPWDataPrep.kt
@@ -36,7 +36,7 @@
val range = FactorType.getRange(a.factorName) ?: return@v
// 鍒ゆ柇鏁版嵁鏄惁鍦ㄥ悎鐞嗚寖鍥村唴
- if (a.factorData ?: 0.0 < range.first || a.factorData ?: 0.0 > range.second) {
+ if (a.factorData != null && (a.factorData!! < range.first || a.factorData!! > range.second)) {
a.factorData = null
}
}
@@ -165,7 +165,7 @@
if (lastData.isNotEmpty() && newList.isNotEmpty()) {
val lastTime = DateUtil.instance.StringToDate(lastData.last().time)
val thisTime = DateUtil.instance.StringToDate(newList.first().time)
- if (thisTime?.time?.minus(lastTime?.time ?: 0) ?: 0 >= (60 * 1000)) {
+ if ((thisTime?.time?.minus(lastTime?.time ?: 0) ?: 0) >= (60 * 1000)) {
lastData.clear()
}
}
@@ -225,7 +225,7 @@
val f = it.values?.get(i)
if (f?.factorName == factorName) {
val range = FactorType.getRange(f?.factorName) ?: continue
- if (f?.factorData ?: 0.0 in range.first..range.second) {
+ if ((f?.factorData ?: 0.0) in range.first..range.second) {
t += (f?.factorData!! - avg) * (f.factorData!! - avg)
c++
}
diff --git a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt
index 927fae2..7074a30 100644
--- a/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt
+++ b/src/main/kotlin/com/flightfeather/uav/model/epw/WindDirWeight.kt
@@ -32,14 +32,13 @@
private fun getAngle(p1: Pair<Double, Double>, p2: Pair<Double, Double>, wd: Double): Double {
val dx = p2.first - p1.first
val dy = p2.second - p1.second
- var x1 = atan2(dy, dx) * 180 / PI
+ var x1 = atan2(dy, dx) * 180 / PI + 180
if (x1 < 0) x1 += 360
var x2 = 270 - wd
if (x2 < 0) x2 += 360
x1 = abs(x2 - x1)
if (x1 > 180) x1 = 360 - x1
// println("澶硅锛�$x1")
- x1 = 180 - x1
return x1
}
}
\ No newline at end of file
diff --git a/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt b/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt
index 4d5f655..7476e3e 100644
--- a/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt
+++ b/src/main/kotlin/com/flightfeather/uav/socket/processor/ElectricProcessor.kt
@@ -41,7 +41,7 @@
}
private fun saveToDataBase(message: BaseMessage, msg: String) {
- if (message is ElectricMessage) {
+ if (message is ElectricMessage && message.mn.isNotBlank()) {
instance.electricRepository.saveData(message)
}
}
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index f03bef2..91a47b7 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -1,3 +1,10 @@
+spring:
+ datasource:
+ # 寮�鍙戞湰鍦版湇鍔″櫒
+ url: jdbc:mysql://localhost:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ username: root
+ password: 123456
+
springfox:
documentation:
swagger:
diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml
index 135277d..a5210a8 100644
--- a/src/main/resources/application-pro.yml
+++ b/src/main/resources/application-pro.yml
@@ -1,3 +1,10 @@
+spring:
+ datasource:
+ # 绾夸笂鏈嶅姟鍣�
+ 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:
swagger:
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
new file mode 100644
index 0000000..373ebee
--- /dev/null
+++ b/src/main/resources/application-test.yml
@@ -0,0 +1,20 @@
+spring:
+ datasource:
+ driver-class-name: com.mysql.cj.jdbc.Driver
+ # 灞�鍩熺綉鏈嶅姟鍣�
+ # url: jdbc:mysql://192.168.0.200:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+ # username: root
+ # 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
+
+springfox:
+ documentation:
+ swagger:
+ v2:
+ enabled: true
+
+
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 1087cd6..e105607 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -1,25 +1,6 @@
spring:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
-# 灞�鍩熺綉鏈嶅姟鍣�
-# url: jdbc:mysql://192.168.0.200:3306/dronemonitor?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-# username: root
-# 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: root
-# 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
hikari:
maximum-pool-size: 500
minimum-idle: 20
@@ -52,10 +33,4 @@
helperDialect: mysql
reasonable: true
supportMethodsArguments: true
- params: count=countSql
-
-springfox:
- documentation:
- swagger:
- v2:
- enabled: false
\ No newline at end of file
+ params: count=countSql
\ No newline at end of file
diff --git a/src/test/kotlin/com/flightfeather/uav/Test.kt b/src/test/kotlin/com/flightfeather/uav/Test.kt
index 85e68a9..7cd72a9 100644
--- a/src/test/kotlin/com/flightfeather/uav/Test.kt
+++ b/src/test/kotlin/com/flightfeather/uav/Test.kt
@@ -118,11 +118,10 @@
@Test
fun foo16() {
- val l = mutableListOf<BigDecimal>().apply {
- add(BigDecimal.valueOf(6.23))
- add(BigDecimal("6.23"))
- add(BigDecimal(6.23))
+ val list = listOf(1, 2, 3, 4, 5, 6)
+ val iterator = list.iterator().also { it.next() }
+ iterator.forEach {
+ println(it)
}
- l.forEach { println(it) }
}
}
\ No newline at end of file
--
Gitblit v1.9.3