Merge branch 'main' of http://carsafe.uicp.cn/toolchaintechnologycenter/spdm-backend
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);
|
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<UserGroupDifficultyVo> getUserGroupDifficultyStatistics(@Param("req") GetUserGroupTaskCompleteStatisticsReq req,@Param("taskMemberTypeList") List<Integer> taskMemberTypeList);
|
||||||
|
|
||||||
List<CommonGetCompleteFromTaskVo> getCommonCompleteStatisticsFromTask(@Param("req") CommonGetCompleteStatisticsReq req);
|
List<CommonGetCompleteFromTaskVo> getCommonCompleteStatisticsFromTask(@Param("req") CommonGetCompleteStatisticsReq req);
|
||||||
|
|||||||
@@ -116,4 +116,19 @@ public class SpdmNodeVo extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private Integer attentionFlag = 0;
|
private Integer attentionFlag = 0;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务总数
|
||||||
|
*/
|
||||||
|
private Integer taskTotalCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已完成任务数
|
||||||
|
*/
|
||||||
|
private Integer taskCompletedCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 已闭环任务数
|
||||||
|
*/
|
||||||
|
private Integer taskClosedLoopCount;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,8 @@ public class UserGroupTaskCompleteVo {
|
|||||||
private String nickname;
|
private String nickname;
|
||||||
private Long userId;
|
private Long userId;
|
||||||
private Long groupId;
|
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.bo.ExportOperate;
|
||||||
import com.sdm.project.common.MemberTypeEnum;
|
import com.sdm.project.common.MemberTypeEnum;
|
||||||
import com.sdm.project.common.NodeMemberTypeEnum;
|
import com.sdm.project.common.NodeMemberTypeEnum;
|
||||||
|
import com.sdm.project.common.TaskExeStatusEnum;
|
||||||
import com.sdm.project.dao.SimulationDemandMapper;
|
import com.sdm.project.dao.SimulationDemandMapper;
|
||||||
import com.sdm.project.dao.SimulationNodeMapper;
|
import com.sdm.project.dao.SimulationNodeMapper;
|
||||||
import com.sdm.project.dao.SimulationProjectMapper;
|
import com.sdm.project.dao.SimulationProjectMapper;
|
||||||
@@ -674,6 +675,8 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
|||||||
// 将当前阶段放到项目对象中返回
|
// 将当前阶段放到项目对象中返回
|
||||||
setCurrentPhase(nodeList);
|
setCurrentPhase(nodeList);
|
||||||
|
|
||||||
|
// 获取项目下的任务完成情况统计
|
||||||
|
setTaskCompleteStatistics(nodeList);
|
||||||
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("data", nodeList);
|
jsonObject.put("data", nodeList);
|
||||||
@@ -701,6 +704,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类型项目当前阶段信息
|
* 设置EP类型项目当前阶段信息
|
||||||
* @param dmProjectNodeList
|
* @param dmProjectNodeList
|
||||||
|
|||||||
@@ -874,7 +874,7 @@ public class SimulationRunServiceImpl extends ServiceImpl<SimulationRunMapper, S
|
|||||||
}
|
}
|
||||||
for (FlowNodeDto flowNodeDto : flowNodeDtoList) {
|
for (FlowNodeDto flowNodeDto : flowNodeDtoList) {
|
||||||
// 每个流程节点建立节点文件夹
|
// 每个流程节点建立节点文件夹
|
||||||
SdmResponse nodeDirResponse = createDir(flowNodeDto.getUuid(), simulationRun.getUuid(), flowNodeDto.getNodeName(), DirTypeEnum.PROJECT_NODE_DIR.getValue(), NodeTypeEnum.FLOW_NODE.getValue());
|
SdmResponse nodeDirResponse = createDir(null, simulationRun.getUuid(), flowNodeDto.getNodeName(), DirTypeEnum.PROJECT_NODE_DIR.getValue(), null);
|
||||||
if (!nodeDirResponse.isSuccess()) {
|
if (!nodeDirResponse.isSuccess()) {
|
||||||
log.error("创建节点文件夹失败:{}", nodeDirResponse.getMessage());
|
log.error("创建节点文件夹失败:{}", nodeDirResponse.getMessage());
|
||||||
throw new RuntimeException("创建节点文件夹失败:" + nodeDirResponse.getMessage());
|
throw new RuntimeException("创建节点文件夹失败:" + nodeDirResponse.getMessage());
|
||||||
|
|||||||
@@ -563,6 +563,27 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</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"
|
<select id="getUserGroupDifficultyStatistics"
|
||||||
parameterType="com.sdm.project.model.req.GetUserGroupTaskCompleteStatisticsReq"
|
parameterType="com.sdm.project.model.req.GetUserGroupTaskCompleteStatisticsReq"
|
||||||
resultType="com.sdm.project.model.vo.UserGroupDifficultyVo">
|
resultType="com.sdm.project.model.vo.UserGroupDifficultyVo">
|
||||||
|
|||||||
Reference in New Issue
Block a user