feiyu02
2024-06-27 e8f935a01d75c89ac591a80b9318eac2480e2dcd
src/main/kotlin/com/flightfeather/uav/lightshare/service/impl/MissionServiceImpl.kt
@@ -1,6 +1,8 @@
package com.flightfeather.uav.lightshare.service.impl
import com.flightfeather.uav.common.exception.ResponseErrorException
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
@@ -11,11 +13,13 @@
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,
    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
@@ -47,7 +51,7 @@
    }
    override fun deleteMissionAndData(missionCode: String): Boolean {
        val mission = missionMapper.selectByPrimaryKey(missionCode) ?: throw ResponseErrorException("任务不存在")
        val mission = missionMapper.selectByPrimaryKey(missionCode) ?: throw BizException("任务不存在")
        missionMapper.deleteByPrimaryKey(missionCode)
        realTimeDataVehicleMapper.deleteByExample(Example(RealTimeDataVehicle::class.java).apply {
            createCriteria().andEqualTo("deviceCode", mission.deviceCode)
@@ -55,4 +59,8 @@
        })
        return true
    }
    override fun getReport(missionCode: String, response: HttpServletResponse) {
        missionReport.execute(missionCode, FactorFilter.default())
    }
}