From c9bbee8bb47d6f383f9699b59c046ddc0cb464e9 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期三, 03 七月 2024 17:49:49 +0800
Subject: [PATCH] 1. 新增走航报告自动道路识别模块

---
 src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt |   26 +++++++++++++++++++++++++-
 1 files changed, 25 insertions(+), 1 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt
index f88d392..a7a0458 100644
--- a/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt
@@ -1,16 +1,26 @@
 package com.flightfeather.uav.lightshare.service.impl
 
+import com.flightfeather.uav.biz.FactorFilter
+import com.flightfeather.uav.biz.report.MissionReport
+import com.flightfeather.uav.common.exception.BizException
 import com.flightfeather.uav.domain.entity.Mission
+import com.flightfeather.uav.domain.entity.RealTimeDataVehicle
 import com.flightfeather.uav.domain.mapper.MissionMapper
+import com.flightfeather.uav.domain.mapper.RealTimeDataVehicleMapper
 import com.flightfeather.uav.lightshare.bean.BaseResponse
 import com.flightfeather.uav.lightshare.bean.DataHead
 import com.flightfeather.uav.lightshare.service.MissionService
 import com.github.pagehelper.PageHelper
 import org.springframework.stereotype.Service
 import tk.mybatis.mapper.entity.Example
+import javax.servlet.http.HttpServletResponse
 
 @Service
-class MissionServiceImpl(private val missionMapper: MissionMapper) : MissionService {
+class MissionServiceImpl(
+    private val missionMapper: MissionMapper,
+    private val realTimeDataVehicleMapper: RealTimeDataVehicleMapper,
+    private val missionReport: MissionReport,
+) : MissionService {
     override fun getMission(type: String?, page: Int?, perPage: Int?): BaseResponse<List<Mission>> {
         val _perPage = perPage ?: 60
         val _page = page ?: 1
@@ -39,4 +49,18 @@
             return BaseResponse(it == 1)
         }
     }
+
+    override fun deleteMissionAndData(missionCode: String): Boolean {
+        val mission = missionMapper.selectByPrimaryKey(missionCode) ?: throw BizException("浠诲姟涓嶅瓨鍦�")
+        missionMapper.deleteByPrimaryKey(missionCode)
+        realTimeDataVehicleMapper.deleteByExample(Example(RealTimeDataVehicle::class.java).apply {
+            createCriteria().andEqualTo("deviceCode", mission.deviceCode)
+                .andBetween("dataTime", mission.startTime, mission.endTime)
+        })
+        return true
+    }
+
+    override fun getReport(missionCode: String, response: HttpServletResponse) {
+        missionReport.execute(missionCode, FactorFilter.default())
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3