fix:项目列表显示任务的已完成和已闭环数
This commit is contained in:
@@ -93,6 +93,11 @@ public interface SimulationNodeMapper extends BaseMapper<SimulationNode> {
|
||||
|
||||
List<UserGroupTaskCompleteVo> getAllUserTaskCompleteStatistics(@Param("req") GetAllUserTaskCompleteStatisticsReq req,@Param("taskMemberTypeList") List<Integer> taskMemberTypeList);
|
||||
|
||||
/**
|
||||
* 根据项目uuid列表获取任务完成情况统计
|
||||
*/
|
||||
List<UserGroupTaskCompleteVo> getTaskCompleteStatisticsByNodeIds(@Param("tenantId") Long tenantId, @Param("nodeIdList") List<String> nodeIdList);
|
||||
|
||||
List<UserGroupDifficultyVo> getUserGroupDifficultyStatistics(@Param("req") GetUserGroupTaskCompleteStatisticsReq req,@Param("taskMemberTypeList") List<Integer> taskMemberTypeList);
|
||||
|
||||
List<CommonGetCompleteFromTaskVo> getCommonCompleteStatisticsFromTask(@Param("req") CommonGetCompleteStatisticsReq req);
|
||||
|
||||
@@ -116,4 +116,19 @@ public class SpdmNodeVo extends BaseEntity {
|
||||
*/
|
||||
private Integer attentionFlag = 0;
|
||||
|
||||
/**
|
||||
* 任务总数
|
||||
*/
|
||||
private Integer taskTotalCount;
|
||||
|
||||
/**
|
||||
* 已完成任务数
|
||||
*/
|
||||
private Integer taskCompletedCount;
|
||||
|
||||
/**
|
||||
* 已闭环任务数
|
||||
*/
|
||||
private Integer taskClosedLoopCount;
|
||||
|
||||
}
|
||||
|
||||
@@ -8,4 +8,8 @@ public class UserGroupTaskCompleteVo {
|
||||
private String nickname;
|
||||
private Long userId;
|
||||
private Long groupId;
|
||||
/**
|
||||
* 项目uuid(task.tag1)
|
||||
*/
|
||||
private String nodeId;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import com.sdm.outbridge.service.lyric.*;
|
||||
import com.sdm.project.bo.ExportOperate;
|
||||
import com.sdm.project.common.MemberTypeEnum;
|
||||
import com.sdm.project.common.NodeMemberTypeEnum;
|
||||
import com.sdm.project.common.TaskExeStatusEnum;
|
||||
import com.sdm.project.dao.SimulationDemandMapper;
|
||||
import com.sdm.project.dao.SimulationNodeMapper;
|
||||
import com.sdm.project.dao.SimulationProjectMapper;
|
||||
@@ -670,6 +671,8 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
// 将当前阶段放到项目对象中返回
|
||||
setCurrentPhase(nodeList);
|
||||
|
||||
// 获取项目下的任务完成情况统计
|
||||
setTaskCompleteStatistics(nodeList);
|
||||
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("data", nodeList);
|
||||
@@ -697,6 +700,68 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置项目下的任务完成情况统计
|
||||
* @param nodeList 项目列表
|
||||
*/
|
||||
public void setTaskCompleteStatistics(List<SpdmNodeVo> nodeList) {
|
||||
if (CollectionUtils.isEmpty(nodeList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取所有项目的uuid
|
||||
List<String> nodeUuidList = nodeList.stream()
|
||||
.map(SpdmNodeVo::getUuid)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtils.isEmpty(nodeUuidList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 获取任务统计数据
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
List<UserGroupTaskCompleteVo> taskCompleteList = this.baseMapper.getTaskCompleteStatisticsByNodeIds(tenantId, nodeUuidList);
|
||||
|
||||
if (CollectionUtils.isEmpty(taskCompleteList)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 按项目uuid(nodeId)分组统计
|
||||
Map<String, Integer> totalCountMap = new HashMap<>();
|
||||
Map<String, Integer> completedCountMap = new HashMap<>();
|
||||
Map<String, Integer> closedLoopCountMap = new HashMap<>();
|
||||
|
||||
for (UserGroupTaskCompleteVo vo : taskCompleteList) {
|
||||
String nodeId = vo.getNodeId();
|
||||
if (StringUtils.isBlank(nodeId)) {
|
||||
continue;
|
||||
}
|
||||
String exeStatus = vo.getExeStatus();
|
||||
|
||||
// 统计总数
|
||||
totalCountMap.merge(nodeId, 1, Integer::sum);
|
||||
|
||||
// 统计已完成数
|
||||
if (TaskExeStatusEnum.COMPLETED.getCode().equals(exeStatus)) {
|
||||
completedCountMap.merge(nodeId, 1, Integer::sum);
|
||||
}
|
||||
|
||||
// 统计已闭环数
|
||||
if (TaskExeStatusEnum.CLOSED_LOOP.getCode().equals(exeStatus)) {
|
||||
closedLoopCountMap.merge(nodeId, 1, Integer::sum);
|
||||
}
|
||||
}
|
||||
|
||||
// 设置每个项目的统计信息
|
||||
for (SpdmNodeVo node : nodeList) {
|
||||
String uuid = node.getUuid();
|
||||
node.setTaskTotalCount(totalCountMap.getOrDefault(uuid, 0));
|
||||
node.setTaskCompletedCount(completedCountMap.getOrDefault(uuid, 0));
|
||||
node.setTaskClosedLoopCount(closedLoopCountMap.getOrDefault(uuid, 0));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置EP类型项目当前阶段信息
|
||||
* @param dmProjectNodeList
|
||||
|
||||
@@ -563,6 +563,27 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getTaskCompleteStatisticsByNodeIds"
|
||||
resultType="com.sdm.project.model.vo.UserGroupTaskCompleteVo">
|
||||
select
|
||||
distinct
|
||||
task.uuid,
|
||||
task.exe_status as exeStatus,
|
||||
task.tag1 as nodeId
|
||||
from simulation_task task
|
||||
<where>
|
||||
task.tenant_Id = #{tenantId}
|
||||
<if test="nodeIdList != null and nodeIdList.size > 0">
|
||||
and task.tag1 in
|
||||
(
|
||||
<foreach collection='nodeIdList' item='nodeId' index='index' separator=','>
|
||||
#{nodeId}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getUserGroupDifficultyStatistics"
|
||||
parameterType="com.sdm.project.model.req.GetUserGroupTaskCompleteStatisticsReq"
|
||||
resultType="com.sdm.project.model.vo.UserGroupDifficultyVo">
|
||||
|
||||
Reference in New Issue
Block a user