移除学科节点,基于学科信息查询优化
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.sdm.common.entity.req.project;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GetAllTasksByDisciplineReq {
|
||||
@Schema(description = "学科")
|
||||
private List<String> disciplines;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.sdm.common.feign.impl.project;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.project.GetAllTasksByDisciplineReq;
|
||||
import com.sdm.common.entity.req.project.GetTaskDetailReq;
|
||||
import com.sdm.common.entity.resp.project.SpdmTaskVo;
|
||||
import com.sdm.common.feign.inter.project.ISimulationTaskFeignClient;
|
||||
@@ -12,6 +13,7 @@ import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@@ -54,4 +56,18 @@ public class SimulationTaskFeignClientImpl implements ISimulationTaskFeignClient
|
||||
return SdmResponse.failed("内部调用获取任务详情失败");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<Map<String, List<String>>> getAllTasksByDiscipline(GetAllTasksByDisciplineReq req) {
|
||||
try {
|
||||
SdmResponse<Map<String, List<String>>> response = simulationTaskFeignClient.getAllTasksByDiscipline(req);
|
||||
if(!response.isSuccess() || ObjectUtils.isEmpty(response.getData())){
|
||||
return SdmResponse.failed("内部调用获取任务详情失败");
|
||||
}
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("内部调用根据学科获取所有的任务失败", e);
|
||||
return SdmResponse.failed("内部调用根据学科获取所有的任务失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.common.feign.inter.project;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.project.GetAllTasksByDisciplineReq;
|
||||
import com.sdm.common.entity.req.project.GetTaskDetailReq;
|
||||
import com.sdm.common.entity.req.project.SpdmReportReq;
|
||||
import com.sdm.common.entity.req.system.LaunchApproveReq;
|
||||
@@ -15,6 +16,7 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(name = "project",contextId = "taskFeignClient")
|
||||
public interface ISimulationTaskFeignClient {
|
||||
@@ -35,4 +37,10 @@ public interface ISimulationTaskFeignClient {
|
||||
|
||||
@PostMapping("/task/getTaskDetail")
|
||||
SdmResponse<SpdmTaskVo> getTaskDetail(@RequestBody GetTaskDetailReq req);
|
||||
|
||||
/**
|
||||
* 根据学科获取所有的任务
|
||||
*/
|
||||
@PostMapping("/task/getAllTasksByDiscipline")
|
||||
SdmResponse<Map<String, List<String>>> getAllTasksByDiscipline(@RequestBody GetAllTasksByDisciplineReq req);
|
||||
}
|
||||
@@ -418,6 +418,14 @@ public class DataFileController implements IDataFeignClient {
|
||||
return IDataFileService.getMinioDownloadUrl(fileId);
|
||||
}
|
||||
|
||||
@GetMapping("/getMinioPresignedUrlTest")
|
||||
@Operation(summary = "获取MinIO文件下载的预签名URL", description = "获取MinIO文件的预签名URL")
|
||||
public SdmResponse<MinioDownloadUrlResp> getMinioPresignedUrlTest(@Parameter(description = "文件id") @RequestParam("fileId") Long fileId) {
|
||||
MinioDownloadUrlResp minioDownloadUrlResp = new MinioDownloadUrlResp();
|
||||
minioDownloadUrlResp.setMinioDownloadUrl("https://minio.sdm.com/sdm/file/download/fileId");
|
||||
return SdmResponse.success(minioDownloadUrlResp);
|
||||
}
|
||||
|
||||
@GetMapping("/queryFileMetadataInfo")
|
||||
@Operation(summary = "根据节点uuid获取节点文件夹信息", description = "获取节点文件夹信息")
|
||||
public SdmResponse<FileMetadataInfoResp> queryFileMetadataInfo(@RequestParam(value = "uuid") String uuid, @RequestParam(value = "uuidOwnType") String uuidOwnType, @RequestParam(value = "dirId") Long dirId) {
|
||||
|
||||
@@ -4,15 +4,16 @@ import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.enums.NodeTypeEnum;
|
||||
import com.sdm.common.entity.req.project.GetAllTasksByDisciplineReq;
|
||||
import com.sdm.common.entity.resp.PageDataResp;
|
||||
import com.sdm.common.feign.inter.project.ISimulationTaskFeignClient;
|
||||
import com.sdm.common.log.annotation.SysLog;
|
||||
import com.sdm.data.model.entity.FileMetadataInfo;
|
||||
import com.sdm.data.model.req.AddUserQuotaEntity;
|
||||
import com.sdm.data.model.req.ListUserQuotaReq;
|
||||
import com.sdm.data.model.req.QueryBigFileReq;
|
||||
import com.sdm.data.model.resp.ListBigFileResp;
|
||||
import com.sdm.data.service.DataStorageAnalysis;
|
||||
import com.sdm.data.service.IFileMetadataInfoService;
|
||||
import com.sdm.data.service.IFileStorageService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -21,8 +22,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 数据存储分析管理
|
||||
@@ -38,6 +41,9 @@ public class DataStorageAnalysisController {
|
||||
@Autowired
|
||||
private IFileStorageService fileStorageService;
|
||||
|
||||
@Autowired
|
||||
ISimulationTaskFeignClient simulationTaskFeignClient;
|
||||
|
||||
/**
|
||||
* 根据nodeId(项目nodeId)获取指定查询类型(queryNodeType)文件空间占用(近几个月、增量查询)
|
||||
* 查询项目存储空间占用:项目Uuid+项目queryNodeType
|
||||
@@ -78,6 +84,111 @@ public class DataStorageAnalysisController {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学科获取存储空间占用
|
||||
* discipline已不是独立节点,而是task节点的属性,需要通过task节点汇总计算
|
||||
*/
|
||||
@GetMapping("/getNodeSizeByDiscipline")
|
||||
@Operation(summary = "根据学科获取存储空间占用")
|
||||
public SdmResponse getNodeSizeByDiscipline(
|
||||
@Parameter(description = "学科名称列表") @RequestParam(value = "disciplines", required = false) List<String> disciplines,
|
||||
@Parameter(description = "查询时间间隔(月)") @RequestParam(value = "intervalMonths", required = false) Integer intervalMonths,
|
||||
@Parameter(description = "增量查询指定的月:2025-06") @RequestParam(value = "targetYm", required = false) String targetYm
|
||||
) {
|
||||
if (CollectionUtils.isEmpty(disciplines)) {
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 1. 调用feign获取每个学科对应的任务名称列表
|
||||
GetAllTasksByDisciplineReq req = new GetAllTasksByDisciplineReq();
|
||||
req.setDisciplines(disciplines);
|
||||
SdmResponse<Map<String, List<String>>> disciplineTasksResponse = simulationTaskFeignClient.getAllTasksByDiscipline(req);
|
||||
|
||||
if (!disciplineTasksResponse.isSuccess() || ObjectUtils.isEmpty(disciplineTasksResponse.getData())) {
|
||||
log.warn("获取学科对应的任务列表失败");
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
Map<String, List<String>> discipline2TaskNames = disciplineTasksResponse.getData();
|
||||
|
||||
// 2. 对每个学科,汇总其下所有任务的存储空间
|
||||
List<JSONObject> result = new ArrayList<>();
|
||||
for (Map.Entry<String, List<String>> entry : discipline2TaskNames.entrySet()) {
|
||||
String discipline = entry.getKey();
|
||||
List<String> taskNames = entry.getValue();
|
||||
|
||||
if (CollectionUtils.isEmpty(taskNames)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
JSONObject disciplineSize = calculateDisciplineSize(discipline, taskNames, intervalMonths, targetYm);
|
||||
if (disciplineSize != null) {
|
||||
result.add(disciplineSize);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取学科[{}]存储空间占用失败", discipline, e);
|
||||
}
|
||||
}
|
||||
|
||||
return SdmResponse.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算单个学科的存储空间占用(汇总该学科下所有任务的存储空间)
|
||||
*/
|
||||
private JSONObject calculateDisciplineSize(String discipline, List<String> taskNames,
|
||||
Integer intervalMonths, String targetYm) {
|
||||
BigDecimal totalSize = BigDecimal.ZERO;
|
||||
BigDecimal beforeSize = BigDecimal.ZERO;
|
||||
BigDecimal incrementSize = BigDecimal.ZERO;
|
||||
|
||||
for (String taskName : taskNames) {
|
||||
try {
|
||||
SdmResponse<List<JSONObject>> sdmResponse = dataStorageAnalysis.getNodeSizeByNodeType(
|
||||
NodeTypeEnum.TASK.getValue(), taskName, intervalMonths, targetYm);
|
||||
|
||||
if (!sdmResponse.isSuccess() || CollectionUtils.isEmpty(sdmResponse.getData())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 汇总每个task的存储空间
|
||||
for (JSONObject taskSize : sdmResponse.getData()) {
|
||||
if (ObjectUtils.isNotEmpty(intervalMonths)) {
|
||||
// 近几个月模式:汇总totalSize
|
||||
Object sizeObj = taskSize.get("totalSize");
|
||||
if (sizeObj != null) {
|
||||
totalSize = totalSize.add(new BigDecimal(sizeObj.toString()));
|
||||
}
|
||||
} else if (ObjectUtils.isNotEmpty(targetYm)) {
|
||||
// 增量查询模式:汇总BEFORE和INCREMENT
|
||||
Object beforeObj = taskSize.get("BEFORE");
|
||||
Object incrementObj = taskSize.get("INCREMENT");
|
||||
if (beforeObj != null) {
|
||||
beforeSize = beforeSize.add(new BigDecimal(beforeObj.toString()));
|
||||
}
|
||||
if (incrementObj != null) {
|
||||
incrementSize = incrementSize.add(new BigDecimal(incrementObj.toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("获取任务[{}]存储空间失败", taskName, e);
|
||||
}
|
||||
}
|
||||
|
||||
// 构建返回结果
|
||||
JSONObject result = new JSONObject();
|
||||
result.put("nodeName", discipline);
|
||||
if (ObjectUtils.isNotEmpty(intervalMonths)) {
|
||||
result.put("totalSize", totalSize);
|
||||
} else if (ObjectUtils.isNotEmpty(targetYm)) {
|
||||
result.put("BEFORE", beforeSize);
|
||||
result.put("INCREMENT", incrementSize);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户组和用户id获取用户的空间占用
|
||||
*
|
||||
|
||||
@@ -10,7 +10,6 @@ import com.sdm.common.entity.resp.project.SimulationNodeResp;
|
||||
import com.sdm.common.entity.resp.project.SimulationRunResp;
|
||||
import com.sdm.common.feign.inter.project.ISimulationNodeFeignClient;
|
||||
import com.sdm.common.log.annotation.SysLog;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.service.INodeService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@@ -173,6 +172,15 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 所有项目的人员任务完成情况统计
|
||||
*/
|
||||
@PostMapping("/getAllUserTaskCompleteStatistics")
|
||||
@Operation(summary = "所有项目的人员任务完成情况统计", description = "所有项目的人员任务完成情况统计")
|
||||
public SdmResponse getAllUserTaskCompleteStatistics(@RequestBody @Validated GetAllUserTaskCompleteStatisticsReq req) {
|
||||
return nodeService.getAllUserTaskCompleteStatistics(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户组项目统计
|
||||
*/
|
||||
@@ -185,6 +193,9 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
|
||||
/**
|
||||
* 用户组任务完成情况统计
|
||||
* 需要传:
|
||||
* discipline 学科
|
||||
* tag1-tag10 标签
|
||||
*/
|
||||
@SysLog("用户组任务完成情况统计")
|
||||
@PostMapping("/getUserGroupTaskCompleteStatistics")
|
||||
@@ -194,17 +205,10 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 所有项目的人员任务完成情况统计
|
||||
*/
|
||||
@PostMapping("/getAllUserTaskCompleteStatistics")
|
||||
@Operation(summary = "所有项目的人员任务完成情况统计", description = "所有项目的人员任务完成情况统计")
|
||||
public SdmResponse getAllUserTaskCompleteStatistics(@RequestBody @Validated GetAllUserTaskCompleteStatisticsReq req) {
|
||||
return nodeService.getAllUserTaskCompleteStatistics(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户组难度系数统计
|
||||
* discipline 学科
|
||||
* tag1-tag10 标签
|
||||
*
|
||||
*/
|
||||
@SysLog("用户组难度系数统计")
|
||||
@@ -215,18 +219,49 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用完成统计查询
|
||||
* 基于节点(工位)查询(任务/指标)完成统计,
|
||||
* 需要传:
|
||||
* queryType 查询统计类型 task/
|
||||
* tag1-tag10 标签
|
||||
* resultTagType 数据返回Tag类型: tag1、tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10
|
||||
*/
|
||||
@SysLog("任务/指标 完成情况统计请求参数(工位、学科)")
|
||||
@SysLog("任务/指标 完成情况统计请求参数(工位)")
|
||||
@PostMapping("/getCommonCompleteStatistics")
|
||||
@Operation(summary = "任务/指标 完成情况统计请求参数(工位、学科)", description = "任务/指标 完成情况统计请求参数(工位、学科)")
|
||||
@Operation(summary = "任务/指标 完成情况统计请求参数(工位)", description = "任务/指标 完成情况统计请求参数(工位)")
|
||||
public SdmResponse getCommonCompleteStatistics(@RequestBody @Validated CommonGetCompleteStatisticsReq req) {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
return nodeService.getCommonCompleteStatistics(req);
|
||||
}
|
||||
|
||||
|
||||
/** 基于 学科(学科不是节点,是task的一个属性)查询(任务)完成统计
|
||||
* 需要传:
|
||||
* tag1-tag10 标签
|
||||
*/
|
||||
@SysLog("任务/指标 完成情况统计请求参数(学科)")
|
||||
@PostMapping("/getTaskCompleteStatisticsByDiscipline")
|
||||
@Operation(summary = "基于 学科(学科不是节点,是task的一个属性)查询 任务 完成统计", description = "基于 学科(学科不是节点,是task的一个属性)查询(任务/指标)完成统计")
|
||||
public SdmResponse getTaskCompleteStatisticsByDiscipline(@RequestBody @Validated CommonGetCompleteStatisticsReq req) {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
return nodeService.getTaskCompleteStatisticsByDiscipline(req);
|
||||
}
|
||||
|
||||
/** 基于 学科(学科不是节点,是task的一个属性)查询(指标)完成统计
|
||||
* 需要传:
|
||||
* tag1-tag10 标签
|
||||
*/
|
||||
@PostMapping("/getPerformanceCompleteStatisticsByDiscipline")
|
||||
@Operation(summary = "基于 学科(学科不是节点,是task的一个属性)查询 指标 完成统计", description = "基于 学科(学科不是节点,是task的一个属性)查询(任务/指标)完成统计")
|
||||
public SdmResponse getPerformanceCompleteStatisticsByDiscipline(@RequestBody @Validated CommonGetCompleteStatisticsReq req) {
|
||||
req.setTenantId(ThreadLocalContext.getTenantId());
|
||||
return nodeService.getPerformanceCompleteStatisticsByDiscipline(req);
|
||||
}
|
||||
/**
|
||||
* 工位评审通过统计查询
|
||||
* 需要传:
|
||||
* tag1-tag10 标签 下拉框选项,查询指定节点下的数据
|
||||
* discipline 下拉框选项学科
|
||||
* resultTagType 数据返回Tag类型: tag1、tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10
|
||||
*/
|
||||
@SysLog("工位评审通过统计查询")
|
||||
@PostMapping("/getWorkstationReviewStatistics")
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.project.controller;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.project.GetAllTasksByDisciplineReq;
|
||||
import com.sdm.common.entity.req.project.GetTaskDetailReq;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.common.feign.inter.project.ISimulationTaskFeignClient;
|
||||
@@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/task")
|
||||
@@ -151,6 +153,15 @@ public class SimulationTaskController implements ISimulationTaskFeignClient {
|
||||
return taskService.getTaskDetail(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据学科获取所有的任务
|
||||
*/
|
||||
@PostMapping("/getAllTasksByDiscipline")
|
||||
@Operation(summary = "根据学科获取所有的任务", description = "根据学科获取所有的任务")
|
||||
public SdmResponse<Map<String, List<String>>> getAllTasksByDiscipline(@RequestBody @Validated GetAllTasksByDisciplineReq req) {
|
||||
return taskService.getAllTasksByDiscipline(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改任务(数据总览使用)
|
||||
*
|
||||
|
||||
@@ -86,6 +86,8 @@ public interface SimulationNodeMapper extends BaseMapper<SimulationNode> {
|
||||
|
||||
List<CommonGetCompleteFromPerformanceVo> getCommonCompleteStatisticsFromPerformance(@Param("req")CommonGetCompleteStatisticsReq req);
|
||||
|
||||
List<PerformanceCompleteFromDisciplineVo> getPerformanceCompleteStatisticsByDiscipline(@Param("req") CommonGetCompleteStatisticsReq req);
|
||||
|
||||
List<WorkstationApproveStatusVo> getWorkstationApproveStatus(@Param("req") GetWorkstationApproveStatusReq req);
|
||||
|
||||
SpdmNodeVo getNodeByProjectIdAndName(@Param("projectId") String projectId, @Param("projectName") String projectName);
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.sdm.project.model.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PerformanceCompleteFromDisciplineVo {
|
||||
private String discipline;
|
||||
private String completeStatus;
|
||||
}
|
||||
@@ -8,7 +8,6 @@ import com.sdm.common.entity.resp.AllNodeByProjectIdAndTypeResp;
|
||||
import com.sdm.common.entity.resp.project.SimulationNodeResp;
|
||||
import com.sdm.common.entity.resp.project.SimulationRunResp;
|
||||
import com.sdm.project.model.entity.SimulationNode;
|
||||
import com.sdm.project.model.entity.SimulationRun;
|
||||
import com.sdm.project.model.req.*;
|
||||
import com.sdm.project.model.req.YA.SyncCidProjectReq;
|
||||
import com.sdm.project.model.resp.YA.BosimSaveProjectTaskRsp;
|
||||
@@ -53,6 +52,10 @@ public interface INodeService extends IService<SimulationNode> {
|
||||
|
||||
SdmResponse getCommonCompleteStatistics(CommonGetCompleteStatisticsReq req);
|
||||
|
||||
SdmResponse getTaskCompleteStatisticsByDiscipline(CommonGetCompleteStatisticsReq req);
|
||||
|
||||
SdmResponse getPerformanceCompleteStatisticsByDiscipline(CommonGetCompleteStatisticsReq req);
|
||||
|
||||
// 工位评审通过统计查询
|
||||
SdmResponse getWorkstationReviewStatistics(GetWorkstationApproveStatusReq req);
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.entity.req.export.PerformanceAnalysisExportExcelFormat;
|
||||
import com.sdm.common.entity.req.export.RunAnalysisExportExcelFormat;
|
||||
import com.sdm.common.entity.req.export.TaskAnalysisExportExcelFormat;
|
||||
import com.sdm.common.entity.req.project.GetAllTasksByDisciplineReq;
|
||||
import com.sdm.common.entity.req.project.GetTaskDetailReq;
|
||||
import com.sdm.common.entity.req.task.TaskExportExcelFormat;
|
||||
import com.sdm.common.entity.req.task.TaskTreeExportExcelFormat;
|
||||
@@ -18,6 +19,7 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@Service
|
||||
@@ -61,6 +63,8 @@ public interface ITaskService {
|
||||
|
||||
SdmResponse<SpdmTaskVo> getTaskDetail(GetTaskDetailReq req);
|
||||
|
||||
SdmResponse<Map<String, List<String>>> getAllTasksByDiscipline(GetAllTasksByDisciplineReq req);
|
||||
|
||||
BosimSaveProjectTaskRsp syncCidTask(SyncCidTaskReq req);
|
||||
|
||||
SdmResponse getTaskCompleteStatistics(TaskCompleteStatisticsReq req);
|
||||
|
||||
@@ -1256,20 +1256,16 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
allExeStatus.add(exeStatus);
|
||||
|
||||
UserGroupTaskCompleteStatisticsVo userStat = userStatisticsMap.getOrDefault(userId, new UserGroupTaskCompleteStatisticsVo());
|
||||
userStat.setUserId(userId);
|
||||
userStat.setUserName(userId2Nickname.getOrDefault(userId, "Unknown User"));
|
||||
UserGroupTaskCompleteStatisticsVo userStat = userStatisticsMap.computeIfAbsent(userId, k -> {
|
||||
UserGroupTaskCompleteStatisticsVo vo = new UserGroupTaskCompleteStatisticsVo();
|
||||
vo.setUserId(k);
|
||||
vo.setUserName(userId2Nickname.getOrDefault(k, "Unknown User"));
|
||||
vo.setTotalTasks(0);
|
||||
return vo;
|
||||
});
|
||||
|
||||
Map<String, Integer> statusCount = userStat.getStatusCount();
|
||||
if (statusCount == null) {
|
||||
statusCount = new HashMap<>();
|
||||
userStat.setStatusCount(statusCount);
|
||||
}
|
||||
|
||||
statusCount.put(exeStatus, statusCount.getOrDefault(exeStatus, 0) + 1);
|
||||
userStat.setTotalTasks(userStat.getTotalTasks() == null ? 1 : userStat.getTotalTasks() + 1);
|
||||
|
||||
userStatisticsMap.put(userId, userStat);
|
||||
userStat.getStatusCount().merge(exeStatus, 1, Integer::sum);
|
||||
userStat.setTotalTasks(userStat.getTotalTasks() + 1);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
@@ -1283,7 +1279,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
@Override
|
||||
public SdmResponse getAllUserTaskCompleteStatistics(GetAllUserTaskCompleteStatisticsReq req) {
|
||||
Map<Long, String> userId2Nickname = new HashMap<>();
|
||||
Map<Long, String> userId2Nickname;
|
||||
if (CollectionUtils.isEmpty(req.getUserIds())) {
|
||||
UserListReq userListReq = new UserListReq();
|
||||
userListReq.setTenantId(ThreadLocalContext.getTenantId());
|
||||
@@ -1296,6 +1292,8 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
List<Long> userIds = pageDataRespSdmResponse.getData().getData().stream().map(CIDUserResp::getUserId).toList();
|
||||
req.setUserIds(userIds);
|
||||
userId2Nickname = pageDataRespSdmResponse.getData().getData().stream().collect(Collectors.toMap(CIDUserResp::getUserId, CIDUserResp::getNickname));
|
||||
} else {
|
||||
userId2Nickname = new HashMap<>();
|
||||
}
|
||||
|
||||
List<UserGroupTaskCompleteVo> userGroupTaskCompleteStatistics = this.baseMapper.getAllUserTaskCompleteStatistics(req);
|
||||
@@ -1312,20 +1310,16 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
allExeStatus.add(exeStatus);
|
||||
|
||||
UserGroupTaskCompleteStatisticsVo userStat = userStatisticsMap.getOrDefault(userId, new UserGroupTaskCompleteStatisticsVo());
|
||||
userStat.setUserId(userId);
|
||||
userStat.setUserName(userId2Nickname.getOrDefault(userId, "Unknown User"));
|
||||
UserGroupTaskCompleteStatisticsVo userStat = userStatisticsMap.computeIfAbsent(userId, k -> {
|
||||
UserGroupTaskCompleteStatisticsVo vo = new UserGroupTaskCompleteStatisticsVo();
|
||||
vo.setUserId(k);
|
||||
vo.setUserName(userId2Nickname.getOrDefault(k, "Unknown User"));
|
||||
vo.setTotalTasks(0);
|
||||
return vo;
|
||||
});
|
||||
|
||||
Map<String, Integer> statusCount = userStat.getStatusCount();
|
||||
if (statusCount == null) {
|
||||
statusCount = new HashMap<>();
|
||||
userStat.setStatusCount(statusCount);
|
||||
}
|
||||
|
||||
statusCount.put(exeStatus, statusCount.getOrDefault(exeStatus, 0) + 1);
|
||||
userStat.setTotalTasks(userStat.getTotalTasks() == null ? 1 : userStat.getTotalTasks() + 1);
|
||||
|
||||
userStatisticsMap.put(userId, userStat);
|
||||
userStat.getStatusCount().merge(exeStatus, 1, Integer::sum);
|
||||
userStat.setTotalTasks(userStat.getTotalTasks() + 1);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
@@ -1367,20 +1361,16 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
Float difficulty = item.getDifficult();
|
||||
alldifficultyValue.add(difficulty);
|
||||
|
||||
UserGroupDifficultyStatisticsVo userStat = userStatisticsMap.getOrDefault(userId, new UserGroupDifficultyStatisticsVo());
|
||||
userStat.setUserId(userId);
|
||||
userStat.setUserName(userId2Nickname.getOrDefault(userId, "Unknown User"));
|
||||
UserGroupDifficultyStatisticsVo userStat = userStatisticsMap.computeIfAbsent(userId, k -> {
|
||||
UserGroupDifficultyStatisticsVo vo = new UserGroupDifficultyStatisticsVo();
|
||||
vo.setUserId(k);
|
||||
vo.setUserName(userId2Nickname.getOrDefault(k, "Unknown User"));
|
||||
vo.setTotalTasks(0);
|
||||
return vo;
|
||||
});
|
||||
|
||||
Map<Float, Integer> statusCount = userStat.getDifficultyCount();
|
||||
if (statusCount == null) {
|
||||
statusCount = new HashMap<>();
|
||||
userStat.setDifficultyCount(statusCount);
|
||||
}
|
||||
|
||||
statusCount.put(difficulty, statusCount.getOrDefault(difficulty, 0) + 1);
|
||||
userStat.setTotalTasks(userStat.getTotalTasks() == null ? 1 : userStat.getTotalTasks() + 1);
|
||||
|
||||
userStatisticsMap.put(userId, userStat);
|
||||
userStat.getDifficultyCount().merge(difficulty, 1, Integer::sum);
|
||||
userStat.setTotalTasks(userStat.getTotalTasks() + 1);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
@@ -1393,113 +1383,88 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
|
||||
@Override
|
||||
public SdmResponse getCommonCompleteStatistics(CommonGetCompleteStatisticsReq req) {
|
||||
// 所有任务执行状态
|
||||
Set<String> allExeStatus = new HashSet<>();
|
||||
|
||||
if (NodeTypeEnum.TASK.getValue().equals(req.getQueryType())) {
|
||||
// 处理任务完成情况统计
|
||||
List<CommonGetCompleteFromTaskVo> commonCompleteStatisticsFromTask = this.baseMapper.getCommonCompleteStatisticsFromTask(req);
|
||||
List<CommonGetCompleteFromTaskVo> taskList = this.baseMapper.getCommonCompleteStatisticsFromTask(req);
|
||||
Map<String, CommonStatisticsVo> taskStatisticsMap = buildCommonStatistics(
|
||||
taskList,
|
||||
CommonGetCompleteFromTaskVo::getNodeName,
|
||||
CommonGetCompleteFromTaskVo::getExeStatus,
|
||||
allExeStatus
|
||||
);
|
||||
return buildStatisticsResponse(taskStatisticsMap, allExeStatus, "allExeStatus");
|
||||
|
||||
// 按tag分组统计任务状态
|
||||
Map<String, CommonStatisticsVo> taskStatisticsMap = new HashMap<>();
|
||||
|
||||
// 统计每个tag的各种状态任务数量
|
||||
for (CommonGetCompleteFromTaskVo item : commonCompleteStatisticsFromTask) {
|
||||
String name = item.getNodeName();
|
||||
|
||||
CommonStatisticsVo stat = taskStatisticsMap.getOrDefault(name, new CommonStatisticsVo());
|
||||
stat.setName(name);
|
||||
|
||||
Map<String, Integer> statusCount = stat.getStatusCount();
|
||||
if (statusCount == null) {
|
||||
statusCount = new HashMap<>();
|
||||
stat.setStatusCount(statusCount);
|
||||
}
|
||||
|
||||
String exeStatus = item.getExeStatus();
|
||||
allExeStatus.add(exeStatus);
|
||||
statusCount.put(exeStatus, statusCount.getOrDefault(exeStatus, 0) + 1);
|
||||
taskStatisticsMap.put(name, stat);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
List<CommonStatisticsVo> taskResult = new ArrayList<>(taskStatisticsMap.values());
|
||||
JSONObject resultResponse = new JSONObject();
|
||||
resultResponse.put("allExeStatus", allExeStatus);
|
||||
resultResponse.put("result", taskResult);
|
||||
return SdmResponse.success(resultResponse);
|
||||
} else if (NodeTypeEnum.PERFORMANCE.getValue().equals(req.getQueryType())) {
|
||||
// 处理指标完成情况统计
|
||||
List<CommonGetCompleteFromPerformanceVo> commonCompleteStatisticsFromPerformance = this.baseMapper.getCommonCompleteStatisticsFromPerformance(req);
|
||||
|
||||
// 按tag分组统计指标状态
|
||||
Map<String, CommonStatisticsVo> performanceStatisticsMap = new HashMap<>();
|
||||
|
||||
// 统计每个tag的各种状态指标数量
|
||||
for (CommonGetCompleteFromPerformanceVo item : commonCompleteStatisticsFromPerformance) {
|
||||
String nodeName = item.getNodeName();
|
||||
|
||||
CommonStatisticsVo stat = performanceStatisticsMap.getOrDefault(nodeName, new CommonStatisticsVo());
|
||||
stat.setName(nodeName);
|
||||
|
||||
Map<String, Integer> statusCount = stat.getStatusCount();
|
||||
if (statusCount == null) {
|
||||
statusCount = new HashMap<>();
|
||||
stat.setStatusCount(statusCount);
|
||||
}
|
||||
|
||||
String completeStatus = item.getCompleteStatus();
|
||||
allExeStatus.add(completeStatus);
|
||||
statusCount.put(completeStatus, statusCount.getOrDefault(completeStatus, 0) + 1);
|
||||
|
||||
performanceStatisticsMap.put(nodeName, stat);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
List<CommonStatisticsVo> performanceResult = new ArrayList<>(performanceStatisticsMap.values());
|
||||
JSONObject resultResponse = new JSONObject();
|
||||
resultResponse.put("allExeStatus", allExeStatus);
|
||||
resultResponse.put("result", performanceResult);
|
||||
return SdmResponse.success(resultResponse);
|
||||
List<CommonGetCompleteFromPerformanceVo> performanceList = this.baseMapper.getCommonCompleteStatisticsFromPerformance(req);
|
||||
Map<String, CommonStatisticsVo> performanceStatisticsMap = buildCommonStatistics(
|
||||
performanceList,
|
||||
CommonGetCompleteFromPerformanceVo::getNodeName,
|
||||
CommonGetCompleteFromPerformanceVo::getCompleteStatus,
|
||||
allExeStatus
|
||||
);
|
||||
return buildStatisticsResponse(performanceStatisticsMap, allExeStatus, "allExeStatus");
|
||||
}
|
||||
return SdmResponse.success(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getTaskCompleteStatisticsByDiscipline(CommonGetCompleteStatisticsReq req) {
|
||||
List<SimulationTask> simulationTasks = simulationTaskService.lambdaQuery()
|
||||
.eq(SimulationTask::getTenantId, ThreadLocalContext.getTenantId())
|
||||
.isNotNull(SimulationTask::getExeStatus)
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag1()), SimulationTask::getTag1, req.getTag1())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag2()), SimulationTask::getTag2, req.getTag2())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag3()), SimulationTask::getTag3, req.getTag3())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag4()), SimulationTask::getTag4, req.getTag4())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag5()), SimulationTask::getTag5, req.getTag5())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag6()), SimulationTask::getTag6, req.getTag6())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag7()), SimulationTask::getTag7, req.getTag7())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag9()), SimulationTask::getTag9, req.getTag9())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getTag10()), SimulationTask::getTag10, req.getTag10())
|
||||
.list();
|
||||
|
||||
// 按学科(discipline)分组统计任务完成状态
|
||||
Set<String> allExeStatus = new HashSet<>();
|
||||
Map<String, CommonStatisticsVo> statisticsMap = buildCommonStatistics(
|
||||
simulationTasks,
|
||||
SimulationTask::getDiscipline,
|
||||
SimulationTask::getExeStatus,
|
||||
allExeStatus
|
||||
);
|
||||
|
||||
return buildStatisticsResponse(statisticsMap, allExeStatus, "allExeStatus");
|
||||
}
|
||||
|
||||
public SdmResponse getPerformanceCompleteStatisticsByDiscipline(CommonGetCompleteStatisticsReq req){
|
||||
List<PerformanceCompleteFromDisciplineVo> performanceList = this.baseMapper.getPerformanceCompleteStatisticsByDiscipline(req);
|
||||
// 按学科(discipline)分组统计指标完成状态
|
||||
Set<String> allExeStatus = new HashSet<>();
|
||||
Map<String, CommonStatisticsVo> performanceStatisticsMap = buildCommonStatistics(
|
||||
performanceList,
|
||||
PerformanceCompleteFromDisciplineVo::getDiscipline,
|
||||
PerformanceCompleteFromDisciplineVo::getCompleteStatus,
|
||||
allExeStatus
|
||||
);
|
||||
return buildStatisticsResponse(performanceStatisticsMap, allExeStatus, "allExeStatus");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SdmResponse getWorkstationReviewStatistics(GetWorkstationApproveStatusReq req) {
|
||||
List<WorkstationApproveStatusVo> workstationApproveStatus = this.baseMapper.getWorkstationApproveStatus(req);
|
||||
|
||||
// 按tag分组统计审批状态
|
||||
Map<String, CommonStatisticsVo> reviewStatisticsMap = new HashMap<>();
|
||||
|
||||
// 所有审批状态
|
||||
Set<String> allApprovalStatus = new HashSet<>();
|
||||
Map<String, CommonStatisticsVo> reviewStatisticsMap = buildCommonStatistics(
|
||||
workstationApproveStatus,
|
||||
WorkstationApproveStatusVo::getNodeName,
|
||||
WorkstationApproveStatusVo::getApprovalStatus,
|
||||
allApprovalStatus
|
||||
);
|
||||
|
||||
// 统计每个tag的各种审批状态数量
|
||||
for (WorkstationApproveStatusVo item : workstationApproveStatus) {
|
||||
String nodeName = item.getNodeName();
|
||||
|
||||
CommonStatisticsVo stat = reviewStatisticsMap.getOrDefault(nodeName, new CommonStatisticsVo());
|
||||
stat.setName(nodeName);
|
||||
|
||||
Map<String, Integer> statusCount = stat.getStatusCount();
|
||||
if (statusCount == null) {
|
||||
statusCount = new HashMap<>();
|
||||
stat.setStatusCount(statusCount);
|
||||
}
|
||||
|
||||
String approvalStatus = item.getApprovalStatus();
|
||||
allApprovalStatus.add(approvalStatus);
|
||||
statusCount.put(approvalStatus, statusCount.getOrDefault(approvalStatus, 0) + 1);
|
||||
reviewStatisticsMap.put(nodeName, stat);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
List<CommonStatisticsVo> result = new ArrayList<>(reviewStatisticsMap.values());
|
||||
JSONObject resultResponse = new JSONObject();
|
||||
resultResponse.put("allApprovalStatus", allApprovalStatus);
|
||||
resultResponse.put("result", result);
|
||||
return SdmResponse.success(resultResponse);
|
||||
return buildStatisticsResponse(reviewStatisticsMap, allApprovalStatus, "allApprovalStatus");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -2392,4 +2357,59 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
return SdmResponse.success(simulationRunResps);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用分组统计方法 - 按指定键分组统计状态数量
|
||||
*
|
||||
* @param items 数据列表
|
||||
* @param keyExtractor 分组键提取函数
|
||||
* @param statusExtractor 状态值提取函数
|
||||
* @param allStatus 收集所有状态值的集合
|
||||
* @return 统计结果Map
|
||||
*/
|
||||
private <T> Map<String, CommonStatisticsVo> buildCommonStatistics(
|
||||
List<T> items,
|
||||
Function<T, String> keyExtractor,
|
||||
Function<T, String> statusExtractor,
|
||||
Set<String> allStatus) {
|
||||
|
||||
Map<String, CommonStatisticsVo> statisticsMap = new HashMap<>();
|
||||
|
||||
for (T item : items) {
|
||||
String key = keyExtractor.apply(item);
|
||||
String status = statusExtractor.apply(item);
|
||||
|
||||
if (status != null) {
|
||||
allStatus.add(status);
|
||||
}
|
||||
|
||||
CommonStatisticsVo stat = statisticsMap.computeIfAbsent(key, k -> {
|
||||
CommonStatisticsVo vo = new CommonStatisticsVo();
|
||||
vo.setName(k);
|
||||
return vo;
|
||||
});
|
||||
|
||||
stat.getStatusCount().merge(status, 1, Integer::sum);
|
||||
}
|
||||
|
||||
return statisticsMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建统计结果响应
|
||||
*
|
||||
* @param statisticsMap 统计结果Map
|
||||
* @param allStatus 所有状态值集合
|
||||
* @param statusKey 状态集合在响应中的key名称
|
||||
* @return SdmResponse
|
||||
*/
|
||||
private SdmResponse buildStatisticsResponse(Map<String, CommonStatisticsVo> statisticsMap,
|
||||
Set<String> allStatus,
|
||||
String statusKey) {
|
||||
List<CommonStatisticsVo> result = new ArrayList<>(statisticsMap.values());
|
||||
JSONObject resultResponse = new JSONObject();
|
||||
resultResponse.put(statusKey, allStatus);
|
||||
resultResponse.put("result", result);
|
||||
return SdmResponse.success(resultResponse);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.QueryFileReq;
|
||||
import com.sdm.common.entity.req.data.UpdatePermissionReq;
|
||||
import com.sdm.common.entity.req.export.*;
|
||||
import com.sdm.common.entity.req.project.GetAllTasksByDisciplineReq;
|
||||
import com.sdm.common.entity.req.project.GetTaskDetailReq;
|
||||
import com.sdm.common.entity.req.project.SimulationPerformance;
|
||||
import com.sdm.common.entity.req.system.QueryGroupDetailReq;
|
||||
@@ -1746,6 +1747,14 @@ public class TaskServiceImpl implements ITaskService {
|
||||
return SdmResponse.success(taskVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse<Map<String, List<String>>> getAllTasksByDiscipline(GetAllTasksByDisciplineReq req) {
|
||||
Map<String, List<String>> discipline2TaskUUIDMap = simulationTaskService.lambdaQuery()
|
||||
.in(SimulationTask::getDiscipline, req.getDisciplines())
|
||||
.list().stream().collect(Collectors.groupingBy(SimulationTask::getDiscipline, Collectors.mapping(SimulationTask::getTaskName, Collectors.toList())));
|
||||
return SdmResponse.success(discipline2TaskUUIDMap);
|
||||
}
|
||||
|
||||
private SdmResponse createDir(String uuid, String uuidOwnType, String parentUuid, String dirName) {
|
||||
CreateDirReq createDirReq = new CreateDirReq();
|
||||
createDirReq.setUuId(uuid);
|
||||
|
||||
@@ -573,6 +573,51 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getPerformanceCompleteStatisticsByDiscipline"
|
||||
parameterType="com.sdm.project.model.req.CommonGetCompleteStatisticsReq"
|
||||
resultType="com.sdm.project.model.vo.PerformanceCompleteFromDisciplineVo">
|
||||
select
|
||||
task.discipline,
|
||||
performance.completeStatus
|
||||
from simulation_task task
|
||||
left join simulation_performance performance on performance.taskId = task.uuid
|
||||
<where>
|
||||
performance.completeStatus is not null
|
||||
and
|
||||
task.tenant_Id = #{req.tenantId}
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 = #{req.tag1}
|
||||
</if>
|
||||
<if test="req.tag2 != null and req.tag2 !='' ">
|
||||
and task.tag2 = #{req.tag2}
|
||||
</if>
|
||||
<if test="req.tag3 != null and req.tag3 !='' ">
|
||||
and task.tag3 = #{req.tag3}
|
||||
</if>
|
||||
<if test="req.tag4 != null and req.tag4 !='' ">
|
||||
and task.tag4 = #{req.tag4}
|
||||
</if>
|
||||
<if test="req.tag5 != null and req.tag5 !='' ">
|
||||
and task.tag5 = #{req.tag5}
|
||||
</if>
|
||||
<if test="req.tag6 != null and req.tag6 !='' ">
|
||||
and task.tag6 = #{req.tag6}
|
||||
</if>
|
||||
<if test="req.tag7 != null and req.tag7 !='' ">
|
||||
and task.tag7 = #{req.tag7}
|
||||
</if>
|
||||
<if test="req.tag8 != null and req.tag8 !='' ">
|
||||
and task.tag8 = #{req.tag8}
|
||||
</if>
|
||||
<if test="req.tag9 != null and req.tag9 !='' ">
|
||||
and task.tag9 = #{req.tag9}
|
||||
</if>
|
||||
<if test="req.tag10 != null and req.tag10 !='' ">
|
||||
and task.tag10 = #{req.tag10}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getWorkstationApproveStatus"
|
||||
parameterType="com.sdm.project.model.req.GetWorkstationApproveStatusReq"
|
||||
resultType="com.sdm.project.model.vo.WorkstationApproveStatusVo">
|
||||
|
||||
Reference in New Issue
Block a user