优化创建节点同时创建文件夹,记录节点的ownRootNodeUuid
This commit is contained in:
@@ -16,6 +16,7 @@ import java.util.Map;
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Data
|
||||
public class ModifyProjectNode extends BaseEntity {
|
||||
String ownRootNodeUuid;
|
||||
|
||||
List<TaskNodeTag> tagMap;
|
||||
|
||||
|
||||
@@ -25,6 +25,8 @@ public class TaskNode extends BaseEntity {
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
private String ownRootNodeUuid;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
|
||||
@@ -21,6 +21,11 @@ public class SpdmProjectNodeEditReq extends BaseEntity {
|
||||
*/
|
||||
private String uuid;
|
||||
|
||||
/**
|
||||
* 当前节点所属项目根节点uuid
|
||||
*/
|
||||
private String ownRootNodeUuid;
|
||||
|
||||
/**
|
||||
* 节点名称
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.sdm.common.entity.resp.system.CIDUserResp;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.feign.impl.system.SysUserFeignClientImpl;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.project.common.MemberTypeEnum;
|
||||
import com.sdm.project.common.TaskAchieveStatusEnum;
|
||||
import com.sdm.project.common.TaskExeStatusEnum;
|
||||
@@ -77,7 +78,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
List<SpdmDemandExtraReq> demandExtraList = req.getExtraList();
|
||||
String curDateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
|
||||
req.setCreateTime(curDateStr);
|
||||
req.setUuid(generateUuid());
|
||||
req.setUuid(RandomUtil.generateString(32));
|
||||
SpdmDemandVo demandByName = mapper.getDemandByName(tenantId, req.getDemandName());
|
||||
if (ObjectUtils.isNotEmpty(demandByName)) {
|
||||
return SdmResponse.failed("需求名称:" + demandByName.getDemandName() + "已存在,请修改");
|
||||
@@ -456,7 +457,7 @@ public class DemandServiceImpl extends BaseService implements IDemandService {
|
||||
List<TaskNode> allPerformanceList = new ArrayList<>();
|
||||
List<TaskExtraNode> allPerformanceExtraList = new ArrayList<>();
|
||||
for (TaskNode task : taskNodeList) {
|
||||
task.setUuid(generateUuid());
|
||||
task.setUuid(RandomUtil.generateString(32));
|
||||
task.setDemandId(demandId);
|
||||
task.setTaskName(task.getNodeName());
|
||||
task.setTaskCode(task.getNodeCode());
|
||||
|
||||
@@ -317,6 +317,10 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
|
||||
}
|
||||
}
|
||||
addNode.setUuid(RandomUtil.generateString(32));
|
||||
// 设置 当前节点所属项目根节点uuid
|
||||
// addNode.getPid()为空时,在创建项目,ownRootNodeUuid就是addNode本身uuid
|
||||
// addNode.getPid()不为空时,在创建阶段,ownRootNodeUuid就是入参的pid父节点
|
||||
addNode.setOwnRootNodeUuid(ObjectUtils.isEmpty(addNode.getPid())?addNode.getUuid():addNode.getPid());
|
||||
addNode.setCreateTime(curDateStr);
|
||||
addNode.setCreator(jobNumber);
|
||||
addNode.setTenantId(tenantId);
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.sdm.common.entity.req.data.DelDirReq;
|
||||
import com.sdm.common.entity.req.data.RenameDirReq;
|
||||
import com.sdm.common.feign.impl.data.DataClientFeignClientImpl;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.project.common.VersionEnum;
|
||||
import com.sdm.project.dao.SimulationNodeMapper;
|
||||
import com.sdm.project.dao.SimulationProjectMapper;
|
||||
@@ -1281,7 +1282,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
}
|
||||
}
|
||||
|
||||
private SdmResponse newRealAddSimulationTaskItems(TaskNodeTree taskNodeTree, Long tenantId, List<TaskNodeTag> tagList) {
|
||||
private SdmResponse newRealAddSimulationTaskItems(TaskNodeTree taskNodeTree, Long tenantId, List<TaskNodeTag> tagList, String ownRootNodeUuid) {
|
||||
Long jobNumber = ThreadLocalContext.getUserId();
|
||||
SdmResponse response = SdmResponse.success();
|
||||
if (CollectionUtils.isEmpty(taskNodeTree.getNodeList())) {
|
||||
@@ -1308,7 +1309,11 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
Map<String, TaskNode> projectNodeMap = Map.of();
|
||||
Map<String, TaskNode> taskNodeMap = Map.of();
|
||||
if (CollectionUtils.isNotEmpty(projectNodeList)) {
|
||||
projectNodeList.forEach(node -> node.setCreateTime(curDateStr));
|
||||
projectNodeList.forEach(node ->
|
||||
{
|
||||
node.setCreateTime(curDateStr);
|
||||
node.setOwnRootNodeUuid(ownRootNodeUuid);
|
||||
});
|
||||
|
||||
if (mapper.batchAddSimulationNodes(projectNodeList) <= 0) {
|
||||
response = SdmResponse.failed("添加节点失败");
|
||||
@@ -1720,7 +1725,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
// }
|
||||
log.info("当前顶级节点类型为:{}", currentTopNodeType);
|
||||
|
||||
eachProjectNode.setUuid(generateUuid());
|
||||
eachProjectNode.setUuid(RandomUtil.generateString(32));
|
||||
eachProjectNode.setParentId(StringUtils.isNotEmpty(parentId) ? parentId : "0");
|
||||
eachProjectNode.setNodeId(eachProjectNode.getParentId());
|
||||
eachProjectNode.setNodeVersion(nodeVersion);
|
||||
@@ -2106,7 +2111,7 @@ public class ProjectServiceImpl extends BaseService implements IProjectService {
|
||||
Long tenantId = ThreadLocalContext.getTenantId();
|
||||
TaskNodeTree taskNodeTree = newParseTaskTree(JSONArray.parseArray(JSONArray.toJSONString(addNodeList)));
|
||||
tagMap = req.getTagMap();
|
||||
SdmResponse response = newRealAddSimulationTaskItems(taskNodeTree, tenantId, req.getTagMap());
|
||||
SdmResponse response = newRealAddSimulationTaskItems(taskNodeTree, tenantId, req.getTagMap(),req.getOwnRootNodeUuid());
|
||||
if (response.getCode() != ResultCode.SUCCESS.getCode()) {
|
||||
log.error("新增任务、分析项失败,清理新增数据!");
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
<insert id="addNodeBatch" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into simulation_node
|
||||
(uuid,nodeName,nodeCode,englishName,nodeType,nodeSubType,nodeStatus,parentId,folderId,nodeLevel,beginTime,endTime,finishTime,progress,
|
||||
(uuid,ownRootNodeUuid,nodeName,nodeCode,englishName,nodeType,nodeSubType,nodeStatus,parentId,folderId,nodeLevel,beginTime,endTime,finishTime,progress,
|
||||
achieveStatus,nodeVersion,tenantId,description,detailImgUrl,creator,create_time,tag1,tag2,tag3,tag4,tag5,tag6,tag7,tag8,tag9,tag10)
|
||||
values
|
||||
<foreach collection='addNodeList' item='addNode' index='index' separator=','>
|
||||
(#{addNode.uuid},#{addNode.nodeName},#{addNode.nodeCode},'',#{addNode.nodeType},#{addNode.nodeSubType},'0',#{addNode.pid},
|
||||
(#{addNode.uuid},#{addNode.ownRootNodeUuid},#{addNode.nodeName},#{addNode.nodeCode},'',#{addNode.nodeType},#{addNode.nodeSubType},'0',#{addNode.pid},
|
||||
'',1,#{addNode.beginTime},#{addNode.endTime},'',#{addNode.progressStatus},#{addNode.achieveStatus},'1',#{addNode.tenantId},#{addNode.description},
|
||||
#{addNode.detailImgUrl},#{addNode.creator},#{addNode.createTime},#{addNode.Tag1},#{addNode.Tag2},
|
||||
#{addNode.Tag3},#{addNode.Tag4},#{addNode.Tag5},#{addNode.Tag6},#{addNode.Tag7},#{addNode.Tag8},#{addNode.Tag9},#{addNode.Tag10})
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.sdm.task.service.impl;
|
||||
|
||||
import com.sdm.common.common.SdmResponse;
|
||||
import com.sdm.common.service.BaseService;
|
||||
import com.sdm.common.utils.RandomUtil;
|
||||
import com.sdm.task.model.dto.TaskPerformanceDto;
|
||||
import com.sdm.task.model.entity.SimulationPerformance;
|
||||
import com.sdm.task.dao.SimulationPerformanceMapper;
|
||||
@@ -59,7 +60,7 @@ public class SimulationPerformanceServiceImpl extends ServiceImpl<SimulationPerf
|
||||
SimulationPerformance simulationPerformance = new SimulationPerformance();
|
||||
BeanUtils.copyProperties(performance, simulationPerformance);
|
||||
|
||||
simulationPerformance.setUuid(BaseService.generateUuid());
|
||||
simulationPerformance.setUuid(RandomUtil.generateString(32));
|
||||
simulationPerformance.setTaskId(simulationTask.getUuid());
|
||||
simulationPerformance.setTaskName(simulationTask.getTaskName());
|
||||
simulationPerformanceList.add(simulationPerformance);
|
||||
|
||||
Reference in New Issue
Block a user