|
|
@@ -55,6 +55,7 @@ public class TreeNodeServiceImpl implements TreeNodeService {
|
|
|
.state(NodeStateEnum.CREATED)
|
|
|
.title("default root")
|
|
|
.description("根节点")
|
|
|
+ .priority(PriorityEnum.MIDDLE)
|
|
|
.type(NodeTypeEnum.REQUIREMENT)
|
|
|
.timeToTake(0L)
|
|
|
.build();
|
|
|
@@ -103,15 +104,23 @@ public class TreeNodeServiceImpl implements TreeNodeService {
|
|
|
@Override
|
|
|
@Transactional
|
|
|
@TreeLogging(OperationEnum.START)
|
|
|
- public Integer insertTreeNodeByFatherNode(int fatherId) throws ServiceException {
|
|
|
- TreeNodePO treeNodePO = getDefaultTreeNodePO();
|
|
|
- treeNodePO.setParentId(fatherId);
|
|
|
- int res = treeNodeMapper.insertTreeNode(treeNodePO);
|
|
|
- // TODO:safety check
|
|
|
- if (res <= 0) {
|
|
|
- throw new ServiceException(503,"插入需求节点失败");
|
|
|
- }
|
|
|
- return treeNodePO.getId();
|
|
|
+ public void insertTreeNodeByFatherNode(int fatherId) throws ServiceException {
|
|
|
+ SimpleDateFormat format = DateUtil.getSimpleDateFormat();
|
|
|
+ TreeNodePO father = treeNodeMapper.getTreeNodeById(fatherId);
|
|
|
+ TreeNodePO son = TreeNodePO.builder()
|
|
|
+ .parentId(fatherId)
|
|
|
+ .type(father.getDeep()+1==4?NodeTypeEnum.TASK:NodeTypeEnum.REQUIREMENT)
|
|
|
+ .title("默认子节点")
|
|
|
+ .description("子节点")
|
|
|
+ .state(NodeStateEnum.CREATED)
|
|
|
+ .projectId(father.getProjectId())
|
|
|
+ .startTime(format.format(new Date()))
|
|
|
+ .deep(father.getDeep()+1)
|
|
|
+ .leaf(father.getDeep()+1==4)
|
|
|
+ .priority(PriorityEnum.MIDDLE)
|
|
|
+ .timeToTake(0L)
|
|
|
+ .build();
|
|
|
+ treeNodeMapper.insertTreeNode(son);
|
|
|
}
|
|
|
|
|
|
@Override
|