@@ -9,7 +9,10 @@ import com.sdm.common.common.ThreadLocalContext;
import com.sdm.common.entity.ExportExcelFormat ;
import com.sdm.common.entity.constants.ProjectConstants ;
import com.sdm.common.entity.enums.* ;
import com.sdm.common.entity.req.data.* ;
import com.sdm.common.entity.req.data.BatchUpdatePermissionReq ;
import com.sdm.common.entity.req.data.CreateDirReq ;
import com.sdm.common.entity.req.data.DelDirReq ;
import com.sdm.common.entity.req.data.UpdatePermissionReq ;
import com.sdm.common.entity.req.export.PerformanceAnalysisExportExcelFormat ;
import com.sdm.common.entity.req.export.RunAnalysisExportExcelFormat ;
import com.sdm.common.entity.req.export.TaskAnalysisExportExcelFormat ;
@@ -23,16 +26,11 @@ import com.sdm.common.entity.req.system.UserListReq;
import com.sdm.common.entity.req.system.UserQueryReq ;
import com.sdm.common.entity.req.task.TaskExportExcelFormat ;
import com.sdm.common.entity.req.task.TaskExportExcelParam ;
import com.sdm.common.entity.req.task.TaskTreeExportExcelFormat ;
import com.sdm.common.entity.req.task.TaskTreeExportExcelParam ;
import com.sdm.common.entity.resp.PageDataResp ;
import com.sdm.common.entity.resp.capability.FlowTemplateResp ;
import com.sdm.common.entity.resp.data.FileMetadataInfoResp ;
import com.sdm.common.entity.resp.project.SpdmTaskVo ;
import com.sdm.common.entity.resp.project.TaskNodeExtraPo ;
import com.sdm.common.entity.resp.system.CIDUserResp ;
import com.sdm.common.entity.resp.system.SysUserGroupDetailResp ;
import com.sdm.common.feign.impl.capability.SimulationFlowFeignClientImpl ;
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl ;
import com.sdm.common.feign.impl.system.MessageFeignClientImpl ;
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl ;
@@ -69,7 +67,6 @@ import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils ;
import org.apache.commons.lang3.ObjectUtils ;
import org.apache.commons.lang3.StringUtils ;
import org.jetbrains.annotations.NotNull ;
import org.mybatis.spring.MyBatisSystemException ;
import org.springframework.beans.BeanUtils ;
import org.springframework.beans.factory.annotation.Autowired ;
@@ -249,7 +246,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 批量查询所有关联数据
*/
private BatchAssociatedData batchQueryAssociatedData ( List < SpdmTaskVo > taskList , SpdmTaskListReq req ) {
private BatchAssociatedData batchQueryAssociatedData ( List < SpdmTaskVo > taskList , SpdmTaskListReq req ) {
List < String > taskIdList = taskList . stream ( ) . map ( SpdmTaskVo : : getUuid ) . collect ( Collectors . toList ( ) ) ;
// 1. 批量查询任务成员
@@ -443,7 +440,7 @@ public class TaskServiceImpl implements ITaskService {
String jobNumber = ThreadLocalContext . getJobNumber ( ) ;
// 维度1: 项目参与人员( 根据工号匹配任务名称)
log . info ( " lyricFlag为: {} " , lyricFlag ) ;
log . info ( " lyricFlag为: {} " , lyricFlag ) ;
if ( StringUtils . isNotBlank ( jobNumber ) & & lyricFlag = = 1 ) {
try {
Set < String > userJoinTaskNameSet = lyricVProjectResourcePlanDMService . lambdaQuery ( )
@@ -620,7 +617,7 @@ public class TaskServiceImpl implements ITaskService {
if ( sortOrder ! = null ) {
if ( sortOrder = = 0 ) {
taskList = taskList . stream ( ) . sorted ( Comparator . comparing ( SpdmTaskVo : : getCreateTime ) ) . toList ( ) ;
} else if ( sortOrder = = 1 ) {
} else if ( sortOrder = = 1 ) {
taskList = taskList . stream ( ) . sorted ( Comparator . comparing ( SpdmTaskVo : : getCreateTime ) . reversed ( ) ) . toList ( ) ;
}
}
@@ -638,6 +635,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 根据用户ID列表获取用户信息列表(
*
* @param userIdList 用户ID列表( 可为空)
* @param cidUserMap 用户ID->用户信息的映射
* @return 匹配到的用户信息列表
@@ -654,9 +652,10 @@ public class TaskServiceImpl implements ITaskService {
/**
* 设置任务成员信息(负责人/执行人/关注人)
* @param newTaskVo 目标VO
*
* @param newTaskVo 目标VO
* @param taskMemberList 该任务的成员列表
* @param cidUserMap 用户ID->用户信息的映射
* @param cidUserMap 用户ID->用户信息的映射
*/
private void setTaskMemberInfo ( SpdmNewTaskVo newTaskVo ,
List < SpdmTaskMemberVo > taskMemberList ,
@@ -681,9 +680,10 @@ public class TaskServiceImpl implements ITaskService {
/**
* 设置需求相关信息(需求名称/提出人/提出人名称)
* @param newTaskVo 目标VO
* @param demandId 需求ID
* @param demandMap 需求ID->需求VO的映射
*
* @param newTaskVo 目标VO
* @param demandId 需求ID
* @param demandMap 需求ID->需求VO的映射
* @param demandSubmitMap 需求ID->提出人用户ID的映射
*/
private void setDemandRelatedInfo ( SpdmNewTaskVo newTaskVo ,
@@ -904,7 +904,7 @@ public class TaskServiceImpl implements ITaskService {
// 4. 批量查询关联数据
stopWatch . start ( " 批量查询关联数据 " ) ;
BatchAssociatedData batchData = batchQueryAssociatedData ( taskList , req ) ;
BatchAssociatedData batchData = batchQueryAssociatedData ( taskList , req ) ;
stopWatch . stop ( ) ;
// 5. 按类型过滤任务(我执行的/我关注的/我分发的/所有)
@@ -972,7 +972,7 @@ public class TaskServiceImpl implements ITaskService {
// yangyang
String value = taskNodeTag . getValue ( ) ;
// tag5---> newTag5
String newValue = " new " + StringUtils . capitalize ( value ) ;
String newValue = " new " + StringUtils . capitalize ( value ) ;
workSpaceUuid = getTagProperty ( taskVo , newValue ) ;
} catch ( Exception e ) {
log . warn ( " get taskVo uuid error:{} " , e . getMessage ( ) ) ;
@@ -1008,7 +1008,7 @@ public class TaskServiceImpl implements ITaskService {
}
List < CIDUserResp > getCidUserList ( List < Long > userIdList ) {
if ( CollectionUtils . isEmpty ( userIdList ) ) return new ArrayList < > ( ) ;
if ( CollectionUtils . isEmpty ( userIdList ) ) return new ArrayList < > ( ) ;
SdmResponse < List < CIDUserResp > > cidUserResp = sysUserFeignClient . listUserByIds ( UserQueryReq . builder ( ) . userIds ( userIdList ) . build ( ) ) ;
if ( ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) return new ArrayList < > ( ) ;
return cidUserResp . getData ( ) ;
@@ -1256,10 +1256,11 @@ public class TaskServiceImpl implements ITaskService {
/**
* 删除权限
*
* @param userId
* @param uuid
*/
private void deletePermission ( Long userId , String uuid ) {
private void deletePermission ( Long userId , String uuid ) {
// 删除文件权限
UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq ( ) ;
updatePermissionReq . setUserId ( userId ) ;
@@ -1267,17 +1268,18 @@ public class TaskServiceImpl implements ITaskService {
Map < Long , Byte > userPermissions = new HashMap < > ( ) ;
userPermissions . put ( userId , FilePermissionEnum . ZERO . getValue ( ) ) ;
updatePermissionReq . setUserPermissions ( userPermissions ) ;
log . info ( " 编辑任务时,删除用户权限的参数为:{} " , updatePermissionReq ) ;
log . info ( " 编辑任务时,删除用户权限的参数为:{} " , updatePermissionReq ) ;
SdmResponse updatePermissionResponse = dataClientFeignClient . updatePermission ( updatePermissionReq ) ;
log . info ( " 编辑时,删除用户权限的返回值为:{} " , updatePermissionResponse ) ;
log . info ( " 编辑时,删除用户权限的返回值为:{} " , updatePermissionResponse ) ;
}
/**
* 更新权限
*
* @param userId
* @param uuid
*/
private void updatePermission ( Long userId , String uuid ) {
private void updatePermission ( Long userId , String uuid ) {
// 更新文件权限
UpdatePermissionReq updatePermissionReq = new UpdatePermissionReq ( ) ;
updatePermissionReq . setUserId ( userId ) ;
@@ -1285,9 +1287,9 @@ public class TaskServiceImpl implements ITaskService {
Map < Long , Byte > userPermissions = new HashMap < > ( ) ;
userPermissions . put ( userId , FilePermissionEnum . ALL . getValue ( ) ) ;
updatePermissionReq . setUserPermissions ( userPermissions ) ;
log . info ( " 编辑任务时,更新用户权限的参数为:{} " , updatePermissionReq ) ;
log . info ( " 编辑任务时,更新用户权限的参数为:{} " , updatePermissionReq ) ;
SdmResponse updatePermissionResponse = dataClientFeignClient . updatePermission ( updatePermissionReq ) ;
log . info ( " 编辑任务时,更新用户权限的返回值为:{} " , updatePermissionResponse ) ;
log . info ( " 编辑任务时,更新用户权限的返回值为:{} " , updatePermissionResponse ) ;
}
private void batchUpdatePermission ( List < BatchUpdatePermissionReq . FilePermissionItem > filePermissions ) {
@@ -1339,7 +1341,7 @@ public class TaskServiceImpl implements ITaskService {
simulationTaskMemberService . deleteTaskMemberList ( taskId , MemberTypeEnum . EXECUTOR . getCode ( ) ) ;
// 删除原来的仿真执行人权限
for ( SimulationTaskMember simulationTaskMember : oldEMemberList ) {
deletePermission ( simulationTaskMember . getUserId ( ) , simulationTaskMember . getTaskId ( ) ) ;
deletePermission ( simulationTaskMember . getUserId ( ) , simulationTaskMember . getTaskId ( ) ) ;
}
}
// 找出新的仿真执行人
@@ -1352,7 +1354,7 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isNotEmpty ( currentUserIdList ) ) {
if ( CollectionUtils . isEmpty ( oldEMemberIdList ) ) {
newUserIdList = currentUserIdList ;
} else {
} else {
for ( Long currentUserId : currentUserIdList ) {
if ( ! oldEMemberIdList . contains ( currentUserId ) ) {
newUserIdList . add ( currentUserId ) ;
@@ -1360,8 +1362,8 @@ public class TaskServiceImpl implements ITaskService {
}
}
}
log . info ( " 老用户id为: {} " , oldEMemberIdList ) ;
log . info ( " 新用户id为: {} " , newUserIdList ) ;
log . info ( " 老用户id为: {} " , oldEMemberIdList ) ;
log . info ( " 新用户id为: {} " , newUserIdList ) ;
if ( CollectionUtils . isNotEmpty ( currentUserIdList ) ) {
if ( ! simulationTaskMemberService . saveTaskMemberList ( taskId , MemberTypeEnum . EXECUTOR . getCode ( ) , currentUserIdList ) ) {
return SdmResponse . failed ( " 编辑仿真执行人失败 " ) ;
@@ -1533,7 +1535,7 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isNotEmpty ( eachTaskNodeMemberPoList ) ) {
SdmResponse < List < CIDUserResp > > cidUserResp = sysUserFeignClient . listUserByIds ( UserQueryReq . builder ( )
. userIds ( eachTaskNodeMemberPoList . stream ( ) . map ( TaskNodeMemberPo : : getUserId ) . toList ( ) ) . build ( ) ) ;
if ( cidUserResp = = null | | ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) {
if ( cidUserResp = = null | | ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) {
continue ;
}
performanceNodePo . setPMembers ( cidUserResp . getData ( ) . stream ( ) . map ( CIDUserResp : : getNickname ) . collect ( Collectors . joining ( " , " ) ) ) ;
@@ -1550,7 +1552,7 @@ public class TaskServiceImpl implements ITaskService {
}
List < String > runIdList = performanceList . stream ( ) . filter ( performance - > StringUtils . isNotBlank ( performance . getRunId ( ) ) ) . map ( PerformanceNodePo : : getRunId ) . toList ( ) ;
Map < String , SimulationRun > runMap = Map . of ( ) ;
if ( CollectionUtils . isNotEmpty ( runIdList ) ) {
if ( CollectionUtils . isNotEmpty ( runIdList ) ) {
List < SimulationRun > runList = simulationRunService . lambdaQuery ( ) . in ( SimulationRun : : getUuid , runIdList ) . list ( ) ;
if ( CollectionUtils . isNotEmpty ( runList ) ) {
runMap = runList . stream ( ) . collect ( Collectors . toMap ( SimulationRun : : getUuid , Function . identity ( ) ) ) ;
@@ -1615,7 +1617,7 @@ public class TaskServiceImpl implements ITaskService {
jsonObject . put ( " total " , 0 ) ;
if ( StringUtils . isNotBlank ( taskNodeId ) ) {
allTaskVoList = mapper . getAnalysisTask ( taskNodeId ) ;
} else {
} else {
taskVoList = mapper . taskList ( req , tenantId , new ArrayList < > ( ) , pos , limit ) ;
if ( CollectionUtils . isEmpty ( taskVoList ) ) {
log . error ( " 数据分析中未查询到任务信息 " ) ;
@@ -1634,8 +1636,8 @@ public class TaskServiceImpl implements ITaskService {
throw new RuntimeException ( e ) ;
}
}
} else {
allTaskVoList = taskVoList ;
} else {
allTaskVoList = taskVoList ;
}
}
if ( CollectionUtils . isEmpty ( allTaskVoList ) ) {
@@ -1689,7 +1691,7 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isNotEmpty ( eachTaskNodeMemberPoList ) ) {
SdmResponse < List < CIDUserResp > > cidUserResp = sysUserFeignClient . listUserByIds ( UserQueryReq . builder ( )
. userIds ( eachTaskNodeMemberPoList . stream ( ) . map ( TaskNodeMemberPo : : getUserId ) . toList ( ) ) . build ( ) ) ;
if ( cidUserResp = = null | | ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) {
if ( cidUserResp = = null | | ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) {
continue ;
}
task . setPMembers ( cidUserResp . getData ( ) . stream ( ) . map ( CIDUserResp : : getNickname ) . collect ( Collectors . joining ( " , " ) ) ) ;
@@ -1763,7 +1765,7 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isNotEmpty ( eachTaskNodeMemberPoList ) ) {
SdmResponse < List < CIDUserResp > > cidUserResp = sysUserFeignClient . listUserByIds ( UserQueryReq . builder ( )
. userIds ( eachTaskNodeMemberPoList . stream ( ) . map ( TaskNodeMemberPo : : getUserId ) . toList ( ) ) . build ( ) ) ;
if ( cidUserResp = = null | | ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) {
if ( cidUserResp = = null | | ! cidUserResp . isSuccess ( ) | | CollectionUtils . isEmpty ( cidUserResp . getData ( ) ) ) {
continue ;
}
taskRunPo . setPMembers ( cidUserResp . getData ( ) . stream ( ) . map ( CIDUserResp : : getNickname ) . collect ( Collectors . joining ( " , " ) ) ) ;
@@ -1945,7 +1947,7 @@ public class TaskServiceImpl implements ITaskService {
List < SpdmTaskVo > taskList = mapper . getUserExecTaskWithinTimeFrame ( req ) ;
if ( CollectionUtils . isNotEmpty ( taskList ) ) {
Map < String , List < SpdmTaskVo > > userTaskMap = taskList . stream ( ) . collect ( Collectors . groupingBy ( SpdmTaskVo : : getEUserId ) ) ;
for ( String eUserId : userTaskMap . keySet ( ) ) {
for ( String eUserId : userTaskMap . keySet ( ) ) {
List < SpdmTaskVo > userTaskList = userTaskMap . get ( eUserId ) ;
UserWorkloadResp workloadResp = new UserWorkloadResp ( ) ;
@@ -2035,14 +2037,14 @@ public class TaskServiceImpl implements ITaskService {
spdmExportNewTaskVo . setDiscipline ( spdmExportNewTaskVo . getDiscipline ( ) ) ;
exportNewTaskVoList . add ( spdmExportNewTaskVo ) ;
}
dataObj . put ( " data " , exportNewTaskVoList ) ;
dataObj . put ( " data " , exportNewTaskVoList ) ;
response . setData ( dataObj ) ;
String taskFileName = exportOperate . convertToFile ( JSON . toJSONString ( response ) , JSON . toJSONString ( taskExportExcelFormat ) ) ;
File file = new File ( taskFileName ) ;
if ( ! file . exists ( ) ) {
if ( ! file . exists ( ) ) {
response = SdmResponse . failed ( " 任务文件不存在 " ) ;
} else {
String taskSaveName = " 仿真任务_ " + RandomUtil . generateString ( 6 ) + " .xlsx " ;
} else {
String taskSaveName = " 仿真任务_ " + RandomUtil . generateString ( 6 ) + " .xlsx " ;
SystemOperate . outputHttpFileStream ( httpServletResponse , taskFileName , taskSaveName ) ;
file . delete ( ) ;
}
@@ -3070,8 +3072,9 @@ public class TaskServiceImpl implements ITaskService {
/**
* 将自定义对象List转换为List<JSONObject>
*
* @param objList 自定义对象列表
* @param <T> 泛型(自定义对象类型)
* @param <T> 泛型(自定义对象类型)
* @return List<JSONObject>
*/
public static < T > List < JSONObject > convertToJSONObjectList ( List < T > objList ) {
@@ -3091,25 +3094,25 @@ public class TaskServiceImpl implements ITaskService {
public SdmResponse < List < JSONObject > > getTaskConfidenceStatistics ( String nodeType ) {
// 查询所有任务, 再通过tag6去过滤, 兼容多层级学科的情况
// .eq(SimulationTask::getExeStatus,TaskExeStatusEnum.COMPLETED.getCode()) 暂时去掉筛选条件,方便调试
List < SimulationTask > allTaskList = simulationTaskService . lambdaQuery ( )
List < SimulationTask > allTaskList = simulationTaskService . lambdaQuery ( )
. isNotNull ( SimulationTask : : getConfidence ) . list ( ) ;
if ( CollectionUtils . isEmpty ( allTaskList ) ) {
log . error ( " 仿真任务置信度统计时未查询到任务 " ) ;
return SdmResponse . success ( new ArrayList < > ( ) ) ;
}
Map < String , List < SimulationTask > > taskMap = new HashMap < > ( ) ;
Map < String , List < SimulationTask > > taskMap = new HashMap < > ( ) ;
String currentNodeId ;
for ( SimulationTask task : allTaskList ) {
String relateTaskNodeId = " " ;
if ( NodeTypeEnum . PROJECT . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag1 ( ) ;
} else if ( NodeTypeEnum . PHASE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . PHASE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag2 ( ) ;
} else if ( NodeTypeEnum . MACHINE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . MACHINE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag4 ( ) ;
} else if ( NodeTypeEnum . WORKSPACE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . WORKSPACE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag5 ( ) ;
} else if ( NodeTypeEnum . DISCIPLINE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . DISCIPLINE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag6 ( ) ;
}
if ( StringUtils . isBlank ( relateTaskNodeId ) ) {
@@ -3120,8 +3123,8 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isEmpty ( taskMap . get ( currentNodeId ) ) ) {
List < SimulationTask > relateTaskList = new ArrayList < > ( ) ;
relateTaskList . add ( task ) ;
taskMap . put ( currentNodeId , relateTaskList ) ;
} else {
taskMap . put ( currentNodeId , relateTaskList ) ;
} else {
taskMap . get ( currentNodeId ) . add ( task ) ;
}
}
@@ -3141,7 +3144,7 @@ public class TaskServiceImpl implements ITaskService {
String nodeId = entry . getKey ( ) ;
String nodeName = nodeMap . get ( nodeId ) ;
if ( StringUtils . isBlank ( nodeName ) ) {
log . error ( " nodeId为: {},未匹配到节点名称 " , nodeId ) ;
log . error ( " nodeId为: {},未匹配到节点名称 " , nodeId ) ;
continue ;
}
List < SimulationTask > taskList = entry . getValue ( ) ;
@@ -3162,25 +3165,25 @@ public class TaskServiceImpl implements ITaskService {
public SdmResponse < List < JSONObject > > getTaskDifficultStatistics ( String nodeType ) {
// 查询所有任务, 再通过tag6去过滤, 兼容多层级学科的情况
// .eq(SimulationTask::getExeStatus,TaskExeStatusEnum.COMPLETED.getCode()) 暂时去掉筛选条件,方便调试
List < SimulationTask > allTaskList = simulationTaskService . lambdaQuery ( )
List < SimulationTask > allTaskList = simulationTaskService . lambdaQuery ( )
. isNotNull ( SimulationTask : : getDifficult ) . list ( ) ;
if ( CollectionUtils . isEmpty ( allTaskList ) ) {
log . error ( " 仿真任务难度系数统计时未查询到任务 " ) ;
return SdmResponse . success ( new ArrayList < > ( ) ) ;
}
Map < String , List < SimulationTask > > taskMap = new HashMap < > ( ) ;
Map < String , List < SimulationTask > > taskMap = new HashMap < > ( ) ;
String currentNodeId ;
for ( SimulationTask task : allTaskList ) {
String relateTaskNodeId = " " ;
if ( NodeTypeEnum . PROJECT . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag1 ( ) ;
} else if ( NodeTypeEnum . PHASE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . PHASE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag2 ( ) ;
} else if ( NodeTypeEnum . MACHINE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . MACHINE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag4 ( ) ;
} else if ( NodeTypeEnum . WORKSPACE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . WORKSPACE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag5 ( ) ;
} else if ( NodeTypeEnum . DISCIPLINE . getValue ( ) . equals ( nodeType ) ) {
} else if ( NodeTypeEnum . DISCIPLINE . getValue ( ) . equals ( nodeType ) ) {
relateTaskNodeId = task . getTag6 ( ) ;
}
if ( StringUtils . isBlank ( relateTaskNodeId ) ) {
@@ -3191,8 +3194,8 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isEmpty ( taskMap . get ( currentNodeId ) ) ) {
List < SimulationTask > relateTaskList = new ArrayList < > ( ) ;
relateTaskList . add ( task ) ;
taskMap . put ( currentNodeId , relateTaskList ) ;
} else {
taskMap . put ( currentNodeId , relateTaskList ) ;
} else {
taskMap . get ( currentNodeId ) . add ( task ) ;
}
}
@@ -3212,7 +3215,7 @@ public class TaskServiceImpl implements ITaskService {
String nodeId = entry . getKey ( ) ;
String nodeName = nodeMap . get ( nodeId ) ;
if ( StringUtils . isBlank ( nodeName ) ) {
log . error ( " nodeId为: {},未匹配到节点名称 " , nodeId ) ;
log . error ( " nodeId为: {},未匹配到节点名称 " , nodeId ) ;
continue ;
}
List < SimulationTask > taskList = entry . getValue ( ) ;
@@ -3231,6 +3234,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 判断字符串是否可以安全转换为Long类型
*
* @param str 待校验的字符串
* @return true-可以转换, false-不可以转换
*/
@@ -3328,7 +3332,7 @@ public class TaskServiceImpl implements ITaskService {
}
try {
deleteDirNew ( taskIdList ) ;
} catch ( Exception e ) {
} catch ( Exception e ) {
TransactionAspectSupport . currentTransactionStatus ( ) . setRollbackOnly ( ) ;
return SdmResponse . failed ( " 删除任务失败,原因为: " + e . getMessage ( ) ) ;
}
@@ -3366,9 +3370,9 @@ public class TaskServiceImpl implements ITaskService {
} else {
String taskFileName = exportOperate . convertToFile ( JSON . toJSONString ( response ) , JSON . toJSONString ( req ) ) ;
File file = new File ( taskFileName ) ;
if ( ! file . exists ( ) ) {
if ( ! file . exists ( ) ) {
response = SdmResponse . failed ( " 任务文件不存在 " ) ;
} else {
} else {
String taskSaveName = " 仿真任务.xlsx " ;
SystemOperate . outputHttpFileStream ( httpServletResponse , taskFileName , taskSaveName ) ;
file . delete ( ) ;
@@ -3382,7 +3386,7 @@ public class TaskServiceImpl implements ITaskService {
req . getParams ( ) . setCurrent ( 1 ) ;
req . getParams ( ) . setSize ( 10000 ) ;
SpdmAnalysisRunListReq spdmAnalysisRunListReq = new SpdmAnalysisRunListReq ( ) ;
BeanUtils . copyProperties ( req . getParams ( ) , spdmAnalysisRunListReq ) ;
BeanUtils . copyProperties ( req . getParams ( ) , spdmAnalysisRunListReq ) ;
SdmResponse response = analysisRunList ( spdmAnalysisRunListReq ) ;
if ( ObjectUtils . isEmpty ( response ) ) {
log . error ( " exportRunByScript, 未查询到任务1 " ) ;
@@ -3390,9 +3394,9 @@ public class TaskServiceImpl implements ITaskService {
} else {
String runFileName = exportOperate . convertToFile ( JSON . toJSONString ( response ) , JSON . toJSONString ( req ) ) ;
File file = new File ( runFileName ) ;
if ( ! file . exists ( ) ) {
if ( ! file . exists ( ) ) {
response = SdmResponse . failed ( " 算例文件不存在 " ) ;
} else {
} else {
String taskSaveName = " 仿真算例.xlsx " ;
SystemOperate . outputHttpFileStream ( httpServletResponse , runFileName , taskSaveName ) ;
file . delete ( ) ;
@@ -3406,7 +3410,7 @@ public class TaskServiceImpl implements ITaskService {
req . getParams ( ) . setCurrent ( 1 ) ;
req . getParams ( ) . setSize ( 10000 ) ;
SpdmAnalysisPerformanceListReq spdmAnalysisPerformanceListReq = new SpdmAnalysisPerformanceListReq ( ) ;
BeanUtils . copyProperties ( req . getParams ( ) , spdmAnalysisPerformanceListReq ) ;
BeanUtils . copyProperties ( req . getParams ( ) , spdmAnalysisPerformanceListReq ) ;
SdmResponse response = analysisPerformanceList ( spdmAnalysisPerformanceListReq ) ;
if ( ObjectUtils . isEmpty ( response ) ) {
log . error ( " exportRunByScript, 未查询到任务1 " ) ;
@@ -3414,9 +3418,9 @@ public class TaskServiceImpl implements ITaskService {
} else {
String performanceFileName = exportOperate . convertToFile ( JSON . toJSONString ( response ) , JSON . toJSONString ( req ) ) ;
File file = new File ( performanceFileName ) ;
if ( ! file . exists ( ) ) {
if ( ! file . exists ( ) ) {
response = SdmResponse . failed ( " 指标文件不存在 " ) ;
} else {
} else {
String taskSaveName = " 仿真指标.xlsx " ;
SystemOperate . outputHttpFileStream ( httpServletResponse , performanceFileName , taskSaveName ) ;
file . delete ( ) ;
@@ -3475,8 +3479,8 @@ public class TaskServiceImpl implements ITaskService {
/**
* 构建项目用户负载响应列表
*/
private List < ProjectUserLoadResp > buildProjectUserLoadResponse ( List < SimulationNode > projectNodeList , TaskData taskData , Map < String , String > projectNodeReferenceItemMap ,
Long tenantId , String beginTime , String endTime ) {
private List < ProjectUserLoadResp > buildProjectUserLoadResponse ( List < SimulationNode > projectNodeList , TaskData taskData , Map < String , String > projectNodeReferenceItemMap ,
Long tenantId , String beginTime , String endTime ) {
List < ProjectUserLoadResp > responseList = new ArrayList < > ( ) ;
Set < String > processedProjectNames = new HashSet < > ( ) ; // 记录已处理的项目名称,避免重复
@@ -3491,7 +3495,7 @@ public class TaskServiceImpl implements ITaskService {
processedProjectNames . add ( projectName ) ;
// 构建当前项目的响应对象
ProjectUserLoadResp currentProjectResp = buildSingleProjectResp ( projectNode , taskData , projectNodeReferenceItemMap . get ( projectNode . getUuid ( ) ) ) ;
ProjectUserLoadResp currentProjectResp = buildSingleProjectResp ( projectNode , taskData , projectNodeReferenceItemMap . get ( projectNode . getUuid ( ) ) ) ;
responseList . add ( currentProjectResp ) ;
// 获取当前参考项目名称
@@ -3527,7 +3531,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 构建单个项目的响应对象
*/
private ProjectUserLoadResp buildSingleProjectResp ( SimulationNode projectNode , TaskData taskData , String referenceItem ) {
private ProjectUserLoadResp buildSingleProjectResp ( SimulationNode projectNode , TaskData taskData , String referenceItem ) {
ProjectUserLoadResp resp = new ProjectUserLoadResp ( ) ;
resp . setProjectName ( projectNode . getNodeName ( ) ) ;
resp . setRelateProjectName ( referenceItem ) ;
@@ -3563,7 +3567,7 @@ public class TaskServiceImpl implements ITaskService {
List < SimulationNode > allProjectNodeList ,
TaskData taskData ,
List < ProjectUserLoadResp > responseList ,
Set < String > processedProjectNames , String referenceItem ) {
Set < String > processedProjectNames , String referenceItem ) {
if ( StringUtils . isBlank ( referenceItem ) ) {
return ;
}
@@ -3588,7 +3592,7 @@ public class TaskServiceImpl implements ITaskService {
processedProjectNames . add ( refProjectName ) ;
// 构建参考项目响应对象并添加到列表,参考项目不再去设置他的参考项目信息
ProjectUserLoadResp referenceResp = buildSingleProjectResp ( referenceNode , taskData , " " ) ;
ProjectUserLoadResp referenceResp = buildSingleProjectResp ( referenceNode , taskData , " " ) ;
responseList . add ( referenceResp ) ;
}
@@ -3641,7 +3645,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 补充参考项目到项目节点列表
*/
private void supplementReferenceProjects ( Long tenantId , List < SimulationNode > baseProjectNodeList , Map < String , String > projectNodeReferenceItemMap ) {
private void supplementReferenceProjects ( Long tenantId , List < SimulationNode > baseProjectNodeList , Map < String , String > projectNodeReferenceItemMap ) {
// 提取所有非空的参考项目名称
List < String > referenceProjectNames = projectNodeReferenceItemMap . values ( ) . stream ( )
. filter ( Objects : : nonNull ) // 步骤1: 排除null
@@ -3675,6 +3679,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 查询项目节点列表下的参考项目字段(拓展属性)
*
* @param projectIdList
* @return
*/
@@ -3700,6 +3705,7 @@ public class TaskServiceImpl implements ITaskService {
/**
* 查询项目人员负载
* 按项目、任务、任务成员以及参考项目的信息进行数据组装
*
* @param req
* @return
*/
@@ -3713,10 +3719,10 @@ public class TaskServiceImpl implements ITaskService {
return SdmResponse . success ( new ArrayList < > ( ) ) ;
}
// 2. 查询项目节点列表下的参考项目字段(拓展属性)
Map < String , String > projectNodeReferenceItemMap = queryProjectReferenceItemMap ( projectNodeList . stream ( ) . map ( SimulationNode : : getUuid ) . toList ( ) ) ;
Map < String , String > projectNodeReferenceItemMap = queryProjectReferenceItemMap ( projectNodeList . stream ( ) . map ( SimulationNode : : getUuid ) . toList ( ) ) ;
// 3. 补充参考项目到节点列表( 仅当传入projectIdList时执行)
if ( CollectionUtils . isNotEmpty ( projectIdList ) ) {
supplementReferenceProjects ( tenantId , projectNodeList , projectNodeReferenceItemMap ) ;
supplementReferenceProjects ( tenantId , projectNodeList , projectNodeReferenceItemMap ) ;
}
// 4. 处理项目ID列表( 兼容未传projectIdList的情况)
List < String > realProjectIdList = CollectionUtils . isNotEmpty ( projectIdList )
@@ -3725,7 +3731,7 @@ public class TaskServiceImpl implements ITaskService {
// 5. 查询任务列表并构建映射
TaskData taskData = queryAndBuildTaskData ( tenantId , realProjectIdList , req . getBeginTime ( ) , req . getEndTime ( ) ) ;
// 6. 构建返回结果
return SdmResponse . success ( buildProjectUserLoadResponse ( projectNodeList , taskData , projectNodeReferenceItemMap , tenantId , req . getBeginTime ( ) , req . getEndTime ( ) ) ) ;
return SdmResponse . success ( buildProjectUserLoadResponse ( projectNodeList , taskData , projectNodeReferenceItemMap , tenantId , req . getBeginTime ( ) , req . getEndTime ( ) ) ) ;
}
@Transactional ( rollbackFor = Exception . class )
@@ -3745,10 +3751,10 @@ public class TaskServiceImpl implements ITaskService {
Map < String , SpdmBatchTaskOprReq > taskModifyMap = batchTaskOprReqList . stream ( ) . collect ( Collectors . toMap ( SpdmBatchTaskOprReq : : getTaskId , Function . identity ( ) ) ) ;
String curDateStr = new SimpleDateFormat ( " yyyy-MM-dd HH:mm:ss " ) . format ( new Date ( ) ) ;
Long userId = ThreadLocalContext . getUserId ( ) ;
for ( SimulationTask simulationT ask : taskList ) {
SpdmBatchTaskOprReq req = taskModifyMap . get ( simulationT ask. getUuid ( ) ) ;
for ( SimulationTask t ask : taskList ) {
SpdmBatchTaskOprReq req = taskModifyMap . get ( t ask. getUuid ( ) ) ;
if ( ObjectUtils . isEmpty ( req ) ) {
log . error ( " 异常情况,根据{}, 在taskModifyMap未查询到数据 " , simulationT ask. getUuid ( ) ) ;
log . error ( " 异常情况,根据{}, 在taskModifyMap未查询到数据 " , t ask. getUuid ( ) ) ;
continue ;
}
// 更新任务的基础属性
@@ -3759,29 +3765,11 @@ public class TaskServiceImpl implements ITaskService {
String taskId = req . getTaskId ( ) ;
req . setTaskId ( taskId ) ;
SpdmBatchTaskOprTagReq spdmBatchTaskOprTagReq = new SpdmBatchTaskOprTagReq ( ) ;
SpringBeanCopyUtil . copyPropertiesIgnoreNull ( simulationT ask, spdmBatchTaskOprTagReq ) ;
SpringBeanCopyUtil . copyPropertiesIgnoreNull ( req , simulationT ask) ;
if ( ! simulationTaskService . updateById ( simulationT ask) ) {
throw new RuntimeException ( " 编辑任务: " + simulationT ask. getTaskName ( ) + " 失败 " ) ;
SpringBeanCopyUtil . copyPropertiesIgnoreNull ( t ask, spdmBatchTaskOprTagReq ) ;
SpringBeanCopyUtil . copyPropertiesIgnoreNull ( req , t ask) ;
if ( ! simulationTaskService . updateById ( t ask) ) {
throw new RuntimeException ( " 编辑任务: " + t ask. getTaskName ( ) + " 失败 " ) ;
}
public SdmResponse batchOperation ( SpdmTaskOpr taskOpr ) {
if ( CollectionUtils . isNotEmpty ( taskOpr . getTaskIds ( ) ) & & ObjectUtils . isNotEmpty ( taskOpr . getReq ( ) ) ) {
SpdmTaskOprReq req = taskOpr . getReq ( ) ;
if ( ObjectUtils . isNotEmpty ( req . getProgress ( ) ) & & req . getProgress ( ) > 100 ) {
return SdmResponse . failed ( " 任务进度超过100%,请核查 " ) ;
}
String curDateStr = new SimpleDateFormat ( " yyyy-MM-dd HH:mm:ss " ) . format ( new Date ( ) ) ;
Long userId = ThreadLocalContext . getUserId ( ) ;
for ( String taskId : taskOpr . getTaskIds ( ) ) {
req . setTaskId ( taskId ) ;
SimulationTask task = simulationTaskService . lambdaQuery ( ) . eq ( SimulationTask : : getUuid , taskId ) . one ( ) ;
if ( task = = null ) {
log . error ( " 根据taskId: {},未查询到任务 " , taskId ) ;
return SdmResponse . failed ( " 未查询到任务 " ) ;
}
if ( ! simulationTaskService . updateSimulationTask ( req ) ) {
return SdmResponse . failed ( " 编辑任务失败 " ) ;
}
// 原来的仿真执行人
List < SimulationTaskMember > oldEMemberList = simulationTaskMemberService . lambdaQuery ( )
@@ -3795,7 +3783,7 @@ public class TaskServiceImpl implements ITaskService {
simulationTaskMemberService . deleteTaskMemberList ( taskId , MemberTypeEnum . EXECUTOR . getCode ( ) ) ;
// 删除原来的仿真执行人权限
for ( SimulationTaskMember simulationTaskMember : oldEMemberList ) {
deletePermission ( simulationTaskMember . getUserId ( ) , simulationTaskMember . getTaskId ( ) ) ;
deletePermission ( simulationTaskMember . getUserId ( ) , simulationTaskMember . getTaskId ( ) ) ;
}
}
// 找出新的仿真执行人
@@ -3808,7 +3796,7 @@ public class TaskServiceImpl implements ITaskService {
if ( CollectionUtils . isNotEmpty ( currentUserIdList ) ) {
if ( CollectionUtils . isEmpty ( oldEMemberIdList ) ) {
newUserIdList = currentUserIdList ;
} else {
} else {
for ( Long currentUserId : currentUserIdList ) {
if ( ! oldEMemberIdList . contains ( currentUserId ) ) {
newUserIdList . add ( currentUserId ) ;
@@ -3816,8 +3804,8 @@ public class TaskServiceImpl implements ITaskService {
}
}
}
log . info ( " 老用户id为: {} " , oldEMemberIdList ) ;
log . info ( " 新用户id为: {} " , newUserIdList ) ;
log . info ( " 老用户id为: {} " , oldEMemberIdList ) ;
log . info ( " 新用户id为: {} " , newUserIdList ) ;
if ( CollectionUtils . isNotEmpty ( currentUserIdList ) ) {
if ( ! simulationTaskMemberService . saveTaskMemberList ( taskId , MemberTypeEnum . EXECUTOR . getCode ( ) , currentUserIdList ) ) {
return SdmResponse . failed ( " 编辑仿真执行人失败 " ) ;
@@ -3827,87 +3815,33 @@ public class TaskServiceImpl implements ITaskService {
newUserIdList . forEach ( i - > {
sendMessage ( MessageTemplateEnum . TASK_ISSUE , req . getNodeName ( ) , String . valueOf ( i ) , taskId ) ;
} ) ;
List < BatchUpdatePermissionReq . FilePermissionItem > filePermissions = new ArrayList < > ( ) ;
// 保存当前的仿真执行人权限
for ( Long currentUserId : currentUserIdList ) {
u pdatePermission( currentUserId , taskId ) ;
BatchU pdatePermissionReq . FilePermissionItem item = new BatchUpdatePermissionReq . FilePermissionItem ( ) ;
item . setUuid ( task . getUuid ( ) ) ;
Map < Long , Byte > userPermissions = new HashMap < > ( ) ;
userPermissions . put ( currentUserId , FilePermissionEnum . ALL_EXCLUDE_DELETE . getValue ( ) ) ;
item . setUserPermissions ( userPermissions ) ;
filePermissions . add ( item ) ;
}
// 新增拓展属性
List < SimulationTaskExtra > extraList = req . getExtras ( ) ;
if ( CollectionUtil s . isNotEmpty ( extraList ) ) {
// 原来的仿真执行人
List < SimulationTaskMember > oldEMemberList = simulationTaskMemberService . lambdaQuery ( )
. eq ( SimulationTaskMember : : getTaskId , taskId )
. eq ( SimulationTaskMember : : getType , MemberTypeEnum . EXECUTOR . getCode ( ) ) . list ( ) ;
List < Long > oldEMemberIdList = new ArrayList < > ( ) ;
// eMemberList传空字符串代表要清空仿真执行人, 传null代表不对仿真执行人做操作
if ( CollectionUtils . isNotEmpty ( oldEMemberList ) & & Objects . equals ( req . getEMemberList ( ) , " " ) ) {
oldEMemberIdList = oldEMemberList . stream ( ) . map ( SimulationTaskMember : : getUserId ) . toList ( ) ;
// 删除原来的仿真执行人信息
simulationTaskMemberService . deleteTaskMemberList ( taskId , MemberTypeEnum . EXECUTOR . getCode ( ) ) ;
// 删除原来的仿真执行人权限
for ( SimulationTaskMember simulationTaskMember : oldEMemberList ) {
deletePermission ( simulationTaskMember . getUserId ( ) , simulationTaskMember . getTaskId ( ) ) ;
}
}
// 找出新的仿真执行人
List < Long > currentUserIdList = new ArrayList < > ( ) ;
if ( StringUtils . isNotBlank ( req . getEMemberList ( ) ) ) {
String [ ] userIdArr = req . getEMemberList ( ) . split ( " , " ) ;
currentUserIdList = Arrays . stream ( userIdArr ) . filter ( s - > ! s . isEmpty ( ) ) . map ( Long : : valueOf ) . collect ( Collectors . toList ( ) ) ;
}
List < Long > newUserIdList = new ArrayList < > ( ) ;
if ( CollectionUtils . isNotEmpty ( currentUserIdList ) ) {
if ( CollectionUtils . isEmpty ( oldEMemberIdList ) ) {
newUserIdList = currentUserIdList ;
} else {
for ( Long currentUserId : currentUserIdList ) {
if ( ! oldEMemberIdList . contains ( currentUserId ) ) {
newUserIdList . add ( currentUserId ) ;
}
}
}
}
log . info ( " 老用户id为: {} " , oldEMemberIdList ) ;
log . info ( " 新用户id为: {} " , newUserIdList ) ;
if ( CollectionUtils . isNotEmpty ( currentUserIdList ) ) {
if ( ! simulationTaskMemberService . saveTaskMemberList ( taskId , MemberTypeEnum . EXECUTOR . getCode ( ) , currentUserIdList ) ) {
return SdmResponse . failed ( " 编辑仿真执行人失败 " ) ;
}
}
// 发送消息通知
newUserIdList . forEach ( i - > {
sendMessage ( MessageTemplateEnum . TASK_ISSUE , req . getNodeName ( ) , String . valueOf ( i ) , taskId ) ;
} ) ;
List < BatchUpdatePermissionReq . FilePermissionItem > filePermissions = new ArrayList < > ( ) ;
// 保存当前的仿真执行人权限
// 设置任务执行人对关联的需求文件夹设置权限
if ( StringUtils . isNotEmpty ( task . getDemandId ( ) ) ) {
SpdmDemandVo demand = demandMapper . getDemandListById ( Collections . singletonList ( task . getDemandId ( ) ) ) . get ( 0 ) ;
for ( Long currentUserId : currentUserIdList ) {
BatchUpdatePermissionReq . FilePermissionItem item = new BatchUpdatePermissionReq . FilePermissionItem ( ) ;
item . setUuid ( task . getUuid ( ) ) ;
item . setUuid ( demand . getUuid ( ) ) ;
Map < Long , Byte > userPermissions = new HashMap < > ( ) ;
userPermissions . put ( currentUserId , FilePermissionEnum . ALL_EXCLUDE_DELET E. getValue ( ) ) ;
userPermissions . put ( currentUserId , FilePermissionEnum . BAS E. getValue ( ) ) ;
item . setUserPermissions ( userPermissions ) ;
filePermissions . add ( item ) ;
}
// 设置任务执行人对关联的需求文件夹设置权限
if ( StringUtils . isNotEmpty ( task . getDemandId ( ) ) ) {
SpdmDemandVo demand = demandMapper . getDemandListById ( Collections . singletonList ( task . getDemandId ( ) ) ) . get ( 0 ) ;
for ( Long currentUserId : currentUserIdList ) {
BatchUpdatePermissionReq . FilePermissionItem item = new BatchUpdatePermissionReq . FilePermissionItem ( ) ;
item . setUuid ( demand . getUuid ( ) ) ;
Map < Long , Byte > userPermissions = new HashMap < > ( ) ;
userPermissions . put ( currentUserId , FilePermissionEnum . BASE . getValue ( ) ) ;
item . setUserPermissions ( userPermissions ) ;
filePermissions . add ( item ) ;
}
}
batchUpdatePermission ( filePermissions ) ;
}
batchUpdatePermission ( filePermissions ) ;
// 新增拓展属性
List < SimulationTaskExtra > extraList = req . getExtras ( ) ;
if ( CollectionUtils . isEmpty ( extraList ) ) {
continue ;
}
// 新增拓展属性
List < SimulationTaskExtra > extraList = req . getExtras ( ) ;
if ( CollectionUtils . isNot Empty ( extraList ) ) {
List < SimulationTaskExtra > saveExtraList = extraList . stream ( ) . filter ( extra - > ObjectUtils . isEmpty ( extra . getId ( ) ) ) . toList ( ) ;
if ( CollectionUtils . isNotEmpty ( saveExtraList ) ) {
saveExtraList . forEach ( extra - > {
@@ -3929,30 +3863,32 @@ public class TaskServiceImpl implements ITaskService {
}
// 判断tag有没有改变, 如果没有就不去操作文件夹, 这里如果relateTag为空代表没有改变, 否则代表任务的直接上层节点uuid
String relateTag = judgeTaskTag ( req , spdmBatchTaskOprTagReq ) ;
log . info ( " relateTag为: {} " , relateTag ) ;
String relateTag = judgeTaskTag ( req , spdmBatchTaskOprTagReq ) ;
log . info ( " relateTag为: {} " , relateTag ) ;
if ( StringUtils . isNotBlank ( relateTag ) ) {
// 删除原来的文件夹
SdmResponse taskDelDirResponse = deleteDirById ( taskId ) ;
if ( ObjectUtils . isEmpty ( taskDelDirResponse ) | | taskDelDirResponse . getCode ( ) ! = ResultCode . SUCCESS . getCode ( ) ) {
log . error ( " 删除任务:{}的文件夹失败,原因为:{} " , simulationT ask. getTaskName ( ) , taskDelDirResponse . getMessage ( ) ) ;
log . error ( " 删除任务:{}的文件夹失败,原因为:{} " , t ask. getTaskName ( ) , taskDelDirResponse . getMessage ( ) ) ;
TransactionAspectSupport . currentTransactionStatus ( ) . setRollbackOnly ( ) ;
return SdmResponse . failed ( " 删除任务: " + simulationT ask. getTaskName ( ) + " 的文件夹失败,原因: " + taskDelDirResponse . getMessage ( ) ) ;
return SdmResponse . failed ( " 删除任务: " + t ask. getTaskName ( ) + " 的文件夹失败,原因: " + taskDelDirResponse . getMessage ( ) ) ;
}
// 并新建relateTag下的文件夹
SdmResponse taskCreateDirResponse = createDirNew ( simulationT ask. getUuid ( ) , NodeTypeEnum . TASK . getValue ( ) , relateTag , simulationT ask. getTaskName ( ) ) ;
SdmResponse taskCreateDirResponse = createDirNew ( t ask. getUuid ( ) , NodeTypeEnum . TASK . getValue ( ) , relateTag , t ask. getTaskName ( ) ) ;
if ( ObjectUtils . isEmpty ( taskCreateDirResponse ) | | taskCreateDirResponse . getCode ( ) ! = ResultCode . SUCCESS . getCode ( ) ) {
log . error ( " 新建任务:{}的文件夹失败,原因为:{} " , simulationT ask. getTaskName ( ) , taskCreateDirResponse . getMessage ( ) ) ;
log . error ( " 新建任务:{}的文件夹失败,原因为:{} " , t ask. getTaskName ( ) , taskCreateDirResponse . getMessage ( ) ) ;
TransactionAspectSupport . currentTransactionStatus ( ) . setRollbackOnly ( ) ;
return SdmResponse . failed ( " 新建任务: " + simulationT ask. getTaskName ( ) + " 的文件夹失败,原因: " + taskCreateDirResponse . getMessage ( ) ) ;
return SdmResponse . failed ( " 新建任务: " + t ask. getTaskName ( ) + " 的文件夹失败,原因: " + taskCreateDirResponse . getMessage ( ) ) ;
}
}
}
return SdmResponse . success ( ) ;
}
/**
* 返回不同字段的最大tag
*
* @param spdmBatchTaskOprReq
* @param spdmBatchTaskOprTagReq
* @return
@@ -3998,9 +3934,9 @@ public class TaskServiceImpl implements ITaskService {
return " " ;
}
/**
* 工具方法: 比较两个String, 处理null值
*
* @param s1 第一个字符串
* @param s2 第二个字符串
* @return 相等( 包括都为null) 返回true, 否则false
@@ -4012,5 +3948,4 @@ public class TaskServiceImpl implements ITaskService {
return s1 . equals ( s2 ) ;
}
}
}