Merge branch 'main' of http://192.168.65.198:3000/toolchaintechnologycenter/spdm-backend
This commit is contained in:
@@ -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/performance
|
||||
* tag1-tag10 标签
|
||||
* resultTagType X轴(工位对应的tag)数据返回对应的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);
|
||||
|
||||
@@ -11,13 +11,11 @@ import lombok.Data;
|
||||
@Schema(description = "任务/指标 完成情况统计请求参数(工位、学科)")
|
||||
public class CommonGetCompleteStatisticsReq {
|
||||
@Schema(description = "查询统计类型 task/performance")
|
||||
@NotNull
|
||||
private String queryType;
|
||||
|
||||
private Long tenantId;
|
||||
|
||||
@Schema(description = "数据返回Tag类型: tag1、tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10")
|
||||
@NotNull
|
||||
private String resultTagType;
|
||||
|
||||
@Schema(description = "标签1")
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -1271,20 +1271,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);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
@@ -1298,7 +1294,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());
|
||||
@@ -1311,6 +1307,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);
|
||||
@@ -1327,20 +1325,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);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
@@ -1382,20 +1376,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);
|
||||
}
|
||||
|
||||
// 转换为列表返回
|
||||
@@ -1408,113 +1398,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
|
||||
@@ -2407,4 +2372,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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1115,8 +1115,11 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
||||
@Override
|
||||
public SdmResponse<PageDataResp<List<SimulationRunKeyResult>>> listSimulationKeyResult(KeyResultReq req) {
|
||||
PageHelper.startPage(req.getCurrent(), req.getSize());
|
||||
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.lambdaQuery().eq(SimulationRunKeyResult::getRunId, req.getRunId())
|
||||
.eq(SimulationRunKeyResult::getKeyResultType, req.getKeyResultType()).list();
|
||||
List<SimulationRunKeyResult> runKeyResults = simulationKeyResultService.lambdaQuery()
|
||||
.eq(ObjectUtils.isNotEmpty(req.getRunId()),SimulationRunKeyResult::getRunId, req.getRunId())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getKeyResultType()),SimulationRunKeyResult::getKeyResultType, req.getKeyResultType())
|
||||
.eq(ObjectUtils.isNotEmpty(req.getFileId()),SimulationRunKeyResult::getFileId, req.getFileId())
|
||||
.list();
|
||||
PageInfo<SimulationRunKeyResult> page = new PageInfo<>(runKeyResults);
|
||||
return PageUtils.getJsonObjectSdmResponse(runKeyResults, page);
|
||||
}
|
||||
|
||||
@@ -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