获取角色

This commit is contained in:
huangzj
2023-06-27 15:04:40 +08:00
parent cabede01e6
commit 916b68d307
3 changed files with 15 additions and 1 deletions

View File

@@ -11,6 +11,8 @@ public interface LogInfo {
String UNKNOWN_USER = "unknown user";
String UNKNOWN_ROLE = "unknown role";
String UNKNOWN_IP = "unknown IP";
String UNKNOWN_CLIENT = "unknown client";

View File

@@ -217,6 +217,18 @@ public class RequestUtil {
}
return userIndex;
}
/**
* HttpServletRequest获取在网关中存储的用户角色
*/
public static String getUserRole() {
String userIndex = LogInfo.UNKNOWN_ROLE;
JSONObject jwtPayload = getJwtPayload();
if (Objects.nonNull(jwtPayload)) {
userIndex = jwtPayload.getString(SecurityConstants.JWT_AUTHORITIES_KEY);
}
return userIndex;
}
/**
* HttpServletRequest获取在网关中存储的部门索引

View File

@@ -82,7 +82,7 @@ public class CommonServiceImpl implements CommonService {
.or("line_id",lineIds)
.eq("phasic_type",phasic)
.between("time", startTime, endTime)
.eq("value_type",dataType).groupBy("line_id");
.eq("value_type",dataType);
return commonMapper.getDeviceRtDataByTime(influxQueryWrapper);
}