实现根据输入的jsonData,deptId,以及roleId查询uesrNameList
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
package org.jeecg.modules.system.constant;
|
||||
|
||||
/**
|
||||
* 用户密级常量
|
||||
*/
|
||||
public final class UserSecretLevel {
|
||||
|
||||
private UserSecretLevel() {
|
||||
}
|
||||
|
||||
/**
|
||||
* 非密
|
||||
*/
|
||||
public static final Integer SECRET_LEVEL_NONE = 3;
|
||||
|
||||
/**
|
||||
* 一般
|
||||
*/
|
||||
public static final Integer SECRET_LEVEL_NORMAL = 4;
|
||||
|
||||
/**
|
||||
* 重要
|
||||
*/
|
||||
public static final Integer SECRET_LEVEL_IMPORTANT = 5;
|
||||
}
|
||||
+39
@@ -50,6 +50,7 @@ import org.jeecg.modules.message.handle.impl.QywxSendMsgHandle;
|
||||
import org.jeecg.modules.message.handle.impl.SystemSendMsgHandle;
|
||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||
import org.jeecg.modules.message.websocket.WebSocket;
|
||||
import org.jeecg.modules.system.constant.UserSecretLevel;
|
||||
import org.jeecg.modules.system.entity.*;
|
||||
import org.jeecg.modules.system.mapper.*;
|
||||
import org.jeecg.modules.system.service.*;
|
||||
@@ -2099,4 +2100,42 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
||||
return "";
|
||||
}
|
||||
|
||||
public List<String> getUsersListByJsonLocalAPI(Object jsonData, String deptKeyName, String roleId) {
|
||||
if (jsonData == null || StringUtils.isEmpty(deptKeyName) || StringUtils.isEmpty(roleId)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 统一转成 JSONObject(一步到位,不用来回转字符串)
|
||||
JSONObject json;
|
||||
if (jsonData instanceof String) {
|
||||
json = JSON.parseObject((String) jsonData);
|
||||
} else if (jsonData instanceof JSONObject) {
|
||||
json = (JSONObject) jsonData;
|
||||
} else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 关键参数无效 → 直接返回空
|
||||
if (json == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
|
||||
String deptId = json.getString(deptKeyName);
|
||||
if (StringUtils.isEmpty(deptId)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<SysUser> sysUserList = sysUserService.queryUserByDeptAndROle(
|
||||
deptId,
|
||||
roleId,
|
||||
UserSecretLevel.SECRET_LEVEL_NONE
|
||||
);
|
||||
|
||||
return Optional.ofNullable(sysUserList)
|
||||
.orElse(Collections.emptyList())
|
||||
.stream()
|
||||
.map(SysUser::getUsername)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user