| | |
| | | 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 |
| | |
| | | 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 |
| | |
| | | */ |
| | | 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 |
| | | } |
| | | } |
| | |
| | | * 数据异常所在时段的折线图 |
| | | */ |
| | | class ExceptionChart : ExceptionResult() { |
| | | // 数据折线图Base64编码 |
| | | var pict: String? = null |
| | | // 污染因子的异常数据折线图Base64编码 |
| | | var mainPict: String? = null |
| | | |
| | | // 关联因子的异常数据折线图Base64编码 |
| | | var subPictList: List<String>? = null |
| | | } |
| | | |
| | | private val templateName = "report-underway.ftl" |
| | |
| | | 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 |
| | | }) |
| | | } |