服务指令同步
This commit is contained in:
parent
53fbd4c39e
commit
05c000f53d
|
|
@ -7,63 +7,131 @@ import java.io.Serializable;
|
||||||
/**
|
/**
|
||||||
* @Description: 服务指令审核
|
* @Description: 服务指令审核
|
||||||
* @Author: 张明远
|
* @Author: 张明远
|
||||||
* @Date: 2025-07-14
|
* @Date: 2025-07-14
|
||||||
* @Version: V1.0
|
* @Version: V1.0
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DirectiveAsyncMQDto implements Serializable {
|
public class DirectiveAsyncMQDto implements Serializable {
|
||||||
/**id*/
|
/**
|
||||||
|
* id
|
||||||
|
*/
|
||||||
private String id;
|
private String id;
|
||||||
/**服务类别id*/
|
/**
|
||||||
|
* 服务类别id
|
||||||
|
*/
|
||||||
private String categoryId;
|
private String categoryId;
|
||||||
/**服务类型id*/
|
/**
|
||||||
|
* 服务类型id
|
||||||
|
*/
|
||||||
private String typeId;
|
private String typeId;
|
||||||
/**分类标签*/
|
/**
|
||||||
|
* 分类标签
|
||||||
|
*/
|
||||||
private String instructionTagId;
|
private String instructionTagId;
|
||||||
/**服务指令名称*/
|
/**
|
||||||
|
* 服务指令名称
|
||||||
|
*/
|
||||||
private String directiveName;
|
private String directiveName;
|
||||||
/**收费价格*/
|
/**
|
||||||
|
* 收费价格
|
||||||
|
*/
|
||||||
private java.math.BigDecimal tollPrice;
|
private java.math.BigDecimal tollPrice;
|
||||||
/**提成价格*/
|
/**
|
||||||
|
* 提成价格
|
||||||
|
*/
|
||||||
private java.math.BigDecimal comPrice;
|
private java.math.BigDecimal comPrice;
|
||||||
/**是否参与医保报销 0不报销 1报销*/
|
/**
|
||||||
|
* 是否参与医保报销 0不报销 1报销
|
||||||
|
*/
|
||||||
private String izReimbursement;
|
private String izReimbursement;
|
||||||
/**是否参与机构优惠 0不参与 1参与*/
|
/**
|
||||||
|
* 是否参与机构优惠 0不参与 1参与
|
||||||
|
*/
|
||||||
private String izPreferential;
|
private String izPreferential;
|
||||||
/**收费频次 1按次收费 2按天收费*/
|
/**
|
||||||
|
* 收费频次 1按次收费 2按天收费
|
||||||
|
*/
|
||||||
private String chargingFrequency;
|
private String chargingFrequency;
|
||||||
/**周期类型 1日常护理 2周期护理 3即时护理*/
|
/**
|
||||||
|
* 周期类型 1日常护理 2周期护理 3即时护理
|
||||||
|
*/
|
||||||
private String cycleType;
|
private String cycleType;
|
||||||
/**排序*/
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
/**服务描述*/
|
/**
|
||||||
|
* 服务描述
|
||||||
|
*/
|
||||||
private String serviceContent;
|
private String serviceContent;
|
||||||
/**服务时长(分钟)*/
|
/**
|
||||||
|
* 服务时长(分钟)
|
||||||
|
*/
|
||||||
private String serviceDuration;
|
private String serviceDuration;
|
||||||
/**指令状态*/
|
/**
|
||||||
|
* 指令状态
|
||||||
|
*/
|
||||||
private String status;
|
private String status;
|
||||||
/**是否启用 0启用 1未启用*/
|
/**
|
||||||
|
* 是否启用 0启用 1未启用
|
||||||
|
*/
|
||||||
private String izEnabled;
|
private String izEnabled;
|
||||||
/**是否删除*/
|
/**
|
||||||
|
* 是否删除
|
||||||
|
*/
|
||||||
private String delFlag;
|
private String delFlag;
|
||||||
/**创建人*/
|
/**
|
||||||
|
* 创建人
|
||||||
|
*/
|
||||||
private String createBy;
|
private String createBy;
|
||||||
/**创建日期*/
|
/**
|
||||||
|
* 创建日期
|
||||||
|
*/
|
||||||
private java.util.Date createTime;
|
private java.util.Date createTime;
|
||||||
/**更新人*/
|
/**
|
||||||
|
* 更新人
|
||||||
|
*/
|
||||||
private String updateBy;
|
private String updateBy;
|
||||||
/**更新日期*/
|
/**
|
||||||
|
* 更新日期
|
||||||
|
*/
|
||||||
private java.util.Date updateTime;
|
private java.util.Date updateTime;
|
||||||
/**所属部门*/
|
/**
|
||||||
|
* 所属部门
|
||||||
|
*/
|
||||||
private String sysOrgCode;
|
private String sysOrgCode;
|
||||||
/**指令音频文件*/
|
/**
|
||||||
|
* 指令音频文件
|
||||||
|
*/
|
||||||
private String mp3File;
|
private String mp3File;
|
||||||
/**指令视频文件*/
|
/**
|
||||||
|
* 指令视频文件
|
||||||
|
*/
|
||||||
private String mp4File;
|
private String mp4File;
|
||||||
/**服务指令图片*/
|
/**
|
||||||
|
* 服务指令图片
|
||||||
|
*/
|
||||||
private String previewFile;
|
private String previewFile;
|
||||||
/**即时指令图标*/
|
/**
|
||||||
|
* 即时指令图标
|
||||||
|
*/
|
||||||
private String immediateFile;
|
private String immediateFile;
|
||||||
|
/**
|
||||||
|
* 指令音频文件md5
|
||||||
|
*/
|
||||||
|
private java.lang.String mp3FileMd5;
|
||||||
|
/**
|
||||||
|
* 指令视频文件md5
|
||||||
|
*/
|
||||||
|
private java.lang.String mp4FileMd5;
|
||||||
|
/**
|
||||||
|
* 服务指令图片md5
|
||||||
|
*/
|
||||||
|
private java.lang.String previewFileMd5;
|
||||||
|
/**
|
||||||
|
* 即时指令图标md5
|
||||||
|
*/
|
||||||
|
private java.lang.String immediateFileMd5;
|
||||||
|
|
||||||
|
|
||||||
//分类标签中文名称
|
//分类标签中文名称
|
||||||
|
|
|
||||||
|
|
@ -127,8 +127,8 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
||||||
configServiceDirective.setSysOrgCode(deptInfo.getString("code"));
|
configServiceDirective.setSysOrgCode(deptInfo.getString("code"));
|
||||||
//设置为“未授权”
|
//设置为“未授权”
|
||||||
configServiceDirective.setStatus("1");
|
configServiceDirective.setStatus("1");
|
||||||
//业务平台添加时无媒体资源 处理媒体资源(放在保存方法之前)
|
//处理媒体资源(放在保存方法之前)
|
||||||
// configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
||||||
configServiceDirectiveService.save(configServiceDirective);
|
configServiceDirectiveService.save(configServiceDirective);
|
||||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||||
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
||||||
|
|
@ -162,8 +162,8 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
|
||||||
@ApiOperation(value = "服务指令-编辑", notes = "服务指令-编辑")
|
@ApiOperation(value = "服务指令-编辑", notes = "服务指令-编辑")
|
||||||
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
|
||||||
public Result<String> edit(@RequestBody ConfigServiceDirective configServiceDirective) {
|
public Result<String> edit(@RequestBody ConfigServiceDirective configServiceDirective) {
|
||||||
//业务平台添加时无媒体资源 处理媒体资源(放在保存方法之前)
|
//处理媒体资源(放在保存方法之前)
|
||||||
// configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
configServiceDirectiveService.handleMediaFile(configServiceDirective);
|
||||||
configServiceDirectiveService.updateById(configServiceDirective);
|
configServiceDirectiveService.updateById(configServiceDirective);
|
||||||
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
|
||||||
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
configServiceDirectiveService.saveBodyTags(configServiceDirective);
|
||||||
|
|
|
||||||
|
|
@ -148,6 +148,20 @@ public class ConfigServiceDirective implements Serializable {
|
||||||
/**即时指令图标*/
|
/**即时指令图标*/
|
||||||
@ApiModelProperty(value = "即时指令图标")
|
@ApiModelProperty(value = "即时指令图标")
|
||||||
private java.lang.String immediateFile;
|
private java.lang.String immediateFile;
|
||||||
|
/**指令音频文件md5*/
|
||||||
|
@ApiModelProperty(value = "指令音频文件md5")
|
||||||
|
private java.lang.String mp3FileMd5;
|
||||||
|
/**指令视频文件md5*/
|
||||||
|
@ApiModelProperty(value = "指令视频文件md5")
|
||||||
|
private java.lang.String mp4FileMd5;
|
||||||
|
/**服务指令图片md5*/
|
||||||
|
@ApiModelProperty(value = "服务指令图片md5")
|
||||||
|
private java.lang.String previewFileMd5;
|
||||||
|
/**即时指令图标md5*/
|
||||||
|
@ApiModelProperty(value = "即时指令图标md5")
|
||||||
|
private java.lang.String immediateFileMd5;
|
||||||
|
|
||||||
|
|
||||||
//即时指令图标是否变更
|
//即时指令图标是否变更
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private boolean immediateFileChanged;
|
private boolean immediateFileChanged;
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.security.MessageDigest;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
|
@ -267,7 +269,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
||||||
//上传根路径
|
//上传根路径
|
||||||
String path = uploadpath;
|
String path = uploadpath;
|
||||||
//需要存储的路径
|
//需要存储的路径
|
||||||
String mediaFileSavePath = configServiceDirective.getMediaFileSavePath();
|
String mediaFileSavePath = configServiceDirective.getMediaFileSavePath() + configServiceDirective.getId();
|
||||||
//服务指令图片
|
//服务指令图片
|
||||||
String previewFile = configServiceDirective.getPreviewFile();
|
String previewFile = configServiceDirective.getPreviewFile();
|
||||||
//即时指令图标
|
//即时指令图标
|
||||||
|
|
@ -278,23 +280,27 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
||||||
String mp4File = configServiceDirective.getMp4File();
|
String mp4File = configServiceDirective.getMp4File();
|
||||||
|
|
||||||
// 处理每个文件并获取更新后的路径
|
// 处理每个文件并获取更新后的路径
|
||||||
String newPreviewFile = processFile(path, mediaFileSavePath, previewFile);
|
Map<String, String> newPreviewFileMap = processFile(path, mediaFileSavePath, previewFile);
|
||||||
String newImmediateFile = processFile(path, mediaFileSavePath, immediateFile);
|
Map<String, String> newImmediateFileMap = processFile(path, mediaFileSavePath, immediateFile);
|
||||||
String newMp3File = processFile(path, mediaFileSavePath, mp3File);
|
Map<String, String> newMp3FileMap = processFile(path, mediaFileSavePath, mp3File);
|
||||||
String newMp4File = processFile(path, mediaFileSavePath, mp4File);
|
Map<String, String> newMp4FileMap = processFile(path, mediaFileSavePath, mp4File);
|
||||||
|
|
||||||
// 如果有变化,更新ConfigServiceDirective对象
|
// 如果有变化,更新ConfigServiceDirective对象
|
||||||
if (newPreviewFile != null) {
|
if (newPreviewFileMap != null) {
|
||||||
configServiceDirective.setPreviewFile(newPreviewFile);
|
configServiceDirective.setPreviewFile(newPreviewFileMap.get("path"));
|
||||||
|
configServiceDirective.setPreviewFileMd5(newPreviewFileMap.get("md5"));
|
||||||
}
|
}
|
||||||
if (newImmediateFile != null) {
|
if (newImmediateFileMap != null) {
|
||||||
configServiceDirective.setImmediateFile(newImmediateFile);
|
configServiceDirective.setImmediateFile(newImmediateFileMap.get("path"));
|
||||||
|
configServiceDirective.setImmediateFileMd5(newImmediateFileMap.get("md5"));
|
||||||
}
|
}
|
||||||
if (newMp3File != null) {
|
if (newMp3FileMap != null) {
|
||||||
configServiceDirective.setMp3File(newMp3File);
|
configServiceDirective.setMp3File(newMp3FileMap.get("path"));
|
||||||
|
configServiceDirective.setMp3FileMd5(newMp3FileMap.get("md5"));
|
||||||
}
|
}
|
||||||
if (newMp4File != null) {
|
if (newMp4FileMap != null) {
|
||||||
configServiceDirective.setMp4File(newMp4File);
|
configServiceDirective.setMp4File(newMp4FileMap.get("path"));
|
||||||
|
configServiceDirective.setMp4FileMd5(newMp4FileMap.get("md5"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -306,7 +312,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
||||||
* @param filePath 文件路径
|
* @param filePath 文件路径
|
||||||
* @return 如果路径有变化返回新路径,否则返回null
|
* @return 如果路径有变化返回新路径,否则返回null
|
||||||
*/
|
*/
|
||||||
private String processFile(String basePath, String targetDir, String filePath) {
|
private Map<String, String> processFile(String basePath, String targetDir, String filePath) {
|
||||||
if (StringUtils.isBlank(filePath)) {
|
if (StringUtils.isBlank(filePath)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
@ -331,6 +337,9 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
||||||
// 移动文件
|
// 移动文件
|
||||||
File oldFile = new File(oldFullPath);
|
File oldFile = new File(oldFullPath);
|
||||||
if (oldFile.exists()) {
|
if (oldFile.exists()) {
|
||||||
|
// 计算原文件的MD5
|
||||||
|
String md5 = calculateMD5(oldFile);
|
||||||
|
|
||||||
File newFile = new File(newFullPath);
|
File newFile = new File(newFullPath);
|
||||||
|
|
||||||
// 如果目标文件已存在,先删除
|
// 如果目标文件已存在,先删除
|
||||||
|
|
@ -341,8 +350,11 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
||||||
// 移动文件
|
// 移动文件
|
||||||
Files.move(oldFile.toPath(), newFile.toPath());
|
Files.move(oldFile.toPath(), newFile.toPath());
|
||||||
|
|
||||||
// 返回新的相对路径
|
// 返回包含新路径和MD5的Map
|
||||||
return newRelativePath;
|
Map<String, String> result = new HashMap<>();
|
||||||
|
result.put("path", newRelativePath);
|
||||||
|
result.put("md5", md5);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
@ -353,6 +365,23 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String calculateMD5(File file) throws Exception {
|
||||||
|
try (InputStream is = Files.newInputStream(file.toPath())) {
|
||||||
|
MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
byte[] buffer = new byte[8192];
|
||||||
|
int read;
|
||||||
|
while ((read = is.read(buffer)) != -1) {
|
||||||
|
md.update(buffer, 0, read);
|
||||||
|
}
|
||||||
|
byte[] md5 = md.digest();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
for (byte b : md5) {
|
||||||
|
sb.append(String.format("%02x", b));
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void auditPass(DirectiveAsyncMQDto dto) {
|
public void auditPass(DirectiveAsyncMQDto dto) {
|
||||||
//将相应字典项改为已授权
|
//将相应字典项改为已授权
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ package com.nu.mq.directive.listener;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.nu.dto.*;
|
import com.nu.dto.*;
|
||||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||||
|
|
@ -12,6 +13,7 @@ import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||||
import com.nu.modules.instructiontag.entity.InstructionTag;
|
import com.nu.modules.instructiontag.entity.InstructionTag;
|
||||||
import com.nu.modules.instructiontag.service.IInstructionTagService;
|
import com.nu.modules.instructiontag.service.IInstructionTagService;
|
||||||
|
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
||||||
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
|
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
|
||||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||||
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
||||||
|
|
@ -19,7 +21,10 @@ import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||||
|
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||||
|
import com.nu.utils.FileDownloader;
|
||||||
|
import com.nu.utils.SafetyUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.compress.utils.Lists;
|
import org.apache.commons.compress.utils.Lists;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
@ -32,6 +37,9 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -97,127 +105,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 未到运营开始时间时 全量变更
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue