Commit a4174677 by zhouhaibao

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

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