数据查询分析

This commit is contained in:
2025-11-03 19:52:21 +08:00
parent 18c12a3a22
commit dcb6e8399c
18 changed files with 229 additions and 25 deletions

View File

@@ -7,6 +7,9 @@ import lombok.Data;
@Schema(description = "用户列表查询请求参数")
@Data
public class UserListReq extends BaseReq {
@Schema(description = "租户ID")
private Long tenantId;
@Schema(description = "用户ID")
private Long userId;

View File

@@ -126,5 +126,51 @@ public class FileMetadataInfo implements Serializable {
@TableField("fileSize")
private Long fileSize;
@ApiModelProperty(value = "任务ID")
@TableField("taskId")
private String taskId;
@ApiModelProperty(value = "算列ID")
@TableField("runId")
private String runId;
@ApiModelProperty(value = "tag1")
@TableField("tag1")
private String tag1;
@ApiModelProperty(value = "tag2")
@TableField("tag2")
private String tag2;
@ApiModelProperty(value = "tag3")
@TableField("tag3")
private String tag3;
@ApiModelProperty(value = "tag4")
@TableField("tag4")
private String tag4;
@ApiModelProperty(value = "tag5")
@TableField("tag5")
private String tag5;
@ApiModelProperty(value = "tag6")
@TableField("tag6")
private String tag6;
@ApiModelProperty(value = "tag7")
@TableField("tag7")
private String tag7;
@ApiModelProperty(value = "tag8")
@TableField("tag8")
private String tag8;
@ApiModelProperty(value = "tag9")
@TableField("tag9")
private String tag9;
@ApiModelProperty(value = "tag10")
@TableField("tag10")
private String tag10;
}

View File

@@ -9,8 +9,11 @@ import java.time.LocalDateTime;
@Data
public class GetSimulationTaskFileReq extends BaseReq {
@Schema(description = "任务ID(simulationtTask的id)")
Long taskId;
@Schema(description = "任务工况ID(simulationtTask的id)")
String taskId;
@Schema(description = "算列ID")
String runId;
@Schema(description = "文件类型", implementation = Constants.FileType.class)
Integer fileType;
@@ -25,4 +28,34 @@ public class GetSimulationTaskFileReq extends BaseReq {
@Schema(description = "结束时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private LocalDateTime endTime;
@Schema(description = "标签1")
private String tag1;
@Schema(description = "标签2")
private String tag2;
@Schema(description = "标签3")
private String tag3;
@Schema(description = "标签4")
private String tag4;
@Schema(description = "标签5")
private String tag5;
@Schema(description = "标签6")
private String tag6;
@Schema(description = "标签7")
private String tag7;
@Schema(description = "标签8")
private String tag8;
@Schema(description = "标签9")
private String tag9;
@Schema(description = "标签10")
private String tag10;
}

View File

@@ -37,18 +37,20 @@ public class DataAnalysisServiceImpl implements IDataAnalysisService {
@Override
public SdmResponse getSimulationTaskFile(GetSimulationTaskFileReq getSimulationTaskFileReq) {
String objectKey = null;
if (ObjectUtils.isNotNull(getSimulationTaskFileReq.getTaskId())) {
FileMetadataInfo nodeFileMetadataInfo = fileMetadataInfoService.lambdaQuery().eq(FileMetadataInfo::getNodeId, getSimulationTaskFileReq.getTaskId()).one();
if(nodeFileMetadataInfo == null ){
return SdmResponse.failed("节点不存在");
}
objectKey = nodeFileMetadataInfo.getObjectKey();
}
PageHelper.startPage(getSimulationTaskFileReq.getCurrent(), getSimulationTaskFileReq.getSize());
List<FileMetadataInfo> simulationTaskFileMetadataInfos = fileMetadataInfoService.lambdaQuery()
.likeRight(ObjectUtils.isNotNull(objectKey), FileMetadataInfo::getObjectKey, objectKey)
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getRunId()), FileMetadataInfo::getRunId, getSimulationTaskFileReq.getRunId())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTaskId()), FileMetadataInfo::getTaskId, getSimulationTaskFileReq.getTaskId())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag1()), FileMetadataInfo::getTag1, getSimulationTaskFileReq.getTag1())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag2()), FileMetadataInfo::getTag2, getSimulationTaskFileReq.getTag2())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag3()), FileMetadataInfo::getTag3, getSimulationTaskFileReq.getTag3())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag4()), FileMetadataInfo::getTag4, getSimulationTaskFileReq.getTag4())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag5()), FileMetadataInfo::getTag5, getSimulationTaskFileReq.getTag5())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag6()), FileMetadataInfo::getTag6, getSimulationTaskFileReq.getTag6())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag7()), FileMetadataInfo::getTag7, getSimulationTaskFileReq.getTag7())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag8()), FileMetadataInfo::getTag8, getSimulationTaskFileReq.getTag8())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag9()), FileMetadataInfo::getTag9, getSimulationTaskFileReq.getTag9())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getTag10()), FileMetadataInfo::getTag10, getSimulationTaskFileReq.getTag10())
.eq(ObjectUtils.isNotNull(getSimulationTaskFileReq.getFileType()), FileMetadataInfo::getFileType, getSimulationTaskFileReq.getFileType())
.like(ObjectUtils.isNotNull(getSimulationTaskFileReq.getFileName()), FileMetadataInfo::getOriginalName, getSimulationTaskFileReq.getFileName())
.ge(ObjectUtils.isNotNull(getSimulationTaskFileReq.getStartTime()), FileMetadataInfo::getCreateTime, getSimulationTaskFileReq.getStartTime())

