|
@@ -13,6 +13,7 @@ import com.fjhx.flow.service.flow.FlowDefinitionNodeService;
|
|
|
import com.fjhx.flow.service.flow.FlowDefinitionService;
|
|
|
import com.fjhx.flow.service.flow.FlowInfoService;
|
|
|
import com.ruoyi.common.constant.StatusConstant;
|
|
|
+import com.ruoyi.common.core.domain.BaseIdPo;
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -80,6 +81,7 @@ public class FlowDefinitionServiceImpl extends ServiceImpl<FlowDefinitionMapper,
|
|
|
flowDefinitionNodeService.saveBatch(Arrays.asList(startNode, endNode));
|
|
|
}
|
|
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
@Override
|
|
|
public void addVersion(FlowDefinitionDto dto) {
|
|
|
Long flowInfoId = dto.getFlowInfoId();
|
|
@@ -128,13 +130,18 @@ public class FlowDefinitionServiceImpl extends ServiceImpl<FlowDefinitionMapper,
|
|
|
}
|
|
|
|
|
|
FlowDefinition flowDefinition = getById(flowDefinitionId);
|
|
|
- flowDefinition.setCurrentVersion(StatusConstant.YES);
|
|
|
+ if (StatusConstant.YES.equals(flowDefinition.getCurrentVersion())) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
|
|
|
update(q -> q
|
|
|
.eq(FlowDefinition::getFlowInfoId, flowDefinition.getFlowInfoId())
|
|
|
.eq(FlowDefinition::getTenantId, flowDefinition.getTenantId())
|
|
|
+ .in(BaseIdPo::getId, flowDefinition.getId())
|
|
|
.set(FlowDefinition::getCurrentVersion, StatusConstant.NO)
|
|
|
);
|
|
|
+
|
|
|
+ flowDefinition.setCurrentVersion(StatusConstant.YES);
|
|
|
updateById(flowDefinition);
|
|
|
}
|
|
|
|