|
|
@@ -5,10 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.tuoheng.admin.entity.domain.ThMission; |
|
|
|
import com.tuoheng.admin.enums.MarkTypeEnum; |
|
|
|
import com.tuoheng.admin.enums.TaskStatusEnum; |
|
|
|
import com.tuoheng.admin.enums.UpdateOrCreateEnum; |
|
|
|
import com.tuoheng.admin.mapper.ThMissionMapper; |
|
|
|
import com.tuoheng.admin.service.IMissionService; |
|
|
|
import com.tuoheng.admin.service.IThInspectionService; |
|
|
|
import com.tuoheng.common.utils.JsonResult; |
|
|
|
import com.tuoheng.common.utils.StringUtils; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.scheduling.annotation.Scheduled; |
|
|
@@ -47,14 +49,23 @@ public class ScheduledTask { |
|
|
|
|
|
|
|
log.info("执行定时执行飞行任务,一秒钟一次"); |
|
|
|
|
|
|
|
for (ThMission thMission : thMissions) { |
|
|
|
log.info("执行定时执行飞行任务:" + thMission.getId()); |
|
|
|
JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); |
|
|
|
thMission.setExecutionStatus(2); |
|
|
|
if(jsonResult.getCode()!=0 && ObjectUtil.isEmpty(jsonResult.getData())){ |
|
|
|
thMission.setStatus(TaskStatusEnum.FAIL.getCode()); |
|
|
|
if(StringUtils.isNotEmpty(thMissions)){ |
|
|
|
for (ThMission thMission : thMissions) { |
|
|
|
log.info("执行定时执行飞行任务:" + thMission.getId()); |
|
|
|
JsonResult jsonResult = inspectionService.executeTask(String.valueOf(thMission.getId()), null); |
|
|
|
log.info("执行定时执行飞行任务result:" + jsonResult); |
|
|
|
thMission.setExecutionStatus(2); |
|
|
|
|
|
|
|
ThMission thMissionUpdate = new ThMission(UpdateOrCreateEnum.UPDATE.getCode()); |
|
|
|
thMissionUpdate.setId(thMission.getId()); |
|
|
|
thMissionUpdate.setExecutionStatus(2); |
|
|
|
if(jsonResult.getCode()!=0 && ObjectUtil.isEmpty(jsonResult.getData())){ |
|
|
|
thMission.setStatus(TaskStatusEnum.FAIL.getCode()); |
|
|
|
} |
|
|
|
missionMapper.updateById(thMissionUpdate); |
|
|
|
} |
|
|
|
missionMapper.updateById(thMission); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |