update - 添加分类黑白名单配置,不允许添加重复的数据
This commit is contained in:
parent
d39acaa9f9
commit
e74bbf288d
@ -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<Long> workspaceIds;
|
||||
|
||||
/**
|
||||
* 操作人姓名
|
||||
*/
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<ExtAxDictConfMapper, ExtAxDictConf> 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<CategoryConfigItemVO> 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<ExtAxDictConfMapper,
|
||||
.eq(Objects.nonNull(dto.getDictId()), ExtAxDictConf::getDictId, dto.getDictId())
|
||||
.eq(StringUtils.hasLength(dto.getConfigType()), ExtAxDictConf::getConfigType, dto.getConfigType())
|
||||
.eq(Objects.nonNull(dto.getWorkspaceId()), ExtAxDictConf::getWorkspaceId, dto.getWorkspaceId())
|
||||
.in(!CollectionUtils.isEmpty(dto.getWorkspaceIds()), ExtAxDictConf::getWorkspaceId,
|
||||
dto.getWorkspaceIds())
|
||||
.like(StringUtils.hasLength(dto.getOperationName()), ExtAxDictConf::getOperationName,
|
||||
dto.getOperationName())
|
||||
.eq(ExtAxDictConf::getIsDelete, false)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user