启动脚本+数据总览
This commit is contained in:
17
.idea/dataSources.xml
generated
Normal file
17
.idea/dataSources.xml
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="spdm_baseline@192.168.65.161" uuid="c854839d-329f-49dd-bc0e-6f0d94d33435">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://192.168.65.161:3306/spdm_baseline?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=Asia/Shanghai</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/data_source_mapping.xml
generated
Normal file
6
.idea/data_source_mapping.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourcePerFileMappings">
|
||||
<file url="file://$APPLICATION_CONFIG_DIR$/consoles/db/c854839d-329f-49dd-bc0e-6f0d94d33435/console.sql" value="c854839d-329f-49dd-bc0e-6f0d94d33435" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -1,43 +0,0 @@
|
||||
package com.sdm.common.entity.enums;
|
||||
|
||||
import com.sdm.common.entity.data.IData;
|
||||
|
||||
public enum NodeType {
|
||||
PHASE( "阶段", 1, IData.DATA_TYPE.PHASE),
|
||||
DISCIPLINE("学科", 2, IData.DATA_TYPE.DISCIPLINE),
|
||||
SYSTEM("系统", 3, IData.DATA_TYPE.SYSTEM),
|
||||
TASK_GROUP("任务组", 4, IData.DATA_TYPE.TASK_GROUP);
|
||||
|
||||
private final String name;
|
||||
private final int code;
|
||||
private final IData.DATA_TYPE dataType;
|
||||
private NodeType(String name, int code, IData.DATA_TYPE dataType) {
|
||||
this.dataType = dataType;
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public int getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public IData.DATA_TYPE getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public static IData.DATA_TYPE getDataTypeByCode(int code) {
|
||||
IData.DATA_TYPE dataType = null;
|
||||
switch (code) {
|
||||
case 1 -> dataType = IData.DATA_TYPE.PHASE;
|
||||
case 2 -> dataType = IData.DATA_TYPE.DISCIPLINE;
|
||||
case 3 -> dataType = IData.DATA_TYPE.SYSTEM;
|
||||
case 4 -> dataType = IData.DATA_TYPE.TASK_GROUP;
|
||||
default -> dataType = IData.DATA_TYPE.INHERIT_TYPE;
|
||||
}
|
||||
return dataType;
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,11 @@ package com.sdm.common.entity.enums;
|
||||
|
||||
public enum NodeTypeEnum {
|
||||
NODE("node"),
|
||||
PROJECT("project"),
|
||||
PHASE("phase"),
|
||||
DISCIPLINE("discipline"),
|
||||
MACHINE("machine"),
|
||||
WORKSPACE("workspace"),
|
||||
TASK("task"),
|
||||
RUN("run"),
|
||||
PERFORMANCE("performance");
|
||||
|
||||
@@ -9,8 +9,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class UserListReq extends BaseReq {
|
||||
@Schema(description = "租户ID")
|
||||
@NotNull(message = "租户ID不能为空")
|
||||
private Long tenantId = 1979091834410176514L;
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "用户ID")
|
||||
private Long userId;
|
||||
|
||||
@@ -26,5 +26,5 @@ public class UserQueryReq {
|
||||
@Schema(description = "用户IDS")
|
||||
private List<Long> userIds;
|
||||
|
||||
private Long tenantId = 1979091834410176514L;
|
||||
private Long tenantId;
|
||||
}
|
||||
@@ -23,9 +23,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
SdmResponse<List<FileMetadataInfoResp> > response;
|
||||
try {
|
||||
response = dataClient.listDir(dirType,parentDirId);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("创建文件夹失败");
|
||||
}
|
||||
log.info("查询文件夹列表响应:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("创建文件夹失败", e);
|
||||
@@ -37,9 +35,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = dataClient.createDir(req);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("创建文件夹失败");
|
||||
}
|
||||
log.info("创建文响应件夹:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("创建文件夹失败", e);
|
||||
@@ -52,9 +48,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = dataClient.renameDirNew(req);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("重命名文件夹失败");
|
||||
}
|
||||
log.info("重命名文件夹响应:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("重命名文件夹失败", e);
|
||||
@@ -67,9 +61,7 @@ public class DataClientFeignClientImpl implements IDataFeignClient {
|
||||
SdmResponse response;
|
||||
try {
|
||||
response = dataClient.delDir(req);
|
||||
if (!response.isSuccess()) {
|
||||
return SdmResponse.failed("删除文件夹失败");
|
||||
}
|
||||
log.info("删除文件夹响应:"+ response);
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("删除文件夹失败", e);
|
||||
|
||||
@@ -36,7 +36,7 @@ public interface ISimulationNodeFeignClient {
|
||||
SdmResponse delteNode(@RequestBody DelNodeReq req);
|
||||
|
||||
// 项目列表
|
||||
@GetMapping("/list")
|
||||
@GetMapping("/node/list")
|
||||
SdmResponse list(@RequestBody SpdmNodeListReq req);
|
||||
|
||||
|
||||
|
||||
@@ -3,17 +3,21 @@ package com.sdm.data.controller;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.req.*;
|
||||
import com.sdm.data.service.IDimensionTemplateService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 数据总览
|
||||
*
|
||||
@@ -35,7 +39,7 @@ public class DataOverviewController {
|
||||
*/
|
||||
@PostMapping("/getSimulationNodeTree")
|
||||
@Operation(summary = "根据数据显示维度展示左侧节点树")
|
||||
public SdmResponse getSimulationNodeTree(@RequestBody GetSimulationNodeTreeReq req) {
|
||||
public SdmResponse<List<FileMetadataInfo>> getSimulationNodeTree(@RequestBody GetSimulationNodeTreeReq req) {
|
||||
return dimensionTemplateService.getSimulationNodeTree(req);
|
||||
}
|
||||
|
||||
@@ -43,7 +47,7 @@ public class DataOverviewController {
|
||||
* 根据数据显示维度查询当前节点下的文件夹和文件
|
||||
*/
|
||||
@PostMapping("/listSimulationNodeFiles")
|
||||
@Operation(summary = "dimensionTemplateId+chooseUuid+chooseNodeType根据数据显示维度查询当前节点下的文件夹和文件,dimensionTemplateId+fileId支持进入普通文件夹和节点文件夹查询下一层,支持分页查询")
|
||||
@Operation(summary = "dimensionTemplateId+fileId支持进入文件夹和节点文件夹查询下一层,支持分页查询")
|
||||
public SdmResponse listSimulationNodeFiles(@RequestBody ListSimulationNodeTreeReq req) {
|
||||
return dimensionTemplateService.listSimulationNodeFiles(req);
|
||||
}
|
||||
@@ -60,9 +64,9 @@ public class DataOverviewController {
|
||||
/**
|
||||
* 数据总览上传文件到节点文件夹
|
||||
*/
|
||||
@PostMapping("/uploadSimulationNodeFiles")
|
||||
@PostMapping(value = "/uploadSimulationNodeFiles",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
||||
@Operation(summary = "数据总览上传文件到节点文件夹")
|
||||
public SdmResponse uploadSimulationNodeFiles(@RequestBody UploadFilesReq req) {
|
||||
public SdmResponse uploadSimulationNodeFiles(UploadFilesReq req) {
|
||||
return dimensionTemplateService.uploadSimulationNodeFiles(req);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,6 @@ import java.util.List;
|
||||
* @since 2025-09-05
|
||||
*/
|
||||
public interface FileMetadataInfoMapper extends BaseMapper<FileMetadataInfo> {
|
||||
List<FileMetadataInfo> listSimulationNodeFiles(@Param("parentId") Long parentId,@Param("uuids") List<String> uuids);
|
||||
List<FileMetadataInfo> listSimulationNodeFiles(@Param("parentId") Long parentId,@Param("fileIds") List<Long> fileIds);
|
||||
|
||||
}
|
||||
|
||||
@@ -14,15 +14,7 @@ public class GetSimulationNodeTreeReq {
|
||||
private Long dimensionTemplateId;
|
||||
|
||||
/**
|
||||
* 选择的节点ID
|
||||
* 文件ID
|
||||
*/
|
||||
@Schema(description = "选择的节点ID,选中节点时,才同时传chooseNodeId和chooseNodeType")
|
||||
private String chooseUuid;
|
||||
|
||||
/**
|
||||
* 选择的节点类型
|
||||
*/
|
||||
@Schema(description = "选择的节点类型,选中节点时,才同时传chooseNodeId和chooseNodeType")
|
||||
private String chooseNodeType;
|
||||
|
||||
private Long fileId;
|
||||
}
|
||||
|
||||
@@ -13,18 +13,6 @@ public class ListSimulationNodeTreeReq extends BaseReq {
|
||||
@NotEmpty(message = "数据展示维度模版ID不能为空")
|
||||
private Long dimensionTemplateId;
|
||||
|
||||
/**
|
||||
* 选择的节点ID
|
||||
*/
|
||||
@Schema(description = "选择的节点ID,选中节点时,才同时传chooseNodeId和chooseNodeType")
|
||||
private String chooseUuid;
|
||||
|
||||
/**
|
||||
* 选择的节点类型
|
||||
*/
|
||||
@Schema(description = "选择的节点类型,选中节点时,才同时传chooseNodeId和chooseNodeType")
|
||||
private String chooseNodeType;
|
||||
|
||||
/**
|
||||
* 文件夹ID
|
||||
*/
|
||||
|
||||
@@ -4,9 +4,12 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.data.model.entity.DimensionTemplate;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.req.*;
|
||||
import com.sdm.data.model.req.dimensionTemplate.TemplateCreationRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 维度模板主表 服务类
|
||||
@@ -26,7 +29,7 @@ public interface IDimensionTemplateService extends IService<DimensionTemplate> {
|
||||
|
||||
SdmResponse deleteTemplateWithHierarchies(Long id);
|
||||
|
||||
SdmResponse getSimulationNodeTree(GetSimulationNodeTreeReq req);
|
||||
SdmResponse<List<FileMetadataInfo>> getSimulationNodeTree(GetSimulationNodeTreeReq req);
|
||||
|
||||
/**
|
||||
* 根据数据显示维度展示左侧节点树
|
||||
|
||||
@@ -16,5 +16,5 @@ import java.util.List;
|
||||
* @since 2025-09-05
|
||||
*/
|
||||
public interface IFileMetadataInfoService extends IService<FileMetadataInfo> {
|
||||
List<FileMetadataInfo> listSimulationNodeFiles(Long parentId,List<String> uuids);
|
||||
List<FileMetadataInfo> listSimulationNodeFiles(Long parentId,List<Long> fileIds);
|
||||
}
|
||||
|
||||
@@ -5,15 +5,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.constants.NumberConstants;
|
||||
import com.sdm.common.entity.enums.DataTypeEnum;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
import com.sdm.common.entity.enums.FileIsLastEnum;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.project.DelNodeReq;
|
||||
import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.feign.impl.project.SimulationNodeFeignClientImpl;
|
||||
import com.sdm.common.utils.PageUtils;
|
||||
import com.sdm.data.model.entity.DimensionTemplate;
|
||||
@@ -161,16 +158,16 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse getSimulationNodeTree(GetSimulationNodeTreeReq req) {
|
||||
public SdmResponse<List<FileMetadataInfo>> getSimulationNodeTree(GetSimulationNodeTreeReq req) {
|
||||
// 根据展示维度获取展示节点类型顺序
|
||||
Long dimensionTemplateId = req.getDimensionTemplateId();
|
||||
LambdaQueryWrapper<DimensionTemplateHierarchy> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(DimensionTemplateHierarchy::getTemplateId, dimensionTemplateId).orderByAsc(DimensionTemplateHierarchy::getSortOrder);
|
||||
List<String> dimensionNodeTyepOrderList = dimensionTemplateHierarchyService.list(queryWrapper).stream().map(DimensionTemplateHierarchy::getDisplayName).toList();
|
||||
|
||||
String chooseUuid = req.getChooseUuid();
|
||||
String chooseNodeType = req.getChooseNodeType();
|
||||
if (ObjectUtils.isEmpty(chooseUuid)) {
|
||||
List<String> uuids = null;
|
||||
List<FileMetadataInfo> resultDir = new ArrayList<>();
|
||||
if (ObjectUtils.isEmpty(req.getFileId())) {
|
||||
// 选中维度了,没有选节点,按照模版,展示模版的第一层节点数据
|
||||
String rootNodeType = dimensionNodeTyepOrderList.get(0);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByNodeTypeResponse = simuluationNodeFeignClient.getAllNodeByNodeType(null, rootNodeType);
|
||||
@@ -179,28 +176,57 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
return allNodeByNodeTypeResponse;
|
||||
uuids = allNodeByNodeTypeResponse.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList();
|
||||
} else {
|
||||
// 从dimensionNodeTyepOrderList中获取chooseNodeType下一个位置的数据,有可能chooseNodeType所在位置就是最后一层节点,SdmResponse返回空数据
|
||||
int index = dimensionNodeTyepOrderList.indexOf(chooseNodeType);
|
||||
if (index == -1) {
|
||||
return SdmResponse.failed("选中节点类型不在数据展示维度中");
|
||||
}
|
||||
// 选中维度了,也选中了节点,按照模版,展示该节点的下一层节点文件夹和普通文件夹
|
||||
Long fileId = req.getFileId();
|
||||
|
||||
if (index == dimensionNodeTyepOrderList.size() - 1) {
|
||||
//尾节点,直接返回空数据
|
||||
return SdmResponse.success();
|
||||
}
|
||||
// 先获取普通文件夹
|
||||
List<FileMetadataInfo> dirInfos = fileMetadataInfoService
|
||||
.lambdaQuery()
|
||||
.eq(FileMetadataInfo::getParentId, fileId)
|
||||
.eq(FileMetadataInfo::getDataType, DataTypeEnum.DIRECTORY.getValue())
|
||||
.isNull(FileMetadataInfo::getRelatedResourceUuid)
|
||||
.list();
|
||||
|
||||
resultDir.addAll(dirInfos);
|
||||
|
||||
// 再获取节点文件夹
|
||||
FileMetadataInfo nodeDirInfo = fileMetadataInfoService.getById(fileId);
|
||||
String chooseUuid = nodeDirInfo.getRelatedResourceUuid();
|
||||
String chooseNodeType = nodeDirInfo.getRelatedResourceUuidOwnType();
|
||||
|
||||
// chooseUuid和chooseNodeType不为空才是节点文件夹,才需要查询子节点文件夹文件
|
||||
if (ObjectUtils.isNotEmpty(chooseUuid) && ObjectUtils.isNotEmpty(chooseNodeType)) {
|
||||
// 从dimensionNodeTyepOrderList中获取chooseNodeType下一个位置的数据,有可能chooseNodeType所在位置就是最后一层节点,SdmResponse返回空数据
|
||||
int index = dimensionNodeTyepOrderList.indexOf(chooseNodeType);
|
||||
if (index == -1) {
|
||||
return SdmResponse.failed("选中节点类型不在数据展示维度中");
|
||||
}
|
||||
|
||||
if (index == dimensionNodeTyepOrderList.size() - 1) {
|
||||
//尾节点,直接返回空数据
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
|
||||
// 获取dimensionNodeTyepOrderList的index+1位置的节点类型
|
||||
String nextNodeType = dimensionNodeTyepOrderList.get(index + 1);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType);
|
||||
if (!allNodeByProjectIdAndType.isSuccess()) {
|
||||
return SdmResponse.success();
|
||||
// 获取dimensionNodeTyepOrderList的index+1位置的节点类型
|
||||
String nextNodeType = dimensionNodeTyepOrderList.get(index + 1);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = simuluationNodeFeignClient.getAllNodeByProjectIdAndType(chooseUuid, nextNodeType);
|
||||
if (!allNodeByProjectIdAndType.isSuccess()) {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
uuids = allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList();
|
||||
}
|
||||
return allNodeByProjectIdAndType;
|
||||
}
|
||||
|
||||
if (ObjectUtils.isEmpty(uuids)) {
|
||||
return SdmResponse.success(resultDir);
|
||||
}
|
||||
|
||||
List<FileMetadataInfo> nodeDirInfos = fileMetadataInfoService.lambdaQuery().in(FileMetadataInfo::getRelatedResourceUuid, uuids).list();
|
||||
resultDir.addAll(nodeDirInfos);
|
||||
return SdmResponse.success(resultDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,48 +234,31 @@ public class DimensionTemplateServiceImpl extends ServiceImpl<DimensionTemplateM
|
||||
// 按照显示维度展示后,会打乱原本的文件夹父子关系,需要重新构建父子关系:
|
||||
// 1、先调用 getSimulationNodeTree 按照维度查询项目子节点node,根据node-uuid获取fileId
|
||||
// 2、再查询原本的普通文件夹信息,需要isProjectDimension=true 只查询普通文件夹,不查询节点文件夹,union all 查询node的fileId 后 分页查询
|
||||
Long parentId;
|
||||
List<String> uuids = null;
|
||||
String relatedResourceUuid = null;
|
||||
String relatedResourceUuidOwnType = null;
|
||||
Long parentDirId;
|
||||
List<Long> dirInfos = null;
|
||||
if (ObjectUtils.isNotEmpty(req.getFileId())) {
|
||||
//fileId 不为空,是右侧点击进入文件夹下一层级查询
|
||||
parentId = req.getFileId();
|
||||
Optional<FileMetadataInfo> parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parentId).oneOpt();
|
||||
parentDirId = req.getFileId();
|
||||
Optional<FileMetadataInfo> parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parentDirId).oneOpt();
|
||||
if (!parentDirInfo.isPresent()) {
|
||||
return SdmResponse.failed("父文件夹不存在");
|
||||
}
|
||||
relatedResourceUuid = parentDirInfo.get().getRelatedResourceUuid();
|
||||
relatedResourceUuidOwnType = parentDirInfo.get().getRelatedResourceUuidOwnType();
|
||||
|
||||
} else if (ObjectUtils.isNotEmpty(req.getChooseUuid()) && ObjectUtils.isNotEmpty(req.getChooseNodeType())) {
|
||||
// chooseUuid 和 chooseNodeType不为空,是左侧点击树节点后,查询当前节点文件下的文件信息
|
||||
relatedResourceUuid = req.getChooseUuid();
|
||||
relatedResourceUuidOwnType = req.getChooseNodeType();
|
||||
Optional<FileMetadataInfo> parentDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getRelatedResourceUuid, relatedResourceUuid).oneOpt();
|
||||
if (!parentDirInfo.isPresent()) {
|
||||
return SdmResponse.failed("父文件夹不存在");
|
||||
}
|
||||
parentId = parentDirInfo.get().getId();
|
||||
} else {
|
||||
return SdmResponse.success();
|
||||
}
|
||||
|
||||
// relatedResourceUuid和relatedResourceUuidOwnType不为空才是节点文件夹,才需要查询子节点文件夹文件
|
||||
if (ObjectUtils.isNotEmpty(relatedResourceUuid) && ObjectUtils.isNotEmpty(relatedResourceUuidOwnType)) {
|
||||
GetSimulationNodeTreeReq getSimulationNodeTreeReq = new GetSimulationNodeTreeReq();
|
||||
getSimulationNodeTreeReq.setDimensionTemplateId(req.getDimensionTemplateId());
|
||||
getSimulationNodeTreeReq.setChooseUuid(relatedResourceUuid);
|
||||
getSimulationNodeTreeReq.setChooseNodeType(relatedResourceUuidOwnType);
|
||||
SdmResponse<List<AllNodeByProjectIdAndTypeResp>> allNodeByProjectIdAndType = getSimulationNodeTree(getSimulationNodeTreeReq);
|
||||
if (allNodeByProjectIdAndType.isSuccess() && ObjectUtils.isNotEmpty(allNodeByProjectIdAndType.getData())) {
|
||||
uuids = allNodeByProjectIdAndType.getData().stream().map(AllNodeByProjectIdAndTypeResp::getUuid).toList();
|
||||
}
|
||||
GetSimulationNodeTreeReq getSimulationNodeTreeReq = new GetSimulationNodeTreeReq();
|
||||
getSimulationNodeTreeReq.setDimensionTemplateId(req.getDimensionTemplateId());
|
||||
getSimulationNodeTreeReq.setFileId(parentDirId);
|
||||
SdmResponse<List<FileMetadataInfo>> nodeDirInfos = getSimulationNodeTree(getSimulationNodeTreeReq);
|
||||
if (nodeDirInfos.isSuccess() && ObjectUtils.isNotEmpty(nodeDirInfos.getData())) {
|
||||
dirInfos = nodeDirInfos.getData().stream().map(FileMetadataInfo::getId).toList();
|
||||
}
|
||||
|
||||
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<FileMetadataInfo> fileMetadataInfos = fileMetadataInfoService.listSimulationNodeFiles(parentId, uuids);
|
||||
List<FileMetadataInfo> fileMetadataInfos = fileMetadataInfoService.listSimulationNodeFiles(parentDirId, dirInfos);
|
||||
|
||||
PageInfo<FileMetadataInfo> page = new PageInfo<>(fileMetadataInfos);
|
||||
return PageUtils.getJsonObjectSdmResponse(fileMetadataInfos, page);
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
@Service
|
||||
public class FileMetadataInfoServiceImpl extends ServiceImpl<FileMetadataInfoMapper, FileMetadataInfo> implements IFileMetadataInfoService {
|
||||
@Override
|
||||
public List<FileMetadataInfo> listSimulationNodeFiles(Long parentId, List<String> uuids) {
|
||||
return this.baseMapper.listSimulationNodeFiles(parentId,uuids);
|
||||
public List<FileMetadataInfo> listSimulationNodeFiles(Long parentId, List<Long> fileIds) {
|
||||
return this.baseMapper.listSimulationNodeFiles(parentId,fileIds);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,14 +121,17 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public SdmResponse createDir(CreateDirReq req) {
|
||||
if (req == null || !StringUtils.hasText(req.getDirName())) {
|
||||
log.error("创建目录失败, 目录名称为空");
|
||||
return SdmResponse.failed("目录名称不能为空");
|
||||
}
|
||||
try {
|
||||
// 处理根目录创建逻辑(知识库根目录创建逻辑和项目节点目录创建)
|
||||
if (ObjectUtils.isEmpty(req.getParDirId()) && ObjectUtils.isEmpty(req.getParentUuId())) {
|
||||
log.info("创建根目录");
|
||||
return createRootDir(req);
|
||||
} else {
|
||||
// 处理子目录创建逻辑
|
||||
log.info("创建子目录");
|
||||
return createChildDir(req);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -243,11 +246,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
|
||||
public SdmResponse<?> createRootDir(CreateDirReq req) {
|
||||
if(ObjectUtils.isEmpty(req.getDirType())){
|
||||
log.error("请选择目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹");
|
||||
return SdmResponse.failed("请选择目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹");
|
||||
}
|
||||
|
||||
DirTypeEnum dirTypeByValue = DirTypeEnum.getDirTypeByValue(req.getDirType());
|
||||
if (dirTypeByValue == null) {
|
||||
log.error("请选择正确的目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹");
|
||||
return SdmResponse.failed("请选择正确的目录类型:1 知识库文件夹,2 项目节点文件夹,3 头像库文件夹,4 仿真参数库文件夹,5 训练模型文件夹");
|
||||
}
|
||||
|
||||
@@ -256,6 +261,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
Optional<FileMetadataInfo> fileMetadataInfoByObjectKey = getFileMetadataInfoByObjectKey(rootDirMinioObjectKey);
|
||||
// 检查目录是否已存在
|
||||
if (!fileMetadataInfoByObjectKey.isPresent()) {
|
||||
log.error("知识库、项目根目录不存在,等待initSystemDirectory 初始化完成");
|
||||
return SdmResponse.failed("知识库、项目根目录不存在,等待initSystemDirectory 初始化完成");
|
||||
}
|
||||
|
||||
@@ -271,6 +277,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
try {
|
||||
// 检查目录是否已存在
|
||||
if (getFileMetadataInfoByObjectKey(dirMinioObjectKey).isPresent()) {
|
||||
log.error("目录已存在");
|
||||
return SdmResponse.failed("目录已存在");
|
||||
}
|
||||
|
||||
@@ -284,6 +291,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 创建默认权限记录
|
||||
createDirectoryPermission(dirInfo.getId());
|
||||
|
||||
log.error("根目录创建成功");
|
||||
return SdmResponse.success("根目录创建成功");
|
||||
} catch (Exception dbException) {
|
||||
log.error("创建根目录失败", dbException);
|
||||
@@ -307,6 +315,10 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
Long parDirId = null;
|
||||
if (req.getParentUuId() != null) {
|
||||
FileMetadataInfo node = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getRelatedResourceUuid, req.getParentUuId()).one();
|
||||
if (ObjectUtils.isEmpty(node)) {
|
||||
log.error("上级节点目录不存在");
|
||||
return SdmResponse.failed("上级节点目录不存在");
|
||||
}
|
||||
parDirId = node.getId();
|
||||
} else {
|
||||
parDirId = req.getParDirId();
|
||||
@@ -314,6 +326,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
|
||||
FileMetadataInfo parDirInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getId, parDirId).one();
|
||||
if (ObjectUtils.isEmpty(parDirInfo)) {
|
||||
log.error("上级目录不存在");
|
||||
return SdmResponse.failed("上级目录不存在");
|
||||
}
|
||||
|
||||
@@ -322,11 +335,13 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
|
||||
// 检查子目录是否已存在
|
||||
if (getFileMetadataInfoByObjectKey(childDirMinioObjectKey).isPresent()) {
|
||||
log.error("目录已存在");
|
||||
return SdmResponse.failed("目录已存在");
|
||||
}
|
||||
|
||||
boolean hasWritePermission = fileUserPermissionService.hasFilePermission(parDirId, ThreadLocalContext.getUserId(), FilePermissionEnum.WRITE);
|
||||
if (!hasWritePermission) {
|
||||
log.error("没有写入权限");
|
||||
return SdmResponse.failed("没有写入权限");
|
||||
}
|
||||
|
||||
@@ -341,6 +356,7 @@ public class MinioFileIDataFileServiceImpl implements IDataFileService {
|
||||
// 创建默认权限记录
|
||||
createDirectoryPermission(dirInfo.getId());
|
||||
|
||||
log.info("子目录创建成功");
|
||||
return SdmResponse.success("子目录创建成功");
|
||||
|
||||
} catch (Exception dbException) {
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: local
|
||||
@@ -42,4 +42,4 @@ fi
|
||||
|
||||
# 启动项目
|
||||
echo "正在启动项目..."
|
||||
nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
@@ -2,22 +2,22 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.sdm.data.dao.FileMetadataInfoMapper">
|
||||
<select id="listSimulationNodeFiles" resultType="com.sdm.data.model.entity.FileMetadataInfo">
|
||||
<!-- 第一个子查询(必执行) -->
|
||||
<!-- 第一个子查询文件(必执行) -->
|
||||
SELECT *
|
||||
FROM file_metadata_info
|
||||
WHERE parentId = #{parentId}
|
||||
AND relatedResourceUuid IS NULL
|
||||
AND dataType = 2
|
||||
AND isLatest = true
|
||||
|
||||
<!-- 动态判断:uuids 不为空且有元素时,才拼接 UNION ALL + 第二个子查询 -->
|
||||
<if test="uuids != null">
|
||||
<!-- 动态判断:uuids 不为空且有元素时,才拼接 UNION ALL + 第二个子查询普通文件夹和节点文件夹 -->
|
||||
<if test="fileIds != null">
|
||||
UNION ALL
|
||||
(
|
||||
SELECT *
|
||||
FROM file_metadata_info
|
||||
WHERE relatedResourceUuid IN (
|
||||
<foreach collection="uuids" item="uuid" separator=",">
|
||||
#{uuid}
|
||||
WHERE id IN (
|
||||
<foreach collection="fileIds" item="fileId" separator=",">
|
||||
#{fileId}
|
||||
</foreach>
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: local
|
||||
main:
|
||||
web-application-type: reactive
|
||||
cloud:
|
||||
|
||||
@@ -45,6 +45,6 @@ echo "正在启动项目... "
|
||||
echo "======================================================================"
|
||||
|
||||
# 启动项目,保留控制台输出
|
||||
nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" --spring.profiles.active=dev > "${LOG_FILE}" 2>&1 &
|
||||
|
||||
|
||||
|
||||
@@ -69,9 +69,9 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@PostMapping("/list")
|
||||
@Operation(summary = "项目列表", description = "项目列表")
|
||||
public SdmResponse list(SpdmNodeListReq req) {
|
||||
public SdmResponse list(@RequestBody SpdmNodeListReq req) {
|
||||
return nodeService.list(req);
|
||||
}
|
||||
|
||||
|
||||
@@ -366,9 +366,8 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
Optional<SpdmProjectNodeEditReq> projectOptional = addNodeList.stream().filter(node -> SystemConstants.PROJECT_TAG.equals(node.getNodeType())).findFirst();
|
||||
if (projectOptional.isPresent()) {
|
||||
SpdmProjectNodeEditReq projectNode = projectOptional.get();
|
||||
String uuid = projectNode.getUuid();
|
||||
// 创建项目节点的文件夹
|
||||
createDir(uuid, NodeTypeEnum.NODE.getValue() , null, projectNode.getNodeName());
|
||||
createDir( projectNode.getUuid(), projectNode.getNodeType(), null, projectNode.getNodeName());
|
||||
} else {
|
||||
List<ProjectNodePo> projectNodePoList = mapper.queryNodeListByNodeId(addNodeList.get(0).getPid());
|
||||
if (CollectionUtils.isEmpty(projectNodePoList)) {
|
||||
@@ -378,7 +377,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
ProjectNodePo projectNodePo = projectNodePoList.get(0);
|
||||
String projectUuid = projectNodePo.getUuid();
|
||||
for (SpdmProjectNodeEditReq node : addNodeList) {
|
||||
createDir(node.getUuid(),NodeTypeEnum.NODE.getValue() , projectUuid, node.getNodeName());
|
||||
createDir(node.getUuid(),node.getNodeType() , projectUuid, node.getNodeName());
|
||||
}
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(allNodeManagerList) && nodeMapper.addNodeMemberBatch(allNodeManagerList) <= 0) {
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.constants.SystemConstants;
|
||||
import com.sdm.common.entity.enums.DirTypeEnum;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.data.CreateDirReq;
|
||||
import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.RenameDirReq;
|
||||
@@ -1383,7 +1382,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
response = SdmResponse.failed("新增节点时,创建文件失败");
|
||||
return response;
|
||||
}
|
||||
createDir(taskNode.getUuid(),NodeTypeEnum.NODE.getValue(),
|
||||
createDir(taskNode.getUuid(),taskNode.getNodeType(),
|
||||
SystemConstants.PROJECT_TAG.equals(taskNode.getNodeType()) ? null : (ObjectUtils.isNotEmpty(projectNodePoMap.get(taskNode.getParentId()))
|
||||
? projectNodePoMap.get(taskNode.getParentId()).getUuid()
|
||||
: projectNodeMap.get(taskNode.getParentId()).getUuid()),
|
||||
@@ -1439,7 +1438,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
response = SdmResponse.failed("新增分析项时,创建文件失败");
|
||||
return response;
|
||||
}
|
||||
createDir(taskNode.getUuid(),NodeTypeEnum.TASK.getValue(), projectNodePoMap.get(taskNode.getParentId()).getUuid(), taskNode.getNodeName());
|
||||
createDir(taskNode.getUuid(),taskNode.getNodeType(), projectNodePoMap.get(taskNode.getParentId()).getUuid(), taskNode.getNodeName());
|
||||
|
||||
}
|
||||
} else {
|
||||
@@ -1449,7 +1448,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
response = SdmResponse.failed("新增分析项时,创建文件失败");
|
||||
return response;
|
||||
}
|
||||
createDir(taskNode.getUuid(),NodeTypeEnum.TASK.getValue(),
|
||||
createDir(taskNode.getUuid(),taskNode.getNodeType(),
|
||||
ObjectUtils.isNotEmpty(projectNodePoMap.get(taskNode.getParentId())) ? projectNodePoMap.get(taskNode.getParentId()).getUuid() : projectNodeMap.get(taskNode.getParentId()).getUuid(),
|
||||
taskNode.getNodeName());
|
||||
}
|
||||
@@ -1494,7 +1493,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
response = SdmResponse.failed("新增指标时,创建文件失败");
|
||||
return response;
|
||||
}
|
||||
createDir(taskNode.getUuid(), NodeTypeEnum.PERFORMANCE.getValue(), taskNodePoMap.get(taskNode.getTaskId()).getUuid(), taskNode.getNodeName());
|
||||
createDir(taskNode.getUuid(), taskNode.getNodeType(), taskNodePoMap.get(taskNode.getTaskId()).getUuid(), taskNode.getNodeName());
|
||||
}
|
||||
} else {
|
||||
for (TaskNode taskNode : projectNodePerformanceList) {
|
||||
@@ -1503,7 +1502,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
response = SdmResponse.failed("新增指标时,创建文件失败");
|
||||
return response;
|
||||
}
|
||||
createDir(taskNode.getUuid(),NodeTypeEnum.PERFORMANCE.getValue(),
|
||||
createDir(taskNode.getUuid(),taskNode.getNodeType(),
|
||||
ObjectUtils.isNotEmpty(taskNodePoMap.get(taskNode.getTaskId())) ? taskNodePoMap.get(taskNode.getTaskId()).getUuid() : taskNodeMap.get(taskNode.getTaskId()).getUuid(),
|
||||
taskNode.getNodeName());
|
||||
}
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: dev
|
||||
active: local
|
||||
@@ -42,4 +42,4 @@ fi
|
||||
echo "正在启动项目... "
|
||||
|
||||
# 启动项目并保留控制台输出
|
||||
nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
|
||||
@@ -42,8 +42,8 @@ public class SysRoleController {
|
||||
@Operation(summary = "通过角色编码查询", description = "通过角色编码查询")
|
||||
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = SysRole.class)))
|
||||
@GetMapping("/getRoleByRoleCode")
|
||||
public SdmResponse getRoleByRoleCode(@Parameter(description = "角色编码") @RequestParam("roleCode") String roleCode,@Parameter(description = "租户ID") @RequestParam(name = "tenantId",defaultValue = "1979091834410176514") Long tenantId) {
|
||||
return sysRoleService.getRoleByRoleCode(roleCode, tenantId);
|
||||
public SdmResponse getRoleByRoleCode(@Parameter(description = "角色编码") @RequestParam("roleCode") String roleCode) {
|
||||
return sysRoleService.getRoleByRoleCode(roleCode);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,8 +54,8 @@ public class SysRoleController {
|
||||
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = SysRole.class)))
|
||||
@GetMapping("/getRoleById")
|
||||
public SdmResponse getRoleById(
|
||||
@Parameter(description = "角色ID") @RequestParam("roleId") Long roleId,@Parameter(description = "租户id") @RequestParam(value = "tenantId",defaultValue = "1979091834410176514") Long tenantId) {
|
||||
return sysRoleService.getRoleById(roleId, tenantId);
|
||||
@Parameter(description = "角色ID") @RequestParam("roleId") Long roleId) {
|
||||
return sysRoleService.getRoleById(roleId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,8 +64,8 @@ public class SysRoleController {
|
||||
@Operation(summary = "通过角色名称查询", description = "通过角色名称查询")
|
||||
@ApiResponse(content = @Content(mediaType = "application/json", schema = @Schema(implementation = SysRole.class)))
|
||||
@GetMapping("/getRoleByRoleName")
|
||||
public SdmResponse getRoleByRoleName(@Parameter(description = "角色名称") @RequestParam("roleName") String roleName,@Parameter(description = "租户ID") @RequestParam(name = "tenantId",defaultValue = "1979091834410176514") Long tenantId) {
|
||||
return sysRoleService.getRoleByRoleName(roleName, tenantId);
|
||||
public SdmResponse getRoleByRoleName(@Parameter(description = "角色名称") @RequestParam("roleName") String roleName) {
|
||||
return sysRoleService.getRoleByRoleName(roleName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -141,8 +141,8 @@ public class SysUserController implements ISysUserFeignClient {
|
||||
*/
|
||||
@Operation(summary = "查询用户角色", description = "查询用户角色接口,用于查询指定用户的角色列表")
|
||||
@GetMapping("/queryUserRole")
|
||||
public SdmResponse<CIDRoleResp> queryUserRole(@Parameter(description = "用户id") @RequestParam("userId") Long userId, @Parameter(description = "租户id") @RequestParam(name = "tenantId",defaultValue = "1979091834410176514") Long tenantId) {
|
||||
return ISysUserService.queryUserRole(userId,tenantId);
|
||||
public SdmResponse<CIDRoleResp> queryUserRole(@Parameter(description = "用户id") @RequestParam("userId") Long userId) {
|
||||
return ISysUserService.queryUserRole(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,6 +17,5 @@ public class QueryRoleReq extends BaseReq {
|
||||
private String roleName;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
@NotNull(message = "租户ID不能为空")
|
||||
private Long tenantId = 1979091834410176514L;
|
||||
private Long tenantId;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,5 @@ public class GroupQueryReq extends BaseReq {
|
||||
private String groupName;
|
||||
|
||||
@Schema(description = "租户ID")
|
||||
@NotNull(message = "租户ID不能为空")
|
||||
private Long tenantId = 1979091834410176514L;
|
||||
private Long tenantId;
|
||||
}
|
||||
@@ -14,5 +14,5 @@ public class QueryGroupDetailReq extends BaseReq {
|
||||
Long id;
|
||||
|
||||
@Parameter(description = "租户id")
|
||||
Long tenantId =1979091834410176514L ;
|
||||
Long tenantId ;
|
||||
}
|
||||
|
||||
@@ -30,24 +30,22 @@ public interface ISysRoleService extends IService<SysRole> {
|
||||
* 根据ID获取角色
|
||||
*
|
||||
* @param roleCode 角色编码
|
||||
* @param tenantId
|
||||
* @return 角色信息
|
||||
*/
|
||||
SdmResponse getRoleByRoleCode(String roleCode, Long tenantId);
|
||||
SdmResponse getRoleByRoleCode(String roleCode);
|
||||
|
||||
/**
|
||||
* 根据ID获取角色
|
||||
*
|
||||
* @param roleId 角色ID
|
||||
* @param tenantId
|
||||
* @return 角色信息
|
||||
*/
|
||||
SdmResponse getRoleById(Long roleId, Long tenantId);
|
||||
SdmResponse getRoleById(Long roleId);
|
||||
|
||||
/**
|
||||
* 根据角色名称查询
|
||||
*/
|
||||
SdmResponse getRoleByRoleName(String roleName, Long tenantId);
|
||||
SdmResponse getRoleByRoleName(String roleName);
|
||||
|
||||
/**
|
||||
* 创建角色
|
||||
|
||||
@@ -35,7 +35,7 @@ public interface ISysUserService extends IService<SysUser> {
|
||||
|
||||
SdmResponse updateUserRole(UpdateUserRole req);
|
||||
|
||||
SdmResponse<CIDRoleResp> queryUserRole(Long userId, Long tenantId);
|
||||
SdmResponse<CIDRoleResp> queryUserRole(Long userId);
|
||||
|
||||
SdmResponse addGroup(GroupAddReq req);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.json.JSONUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.req.system.UserListReq;
|
||||
import com.sdm.common.entity.req.system.UserQueryReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
@@ -88,6 +89,7 @@ public class CIDISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||
@Override
|
||||
public SdmResponse queryUserDetail(UserQueryReq req) {
|
||||
try {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
String userJson = HttpUtil.post(cidUrl + queryUserDetail, JSONUtil.toJsonStr(req));
|
||||
SdmResponse<CIDUserResp> CIDUserRespose = JSON.parseObject(userJson, SdmResponse.class);
|
||||
if (CIDUserRespose != null) {
|
||||
@@ -118,6 +120,7 @@ public class CIDISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||
@Override
|
||||
public SdmResponse listUser(UserListReq req) {
|
||||
try {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
String userJson = HttpUtil.post(cidUrl + listUser, JSONUtil.toJsonStr(req));
|
||||
SdmResponse<PageDataResp<List<CIDUserResp>>> cidUserAddReq = JSON.parseObject(userJson, SdmResponse.class);
|
||||
return cidUserAddReq;
|
||||
@@ -158,11 +161,11 @@ public class CIDISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<CIDRoleResp> queryUserRole(Long userId, Long tenantId) {
|
||||
public SdmResponse<CIDRoleResp> queryUserRole(Long userId) {
|
||||
try {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("userId", userId);
|
||||
paramMap.put("tenantId", tenantId);
|
||||
paramMap.put("tenantId", ThreadLocalContext.getTenantId());
|
||||
String resultJson = HttpUtil.get(cidUrl + queryUserRole, paramMap);
|
||||
SdmResponse<CIDRoleResp> result = JSON.parseObject(resultJson, SdmResponse.class);
|
||||
return result;
|
||||
@@ -185,6 +188,7 @@ public class CIDISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SysUserGroupResp>>> queryGroup(GroupQueryReq req) {
|
||||
try {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
String userJson = HttpUtil.post(cidUrl + queryGroup, JSONUtil.toJsonStr(req));
|
||||
SdmResponse<PageDataResp<List<SysUserGroupResp>>> CIDGroupRespose = JSON.parseObject(userJson, SdmResponse.class);
|
||||
if (CIDGroupRespose != null) {
|
||||
@@ -200,6 +204,7 @@ public class CIDISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
|
||||
@Override
|
||||
public SdmResponse<SysUserGroupDetailResp> queryGroupDetail(QueryGroupDetailReq req) {
|
||||
try {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
String userJson = HttpUtil.post(cidUrl + queryGroupDetail, JSONUtil.toJsonStr(req));
|
||||
SdmResponse<SysUserGroupDetailResp> CIDGroupDetailRespose = JSON.parseObject(userJson, SdmResponse.class);
|
||||
if (CIDGroupDetailRespose != null) {
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.http.HttpUtil;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.common.ThreadLocalContext;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.entity.resp.system.CIDRoleResp;
|
||||
import com.sdm.system.dao.SysRoleMapper;
|
||||
@@ -56,6 +57,7 @@ public class CIDSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> i
|
||||
@Override
|
||||
public SdmResponse listRoles(QueryRoleReq queryRoleReq) {
|
||||
try {
|
||||
queryRoleReq.setTenantId(ThreadLocalContext.getTenantId());
|
||||
String jsonResponse = HttpUtil.post(cidUrl + listRoles, JSON.toJSONString(queryRoleReq));
|
||||
SdmResponse<PageDataResp<List<CIDRoleResp>>> respSdmResponse = JSON.parseObject(jsonResponse, SdmResponse.class);
|
||||
return respSdmResponse;
|
||||
@@ -67,11 +69,11 @@ public class CIDSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> i
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse getRoleByRoleCode(String roleCode, Long tenantId) {
|
||||
public SdmResponse getRoleByRoleCode(String roleCode) {
|
||||
try {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("roleCode", roleCode);
|
||||
paramMap.put("tenantId", tenantId);
|
||||
paramMap.put("tenantId", ThreadLocalContext.getTenantId());
|
||||
String resultJson = HttpUtil.get(cidUrl + getRoleByRoleCode, paramMap);
|
||||
SdmResponse<CIDRoleResp> respSdmResponse = JSON.parseObject(resultJson, SdmResponse.class);
|
||||
return respSdmResponse;
|
||||
@@ -82,11 +84,11 @@ public class CIDSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getRoleById(Long roleId, Long tenantId) {
|
||||
public SdmResponse getRoleById(Long roleId) {
|
||||
try {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("roleId", roleId);
|
||||
paramMap.put("tenantId", tenantId);
|
||||
paramMap.put("tenantId", ThreadLocalContext.getTenantId());
|
||||
String resultJson = HttpUtil.get(cidUrl + getRoleById, paramMap);
|
||||
SdmResponse<CIDRoleResp> respSdmResponse = JSON.parseObject(resultJson, SdmResponse.class);
|
||||
return SdmResponse.success(respSdmResponse);
|
||||
@@ -97,11 +99,11 @@ public class CIDSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getRoleByRoleName(String roleName, Long tenantId){
|
||||
public SdmResponse getRoleByRoleName(String roleName){
|
||||
try {
|
||||
Map<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("roleName", roleName);
|
||||
paramMap.put("tenantId", tenantId);
|
||||
paramMap.put("tenantId", ThreadLocalContext.getTenantId());
|
||||
String resultJson = HttpUtil.get(cidUrl + getRoleByRoleName, paramMap);
|
||||
SdmResponse<CIDRoleResp> respSdmResponse = JSON.parseObject(resultJson, SdmResponse.class);
|
||||
return respSdmResponse;
|
||||
|
||||
@@ -72,7 +72,7 @@ public class LocalSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole>
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse getRoleByRoleCode(String roleCode, Long tenantId) {
|
||||
public SdmResponse getRoleByRoleCode(String roleCode) {
|
||||
try {
|
||||
SysRole sysRole = this.lambdaQuery().eq(SysRole::getRoleCode, roleCode).one();
|
||||
return SdmResponse.success(sysRole);
|
||||
@@ -83,7 +83,7 @@ public class LocalSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole>
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getRoleById(Long roleId, Long tenantId) {
|
||||
public SdmResponse getRoleById(Long roleId) {
|
||||
try {
|
||||
SysRole sysRole = this.getById(roleId);
|
||||
if (sysRole != null) {
|
||||
@@ -97,7 +97,7 @@ public class LocalSysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole>
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getRoleByRoleName(String roleName, Long tenantId) {
|
||||
public SdmResponse getRoleByRoleName(String roleName) {
|
||||
try {
|
||||
List<SysRole> list = this.lambdaQuery().like(SysRole::getRoleName, roleName).list();
|
||||
return SdmResponse.success(list);
|
||||
|
||||
@@ -167,7 +167,7 @@ public class LocalUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> im
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<CIDRoleResp> queryUserRole(Long userId, Long tenantId) {
|
||||
public SdmResponse<CIDRoleResp> queryUserRole(Long userId) {
|
||||
SysUserRoleRelation userRoleRelation = sysUserRoleRelationService.lambdaQuery().eq(SysUserRoleRelation::getUserId, userId).one();
|
||||
if (userRoleRelation == null) {
|
||||
return SdmResponse.failed("用户角色不存在");
|
||||
|
||||
@@ -42,5 +42,5 @@ fi
|
||||
echo "正在启动项目..."
|
||||
|
||||
# 启动项目,保留控制台输出
|
||||
nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
|
||||
|
||||
@@ -44,8 +44,16 @@
|
||||
</appender>
|
||||
|
||||
<!-- 日志输出级别 -->
|
||||
<root level="DEBUG">
|
||||
<root level="INFO">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
|
||||
<!-- local环境使用DEBUG级别 -->
|
||||
<springProfile name="local">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
|
||||
@@ -43,5 +43,5 @@ echo "正在启动项目..."
|
||||
echo "======================================================================"
|
||||
|
||||
# 启动项目,保留控制台输出
|
||||
nohup java ${JVM_OPTS} -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
nohup java ${JVM_OPTS} -Dspring.profiles.active=dev -jar "${FULL_JAR_PATH}" > "${LOG_FILE}" 2>&1 &
|
||||
|
||||
|
||||
@@ -48,4 +48,12 @@
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
|
||||
<!-- local环境使用DEBUG级别 -->
|
||||
<springProfile name="local">
|
||||
<root level="DEBUG">
|
||||
<appender-ref ref="STDOUT" />
|
||||
<appender-ref ref="FILE" />
|
||||
</root>
|
||||
</springProfile>
|
||||
</configuration>
|
||||
|
||||
Reference in New Issue
Block a user