@@ -1178,8 +1178,8 @@ public class TaskServiceImpl implements ITaskService {
StopWatch stopWatch = new StopWatch ( " 所有任务方法计时 " ) ;
stopWatch . start ( " 查所有任务 " ) ;
// 二次查询过滤学科
if ( StringUtils . isNotBlank ( req . getDiscipline ( ) ) ) {
req . setFilterDiscipline ( Collections . singletonList ( req . getDiscipline ( ) ) ) ;
if ( StringUtils . isNotBlank ( req . getOwn DisciplineName ( ) ) ) {
req . setFilterDiscipline ( Collections . singletonList ( req . getOwn DisciplineName ( ) ) ) ;
}
List < SpdmTaskVo > allTaskList = mapper . optimisedGtTaskList ( tenantId , req ) ;
stopWatch . stop ( ) ;
@@ -2066,11 +2066,13 @@ public class TaskServiceImpl implements ITaskService {
int limit = req . getSize ( ) ;
Long tenantId = ThreadLocalContext . getTenantId ( ) ;
Long userId = ThreadLocalContext . getUserId ( ) ;
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " total " , 0 ) ;
TagReq tagReq = req . getTagReq ( ) ;
if ( ObjectUtils . isEmpty ( tagReq ) ) {
log . error ( " tagReq为空 " ) ;
return oldAnalysisTaskList ( req ) ;
jsonObject . put ( " data " , new ArrayList < > ( ) ) ;
return SdmResponse . success ( jsonObject ) ;
}
// key可能为多个, 根据逗号转化为集合
List < String > tag1KeyList = new ArrayList < > ( ) ;
@@ -2129,10 +2131,8 @@ public class TaskServiceImpl implements ITaskService {
String taskNodeId = tagReq . getTaskId ( ) ;
List < SpdmAnalysisTaskVo > taskVoList ;
List < SpdmAnalysisTaskVo > allTaskVoList = new ArrayList < > ( ) ;
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( " total " , 0 ) ;
if ( StringUtils . isNotBlank ( taskNodeId ) ) {
allTaskVoList = mapper . getAnalysisTask ( taskNodeId ) ;
allTaskVoList = mapper . getAnalysisTask ( taskNodeId , req . getOwnDisciplineName ( ) );
} else {
taskVoList = mapper . taskListByTag ( req , tenantId , new ArrayList < > ( ) , pos , limit , userId ,
tag1KeyList , tag2KeyList , tag3KeyList , tag4KeyList , tag5KeyList , tag6KeyList , tag7KeyList
@@ -2347,146 +2347,146 @@ public class TaskServiceImpl implements ITaskService {
return SdmResponse . success ( jsonObject ) ;
}
public SdmResponse oldAnalysisTaskList( SpdmAnalysisTaskListReq req ) {
int pos = ( req . getCurrent ( ) - 1 ) * req . getSize ( ) ;
int limit = req . getSize ( ) ;
Long tenantId = ThreadLocalContext. getTenantId( ) ;
Long userId = ThreadLocalContext. getUserId( ) ;
String projectNodeId = req . getProjectNodeId( ) ;
String phaseNodeId = req . getPhaseNodeId( ) ;
String machineNodeId = req . getMachineNodeId( ) ;
String workspaceNodeId = req . getWorkspaceNodeId( ) ;
String disciplineNodeId = req . getDisciplineNodeId( ) ;
String nodeId = " " ;
String nodeTag = " " ;
if ( StringUtils. isNotBlank( projectNodeId) ) {
nodeId = projectNodeId ;
nodeTag = " tag1 " ;
}
if ( StringUtils. isNotBlank( phaseNodeId) ) {
nodeId = phaseNodeId ;
nodeTag = " tag2 " ;
}
if ( StringUtils. isNotBlank( machineNodeId) ) {
nodeId = machineNodeId ;
nodeTag = " tag4 " ;
}
if ( StringUtils. isNotBlank( workspaceNodeId) ) {
nodeId = workspaceNodeId ;
nodeTag = " tag5 " ;
}
if ( StringUtils. isNotBlank( disciplineNodeId) ) {
nodeId = disciplineNodeId ;
nodeTag = " tag6 " ;
}
List< String> allNodeIdList = new ArrayList < > ( ) ;
if ( StringUtils. isNotBlank( nodeId) ) {
allNodeIdList. add ( nodeId) ;
recursionAllNodeIdList( Collections. singletonList( nodeId) , allNodeIdList) ;
}
String taskNodeId = req . getTaskNodeId( ) ;
List< SpdmAnalysisTaskVo> taskVoList ;
List< SpdmAnalysisTaskVo> allTaskVoList = new ArrayList < > ( ) ;
JSONObject jsonObject = new JSONObject( ) ;
jsonObject. put ( " total " , 0 ) ;
if ( StringUtils. isNotBlank( taskNodeId) ) {
allTaskVoList = mapper. getAnalysisTask( taskNodeId) ;
} else {
taskVoList = mapper. taskList( req , tenantId , new ArrayList < > ( ) , pos , limit , userId) ;
if ( CollectionUtils. isEmpty( taskVoList) ) {
log. error ( " 数据分析中未查询到任务信息" ) ;
jsonObject. put ( " data " , new ArrayList < > ( ) ) ;
return SdmResponse. success( jsonObject) ;
}
if ( StringUtils. isNotBlank( nodeId) & & StringUtils. isNotBlank( nodeTag) ) {
String currentNodeTagId = " " ;
for ( SpdmAnalysisTaskVo spdmTaskVo : taskVoList) {
try {
currentNodeTagId = getTagProperty( spdmTaskVo, nodeTag) ;
if ( StringUtils. isNotBlank( currentNodeTagId) & & currentNodeTagId. contains( nodeId) ) {
allTaskVoList. add ( spdmTaskVo) ;
}
} catch ( Exception e ) {
throw new RuntimeException( e ) ;
}
}
} else {
allTaskVoList = taskVoList ;
}
}
if ( CollectionUtils. isEmpty( allTaskVoList) ) {
log. error ( " 数据分析中未查询到任务信息" ) ;
jsonObject. put ( " data " , new ArrayList < > ( ) ) ;
return SdmResponse. success( jsonObject) ;
}
jsonObject. put ( " total " , allTaskVoList . size ( ) ) ;
taskVoList = allTaskVoList. stream( ) . skip ( ( long ) ( req . getCurrent ( ) - 1 ) * req . getSize ( ) ) . limit ( req . getSize ( ) ) . toList ( ) ;
if ( CollectionUtils. isEmpty( taskVoList) ) {
log. error ( " 数据分析中未查询到任务信息" ) ;
jsonObject. put ( " data " , new ArrayList < > ( ) ) ;
return SdmResponse. success( jsonObject) ;
}
List< ProjectNodePo> allNodeList = projectMapper. getNodeListByNodeIdList( allNodeIdList) ;
Map< String, ProjectNodePo> nodeMap = allNodeList. stream( )
. collect( Collectors. toMap (
ProjectNodePo: : getUuid, // key: 取uuid
Function. identity( ) , // value: 取对象本身
( existing, replacement) - > existing // 重复时保留已存在的(第一个)元素
) ) ;
// 设置仿真负责人
List< String> taskIdList = taskVoList. stream( ) . map ( SpdmAnalysisTaskVo : : getUuid ) . toList ( ) ;
List< TaskNodeMemberPo> taskNodeMemberPoList = projectMapper. queryTaskNodeMembersByNodeIdList( taskIdList) ;
Map< String, List < TaskNodeMemberPo > > memberMap = new HashMap < > ( ) ;
Map< Long , String > cidUserMap = new HashMap < > ( ) ;
if ( CollectionUtils. isNotEmpty( taskNodeMemberPoList) ) {
taskNodeMemberPoList = taskNodeMemberPoList. stream( ) . filter( member - > MemberTypeEnum. PRINCIPAL. getCode( ) . equals( member. getType( ) ) ) . toList ( ) ;
if ( CollectionUtils. isNotEmpty( taskNodeMemberPoList) ) {
memberMap = taskNodeMemberPoList. stream( ) . collect( Collectors. groupingBy( TaskNodeMemberPo: : getTaskId) ) ;
SdmResponse< List < CIDUserResp > > cidUserResp = sysUserFeignClient. listUserByIds( UserQueryReq. builder( )
. userIds( taskNodeMemberPoList. stream( ) . map ( TaskNodeMemberPo: : getUserId) . toList ( ) ) . build ( ) ) ;
List< CIDUserResp> cidUserRespList ;
if ( cidUserResp. isSuccess( ) & & CollectionUtils. isNotEmpty( cidUserRespList = cidUserResp. getData( ) ) ) {
cidUserMap = cidUserRespList. stream( ) . collect( Collectors. toMap ( CIDUserResp: : getUserId, CIDUserResp: : getNickname) ) ;
}
}
}
ProjectNodePo eachProjectNodePo ;
List< TaskNodeMemberPo> eachTaskNodeMemberPoList ;
for ( SpdmAnalysisTaskVo task : taskVoList) {
eachProjectNodePo = nodeMap . get ( task . getNodeId ( ) ) ;
// SpdmNodeVo phaseNode = nodeMapper.getNodeById(task.getTag2());
ProjectNodePo phaseNode = nodeMap . get ( task . getTag2 ( ) ) ;
if ( phaseNode ! = null ) {
task. setPhaseName( phaseNode. getNodeName( ) ) ;
}
// SpdmNodeVo projectNode = nodeMapper.getNodeById(task.getTag1());
ProjectNodePo projectNode = nodeMap . get ( task . getTag1 ( ) ) ;
if ( projectNode ! = null ) {
task. setProjectName( projectNode. getNodeName( ) ) ;
}
if ( eachProjectNodePo ! = null & & NodeTypeEnum. DISCIPLINE. getValue( ) . equals( eachProjectNodePo. getNodeType( ) ) ) {
task. setDisciplineName( eachProjectNodePo. getNodeName( ) ) ;
}
eachTaskNodeMemberPoList = memberMap . get ( task . getUuid ( ) ) ;
if ( CollectionUtils. isNotEmpty( eachTaskNodeMemberPoList) & & MapUtils. isNotEmpty( cidUserMap) ) {
List< String> nickNameList = new ArrayList < > ( ) ;
for ( TaskNodeMemberPo taskNodeMemberPo : eachTaskNodeMemberPoList) {
String nickName = cidUserMap . get ( taskNodeMemberPo. getUserId( ) ) ;
if ( StringUtils. isBlank( nickName) ) {
continue ;
}
nickNameList. add ( nickName) ;
}
task. setPMembers( String. join ( " , " , nickNameList) ) ;
}
}
jsonObject. put ( " currentPage " , req . getCurrent ( ) ) ;
jsonObject. put ( " pageSize " , req . getSize ( ) ) ;
jsonObject. put ( " data " , taskVoList) ;
return SdmResponse. success( jsonObject) ;
}
// public SdmResponse oldAnalysisTaskList( SpdmAnalysisTaskListReq req) {
// int pos = (req.getCurrent() - 1) * req.getSize() ;
// int limit = req.getSize() ;
// Long tenantId = ThreadLocalContext. getTenantId() ;
// Long userId = ThreadLocalContext. getUserId() ;
// String projectNodeId = req. getProjectNodeId() ;
// String phaseNodeId = req. getPhaseNodeId() ;
// String machineNodeId = req. getMachineNodeId() ;
// String workspaceNodeId = req. getWorkspaceNodeId() ;
// String disciplineNodeId = req. getDisciplineNodeId() ;
// String nodeId = "" ;
// String nodeTag = "" ;
// if ( StringUtils. isNotBlank( projectNodeId)) {
// nodeId = projectNodeId;
// nodeTag = "tag1" ;
// }
// if ( StringUtils. isNotBlank( phaseNodeId)) {
// nodeId = phaseNodeId;
// nodeTag = "tag2" ;
// }
// if ( StringUtils. isNotBlank( machineNodeId)) {
// nodeId = machineNodeId;
// nodeTag = "tag4" ;
// }
// if ( StringUtils. isNotBlank( workspaceNodeId)) {
// nodeId = workspaceNodeId;
// nodeTag = "tag5" ;
// }
// if ( StringUtils. isNotBlank( disciplineNodeId)) {
// nodeId = disciplineNodeId;
// nodeTag = "tag6" ;
// }
// List< String> allNodeIdList = new ArrayList<>() ;
// if ( StringUtils. isNotBlank( nodeId)) {
// allNodeIdList.add( nodeId) ;
// recursionAllNodeIdList( Collections. singletonList( nodeId), allNodeIdList) ;
// }
// String taskNodeId = req. getTaskNodeId() ;
// List< SpdmAnalysisTaskVo> taskVoList;
// List< SpdmAnalysisTaskVo> allTaskVoList = new ArrayList<>() ;
// JSONObject jsonObject = new JSONObject() ;
// jsonObject.put("total", 0) ;
// if ( StringUtils. isNotBlank( taskNodeId)) {
// allTaskVoList = mapper. getAnalysisTask( taskNodeId) ;
// } else {
// taskVoList = mapper. taskList(req, tenantId, new ArrayList<>(), pos, limit, userId) ;
// if ( CollectionUtils. isEmpty( taskVoList)) {
// log.error(" 数据分析中未查询到任务信息") ;
// jsonObject.put("data", new ArrayList<>()) ;
// return SdmResponse. success( jsonObject) ;
// }
// if ( StringUtils. isNotBlank( nodeId) && StringUtils. isNotBlank( nodeTag)) {
// String currentNodeTagId = "" ;
// for ( SpdmAnalysisTaskVo spdmTaskVo : taskVoList) {
// try {
// currentNodeTagId = getTagProperty( spdmTaskVo, nodeTag) ;
// if ( StringUtils. isNotBlank( currentNodeTagId) && currentNodeTagId. contains( nodeId)) {
// allTaskVoList.add( spdmTaskVo) ;
// }
// } catch (Exception e) {
// throw new RuntimeException(e) ;
// }
// }
// } else {
// allTaskVoList = taskVoList;
// }
// }
// if ( CollectionUtils. isEmpty( allTaskVoList)) {
// log.error(" 数据分析中未查询到任务信息") ;
// jsonObject.put("data", new ArrayList<>()) ;
// return SdmResponse. success( jsonObject) ;
// }
// jsonObject.put("total", allTaskVoList.size()) ;
// taskVoList = allTaskVoList. stream().skip((long) (req.getCurrent() - 1) * req.getSize()).limit(req.getSize()).toList() ;
// if ( CollectionUtils. isEmpty( taskVoList)) {
// log.error(" 数据分析中未查询到任务信息") ;
// jsonObject.put("data", new ArrayList<>()) ;
// return SdmResponse. success( jsonObject) ;
// }
// List< ProjectNodePo> allNodeList = projectMapper. getNodeListByNodeIdList( allNodeIdList) ;
// Map< String, ProjectNodePo> nodeMap = allNodeList. stream( )
// . collect( Collectors. toMap(
// ProjectNodePo:: getUuid, // key: 取uuid
// Function. identity(), // value: 取对象本身
// ( existing, replacement) -> existing // 重复时保留已存在的(第一个)元素
// )) ;
// // 设置仿真负责人
// List< String> taskIdList = taskVoList. stream().map(SpdmAnalysisTaskVo::getUuid).toList() ;
// List< TaskNodeMemberPo> taskNodeMemberPoList = projectMapper. queryTaskNodeMembersByNodeIdList( taskIdList) ;
// Map< String, List<TaskNodeMemberPo>> memberMap = new HashMap<>() ;
// Map<Long, String> cidUserMap = new HashMap<>() ;
// if ( CollectionUtils. isNotEmpty( taskNodeMemberPoList)) {
// taskNodeMemberPoList = taskNodeMemberPoList. stream(). filter( member -> MemberTypeEnum. PRINCIPAL. getCode(). equals( member. getType())).toList() ;
// if ( CollectionUtils. isNotEmpty( taskNodeMemberPoList)) {
// memberMap = taskNodeMemberPoList. stream(). collect( Collectors. groupingBy( TaskNodeMemberPo:: getTaskId)) ;
// SdmResponse<List<CIDUserResp>> cidUserResp = sysUserFeignClient. listUserByIds( UserQueryReq. builder( )
// . userIds( taskNodeMemberPoList. stream().map( TaskNodeMemberPo:: getUserId).toList()).build()) ;
// List< CIDUserResp> cidUserRespList;
// if ( cidUserResp. isSuccess() && CollectionUtils. isNotEmpty( cidUserRespList = cidUserResp. getData())) {
// cidUserMap = cidUserRespList. stream(). collect( Collectors.toMap( CIDUserResp:: getUserId, CIDUserResp:: getNickname)) ;
// }
// }
// }
// ProjectNodePo eachProjectNodePo;
// List< TaskNodeMemberPo> eachTaskNodeMemberPoList;
// for ( SpdmAnalysisTaskVo task : taskVoList) {
// eachProjectNodePo = nodeMap.get(task.getNodeId()) ;
//
//// SpdmNodeVo phaseNode = nodeMapper.getNodeById(task.getTag2());
// ProjectNodePo phaseNode = nodeMap.get(task.getTag2()) ;
// if (phaseNode != null) {
// task. setPhaseName( phaseNode. getNodeName()) ;
// }
//// SpdmNodeVo projectNode = nodeMapper.getNodeById(task.getTag1());
// ProjectNodePo projectNode = nodeMap.get(task.getTag1()) ;
// if (projectNode != null) {
// task. setProjectName( projectNode. getNodeName()) ;
// }
// if ( eachProjectNodePo != null && NodeTypeEnum. DISCIPLINE. getValue(). equals( eachProjectNodePo. getNodeType())) {
// task. setDisciplineName( eachProjectNodePo. getNodeName()) ;
// }
//
// eachTaskNodeMemberPoList = memberMap.get(task.getUuid()) ;
// if ( CollectionUtils. isNotEmpty( eachTaskNodeMemberPoList) && MapUtils. isNotEmpty( cidUserMap)) {
// List< String> nickNameList = new ArrayList<>() ;
// for ( TaskNodeMemberPo taskNodeMemberPo : eachTaskNodeMemberPoList) {
// String nickName = cidUserMap.get( taskNodeMemberPo. getUserId()) ;
// if ( StringUtils. isBlank( nickName)) {
// continue;
// }
// nickNameList.add( nickName) ;
// }
// task. setPMembers( String.join(",", nickNameList)) ;
// }
// }
// jsonObject.put("currentPage", req.getCurrent()) ;
// jsonObject.put("pageSize", req.getSize()) ;
// jsonObject.put("data", taskVoList) ;
// return SdmResponse. success( jsonObject) ;
// }
@Override