update 新增翻译根据流程分类ID查询流程分类名称

This commit is contained in:
AprilWind 2024-12-16 16:29:36 +08:00
parent 640981b6d6
commit 3d5c00f03d
7 changed files with 79 additions and 4 deletions

View File

@ -48,4 +48,14 @@ public interface FlowConstant {
*/
String REDUCTION_SIGNATURE = "reductionSignature";
/**
* 流程分类Id转名称
*/
String CATEGORY_ID_TO_NAME = "category_id_to_name";
/**
* 流程分类名称
*/
String FLOW_CATEGORY_NAME = "flow_category_name#30d";
}

View File

@ -1,6 +1,8 @@
package org.dromara.workflow.domain.vo;
import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.workflow.common.constant.FlowConstant;
import java.io.Serial;
import java.io.Serializable;
@ -54,6 +56,12 @@ public class FlowDefinitionVo implements Serializable {
*/
private String category;
/**
* 流程分类名称
*/
@Translation(type = FlowConstant.CATEGORY_ID_TO_NAME, mapper = "category")
private String categoryName;
/**
* 流程版本
*/

View File

@ -21,6 +21,14 @@ public interface IFlwCategoryService {
*/
FlowCategoryVo queryById(Long categoryId);
/**
* 根据流程分类ID查询流程分类名称
*
* @param categoryId 流程分类ID
* @return 流程分类名称
*/
String selectCategoryNameById(String categoryId);
/**
* 查询符合条件的流程分类列表
*

View File

@ -18,6 +18,7 @@ import java.util.Map;
* @author may
*/
public interface IFlwTaskService {
/**
* 启动任务
*
@ -26,7 +27,6 @@ public interface IFlwTaskService {
*/
Map<String, Object> startWorkFlow(StartProcessBo startProcessBo);
/**
* 办理任务
*
@ -53,7 +53,6 @@ public interface IFlwTaskService {
*/
TableDataInfo<FlowHisTaskVo> pageByTaskFinish(FlowTaskBo flowTaskBo, PageQuery pageQuery);
/**
* 查询待办任务
*

View File

@ -0,0 +1,31 @@
package org.dromara.workflow.service.impl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.common.translation.annotation.TranslationType;
import org.dromara.common.translation.core.TranslationInterface;
import org.dromara.workflow.common.constant.FlowConstant;
import org.dromara.workflow.service.IFlwCategoryService;
import org.springframework.stereotype.Service;
/**
* 流程分类名称翻译实现
*
* @author AprilWind
*/
@Slf4j
@RequiredArgsConstructor
@Service
@TranslationType(type = FlowConstant.CATEGORY_ID_TO_NAME)
public class CategoryNameTranslationImpl implements TranslationInterface<String> {
private final IFlwCategoryService flwCategoryService;
@Override
public String translation(Object key, String other) {
if (key instanceof String categoryId) {
return flwCategoryService.selectCategoryNameById(categoryId);
}
return null;
}
}

View File

@ -15,11 +15,14 @@ import org.dromara.common.mybatis.helper.DataBaseHelper;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.warm.flow.core.service.DefService;
import org.dromara.warm.flow.orm.entity.FlowDefinition;
import org.dromara.workflow.common.constant.FlowConstant;
import org.dromara.workflow.domain.FlowCategory;
import org.dromara.workflow.domain.bo.FlowCategoryBo;
import org.dromara.workflow.domain.vo.FlowCategoryVo;
import org.dromara.workflow.mapper.FlwCategoryMapper;
import org.dromara.workflow.service.IFlwCategoryService;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
@ -56,6 +59,20 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService {
return category;
}
/**
* 根据流程分类ID查询流程分类名称
*
* @param categoryId 流程分类ID
* @return 流程分类名称
*/
@Cacheable(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId")
@Override
public String selectCategoryNameById(String categoryId) {
FlowCategory category = baseMapper.selectOne(new LambdaQueryWrapper<FlowCategory>()
.select(FlowCategory::getCategoryName).eq(FlowCategory::getCategoryId, categoryId));
return ObjectUtils.notNullGetter(category, FlowCategory::getCategoryName);
}
/**
* 查询符合条件的流程分类列表
*
@ -210,6 +227,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService {
* @param bo 流程分类
* @return 是否修改成功
*/
@CacheEvict(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#bo.categoryId")
@Override
public int updateByBo(FlowCategoryBo bo) {
FlowCategory category = MapstructUtils.convert(bo, FlowCategory.class);
@ -280,6 +298,7 @@ public class FlwCategoryServiceImpl implements IFlwCategoryService {
* @param categoryId 主键
* @return 是否删除成功
*/
@CacheEvict(cacheNames = FlowConstant.FLOW_CATEGORY_NAME, key = "#categoryId")
@Override
public int deleteWithValidById(Long categoryId) {
return baseMapper.deleteById(categoryId);

View File

@ -80,7 +80,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
/**
* 分页查询正在运行的流程实例
*
* @param flowInstanceBo 参数
* @param flowInstanceBo 流程实例
* @param pageQuery 分页
*/
@Override
@ -94,7 +94,7 @@ public class FlwInstanceServiceImpl implements IFlwInstanceService {
/**
* 分页查询已结束的流程实例
*
* @param flowInstanceBo 参数
* @param flowInstanceBo 流程实例
* @param pageQuery 分页
*/
@Override