diff --git a/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/request/category/CategoryConfigSearchDTO.java b/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/request/category/CategoryConfigSearchDTO.java index da154896f..e3d32a85f 100644 --- a/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/request/category/CategoryConfigSearchDTO.java +++ b/workflow-engine-common/src/main/java/cn/axzo/workflow/common/model/request/category/CategoryConfigSearchDTO.java @@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModel; import lombok.Data; import lombok.EqualsAndHashCode; +import java.util.List; + /** * 业务分类黑白名单搜索入参模型 * @@ -27,10 +29,15 @@ public class CategoryConfigSearchDTO extends BpmPageParam { private String configType; /** - * 工作台名称 + * 工作台 ID */ private Long workspaceId; + /** + * 工作台 ID 集合 + */ + private List workspaceIds; + /** * 操作人姓名 */ diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/code/CategoryRespCode.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/code/CategoryRespCode.java index 42d9128fd..cca3ac338 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/code/CategoryRespCode.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/common/code/CategoryRespCode.java @@ -18,6 +18,7 @@ public enum CategoryRespCode implements IModuleRespCode { CATEGORY_ID_NOT_EXISTS("003", "指定分类ID:【{}】不存在"), CATEGORY_CODE_NOT_EXISTS("004", "指定分类CODE:【{}】不存在"), CATEGORY_DATA_ERROR("005", "分类数据异常"), + CATEGORY_CONFIG_EXISTS("006", "分类【{}】的【{}】配置中已存在重复数据"), ; private String code; diff --git a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/CategoryConfigServiceImpl.java b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/CategoryConfigServiceImpl.java index fcfa85fcd..2def737e1 100644 --- a/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/CategoryConfigServiceImpl.java +++ b/workflow-engine-core/src/main/java/cn/axzo/workflow/core/service/impl/CategoryConfigServiceImpl.java @@ -4,8 +4,11 @@ import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO; import cn.axzo.workflow.common.model.request.category.CategoryConfigSearchDTO; import cn.axzo.workflow.common.model.response.BpmPageResult; import cn.axzo.workflow.common.model.response.category.CategoryConfigItemVO; +import cn.axzo.workflow.core.common.exception.WorkflowEngineException; +import cn.axzo.workflow.core.repository.entity.ExtAxDict; import cn.axzo.workflow.core.repository.entity.ExtAxDictConf; import cn.axzo.workflow.core.repository.mapper.ExtAxDictConfMapper; +import cn.axzo.workflow.core.repository.mapper.ExtAxDictMapper; import cn.axzo.workflow.core.service.CategoryConfigService; import cn.axzo.workflow.core.service.converter.CategoryConfigConverter; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; @@ -15,12 +18,15 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; +import org.springframework.util.CollectionUtils; import org.springframework.util.StringUtils; import javax.annotation.Resource; import java.util.List; import java.util.Objects; +import static cn.axzo.workflow.core.common.code.CategoryRespCode.CATEGORY_CONFIG_EXISTS; + /** * 分类黑白名单配置服务 * @@ -31,13 +37,24 @@ import java.util.Objects; @RequiredArgsConstructor @Slf4j public class CategoryConfigServiceImpl extends ServiceImpl implements CategoryConfigService { - + @Resource + private ExtAxDictMapper dictMapper; @Resource private ExtAxDictConfMapper dictConfMapper; private final CategoryConfigConverter categoryConfigConverter; @Override public void create(CategoryConfigCreateDTO dto) { + CategoryConfigSearchDTO searchDTO = new CategoryConfigSearchDTO(); + searchDTO.setDictId(dto.getDictId()); + searchDTO.setConfigType(dto.getConfigType()); + searchDTO.setWorkspaceIds(dto.getWorkspaceIds()); + List list = configSearch(searchDTO).getList(); + if (!list.isEmpty()) { + ExtAxDict extAxDict = dictMapper.selectById(dto.getDictId()); + throw new WorkflowEngineException(CATEGORY_CONFIG_EXISTS, extAxDict.getLabel(), dto.getConfigType()); + } + dto.getWorkspaceIds().forEach(workspaceId -> { ExtAxDictConf config = new ExtAxDictConf(); config.setDictId(dto.getDictId()); @@ -60,6 +77,8 @@ public class CategoryConfigServiceImpl extends ServiceImpl