服务指令同步
This commit is contained in:
parent
592d0d1f75
commit
f37543beee
|
|
@ -0,0 +1,41 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 体型标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class BodyTagMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
private String tagName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态 0已授权 1未授权
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 是否启用 0启用 1未启用
|
||||
*/
|
||||
private String izEnabled;
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 服务类别
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class CategoryMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 分类标签id
|
||||
*/
|
||||
private String instructionId;
|
||||
/**
|
||||
* 服务类别名称
|
||||
*/
|
||||
private String categoryName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态 0已授权 1未授权
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 是否启用 0启用 1未启用
|
||||
*/
|
||||
private String izEnabled;
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
|
|
@ -8,11 +8,24 @@ import java.util.List;
|
|||
public class DirectiveMQDto {
|
||||
private boolean izInc;//是否为增量 否则为全量
|
||||
private String orgCode;//机构编码
|
||||
private String idStr;//前台传来的所有需要新增的服务指令
|
||||
private List<String> idList;//!!实际需要新增的服务指令id
|
||||
private String idStr;
|
||||
private List<String> idList;
|
||||
|
||||
//同步主表id
|
||||
private String asyncId;
|
||||
//同步子表code
|
||||
private String code;
|
||||
|
||||
//指令集合
|
||||
private List<DirectiveAsyncMQDto> directiveList;
|
||||
//分类标签字典项
|
||||
private List<InstructionTagMQDto> instructionList;
|
||||
//服务类别字典项
|
||||
private List<CategoryMQDto> categoryList;
|
||||
//服务类型字典项
|
||||
private List<DirectiveTypeMQDto> typeList;
|
||||
//体型标签字典项
|
||||
private List<BodyTagMQDto> bodyTagList;
|
||||
//情绪标签字典项
|
||||
private List<EmotionTagMQDto> emotionTagList;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 服务类型
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class DirectiveTypeMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 分类标签id
|
||||
*/
|
||||
private String instructionId;
|
||||
/**
|
||||
* 服务类别id
|
||||
*/
|
||||
private String categoryId;
|
||||
/**
|
||||
* 服务类型名称
|
||||
*/
|
||||
private String typeName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态 0已授权 1未授权
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 是否启用 0启用 1未启用
|
||||
*/
|
||||
private String izEnabled;
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 情绪标签
|
||||
* @Author: 张明远
|
||||
* @Date: 2025-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class EmotionTagMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 标签名称
|
||||
*/
|
||||
private String tagName;
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
/**
|
||||
* 状态 0已授权 1未授权
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 是否启用 0启用 1未启用
|
||||
*/
|
||||
private String izEnabled;
|
||||
/**
|
||||
* 是否删除 0未删除 1删除
|
||||
*/
|
||||
private String delFlag;
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
package com.nu.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令-分类标签
|
||||
* @Author: zmy
|
||||
* @Date: 2025-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
public class InstructionTagMQDto implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**id*/
|
||||
private String id;
|
||||
/**分类标签名称*/
|
||||
private String instructionName;
|
||||
/**排序*/
|
||||
private Integer sort;
|
||||
/**状态 0已授权 1未授权*/
|
||||
private String status;
|
||||
/**是否启用 0启用 1未启用*/
|
||||
private String izEnabled;
|
||||
/**是否删除 0未删除 1删除*/
|
||||
private String delFlag;
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@ package com.nu.modules.instructiontag.service;
|
|||
import com.nu.modules.instructiontag.entity.InstructionTag;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令-分类标签
|
||||
* @Author: jeecg-boot
|
||||
|
|
@ -11,4 +13,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||
*/
|
||||
public interface IInstructionTagService extends IService<InstructionTag> {
|
||||
|
||||
void insertAll(List<InstructionTag> instructionList);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 服务指令-分类标签
|
||||
* @Author: jeecg-boot
|
||||
|
|
@ -16,4 +18,10 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
@Service
|
||||
public class InstructionTagServiceImpl extends ServiceImpl<InstructionTagMapper, InstructionTag> implements IInstructionTagService {
|
||||
|
||||
@Override
|
||||
public void insertAll(List<InstructionTag> instructionList) {
|
||||
instructionList.forEach(i -> {
|
||||
baseMapper.insert(i);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
});
|
||||
}
|
||||
//处理单元格合并所需数据
|
||||
merge(list);
|
||||
// merge(list);
|
||||
|
||||
|
||||
return list;
|
||||
|
|
@ -429,32 +429,30 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
.collect(Collectors.groupingBy(ConfigServiceType::getCategoryId));
|
||||
|
||||
List<TreeNode> tree = new ArrayList<>();
|
||||
boolean canAdd = true;
|
||||
boolean insUsing = true;
|
||||
boolean catUsing = true;
|
||||
boolean typUsing = true;
|
||||
for (InstructionTag inst : instructions) {
|
||||
canAdd = "0".equals(inst.getIzEnabled());
|
||||
TreeNode instNode = new TreeNode(inst.getId(), "", "", inst.getId(), inst.getInstructionName(), 1, "", inst.getIzEnabled(), inst.getSort(), canAdd);
|
||||
insUsing = "0".equals(inst.getIzEnabled());
|
||||
TreeNode instNode = new TreeNode(inst.getId(), "", "", inst.getId(), inst.getInstructionName(), 1, "", inst.getIzEnabled(), inst.getSort(), insUsing);
|
||||
List<ConfigServiceCategory> catList = catMap.get(inst.getId());
|
||||
if (catList != null) {
|
||||
catList.sort(Comparator.comparingInt(ConfigServiceCategory::getSort));
|
||||
for (ConfigServiceCategory cat : catList) {
|
||||
if (canAdd) {
|
||||
canAdd = "0".equals(cat.getIzEnabled());
|
||||
}
|
||||
TreeNode catNode = new TreeNode(inst.getId(), cat.getId(), "", cat.getId(), cat.getCategoryName(), 2, "", cat.getIzEnabled(), cat.getSort(), canAdd);
|
||||
catUsing = "0".equals(cat.getIzEnabled());
|
||||
TreeNode catNode = new TreeNode(inst.getId(), cat.getId(), "", cat.getId(), cat.getCategoryName(), 2, "", cat.getIzEnabled(), cat.getSort(), insUsing && catUsing);
|
||||
List<ConfigServiceType> typeList = typeMap.get(cat.getId());
|
||||
if (typeList != null) {
|
||||
typeList.sort(Comparator.comparingInt(ConfigServiceType::getSort));
|
||||
for (ConfigServiceType tp : typeList) {
|
||||
if (canAdd) {
|
||||
canAdd = "0".equals(tp.getIzEnabled());
|
||||
}
|
||||
TreeNode typeNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), tp.getId(), tp.getTypeName(), 3, "", tp.getIzEnabled(), tp.getSort(), canAdd);
|
||||
typUsing = "0".equals(tp.getIzEnabled());
|
||||
TreeNode typeNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), tp.getId(), tp.getTypeName(), 3, "", tp.getIzEnabled(), tp.getSort(), insUsing && catUsing && typUsing);
|
||||
List<ConfigServiceDirective> dirList = directiveMap.get(tp.getId());
|
||||
if (dirList != null) {
|
||||
dirList.sort(Comparator.comparingInt(ConfigServiceDirective::getSort));
|
||||
for (ConfigServiceDirective dir : dirList) {
|
||||
TreeNode dirNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), dir.getId(), dir.getDirectiveName(), 4, cycleTypeMap.get(dir.getCycleType()), dir.getIzEnabled(), dir.getSort(), canAdd);
|
||||
TreeNode tagNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), IdUtil.simpleUUID(), "标签", 5, cycleTypeMap.get(dir.getCycleType()), dir.getIzEnabled(), dir.getSort(), canAdd);
|
||||
TreeNode dirNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), dir.getId(), dir.getDirectiveName(), 4, cycleTypeMap.get(dir.getCycleType()), dir.getIzEnabled(), dir.getSort(), insUsing && catUsing && typUsing);
|
||||
TreeNode tagNode = new TreeNode(inst.getId(), cat.getId(), tp.getId(), IdUtil.simpleUUID(), "标签", 5, cycleTypeMap.get(dir.getCycleType()), dir.getIzEnabled(), dir.getSort(), insUsing && catUsing && typUsing);
|
||||
tagNode.setBodyTagList(dir.getBodyTagList());
|
||||
tagNode.setEmotionTagList(dir.getEmotionTagList());
|
||||
typeNode.addChild(dirNode);
|
||||
|
|
@ -462,11 +460,9 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
|
|||
}
|
||||
}
|
||||
catNode.addChild(typeNode);
|
||||
canAdd = true;
|
||||
}
|
||||
}
|
||||
instNode.addChild(catNode);
|
||||
canAdd = true;
|
||||
}
|
||||
}
|
||||
tree.add(instNode);
|
||||
|
|
|
|||
|
|
@ -1,16 +1,27 @@
|
|||
package com.nu.mq.directive.listener;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.nu.dto.DirectiveAsyncMQDto;
|
||||
import com.nu.modules.mediaasyncerrorlog.entity.MediaAsyncErrorLog;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.nu.dto.*;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTag;
|
||||
import com.nu.modules.directivetag.body.entity.DirectiveBodyTagRelation;
|
||||
import com.nu.modules.directivetag.body.service.IDirectiveBodyTagService;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTag;
|
||||
import com.nu.modules.directivetag.emotion.entity.DirectiveEmotionTagRelation;
|
||||
import com.nu.modules.directivetag.emotion.service.IDirectiveEmotionTagService;
|
||||
import com.nu.modules.instructiontag.entity.InstructionTag;
|
||||
import com.nu.modules.instructiontag.service.IInstructionTagService;
|
||||
import com.nu.modules.mediaasyncerrorlog.service.IMediaAsyncErrorLogService;
|
||||
import com.nu.modules.servicecategory.entity.ConfigServiceCategory;
|
||||
import com.nu.modules.servicecategory.service.IConfigServiceCategoryService;
|
||||
import com.nu.modules.servicedirective.entity.ConfigServiceDirective;
|
||||
import com.nu.modules.servicedirective.service.IConfigServiceDirectiveService;
|
||||
import com.nu.modules.sysconfig.entity.SysConfig;
|
||||
import com.nu.modules.servicetype.entity.ConfigServiceType;
|
||||
import com.nu.modules.servicetype.service.IConfigServiceTypeService;
|
||||
import com.nu.modules.sysconfig.service.ISysConfigService;
|
||||
import com.nu.utils.FileDownloader;
|
||||
import com.nu.utils.SafetyUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.compress.utils.Lists;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.amqp.core.ExchangeTypes;
|
||||
import org.springframework.amqp.rabbit.annotation.Exchange;
|
||||
|
|
@ -21,9 +32,11 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.beans.factory.annotation.Value;
|
||||
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.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
|
|
@ -39,156 +52,172 @@ public class DirectiveMQListener {
|
|||
private IMediaAsyncErrorLogService mediaAsyncErrorLogService;
|
||||
@Autowired
|
||||
private IConfigServiceDirectiveService directiveService;
|
||||
// @Autowired
|
||||
// private IDirectiveBodyTagService bodyTagService;
|
||||
// @Autowired
|
||||
// private IDirectiveEmotionTagService emotionTagService;
|
||||
// @Autowired
|
||||
// private IConfigServiceCategoryService serviceCategoryService;
|
||||
// @Autowired
|
||||
// private IConfigServiceTypeService serviceTypeService;
|
||||
@Autowired
|
||||
private IDirectiveBodyTagService bodyTagService;
|
||||
@Autowired
|
||||
private IDirectiveEmotionTagService emotionTagService;
|
||||
@Autowired
|
||||
private IInstructionTagService instructionTagService;
|
||||
@Autowired
|
||||
private IConfigServiceCategoryService serviceCategoryService;
|
||||
@Autowired
|
||||
private IConfigServiceTypeService serviceTypeService;
|
||||
// @Autowired
|
||||
// private RabbitMQUtil rabbitMQUtil;
|
||||
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(name = "#{directiveAsyncDQNP.getAuditResultQueueName()}"),
|
||||
value = @Queue(name = "#{directiveAsyncDQNP.getSyncDirectiveQueueName()}"),
|
||||
exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
||||
key = "#{directiveAsyncDQNP.getAuditResultKeyName()}"
|
||||
key = "#{directiveAsyncDQNP.getSyncDirectiveKeyName()}"
|
||||
),
|
||||
errorHandler = "directiveMQErrorHandler"
|
||||
)
|
||||
public void handleAuditResult(DirectiveAsyncMQDto dto) {
|
||||
//将字典项更新为已授权
|
||||
directiveService.auditPass(dto);
|
||||
//更新服务指令状态
|
||||
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||
configServiceDirective.setId(dto.getId());
|
||||
configServiceDirective.setStatus(dto.getStatus());
|
||||
directiveService.updateById(configServiceDirective);
|
||||
}
|
||||
|
||||
@RabbitListener(
|
||||
bindings = @QueueBinding(
|
||||
value = @Queue(name = "#{directiveAsyncDQNP.getCreateMediaQueueName()}"),
|
||||
exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
||||
key = "#{directiveAsyncDQNP.getCreateMediaKeyName()}"
|
||||
),
|
||||
errorHandler = "directiveMQErrorHandler"
|
||||
)
|
||||
public void handleCreateMedia(DirectiveAsyncMQDto dto) {
|
||||
//更新服务指令媒体资源字段
|
||||
ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||
configServiceDirective.setId(dto.getId());
|
||||
configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
|
||||
configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
|
||||
configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
|
||||
configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
|
||||
configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
|
||||
directiveService.updateById(configServiceDirective);
|
||||
|
||||
//拉取媒体资源至本地目录
|
||||
{
|
||||
LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(SysConfig::getDelFlag, "0");
|
||||
qw.eq(SysConfig::getConfigKey, "ope_open_url");
|
||||
SysConfig urlObj = sysConfigService.getOne(qw);
|
||||
//试验田协议+域名(/ip+端口)
|
||||
String baseUrl = urlObj.getConfigValue();
|
||||
if (baseUrl.endsWith("/")) {
|
||||
baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
|
||||
}
|
||||
|
||||
//处理服务指令图片
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
mediaAsyncErrorLog.setMediaid(previewFile);
|
||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
//处理即时指令图标
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
mediaAsyncErrorLog.setMediaid(immediateFile);
|
||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
//处理指令音频文件
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
mediaAsyncErrorLog.setMediaid(mp3File);
|
||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
//处理指令视频文件
|
||||
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);
|
||||
} catch (Exception e) {
|
||||
MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
mediaAsyncErrorLog.setMediaid(mp4File);
|
||||
mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
public void handleAuditResult(DirectiveMQDto dto) {
|
||||
dto.setIzInc(true);
|
||||
dto.setIdStr(dto.getDirectiveList().stream().map(d -> d.getId()).collect(Collectors.joining(",")));
|
||||
//增量处理
|
||||
handleIncremental(dto);
|
||||
}
|
||||
// @RabbitListener(
|
||||
// bindings = @QueueBinding(
|
||||
// value = @Queue(name = "#{directiveAsyncDQNP.getAuditResultQueueName()}"),
|
||||
// exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
||||
// key = "#{directiveAsyncDQNP.getAuditResultKeyName()}"
|
||||
// ),
|
||||
// errorHandler = "directiveMQErrorHandler"
|
||||
// )
|
||||
// public void handleAuditResult(DirectiveAsyncMQDto dto) {
|
||||
// //将字典项更新为已授权
|
||||
// directiveService.auditPass(dto);
|
||||
// //更新服务指令状态
|
||||
// ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||
// configServiceDirective.setId(dto.getId());
|
||||
// configServiceDirective.setStatus(dto.getStatus());
|
||||
// directiveService.updateById(configServiceDirective);
|
||||
// }
|
||||
//
|
||||
// @RabbitListener(
|
||||
// bindings = @QueueBinding(
|
||||
// value = @Queue(name = "#{directiveAsyncDQNP.getCreateMediaQueueName()}"),
|
||||
// exchange = @Exchange(name = "hldy.directive", type = ExchangeTypes.DIRECT),
|
||||
// key = "#{directiveAsyncDQNP.getCreateMediaKeyName()}"
|
||||
// ),
|
||||
// errorHandler = "directiveMQErrorHandler"
|
||||
// )
|
||||
// public void handleCreateMedia(DirectiveAsyncMQDto dto) {
|
||||
// //更新服务指令媒体资源字段
|
||||
// ConfigServiceDirective configServiceDirective = new ConfigServiceDirective();
|
||||
// configServiceDirective.setId(dto.getId());
|
||||
// configServiceDirective.setPreviewFile(dto.getPreviewFile());//服务指令图片
|
||||
// configServiceDirective.setServiceContent(dto.getServiceContent());//服务指令说明
|
||||
// configServiceDirective.setImmediateFile(dto.getImmediateFile());//即时指令图标
|
||||
// configServiceDirective.setMp3File(dto.getMp3File());//指令音频文件
|
||||
// configServiceDirective.setMp4File(dto.getMp4File());//指令视频文件
|
||||
// directiveService.updateById(configServiceDirective);
|
||||
//
|
||||
// //拉取媒体资源至本地目录
|
||||
// {
|
||||
// LambdaQueryWrapper<SysConfig> qw = new LambdaQueryWrapper<>();
|
||||
// qw.eq(SysConfig::getDelFlag, "0");
|
||||
// qw.eq(SysConfig::getConfigKey, "ope_open_url");
|
||||
// SysConfig urlObj = sysConfigService.getOne(qw);
|
||||
// //试验田协议+域名(/ip+端口)
|
||||
// String baseUrl = urlObj.getConfigValue();
|
||||
// if (baseUrl.endsWith("/")) {
|
||||
// baseUrl = baseUrl.substring(0, baseUrl.length() - 1); // 移除末尾斜杠
|
||||
// }
|
||||
//
|
||||
// //处理服务指令图片
|
||||
// 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);
|
||||
// } catch (Exception e) {
|
||||
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
// mediaAsyncErrorLog.setMediaid(previewFile);
|
||||
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
// e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// //处理即时指令图标
|
||||
// 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);
|
||||
// } catch (Exception e) {
|
||||
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
// mediaAsyncErrorLog.setMediaid(immediateFile);
|
||||
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
// e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// //处理指令音频文件
|
||||
// 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);
|
||||
// } catch (Exception e) {
|
||||
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
// mediaAsyncErrorLog.setMediaid(mp3File);
|
||||
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
// e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// //处理指令视频文件
|
||||
// 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);
|
||||
// } catch (Exception e) {
|
||||
// MediaAsyncErrorLog mediaAsyncErrorLog = new MediaAsyncErrorLog();
|
||||
// mediaAsyncErrorLog.setMediaid(mp4File);
|
||||
// mediaAsyncErrorLogService.save(mediaAsyncErrorLog);
|
||||
// e.printStackTrace();
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * if 未到运营开始时间时 全量变更
|
||||
|
|
@ -285,109 +314,213 @@ public class DirectiveMQListener {
|
|||
// handleData(dto);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 处理增量同步数据
|
||||
// *
|
||||
// * @param dto
|
||||
// * @throws Exception
|
||||
// */
|
||||
// private void handleIncremental(DirectiveMQDto dto) {
|
||||
// //增量:传过来的是已勾选的全部数据,需将重复部分去除
|
||||
// //先查出所有指令id 然后进行去重
|
||||
// QueryWrapper<ConfigServiceDirective> dtw = new QueryWrapper<>();
|
||||
// dtw.select("id");
|
||||
// List<ConfigServiceDirective> tempList = directiveService.list(dtw);
|
||||
// Set<String> existingIds = tempList.stream()
|
||||
// .map(ConfigServiceDirective::getId)
|
||||
// .map(String::valueOf)
|
||||
// .collect(Collectors.toSet());
|
||||
//
|
||||
// String idStr = dto.getIdStr();
|
||||
// List<String> inputIds = Arrays.asList(idStr.split(","));
|
||||
//
|
||||
// List<String> uniqueIds = inputIds.stream()
|
||||
// .filter(id -> !existingIds.contains(id))
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// dto.setIdList(uniqueIds);
|
||||
//
|
||||
// handleData(dto);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 处理数据
|
||||
// *
|
||||
// * @param dto
|
||||
// */
|
||||
// private void handleData(DirectiveMQDto dto) {
|
||||
// if (dto.getIdList() != null && !dto.getIdList().isEmpty()) {
|
||||
// //体型标签
|
||||
// {
|
||||
// //需要排除的体型标签id
|
||||
// List<String> excludeSubIds = Lists.newArrayList();
|
||||
// if (dto.isIzInc()) {
|
||||
// List<DirectiveBodyTag> list = bodyTagService.list();
|
||||
// excludeSubIds = list.stream().map(DirectiveBodyTag::getId).collect(Collectors.toList());
|
||||
// }
|
||||
// List<DirectiveBodyTag> bodyAll = bodyTagService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
// if (bodyAll != null && !bodyAll.isEmpty()) {
|
||||
// bodyTagService.insertAll(bodyAll);
|
||||
// }
|
||||
// List<DirectiveBodyTagRelation> bodyRelations = bodyTagService.selectAllRelation("nuro", dto.getIdList(), null);
|
||||
// if (bodyRelations != null && !bodyRelations.isEmpty()) {
|
||||
// bodyTagService.insertAllRelation(bodyRelations);
|
||||
// }
|
||||
// }
|
||||
// //情绪标签
|
||||
// {
|
||||
// //需要排除的情绪标签id
|
||||
// List<String> excludeSubIds = Lists.newArrayList();
|
||||
// if (dto.isIzInc()) {
|
||||
// List<DirectiveEmotionTag> list = emotionTagService.list();
|
||||
// excludeSubIds = list.stream().map(DirectiveEmotionTag::getId).collect(Collectors.toList());
|
||||
// }
|
||||
// List<DirectiveEmotionTag> emoAll = emotionTagService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
// if (emoAll != null && !emoAll.isEmpty()) {
|
||||
// emotionTagService.insertAll(emoAll);
|
||||
// }
|
||||
// List<DirectiveEmotionTagRelation> emoRelations = emotionTagService.selectAllRelation("nuro", dto.getIdList(), null);
|
||||
// if (emoRelations != null && !emoRelations.isEmpty()) {
|
||||
// emotionTagService.insertAllRelation(emoRelations);
|
||||
// }
|
||||
// }
|
||||
// //服务类别
|
||||
// {
|
||||
// //需要排除的服务类别id
|
||||
// List<String> excludeSubIds = Lists.newArrayList();
|
||||
// if (dto.isIzInc()) {
|
||||
// List<ConfigServiceCategory> list = serviceCategoryService.list();
|
||||
// excludeSubIds = list.stream().map(ConfigServiceCategory::getId).collect(Collectors.toList());
|
||||
// }
|
||||
// List<ConfigServiceCategory> categoryList = serviceCategoryService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
// if (categoryList != null && !categoryList.isEmpty()) {
|
||||
// serviceCategoryService.insertAll(categoryList);
|
||||
// }
|
||||
// }
|
||||
// //服务类型
|
||||
// {
|
||||
// //需要排除的服务类型id
|
||||
// List<String> excludeSubIds = Lists.newArrayList();
|
||||
// if (dto.isIzInc()) {
|
||||
// List<ConfigServiceType> list = serviceTypeService.list();
|
||||
// excludeSubIds = list.stream().map(ConfigServiceType::getId).collect(Collectors.toList());
|
||||
// }
|
||||
// List<ConfigServiceType> typeList = serviceTypeService.selectAll("nuro", dto.getIdList(), excludeSubIds);
|
||||
// if (typeList != null && !typeList.isEmpty()) {
|
||||
// serviceTypeService.insertAll(typeList);
|
||||
// }
|
||||
// }
|
||||
// //查询服务指令,并将服务指令新增进自己的数据库表中
|
||||
// List<ConfigServiceDirective> directives = directiveService.selectAllByIds("nuro", dto.getIdList());
|
||||
// if (directives != null && !directives.isEmpty()) {
|
||||
// directiveService.insertAllDirectives(directives);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 处理增量同步数据
|
||||
*
|
||||
* @param dto
|
||||
* @throws Exception
|
||||
*/
|
||||
private void handleIncremental(DirectiveMQDto dto) {
|
||||
//增量:传过来的是已勾选的全部数据,需将重复部分去除
|
||||
//先查出所有指令id 然后进行去重
|
||||
QueryWrapper<ConfigServiceDirective> dtw = new QueryWrapper<>();
|
||||
dtw.select("id");
|
||||
List<ConfigServiceDirective> tempList = directiveService.list(dtw);
|
||||
Set<String> existingIds = tempList.stream()
|
||||
.map(ConfigServiceDirective::getId)
|
||||
.map(String::valueOf)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
String idStr = dto.getIdStr();
|
||||
List<String> inputIds = Arrays.asList(idStr.split(","));
|
||||
|
||||
List<String> uniqueIds = inputIds.stream()
|
||||
.filter(id -> !existingIds.contains(id))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
dto.setIdList(uniqueIds);
|
||||
|
||||
handleData(dto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理数据
|
||||
* 每一项都会筛选 只留下需要新增的数据
|
||||
*
|
||||
* @param dto
|
||||
*/
|
||||
private void handleData(DirectiveMQDto dto) {
|
||||
if (dto.getIdList() != null && !dto.getIdList().isEmpty()) {
|
||||
//服务指令
|
||||
List<ConfigServiceDirective> needAddDirectiveList = Lists.newArrayList();
|
||||
//需要新增的服务指令集合
|
||||
{
|
||||
//需要新增的指令id
|
||||
List<String> needAddIds = dto.getIdList();
|
||||
//传来的全部指令集合
|
||||
List<ConfigServiceDirective> allData = BeanUtil.copyToList(dto.getDirectiveList(), ConfigServiceDirective.class);
|
||||
//获取到需要新增的指令集合
|
||||
for (ConfigServiceDirective directive : allData) {
|
||||
if (needAddIds.contains(directive.getId())) {
|
||||
needAddDirectiveList.add(directive);
|
||||
}
|
||||
}
|
||||
//新增到数据库
|
||||
if (needAddDirectiveList != null && !needAddDirectiveList.isEmpty()) {
|
||||
directiveService.insertAllDirectives(needAddDirectiveList);
|
||||
}
|
||||
}
|
||||
//体型标签
|
||||
{
|
||||
//处理体型标签字典主表
|
||||
if (dto.getBodyTagList() != null) {
|
||||
//已经存在的体型标签id
|
||||
List<String> existedIds = Lists.newArrayList();
|
||||
//获取到已经存在的体型标签数据
|
||||
if (dto.isIzInc()) {
|
||||
List<DirectiveBodyTag> list = bodyTagService.list();
|
||||
existedIds = list.stream().map(DirectiveBodyTag::getId).collect(Collectors.toList());
|
||||
}
|
||||
//传过来的全部体型标签主表数据
|
||||
List<DirectiveBodyTag> allData = BeanUtil.copyToList(dto.getBodyTagList(), DirectiveBodyTag.class);
|
||||
//需要新增的体型标签字典表数据
|
||||
List<DirectiveBodyTag> needAddBodyList = new ArrayList<>();
|
||||
//获取到需要新增的体型标签字典表数据
|
||||
for (DirectiveBodyTag body : allData) {
|
||||
if (!existedIds.contains(body.getId())) {
|
||||
needAddBodyList.add(body);
|
||||
}
|
||||
}
|
||||
if (needAddBodyList != null && !needAddBodyList.isEmpty()) {
|
||||
bodyTagService.insertAll(needAddBodyList);
|
||||
}
|
||||
}
|
||||
//中间关系表
|
||||
{
|
||||
List<DirectiveBodyTagRelation> bodyRelations = Lists.newArrayList();//关系表
|
||||
needAddDirectiveList.stream().forEach(d -> {
|
||||
String bodyTags = d.getBodyTags();
|
||||
if (StringUtils.isNotBlank(bodyTags)) {
|
||||
Arrays.stream(bodyTags.split(",")).forEach(bi -> {
|
||||
DirectiveBodyTagRelation r = new DirectiveBodyTagRelation();
|
||||
r.setDirectiveId(d.getId());
|
||||
r.setTagId(bi);
|
||||
bodyRelations.add(r);
|
||||
});
|
||||
}
|
||||
});
|
||||
bodyTagService.insertAllRelation(bodyRelations);
|
||||
}
|
||||
}
|
||||
//情绪标签
|
||||
{
|
||||
if (dto.getEmotionTagList() != null) {
|
||||
//需要排除的情绪标签id
|
||||
List<String> existedIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<DirectiveEmotionTag> list = emotionTagService.list();
|
||||
existedIds = list.stream().map(DirectiveEmotionTag::getId).collect(Collectors.toList());
|
||||
}
|
||||
//传来的所有数据
|
||||
List<DirectiveEmotionTag> allData = BeanUtil.copyToList(dto.getEmotionTagList(), DirectiveEmotionTag.class);
|
||||
|
||||
//需要新增的数据
|
||||
List<DirectiveEmotionTag> needAddData = new ArrayList<>();//字典表
|
||||
for (DirectiveEmotionTag emotion : allData) {
|
||||
if (!existedIds.contains(emotion.getId())) {
|
||||
needAddData.add(emotion); // 如果不在排除列表里,就加入结果
|
||||
}
|
||||
}
|
||||
if (needAddData != null && !needAddData.isEmpty()) {
|
||||
emotionTagService.insertAll(needAddData);
|
||||
}
|
||||
}
|
||||
//中间关系表
|
||||
{
|
||||
List<DirectiveEmotionTagRelation> emotionRelations = Lists.newArrayList();//关系表
|
||||
needAddDirectiveList.stream().forEach(d -> {
|
||||
String emotionTags = d.getEmotionTags();
|
||||
if (StringUtils.isNotBlank(emotionTags)) {
|
||||
Arrays.stream(emotionTags.split(",")).forEach(bi -> {
|
||||
DirectiveEmotionTagRelation r = new DirectiveEmotionTagRelation();
|
||||
r.setDirectiveId(d.getId());
|
||||
r.setTagId(bi);
|
||||
emotionRelations.add(r);
|
||||
});
|
||||
}
|
||||
});
|
||||
emotionTagService.insertAllRelation(emotionRelations);
|
||||
}
|
||||
}
|
||||
//分类标签
|
||||
{
|
||||
//需要排除的分类标签id
|
||||
List<String> existedIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<InstructionTag> list = instructionTagService.list();
|
||||
existedIds = list.stream().map(InstructionTag::getId).collect(Collectors.toList());
|
||||
}
|
||||
//传过来的所有数据
|
||||
List<InstructionTag> allData = BeanUtil.copyToList(dto.getInstructionList(), InstructionTag.class);
|
||||
|
||||
//需要新增的数据
|
||||
List<InstructionTag> needAddData = Lists.newArrayList();
|
||||
for (InstructionTag instruction : allData) {
|
||||
if (!existedIds.contains(instruction.getId())) {
|
||||
needAddData.add(instruction);
|
||||
}
|
||||
}
|
||||
if (needAddData != null && !needAddData.isEmpty()) {
|
||||
instructionTagService.insertAll(needAddData);
|
||||
}
|
||||
}
|
||||
//服务类别
|
||||
{
|
||||
//需要排除的服务类别id
|
||||
List<String> existedIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<ConfigServiceCategory> list = serviceCategoryService.list();
|
||||
existedIds = list.stream().map(ConfigServiceCategory::getId).collect(Collectors.toList());
|
||||
}
|
||||
//传过来的所有数据
|
||||
List<ConfigServiceCategory> allData = BeanUtil.copyToList(dto.getCategoryList(), ConfigServiceCategory.class);
|
||||
|
||||
//需要新增的数据
|
||||
List<ConfigServiceCategory> needAddData = Lists.newArrayList();
|
||||
for (ConfigServiceCategory category : allData) {
|
||||
if (!existedIds.contains(category.getId())) {
|
||||
needAddData.add(category);
|
||||
}
|
||||
}
|
||||
if (needAddData != null && !needAddData.isEmpty()) {
|
||||
serviceCategoryService.insertAll(needAddData);
|
||||
}
|
||||
}
|
||||
//服务类型
|
||||
{
|
||||
//需要排除的服务类型id
|
||||
List<String> existedIds = Lists.newArrayList();
|
||||
if (dto.isIzInc()) {
|
||||
List<ConfigServiceType> list = serviceTypeService.list();
|
||||
existedIds = list.stream().map(ConfigServiceType::getId).collect(Collectors.toList());
|
||||
}
|
||||
//传过来的所有数据
|
||||
List<ConfigServiceType> allData = BeanUtil.copyToList(dto.getTypeList(), ConfigServiceType.class);
|
||||
|
||||
//需要新增的数据
|
||||
List<ConfigServiceType> needAddData = Lists.newArrayList();
|
||||
for (ConfigServiceType type : allData) {
|
||||
if (!existedIds.contains(type.getId())) {
|
||||
needAddData.add(type);
|
||||
}
|
||||
}
|
||||
if (needAddData != null && !needAddData.isEmpty()) {
|
||||
serviceTypeService.insertAll(needAddData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
// /**
|
||||
// * 处理文件同步
|
||||
|
|
|
|||
|
|
@ -53,4 +53,18 @@ public class DynamicQueueNameProvider {
|
|||
public String getCreateMediaKeyName() {
|
||||
return getCreateMediaQueueName();
|
||||
}
|
||||
|
||||
public String getSyncDirectiveQueueName() {
|
||||
JSONObject deptInfo = sysBaseAPI.getDeptInfo();
|
||||
String orgCode = deptInfo.getString("code");
|
||||
if (StringUtils.isNotBlank(orgCode)) {
|
||||
return orgCode + ".directive.syncDirective";
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getSyncDirectiveKeyName() {
|
||||
return getSyncDirectiveQueueName();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,405 @@
|
|||
server:
|
||||
port: 8084
|
||||
tomcat:
|
||||
max-swallow-size: -1
|
||||
error:
|
||||
include-exception: true
|
||||
include-stacktrace: ALWAYS
|
||||
include-message: ALWAYS
|
||||
servlet:
|
||||
context-path: /biz103
|
||||
compression:
|
||||
enabled: true
|
||||
min-response-size: 1024
|
||||
mime-types: application/javascript,application/json,application/xml,text/html,text/xml,text/plain,text/css,image/*
|
||||
|
||||
management:
|
||||
endpoints:
|
||||
web:
|
||||
exposure:
|
||||
include: metrics,jeecghttptrace
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: nursing-unit-103
|
||||
config:
|
||||
import:
|
||||
- optional:nacos:${spring.application.name}.yaml # 你的服务专属配置
|
||||
- optional:nacos:common-db.yaml
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: nacos:8848 # 直接写死IP(或保留${config.server-addr})
|
||||
namespace: public
|
||||
group: DEFAULT_GROUP
|
||||
config:
|
||||
server-addr: nacos:8848
|
||||
namespace: public
|
||||
group: DEFAULT_GROUP
|
||||
file-extension: yaml
|
||||
# flyway配置
|
||||
flyway:
|
||||
# 是否启用flyway
|
||||
enabled: false
|
||||
# 编码格式,默认UTF-8
|
||||
encoding: UTF-8
|
||||
# 迁移sql脚本文件存放路径,官方默认db/migration
|
||||
locations: classpath:flyway/sql/mysql
|
||||
# 迁移sql脚本文件名称的前缀,默认V
|
||||
sql-migration-prefix: V
|
||||
# 迁移sql脚本文件名称的分隔符,默认2个下划线__
|
||||
sql-migration-separator: __
|
||||
# 避免带${}sql执行失败
|
||||
placeholder-prefix: '#('
|
||||
placeholder-suffix: )
|
||||
# 迁移sql脚本文件名称的后缀
|
||||
sql-migration-suffixes: .sql
|
||||
# 迁移时是否进行校验,默认true
|
||||
validate-on-migrate: true
|
||||
# 当迁移发现数据库非空且存在没有元数据的表时,自动执行基准迁移,新建schema_version表
|
||||
baseline-on-migrate: true
|
||||
# 是否关闭要清除已有库下的表功能,生产环境必须为true,否则会删库,非常重要!!!
|
||||
clean-disabled: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
mail:
|
||||
# 定时任务发送邮件
|
||||
timeJobSend: false
|
||||
host: smtp.163.com
|
||||
username: jeecgos@163.com
|
||||
password: ??
|
||||
properties:
|
||||
mail:
|
||||
smtp:
|
||||
auth: true
|
||||
starttls:
|
||||
enable: true
|
||||
required: true
|
||||
## quartz定时任务,采用数据库方式
|
||||
quartz:
|
||||
job-store-type: jdbc
|
||||
initialize-schema: embedded
|
||||
#定时任务启动开关,true-开 false-关
|
||||
auto-startup: true
|
||||
#延迟1秒启动定时任务
|
||||
startup-delay: 1s
|
||||
#启动时更新己存在的Job
|
||||
overwrite-existing-jobs: true
|
||||
properties:
|
||||
org:
|
||||
quartz:
|
||||
scheduler:
|
||||
instanceName: MyScheduler
|
||||
instanceId: AUTO
|
||||
jobStore:
|
||||
class: org.springframework.scheduling.quartz.LocalDataSourceJobStore
|
||||
driverDelegateClass: org.quartz.impl.jdbcjobstore.StdJDBCDelegate
|
||||
tablePrefix: QRTZ_
|
||||
isClustered: false
|
||||
misfireThreshold: 12000
|
||||
clusterCheckinInterval: 0 #心跳检查 之前是15000
|
||||
acquireTriggersWithinLock: false # 减少锁竞争
|
||||
threadPool:
|
||||
class: org.quartz.simpl.SimpleThreadPool
|
||||
threadCount: 10
|
||||
threadPriority: 5
|
||||
threadsInheritContextClassLoaderOfInitializingThread: true
|
||||
#json 时间戳统一转换
|
||||
jackson:
|
||||
date-format: yyyy-MM-dd HH:mm:ss
|
||||
time-zone: GMT+8
|
||||
jpa:
|
||||
open-in-view: false
|
||||
aop:
|
||||
proxy-target-class: true
|
||||
#配置freemarker
|
||||
freemarker:
|
||||
# 设置模板后缀名
|
||||
suffix: .ftl
|
||||
# 设置文档类型
|
||||
content-type: text/html
|
||||
# 设置页面编码格式
|
||||
charset: UTF-8
|
||||
# 设置页面缓存
|
||||
cache: false
|
||||
prefer-file-system-access: false
|
||||
# 设置ftl文件路径
|
||||
template-loader-path:
|
||||
- classpath:/templates
|
||||
template_update_delay: 0
|
||||
# 设置静态文件路径,js,css等
|
||||
mvc:
|
||||
static-path-pattern: /**
|
||||
#Spring Boot 2.6+后映射匹配的默认策略已从AntPathMatcher更改为PathPatternParser,需要手动指定为ant-path-matcher
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
resource:
|
||||
static-locations: classpath:/static/,classpath:/public/
|
||||
autoconfigure:
|
||||
exclude:
|
||||
- com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||
- org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration
|
||||
datasource:
|
||||
druid:
|
||||
stat-view-servlet:
|
||||
enabled: true
|
||||
loginUsername: admin
|
||||
loginPassword: 123456
|
||||
allow:
|
||||
web-stat-filter:
|
||||
enabled: true
|
||||
dynamic:
|
||||
druid: # 全局druid参数,绝大部分值和默认保持一致。(现已支持的参数如下,不清楚含义不要乱设置)
|
||||
# 连接池的配置信息
|
||||
# 初始化大小,最小,最大
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
maxActive: 1000
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 3600000
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
# 打开PSCache,并且指定每个连接上PSCache的大小
|
||||
poolPreparedStatements: true
|
||||
maxPoolPreparedStatementPerConnectionSize: 20
|
||||
# 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙
|
||||
filters: stat,wall,slf4j
|
||||
# 允许SELECT语句的WHERE子句是一个永真条件
|
||||
wall:
|
||||
selectWhereAlwayTrueCheck: false
|
||||
# 打开mergeSql功能;慢SQL记录
|
||||
stat:
|
||||
merge-sql: true
|
||||
slow-sql-millis: 5000
|
||||
datasource:
|
||||
master:
|
||||
url: jdbc:mysql://mysql8-prod:3306/nursing_unit_003?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: fw8864sshdang
|
||||
password: uGDBkM25I6nZCNM2
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置-运维系统
|
||||
multi-datasource1:
|
||||
url: jdbc:mysql://mysql8-prod:3306/nursing_unit?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: fw8864sshdang
|
||||
password: uGDBkM25I6nZCNM2
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# 多数据源配置-试验田 TODO 需要创建对应只读账号 不同服务器间需要更改ip端口 另外注意是否采用了VPC
|
||||
nuro:
|
||||
url: jdbc:mysql://mysql8-prod:3306/nursing_unit_001?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
|
||||
username: fw8864sshdang
|
||||
password: uGDBkM25I6nZCNM2
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
#redis 配置
|
||||
redis:
|
||||
database: 0
|
||||
host: redis
|
||||
port: 6379
|
||||
password: uUgrUus4JAYuwxzo
|
||||
rabbitmq:
|
||||
host: rabbitmq
|
||||
prot: 5672
|
||||
username: hldy
|
||||
password: SJ+lhRn6nZ43KeXE
|
||||
virtual-host: hldy
|
||||
#mybatis plus 设置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:com/nu/**/xml/*Mapper.xml
|
||||
global-config:
|
||||
# 关闭MP3.0自带的banner
|
||||
banner: false
|
||||
db-config:
|
||||
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
|
||||
id-type: ASSIGN_ID
|
||||
# 默认数据库表下划线命名
|
||||
table-underline: true
|
||||
configuration:
|
||||
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
# 返回类型为Map,显示null对应的字段
|
||||
call-setters-on-nulls: true
|
||||
#jeecg专用配置
|
||||
minidao:
|
||||
base-package: org.jeecg.modules.jmreport.*,org.jeecg.modules.drag.*
|
||||
jeecg:
|
||||
# AI集成
|
||||
ai-chat:
|
||||
enabled: true
|
||||
model: deepseek-chat
|
||||
apiKey: ??
|
||||
apiHost: https://api.deepseek.com
|
||||
timeout: 60
|
||||
# 平台上线安全配置
|
||||
firewall:
|
||||
# 数据源安全 (开启后,Online报表和图表的数据源为必填)
|
||||
dataSourceSafe: false
|
||||
# 低代码模式(dev:开发模式,prod:发布模式——关闭所有在线开发配置能力)
|
||||
lowCodeMode: dev
|
||||
# 签名密钥串(前后端要一致,正式发布请自行修改)
|
||||
signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
|
||||
#签名拦截接口
|
||||
signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys,/sys/sendChangePwdSms,/sys/user/sendChangePhoneSms,/sys/sms,/desform/api/sendVerifyCode
|
||||
# 本地:local、Minio:minio、阿里云:alioss
|
||||
uploadType: local
|
||||
# 前端访问地址
|
||||
domainUrl:
|
||||
pc: http://localhost:3100
|
||||
app: http://localhost:8051
|
||||
path:
|
||||
#文件上传根目录 设置
|
||||
upload: /opt/biz/upFiles103
|
||||
#webapp文件路径
|
||||
webapp: /opt/biz103/webapp
|
||||
shiro:
|
||||
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
|
||||
#阿里云oss存储和大鱼短信秘钥配置
|
||||
oss:
|
||||
accessKey: ??
|
||||
secretKey: ??
|
||||
endpoint: oss-cn-beijing.aliyuncs.com
|
||||
bucketName: jeecgdev
|
||||
# 短信模板
|
||||
sms-template:
|
||||
# 签名
|
||||
signature:
|
||||
# 模板code
|
||||
templateCode:
|
||||
# 登录短信、忘记密码模板编码
|
||||
SMS_175435174:
|
||||
# 修改密码短信模板编码
|
||||
SMS_465391221:
|
||||
# 注册账号短信模板编码
|
||||
SMS_175430166:
|
||||
# 在线预览文件服务器地址配置
|
||||
file-view-domain: http://fileview.jeecg.com
|
||||
# minio文件上传
|
||||
minio:
|
||||
minio_url: http://minio.jeecg.com
|
||||
minio_name: ??
|
||||
minio_pass: ??
|
||||
bucketName: otatest
|
||||
#大屏报表参数设置
|
||||
jmreport:
|
||||
#多租户模式,默认值为空(created:按照创建人隔离、tenant:按照租户隔离) (v1.6.2+ 新增)
|
||||
saasMode:
|
||||
# 平台上线安全配置(v1.6.2+ 新增)
|
||||
firewall:
|
||||
# 数据源安全 (开启后,不允许使用平台数据源、SQL解析加签并且不允许查询数据库)
|
||||
dataSourceSafe: false
|
||||
# 低代码开发模式(dev:开发模式,prod:发布模式—关闭在线报表设计功能,分配角色admin、lowdeveloper可以放开限制)
|
||||
lowCodeMode: dev
|
||||
#xxl-job配置
|
||||
xxljob:
|
||||
enabled: false
|
||||
adminAddresses: http://127.0.0.1:9080/xxl-job-admin
|
||||
appname: ${spring.application.name}
|
||||
accessToken: ''
|
||||
address: 127.0.0.1:30007
|
||||
ip: 127.0.0.1
|
||||
port: 30007
|
||||
logPath: logs/jeecg/job/jobhandler/
|
||||
logRetentionDays: 30
|
||||
#分布式锁配置
|
||||
redisson:
|
||||
address: 127.0.0.1:6379
|
||||
password:
|
||||
type: STANDALONE
|
||||
enabled: true
|
||||
# 百度开放API配置
|
||||
baidu-api:
|
||||
app-id: ??
|
||||
api-key: ??
|
||||
secret-key: ??
|
||||
# ElasticSearch 6设置
|
||||
elasticsearch:
|
||||
cluster-name: jeecg-ES
|
||||
cluster-nodes: 127.0.0.1:9200
|
||||
check-enabled: false
|
||||
#cas单点登录
|
||||
cas:
|
||||
prefixUrl: http://cas.example.org:8443/cas
|
||||
#Mybatis输出sql日志
|
||||
logging:
|
||||
level:
|
||||
org.flywaydb: debug
|
||||
org.jeecg.modules.system.mapper: info
|
||||
com.nu.modules.system.mapper: info
|
||||
#swagger
|
||||
knife4j:
|
||||
#开启增强配置
|
||||
enable: true
|
||||
#开启生产环境屏蔽
|
||||
production: false
|
||||
basic:
|
||||
enable: false
|
||||
username: jeecg
|
||||
password: jeecg1314
|
||||
#第三方登录
|
||||
justauth:
|
||||
enabled: true
|
||||
type:
|
||||
GITHUB:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/github/callback
|
||||
WECHAT_ENTERPRISE:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_enterprise/callback
|
||||
agent-id: ??
|
||||
DINGTALK:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/dingtalk/callback
|
||||
WECHAT_OPEN:
|
||||
client-id: ??
|
||||
client-secret: ??
|
||||
redirect-uri: http://sso.test.com:8080/jeecg-boot/sys/thirdLogin/wechat_open/callback
|
||||
cache:
|
||||
type: default
|
||||
prefix: 'demo::'
|
||||
timeout: 1h
|
||||
#tplink登录信息
|
||||
tplink:
|
||||
tums:
|
||||
url: https://121.36.88.64:8888
|
||||
username: admin
|
||||
password: Bl20230518
|
||||
ftp:
|
||||
ip: 1.92.152.160
|
||||
port: 21
|
||||
username: administrator
|
||||
password: Root@123..
|
||||
uploadpath: /
|
||||
|
||||
#zmy
|
||||
aliyun:
|
||||
ocr:
|
||||
accessKeyId: LTAI5tMoCTt4sb9VQrcnZFsb
|
||||
accessKeySecret: pQBMT6TlUWgRfvvDnOu0IKVYXCfKee
|
||||
#文件传输秘钥
|
||||
downloadkey: hP2K9Z!WLuj"M#8,
|
||||
|
||||
# 微信支付
|
||||
wxpay:
|
||||
# APIv3密钥
|
||||
api-v3-key: asdfiuzwe3534565478WETDSAFRWEq1E
|
||||
# APPID
|
||||
appid: wx8fc3e4305d2fbf0b
|
||||
# appsecret
|
||||
appsecret: 3bf3dd4ec72f591432db6b28c2c044e5
|
||||
# 商户ID
|
||||
mch-id: 1717618860
|
||||
# 商户API证书序列号
|
||||
mch-serial-no: 3E51C9D24F64CE50E9273E544561D29684AB21C7
|
||||
# 接收结果通知地址
|
||||
notify-domain: https://www.focusnu.com/nursing-unit_0010507/weiXinPay/callback
|
||||
# 商户私钥文件路径
|
||||
private-key-path: /opt/nu001/apiclient_key.pem
|
||||
9
pom.xml
9
pom.xml
|
|
@ -489,12 +489,15 @@
|
|||
<profile.name>uat102</profile.name>
|
||||
</properties>
|
||||
</profile>
|
||||
<!-- 生产 -->
|
||||
<profile>
|
||||
<id>prod</id>
|
||||
<id>uat103</id>
|
||||
<activation>
|
||||
<!--默认激活配置-->
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
<properties>
|
||||
<!--当前环境-->
|
||||
<profile.name>prod</profile.name>
|
||||
<profile.name>uat103</profile.name>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
|
|
|||
Loading…
Reference in New Issue