|
@ -17,6 +17,7 @@ import org.dromara.common.redis.utils.RedisOpsUtils; |
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
import org.dromara.common.satoken.utils.LoginHelper; |
|
|
|
|
|
|
|
|
import org.dromara.common.sdk.cloudapi.wayline.*; |
|
|
import org.dromara.common.sdk.cloudapi.wayline.*; |
|
|
|
|
|
import org.dromara.common.sdk.common.HttpResultResponse; |
|
|
import org.dromara.sample.fegin.RemoteBusinessTaskFeign; |
|
|
import org.dromara.sample.fegin.RemoteBusinessTaskFeign; |
|
|
import org.dromara.sample.manage.mapper.IDeviceQrtzDateMapper; |
|
|
import org.dromara.sample.manage.mapper.IDeviceQrtzDateMapper; |
|
|
import org.dromara.sample.manage.mapper.IDeviceQrtzFileMapper; |
|
|
import org.dromara.sample.manage.mapper.IDeviceQrtzFileMapper; |
|
@ -51,6 +52,8 @@ import java.time.format.DateTimeFormatter; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.ExecutorService; |
|
|
import java.util.concurrent.ExecutorService; |
|
|
import java.util.concurrent.Executors; |
|
|
import java.util.concurrent.Executors; |
|
|
|
|
|
import java.util.concurrent.locks.Lock; |
|
|
|
|
|
import java.util.concurrent.locks.ReentrantLock; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @auther yq |
|
|
* @auther yq |
|
@ -70,8 +73,9 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
private IWaylineFileMapper waylineFileMapper; |
|
|
private IWaylineFileMapper waylineFileMapper; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private IFlightTaskService flightTaskService; |
|
|
private IFlightTaskService flightTaskService; |
|
|
// @DubboReference
|
|
|
|
|
|
// private RemoteBusinessTaskService remoteBusinessTaskService;
|
|
|
Lock lock = new ReentrantLock(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private ExecutorService executor = Executors.newFixedThreadPool(5); |
|
|
private ExecutorService executor = Executors.newFixedThreadPool(5); |
|
|
|
|
|
|
|
@ -285,10 +289,7 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
RedisOpsUtils.setWithExpire(device.getDeviceSn(), device, 180); |
|
|
RedisOpsUtils.setWithExpire(device.getDeviceSn(), device, 180); |
|
|
executor.execute(new Runnable() { |
|
|
|
|
|
@Override |
|
|
|
|
|
public void run() { |
|
|
|
|
|
try { |
|
|
|
|
|
// 获取当前日期
|
|
|
// 获取当前日期
|
|
|
LocalDateTime currentDate = LocalDateTime.now(); |
|
|
LocalDateTime currentDate = LocalDateTime.now(); |
|
|
// 定义日期格式
|
|
|
// 定义日期格式
|
|
@ -328,7 +329,14 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
createJobParam.setWaylinePrecisionType(WaylinePrecisionTypeEnum.RTK); |
|
|
createJobParam.setWaylinePrecisionType(WaylinePrecisionTypeEnum.RTK); |
|
|
createJobParam.setOutOfControlAction(OutOfControlActionEnum.RETURN_TO_HOME); |
|
|
createJobParam.setOutOfControlAction(OutOfControlActionEnum.RETURN_TO_HOME); |
|
|
createJobParam.setRthAltitude(120); |
|
|
createJobParam.setRthAltitude(120); |
|
|
flightTaskService.publishFlightTask(device.getWorkspaceId(), createJobParam,deviceQrtzFileEntity.getNickName()); |
|
|
HttpResultResponse httpResultResponse = flightTaskService.publishFlightTask(device.getWorkspaceId(), createJobParam, deviceQrtzFileEntity.getNickName()); |
|
|
|
|
|
if(httpResultResponse.getCode() == 0){ |
|
|
|
|
|
deviceQrtzFileEntity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_2); |
|
|
|
|
|
deviceQrtzFileMapper.updateById(deviceQrtzFileEntity); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
deviceQrtzFileEntity.setStatus(DeviceQrtzConstants.QRTZ_FILE_STATUS_0); |
|
|
|
|
|
deviceQrtzFileMapper.updateById(deviceQrtzFileEntity); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
e.printStackTrace(); |
|
|
e.printStackTrace(); |
|
|
} |
|
|
} |
|
@ -338,10 +346,6 @@ public class DeviceQrtzServiceImpl implements IDeviceQrtzService { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} catch (Exception e) { |
|
|
|
|
|
throw new RuntimeException(e); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|