服务指令资源同步
This commit is contained in:
parent
05c000f53d
commit
be5cc5f120
|
|
@ -150,4 +150,6 @@ public class DirectiveAsyncMQDto implements Serializable {
|
||||||
private String bodyTagsObj;
|
private String bodyTagsObj;
|
||||||
//情绪标签json字符串(有id、label)
|
//情绪标签json字符串(有id、label)
|
||||||
private String emotionTagsObj;
|
private String emotionTagsObj;
|
||||||
|
//资源请求接口域名+项目上下文路径
|
||||||
|
private String api;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,4 +28,6 @@ public class DirectiveMQDto {
|
||||||
private List<BodyTagMQDto> bodyTagList;
|
private List<BodyTagMQDto> bodyTagList;
|
||||||
//情绪标签字典项
|
//情绪标签字典项
|
||||||
private List<EmotionTagMQDto> emotionTagList;
|
private List<EmotionTagMQDto> emotionTagList;
|
||||||
|
//是否同步指令资源
|
||||||
|
private boolean izSyncMedia;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,6 +86,142 @@ public class DirectiveMQListener {
|
||||||
dto.setIdStr(dto.getDirectiveList().stream().map(d -> d.getId()).collect(Collectors.joining(",")));
|
dto.setIdStr(dto.getDirectiveList().stream().map(d -> d.getId()).collect(Collectors.joining(",")));
|
||||||
//增量处理
|
//增量处理
|
||||||
handleIncremental(dto);
|
handleIncremental(dto);
|
||||||
|
handleCreateMedia(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拉取指令资源
|
||||||
|
*
|
||||||
|
* @param mqDto
|
||||||
|
*/
|
||||||
|
@RabbitListener(
|
||||||
|
bindings = @QueueBinding(
|
||||||
|
value = @Queue(name = "#{directiveAsyncDQNP.getCreateMediaQueueName()}"),
|
||||||
|
exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
||||||
|
key = "#{directiveAsyncDQNP.getCreateMediaKeyName()}"
|
||||||
|
),
|
||||||
|
errorHandler = "directiveMQErrorHandler"
|
||||||
|
)
|
||||||
|
public void handleCreateMedia(DirectiveMQDto mqDto) {
|
||||||
|
mqDto.getDirectiveList().stream().forEach(dto -> {
|
||||||
|
//查询现有服务指令
|
||||||
|
QueryWrapper<ConfigServiceDirective> qw = new QueryWrapper<>();
|
||||||
|
qw.eq("id", dto.getId());
|
||||||
|
ConfigServiceDirective currentDirective = directiveService.getOne(qw);
|
||||||
|
|
||||||
|
//更新服务指令媒体资源字段
|
||||||
|
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||||
|
configServiceDirective.setId(dto.getId());
|
||||||
|
configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
|
||||||
|
|
||||||
|
//拉取媒体资源至本地目录
|
||||||
|
{
|
||||||
|
//接口协议域名+上下文访问路径
|
||||||
|
String baseUrl = dto.getApi();
|
||||||
|
|
||||||
|
//处理服务指令图片
|
||||||
|
if (!dto.getPreviewFileMd5().equals(currentDirective.getPreviewFileMd5())) {
|
||||||
|
String previewFile = dto.getPreviewFile();
|
||||||
|
if (StringUtils.isNotBlank(previewFile)) {
|
||||||
|
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
|
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
|
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
|
}
|
||||||
|
String filePath = previewFile.substring(0, previewFile.lastIndexOf("/"));
|
||||||
|
String fileName = previewFile.substring(previewFile.lastIndexOf("/") + 1);
|
||||||
|
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
|
filePath = filePath.substring(1);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
|
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
|
||||||
|
configServiceDirective.setPreviewFileMd5(dto.getPreviewFileMd5());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
|
mediaAsyncErrorLog.setMediaid(previewFile);
|
||||||
|
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理即时指令图标
|
||||||
|
if (!dto.getImmediateFileMd5().equals(currentDirective.getImmediateFileMd5())) {
|
||||||
|
String immediateFile = dto.getImmediateFile();
|
||||||
|
if (StringUtils.isNotBlank(immediateFile)) {
|
||||||
|
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
|
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
|
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
|
}
|
||||||
|
String filePath = immediateFile.substring(0, immediateFile.lastIndexOf("/"));
|
||||||
|
String fileName = immediateFile.substring(immediateFile.lastIndexOf("/") + 1);
|
||||||
|
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
|
filePath = filePath.substring(1);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
|
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
|
||||||
|
configServiceDirective.setImmediateFileMd5(dto.getImmediateFileMd5());
|
||||||
|
} catch (Exception e) {
|
||||||
|
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
|
mediaAsyncErrorLog.setMediaid(immediateFile);
|
||||||
|
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理指令音频文件
|
||||||
|
if (!dto.getMp3FileMd5().equals(currentDirective.getMp3FileMd5())) {
|
||||||
|
String mp3File = dto.getMp3File();
|
||||||
|
if (StringUtils.isNotBlank(mp3File)) {
|
||||||
|
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp3File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
|
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
|
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
|
}
|
||||||
|
String filePath = mp3File.substring(0, mp3File.lastIndexOf("/"));
|
||||||
|
String fileName = mp3File.substring(mp3File.lastIndexOf("/") + 1);
|
||||||
|
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
|
filePath = filePath.substring(1);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
|
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
|
||||||
|
configServiceDirective.setMp3FileMd5(dto.getMp3FileMd5());
|
||||||
|
} catch (Exception e) {
|
||||||
|
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
|
mediaAsyncErrorLog.setMediaid(mp3File);
|
||||||
|
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//处理指令视频文件
|
||||||
|
if (!dto.getMp4FileMd5().equals(currentDirective.getMp4FileMd5())) {
|
||||||
|
String mp4File = dto.getMp4File();
|
||||||
|
if (StringUtils.isNotBlank(mp4File)) {
|
||||||
|
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp4File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
|
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
|
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
|
}
|
||||||
|
String filePath = mp4File.substring(0, mp4File.lastIndexOf("/"));
|
||||||
|
String fileName = mp4File.substring(mp4File.lastIndexOf("/") + 1);
|
||||||
|
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
|
filePath = filePath.substring(1);
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
|
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
|
||||||
|
configServiceDirective.setMp4FileMd5(dto.getMp4FileMd5());
|
||||||
|
} catch (Exception e) {
|
||||||
|
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
|
mediaAsyncErrorLog.setMediaid(mp4File);
|
||||||
|
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
directiveService.updateById(configServiceDirective);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
// @RabbitListener(
|
// @RabbitListener(
|
||||||
// bindings = @QueueBinding(
|
// bindings = @QueueBinding(
|
||||||
|
|
@ -105,127 +241,127 @@ public class DirectiveMQListener {
|
||||||
// directiveService.updateById(configServiceDirective);
|
// directiveService.updateById(configServiceDirective);
|
||||||
// }
|
// }
|
||||||
//
|
//
|
||||||
@RabbitListener(
|
// @RabbitListener(
|
||||||
bindings = @QueueBinding(
|
// bindings = @QueueBinding(
|
||||||
value = @Queue(name = "#{directiveAsyncDQNP.getCreateMediaQueueName()}"),
|
// value = @Queue(name = "#{directiveAsyncDQNP.getCreateMediaQueueName()}"),
|
||||||
exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
// exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
||||||
key = "#{directiveAsyncDQNP.getCreateMediaKeyName()}"
|
// key = "#{directiveAsyncDQNP.getCreateMediaKeyName()}"
|
||||||
),
|
// ),
|
||||||
errorHandler = "directiveMQErrorHandler"
|
// errorHandler = "directiveMQErrorHandler"
|
||||||
)
|
// )
|
||||||
public void handleCreateMedia(DirectiveAsyncMQDto dto) {
|
// public void handleCreateMedia(DirectiveAsyncMQDto dto) {
|
||||||
//更新服务指令媒体资源字段
|
// //更新服务指令媒体资源字段
|
||||||
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
// ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||||
configServiceDirective.setId(dto.getId());
|
// configServiceDirective.setId(dto.getId());
|
||||||
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
|
// configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
|
||||||
configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
|
// configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
|
||||||
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
|
// configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
|
||||||
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
|
// configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
|
||||||
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
|
// configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
|
||||||
directiveService.updateById(configServiceDirective);
|
// directiveService.updateById(configServiceDirective);
|
||||||
|
//
|
||||||
//拉取媒体资源至本地目录
|
// //拉取媒体资源至本地目录
|
||||||
{
|
// {
|
||||||
LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
|
// LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
|
||||||
qw.eq(SysConfig::getDelFlag, "0");
|
// qw.eq(SysConfig::getDelFlag, "0");
|
||||||
qw.eq(SysConfig::getConfigKey, "ope_open_url");
|
// qw.eq(SysConfig::getConfigKey, "ope_open_url");
|
||||||
SysConfig urlObj = sysConfigService.getOne(qw);
|
// SysConfig urlObj = sysConfigService.getOne(qw);
|
||||||
//试验田协议+域名(/ip+端口)
|
// //试验田协议+域名(/ip+端口)
|
||||||
String baseUrl = urlObj.getConfigValue();
|
// String baseUrl = urlObj.getConfigValue();
|
||||||
if (baseUrl.endsWith("/")) {
|
// if (baseUrl.endsWith("/")) {
|
||||||
baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
|
// baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
//处理服务指令图片
|
// //处理服务指令图片
|
||||||
String previewFile = dto.getPreviewFile();
|
// String previewFile = dto.getPreviewFile();
|
||||||
if (StringUtils.isNotBlank(previewFile)) {
|
// if (StringUtils.isNotBlank(previewFile)) {
|
||||||
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(previewFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
}
|
// }
|
||||||
String filePath = previewFile.substring(0, previewFile.lastIndexOf("/"));
|
// String filePath = previewFile.substring(0, previewFile.lastIndexOf("/"));
|
||||||
String fileName = previewFile.substring(previewFile.lastIndexOf("/") + 1);
|
// String fileName = previewFile.substring(previewFile.lastIndexOf("/") + 1);
|
||||||
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
filePath = filePath.substring(1);
|
// filePath = filePath.substring(1);
|
||||||
}
|
// }
|
||||||
try {
|
// try {
|
||||||
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
mediaAsyncErrorLog.setMediaid(previewFile);
|
// mediaAsyncErrorLog.setMediaid(previewFile);
|
||||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//处理即时指令图标
|
// //处理即时指令图标
|
||||||
String immediateFile = dto.getImmediateFile();
|
// String immediateFile = dto.getImmediateFile();
|
||||||
if (StringUtils.isNotBlank(immediateFile)) {
|
// if (StringUtils.isNotBlank(immediateFile)) {
|
||||||
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(immediateFile, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
}
|
// }
|
||||||
String filePath = immediateFile.substring(0, immediateFile.lastIndexOf("/"));
|
// String filePath = immediateFile.substring(0, immediateFile.lastIndexOf("/"));
|
||||||
String fileName = immediateFile.substring(immediateFile.lastIndexOf("/") + 1);
|
// String fileName = immediateFile.substring(immediateFile.lastIndexOf("/") + 1);
|
||||||
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
filePath = filePath.substring(1);
|
// filePath = filePath.substring(1);
|
||||||
}
|
// }
|
||||||
try {
|
// try {
|
||||||
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
mediaAsyncErrorLog.setMediaid(immediateFile);
|
// mediaAsyncErrorLog.setMediaid(immediateFile);
|
||||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//处理指令音频文件
|
// //处理指令音频文件
|
||||||
String mp3File = dto.getMp3File();
|
// String mp3File = dto.getMp3File();
|
||||||
if (StringUtils.isNotBlank(mp3File)) {
|
// if (StringUtils.isNotBlank(mp3File)) {
|
||||||
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp3File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp3File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
}
|
// }
|
||||||
String filePath = mp3File.substring(0, mp3File.lastIndexOf("/"));
|
// String filePath = mp3File.substring(0, mp3File.lastIndexOf("/"));
|
||||||
String fileName = mp3File.substring(mp3File.lastIndexOf("/") + 1);
|
// String fileName = mp3File.substring(mp3File.lastIndexOf("/") + 1);
|
||||||
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
filePath = filePath.substring(1);
|
// filePath = filePath.substring(1);
|
||||||
}
|
// }
|
||||||
try {
|
// try {
|
||||||
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
mediaAsyncErrorLog.setMediaid(mp3File);
|
// mediaAsyncErrorLog.setMediaid(mp3File);
|
||||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
//处理指令视频文件
|
// //处理指令视频文件
|
||||||
String mp4File = dto.getMp4File();
|
// String mp4File = dto.getMp4File();
|
||||||
if (StringUtils.isNotBlank(mp4File)) {
|
// if (StringUtils.isNotBlank(mp4File)) {
|
||||||
String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp4File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
// String url = baseUrl + "/sys/common/open/static/" + URLEncoder.encode(mp4File, StandardCharsets.UTF_8).replace("%2F", "/") + "?name=" + SafetyUtil.getSecureKey();
|
||||||
if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
// if (upLoadPath.endsWith("/") || upLoadPath.endsWith("\\")) {
|
||||||
upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
// upLoadPath = upLoadPath.substring(0, upLoadPath.length() - 1);
|
||||||
}
|
// }
|
||||||
String filePath = mp4File.substring(0, mp4File.lastIndexOf("/"));
|
// String filePath = mp4File.substring(0, mp4File.lastIndexOf("/"));
|
||||||
String fileName = mp4File.substring(mp4File.lastIndexOf("/") + 1);
|
// String fileName = mp4File.substring(mp4File.lastIndexOf("/") + 1);
|
||||||
if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
// if (filePath.startsWith("/") || filePath.startsWith("\\")) {
|
||||||
filePath = filePath.substring(1);
|
// filePath = filePath.substring(1);
|
||||||
}
|
// }
|
||||||
try {
|
// try {
|
||||||
FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
// FileDownloader.downloadFile(url, upLoadPath + File.separator + filePath, fileName);
|
||||||
} catch (Exception e) {
|
// } catch (Exception e) {
|
||||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||||
mediaAsyncErrorLog.setMediaid(mp4File);
|
// mediaAsyncErrorLog.setMediaid(mp4File);
|
||||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||||
e.printStackTrace();
|
// e.printStackTrace();
|
||||||
throw new RuntimeException(e);
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * if 未到运营开始时间时 全量变更
|
// * if 未到运营开始时间时 全量变更
|
||||||
|
|
@ -371,6 +507,16 @@ public class DirectiveMQListener {
|
||||||
//获取到需要新增的指令集合
|
//获取到需要新增的指令集合
|
||||||
for (ConfigServiceDirective directive : allData) {
|
for (ConfigServiceDirective directive : allData) {
|
||||||
if (needAddIds.contains(directive.getId())) {
|
if (needAddIds.contains(directive.getId())) {
|
||||||
|
//这里都是新增的指令 不存储指令资源字段 在指令资源mq中会存储这个值
|
||||||
|
directive.setPreviewFile(null);
|
||||||
|
directive.setImmediateFile(null);
|
||||||
|
directive.setMp3File(null);
|
||||||
|
directive.setMp4File(null);
|
||||||
|
directive.setServiceContent(null);
|
||||||
|
directive.setPreviewFileMd5(null);
|
||||||
|
directive.setImmediateFileMd5(null);
|
||||||
|
directive.setMp3FileMd5(null);
|
||||||
|
directive.setMp4FileMd5(null);
|
||||||
needAddDirectiveList.add(directive);
|
needAddDirectiveList.add(directive);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue