Commit b9172825 by gdj

修改临时任务保存路径。

parent 2e57dafa
......@@ -25,6 +25,12 @@ public class TakeoffToPointRequest extends BaseModel {
@NotNull
private String flightId;
private String flightName;
private String dockSn;
private String dockNickName;
private String orgId;
@Min(-180)
......@@ -119,6 +125,32 @@ public class TakeoffToPointRequest extends BaseModel {
return this;
}
public String getFlightName() {
return flightName;
}
public TakeoffToPointRequest setFlightName(String flightName) {
this.flightName = flightName;
return this;
}
public String getDockSn() {
return dockSn;
}
public TakeoffToPointRequest setDockSn(String dockSn) {
this.dockSn = dockSn;
return this;
}
public String getDockNickName() {
return dockNickName;
}
public TakeoffToPointRequest setDockNickName(String dockNickName) {
this.dockNickName = dockNickName;
return this;
}
public String getOrgId() {
return orgId;
}
......
......@@ -37,6 +37,8 @@ import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.Objects;
import java.util.Optional;
import java.util.UUID;
......@@ -195,6 +197,19 @@ public class ControlServiceImpl implements IControlService {
param.setFlightId(UUID.randomUUID().toString());
TakeoffToPointRequest takeoffToPointRequest = mapper.convertValue(param, TakeoffToPointRequest.class);
takeoffToPointRequest.setOrgId(SecurityUtils.getOrgId());
// 名字
Optional<DeviceDTO> dockOpt = deviceRedisService.getDeviceOnline(sn);
DeviceDTO dockDTO = new DeviceDTO();
if (dockOpt.isPresent()) {
dockDTO = dockOpt.get();
}
String dockNickName = dockDTO.getNickname();
takeoffToPointRequest.setDockSn(sn);
takeoffToPointRequest.setDockNickName(dockNickName);
String timeStr = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
String flightName = dockNickName + "_" + timeStr;
takeoffToPointRequest.setFlightName(flightName);
RedisOpsUtils.setWithExpire("templateTask:"+param.getFlightId(), takeoffToPointRequest, 24*60*60);
TopicServicesResponse<ServicesReplyData> response = abstractControlService.takeoffToPoint(
......
......@@ -182,11 +182,15 @@ public class MediaServiceImpl extends AbstractMediaService implements IMediaServ
String orgId = takeoffToPointRequest.getOrgId();
String prePath = OssConfiguration.objectDirPrefix + "/" + device.getWorkspaceId() + "/" + orgId + "/" + takeoffToPointRequest.getDockNickName() + "/临时任务";
if (path.contains(OssConfiguration.objectDirPrefix + "/" + device.getWorkspaceId())) {
path = path.replace(OssConfiguration.objectDirPrefix + "/" + device.getWorkspaceId(), OssConfiguration.objectDirPrefix + "/" + device.getWorkspaceId() + "/" + orgId + "/临时任务");
path = path.replace(OssConfiguration.objectDirPrefix + "/" + device.getWorkspaceId(), prePath);
} else {
path = path.replace(OssConfiguration.objectDirPrefix, OssConfiguration.objectDirPrefix + "/" + device.getWorkspaceId() + "/" + orgId + "/临时任务");
path = path.replace(OssConfiguration.objectDirPrefix, prePath);
}
// 过滤变更名字
path = path.replace(callback.getFile().getExt().getFlightId(), takeoffToPointRequest.getFlightName());
String moveFilePath = path;
file.setPath(path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment