1、项目详情,按工位、学科的仿真任务达成统计接口
2、项目详情,按工位、学科的仿真指标达成统计
This commit is contained in:
@@ -139,4 +139,22 @@ public class SimulationTaskController {
|
||||
return simulationTaskService.editTaskForData(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按工位、学科的仿真任务达成统计
|
||||
*/
|
||||
@PostMapping("/getTaskCompleteStatistics")
|
||||
@Operation(summary = "按工位、学科的仿真任务达成统计", description = "按工位、学科的仿真任务达成统计")
|
||||
public SdmResponse getCommonCompleteStatistics(@RequestBody @Validated TaskCompleteStatisticsReq req) {
|
||||
return taskService.getCommonCompleteStatistics(req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 按工位、学科的仿真指标达成统计
|
||||
*/
|
||||
@PostMapping("/getPerformanceCompleteStatistics")
|
||||
@Operation(summary = "按工位、学科的仿真指标达成统计", description = "按工位、学科的仿真指标达成统计")
|
||||
public SdmResponse getPerformanceCompleteStatistics(@RequestBody @Validated PerformanceCompleteStatisticsReq req) {
|
||||
return taskService.getPerformanceCompleteStatistics(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -39,4 +39,8 @@ public interface SimulationTaskMapper extends BaseMapper<SimulationTask> {
|
||||
|
||||
SpdmTaskVo getTaskById(@Param("id") Long id);
|
||||
|
||||
List<CommonGetCompleteFromTaskVo> getTaskCompleteStatistics(@Param("req") TaskCompleteStatisticsReq req);
|
||||
|
||||
List<CommonGetCompleteFromPerformanceVo> getPerformanceCompleteStatistics(@Param("req") PerformanceCompleteStatisticsReq req);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 指标 完成情况统计请求参数(工位、学科)
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "按工位、学科的仿真指标达成统计")
|
||||
public class PerformanceCompleteStatisticsReq {
|
||||
|
||||
@Schema(description = "数据返回Tag类型: tag1、tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10")
|
||||
@NotNull
|
||||
private String resultTagType;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.sdm.project.model.req;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 任务 完成情况统计请求参数(工位、学科)
|
||||
*/
|
||||
@Data
|
||||
@Schema(description = "按工位、学科的仿真任务达成统计")
|
||||
public class TaskCompleteStatisticsReq {
|
||||
|
||||
@Schema(description = "数据返回Tag类型: tag1、tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10")
|
||||
@NotNull
|
||||
private String resultTagType;
|
||||
|
||||
@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;
|
||||
|
||||
}
|
||||
@@ -55,4 +55,7 @@ public interface ITaskService {
|
||||
|
||||
BosimSaveProjectTaskRsp syncCidTask(SyncCidTaskReq req);
|
||||
|
||||
SdmResponse getCommonCompleteStatistics(TaskCompleteStatisticsReq req);
|
||||
|
||||
SdmResponse getPerformanceCompleteStatistics(PerformanceCompleteStatisticsReq req);
|
||||
}
|
||||
|
||||
@@ -1355,4 +1355,67 @@ public class TaskServiceImpl implements ITaskService {
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getCommonCompleteStatistics(TaskCompleteStatisticsReq req) {
|
||||
// 所有任务执行状态
|
||||
Set<String> allExeStatus = new HashSet<>();
|
||||
List<CommonGetCompleteFromTaskVo> commonCompleteStatisticsFromTask = mapper.getTaskCompleteStatistics(req);
|
||||
// 按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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SdmResponse getPerformanceCompleteStatistics(PerformanceCompleteStatisticsReq req) {
|
||||
// 所有指标执行状态
|
||||
Set<String> allExeStatus = new HashSet<>();
|
||||
// 处理指标完成情况统计
|
||||
List<CommonGetCompleteFromPerformanceVo> commonCompleteStatisticsFromPerformance = mapper.getPerformanceCompleteStatistics(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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -185,5 +185,95 @@
|
||||
select * from simulation_task where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getTaskCompleteStatistics" resultType="com.sdm.project.model.vo.CommonGetCompleteFromTaskVo">
|
||||
select
|
||||
task.${req.resultTagType} as tag,
|
||||
node.nodeName,
|
||||
task.exe_status as exeStatus
|
||||
from simulation_task task
|
||||
left join simulation_node node on task.${req.resultTagType} = node.uuid
|
||||
<where>
|
||||
1=1
|
||||
and node.nodeName is not null and node.nodeName != ''
|
||||
and task.exe_status is not null
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 like CONCAT('%',#{req.tag1},'%')
|
||||
</if>
|
||||
<if test="req.tag2 != null and req.tag2 !='' ">
|
||||
and task.tag2 like CONCAT('%',#{req.tag2},'%')
|
||||
</if>
|
||||
<if test="req.tag3 != null and req.tag3 !='' ">
|
||||
and task.tag3 like CONCAT('%',#{req.tag3},'%')
|
||||
</if>
|
||||
<if test="req.tag4 != null and req.tag4 !='' ">
|
||||
and task.tag4 like CONCAT('%',#{req.tag4},'%')
|
||||
</if>
|
||||
<if test="req.tag5 != null and req.tag5 !='' ">
|
||||
and task.tag5 like CONCAT('%',#{req.tag5},'%')
|
||||
</if>
|
||||
<if test="req.tag6 != null and req.tag6 !='' ">
|
||||
and task.tag6 like CONCAT('%',#{req.tag6},'%')
|
||||
</if>
|
||||
<if test="req.tag7 != null and req.tag7 !='' ">
|
||||
and task.tag7 like CONCAT('%',#{req.tag7},'%')
|
||||
</if>
|
||||
<if test="req.tag8 != null and req.tag8 !='' ">
|
||||
and task.tag8 like CONCAT('%',#{req.tag8},'%')
|
||||
</if>
|
||||
<if test="req.tag9 != null and req.tag9 !='' ">
|
||||
and task.tag9 like CONCAT('%',#{req.tag9},'%')
|
||||
</if>
|
||||
<if test="req.tag10 != null and req.tag10 !='' ">
|
||||
and task.tag10 like CONCAT('%',#{req.tag10},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getPerformanceCompleteStatistics"
|
||||
resultType="com.sdm.project.model.vo.CommonGetCompleteFromPerformanceVo">
|
||||
select
|
||||
task.${req.resultTagType} as tag,
|
||||
node.nodeName,
|
||||
performance.completeStatus
|
||||
from simulation_performance performance
|
||||
left join simulation_task task on performance.taskId = task.uuid
|
||||
left join simulation_node node on task.${req.resultTagType} = node.uuid
|
||||
<where>
|
||||
node.nodeName is not null and node.nodeName != ''
|
||||
and
|
||||
performance.completeStatus is not null
|
||||
<if test="req.tag1 != null and req.tag1 !='' ">
|
||||
and task.tag1 like CONCAT('%',#{req.tag1},'%')
|
||||
</if>
|
||||
<if test="req.tag2 != null and req.tag2 !='' ">
|
||||
and task.tag2 like CONCAT('%',#{req.tag2},'%')
|
||||
</if>
|
||||
<if test="req.tag3 != null and req.tag3 !='' ">
|
||||
and task.tag3 like CONCAT('%',#{req.tag3},'%')
|
||||
</if>
|
||||
<if test="req.tag4 != null and req.tag4 !='' ">
|
||||
and task.tag4 like CONCAT('%',#{req.tag4},'%')
|
||||
</if>
|
||||
<if test="req.tag5 != null and req.tag5 !='' ">
|
||||
and task.tag5 like CONCAT('%',#{req.tag5},'%')
|
||||
</if>
|
||||
<if test="req.tag6 != null and req.tag6 !='' ">
|
||||
and task.tag6 like CONCAT('%',#{req.tag6},'%')
|
||||
</if>
|
||||
<if test="req.tag7 != null and req.tag7 !='' ">
|
||||
and task.tag7 like CONCAT('%',#{req.tag7},'%')
|
||||
</if>
|
||||
<if test="req.tag8 != null and req.tag8 !='' ">
|
||||
and task.tag8 like CONCAT('%',#{req.tag8},'%')
|
||||
</if>
|
||||
<if test="req.tag9 != null and req.tag9 !='' ">
|
||||
and task.tag9 like CONCAT('%',#{req.tag9},'%')
|
||||
</if>
|
||||
<if test="req.tag10 != null and req.tag10 !='' ">
|
||||
and task.tag10 like CONCAT('%',#{req.tag10},'%')
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user