fix:userinfo返回角色编码

This commit is contained in:
2026-02-03 20:34:12 +08:00
parent 28fddc4332
commit 4a2f995584
3 changed files with 48 additions and 39 deletions

View File

@@ -8,11 +8,11 @@ import com.honeycombis.honeycom.msg.api.constant.MessageArgsEnum;
import com.honeycombis.honeycom.msg.api.dto.MessageParameterDTO; import com.honeycombis.honeycom.msg.api.dto.MessageParameterDTO;
import com.honeycombis.honeycom.msg.api.vo.MessageArgsVo; import com.honeycombis.honeycom.msg.api.vo.MessageArgsVo;
import com.honeycombis.honeycom.msg.service.MessageArgsService; import com.honeycombis.honeycom.msg.service.MessageArgsService;
import com.honeycombis.honeycom.pm.entity.PmMilestoneEntity; //import com.honeycombis.honeycom.pm.entity.PmMilestoneEntity;
import com.honeycombis.honeycom.pm.entity.PmProjectEntity; //import com.honeycombis.honeycom.pm.entity.PmProjectEntity;
import com.honeycombis.honeycom.pm.entity.PmTaskEntity; //import com.honeycombis.honeycom.pm.entity.PmTaskEntity;
import com.honeycombis.honeycom.pm.feign.HoneycomPmTaskServiceFeign; //import com.honeycombis.honeycom.pm.feign.HoneycomPmTaskServiceFeign;
import com.honeycombis.honeycom.pm.vo.PmTaskToMsgVo; //import com.honeycombis.honeycom.pm.vo.PmTaskToMsgVo;
import com.honeycombis.honeycom.tenant.entity.SysDeptEntity; import com.honeycombis.honeycom.tenant.entity.SysDeptEntity;
import com.honeycombis.honeycom.tenant.feign.HoneycomTenantServiceFeign; import com.honeycombis.honeycom.tenant.feign.HoneycomTenantServiceFeign;
import com.honeycombis.honeycom.tenant.vo.SysStaffDetailVO; import com.honeycombis.honeycom.tenant.vo.SysStaffDetailVO;
@@ -33,7 +33,7 @@ import java.util.Objects;
@RequiredArgsConstructor @RequiredArgsConstructor
public class MessageArgsServiceImpl implements MessageArgsService { public class MessageArgsServiceImpl implements MessageArgsService {
private final HoneycomPmTaskServiceFeign honeycomPmTaskServiceFeign; // private final HoneycomPmTaskServiceFeign honeycomPmTaskServiceFeign;
private final HoneycomTenantServiceFeign honeycomTenantServiceFeign; private final HoneycomTenantServiceFeign honeycomTenantServiceFeign;
private final HoneycomUserServiceFeign honeycomUserServiceFeign; private final HoneycomUserServiceFeign honeycomUserServiceFeign;
@@ -70,39 +70,39 @@ public class MessageArgsServiceImpl implements MessageArgsService {
*/ */
@Override @Override
public String getValue4Args(String businessArgsJson, Long tenantId, MessageArgsEnum args, Long userId) { public String getValue4Args(String businessArgsJson, Long tenantId, MessageArgsEnum args, Long userId) {
if (StringUtils.isBlank(businessArgsJson)) { // if (StringUtils.isBlank(businessArgsJson)) {
// json值为空则返回空串 // // json值为空则返回空串
return ""; // return "";
} // }
JSONObject jsonObject = JSONObject.parseObject(businessArgsJson); // JSONObject jsonObject = JSONObject.parseObject(businessArgsJson);
String argsValue = jsonObject.getString(args.getBusinessArgName()); // String argsValue = jsonObject.getString(args.getBusinessArgName());
if (StrUtil.isBlank(argsValue)) { // if (StrUtil.isBlank(argsValue)) {
// 获取的属性值为空返回空串 // // 获取的属性值为空返回空串
return ""; // return "";
} // }
if (args.getDataSource() == 0) { // if (args.getDataSource() == 0) {
// 根据项目ID获取项目信息 // // 根据项目ID获取项目信息
R<PmProjectEntity> result = honeycomPmTaskServiceFeign.getMsgProjectArgs(Long.valueOf(argsValue), SecurityConstants.FROM_IN); // R<PmProjectEntity> result = honeycomPmTaskServiceFeign.getMsgProjectArgs(Long.valueOf(argsValue), SecurityConstants.FROM_IN);
return getObjectValue(result, args.getApiFieldName()); // return getObjectValue(result, args.getApiFieldName());
} else if (args.getDataSource() == 1) { // } else if (args.getDataSource() == 1) {
// 根据任务ID获取任务信息 // // 根据任务ID获取任务信息
R<PmTaskToMsgVo> result = honeycomPmTaskServiceFeign.getMsgTaskArgs(Long.valueOf(argsValue), SecurityConstants.FROM_IN); // R<PmTaskToMsgVo> result = honeycomPmTaskServiceFeign.getMsgTaskArgs(Long.valueOf(argsValue), SecurityConstants.FROM_IN);
return getObjectValue(result, args.getApiFieldName()); // return getObjectValue(result, args.getApiFieldName());
} else if (args.getDataSource() == 2) { // } else if (args.getDataSource() == 2) {
// 根据里程碑ID获取里程碑信息 // // 根据里程碑ID获取里程碑信息
R<PmMilestoneEntity> result = honeycomPmTaskServiceFeign.getMsgMilestoneArgs(Long.valueOf(argsValue), SecurityConstants.FROM_IN); // R<PmMilestoneEntity> result = honeycomPmTaskServiceFeign.getMsgMilestoneArgs(Long.valueOf(argsValue), SecurityConstants.FROM_IN);
return getObjectValue(result, args.getApiFieldName()); // return getObjectValue(result, args.getApiFieldName());
} else if (args.getDataSource() == 3) { // } else if (args.getDataSource() == 3) {
// 根据租户ID获取租户信息 // // 根据租户ID获取租户信息
R<TenantViewVO> result = honeycomTenantServiceFeign.getTenantView(tenantId, SecurityConstants.FROM_IN); // R<TenantViewVO> result = honeycomTenantServiceFeign.getTenantView(tenantId, SecurityConstants.FROM_IN);
return getObjectValue(result, args.getApiFieldName()); // return getObjectValue(result, args.getApiFieldName());
} else if (args.getDataSource() == 4) { // } else if (args.getDataSource() == 4) {
R<SysStaffDetailVO> result = honeycomTenantServiceFeign.getById(Long.valueOf(argsValue), SecurityConstants.FROM_IN); // R<SysStaffDetailVO> result = honeycomTenantServiceFeign.getById(Long.valueOf(argsValue), SecurityConstants.FROM_IN);
return getObjectValue(result, args.getApiFieldName()); // return getObjectValue(result, args.getApiFieldName());
} else if (args.getDataSource() == 5) { // } else if (args.getDataSource() == 5) {
R<SysDeptEntity> result = honeycomTenantServiceFeign.getDeptById(Long.valueOf(argsValue), SecurityConstants.FROM_IN); // R<SysDeptEntity> result = honeycomTenantServiceFeign.getDeptById(Long.valueOf(argsValue), SecurityConstants.FROM_IN);
return getObjectValue(result, args.getApiFieldName()); // return getObjectValue(result, args.getApiFieldName());
} // }
return ""; return "";
} }

View File

@@ -32,4 +32,10 @@ public class SysUserInfoVO implements Serializable {
@Schema(description = "角色标识集合") @Schema(description = "角色标识集合")
private List<Long> roles = new ArrayList<>(); private List<Long> roles = new ArrayList<>();
/**
* 角色编码集合
*/
@Schema(description = "角色编码集合")
private List<String> roleCodes = new ArrayList<>();
} }

View File

@@ -829,6 +829,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUserEntity
List<Long> roleIds = sysRoleList.stream().map(SysRoleVO::getRoleId).collect(Collectors.toList()); List<Long> roleIds = sysRoleList.stream().map(SysRoleVO::getRoleId).collect(Collectors.toList());
result.setRoles(roleIds); result.setRoles(roleIds);
List<String> roleCodes = sysRoleList.stream().map(SysRoleVO::getRoleCode).collect(Collectors.toList());
result.setRoleCodes(roleCodes);
// 获取功能编码相关 // 获取功能编码相关
R<List<String>> functionCodeReturn = honeycomTenantServiceFeign.findFunctionCodesByRoleId(userInfo.getUserId(), String.valueOf(loginDefaultStaff.getTenantId()), SecurityConstants.FROM_IN); R<List<String>> functionCodeReturn = honeycomTenantServiceFeign.findFunctionCodesByRoleId(userInfo.getUserId(), String.valueOf(loginDefaultStaff.getTenantId()), SecurityConstants.FROM_IN);
if (Objects.isNull(functionCodeReturn) || !functionCodeReturn.isOk()) { if (Objects.isNull(functionCodeReturn) || !functionCodeReturn.isOk()) {