Commit 8d371abf by zhouhaibao

feat(meituan-order): 部门统计排除指定部门数据

- 新增获取需排除部门名称列表的逻辑
- 对上月和前月订单数据按部门进行过滤排除
- 更新日志输出以记录被排除的部门信息
1 parent fc519997
...@@ -340,10 +340,15 @@ public class StaffMeituanOrderService { ...@@ -340,10 +340,15 @@ public class StaffMeituanOrderService {
List<StaffMeituanOrder> lastMonthAll = staffMeituanOrderMapper.selectByCreateTimeRange(lastMonthStart, lastMonthEnd); List<StaffMeituanOrder> lastMonthAll = staffMeituanOrderMapper.selectByCreateTimeRange(lastMonthStart, lastMonthEnd);
List<StaffMeituanOrder> prevMonthAll = staffMeituanOrderMapper.selectByCreateTimeRange(prevMonthStart, prevMonthEnd); List<StaffMeituanOrder> prevMonthAll = staffMeituanOrderMapper.selectByCreateTimeRange(prevMonthStart, prevMonthEnd);
// 排除指定部门(零售运营部、场景运营部、数字化运营部)的数据
List<String> excludeDeptNames = getExcludeReportDeptNames();
lastMonthAll = excludeDeptOrders(lastMonthAll, excludeDeptNames);
prevMonthAll = excludeDeptOrders(prevMonthAll, excludeDeptNames);
if (CollectionUtils.isEmpty(lastMonthAll)) { if (CollectionUtils.isEmpty(lastMonthAll)) {
return new ArrayList<>(); return new ArrayList<>();
} }
log.info("Dept lastMonthAll size:{}", lastMonthAll.size()); log.info("Dept排除部门:{},lastMonthAll size:{}", excludeDeptNames, lastMonthAll.size());
// 按部门分组 // 按部门分组
Map<Long, List<StaffMeituanOrder>> lastMonthDeptMap = lastMonthAll.stream() Map<Long, List<StaffMeituanOrder>> lastMonthDeptMap = lastMonthAll.stream()
......
  • @wangxw1
    commented
    Master

    一、关键问题与优化建议,如果必要,给出代码示例(仅限 Top 3)

    1. 排除规则以部门名称作为输入,存在统计口径不稳定的风险
      • 问题描述:新增过滤调用使用 List<String> excludeDeptNames 表达排除范围。若 excludeDeptOrders() 直接根据部门名称匹配,则规则依赖名称的准确性与唯一性。当前未提供两个辅助方法的实现,无法确认是否已经处理同名部门、部门更名、空名称及历史订单的部门归属问题。
      • 影响分析:部门更名、存在同名部门或历史订单保存旧名称时,可能出现漏排除或误排除。上月与前月分别过滤后,还可能影响环比统计的可比性。
      • 优化建议:
        • 优先使用稳定的部门 ID 或业务编码定义排除范围,名称仅用于展示和日志。
        • 明确历史订单按“下单时部门”还是“当前部门”进行统计,并确保两个月使用相同口径。
        • 补充辅助方法实现及测试,至少覆盖部门更名、同名部门、部门信息缺失、过滤后为空等场景。如果辅助方法内部已将名称解析为唯一且稳定的标识,应明确该约束。

    本次仅列出上述重要风险,不将未展示的实现推定为缺陷。可见差异未涉及 MyBatis SQL 或 Dubbo Remote 接口请求参数变更;是否存在子查询或接口兼容性问题,仍需结合相关文件确认。

    二、评分明细

    评分维度 得分 理由
    功能实现的正确性与健壮性 36/40 上月、前月使用相同过滤入口,且过滤后保留空集合检查,流程合理;但排除规则的身份匹配与历史归属口径尚未得到验证。
    安全性与潜在风险 30/30 可见变更未引入注入、越权或敏感信息泄露问题;该评分仅针对已展示代码。
    最佳实践与可维护性 18/20 过滤逻辑封装为辅助方法,调用清晰;排除范围以名称表达,缺乏稳定标识和口径约束说明。
    性能与资源利用 5/5 新增两次列表过滤,未见明显性能瓶颈;不能仅因原有全量查询而归责于本次变更。
    提交信息质量 5/5 提交信息清楚说明排除部门、过滤月份与日志调整,与可见变更一致。

    总分:94分

Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!