Sfoglia il codice sorgente

当前待办数量统计

fanxp 1 anno fa
parent
commit
baf561c264

+ 24 - 16
src/main/java/com/xjrsoft/module/organization/controller/UserController.java

@@ -30,6 +30,7 @@ import com.xjrsoft.module.organization.service.*;
 import com.xjrsoft.module.organization.utils.OrganizationUtil;
 import com.xjrsoft.module.organization.vo.*;
 import com.xjrsoft.module.oss.factory.OssFactory;
+import com.xjrsoft.module.workflow.service.IWorkflowExecuteService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
@@ -79,6 +80,7 @@ public class UserController {
 
     private final IUserStudentService userStudentService;
     private final IBaseClassService baseClassService;
+    private final IWorkflowExecuteService workflowExecuteService;
 
 
     @GetMapping(value = "/list")
@@ -99,22 +101,22 @@ public class UserController {
     @ApiOperation(value = "用户列表(分页)")
     public R page(UserPageDto dto) {
         List<Long> deptIds = new ArrayList<>();
-        if (ObjectUtil.isNotNull(dto.getDepartmentId())){
-            List<Department> list = redisUtil.get(GlobalConstant.DEP_CACHE_KEY,new TypeReference<List<Department>>() {
+        if (ObjectUtil.isNotNull(dto.getDepartmentId())) {
+            List<Department> list = redisUtil.get(GlobalConstant.DEP_CACHE_KEY, new TypeReference<List<Department>>() {
             });
             //当前部门的层级
             String hierarchy = list.stream().filter(x -> x.getId().equals(dto.getDepartmentId())).findFirst().orElse(new Department()).getHierarchy();
-            if (StrUtil.isNotBlank(hierarchy)){
+            if (StrUtil.isNotBlank(hierarchy)) {
                 //层级里面包含当前部门层级的就是它的子集,如1-1,下面包含了1-1、1-1-2这种
-                deptIds = list.stream().filter(x -> StrUtil.isNotBlank(x.getHierarchy())&&x.getHierarchy().contains(hierarchy)).map(Department::getId).collect(Collectors.toList());
-            }else {
+                deptIds = list.stream().filter(x -> StrUtil.isNotBlank(x.getHierarchy()) && x.getHierarchy().contains(hierarchy)).map(Department::getId).collect(Collectors.toList());
+            } else {
                 //如果不存在层级就查询自己的数据
                 deptIds.add(dto.getDepartmentId());
             }
         }
 
         //因为多表关联 会有多个表都使用了id字段,  所以必须专门指定主表的Id
-        if (ObjectUtil.isNotNull(dto.getDepartmentId())){//不为空联合查询
+        if (ObjectUtil.isNotNull(dto.getDepartmentId())) {//不为空联合查询
             IPage<UserPageVo> page = userService.selectJoinListPage(ConventPage.getPage(dto), UserPageVo.class,
                     MPJWrappers.<User>lambdaJoin()
                             .disableSubLogicDel()
@@ -137,7 +139,7 @@ public class UserController {
             PageOutput<UserPageVo> pageOutput = ConventPage.getPageOutput(page);
 
             return R.ok(pageOutput);
-        }else {
+        } else {
 //            LambdaQueryWrapper<User> queryWrapper = new LambdaQueryWrapper<>();
 //            queryWrapper.like(StrUtil.isNotBlank(dto.getKeyword()), User::getName, dto.getKeyword())
 //                    .or(StrUtil.isNotBlank(dto.getKeyword()), x -> x.like(StrUtil.isNotBlank(dto.getKeyword()), User::getCode, dto.getKeyword()))
@@ -202,7 +204,6 @@ public class UserController {
         return R.ok(userService.update(dto));
     }
 
-
     @GetMapping(value = "/current/info")
     @ApiOperation(value = "当前登录用户信息")
     public R info() {
@@ -265,6 +266,14 @@ public class UserController {
         return R.ok(vo);
     }
 
+    @GetMapping(value = "/pending/count")
+    @ApiOperation(value = "当前待办数量统计")
+    public RT<PendingCountDto> pendingCount() {
+        PendingCountDto pendingCountDto = new PendingCountDto();
+        pendingCountDto.setWfPendingCount(workflowExecuteService.pendingCount());
+
+        return RT.ok(pendingCountDto);
+    }
 
     @PutMapping("/update/info")
     @ApiOperation(value = "登陆人修改自己得用户信息")
@@ -279,7 +288,6 @@ public class UserController {
         return R.ok(userService.updateById(updateUserInfo));
     }
 
-
     @PutMapping("/update/password")
     @ApiOperation(value = "当前登录用户修改本人密码")
     public RT<Boolean> updatePassword(@RequestBody @Valid UpdatePasswordDto dto) {
@@ -381,15 +389,15 @@ public class UserController {
 
     @PostMapping("/bind-unionid")
     @ApiOperation(value = "绑定微信 UnionId")
-    public  R bindUnionId(@RequestBody BindOpenidDto dto) {
-        User user = userService.getOne(Wrappers.<User>query().lambda().select(User::getId, User::getOpenId,User::getUnionId).eq(User::getId, dto.getId()), false);
+    public R bindUnionId(@RequestBody BindOpenidDto dto) {
+        User user = userService.getOne(Wrappers.<User>query().lambda().select(User::getId, User::getOpenId, User::getUnionId).eq(User::getId, dto.getId()), false);
         if (user != null) {
             if (StrUtil.isNotBlank(user.getUnionId())) {
                 return R.error("该用户已经绑定微信!");
             }
 
             long count = userService.count(Wrappers.<User>query().lambda().eq(User::getUnionId, dto.getOpenid()));
-            if(count > 0){
+            if (count > 0) {
                 return R.error("该用户已经绑定微信!");
             }
 
@@ -398,9 +406,9 @@ public class UserController {
 //            updateUser.setOpenId(dto.getOpenid());
             updateUser.setUnionId(dto.getOpenid());
             return R.ok(userService.updateById(updateUser));
-        }else{
+        } else {
             long count = userService.count(Wrappers.<User>query().lambda().eq(User::getOpenId, dto.getOpenid()));
-            if(count > 0){
+            if (count > 0) {
                 return R.error("该用户已经绑定微信!");
             }
         }
@@ -409,13 +417,13 @@ public class UserController {
 
     @PostMapping("/bind-openid")
     @ApiOperation(value = "绑定微信 Openid")
-    public  R bindOpenid(@RequestBody BindOpenidDto dto) {
+    public R bindOpenid(@RequestBody BindOpenidDto dto) {
         return R.ok(userService.bindOpenid(dto));
     }
 
     @GetMapping("/unbind-openid")
     @ApiOperation(value = "取消绑定微信 UnionId")
-    public  R unbindOpenid(@RequestParam Long id) {
+    public R unbindOpenid(@RequestParam Long id) {
         return R.ok(userService.unbindOpenid(id));
     }
 

+ 16 - 0
src/main/java/com/xjrsoft/module/organization/vo/PendingCountDto.java

@@ -0,0 +1,16 @@
+package com.xjrsoft.module.organization.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+
+@Data
+public class PendingCountDto implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 流程待办数量
+     */
+    private long wfPendingCount;
+}

+ 6 - 0
src/main/java/com/xjrsoft/module/workflow/service/IWorkflowExecuteService.java

@@ -137,6 +137,12 @@ public interface IWorkflowExecuteService {
      */
     List<LaunchAndApproveVo> reLaunch(ReLaunchDto dto);
 
+    /**
+     * 当前人员待办数量
+     * @return
+     */
+    long pendingCount();
+
 
     /**
      * 当前人员待处理

+ 14 - 0
src/main/java/com/xjrsoft/module/workflow/service/impl/WorkflowExecuteServiceImpl.java

@@ -1426,6 +1426,20 @@ public class WorkflowExecuteServiceImpl implements IWorkflowExecuteService {
         }
     }
 
+    @Override
+    public long pendingCount() {
+
+        SaSession tokenSession = StpUtil.getTokenSession();
+        User user = tokenSession.get(GlobalConstant.LOGIN_USER_INFO_KEY, new User());
+
+        TaskQuery taskQuery = taskService.createTaskQuery()
+                .active()
+                .taskVariableValueEquals(WorkflowConstant.TASK_IS_APPOINT_APPROVE, YesOrNoEnum.NO.getCode())
+                .processVariableValueEquals(WorkflowConstant.PROCESS_ISRECYCLE_FLAG_KEY, WorkflowIsRecycleType.NO.getCode())
+                .taskVariableValueLike(WorkflowConstant.TASK_ASSIGNEE_VAR_KEY, StringPool.PERCENT + user.getId() + StringPool.PERCENT);
+        return taskQuery.count();
+    }
+
     @Override
     public PageOutput<PendingTaskVo> pending(PendingTaskPageDto dto) {