|
@@ -35,6 +35,9 @@ import com.ruoyi.system.service.ISysDeptService;
|
|
|
import com.ruoyi.system.service.ISysUserIdentityService;
|
|
|
import com.ruoyi.system.service.ISysUserService;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import net.sf.jsqlparser.JSQLParserException;
|
|
|
+import net.sf.jsqlparser.parser.CCJSqlParserUtil;
|
|
|
+import net.sf.jsqlparser.statement.select.Select;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
@@ -1071,6 +1074,28 @@ public class FlowProcessServiceImpl implements FlowProcessService {
|
|
|
flowResult.setSuccess(true);
|
|
|
flowResult.setUserId(userId);
|
|
|
return flowResult;
|
|
|
+ case SQL_EXPRESSION:
|
|
|
+ String jumpCondition = templateParse(node.getJumpCondition(), FlowThreadLocalUtil.getTemplateData());
|
|
|
+ try {
|
|
|
+ if (!(CCJSqlParserUtil.parse(jumpCondition) instanceof Select)) {
|
|
|
+ throw new ServiceException("非法表达式");
|
|
|
+ }
|
|
|
+ } catch (JSQLParserException e) {
|
|
|
+ log.error("表达式解析异常:" + e.getMessage(), e);
|
|
|
+ throw new ServiceException("表达式解析失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+ List<SysUser> userList = sysUserService.list(Wrappers.<SysUser>query().apply("user_id in (" + jumpCondition + ")"));
|
|
|
+ if (ObjectUtil.isEmpty(userList)) {
|
|
|
+ throw new ServiceException("节点表达式结果无用户!");
|
|
|
+ }
|
|
|
+ if (userList.size() == 1) {
|
|
|
+ flowResult.setSuccess(true);
|
|
|
+ flowResult.setUserId(String.valueOf(userList.get(0).getUserId()));
|
|
|
+ return flowResult;
|
|
|
+ }
|
|
|
+ flowResult.setSuccess(false);
|
|
|
+ flowResult.setUserList(userList);
|
|
|
+ return flowResult;
|
|
|
|
|
|
default:
|
|
|
throw new ServiceException("未知用户处理类型:" + handleObjectType);
|