“培训审批修改v1.2”
This commit is contained in:
1 parent
2e4d35b41e
commit
53e5afaafe
3 files changed
+180
-46
No files matched your search
+77
-1
@@ -19,7 +19,6 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
@@ -28,6 +27,10 @@ import org.dromara.system.domain.vo.SysUserVo;
|
||||
import org.dromara.system.service.ISysUserService;
|
||||
import org.dromara.common.core.utils.StringUtils;
|
||||
import org.dromara.common.satoken.utils.LoginHelper;
|
||||
import org.dromara.rs.domain.vo.SysUserBasicVo;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* 培训申请控制器
|
||||
@@ -439,4 +442,77 @@ public class RsTrainingApplicationController extends BaseController {
|
||||
return R.fail("查询失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量查询同行人基本信息
|
||||
* 用于培训申请/记录详情展示,不限制account_type
|
||||
*
|
||||
* 权限说明:
|
||||
* - 只需要培训申请的查询权限即可
|
||||
* - 不需要system:teacher:list权限
|
||||
* - 只返回用户的基本信息(姓名、部门等),不暴露敏感数据
|
||||
*
|
||||
* @param userIds 用户ID列表(逗号分隔)
|
||||
* @return 用户基本信息列表
|
||||
*/
|
||||
@SaCheckPermission("rs:trainingapplication:query")
|
||||
@GetMapping("/companions/batch")
|
||||
public R<List<SysUserBasicVo>> batchQueryCompanions(@RequestParam String userIds) {
|
||||
log.info("批量查询同行人信息,用户ID列表: {}", userIds);
|
||||
|
||||
// 参数验证
|
||||
if (StringUtils.isBlank(userIds)) {
|
||||
log.warn("同行人ID列表为空");
|
||||
return R.ok(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 解析用户ID列表
|
||||
List<Long> userIdList = new ArrayList<>();
|
||||
try {
|
||||
String[] idArray = userIds.split(",");
|
||||
for (String idStr : idArray) {
|
||||
if (StringUtils.isNotBlank(idStr)) {
|
||||
userIdList.add(Long.parseLong(idStr.trim()));
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
log.error("解析用户ID失败: {}", e.getMessage());
|
||||
return R.fail("用户ID格式错误");
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(userIdList)) {
|
||||
log.warn("解析后的用户ID列表为空");
|
||||
return R.ok(new ArrayList<>());
|
||||
}
|
||||
|
||||
// 批量查询用户信息
|
||||
List<SysUserBasicVo> userList = new ArrayList<>();
|
||||
for (Long userId : userIdList) {
|
||||
try {
|
||||
// 调用用户服务查询
|
||||
SysUserVo sysUser = sysUserService.selectUserById(userId);
|
||||
if (sysUser != null) {
|
||||
SysUserBasicVo vo = new SysUserBasicVo();
|
||||
vo.setUserId(sysUser.getUserId());
|
||||
vo.setUserName(sysUser.getUserName());
|
||||
vo.setNickName(sysUser.getNickName());
|
||||
vo.setAccountType(sysUser.getAccountType());
|
||||
vo.setStatus(sysUser.getStatus());
|
||||
vo.setDeptId(sysUser.getDeptId());
|
||||
// 设置部门名称(SysUserVo已经包含deptName字段)
|
||||
vo.setDeptName(sysUser.getDeptName());
|
||||
userList.add(vo);
|
||||
log.debug("查询到用户: userId={}, nickName={}", userId, sysUser.getNickName());
|
||||
} else {
|
||||
log.warn("用户不存在: userId={}", userId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("查询用户{}失败: {}", userId, e.getMessage());
|
||||
// 继续查询下一个用户,不中断整个流程
|
||||
}
|
||||
}
|
||||
|
||||
log.info("批量查询同行人完成,请求{}个,查询到{}个", userIdList.size(), userList.size());
|
||||
return R.ok(userList);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user