Merge remote-tracking branch 'origin/feature/REQ-3769' into feature/REQ-3769
This commit is contained in:
commit
03cabaf1be
@ -1,31 +1,20 @@
|
||||
package cn.axzo.workflow.client.feign.manage;
|
||||
|
||||
import cn.axzo.workflow.client.annotation.WorkflowEngineFeignClient;
|
||||
import cn.axzo.workflow.client.config.CommonFeignConfiguration;
|
||||
import cn.axzo.workflow.common.annotation.InvokeMode;
|
||||
import cn.axzo.workflow.common.annotation.Manageable;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategorySearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryUpdateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.*;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryConfigItemVO;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryItemVO;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.SYNC;
|
||||
import static cn.axzo.workflow.common.enums.RpcInvokeModeEnum.*;
|
||||
|
||||
|
||||
/**
|
||||
@ -177,4 +166,21 @@ public interface ProcessCategoryApi {
|
||||
@GetMapping("/api/process/category/check/status")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<Boolean> checkCategoryStatus(@RequestParam Long tenantId, @RequestParam String categoryCode);
|
||||
|
||||
/**
|
||||
* 查询分类对应的分组以及分组下的变量
|
||||
* @param dto 请求参数
|
||||
* @return 分组以及分组下的变量
|
||||
*/
|
||||
@PostMapping("/api/process/category/group-with-vars/list")
|
||||
@InvokeMode(SYNC)
|
||||
CommonResponse<List<CategoryGroupVarItemVo>> configSearchGroupAndVars(@Validated @RequestBody CategoryGroupVarSearchDto dto);
|
||||
|
||||
/**
|
||||
* 新增或者更新分组或者变量
|
||||
* @param dto 请求参数
|
||||
* @return 是否成功
|
||||
*/
|
||||
@PostMapping("/api/process/category/group-with-vars/upsert")
|
||||
CommonResponse<Boolean> upsertGroupAndVars(@Validated @RequestBody CategoryGroupVarUpsertDto dto);
|
||||
}
|
||||
|
||||
@ -0,0 +1,18 @@
|
||||
package cn.axzo.workflow.common.model.request.category;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@ApiModel("业务分类分组和变量搜索入参模型")
|
||||
@Data
|
||||
public class CategoryGroupVarSearchDto {
|
||||
|
||||
@NotNull(message = "dictId 不允许为空")
|
||||
@Min(value = 1, message = "字典ID值必须大于等于1")
|
||||
@ApiModelProperty(value = "字典 ID")
|
||||
private Long dictId;
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package cn.axzo.workflow.common.model.request.category;
|
||||
|
||||
import cn.axzo.workflow.common.enums.VarTypeEnum;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.*;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CategoryGroupVarUpsertDto {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "字典id")
|
||||
@Min(value = 1, message = "字典id值必须大于等1")
|
||||
@NotNull(message = "字典id不能为空")
|
||||
private Long dictId;
|
||||
|
||||
@NotEmpty(message = "分组列表不能为空")
|
||||
@Valid
|
||||
private List<CategoryGroupUpsertVo> groupVos;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public static class CategoryGroupUpsertVo implements Serializable {
|
||||
private static final long serialVersionUID = 5406711143425155649L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 上级分组id
|
||||
*/
|
||||
private Long parentGroupId;
|
||||
|
||||
/**
|
||||
* 分组名
|
||||
*/
|
||||
@NotBlank(message = "分组名称不能为空")
|
||||
@Length(max = 50, message = "字典标签最长只支持50个字符")
|
||||
private String groupName;
|
||||
|
||||
@NotNull(message = "分组序号不能为空")
|
||||
private Integer ordinal;
|
||||
|
||||
@Valid
|
||||
private List<CategoryVarUpsertVo> vars;
|
||||
}
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public static class CategoryVarUpsertVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1918203166603971593L;
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 变量类型,文本/图片
|
||||
*/
|
||||
@NotNull(message = "变量类型不能为空")
|
||||
private VarTypeEnum type;
|
||||
|
||||
/**
|
||||
* 变量code
|
||||
*/
|
||||
@NotBlank(message = "变量编码不能为空")
|
||||
@Length(max = 50, message = "变量编码最长只支持50个字符")
|
||||
@Pattern(regexp = "^[a-zA-Z]+$", message = "变量编码仅限英文字符")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 变量名称
|
||||
*/
|
||||
@NotBlank(message = "变量名称不能为空")
|
||||
@Length(max = 50, message = "变量名称最长只支持50个字符")
|
||||
private String name;
|
||||
|
||||
@NotNull(message = "变量序号不能为空")
|
||||
private Integer ordinal;
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,80 @@
|
||||
package cn.axzo.workflow.common.model.response.category;
|
||||
|
||||
|
||||
import cn.axzo.workflow.common.enums.VarTypeEnum;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public class CategoryGroupVarItemVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -3349551294678140220L;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 上级分组id
|
||||
*/
|
||||
private Long parentGroupId;
|
||||
|
||||
/**
|
||||
* 分组名
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 当前分组对应的变量
|
||||
*/
|
||||
private List<CategoryVarItemVo> vars;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@Builder
|
||||
public static class CategoryVarItemVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1918203166603971593L;
|
||||
|
||||
/**
|
||||
* 变量id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
private Long groupId;
|
||||
|
||||
/**
|
||||
* 变量类型,文本/图片
|
||||
*/
|
||||
private VarTypeEnum type;
|
||||
|
||||
/**
|
||||
* 变量code
|
||||
*/
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 变量名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
}
|
||||
}
|
||||
@ -14,10 +14,20 @@ public class ExtAxDictGroup extends BaseEntity<ExtAxDictGroup> {
|
||||
|
||||
private static final long serialVersionUID = 7133194071098740752L;
|
||||
|
||||
/**
|
||||
* 对应字典id
|
||||
*/
|
||||
private Long dictId;
|
||||
|
||||
private Long parentGroupId;
|
||||
|
||||
/**
|
||||
* 分组名
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer ordinal;
|
||||
}
|
||||
|
||||
@ -11,10 +11,15 @@ import lombok.ToString;
|
||||
@TableName(value = "ext_ax_dict_group_variables", autoResultMap = true)
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class ExtAxDictGroupVariables extends BaseEntity<ExtAxDictGroupVariables> {
|
||||
public class ExtAxDictGroupVariable extends BaseEntity<ExtAxDictGroupVariable> {
|
||||
|
||||
private static final long serialVersionUID = 2910796107844751820L;
|
||||
|
||||
/**
|
||||
* 字典id
|
||||
*/
|
||||
private Long dictId;
|
||||
|
||||
/**
|
||||
* 分组id
|
||||
*/
|
||||
@ -35,4 +40,8 @@ public class ExtAxDictGroupVariables extends BaseEntity<ExtAxDictGroupVariables>
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 顺序
|
||||
*/
|
||||
private Integer ordinal;
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.workflow.core.repository.mapper;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroup;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ExtAxDictGroupMapper extends BaseMapper<ExtAxDictGroup> {
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package cn.axzo.workflow.core.repository.mapper;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroupVariable;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface ExtAxDictGroupVariableMapper extends BaseMapper<ExtAxDictGroupVariable> {
|
||||
}
|
||||
@ -2,8 +2,11 @@ package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarSearchDto;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarUpsertDto;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryConfigItemVO;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -0,0 +1,24 @@
|
||||
package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarSearchDto;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarUpsertDto;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CategoryGroupService {
|
||||
|
||||
/**
|
||||
* 查询业务分类下的分组以及变量
|
||||
* @param dto 请求参数
|
||||
* @return 分组以及对应变量列表
|
||||
*/
|
||||
List<CategoryGroupVarItemVo> searchGroupAndVarList(CategoryGroupVarSearchDto dto);
|
||||
|
||||
/**
|
||||
* 新增/更新 分组以及变量
|
||||
* @param dto 请求桉树
|
||||
* @return 是否成功
|
||||
*/
|
||||
Boolean upsertGroupAndVars(CategoryGroupVarUpsertDto dto);
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package cn.axzo.workflow.core.service;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroupVariable;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
public interface CategoryGroupVariableService extends IService<ExtAxDictGroupVariable> {
|
||||
|
||||
}
|
||||
@ -1,31 +1,45 @@
|
||||
package cn.axzo.workflow.core.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarSearchDto;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarUpsertDto;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryConfigItemVO;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDict;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictConf;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroup;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroupVariable;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictConfMapper;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictGroupMapper;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictGroupVariableMapper;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictMapper;
|
||||
import cn.axzo.workflow.core.service.CategoryConfigService;
|
||||
import cn.axzo.workflow.core.service.converter.CategoryConfigConverter;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.workflow.common.code.CategoryRespCode.CATEGORY_CONFIG_EXISTS;
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.*;
|
||||
import static cn.axzo.workflow.common.code.CategoryRespCode.*;
|
||||
|
||||
/**
|
||||
* 分类黑白名单配置服务
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
package cn.axzo.workflow.core.service.impl;
|
||||
|
||||
import cn.axzo.basics.common.constant.enums.TableIsDeleteEnum;
|
||||
import cn.axzo.workflow.common.exception.WorkflowEngineException;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarSearchDto;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryGroupVarUpsertDto;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroup;
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroupVariable;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictGroupMapper;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictGroupVariableMapper;
|
||||
import cn.axzo.workflow.core.service.CategoryGroupService;
|
||||
import cn.axzo.workflow.core.service.CategoryGroupVariableService;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.axzo.workflow.common.code.BpmnInstanceRespCode.*;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CategoryGroupServiceImpl extends ServiceImpl<ExtAxDictGroupMapper, ExtAxDictGroup> implements CategoryGroupService {
|
||||
|
||||
private final ExtAxDictGroupMapper extAxDictGroupMapper;
|
||||
private final ExtAxDictGroupVariableMapper extAxDictGroupVariableMapper;
|
||||
private final CategoryGroupVariableService categoryGroupVariableService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CategoryGroupVarItemVo> searchGroupAndVarList(CategoryGroupVarSearchDto dto) {
|
||||
LambdaQueryWrapper<ExtAxDictGroup> groupQueryWrapper = Wrappers.lambdaQuery(ExtAxDictGroup.class)
|
||||
.eq(Objects.nonNull(dto.getDictId()), ExtAxDictGroup::getDictId, dto.getDictId())
|
||||
.eq(ExtAxDictGroup::getIsDelete, TableIsDeleteEnum.NORMAL.value);
|
||||
List<ExtAxDictGroup> extAxDictGroups = extAxDictGroupMapper.selectList(groupQueryWrapper);
|
||||
if (CollectionUtils.isEmpty(extAxDictGroups)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
LambdaQueryWrapper<ExtAxDictGroupVariable> varQueryWrapper = Wrappers.lambdaQuery(ExtAxDictGroupVariable.class)
|
||||
.eq(Objects.nonNull(dto.getDictId()), ExtAxDictGroupVariable::getDictId, dto.getDictId())
|
||||
.eq(ExtAxDictGroupVariable::getIsDelete, TableIsDeleteEnum.NORMAL.value);
|
||||
List<ExtAxDictGroupVariable> groupVars = extAxDictGroupVariableMapper.selectList(varQueryWrapper);
|
||||
Map<Long, List<ExtAxDictGroupVariable>> varMap = ListUtils.emptyIfNull(groupVars).stream().collect(Collectors.groupingBy(ExtAxDictGroupVariable::getGroupId));
|
||||
return extAxDictGroups.stream()
|
||||
.map(group -> {
|
||||
CategoryGroupVarItemVo categoryGroupVarItemVo = BeanUtil.copyProperties(group, CategoryGroupVarItemVo.class);
|
||||
List<CategoryGroupVarItemVo.CategoryVarItemVo> categoryVarItemVos = BeanUtil.copyToList(ListUtils.emptyIfNull(varMap.get(group.getId())), CategoryGroupVarItemVo.CategoryVarItemVo.class);
|
||||
categoryGroupVarItemVo.setVars(categoryVarItemVos);
|
||||
return categoryGroupVarItemVo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean upsertGroupAndVars(CategoryGroupVarUpsertDto dto) {
|
||||
if (CollectionUtils.isEmpty(dto.getGroupVos())) {
|
||||
throw new WorkflowEngineException(PROCESS_INSTANCE_NOT_EXISTS);
|
||||
}
|
||||
List<ExtAxDictGroup> updateGroupList = new ArrayList<>();
|
||||
List<ExtAxDictGroup> createGroupList = new ArrayList<>();
|
||||
List<ExtAxDictGroupVariable> updateVarList = new ArrayList<>();
|
||||
Map<Integer, List<ExtAxDictGroupVariable>> createVarMap = new HashMap<>();
|
||||
for (CategoryGroupVarUpsertDto.CategoryGroupUpsertVo groupVo : dto.getGroupVos()) {
|
||||
ExtAxDictGroup extAxDictGroup = new ExtAxDictGroup();
|
||||
extAxDictGroup.setGroupName(groupVo.getGroupName());
|
||||
extAxDictGroup.setDictId(dto.getDictId());
|
||||
extAxDictGroup.setParentGroupId(groupVo.getParentGroupId());
|
||||
if (groupVo.getId() != null && groupVo.getId() > 0) {
|
||||
extAxDictGroup.setId(groupVo.getId());
|
||||
updateGroupList.add(extAxDictGroup);
|
||||
List<CategoryGroupVarUpsertDto.CategoryVarUpsertVo> vars = groupVo.getVars();
|
||||
if (!CollectionUtils.isEmpty(vars)) {
|
||||
for (CategoryGroupVarUpsertDto.CategoryVarUpsertVo v : vars) {
|
||||
ExtAxDictGroupVariable extAxDictGroupVariable = BeanUtil.copyProperties(v, ExtAxDictGroupVariable.class);
|
||||
if (v.getId() != null && v.getId() > 0) {
|
||||
updateVarList.add(extAxDictGroupVariable);
|
||||
} else {
|
||||
extAxDictGroupVariable.setDictId(dto.getDictId());
|
||||
extAxDictGroupVariable.setGroupId(groupVo.getId());
|
||||
createVarMap.computeIfAbsent(groupVo.getOrdinal(), c -> new ArrayList<>()).add(extAxDictGroupVariable);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
createGroupList.add(extAxDictGroup);
|
||||
List<CategoryGroupVarUpsertDto.CategoryVarUpsertVo> vars = groupVo.getVars();
|
||||
if (!CollectionUtils.isEmpty(vars)) {
|
||||
vars.forEach(v -> createVarMap.computeIfAbsent(groupVo.getOrdinal(), c -> new ArrayList<>()).add(BeanUtil.copyProperties(v, ExtAxDictGroupVariable.class)));
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updateBatchById(updateGroupList);
|
||||
this.saveBatch(createGroupList);
|
||||
Map<Integer, List<ExtAxDictGroup>> ordinalGroupMap = createGroupList.stream().collect(Collectors.groupingBy(ExtAxDictGroup::getOrdinal));
|
||||
createVarMap.forEach((key, value) -> value.forEach(v -> v.setGroupId(ordinalGroupMap.get(key).get(0).getId())));
|
||||
updateVarList.addAll(createVarMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList()));
|
||||
categoryGroupVariableService.saveOrUpdateBatch(updateVarList);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package cn.axzo.workflow.core.service.impl;
|
||||
|
||||
import cn.axzo.workflow.core.repository.entity.ExtAxDictGroupVariable;
|
||||
import cn.axzo.workflow.core.repository.mapper.ExtAxDictGroupVariableMapper;
|
||||
import cn.axzo.workflow.core.service.CategoryGroupVariableService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class CategoryGroupVariableServiceImpl extends ServiceImpl<ExtAxDictGroupVariableMapper, ExtAxDictGroupVariable> implements CategoryGroupVariableService {
|
||||
}
|
||||
@ -196,9 +196,7 @@ public class CategoryServiceImpl extends ServiceImpl<ExtAxDictMapper, ExtAxDict>
|
||||
if (!dictDO.isPresent()) {
|
||||
throw new WorkflowEngineException(CATEGORY_ID_NOT_EXISTS, String.valueOf(id));
|
||||
}
|
||||
dictDO.ifPresent(dict -> {
|
||||
dict.setStatus(state ? 1 : 0);
|
||||
});
|
||||
dictDO.ifPresent(dict -> dict.setStatus(Boolean.TRUE.equals(state) ? 1 : 0));
|
||||
dictMapper.updateById(dictDO.get());
|
||||
return true;
|
||||
}
|
||||
@ -209,9 +207,7 @@ public class CategoryServiceImpl extends ServiceImpl<ExtAxDictMapper, ExtAxDict>
|
||||
if (!dictDO.isPresent()) {
|
||||
throw new WorkflowEngineException(CATEGORY_ID_NOT_EXISTS, String.valueOf(id));
|
||||
}
|
||||
dictDO.ifPresent(dict -> {
|
||||
dict.setRemark(configType);
|
||||
});
|
||||
dictDO.ifPresent(dict -> dict.setRemark(configType));
|
||||
dictMapper.updateById(dictDO.get());
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1,36 +1,26 @@
|
||||
package cn.axzo.workflow.server.controller.web.manage;
|
||||
|
||||
import cn.axzo.workflow.client.feign.manage.ProcessCategoryApi;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryConfigSearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryCreateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategorySearchDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.CategoryUpdateDTO;
|
||||
import cn.axzo.workflow.common.model.request.category.*;
|
||||
import cn.axzo.workflow.common.model.response.BpmPageResult;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryConfigItemVO;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryGroupVarItemVo;
|
||||
import cn.axzo.workflow.common.model.response.category.CategoryItemVO;
|
||||
import cn.axzo.workflow.core.service.CategoryConfigService;
|
||||
import cn.axzo.workflow.core.service.CategoryService;
|
||||
import cn.axzo.workflow.core.service.CategoryGroupService;
|
||||
import cn.axzo.workflow.server.common.annotation.ErrorReporter;
|
||||
import cn.axzo.workflow.server.common.annotation.RepeatSubmit;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.azxo.framework.common.model.CommonResponse.success;
|
||||
import static cn.azxo.framework.common.model.CommonResponse.*;
|
||||
|
||||
/**
|
||||
* 业务分类相关控制器
|
||||
@ -49,6 +39,8 @@ public class ProcessCategoryController implements ProcessCategoryApi {
|
||||
private CategoryService categoryService;
|
||||
@Resource
|
||||
private CategoryConfigService categoryConfigService;
|
||||
@Resource
|
||||
private CategoryGroupService categoryGroupService;
|
||||
|
||||
/**
|
||||
* 获取指定业务分类
|
||||
@ -228,4 +220,28 @@ public class ProcessCategoryController implements ProcessCategoryApi {
|
||||
public CommonResponse<Boolean> checkCategoryStatus(@RequestParam Long tenantId, @RequestParam String categoryCode) {
|
||||
return success(categoryService.checkCategoryStatus(tenantId, categoryCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务分类的分组和变量查询
|
||||
*
|
||||
* @return 业务分类的分组以及变量
|
||||
*/
|
||||
@Operation(summary = "业务分类黑白名单查询")
|
||||
@PostMapping("/group-with-vars/list")
|
||||
@Override
|
||||
public CommonResponse<List<CategoryGroupVarItemVo>> configSearchGroupAndVars(@Validated @RequestBody CategoryGroupVarSearchDto dto) {
|
||||
return success(categoryGroupService.searchGroupAndVarList(dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 业务分类的分组和变量查询
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
@Operation(summary = "业务分类黑白名单查询")
|
||||
@PostMapping("/group-with-vars/upsert")
|
||||
@Override
|
||||
public CommonResponse<Boolean> upsertGroupAndVars(@Validated @RequestBody CategoryGroupVarUpsertDto dto) {
|
||||
return success(categoryGroupService.upsertGroupAndVars(dto));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user