View File

@@ -4,6 +4,8 @@ import com.sdm.common.common.SdmResponse;
import com.sdm.project.model.req.SpdmAnalysisPerformanceListReq;
import com.sdm.project.model.req.SpdmAnalysisRunListReq;
import com.sdm.project.model.req.SpdmAnalysisTaskListReq;
import com.sdm.project.model.resp.GetAllRunResultByTaskIdResp;
import com.sdm.project.model.resp.RunResultResp;
import com.sdm.project.service.ITaskService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping("/analysis")
@@ -59,10 +62,10 @@ public class SimulationAnalysisController {
/**
* 数据分析(数据查询)-根据任务id获取所有算列结果和5种文件
* 数据分析(数据查询)-根据任务id获取所有算列结果
*/
@GetMapping("/getAllRunResult")
public SdmResponse getAllRunResultByTaskId(String taskId) {
@GetMapping("/getAllRunResultByTaskId")
public SdmResponse<GetAllRunResultByTaskIdResp> getAllRunResultByTaskId(String taskId) {
return taskService.getAllRunResultByTaskId(taskId);
}

View File

@@ -0,0 +1,16 @@
package com.sdm.project.model.resp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class GetAllRunResultByTaskIdResp {
@Schema(description = "任务指标列表")
List<TasKPerformanceResp> tasKPerformanceRespList = new ArrayList<>();
@Schema(description = "工况算列运行结果")
List<RunResultResp> runResultResp;
}

View File

@@ -0,0 +1,15 @@
package com.sdm.project.model.resp;
import com.sdm.project.model.entity.SimulationPerformance;
import com.sdm.project.model.entity.SimulationRun;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
@Data
public class RunResultResp {
SimulationRun simulationRun;
List<SimulationPerformance> simulationPerformance = new ArrayList<>();
}

View File

@@ -0,0 +1,19 @@
package com.sdm.project.model.resp;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class TasKPerformanceResp {
@Schema(description = "指标名称")
String performanceName;
@Schema(description = "单位")
String unit;
@Schema(description = "达成方式")
String method;
@Schema(description = "目标值")
String targetValue;
}

View File

@@ -6,6 +6,8 @@ import com.sdm.project.model.req.SpdmAnalysisPerformanceListReq;
import com.sdm.project.model.req.SpdmAnalysisRunListReq;
import com.sdm.project.model.req.SpdmAnalysisTaskListReq;
import com.sdm.project.model.req.SpdmTaskListReq;
import com.sdm.project.model.resp.GetAllRunResultByTaskIdResp;
import com.sdm.project.model.resp.RunResultResp;
import org.springframework.stereotype.Service;
import java.util.List;
@@ -28,5 +30,5 @@ public interface ITaskService {
SdmResponse edit(ModifyTaskNode req);
SdmResponse getAllRunResultByTaskId(String taskId);
SdmResponse<GetAllRunResultByTaskIdResp> getAllRunResultByTaskId(String taskId);
}

View File

@@ -13,13 +13,18 @@ import com.sdm.project.model.bo.ModifyTaskNode;
import com.sdm.project.model.bo.TaskExtraNode;
import com.sdm.project.model.bo.TaskMemberNode;
import com.sdm.project.model.bo.TaskNodeTag;
import com.sdm.project.model.entity.SimulationPerformance;
import com.sdm.project.model.entity.SimulationRun;
import com.sdm.project.model.po.PerformanceNodePo;
import com.sdm.project.model.po.ProjectNodePo;
import com.sdm.project.model.po.TaskNodeMemberPo;
import com.sdm.project.model.po.TaskRunPo;
import com.sdm.project.model.req.*;
import com.sdm.project.model.resp.GetAllRunResultByTaskIdResp;
import com.sdm.project.model.resp.RunResultResp;
import com.sdm.project.model.resp.TasKPerformanceResp;
import com.sdm.project.model.vo.*;
import com.sdm.project.service.ISimulationPerformanceService;
import com.sdm.project.service.ISimulationRunService;
import com.sdm.project.service.ITaskService;
import lombok.extern.slf4j.Slf4j;
@@ -58,6 +63,9 @@ public class TaskServiceImpl implements ITaskService {
@Autowired
private ISimulationRunService simulationRunService;
@Autowired
private ISimulationPerformanceService simulationPerformanceService;
@Override
public SdmResponse list(SpdmTaskListReq req) {
@@ -703,9 +711,53 @@ public class TaskServiceImpl implements ITaskService {
}
@Override
public SdmResponse getAllRunResultByTaskId(String taskId) {
List<SimulationRun> list = simulationRunService.lambdaQuery().eq(SimulationRun::getTaskId, taskId).list();
public SdmResponse<GetAllRunResultByTaskIdResp> getAllRunResultByTaskId(String taskId) {
GetAllRunResultByTaskIdResp result= new GetAllRunResultByTaskIdResp();
// taskId不为nullrunid为null查询所有工况设定的标准指标
List<SimulationPerformance> simulationTaskPerformances = simulationPerformanceService
.lambdaQuery()
.eq(SimulationPerformance::getTaskId, taskId)
.isNull(SimulationPerformance::getRunId)
.list();
if(CollectionUtils.isEmpty(simulationTaskPerformances)) {
return SdmResponse.success();
}
return null;
simulationTaskPerformances.forEach(simulationPerformance -> {
TasKPerformanceResp taskPerformanceResp = new TasKPerformanceResp();
BeanUtils.copyProperties(simulationPerformance, taskPerformanceResp);
result.getTasKPerformanceRespList().add(taskPerformanceResp);
});
// // taskId不为nullrunid不为null获取算列计算结果
List<SimulationRun> simulationRunList = simulationRunService.lambdaQuery().eq(SimulationRun::getTaskId, taskId).list();
Map<String, List<SimulationPerformance>> simulationRunPerformanceMap = simulationPerformanceService
.lambdaQuery()
.eq(SimulationPerformance::getTaskId, taskId)
.isNotNull(SimulationPerformance::getRunId)
.list()
.stream()
.collect(Collectors.groupingBy(SimulationPerformance::getRunId));
List<RunResultResp> runResultRespList = new ArrayList<>();
if(CollectionUtils.isNotEmpty(simulationRunList)) {
for (SimulationRun simulationRun : simulationRunList) {
RunResultResp runResultResp = new RunResultResp();
runResultResp.setSimulationRun(simulationRun);
List<SimulationPerformance> simulationPerformance = simulationRunPerformanceMap.get(simulationRun.getUuid());
if (CollectionUtils.isNotEmpty(simulationPerformance)) {
runResultResp.setSimulationPerformance(simulationPerformance);
}
runResultRespList.add(runResultResp);
}
}
result.setRunResultResp(runResultRespList);
return SdmResponse.success(result);
}
}

View File

@@ -1,6 +1,7 @@
package com.sdm.system.model.req.user;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
@@ -8,7 +9,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
@Data
public class GroupMemberQueryReq {
@NotBlank(message = "groupID不能为空")
@NotNull(message = "groupID不能为空")
@Schema(description = "groupID", requiredMode = Schema.RequiredMode.REQUIRED)
private Long groupId;

View File

@@ -2,6 +2,7 @@ package com.sdm.system.model.req.user;
import com.sdm.system.model.req.BaseReq;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
@Schema(description = "用户组查询请求参数")
@@ -9,4 +10,8 @@ import lombok.Data;
public class GroupQueryReq extends BaseReq {
@Schema(description = "用户组名称")
private String groupName;
@Schema(description = "租户ID")
@NotNull(message = "租户ID不能为空")
private Long tenantId;
}

View File

@@ -12,4 +12,7 @@ public class QueryGroupDetailReq extends BaseReq {
@Schema(description = "用户组id")
@NotNull(message = "用户组id不能为空")
Long id;
@Parameter(description = "租户id")
Long tenantId;
}

View File

@@ -207,7 +207,7 @@ public class CIDISysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser>
@Override
public SdmResponse<CIDUserResp> queryGroupMember(GroupMemberQueryReq req) {
try {
String userJson = HttpUtil.post(cidUrl + queryGroupDetail, JSONUtil.toJsonStr(req));
String userJson = HttpUtil.post(cidUrl + queryGroupMember, JSONUtil.toJsonStr(req));
SdmResponse<CIDUserResp> cIDUserResp = JSON.parseObject(userJson, SdmResponse.class);
if (cIDUserResp != null) {
return cIDUserResp;

View File

@@ -125,7 +125,8 @@ tenantSystem:
localTenant: local
cid:
url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
## url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
url: http://192.168.65.75:8989/honeycom-spdm # 朱欣茹地址
user:
listUser: /spdm-user/listUser
queryUserDetail: /spdm-user/queryUserDetail

View File

@@ -116,7 +116,8 @@ tenantSystem:
localTenant: local
cid:
url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
## url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
url: http://192.168.65.75:8989/honeycom-spdm # 朱欣茹地址
user:
listUser: /spdm-user/listUser
queryUserDetail: /spdm-user/queryUserDetail

View File

@@ -144,7 +144,8 @@ tenantSystem:
localTenant: local
cid:
url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
## url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
url: http://192.168.65.75:8989/honeycom-spdm # 朱欣茹地址
user:
listUser: /spdm-user/listUser
queryUserDetail: /spdm-user/queryUserDetail

View File

@@ -143,7 +143,8 @@ tenantSystem:
localTenant: local
cid:
url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
## url: http://192.168.65.162:8989/honeycom-spdm # 请根据实际CID服务地址修改
url: http://192.168.65.75:8989/honeycom-spdm # 朱欣茹地址
user:
listUser: /spdm-user/listUser
queryUserDetail: /spdm-user/queryUserDetail