审核管理:新增当前用户待办统计接口(按模块聚合)
- GET /api/gxmu/review-list/pending-summary:status=0 且 user_id=当前登录人, 按 module 聚合并回填注册表标题,供「待办审核」左侧模块导航显示待办数 - 不拿分页结果当计数:避免 limit 上限后数字失真 - 附 sql/20261111_spec58_review_menu.sql:三个子菜单收敛为 待办审核(14359)/ 审批规则(14355),删除「审核流分配管理」(14356)
This commit is contained in:
@@ -0,0 +1,25 @@
|
|||||||
|
-- 审核管理:三个子菜单收敛成两个(变体 A「按模块的工作台」落地)
|
||||||
|
--
|
||||||
|
-- 之前:审核流配置 / 审核流分配管理 / 审核列表 —— 三个页面各自对应一张表,
|
||||||
|
-- 用户要在脑子里 join 才能回答「这条申报现在谁在审」。
|
||||||
|
-- 之后:待办审核(原审核列表页,改造成工作台)/ 审批规则(原审核流配置页,
|
||||||
|
-- 按模块一行展示生效的审批链,可直接换链、编辑链)。
|
||||||
|
-- 「审核流分配管理」删除:模块与审批链的绑定并入审批规则页。
|
||||||
|
--
|
||||||
|
-- 依赖:先跑 20261110_spec58_approval_chain.sql(模块注册表)。
|
||||||
|
|
||||||
|
UPDATE sys_menu SET title = '待办审核', sort_number = 10
|
||||||
|
WHERE menu_id = 14359 AND deleted = 0;
|
||||||
|
|
||||||
|
UPDATE sys_menu SET title = '审批规则', sort_number = 20
|
||||||
|
WHERE menu_id = 14355 AND deleted = 0;
|
||||||
|
|
||||||
|
DELETE FROM sys_role_menu WHERE menu_id = 14356;
|
||||||
|
UPDATE sys_menu SET deleted = 1
|
||||||
|
WHERE menu_id = 14356 AND deleted = 0;
|
||||||
|
|
||||||
|
-- 校验:期望只剩「待办审核」「审批规则」两条子菜单
|
||||||
|
SELECT menu_id, parent_id, title, path, sort_number, deleted
|
||||||
|
FROM sys_menu
|
||||||
|
WHERE parent_id = 14358
|
||||||
|
ORDER BY sort_number;
|
||||||
@@ -8,6 +8,8 @@ import com.gxwebsoft.gxmu.service.ReviewFlowStarterService;
|
|||||||
import com.gxwebsoft.gxmu.service.DeclareGuardService;
|
import com.gxwebsoft.gxmu.service.DeclareGuardService;
|
||||||
import com.gxwebsoft.gxmu.service.ReviewListService;
|
import com.gxwebsoft.gxmu.service.ReviewListService;
|
||||||
import com.gxwebsoft.gxmu.entity.ReviewList;
|
import com.gxwebsoft.gxmu.entity.ReviewList;
|
||||||
|
import com.gxwebsoft.gxmu.model.ReviewPendingSummary;
|
||||||
|
import com.gxwebsoft.gxmu.module.service.ModuleRegistryService;
|
||||||
import com.gxwebsoft.gxmu.param.ReviewListParam;
|
import com.gxwebsoft.gxmu.param.ReviewListParam;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
@@ -21,6 +23,7 @@ import org.springframework.web.bind.annotation.*;
|
|||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审核列表控制器
|
* 审核列表控制器
|
||||||
@@ -42,6 +45,8 @@ public class ReviewListController extends BaseController {
|
|||||||
private DeclareGuardService declareGuardService;
|
private DeclareGuardService declareGuardService;
|
||||||
@Resource
|
@Resource
|
||||||
private ReviewFlowStarterService reviewFlowStarterService;
|
private ReviewFlowStarterService reviewFlowStarterService;
|
||||||
|
@Resource
|
||||||
|
private ModuleRegistryService moduleRegistryService;
|
||||||
|
|
||||||
@ApiOperation("分页查询审核列表")
|
@ApiOperation("分页查询审核列表")
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@@ -67,6 +72,24 @@ public class ReviewListController extends BaseController {
|
|||||||
return success(reviewListService.pageRel(param));
|
return success(reviewListService.pageRel(param));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ApiOperation("当前用户的待办统计(按模块)")
|
||||||
|
@GetMapping("/pending-summary")
|
||||||
|
public ApiResult<ReviewPendingSummary> pendingSummary() {
|
||||||
|
Map<String, Long> counts = reviewListService.countPendingByModule(getLoginUserId());
|
||||||
|
Map<String, String> titles = moduleRegistryService.titleMap();
|
||||||
|
ReviewPendingSummary summary = new ReviewPendingSummary();
|
||||||
|
counts.entrySet().stream()
|
||||||
|
// 数量倒序、同数量按模块名,保证前端导航顺序稳定
|
||||||
|
.sorted(Map.Entry.<String, Long>comparingByValue().reversed()
|
||||||
|
.thenComparing(Map.Entry.comparingByKey()))
|
||||||
|
.forEach(entry -> summary.getModules().add(new ReviewPendingSummary.Item(
|
||||||
|
entry.getKey(),
|
||||||
|
ModuleRegistryService.titleOf(titles, entry.getKey()),
|
||||||
|
entry.getValue())));
|
||||||
|
summary.setTotal(counts.values().stream().mapToLong(Long::longValue).sum());
|
||||||
|
return success(summary);
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("查询全部审核列表")
|
@ApiOperation("查询全部审核列表")
|
||||||
@GetMapping()
|
@GetMapping()
|
||||||
public ApiResult<List<ReviewList>> list(ReviewListParam param) {
|
public ApiResult<List<ReviewList>> list(ReviewListParam param) {
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.gxwebsoft.gxmu.model;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前用户的待办统计(按模块聚合)。
|
||||||
|
*
|
||||||
|
* <p>「待办审核」页左侧模块导航的数字来自这里:一次请求拿全,避免前端为每个模块
|
||||||
|
* 各发一次分页查询、也避免把分页结果当计数用。
|
||||||
|
*
|
||||||
|
* @author LX
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("待办统计")
|
||||||
|
public class ReviewPendingSummary implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("待办总数")
|
||||||
|
private long total;
|
||||||
|
|
||||||
|
@ApiModelProperty("按模块分组的待办数,按数量倒序")
|
||||||
|
private List<Item> modules = new ArrayList<>();
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel("模块待办数")
|
||||||
|
public static class Item implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块标识")
|
||||||
|
private String module;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块标题")
|
||||||
|
private String moduleName;
|
||||||
|
|
||||||
|
@ApiModelProperty("待办数")
|
||||||
|
private long count;
|
||||||
|
|
||||||
|
public Item() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public Item(String module, String moduleName, long count) {
|
||||||
|
this.module = module;
|
||||||
|
this.moduleName = moduleName;
|
||||||
|
this.count = count;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -48,4 +48,12 @@ public interface ReviewListService extends IService<ReviewList> {
|
|||||||
ReviewList getByIdRel(Integer id);
|
ReviewList getByIdRel(Integer id);
|
||||||
|
|
||||||
List<ReviewList> listByModuleNPK(String module, Integer pk);
|
List<ReviewList> listByModuleNPK(String module, Integer pk);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计某个用户的待办(status=0)按模块的分布。
|
||||||
|
*
|
||||||
|
* @param userId 审批人用户id,null 表示不按人过滤
|
||||||
|
* @return module -> 待办数,按数量倒序由调用方决定
|
||||||
|
*/
|
||||||
|
java.util.Map<String, Long> countPendingByModule(Integer userId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.gxwebsoft.gxmu.service.impl;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.gxwebsoft.common.system.service.UserService;
|
import com.gxwebsoft.common.system.service.UserService;
|
||||||
|
import com.gxwebsoft.gxmu.constant.ReviewStatus;
|
||||||
import com.gxwebsoft.gxmu.mapper.ReviewListMapper;
|
import com.gxwebsoft.gxmu.mapper.ReviewListMapper;
|
||||||
import com.gxwebsoft.gxmu.service.ReviewListService;
|
import com.gxwebsoft.gxmu.service.ReviewListService;
|
||||||
import com.gxwebsoft.gxmu.entity.ReviewList;
|
import com.gxwebsoft.gxmu.entity.ReviewList;
|
||||||
@@ -13,6 +14,7 @@ import com.gxwebsoft.common.core.web.PageResult;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -90,6 +92,24 @@ public class ReviewListServiceImpl extends ServiceImpl<ReviewListMapper, ReviewL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Long> countPendingByModule(Integer userId) {
|
||||||
|
List<ReviewList> pending = list(
|
||||||
|
new LambdaQueryWrapper<ReviewList>()
|
||||||
|
.eq(ReviewList::getDeleted, 0)
|
||||||
|
.eq(ReviewList::getStatus, ReviewStatus.PENDING)
|
||||||
|
.eq(userId != null, ReviewList::getUserId, userId)
|
||||||
|
);
|
||||||
|
Map<String, Long> counts = new HashMap<>();
|
||||||
|
for (ReviewList item : pending) {
|
||||||
|
if (item.getModule() == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
counts.merge(item.getModule(), 1L, Long::sum);
|
||||||
|
}
|
||||||
|
return counts;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<ReviewList> listByModuleNPK(String module, Integer pk){
|
public List<ReviewList> listByModuleNPK(String module, Integer pk){
|
||||||
return list(
|
return list(
|
||||||
|
|||||||
Reference in New Issue
Block a user