Browse Source

员工待办

yzc 11 months ago
parent
commit
912b9b5f90

+ 8 - 0
hx-flow/src/main/java/com/fjhx/flow/controller/flow/FlowExampleController.java

@@ -55,6 +55,14 @@ public class FlowExampleController {
     }
 
     /**
+     * 获取下级员工待处理
+     */
+    @PostMapping("getEmployeeToBeProcessedPage")
+    public Page<FlowExampleVo> getEmployeeToBeProcessedPage(@RequestBody FlowExampleSelectDto dto) {
+        return flowExampleService.getEmployeeToBeProcessedPage(dto);
+    }
+
+    /**
      * 获取已发起流程实例
      */
     @PostMapping("/getHaveInitiatedPage")

+ 6 - 0
hx-flow/src/main/java/com/fjhx/flow/entity/flow/vo/FlowExampleVo.java

@@ -39,4 +39,10 @@ public class FlowExampleVo extends FlowExample {
      */
     private Integer nodeHandleType;
 
+    /**
+     * 当前处理人
+     */
+    private Long handleUserId;
+    private String handleUserName;
+
 }

+ 5 - 0
hx-flow/src/main/java/com/fjhx/flow/service/flow/FlowExampleService.java

@@ -39,6 +39,11 @@ public interface FlowExampleService extends BaseService<FlowExample> {
     Page<FlowExampleVo> getToBeProcessedPage(FlowExampleSelectDto dto);
 
     /**
+     * 获取下级员工待处理
+     */
+    Page<FlowExampleVo> getEmployeeToBeProcessedPage(FlowExampleSelectDto dto);
+
+    /**
      * 获取已发起流程实例
      */
     Page<FlowExampleVo> getHaveInitiatedPage(FlowExampleSelectDto dto);

+ 10 - 2
hx-flow/src/main/java/com/fjhx/flow/service/flow/impl/FlowExampleServiceImpl.java

@@ -88,6 +88,14 @@ public class FlowExampleServiceImpl extends ServiceImpl<FlowExampleMapper, FlowE
     }
 
     @Override
+    public Page<FlowExampleVo> getEmployeeToBeProcessedPage(FlowExampleSelectDto dto) {
+        IWrapper<FlowExample> wrapper = getWrapper()
+                .in("fec.handle_user_id", UserUtil.getBelowUserIds(SecurityUtils.getUserId()));
+
+        return doSelectExample(dto, wrapper);
+    }
+
+    @Override
     public Page<FlowExampleVo> getHaveInitiatedPage(FlowExampleSelectDto dto) {
         IWrapper<FlowExample> wrapper = getWrapper()
                 .eq("fe", FlowExample::getCreateUser, SecurityUtils.getUserId())
@@ -398,7 +406,7 @@ public class FlowExampleServiceImpl extends ServiceImpl<FlowExampleMapper, FlowE
                 }
             }
 
-            if (endNode!=null ||  flowDefinitionLineList.size()!=1) {
+            if (endNode != null || flowDefinitionLineList.size() != 1) {
                 break;
             } else {
                 flowDefinitionLineList = flowLineMap.get(nextNodeList.get(0).getId());
@@ -473,7 +481,7 @@ public class FlowExampleServiceImpl extends ServiceImpl<FlowExampleMapper, FlowE
     private Page<FlowExampleVo> doSelectExample(FlowExampleSelectDto dto, IWrapper<FlowExample> wrapper) {
 
         wrapper.eq("fd", FlowDefinition::getFlowInfoId, dto.getFlowInfoId())
-                .keyword(dto, new SqlField("fe", FlowExample::getTitle))
+                .keyword(dto, new SqlField("fe", FlowExample::getTitle),new SqlField("su.nick_name"))
                 .orderByDesc("fe", FlowExample::getId);
 
         Page<FlowExampleVo> page = baseMapper.selectExample(dto.getPage(), wrapper);

+ 4 - 1
hx-flow/src/main/resources/mapper/flow/FlowExampleMapper.xml

@@ -13,12 +13,15 @@
                fe.business_id,
                fe.version,
                fdn.node_name,
-               fdn.node_handle_type
+               fdn.node_handle_type,
+               fec.handle_user_id,
+               su.nick_name AS handle_user_name
         from flow_info fi
                  inner join flow_definition fd on fd.flow_info_id = fi.id
                  inner join flow_example fe on fe.definition_id = fd.id
                  LEFT JOIN flow_example_current fec ON fec.flow_example_id = fe.id
                  LEFT JOIN flow_definition_node fdn ON fec.node_id = fdn.id
+                 LEFT JOIN sys_user su ON fec.handle_user_id = su.user_id
             ${ew.customSqlSegment}
     </select>
 

+ 4 - 4
ruoyi-admin/src/main/resources/application-dev.yml

@@ -6,20 +6,20 @@ spring:
       primary: base
       datasource:
         base:
-          url: jdbc:mysql://121.37.194.75:30102/sanfan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://139.9.102.170:30102/sanfan?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=Asia/Shanghai
           username: root
           password: 5fWD*oa^nso@kmKa
 
     # redis 配置
   redis:
     # 地址
-    host: 121.37.194.75
+    host: 139.9.102.170
     # 端口,默认为6379
-    port: 30103
+    port: 9673
     # 数据库索引
     database: 5
     # 密码
-    password: Fjhx@pwd123
+    password: ss34dsA3DdsF
     # 连接超时时间
     timeout: 10s
     lettuce:

+ 18 - 0
ruoyi-system/src/main/java/com/ruoyi/system/utils/UserUtil.java

@@ -2,11 +2,14 @@ package com.ruoyi.system.utils;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.ruoyi.common.core.domain.entity.SysDept;
 import com.ruoyi.common.core.domain.entity.SysRole;
 import com.ruoyi.common.core.domain.entity.SysUser;
 import com.ruoyi.common.exception.ServiceException;
 import com.ruoyi.common.utils.wrapper.IWrapper;
 import com.ruoyi.system.mapper.SysRoleMapper;
+import com.ruoyi.system.service.ISysDeptService;
 import com.ruoyi.system.service.ISysRoleService;
 import com.ruoyi.system.service.ISysUserService;
 
@@ -20,6 +23,7 @@ public class UserUtil {
     private static final ISysUserService sysUserService = SpringUtil.getBean(ISysUserService.class);
     private static final SysRoleMapper roleMapper = SpringUtil.getBean(SysRoleMapper.class);
     private static final ISysRoleService roleService = SpringUtil.getBean(ISysRoleService.class);
+    private static final ISysDeptService deptService = SpringUtil.getBean(ISysDeptService.class);
 
     public static List<SysUser> getListByIds(List<Long> idList) {
         if (idList.size() == 0) {
@@ -150,4 +154,18 @@ public class UserUtil {
         return userRoles;
     }
 
+    /**
+     * 获取下级部门用户列表
+     */
+    public static List<SysUser> getBelowUserList(Long userId) {
+        SysUser byId = sysUserService.getById(userId);
+        List<SysDept> list = deptService.list(Wrappers.<SysDept>lambdaQuery().apply("FIND_IN_SET( {0}, ancestors )", byId.getDeptId()));
+        List<Long> deptIds = list.stream().map(SysDept::getDeptId).collect(Collectors.toList());
+        return sysUserService.list(Wrappers.<SysUser>lambdaQuery().in(SysUser::getDeptId, deptIds));
+    }
+
+    public static List<Long> getBelowUserIds(Long userId) {
+        return getBelowUserList(userId).stream().map(SysUser::getUserId).collect(Collectors.toList());
+    }
+
 }