From 8a31ed997495182924f831e484698ac125b7725e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=A6=E9=B8=BF=E5=B1=95?= <18031053041@163.com> Date: Thu, 10 Sep 2026 11:46:34 +0800 Subject: [PATCH] =?UTF-8?q?BI=E6=9C=88=E5=8F=B0=E6=8C=87=E6=A0=87=E6=A3=80?= =?UTF-8?q?=E6=B5=8B=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/BiPlatformRealDataMapper.java | 2 +- .../repository/po/RealTaskTypeStatPO.java | 10 ++--- .../service/BiPlatformRealDataService.java | 37 ++++++++----------- .../service/BiReportSnapshotSyncService.java | 2 +- .../BiSnapshotWeeklyRandomDataBuilder.java | 1 + .../BiPlatformRealDataMapper.xml | 21 +++++------ 6 files changed, 33 insertions(+), 40 deletions(-) diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java index d0ac6ff44..9119cec13 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/mapper/BiPlatformRealDataMapper.java @@ -47,7 +47,7 @@ public interface BiPlatformRealDataMapper { /** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */ RealOnTimeStatPO queryTodayOnTimeStats(); - /** 任务类型统计(当月 OMS 运输订单按业务类型分组:1-跨境 2-国内) */ + /** 任务类型统计(本月 YMS QMS_MAIN_BUSINESS 预约按业务类型 BUSINESS_NAME 分组) */ List queryMonthTransportOrderByType(); /** 月台监控-按楼层统计月台车辆(楼层、月台数量、今日预约车辆、当前作业车辆) */ diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java index 5f0a29c3c..bf73ec4b9 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/repository/po/RealTaskTypeStatPO.java @@ -5,16 +5,16 @@ import lombok.Data; import java.io.Serializable; /** - * 任务类型统计(真实数据,来自 NGWL_TEST_OMS.BUSINESS_DOCUMENT_ORDER 运输订单) - * 按业务类型 businessCategory 分组统计当月数量:1-跨境运输 2-国内运输 + * 任务类型统计(真实数据,来自 NGWL_TEST_YMS.QMS_MAIN_BUSINESS 预约登记表) + * 按本月预约车辆数(TARGET_DATE 在当前月)以 BUSINESS_NAME 业务类型分组 */ @Data public class RealTaskTypeStatPO implements Serializable { private static final long serialVersionUID = 1L; - /** 业务类型:1-跨境 2-国内 */ - private Integer businessCategory; + /** 业务类型名称(qms_main_business.BUSINESS_NAME) */ + private String businessName; - /** 该类型当月单量 */ + /** 该业务类型本月预约车辆数 */ private Long count; } \ No newline at end of file diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java index 05fe35cb3..83acdfa23 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biPlatformRealData/service/BiPlatformRealDataService.java @@ -270,39 +270,32 @@ public class BiPlatformRealDataService { } /** - * 任务类型统计:当月 OMS 运输订单按业务类型分组(1-跨境运输,2-国内运输)。 - * 返回 {totalTasks: 当月跨境+国内运输总单量, taskTypes: [{type, count}]} - * 查询失败时返回空结构,不影响写死字段。 - */ - /** - * 任务类型统计:固定输出「跨境运输」「国内运输」两类,count 取当月 OMS 业务单真实单量; - * 当月无数据或查询失败时仍返回两类、count=0(不使用写死模板兜底)。 + * 任务类型统计:本月(YMS QMS_MAIN_BUSINESS)预约车辆按业务类型 BUSINESS_NAME 分组; + * 返回 {totalTasks: 当月总预约车辆数, taskTypes: [{type: 业务类型名称, count: 该类型预约数}]} + * 按真实 BUSINESS_NAME 分组输出,不固定兜底类别;当月无数据或查询失败时返回空列表。 */ public TaskTypeStatisticsVO queryMonthTransportOrderByType() { - int crossBorder = 0; // 跨境运输 BUSINESS_CATEGORY=1 - int domestic = 0; // 国内运输 BUSINESS_CATEGORY=2 + List items = new ArrayList<>(); + int total = 0; try { List rows = biPlatformRealDataMapper.queryMonthTransportOrderByType(); if (rows != null) { for (RealTaskTypeStatPO r : rows) { - if (r == null || r.getBusinessCategory() == null || r.getCount() == null) { + if (r == null || r.getBusinessName() == null || r.getCount() == null) { continue; } - if (r.getBusinessCategory() == 1) { - crossBorder = r.getCount().intValue(); - } else if (r.getBusinessCategory() == 2) { - domestic = r.getCount().intValue(); - } + int c = r.getCount().intValue(); + items.add(TaskTypeCountItemVO.builder().type(r.getBusinessName()).count(c).build()); + total += c; } } } catch (Exception e) { - log.error("【OMS】统计当月运输订单业务类型失败: {}", e.getMessage(), e); - // 失败时不回退写死模板,保持两类 count=0 + log.error("【YMS】统计当月预约业务类型失败: {}", e.getMessage(), e); + // 查询失败返回空列表(前端会显示空) + items = new ArrayList<>(); + total = 0; } - List items = new ArrayList<>(); - items.add(TaskTypeCountItemVO.builder().type("跨境运输").count(crossBorder).build()); - items.add(TaskTypeCountItemVO.builder().type("国内运输").count(domestic).build()); - return TaskTypeStatisticsVO.builder().totalTasks(crossBorder + domestic).taskTypes(items).build(); + return TaskTypeStatisticsVO.builder().totalTasks(total).taskTypes(items).build(); } /** @@ -447,7 +440,7 @@ public class BiPlatformRealDataService { } } - // 任务类型统计:当月 OMS 业务单真实数据(固定跨境运输/国内运输两类,不使用写死模板兜底) + // 任务类型统计:本月 YMS QMS_MAIN_BUSINESS 按业务类型 BUSINESS_NAME 分组(真实业务数据) template.setTaskTypeStatistics(queryMonthTransportOrderByType()); return template; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java index 297a1331e..d32603d17 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/service/BiReportSnapshotSyncService.java @@ -248,7 +248,7 @@ public class BiReportSnapshotSyncService { } } - // ====== 真实数据:任务类型统计(当月 OMS 业务单,固定跨境运输/国内运输两类,不使用写死模板兜底) ====== + // ====== 真实数据:任务类型统计(本月 YMS QMS_MAIN_BUSINESS 按业务类型 BUSINESS_NAME 分组) ====== template.setTaskTypeStatistics(biPlatformRealDataService.queryMonthTransportOrderByType()); return template; diff --git a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java index 81a872259..c251c73f1 100644 --- a/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java +++ b/mhd-bi/src/main/java/com/mhd/bi/domain/biSnapshotSync/support/BiSnapshotWeeklyRandomDataBuilder.java @@ -206,6 +206,7 @@ public final class BiSnapshotWeeklyRandomDataBuilder { handled = Math.min(handled, todayAl); int unhandled = Math.max(0, todayAl - handled); + // 月台告警分布:按业务要求,全部置 0 List dist = new ArrayList<>(); for (int i = 0; i < Baseline.P_DIST_T.length; i++) { dist.add(PlatformAlarmDistItemVO.builder() diff --git a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml index 6f9852c18..03c071e2c 100644 --- a/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml +++ b/mhd-bi/src/main/resources/mapper/biPlatformRealData/BiPlatformRealDataMapper.xml @@ -148,19 +148,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ORDER BY 1 DESC - +