update 优化 重构代码
This commit is contained in:
parent
0bc46c849f
commit
14463d3b1f
@ -32,9 +32,4 @@ public interface TransConstant {
|
|||||||
*/
|
*/
|
||||||
String OSS_ID_TO_URL = "oss_id_to_url";
|
String OSS_ID_TO_URL = "oss_id_to_url";
|
||||||
|
|
||||||
/**
|
|
||||||
* 任务Id转任务办理人名称
|
|
||||||
*/
|
|
||||||
String TASK_ID_TO_ASSIGNEE = "task_id_to_assignee";
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,15 @@
|
|||||||
|
package org.dromara.workflow.constant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 常量
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
public interface WfConstant {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务Id转任务办理人名称
|
||||||
|
*/
|
||||||
|
String TASK_ID_TO_ASSIGNEE = "task_id_to_assignee";
|
||||||
|
|
||||||
|
}
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||||||
import org.dromara.common.translation.annotation.Translation;
|
import org.dromara.common.translation.annotation.Translation;
|
||||||
import org.dromara.common.translation.constant.TransConstant;
|
import org.dromara.common.translation.constant.TransConstant;
|
||||||
import org.dromara.warm.flow.core.entity.User;
|
import org.dromara.warm.flow.core.entity.User;
|
||||||
|
import org.dromara.workflow.constant.WfConstant;
|
||||||
|
|
||||||
import java.io.Serial;
|
import java.io.Serial;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@ -123,7 +124,7 @@ public class FlowTaskVo implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 办理人名称
|
* 办理人名称
|
||||||
*/
|
*/
|
||||||
@Translation(type = TransConstant.TASK_ID_TO_ASSIGNEE, mapper = "id")
|
@Translation(type = WfConstant.TASK_ID_TO_ASSIGNEE, mapper = "id")
|
||||||
private String transactorNames;
|
private String transactorNames;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,30 +0,0 @@
|
|||||||
package org.dromara.workflow.service;
|
|
||||||
|
|
||||||
import org.dromara.common.core.domain.dto.UserDTO;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通用 办理人服务
|
|
||||||
*
|
|
||||||
* @author AprilWind
|
|
||||||
*/
|
|
||||||
public interface AssigneeService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过taskId查询对应的任务办理人
|
|
||||||
*
|
|
||||||
* @param taskIds taskId串逗号分隔
|
|
||||||
* @return 任务办理人名称串逗号分隔
|
|
||||||
*/
|
|
||||||
String selectAssigneeByIds(String taskIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 通过taskId查询对应的任务办理人列表
|
|
||||||
*
|
|
||||||
* @param taskIdList 任务id
|
|
||||||
* @return 列表
|
|
||||||
*/
|
|
||||||
List<UserDTO> selectByIds(List<Long> taskIdList);
|
|
||||||
|
|
||||||
}
|
|
@ -3,7 +3,6 @@ package org.dromara.workflow.service;
|
|||||||
import org.dromara.common.core.domain.dto.UserDTO;
|
import org.dromara.common.core.domain.dto.UserDTO;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.warm.flow.core.entity.HisTask;
|
|
||||||
import org.dromara.warm.flow.orm.entity.FlowHisTask;
|
import org.dromara.warm.flow.orm.entity.FlowHisTask;
|
||||||
import org.dromara.warm.flow.orm.entity.FlowTask;
|
import org.dromara.warm.flow.orm.entity.FlowTask;
|
||||||
import org.dromara.workflow.domain.bo.*;
|
import org.dromara.workflow.domain.bo.*;
|
||||||
@ -115,6 +114,22 @@ public interface IFlwTaskService {
|
|||||||
*/
|
*/
|
||||||
boolean terminationTask(FlowTerminationBo bo);
|
boolean terminationTask(FlowTerminationBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过taskId查询对应的任务办理人
|
||||||
|
*
|
||||||
|
* @param taskIds taskId串逗号分隔
|
||||||
|
* @return 任务办理人名称串逗号分隔
|
||||||
|
*/
|
||||||
|
String selectAssigneeNamesByIds(String taskIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过taskId查询对应的任务办理人列表
|
||||||
|
*
|
||||||
|
* @param taskIdList 任务id
|
||||||
|
* @return 列表
|
||||||
|
*/
|
||||||
|
List<UserDTO> selectAssigneeByIds(List<Long> taskIdList);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 按照任务id查询任务
|
* 按照任务id查询任务
|
||||||
*
|
*
|
||||||
|
@ -2,6 +2,7 @@ package org.dromara.workflow.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.convert.Convert;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
|
||||||
@ -12,7 +13,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.dromara.common.core.domain.dto.UserDTO;
|
import org.dromara.common.core.domain.dto.UserDTO;
|
||||||
import org.dromara.common.core.enums.BusinessStatusEnum;
|
import org.dromara.common.core.enums.BusinessStatusEnum;
|
||||||
import org.dromara.common.core.exception.ServiceException;
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.workflow.service.AssigneeService;
|
|
||||||
import org.dromara.common.core.utils.SpringUtils;
|
import org.dromara.common.core.utils.SpringUtils;
|
||||||
import org.dromara.common.core.utils.StreamUtils;
|
import org.dromara.common.core.utils.StreamUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
@ -61,7 +61,7 @@ import static org.dromara.workflow.common.constant.FlowConstant.*;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
|
public class FlwTaskServiceImpl implements IFlwTaskService {
|
||||||
|
|
||||||
private final TaskService taskService;
|
private final TaskService taskService;
|
||||||
private final InsService insService;
|
private final InsService insService;
|
||||||
@ -417,16 +417,16 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
|
|||||||
* @return 任务办理人名称串逗号分隔
|
* @return 任务办理人名称串逗号分隔
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String selectAssigneeByIds(String taskIds) {
|
public String selectAssigneeNamesByIds(String taskIds) {
|
||||||
if (StringUtils.isBlank(taskIds)) {
|
if (StringUtils.isBlank(taskIds)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
List<User> userList = userService.getByAssociateds(List.of(Long.valueOf(taskIds))
|
List<Long> taskIdList = StringUtils.splitTo(taskIds, Convert::toLong);
|
||||||
, UserType.APPROVAL.getKey(), UserType.TRANSFER.getKey(), UserType.DEPUTE.getKey());
|
List<UserDTO> list = this.selectAssigneeByIds(taskIdList);
|
||||||
// 获取处理用户的昵称并将其合并为一个字符串
|
if (CollUtil.isEmpty(list)) {
|
||||||
return WorkflowUtils.getHandlerUser(userList).stream()
|
return StringUtils.EMPTY;
|
||||||
.map(UserDTO::getNickName)
|
}
|
||||||
.collect(Collectors.joining(","));
|
return StreamUtils.join(list, UserDTO::getNickName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -436,7 +436,7 @@ public class FlwTaskServiceImpl implements IFlwTaskService, AssigneeService {
|
|||||||
* @return 列表
|
* @return 列表
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<UserDTO> selectByIds(List<Long> taskIdList) {
|
public List<UserDTO> selectAssigneeByIds(List<Long> taskIdList) {
|
||||||
if (CollUtil.isEmpty(taskIdList)) {
|
if (CollUtil.isEmpty(taskIdList)) {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,9 @@ package org.dromara.workflow.service.impl;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.dromara.common.translation.annotation.TranslationType;
|
import org.dromara.common.translation.annotation.TranslationType;
|
||||||
import org.dromara.common.translation.constant.TransConstant;
|
|
||||||
import org.dromara.common.translation.core.TranslationInterface;
|
import org.dromara.common.translation.core.TranslationInterface;
|
||||||
import org.dromara.workflow.service.AssigneeService;
|
import org.dromara.workflow.constant.WfConstant;
|
||||||
|
import org.dromara.workflow.service.IFlwTaskService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,17 +16,17 @@ import org.springframework.stereotype.Service;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Service
|
@Service
|
||||||
@TranslationType(type = TransConstant.TASK_ID_TO_ASSIGNEE)
|
@TranslationType(type = WfConstant.TASK_ID_TO_ASSIGNEE)
|
||||||
public class TaskAssigneeTranslationImpl implements TranslationInterface<String> {
|
public class TaskAssigneeTranslationImpl implements TranslationInterface<String> {
|
||||||
|
|
||||||
private final AssigneeService assigneeService;
|
private final IFlwTaskService flwTaskService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String translation(Object key, String other) {
|
public String translation(Object key, String other) {
|
||||||
if (key instanceof Long id) {
|
if (key instanceof Long id) {
|
||||||
return assigneeService.selectAssigneeByIds(id.toString());
|
return flwTaskService.selectAssigneeNamesByIds(id.toString());
|
||||||
} else if (key instanceof String id) {
|
} else if (key instanceof String id) {
|
||||||
return assigneeService.selectAssigneeByIds(id);
|
return flwTaskService.selectAssigneeNamesByIds(id);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user