fix(approve): 修复流程配置节点审批人为空时的异常处理
- 修正了当审批人列表为空时抛出运行时异常的逻辑
- 确保在节点ID集合为空的情况下流程能够正确处理
- 优化了代码缩进和格式以提高可读性
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | alter table sys_user |
| | | add ai_enabled tinyint(1) not null default 0 comment 'æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼'; |
| ¶Ô±ÈÐÂÎļþ |
| | |
| | | # ç¨æ· AI åè½å段å端èè°è¯´æ |
| | | |
| | | ## èæ¯ |
| | | |
| | | å端已å¨ç¨æ·è¡¨å¢å éèåæ®µ `ai_enabled`ï¼ç¨äºæ è¯ç¨æ·æ¯å¦å¼é AI åè½ã |
| | | è¯¥åæ®µä¸å¼æ¾ç»ç¨æ·èµæç»´æ¤æ¥å£ï¼ä¸éè¿ç¨æ·ç¼è¾é¡µé¢ä¸å/ååï¼ã |
| | | |
| | | ## åæ®µå®ä¹ |
| | | |
| | | | åæ®µ | ç±»å | é»è®¤å¼ | 说æ | |
| | | | --- | --- | --- | --- | |
| | | | ai_enabled | tinyint(1) | 0 | æ¯å¦å¼é AI åè½ï¼`0`=æªå¼éï¼`1`=å·²å¼é | |
| | | |
| | | ## èè°æ¥å£ |
| | | |
| | | ç»å½åè°ç¨ï¼ |
| | | |
| | | ```http |
| | | GET /getInfo |
| | | ``` |
| | | |
| | | è¿å䏿°å¢é¡¶å±å段 `aiEnabled`ï¼ |
| | | |
| | | ```json |
| | | { |
| | | "code": 200, |
| | | "msg": "æä½æå", |
| | | "user": { |
| | | "userId": 1, |
| | | "userName": "admin" |
| | | }, |
| | | "aiEnabled": 1, |
| | | "roles": [ |
| | | "admin" |
| | | ], |
| | | "permissions": [ |
| | | "*:*:*" |
| | | ] |
| | | } |
| | | ``` |
| | | |
| | | ## å端使ç¨å»ºè®® |
| | | |
| | | 1. ç»å½æååæç°ææµç¨è°ç¨ `/getInfo`ã |
| | | 2. ä»ååºé¡¶å±è¯»å `aiEnabled`ã |
| | | 3. å¤å®é»è¾å»ºè®®ï¼ |
| | | - `aiEnabled === 1`ï¼å±ç¤º/æ¾å¼ AI ç¸å
³å
¥å£ã |
| | | - å
¶ä»å¼ï¼`0`ã`null`ã`undefined`ï¼ï¼ææªå¼éå¤çã |
| | | |
| | | ## ç¼å说æ |
| | | |
| | | - `aiEnabled` å·²æ¾å
¥ç»å½ç¼å对象ï¼`LoginUser`ï¼å¹¶é token çå½å¨æç®¡çã |
| | | - ç¼å key åç¼ï¼`login_tokens:`ã |
| | |
| | | */
|
| | | private Long tenantId;
|
| | |
|
| | | /**
|
| | | * å½åé¨é¨id
|
| | | */
|
| | | /** |
| | | * å½åé¨é¨id |
| | | */ |
| | | private Long currentDeptId; |
| | | |
| | | /** |
| | | * æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼ |
| | | */ |
| | | private Integer aiEnabled; |
| | | |
| | | private String dataScope; |
| | |
|
| | |
| | | {
|
| | | }
|
| | |
|
| | | public LoginUser(SysUser user, Set<String> permissions)
|
| | | {
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | }
|
| | | public LoginUser(SysUser user, Set<String> permissions) |
| | | { |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptId;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptId, SysUser user, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptId; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptIds;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | this.tenantId = tenantId;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptIds; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.tenantId = tenantId; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions)
|
| | | {
|
| | | this.userId = userId;
|
| | | this.deptIds = deptIds;
|
| | | this.user = user;
|
| | | this.permissions = permissions;
|
| | | this.tenantId = tenantId;
|
| | | this.currentDeptId = currentDeptId;
|
| | | }
|
| | | public LoginUser(Long userId, Long [] deptIds, SysUser user,Long tenantId,Long currentDeptId, Set<String> permissions) |
| | | { |
| | | this.userId = userId; |
| | | this.deptIds = deptIds; |
| | | this.user = user; |
| | | this.permissions = permissions; |
| | | this.tenantId = tenantId; |
| | | this.currentDeptId = currentDeptId; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | public Long getUserId()
|
| | | {
|
| | |
| | | return user;
|
| | | }
|
| | |
|
| | | public void setUser(SysUser user)
|
| | | {
|
| | | this.user = user;
|
| | | }
|
| | | public void setUser(SysUser user) |
| | | { |
| | | this.user = user; |
| | | this.aiEnabled = user == null ? null : user.getAiEnabled(); |
| | | } |
| | |
|
| | | @Override
|
| | | public Collection<? extends GrantedAuthority> getAuthorities()
|
| | |
| | | this.currentDeptId = currentDeptId; |
| | | } |
| | | |
| | | public Integer getAiEnabled() { |
| | | if (aiEnabled != null) { |
| | | return aiEnabled; |
| | | } |
| | | if (user != null && user.getAiEnabled() != null) { |
| | | return user.getAiEnabled(); |
| | | } |
| | | return 0; |
| | | } |
| | | |
| | | public void setAiEnabled(Integer aiEnabled) { |
| | | this.aiEnabled = aiEnabled; |
| | | } |
| | | |
| | | public String getDataScope() { |
| | | return dataScope; |
| | | } |
| | |
| | | import com.ruoyi.project.system.domain.SysMenu;
|
| | | import com.ruoyi.project.system.domain.SysUser;
|
| | | import com.ruoyi.project.system.domain.vo.SysUserDeptVo;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper;
|
| | | import com.ruoyi.project.system.service.ISysMenuService;
|
| | | import com.ruoyi.project.system.service.ISysUserDeptService;
|
| | | import com.ruoyi.project.system.mapper.SysDeptMapper; |
| | | import com.ruoyi.project.system.service.ISysMenuService; |
| | | import com.ruoyi.project.system.service.ISysUserDeptService; |
| | | import com.ruoyi.project.system.service.ISysUserService; |
| | | import lombok.AllArgsConstructor;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.util.ObjectUtils;
|
| | |
| | | {
|
| | | private SysLoginService loginService;
|
| | | private ISysMenuService menuService;
|
| | | private SysPermissionService permissionService;
|
| | | private TokenService tokenService;
|
| | | private ISysUserDeptService userDeptService;
|
| | | private SysDeptMapper sysDeptMapper;
|
| | | private SysPermissionService permissionService; |
| | | private TokenService tokenService; |
| | | private ISysUserDeptService userDeptService; |
| | | private ISysUserService userService; |
| | | private SysDeptMapper sysDeptMapper; |
| | |
|
| | | /**
|
| | | * ç»å½æ¹æ³
|
| | |
| | | public AjaxResult getInfo()
|
| | | {
|
| | | LoginUser loginUser = SecurityUtils.getLoginUser();
|
| | | SysUser user = loginUser.getUser();
|
| | | SysUser user = userService.selectUserById(loginUser.getUserId()); |
| | | if (user == null) |
| | | { |
| | | user = loginUser.getUser(); |
| | | } |
| | | else |
| | | { |
| | | loginUser.setUser(user); |
| | | loginUser.setAiEnabled(user.getAiEnabled()); |
| | | tokenService.setLoginUser(loginUser); |
| | | } |
| | | // è·åå½åç»å½å
¬å¸
|
| | | Long tenantId = loginUser.getTenantId();
|
| | | if(null != tenantId){
|
| | |
| | | loginUser.setPermissions(permissions);
|
| | | tokenService.refreshToken(loginUser);
|
| | | }
|
| | | AjaxResult ajax = AjaxResult.success();
|
| | | ajax.put("user", user);
|
| | | ajax.put("roles", roles);
|
| | | ajax.put("permissions", permissions);
|
| | | return ajax;
|
| | | AjaxResult ajax = AjaxResult.success(); |
| | | ajax.put("user", user); |
| | | ajax.put("aiEnabled", loginUser.getAiEnabled()); |
| | | ajax.put("roles", roles); |
| | | ajax.put("permissions", permissions); |
| | | return ajax; |
| | | }
|
| | |
|
| | | /**
|
| | |
| | | package com.ruoyi.project.system.domain;
|
| | |
|
| | | import com.baomidou.mybatisplus.annotation.TableField;
|
| | | import com.ruoyi.common.xss.Xss;
|
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.fasterxml.jackson.annotation.JsonIgnore; |
| | | import com.ruoyi.common.xss.Xss; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel.ColumnType;
|
| | | import com.ruoyi.framework.aspectj.lang.annotation.Excel.Type;
|
| | |
| | | @Excel(name = "è´¦å·ç¶æ", readConverterExp = "0=æ£å¸¸,1=åç¨")
|
| | | private String status;
|
| | |
|
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */
|
| | | private String delFlag;
|
| | |
|
| | | /** å 餿 å¿ï¼0代表åå¨ 2代表å é¤ï¼ */ |
| | | private String delFlag; |
| | | |
| | | /** æ¯å¦å¼éAIåè½ï¼0å¦ 1æ¯ï¼ */ |
| | | @JsonIgnore |
| | | private Integer aiEnabled; |
| | | |
| | | /** æåç»å½IP */
|
| | | @Excel(name = "æåç»å½IP", type = Type.EXPORT)
|
| | | private String loginIp;
|
| | |
| | | this.status = status;
|
| | | }
|
| | |
|
| | | public String getDelFlag()
|
| | | {
|
| | | return delFlag;
|
| | | }
|
| | | public String getDelFlag() |
| | | { |
| | | return delFlag; |
| | | } |
| | |
|
| | | public void setDelFlag(String delFlag)
|
| | | {
|
| | | this.delFlag = delFlag;
|
| | | }
|
| | | public void setDelFlag(String delFlag) |
| | | { |
| | | this.delFlag = delFlag; |
| | | } |
| | | |
| | | public Integer getAiEnabled() |
| | | { |
| | | return aiEnabled; |
| | | } |
| | | |
| | | public void setAiEnabled(Integer aiEnabled) |
| | | { |
| | | this.aiEnabled = aiEnabled; |
| | | } |
| | |
|
| | | public String getLoginIp()
|
| | | {
|
| | |
| | | .append("sex", getSex())
|
| | | .append("avatar", getAvatar())
|
| | | .append("password", getPassword())
|
| | | .append("status", getStatus())
|
| | | .append("delFlag", getDelFlag())
|
| | | .append("loginIp", getLoginIp())
|
| | | .append("status", getStatus()) |
| | | .append("delFlag", getDelFlag()) |
| | | .append("aiEnabled", getAiEnabled()) |
| | | .append("loginIp", getLoginIp()) |
| | | .append("loginDate", getLoginDate())
|
| | | .append("createBy", getCreateBy())
|
| | | .append("createTime", getCreateTime())
|
| | |
| | | <result property="password" column="password" /> |
| | | <result property="status" column="status" /> |
| | | <result property="delFlag" column="del_flag" /> |
| | | <result property="aiEnabled" column="ai_enabled" /> |
| | | <result property="loginIp" column="login_ip" /> |
| | | <result property="loginDate" column="login_date" /> |
| | | <result property="createBy" column="create_by" /> |
| | |
| | | </resultMap> |
| | | |
| | | <sql id="selectUserVo"> |
| | | select u.user_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | select u.user_id, u.user_name, u.nick_name, u.email, u.avatar, u.phonenumber, u.password, u.sex, u.status, u.del_flag, u.ai_enabled, u.login_ip, u.login_date, u.create_by, u.create_time, u.remark, |
| | | r.role_id, r.role_name, r.role_key, r.role_sort, r.data_scope, r.status as role_status,u.tenant_id |
| | | from sys_user u |
| | | left join sys_user_role ur on u.user_id = ur.user_id |