服务指令功能(临时提交 未完成)

This commit is contained in:
1378012178@qq.com 2025-07-11 15:42:43 +08:00
parent 1c2c70d077
commit 2e03763f87
6 changed files with 44 additions and 91 deletions

View File

@ -38,7 +38,7 @@ import java.util.stream.Collectors;
*/
@Api(tags = "服务指令")
@RestController
@RequestMapping("/services/serviceDirective/configServiceDirective")
@RequestMapping("/services/serviceDirective")
@Slf4j
public class ConfigServiceDirectiveController extends JeecgController<ConfigServiceDirective, IConfigServiceDirectiveService> {
@Autowired
@ -78,18 +78,18 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
directiveIds = configServiceDirectiveService.queryDirectiveIdByBodyTagIds(configServiceDirective.getBodyTags());
if (directiveIds != null && !directiveIds.isEmpty()) {
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
}else{
} else {
//体重标签下没有数据
queryWrapper.eq("id","null");
queryWrapper.eq("id", "null");
}
}
if (StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
directiveIds = configServiceDirectiveService.queryDirectiveIdByEmotionTagIds(configServiceDirective.getEmotionTags());
if (directiveIds != null && !directiveIds.isEmpty() && StringUtils.isNotBlank(configServiceDirective.getEmotionTags())) {
queryWrapper.in("id", directiveIds.stream().map(ConfigServiceDirective::getId).collect(Collectors.toList()));
}else{
} else {
//情绪标签下没有数据
queryWrapper.eq("id","null");
queryWrapper.eq("id", "null");
}
}
Page<ConfigServiceDirective> page = new Page<ConfigServiceDirective>(pageNo, pageSize);
@ -109,8 +109,9 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
@ApiOperation(value = "服务指令-添加", notes = "服务指令-添加")
@PostMapping(value = "/add")
public Result<String> add(@RequestBody ConfigServiceDirective configServiceDirective) {
//处理媒体资源
configServiceDirectiveService.handleMedia(configServiceDirective);
//处理媒体资源放在保存方法之前
configServiceDirectiveService.handleMediaFile(configServiceDirective);
log.info("服务指令保存时pre:{},immedia:{},mp3:{},mp4:{}",configServiceDirective.getPreviewFile(),configServiceDirective.getImmediateFile(),configServiceDirective.getMp3File(),configServiceDirective.getMp4File());
configServiceDirectiveService.save(configServiceDirective);
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
configServiceDirectiveService.saveBodyTags(configServiceDirective);
@ -123,7 +124,6 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
} else {
configServiceDirectiveService.removeEmotionTags(configServiceDirective);
}
return Result.OK("添加成功!");
}
@ -137,8 +137,9 @@ public class ConfigServiceDirectiveController extends JeecgController<ConfigServ
@ApiOperation(value = "服务指令-编辑", notes = "服务指令-编辑")
@RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
public Result<String> edit(@RequestBody ConfigServiceDirective configServiceDirective) {
//处理媒体资源
configServiceDirectiveService.handleMedia(configServiceDirective);
//处理媒体资源放在保存方法之前
configServiceDirectiveService.handleMediaFile(configServiceDirective);
log.info("服务指令保存时pre:{},immedia:{},mp3:{},mp4:{}",configServiceDirective.getPreviewFile(),configServiceDirective.getImmediateFile(),configServiceDirective.getMp3File(),configServiceDirective.getMp4File());
configServiceDirectiveService.updateById(configServiceDirective);
if (StringUtils.isNotBlank(configServiceDirective.getBodyTags())) {
configServiceDirectiveService.saveBodyTags(configServiceDirective);

View File

@ -128,36 +128,24 @@ public class ConfigServiceDirective implements Serializable {
//语音文件是否变更
@TableField(exist = false)
private boolean mp3FileChanged;
//语音文件路径
@TableField(exist = false)
private java.lang.String mp3FileMedia;
/**视频文件*/
@ApiModelProperty(value = "视频文件")
private java.lang.String mp4File;
//视频文件是否变更
@TableField(exist = false)
private boolean mp4FileChanged;
//视频文件路径
@TableField(exist = false)
private java.lang.String mp4FileMedia;
/**预览图片*/
@ApiModelProperty(value = "预览图片")
private java.lang.String previewFile;
//预览图片是否变更
@TableField(exist = false)
private boolean previewFileChanged;
//预览图片路径
@TableField(exist = false)
private java.lang.String previewFileMedia;
/**即时指令图片*/
@ApiModelProperty(value = "即时指令图片")
private java.lang.String immediateFile;
//即时指令图片是否变更
@TableField(exist = false)
private boolean immediateFileChanged;
//即时指令图片路径
@TableField(exist = false)
private java.lang.String immediateFileMedia;
//合并单元格用类别合并的行数
@TableField(exist = false)
@ -174,12 +162,6 @@ public class ConfigServiceDirective implements Serializable {
//情绪标签id,id,id
@TableField(exist = false)
private String emotionTags;
@TableField(exist = false)
//服务类别名称
private String categoryName;
//服务类型名称
@TableField(exist = false)
private String typeName;
//体型标签
@ -195,4 +177,20 @@ public class ConfigServiceDirective implements Serializable {
//情绪标签字符串
@TableField(exist = false)
private String emotionTagsName;
//分类标签中文名称
@TableField(exist = false)
private String instructionName;
//服务类别中文名称
@TableField(exist = false)
private String categoryName;
//服务类型中文名称
@TableField(exist = false)
private String typeName;
//周期类型中文名称
@TableField(exist = false)
private String cycleTypeName;
//媒体资源存储路径名
@TableField(exist = false)
private String mediaFileSavePath;
}

View File

@ -10,35 +10,39 @@ import java.util.List;
/**
* @Description: 服务指令
* @Author: 张明远
* @Date: 2025-03-13
* @Date: 2025-03-13
* @Version: V1.0
*/
public interface IConfigServiceDirectiveService extends IService<ConfigServiceDirective> {
void merge(List<ConfigServiceDirective> records);
List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective,IPage<ConfigServiceDirective> list);
List<ConfigServiceDirective> pageList(ConfigServiceDirective configServiceDirective, IPage<ConfigServiceDirective> list);
/**
* 存储体型标签数据
*
* @param configServiceDirective
*/
void saveBodyTags(ConfigServiceDirective configServiceDirective);
/**
* 存储情绪标签数据
*
* @param configServiceDirective
*/
void saveEmotionTags(ConfigServiceDirective configServiceDirective);
/**
* 移除改服务指令下体型标签
*
* @param configServiceDirective
*/
void removeBodyTags(ConfigServiceDirective configServiceDirective);
/**
* 移除改服务指令下情绪标签
*
* @param configServiceDirective
*/
void removeEmotionTags(ConfigServiceDirective configServiceDirective);
@ -53,7 +57,5 @@ public interface IConfigServiceDirectiveService extends IService<ConfigServiceDi
void insertAllDirectives(List<ConfigServiceDirective> directives);
void handleMedia(ConfigServiceDirective configServiceDirective);
// List<JSONObject> selectMediaList(String dataSourceCode, List<String> idList);
void handleMediaFile(ConfigServiceDirective configServiceDirective);
}

View File

@ -1,6 +1,5 @@
package com.nu.modules.servicedirective.service.impl;
import cn.hutool.json.JSONObject;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -15,13 +14,9 @@ import com.nu.utils.RabbitMQUtil;
import org.jeecg.common.system.api.ISysBaseAPI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* @Description: 服务指令
@ -32,8 +27,6 @@ import java.util.stream.Stream;
@Service
public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigServiceDirectiveMapper, ConfigServiceDirective> implements IConfigServiceDirectiveService {
// @Autowired
// private IMediaManageApi mediaManageApi;
@Autowired
private ISysConfigApi sysConfigApi;
@Autowired
@ -56,23 +49,6 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
List<DirectiveEmotionTag> emotionTagList = record.getEmotionTagList();
record.setEmotionTags(emotionTagList.stream().map(DirectiveEmotionTag::getId).collect(Collectors.joining(",")));
});
//处理媒体资源转换
{
List<String> meidsIds = list.stream().flatMap(directive -> Stream.of(directive.getMp3File(), directive.getMp4File(), directive.getPreviewFile(), directive.getImmediateFile())).filter(Objects::nonNull).distinct().collect(Collectors.toList());
// if (!CollectionUtils.isEmpty(meidsIds)) {
// List<JSONObject> mediaObjs = mediaManageApi.queryByIds(meidsIds);
//
// Map<String, String> idToFilePathMap = mediaObjs.stream().collect(Collectors.toMap(media -> media.getStr("id"), media -> media.getStr("filePath")));
//
// list.stream().forEach(record -> {
// record.setPreviewFileMedia(idToFilePathMap.get(record.getPreviewFile()));
// record.setImmediateFileMedia(idToFilePathMap.get(record.getImmediateFile()));
// record.setMp3FileMedia(idToFilePathMap.get(record.getMp3File()));
// record.setMp4FileMedia(idToFilePathMap.get(record.getMp4File()));
// });
// }
}
}
//处理单元格合并所需数据
merge(list);
@ -242,35 +218,16 @@ public class ConfigServiceDirectiveServiceImpl extends ServiceImpl<ConfigService
});
}
/**
* 处理资源文件
* 1检测各资源文件的存储路径是否跟路径字段的值一致
* 2如果不一致1检测缺少的路径新建目录 2然后把资源挪到新路径中 3修改媒体资源对应字段的值的路径名
*
* @param configServiceDirective
*/
@Override
public void handleMedia(ConfigServiceDirective configServiceDirective) {
// Map<String, String> params = Maps.newHashMap();
// params.put("sysFunc", "directive");
// if (configServiceDirective.isImmediateFileChanged()) {
// params.put("fileName", configServiceDirective.getDirectiveName() + "预览图片");
// params.put("descr", "服务指令用户上传图片:" + configServiceDirective.getDirectiveName() + "预览图片");
// configServiceDirective.setImmediateFile((mediaManageApi.saveByPath(configServiceDirective.getImmediateFileMedia(), params)));
// }
// if (configServiceDirective.isPreviewFileChanged()) {
// params.put("fileName", configServiceDirective.getDirectiveName() + "即时指令图片");
// params.put("descr", "服务指令用户上传图片:" + configServiceDirective.getDirectiveName() + "即时指令图片");
// configServiceDirective.setPreviewFile(mediaManageApi.saveByPath(configServiceDirective.getPreviewFileMedia(), params));
// }
// if (configServiceDirective.isMp3FileChanged()) {
// params.put("fileName", configServiceDirective.getDirectiveName() + "音频文件");
// params.put("descr", "服务指令用户上传音频:" + configServiceDirective.getDirectiveName() + "音频文件");
// configServiceDirective.setMp3File(mediaManageApi.saveByPath(configServiceDirective.getMp3FileMedia(), params));
// }
// if (configServiceDirective.isMp4FileChanged()) {
// params.put("fileName", configServiceDirective.getDirectiveName() + "视频文件");
// params.put("descr", "服务指令用户上传视频:" + configServiceDirective.getDirectiveName() + "视频文件");
// configServiceDirective.setMp4File(mediaManageApi.saveByPath(configServiceDirective.getMp4FileMedia(), params));
// }
public void handleMediaFile(ConfigServiceDirective configServiceDirective) {
}
// @Override
// public List<JSONObject> selectMediaList(String dataSourceCode, List<String> idList) {
// return mediaManageApi.selectByDirectiveIds(dataSourceCode, idList);
// }
}

View File

@ -205,7 +205,7 @@ spring:
password:
#rabbitmq 配置
rabbitmq:
host: 192.168.2.199
host: 192.168.2.1991
prot: 5672
username: hldy
password: hldy
@ -254,13 +254,10 @@ jeecg:
pc: http://localhost:3100
app: http://localhost:8051
path:
#服务指令上传目录
directivepath: /cache/nu/opt/upFiles/directive
#文件上传根目录 设置
upload: /cache/ope/opt/upFiles
#webapp文件路径
webapp: /cache/ope/opt/webapp
webapp1: /abc
shiro:
excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
#阿里云oss存储和大鱼短信秘钥配置

View File

@ -253,8 +253,6 @@ jeecg:
pc: http://localhost:3100
app: http://localhost:8051
path:
#服务指令上传目录
directivepath: /opt/upFiles/directive
#文件上传根目录 设置
upload: /opt/ope/upFiles
#webapp文件路径