From d2d71a6bc8e445ee60b7be2667676138e277d676 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 28 六月 2024 17:41:08 +0800
Subject: [PATCH] 1. 修改走航报告自动输出模块

---
 src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt |   28 ++++++++++++++++++++--------
 1 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
index ccc8b72..62bbcf6 100644
--- a/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
+++ b/src/main/kotlin/com/flightfeather/uav/biz/report/MissionReport.kt
@@ -4,7 +4,6 @@
 import com.flightfeather.uav.biz.dataanalysis.ExceptionAnalysisController
 import com.flightfeather.uav.biz.dataanalysis.model.ExceptionResult
 import com.flightfeather.uav.biz.dataprocess.PreData
-import com.flightfeather.uav.common.chart.ChartUtil
 import com.flightfeather.uav.common.chart.DataToChartUtil
 import com.flightfeather.uav.common.exception.BizException
 import com.flightfeather.uav.common.pdf.GeneratePdfUtil
@@ -13,7 +12,6 @@
 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.FactorType
 import org.springframework.beans.BeanUtils
 import org.springframework.beans.factory.annotation.Value
 import org.springframework.stereotype.Component
@@ -55,11 +53,22 @@
          */
         fun addExceptions(exceptions: List<ExceptionResult>) {
             this.exceptions = exceptions.map {
-                val byteArray = DataToChartUtil.lineToByteArray(it.selectedFactor, it.dataList)
-                val base64Str = ImageUtil.compressImage2(byteArray, 400, needPrefix = false)
                 val c = ExceptionChart()
                 BeanUtils.copyProperties(it, c)
-                c.pict = base64Str
+                // 鍒涘缓涓绘薄鏌撳洜瀛愮殑鏁版嵁鎶樼嚎鍥�
+                val byteArray = DataToChartUtil.lineToByteArray(it.selectedFactor?.main, it.dataList)
+                val base64Str = ImageUtil.compressImage2(byteArray, 800, needPrefix = false)
+                c.mainPict = base64Str
+                // 鍒涘缓鍏宠仈鍥犲瓙鐨勬暟鎹姌绾垮浘
+                if (it.selectedFactor?.subs?.isNotEmpty() == true) {
+                    val subList = mutableListOf<String>()
+                    it.selectedFactor!!.subs.forEach { type ->
+                        val byteArray1 = DataToChartUtil.lineToByteArray(type, it.dataList)
+                        val base64Str1 = ImageUtil.compressImage2(byteArray1, 800, needPrefix = false)
+                        subList.add(base64Str1)
+                    }
+                    c.subPictList = subList
+                }
                 return@map c
             }
         }
@@ -83,8 +92,11 @@
      * 鏁版嵁寮傚父鎵�鍦ㄦ椂娈电殑鎶樼嚎鍥�
      */
     class ExceptionChart : ExceptionResult() {
-        // 鏁版嵁鎶樼嚎鍥綛ase64缂栫爜
-        var pict: String? = null
+        // 姹℃煋鍥犲瓙鐨勫紓甯告暟鎹姌绾垮浘Base64缂栫爜
+        var mainPict: String? = null
+
+        // 鍏宠仈鍥犲瓙鐨勫紓甯告暟鎹姌绾垮浘Base64缂栫爜
+        var subPictList: List<String>? = null
     }
 
     private val templateName = "report-underway.ftl"
@@ -118,7 +130,7 @@
                 max = u.max
 
                 val byteArray = DataToChartUtil.lineToByteArray(t, realTimeData)
-                val base64Str = ImageUtil.compressImage2(byteArray, 400, needPrefix = false)
+                val base64Str = ImageUtil.compressImage2(byteArray, 800, needPrefix = false)
                 pict = base64Str
             })
         }

--
Gitblit v1.9.3