矩阵编排服务指令树调整:返回结果变为map格式,内容分别为原本的服务指令树,新增的即时指令树(服务类别category+所有指令,无服务类型type)

This commit is contained in:
1378012178@qq.com 2026-01-22 09:37:05 +08:00
parent 09b2aba3ab
commit edb7c7c9ae
6 changed files with 197 additions and 141 deletions

View File

@ -40,9 +40,8 @@ public class CareDirectiveApi {
* @return
*/
@GetMapping(value = "/getServiceTree")
public Result<List<Map<String, Object>>> getServiceTree() {
List<Map<String, Object>> treeList = directiveConfigApi.getServiceTree("1");
return Result.OK(treeList);
public Result<Map<String, Object>> getServiceTree() {
return Result.OK(directiveConfigApi.getServiceTree("1"));
}
/**

View File

@ -36,9 +36,8 @@ public class InvoicingDirectiveApi {
* @return
*/
@GetMapping(value = "/getServiceTree")
public Result<List<Map<String,Object>>> getServiceTree() {
List<Map<String,Object>> treeList = directiveConfigApi.getServiceTree("3");
return Result.OK(treeList);
public Result<Map<String, Object>> getServiceTree() {
return Result.OK(directiveConfigApi.getServiceTree("3"));
}

View File

@ -16,11 +16,11 @@ import java.util.Map;
/**
* @Description: 行政类服务指令计划API
* @Author: caolei
* @Date: 2026-1-6
* @Version: V1.0
*/
* @Description: 行政类服务指令计划API
* @Author: caolei
* @Date: 2026-1-6
* @Version: V1.0
*/
@RestController
@RequestMapping("/api/pad/logistics/directive")
@ -39,9 +39,8 @@ public class LogisticsDirectiveApi {
* @return
*/
@GetMapping(value = "/getServiceTree")
public Result<List<Map<String,Object>>> getServiceTree() {
List<Map<String,Object>> treeList = directiveConfigApi.getServiceTree("4");
return Result.OK(treeList);
public Result<Map<String, Object>> getServiceTree() {
return Result.OK(directiveConfigApi.getServiceTree("4"));
}
@ -52,8 +51,8 @@ public class LogisticsDirectiveApi {
* @return
*/
@GetMapping(value = "/getNclist")
public Result<Map<String,Object>> getPlanList(LogisticsDirectiveEntity logisticsDirectiveEntity) {
Map<String,Object> pageList = logisticsDirectivePlanApi.getPlanList(logisticsDirectiveEntity);
public Result<Map<String, Object>> getPlanList(LogisticsDirectiveEntity logisticsDirectiveEntity) {
Map<String, Object> pageList = logisticsDirectivePlanApi.getPlanList(logisticsDirectiveEntity);
return Result.OK(pageList);
}

View File

@ -4,5 +4,5 @@ import java.util.List;
import java.util.Map;
public interface IDirectiveConfigApi {
List<Map<String, Object>> getServiceTree(String instructionType);
Map<String, Object> getServiceTree(String instructionType);
}

View File

@ -1,19 +1,17 @@
package com.nu.modules.biz.common.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.nu.modules.biz.common.entity.BizConfigInstructionTag;
import com.nu.modules.biz.common.entity.BizConfigServiceCategory;
import com.nu.modules.biz.common.entity.BizConfigServiceDirective;
import com.nu.modules.biz.common.entity.BizConfigServiceType;
import com.nu.modules.biz.common.entity.BizConfigInstructionTag;
import com.nu.modules.biz.common.mapper.BizConfigServiceCategoryMapper;
import com.nu.modules.biz.common.service.IBizConfigInstructionTagService;
import com.nu.modules.biz.common.service.IBizConfigServiceCategoryService;
import com.nu.modules.biz.common.service.IBizConfigServiceDirectiveService;
import com.nu.modules.biz.common.service.IBizConfigServiceTypeService;
import com.nu.modules.biz.common.service.IBizConfigInstructionTagService;
import com.nu.modules.config.IDirectiveConfigApi;
import com.nu.modules.sysconfig.ISysConfigApi;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -38,15 +36,133 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
private IBizConfigServiceTypeService configServiceTypeService;
@Autowired
private IBizConfigServiceDirectiveService configServiceDirectiveService;
@Autowired
private ISysConfigApi sysConfigApi;
// @Override
// public Map<String, Object> getServiceTree(String instructionType) {
// Map<String, Object> result = new HashMap();
// //查询护理类服务
// QueryWrapper<BizConfigInstructionTag> instructionTagQueryWrapper = new QueryWrapper<>();
// instructionTagQueryWrapper.eq("iz_enabled", "Y");
// instructionTagQueryWrapper.eq("del_flag", "0");
// instructionTagQueryWrapper.eq("instruction_type", instructionType);
// List<BizConfigInstructionTag> instructionTagList = instructionTagService.list(instructionTagQueryWrapper);
// Map<String, Object> tagMap = new HashMap<String, Object>();
// for (BizConfigInstructionTag par : instructionTagList) {
// tagMap.put(par.getId(), par.getInstructionName());
// }
//
// //查询服务类别数据
// QueryWrapper<BizConfigServiceCategory> categoryQueryWrapper = new QueryWrapper<>();
// categoryQueryWrapper.eq("iz_enabled", "Y");
// categoryQueryWrapper.eq("del_flag", "0");
// List<BizConfigServiceCategory> categoryList = baseMapper.selectList(categoryQueryWrapper);
// //查询服务类型数据
// QueryWrapper<BizConfigServiceType> typeQueryWrapper = new QueryWrapper<>();
// typeQueryWrapper.eq("iz_enabled", "Y");
// typeQueryWrapper.eq("del_flag", "0");
// List<BizConfigServiceType> typeList = configServiceTypeService.list(typeQueryWrapper);
// //查询服务指令数据
// QueryWrapper<BizConfigServiceDirective> directiveQueryWrapper = new QueryWrapper<>();
//// directiveQueryWrapper.eq("cycle_type", "1");
// directiveQueryWrapper.eq("iz_enabled", "Y");
// directiveQueryWrapper.eq("del_flag", "0");
// List<BizConfigServiceDirective> directiveList = configServiceDirectiveService.list(directiveQueryWrapper);
//
// //封装服务指令和服务类型tree集合
// List<Map<String, Object>> typeMapList = new ArrayList<>();
// for (BizConfigServiceType par : typeList) {
// Map<String, Object> wllxMap = new HashMap<String, Object>();
// List<Map<String, Object>> directiceMapList = new ArrayList<Map<String, Object>>();
// for (BizConfigServiceDirective directicePar : directiveList) {
// if (StringUtils.equals(directicePar.getTypeId(), par.getId())) {
// Map<String, Object> directiceMap = new HashMap<String, Object>();
// directiceMap.put("id", directicePar.getId());
// directiceMap.put("title", directicePar.getDirectiveName());
// directiceMap.put("serviceDuration", directicePar.getServiceDuration());
// directiceMap.put("serviceContent", directicePar.getServiceContent());
// directiceMap.put("categoryId", directicePar.getCategoryId());
// directiceMap.put("categoryName", directicePar.getCategoryName());
// directiceMap.put("typeId", directicePar.getTypeId());
// directiceMap.put("typeName", directicePar.getTypeName());
// directiceMap.put("izPackage", "N");
// if (directicePar.getImmediateFile() != null && !directicePar.getImmediateFile().equals("")) {
// directiceMap.put("immediateFile", directicePar.getImmediateFile());
// } else {
// directiceMap.put("immediateFile", "");
// }
// if (directicePar.getImmediateFileFocus() != null && !directicePar.getImmediateFileFocus().equals("")) {
// directiceMap.put("immediateFileFocus", directicePar.getImmediateFileFocus());
// } else {
// directiceMap.put("immediateFileFocus", "");
// }
// if (directicePar.getPreviewFile() != null && !directicePar.getPreviewFile().equals("")) {
// directiceMap.put("previewFile", directicePar.getPreviewFile());
// } else {
// directiceMap.put("previewFile", "");
// }
// if (directicePar.getPreviewFileSmall() != null && !directicePar.getPreviewFileSmall().equals("")) {
// directiceMap.put("previewFileSmall", directicePar.getPreviewFileSmall());
// } else {
// directiceMap.put("previewFileSmall", "");
// }
// if (directicePar.getMp3File() != null && !directicePar.getMp3File().equals("")) {
// directiceMap.put("mp3File", directicePar.getMp3File());
// } else {
// directiceMap.put("mp3File", "");
// }
// if (directicePar.getMp4File() != null && !directicePar.getMp4File().equals("")) {
// directiceMap.put("mp4File", directicePar.getMp4File());
// } else {
// directiceMap.put("mp4File", "");
// }
// directiceMap.put("levle", "3");
// directiceMapList.add(directiceMap);
// }
// }
// wllxMap.put("key", par.getId());
// wllxMap.put("parentId", par.getCategoryId());
// wllxMap.put("title", par.getTypeName());
// wllxMap.put("netFlag", par.getNetFlag());
// wllxMap.put("animationPath", par.getAnimationPath());
// wllxMap.put("levle", "2");
// wllxMap.put("children", directiceMapList);
// typeMapList.add(wllxMap);
// }
//
// //封装服务类别服务类型tree集合
// List<Map<String, Object>> treeList = new ArrayList<>();
// int index = 0;
// for (BizConfigServiceCategory par : categoryList) {
// index++;
// Map<String, Object> infoMap = new HashMap<String, Object>();
// List<Map<String, Object>> wllxMap2List = new ArrayList<Map<String, Object>>();
// for (Map<String, Object> wllxPar : typeMapList) {
// if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
// wllxMap2List.add(wllxPar);
// }
// }
// if (tagMap.get(par.getInstructionId()) != null) {
//
// infoMap.put("key", par.getId());
// infoMap.put("title", par.getCategoryName().substring(0, 2));
// infoMap.put("netFlag", par.getNetFlag());
// infoMap.put("animationPath", par.getAnimationPath());
// infoMap.put("levle", "1");
// infoMap.put("children", wllxMap2List);
// treeList.add(infoMap);
// }
// }
// result.put("fwzl", treeList);
// result.put("jszl", null);
// return result;
// }
@Override
public List<Map<String, Object>> getServiceTree(String instructionType) {
//缓存媒体地址
String mediaAddress = getOpeMediaAddress();
public Map<String, Object> getServiceTree(String instructionType) {
Map<String, Object> result = new HashMap<>();
//查询护理类服务
// 查询护理类服务
QueryWrapper<BizConfigInstructionTag> instructionTagQueryWrapper = new QueryWrapper<>();
instructionTagQueryWrapper.eq("iz_enabled", "Y");
instructionTagQueryWrapper.eq("del_flag", "0");
@ -57,24 +173,25 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
tagMap.put(par.getId(), par.getInstructionName());
}
//查询服务类别数据
// 查询服务类别数据
QueryWrapper<BizConfigServiceCategory> categoryQueryWrapper = new QueryWrapper<>();
categoryQueryWrapper.eq("iz_enabled", "Y");
categoryQueryWrapper.eq("del_flag", "0");
List<BizConfigServiceCategory> categoryList = baseMapper.selectList(categoryQueryWrapper);
//查询服务类型数据
// 查询服务类型数据
QueryWrapper<BizConfigServiceType> typeQueryWrapper = new QueryWrapper<>();
typeQueryWrapper.eq("iz_enabled", "Y");
typeQueryWrapper.eq("del_flag", "0");
List<BizConfigServiceType> typeList = configServiceTypeService.list(typeQueryWrapper);
//查询服务指令数据
// 查询服务指令数据
QueryWrapper<BizConfigServiceDirective> directiveQueryWrapper = new QueryWrapper<>();
// directiveQueryWrapper.eq("cycle_type", "1");
directiveQueryWrapper.eq("iz_enabled", "Y");
directiveQueryWrapper.eq("del_flag", "0");
List<BizConfigServiceDirective> directiveList = configServiceDirectiveService.list(directiveQueryWrapper);
//封装服务指令和服务类型tree集合
// 封装服务指令和服务类型tree集合
List<Map<String, Object>> typeMapList = new ArrayList<>();
for (BizConfigServiceType par : typeList) {
Map<String, Object> wllxMap = new HashMap<String, Object>();
@ -91,54 +208,15 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
directiceMap.put("typeId", directicePar.getTypeId());
directiceMap.put("typeName", directicePar.getTypeName());
directiceMap.put("izPackage", "N");
if (directicePar.getImmediateFile() != null&&!directicePar.getImmediateFile().equals("")) {
String immediateFile = getImageNetUrl(directicePar.getImmediateFile(), mediaAddress);
directiceMap.put("immediateFile", directicePar.getImmediateFile());
directiceMap.put("netImmediateFile", immediateFile);
} else {
directiceMap.put("immediateFile", "");
directiceMap.put("netImmediateFile", "");
}
if (directicePar.getImmediateFileFocus() != null&&!directicePar.getImmediateFileFocus().equals("")) {
String immediateFileFocus = getImageNetUrl(directicePar.getImmediateFileFocus(), mediaAddress);
directiceMap.put("immediateFileFocus", directicePar.getImmediateFileFocus());
directiceMap.put("netImmediateFileFocus", immediateFileFocus);
} else {
directiceMap.put("immediateFileFocus", "");
directiceMap.put("netImmediateFileFocus", "");
}
if (directicePar.getPreviewFile() != null&&!directicePar.getPreviewFile().equals("")) {
String previewFile = getImageNetUrl(directicePar.getPreviewFile(), mediaAddress);
directiceMap.put("previewFile", directicePar.getPreviewFile());
directiceMap.put("netPreviewFile", previewFile);
} else {
directiceMap.put("previewFile", "");
directiceMap.put("netPreviewFile", "");
}
if (directicePar.getPreviewFileSmall() != null&&!directicePar.getPreviewFileSmall().equals("")) {
String previewFileSmall = getImageNetUrl(directicePar.getPreviewFileSmall(), mediaAddress);
directiceMap.put("previewFileSmall", directicePar.getPreviewFileSmall());
directiceMap.put("netPreviewFileSmall", previewFileSmall);
} else {
directiceMap.put("previewFileSmall", "");
directiceMap.put("netPreviewFileSmall", "");
}
if (directicePar.getMp3File() != null&&!directicePar.getMp3File().equals("")) {
String mp3File = getImageNetUrl(directicePar.getMp3File(), mediaAddress);
directiceMap.put("mp3File", directicePar.getMp3File());
directiceMap.put("netMp3File", mp3File);
} else {
directiceMap.put("mp3File", "");
directiceMap.put("netMp3File", "");
}
if (directicePar.getMp4File() != null&&!directicePar.getMp4File().equals("")) {
String mp4File = getImageNetUrl(directicePar.getMp4File(), mediaAddress);
directiceMap.put("mp4File", directicePar.getMp4File());
directiceMap.put("netMp4File", mp4File);
} else {
directiceMap.put("mp4File", "");
directiceMap.put("netMp4File", "");
}
// 处理文件字段
directiceMap.put("immediateFile", StringUtils.isNotBlank(directicePar.getImmediateFile()) ? directicePar.getImmediateFile() : "");
directiceMap.put("immediateFileFocus", StringUtils.isNotBlank(directicePar.getImmediateFileFocus()) ? directicePar.getImmediateFileFocus() : "");
directiceMap.put("previewFile", StringUtils.isNotBlank(directicePar.getPreviewFile()) ? directicePar.getPreviewFile() : "");
directiceMap.put("previewFileSmall", StringUtils.isNotBlank(directicePar.getPreviewFileSmall()) ? directicePar.getPreviewFileSmall() : "");
directiceMap.put("mp3File", StringUtils.isNotBlank(directicePar.getMp3File()) ? directicePar.getMp3File() : "");
directiceMap.put("mp4File", StringUtils.isNotBlank(directicePar.getMp4File()) ? directicePar.getMp4File() : "");
directiceMap.put("levle", "3");
directiceMapList.add(directiceMap);
}
@ -147,85 +225,64 @@ public class BizConfigServiceCategoryServiceImpl extends ServiceImpl<BizConfigSe
wllxMap.put("parentId", par.getCategoryId());
wllxMap.put("title", par.getTypeName());
wllxMap.put("netFlag", par.getNetFlag());
List<String> imagePaths = new ArrayList<>();
if (par.getAnimationPath() != null) {
imagePaths = getImageNetUrls(par.getAnimationPath(), mediaAddress);
}
wllxMap.put("animationPath", imagePaths);
wllxMap.put("animationPath", par.getAnimationPath());
wllxMap.put("levle", "2");
wllxMap.put("children", directiceMapList);
typeMapList.add(wllxMap);
}
//封装服务类别服务类型tree集合
// 封装服务类别服务类型tree集合fwzl
List<Map<String, Object>> treeList = new ArrayList<>();
int index = 0;
// 封装服务类别直接关联服务指令tree集合jszl
List<Map<String, Object>> jszlTreeList = new ArrayList<>();
for (BizConfigServiceCategory par : categoryList) {
index++;
Map<String, Object> infoMap = new HashMap<String, Object>();
List<Map<String, Object>> wllxMap2List = new ArrayList<Map<String, Object>>();
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
wllxMap2List.add(wllxPar);
}
}
if (tagMap.get(par.getInstructionId()) != null) {
// 1. 处理 fwzl二级+三级+四级
Map<String, Object> infoMap = new HashMap<String, Object>();
List<Map<String, Object>> wllxMap2List = new ArrayList<Map<String, Object>>();
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
wllxMap2List.add(wllxPar);
}
}
infoMap.put("key", par.getId());
infoMap.put("title", par.getCategoryName().substring(0, 2));
infoMap.put("title", par.getCategoryName().substring(0, 2)); // 保持原有逻辑
infoMap.put("netFlag", par.getNetFlag());
List<String> imagePaths = new ArrayList<>();
if (par.getAnimationPath() != null) {
imagePaths = getImageNetUrls(par.getAnimationPath(), mediaAddress);
}
infoMap.put("animationPath", imagePaths);
infoMap.put("animationPath", par.getAnimationPath());
infoMap.put("levle", "1");
infoMap.put("children", wllxMap2List);
treeList.add(infoMap);
}
}
return treeList;
}
/**
* 获取管理平台静态资源路径
*
* @return
*/
private String getOpeMediaAddress() {
JSONObject json = sysConfigApi.getByKey("ope_media_address");
if (json != null) {
String configValue = json.getString("configValue");
if (!configValue.endsWith("/")) {
configValue += "/";
}
return configValue;
}
return "";
}
// 2. 处理 jszl二级+四级跳过三级
Map<String, Object> jszlMap = new HashMap<String, Object>();
List<Map<String, Object>> jszlChildren = new ArrayList<Map<String, Object>>();
private String getImageNetUrl(String imageUrl, String mediaAddress) {
String netUrl = "";
// String configValue = getOpeMediaAddress();
if (!mediaAddress.equals("")) {
netUrl = mediaAddress + imageUrl;
}
return netUrl;
}
private List<String> getImageNetUrls(String imageUrl, String mediaAddress) {
List<String> imagePaths = new ArrayList<>();
// String configValue = getOpeMediaAddress();
if (!mediaAddress.equals("")) {
String[] urls = imageUrl.split(",");
for (String url : urls) {
if (!url.isEmpty()) {
String netUrl = mediaAddress + url;
imagePaths.add(netUrl);
// 收集该二级节点下所有的四级节点
for (Map<String, Object> wllxPar : typeMapList) {
if (StringUtils.equals(par.getId(), wllxPar.get("parentId").toString())) {
List<Map<String, Object>> children = (List<Map<String, Object>>) wllxPar.get("children");
if (children != null && !children.isEmpty()) {
jszlChildren.addAll(children);
}
}
}
jszlMap.put("key", par.getId());
jszlMap.put("title", par.getCategoryName().substring(0, 2)); // 保持原有逻辑
jszlMap.put("netFlag", par.getNetFlag());
jszlMap.put("animationPath", par.getAnimationPath());
jszlMap.put("levle", "1");
jszlMap.put("children", jszlChildren);
jszlTreeList.add(jszlMap);
}
}
return imagePaths;
}
result.put("fwzl", treeList);
result.put("jszl", jszlTreeList);
return result;
}
}

View File

@ -34,6 +34,7 @@
<result property="chargingFrequency" column="charging_frequency"/>
<result property="serviceContent" column="service_content"/>
<result property="serviceDuration" column="service_duration"/>
<result property="timeoutDuration" column="directive_timeout_duration"/>
<result property="izEnabled" column="directive_iz_enabled"/>
<result property="delFlag" column="directive_del_flag"/>
<result property="createBy" column="directive_create_by"/>
@ -112,6 +113,7 @@
csd.charging_frequency,
csd.service_content,
csd.service_duration,
csd.timeout_duration as directive_timeout_duration,
csd.iz_enabled AS directive_iz_enabled,
csd.del_flag AS directive_del_flag,
csd.create_by AS directive_create_by,