|
|
@ -1,5 +1,8 @@ |
|
|
|
package org.dromara.sample.wayline.service.impl; |
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import org.dromara.common.core.constant.DeviceQrtzConstants; |
|
|
|
import org.dromara.common.sdk.cloudapi.wayline.*; |
|
|
|
import org.dromara.common.sdk.cloudapi.wayline.api.AbstractWaylineService; |
|
|
|
import org.dromara.common.sdk.mqtt.MqttReply; |
|
|
@ -11,7 +14,9 @@ import org.dromara.common.sdk.mqtt.requests.TopicRequestsResponse; |
|
|
|
import org.dromara.common.websocket.dto.BizCodeEnum; |
|
|
|
import org.dromara.sample.common.error.CommonErrorEnum; |
|
|
|
import org.dromara.sample.component.mqtt.model.EventsReceiver; |
|
|
|
import org.dromara.sample.manage.mapper.IDeviceQrtzFileMapper; |
|
|
|
import org.dromara.sample.manage.model.dto.DeviceDTO; |
|
|
|
import org.dromara.sample.manage.model.entity.DeviceQrtzFileEntity; |
|
|
|
import org.dromara.sample.manage.model.enums.UserTypeEnum; |
|
|
|
import org.dromara.sample.manage.service.IDeviceRedisService; |
|
|
|
import org.dromara.sample.media.model.MediaFileCountDTO; |
|
|
@ -31,7 +36,9 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.net.URL; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.Wrapper; |
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Optional; |
|
|
|
|
|
|
@ -58,7 +65,8 @@ public class SDKWaylineService extends AbstractWaylineService { |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IWaylineFileService waylineFileService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IDeviceQrtzFileMapper deviceQrtzFileMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IWebSocketMessageService webSocketMessageService; |
|
|
@ -105,9 +113,28 @@ public class SDKWaylineService extends AbstractWaylineService { |
|
|
|
.jobId(response.getBid()).mediaCount(job.getMediaCount()).uploadedCount(0).fileId(job.getFileId()).build()); |
|
|
|
} |
|
|
|
|
|
|
|
LambdaQueryWrapper<DeviceQrtzFileEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
wrapper.eq(DeviceQrtzFileEntity::getWaylineId,job.getFileId()).eq(DeviceQrtzFileEntity::getStatus, DeviceQrtzConstants.QRTZ_FILE_STATUS_1).eq(DeviceQrtzFileEntity::getDeviceSn,job.getDockSn()); |
|
|
|
List<DeviceQrtzFileEntity> fileEntityList = deviceQrtzFileMapper.selectList(wrapper); |
|
|
|
if (FlighttaskStatusEnum.OK != statusEnum) { |
|
|
|
job.setCode(eventsReceiver.getResult().getCode()); |
|
|
|
job.setStatus(WaylineJobStatusEnum.FAILED.getVal()); |
|
|
|
|
|
|
|
//异常
|
|
|
|
if(!fileEntityList.isEmpty()){ |
|
|
|
fileEntityList.forEach(f->{ |
|
|
|
f.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_0); |
|
|
|
}); |
|
|
|
deviceQrtzFileMapper.updateById(fileEntityList); |
|
|
|
} |
|
|
|
}else if(FlighttaskStatusEnum.OK == statusEnum){ |
|
|
|
//正常
|
|
|
|
if(!fileEntityList.isEmpty()){ |
|
|
|
fileEntityList.forEach(f->{ |
|
|
|
f.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_3); |
|
|
|
}); |
|
|
|
deviceQrtzFileMapper.updateById(fileEntityList); |
|
|
|
} |
|
|
|
} |
|
|
|
waylineJobService.updateJob(job); |
|
|
|
waylineRedisService.delRunningWaylineJob(response.getGateway()); |
|
|
|