mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 调整用户id翻译,优化审批记录待审批候选人显示问题
This commit is contained in:
		@@ -19,10 +19,18 @@ public interface UserService {
 | 
			
		||||
     * 通过用户ID查询用户账户
 | 
			
		||||
     *
 | 
			
		||||
     * @param userId 用户ID
 | 
			
		||||
     * @return 用户账户
 | 
			
		||||
     * @return 用户名称
 | 
			
		||||
     */
 | 
			
		||||
    String selectNicknameById(Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户ID查询用户账户
 | 
			
		||||
     *
 | 
			
		||||
     * @param userIds 用户ID 多个用逗号隔开
 | 
			
		||||
     * @return 用户名称
 | 
			
		||||
     */
 | 
			
		||||
    String selectNicknameByIds(String userIds);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户ID查询用户手机号
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -20,7 +20,9 @@ public class NicknameTranslationImpl implements TranslationInterface<String> {
 | 
			
		||||
    @Override
 | 
			
		||||
    public String translation(Object key, String other) {
 | 
			
		||||
        if (key instanceof Long id) {
 | 
			
		||||
            return userService.selectNicknameById(id);
 | 
			
		||||
            return userService.selectNicknameByIds(id.toString());
 | 
			
		||||
        } else if (key instanceof String ids) {
 | 
			
		||||
            return userService.selectNicknameByIds(ids);
 | 
			
		||||
        }
 | 
			
		||||
        return null;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,7 @@
 | 
			
		||||
package org.dromara.system.service.impl;
 | 
			
		||||
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
import cn.hutool.core.convert.Convert;
 | 
			
		||||
import cn.hutool.core.util.ArrayUtil;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
 | 
			
		||||
@@ -16,6 +17,7 @@ import org.dromara.common.core.constant.UserConstants;
 | 
			
		||||
import org.dromara.common.core.exception.ServiceException;
 | 
			
		||||
import org.dromara.common.core.service.UserService;
 | 
			
		||||
import org.dromara.common.core.utils.MapstructUtils;
 | 
			
		||||
import org.dromara.common.core.utils.SpringUtils;
 | 
			
		||||
import org.dromara.common.core.utils.StreamUtils;
 | 
			
		||||
import org.dromara.common.core.utils.StringUtils;
 | 
			
		||||
import org.dromara.common.mybatis.core.page.PageQuery;
 | 
			
		||||
@@ -27,16 +29,14 @@ import org.dromara.system.domain.SysUser;
 | 
			
		||||
import org.dromara.system.domain.SysUserPost;
 | 
			
		||||
import org.dromara.system.domain.SysUserRole;
 | 
			
		||||
import org.dromara.system.domain.bo.SysUserBo;
 | 
			
		||||
import org.dromara.system.domain.vo.SysPostVo;
 | 
			
		||||
import org.dromara.system.domain.vo.SysRoleVo;
 | 
			
		||||
import org.dromara.system.domain.vo.SysUserExportVo;
 | 
			
		||||
import org.dromara.system.domain.vo.SysUserVo;
 | 
			
		||||
import org.dromara.system.domain.vo.*;
 | 
			
		||||
import org.dromara.system.mapper.*;
 | 
			
		||||
import org.dromara.system.service.ISysUserService;
 | 
			
		||||
import org.springframework.cache.annotation.Cacheable;
 | 
			
		||||
import org.springframework.stereotype.Service;
 | 
			
		||||
import org.springframework.transaction.annotation.Transactional;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.List;
 | 
			
		||||
import java.util.Map;
 | 
			
		||||
 | 
			
		||||
@@ -579,6 +579,24 @@ public class SysUserServiceImpl implements ISysUserService, UserService {
 | 
			
		||||
        return ObjectUtil.isNull(sysUser) ? null : sysUser.getNickName();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户ID查询用户账户
 | 
			
		||||
     *
 | 
			
		||||
     * @param userIds 用户ID 多个用逗号隔开
 | 
			
		||||
     * @return 用户账户
 | 
			
		||||
     */
 | 
			
		||||
    @Override
 | 
			
		||||
    public String selectNicknameByIds(String userIds) {
 | 
			
		||||
        List<String> list = new ArrayList<>();
 | 
			
		||||
        for (Long id : StringUtils.splitTo(userIds, Convert::toLong)) {
 | 
			
		||||
            String nickname = SpringUtils.getAopProxy(this).selectNicknameById(id);
 | 
			
		||||
            if (StringUtils.isNotBlank(nickname)) {
 | 
			
		||||
                list.add(nickname);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return String.join(StringUtils.SEPARATOR, list);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 通过用户ID查询用户手机号
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ public class ActHistoryInfoVo implements Serializable {
 | 
			
		||||
    /**
 | 
			
		||||
     * 办理人id
 | 
			
		||||
     */
 | 
			
		||||
    private Long assignee;
 | 
			
		||||
    private String assignee;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 办理人名称
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,7 @@ package org.dromara.workflow.service.impl;
 | 
			
		||||
import cn.hutool.core.bean.BeanUtil;
 | 
			
		||||
import cn.hutool.core.codec.Base64;
 | 
			
		||||
import cn.hutool.core.collection.CollUtil;
 | 
			
		||||
import cn.hutool.core.convert.Convert;
 | 
			
		||||
import cn.hutool.core.io.IoUtil;
 | 
			
		||||
import cn.hutool.core.util.ObjectUtil;
 | 
			
		||||
import lombok.RequiredArgsConstructor;
 | 
			
		||||
@@ -300,7 +301,6 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
 | 
			
		||||
        for (HistoricTaskInstance historicTaskInstance : list) {
 | 
			
		||||
            ActHistoryInfoVo actHistoryInfoVo = new ActHistoryInfoVo();
 | 
			
		||||
            BeanUtils.copyProperties(historicTaskInstance, actHistoryInfoVo);
 | 
			
		||||
            actHistoryInfoVo.setAssignee(StringUtils.isNotBlank(historicTaskInstance.getAssignee()) ? Long.valueOf(historicTaskInstance.getAssignee()) : null);
 | 
			
		||||
            actHistoryInfoVo.setStatus(actHistoryInfoVo.getEndTime() == null ? "待处理" : "已处理");
 | 
			
		||||
            if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) {
 | 
			
		||||
                actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis()));
 | 
			
		||||
@@ -318,6 +318,12 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
 | 
			
		||||
                    historyInfoVo.setStartTime(e.getStartTime());
 | 
			
		||||
                    historyInfoVo.setEndTime(null);
 | 
			
		||||
                    historyInfoVo.setRunDuration(null);
 | 
			
		||||
                    if (ObjectUtil.isEmpty(e.getAssignee())) {
 | 
			
		||||
                        ParticipantVo participantVo = WorkflowUtils.getCurrentTaskParticipant(e.getId());
 | 
			
		||||
                        if (ObjectUtil.isNotEmpty(participantVo) && CollUtil.isNotEmpty(participantVo.getCandidate())) {
 | 
			
		||||
                            historyInfoVo.setAssignee(StreamUtils.join(participantVo.getCandidate(), Convert::toStr));
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
            historyInfoVoList.add(historyInfoVo);
 | 
			
		||||
        }
 | 
			
		||||
@@ -356,11 +362,6 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
 | 
			
		||||
            if (ObjectUtil.isNotEmpty(historicTaskInstance.getDurationInMillis())) {
 | 
			
		||||
                actHistoryInfoVo.setRunDuration(getDuration(historicTaskInstance.getDurationInMillis()));
 | 
			
		||||
            }
 | 
			
		||||
            try {
 | 
			
		||||
                actHistoryInfoVo.setAssignee(StringUtils.isNotBlank(historicTaskInstance.getAssignee()) ? Long.valueOf(historicTaskInstance.getAssignee()) : null);
 | 
			
		||||
            } catch (NumberFormatException ignored) {
 | 
			
		||||
                log.warn("当前任务【{}】,办理人转换人员ID【{}】异常!", historicTaskInstance.getName(), historicTaskInstance.getAssignee());
 | 
			
		||||
            }
 | 
			
		||||
            //附件
 | 
			
		||||
            if (CollUtil.isNotEmpty(attachmentList)) {
 | 
			
		||||
                List<Attachment> attachments = attachmentList.stream().filter(e -> e.getTaskId().equals(historicTaskInstance.getId())).collect(Collectors.toList());
 | 
			
		||||
@@ -368,6 +369,13 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
 | 
			
		||||
                    actHistoryInfoVo.setAttachmentList(attachments);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            //设置人员id
 | 
			
		||||
            if (ObjectUtil.isEmpty(historicTaskInstance.getAssignee())) {
 | 
			
		||||
                ParticipantVo participantVo = WorkflowUtils.getCurrentTaskParticipant(historicTaskInstance.getId());
 | 
			
		||||
                if (ObjectUtil.isNotEmpty(participantVo) && CollUtil.isNotEmpty(participantVo.getCandidate())) {
 | 
			
		||||
                    actHistoryInfoVo.setAssignee(StreamUtils.join(participantVo.getCandidate(), Convert::toStr));
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            actHistoryInfoVoList.add(actHistoryInfoVo);
 | 
			
		||||
        }
 | 
			
		||||
        List<ActHistoryInfoVo> collect = new ArrayList<>();
 | 
			
		||||
@@ -383,10 +391,6 @@ public class ActProcessInstanceServiceImpl implements IActProcessInstanceService
 | 
			
		||||
        Map<String, List<ActHistoryInfoVo>> groupByKey = StreamUtils.groupByKey(actHistoryInfoVoList, ActHistoryInfoVo::getTaskDefinitionKey);
 | 
			
		||||
        for (Map.Entry<String, List<ActHistoryInfoVo>> entry : groupByKey.entrySet()) {
 | 
			
		||||
            ActHistoryInfoVo actHistoryInfoVo = BeanUtil.toBean(entry.getValue().get(0), ActHistoryInfoVo.class);
 | 
			
		||||
            String nickName = entry.getValue().stream().filter(e -> StringUtils.isNotBlank(e.getNickName()) && e.getEndTime() == null).map(ActHistoryInfoVo::getNickName).toList().stream().distinct().collect(Collectors.joining(StringUtils.SEPARATOR));
 | 
			
		||||
            if (StringUtils.isNotBlank(nickName)) {
 | 
			
		||||
                actHistoryInfoVo.setNickName(nickName);
 | 
			
		||||
            }
 | 
			
		||||
            actHistoryInfoVoList.stream().filter(e -> e.getTaskDefinitionKey().equals(entry.getKey()) && e.getEndTime() != null).findFirst()
 | 
			
		||||
                .ifPresent(e -> {
 | 
			
		||||
                    actHistoryInfoVo.setStatus("已处理");
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user