!12 实现根据输入的jsonData,deptId,以及roleId查询uesrNameList
Merge pull request !12 from new_new_new/feature/query-list-by-deptId-roleId
This commit is contained in:
@@ -98,6 +98,15 @@
|
|||||||
<artifactId>flowable-json-converter</artifactId>
|
<artifactId>flowable-json-converter</artifactId>
|
||||||
<version>${flowable.version}</version>
|
<version>${flowable.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.jeecgframework.boot</groupId>
|
||||||
|
<artifactId>jeecg-system-local-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.flowable</groupId>
|
||||||
|
<artifactId>flowable-json-converter</artifactId>
|
||||||
|
<version>${flowable.version}</version>
|
||||||
|
</dependency>
|
||||||
<!-- flowable6.4以上添加这个依赖,用于解决流程图预览,发布报错问题-->
|
<!-- flowable6.4以上添加这个依赖,用于解决流程图预览,发布报错问题-->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>xerces</groupId>
|
<groupId>xerces</groupId>
|
||||||
|
|||||||
+29
-5
@@ -1,6 +1,8 @@
|
|||||||
package org.jeecg.modules.extbpm.process.common.expression;
|
package org.jeecg.modules.extbpm.process.common.expression;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.jeecg.common.constant.SymbolConstant;
|
import org.jeecg.common.constant.SymbolConstant;
|
||||||
@@ -10,19 +12,25 @@ import org.springframework.context.annotation.Lazy;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.List;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.Set;
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service("flowNodeExpression")
|
@Service("flowNodeExpression")
|
||||||
|
@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
||||||
public class FlowNodeExpression {
|
public class FlowNodeExpression {
|
||||||
@Lazy
|
// 自动注入
|
||||||
@Autowired
|
private final ISysBaseAPI ISysBaseAPI;
|
||||||
private ISysBaseAPI sysbase;
|
|
||||||
|
// 自动注入 + 自动延迟加载(解决循环依赖)
|
||||||
|
private final @Lazy ISysBaseAPI sysbase;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找当前部门负责人
|
* 查找当前部门负责人
|
||||||
* ${flowNodeExpression.getDepartLeaders(applyUserId)}
|
* ${flowNodeExpression.getDepartLeaders(applyUserId)}
|
||||||
|
*
|
||||||
* @param applyUserId
|
* @param applyUserId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -38,6 +46,7 @@ public class FlowNodeExpression {
|
|||||||
/**
|
/**
|
||||||
* 根据字段名称取json_data查询对应业务表单的数据
|
* 根据字段名称取json_data查询对应业务表单的数据
|
||||||
* ${flowNodeExpression.getJsondatastring(jsonData,'supDeptleaderid')}
|
* ${flowNodeExpression.getJsondatastring(jsonData,'supDeptleaderid')}
|
||||||
|
*
|
||||||
* @param jsonData
|
* @param jsonData
|
||||||
* @param codeName
|
* @param codeName
|
||||||
* @return
|
* @return
|
||||||
@@ -66,9 +75,22 @@ public class FlowNodeExpression {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据字段名称取json_data查询对应业务表单的数据
|
||||||
|
* ${flowNodeExpression.getJsondatastring(jsonData,'supDeptleaderid')}
|
||||||
|
*
|
||||||
|
* @param jsonData
|
||||||
|
* @param deptKeyName
|
||||||
|
* @return roleId
|
||||||
|
*/
|
||||||
|
public List<String> getUsersListByJson(Object jsonData, String deptKeyName, String roleId) {
|
||||||
|
return ISysBaseAPI.getUsersListByJsonLocalAPI(jsonData,deptKeyName,roleId);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查找上一级部门负责人
|
* 查找上一级部门负责人
|
||||||
* ${flowNodeExpression.getLevel1DepartLeaders(applyUserId)}
|
* ${flowNodeExpression.getLevel1DepartLeaders(applyUserId)}
|
||||||
|
*
|
||||||
* @param applyUserId
|
* @param applyUserId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -85,6 +107,7 @@ public class FlowNodeExpression {
|
|||||||
/**
|
/**
|
||||||
* 查找上二级部门负责人
|
* 查找上二级部门负责人
|
||||||
* ${flowNodeExpression.getLevel2DepartLeaders(applyUserId)}
|
* ${flowNodeExpression.getLevel2DepartLeaders(applyUserId)}
|
||||||
|
*
|
||||||
* @param applyUserId
|
* @param applyUserId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -111,6 +134,7 @@ public class FlowNodeExpression {
|
|||||||
/**
|
/**
|
||||||
* 查找上三级部门负责人
|
* 查找上三级部门负责人
|
||||||
* ${flowNodeExpression.getLevel3DepartLeaders(applyUserId)}
|
* ${flowNodeExpression.getLevel3DepartLeaders(applyUserId)}
|
||||||
|
*
|
||||||
* @param applyUserId
|
* @param applyUserId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|||||||
+27
@@ -2,6 +2,7 @@ package org.jeecg.modules.extbpm.process.controller;
|
|||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
@@ -10,9 +11,11 @@ import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.util.SqlInjectionUtil;
|
import org.jeecg.common.util.SqlInjectionUtil;
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
import org.jeecg.common.util.oConvertUtils;
|
||||||
|
import org.jeecg.modules.extbpm.process.common.expression.FlowNodeExpression;
|
||||||
import org.jeecg.modules.extbpm.process.entity.ExtActExpression;
|
import org.jeecg.modules.extbpm.process.entity.ExtActExpression;
|
||||||
import org.jeecg.modules.extbpm.process.service.IExtActExpressionService;
|
import org.jeecg.modules.extbpm.process.service.IExtActExpressionService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@@ -26,6 +29,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -37,11 +43,32 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
*/
|
*/
|
||||||
@RestController("extActExpressionController")
|
@RestController("extActExpressionController")
|
||||||
@RequestMapping("/act/process/extActExpression")
|
@RequestMapping("/act/process/extActExpression")
|
||||||
|
@Tag(name = "流程表达式测试接口")
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ExtActExpressionController {
|
public class ExtActExpressionController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExtActExpressionService extActExpressionService;
|
private IExtActExpressionService extActExpressionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
FlowNodeExpression flowNodeExpression;
|
||||||
|
@GetMapping(value = "/testQueryUsers")
|
||||||
|
@Operation(summary = "获取json内数据测试接口") // 接口说明(必填)
|
||||||
|
public Result<List<String>> queryPageList(
|
||||||
|
@RequestParam(name="jsonData") String jsonData,
|
||||||
|
@RequestParam(name="deptKeyName") String deptKeyName,
|
||||||
|
@RequestParam(name="roleId") String roleId
|
||||||
|
) {
|
||||||
|
// 1. 调用业务方法
|
||||||
|
List<String> usernameList = flowNodeExpression.getUsersListByJson(jsonData, deptKeyName, roleId);
|
||||||
|
|
||||||
|
// 2. 优雅判空 + 提前返回(大厂最爱:卫语句)
|
||||||
|
if (CollectionUtils.isEmpty(usernameList)) {
|
||||||
|
return Result.error("根据 jsonData、部门字段、角色ID未查询到用户");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 成功直接返回数据(标准接口格式)
|
||||||
|
return Result.OK("查询成功", usernameList);
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* 分页列表查询
|
* 分页列表查询
|
||||||
* @param extActExpression
|
* @param extActExpression
|
||||||
|
|||||||
+2
@@ -562,4 +562,6 @@ public interface ISysBaseAPI extends CommonAPI {
|
|||||||
Map<String, Object> queryFileMapById(String id);
|
Map<String, Object> queryFileMapById(String id);
|
||||||
|
|
||||||
String updateBusinessId(String businessId, List<String> deliverablesList);
|
String updateBusinessId(String businessId, List<String> deliverablesList);
|
||||||
|
|
||||||
|
List<String> getUsersListByJsonLocalAPI(Object jsonData, String deptKeyName, String roleId);
|
||||||
}
|
}
|
||||||
|
|||||||
+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.handle.impl.SystemSendMsgHandle;
|
||||||
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
import org.jeecg.modules.message.service.ISysMessageTemplateService;
|
||||||
import org.jeecg.modules.message.websocket.WebSocket;
|
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.entity.*;
|
||||||
import org.jeecg.modules.system.mapper.*;
|
import org.jeecg.modules.system.mapper.*;
|
||||||
import org.jeecg.modules.system.service.*;
|
import org.jeecg.modules.system.service.*;
|
||||||
@@ -2099,4 +2100,42 @@ public class SysBaseApiImpl implements ISysBaseAPI {
|
|||||||
return "";
|
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