Commit a4174677 by zhouhaibao

feat(strategy): 添加分支、条件组和动作序号功能

- 在策略分支保存时添加分支编号设置
- 为条件组增加序列号字段赋值逻辑
- 为动作添加动作序号设置功能
- 确保各层级元素按顺序递增编号
1 parent 334decd1
......@@ -203,8 +203,10 @@ public class StrategySopService {
if (CollUtil.isEmpty(branches)) {
return;
}
int branchNo = 1;
for (SopBranchReqDTO branchReq : branches) {
SopStrategyBranch branch = BeanUtil.copyProperties(branchReq, SopStrategyBranch.class);
branch.setBranchNo(branchNo);
branch.setStrategyId(strategyId);
branch.setDeletedFlag(DeleteFlagEnum.N.getValue());
branch.setCreatedBy(createdBy);
......@@ -212,9 +214,9 @@ public class StrategySopService {
branch.setStep(3);
sopStrategyBranchMapper.insertSelective(branch);
Integer branchId = branch.getId();
saveConditionGroups(strategyId, branchId, branchReq.getConditionGroups(), createdBy);
saveActions(strategyId, branchId, branchReq.getActions(), createdBy);
branchNo++ ;
}
}
......@@ -241,11 +243,13 @@ public class StrategySopService {
if (CollUtil.isEmpty(conditionGroups)) {
return;
}
int groupNo = 1;
for (SopConditionGroupReqDTO groupReq : conditionGroups) {
SopStrategyConditionGroup group = BeanUtil.copyProperties(groupReq, SopStrategyConditionGroup.class);
group.setStrategyId(strategyId);
group.setBranchId(branchId);
group.setStep(3);
group.setGroupSeq(groupNo);
group.setDeletedFlag(DeleteFlagEnum.N.getValue());
group.setCreatedBy(createdBy);
group.setCreatedDate(new Date());
......@@ -253,6 +257,7 @@ public class StrategySopService {
Integer groupId = group.getId();
saveConditions(strategyId, branchId, groupId, groupReq.getConditions(), createdBy);
groupNo++ ;
}
}
......@@ -276,6 +281,7 @@ public class StrategySopService {
if (CollUtil.isEmpty(actions)) {
return;
}
int actionNo = 1;
for (SopActionReqDTO actionReq : actions) {
SopStrategyAction action = BeanUtil.copyProperties(actionReq, SopStrategyAction.class);
List<SopActionMediaReqDTO> medias = actionReq.getMedias();
......@@ -283,6 +289,7 @@ public class StrategySopService {
action.setMediaIds(medias.stream().map(SopActionMediaReqDTO::getMediaUrl).collect(
Collectors.joining(",")));
}
action.setActionSeq(actionNo);
action.setStrategyId(strategyId);
action.setBranchId(branchId);
action.setDeletedFlag(DeleteFlagEnum.N.getValue());
......@@ -313,6 +320,7 @@ public class StrategySopService {
Integer actionId = action.getId();
saveActionMedias(actionId, actionReq.getMedias(), createdBy);
actionNo++ ;
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!