BI月台动态真实数据

This commit is contained in:
秦鸿展
2026-08-10 19:58:05 +08:00
parent 14a5aedf15
commit 8eb280f2b9
2 changed files with 39 additions and 36 deletions
@@ -9,6 +9,7 @@ import com.mhd.bi.domain.biSnapshotSync.support.BiSnapshotWeeklyRandomDataBuilde
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO; import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformSurveillanceVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO; import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.PlatformVehicleItemVO;
import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO; import com.mhd.bi.interfaces.facadeApi.biReport.vo.platform.TaskLoadItemVO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
@@ -22,6 +23,7 @@ import java.util.Random;
* 月台监测-真实数据业务层(封装 YMS 跨库查询) * 月台监测-真实数据业务层(封装 YMS 跨库查询)
* 注:列名大小写、字段类型需以实际库为准;若 YMS 库无数据/无权限,相关方法应返回空/0,不影响写死字段写入快照 * 注:列名大小写、字段类型需以实际库为准;若 YMS 库无数据/无权限,相关方法应返回空/0,不影响写死字段写入快照
*/ */
@Slf4j
@Service @Service
public class BiPlatformRealDataService { public class BiPlatformRealDataService {
@@ -32,6 +34,7 @@ public class BiPlatformRealDataService {
try { try {
return biPlatformRealDataMapper.queryVehicles(); return biPlatformRealDataMapper.queryVehicles();
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】查询作业车辆列表失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList(); return java.util.Collections.emptyList();
} }
} }
@@ -46,6 +49,7 @@ public class BiPlatformRealDataService {
if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L); if (po.getOperatingPlatforms() == null) po.setOperatingPlatforms(0L);
return po; return po;
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】查询月台概览失败: {}", e.getMessage(), e);
RealPlatformOverviewPO po = new RealPlatformOverviewPO(); RealPlatformOverviewPO po = new RealPlatformOverviewPO();
po.setTotalPlatforms(0L); po.setTotalPlatforms(0L);
po.setOperatingPlatforms(0L); po.setOperatingPlatforms(0L);
@@ -58,6 +62,7 @@ public class BiPlatformRealDataService {
Long n = biPlatformRealDataMapper.countTodayTasks(); Long n = biPlatformRealDataMapper.countTodayTasks();
return n == null ? 0L : n; return n == null ? 0L : n;
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】统计今日作业任务失败: {}", e.getMessage(), e);
return 0L; return 0L;
} }
} }
@@ -72,6 +77,7 @@ public class BiPlatformRealDataService {
if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L); if (po.getCompletedVehicles() == null) po.setCompletedVehicles(0L);
return po; return po;
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】统计车辆状态失败: {}", e.getMessage(), e);
RealVehicleStatusPO po = new RealVehicleStatusPO(); RealVehicleStatusPO po = new RealVehicleStatusPO();
po.setTodayReservedVehicles(0L); po.setTodayReservedVehicles(0L);
po.setNotCheckedIn(0L); po.setNotCheckedIn(0L);
@@ -86,6 +92,7 @@ public class BiPlatformRealDataService {
Long n = biPlatformRealDataMapper.countMonthTasks(); Long n = biPlatformRealDataMapper.countMonthTasks();
return n == null ? 0L : n; return n == null ? 0L : n;
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】统计本月任务量失败: {}", e.getMessage(), e);
return 0L; return 0L;
} }
} }
@@ -94,6 +101,7 @@ public class BiPlatformRealDataService {
try { try {
return biPlatformRealDataMapper.queryTaskLoadToday(); return biPlatformRealDataMapper.queryTaskLoadToday();
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】统计任务负荷失败: {}", e.getMessage(), e);
return java.util.Collections.emptyList(); return java.util.Collections.emptyList();
} }
} }
@@ -5,30 +5,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper"> <mapper namespace="com.mhd.bi.domain.biPlatformRealData.repository.mapper.BiPlatformRealDataMapper">
<!-- 作业车辆状态列表(vehicles): <!-- 作业车辆状态列表(vehicles):
plateNumber <- qms_main_business.CARNO plateNumber <- qms_main_business.CAR_NO
status <- qms_main_business.FLOWSTATUS status <- qms_main_business.FLOW_STATUS
platformId <- qms_queue_list.WINDOWNAME按主业务的某个窗口关联键关联;此处用 businessNo = windowNo 关联,根据实际表调整 platformId <- qms_main_business.WINDOW_NAME叫号月台,主业务表直接有
platformDuration <- qms_main_business.EXITTIME - ENTRYTIME(分钟) platformDuration <- qms_main_business.EXIT_TIME - ENTRY_TIME(分钟)
appointmentTime <- qms_main_business.CREATE_TIME(创建时间) appointmentTime <- qms_main_business.CREATE_TIME
workFloor <- qms_window_info.PLATFORMFLOOR(按 platformId 关联窗口号 workFloor <- qms_window_info.PLATFORM_FLOOR(按 WINDOW_NAME 关联
注:列名按达梦默认大写规则;若实际为小写,请反馈调整 --> -->
<select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO"> <select id="queryVehicles" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformVehiclePO">
SELECT SELECT
mb.CARNO AS plateNumber, mb.CAR_NO AS plateNumber,
mb.FLOWSTATUS AS status, mb.FLOW_STATUS AS status,
ql.WINDOWNAME AS platformId, mb.WINDOW_NAME AS platformId,
CASE CASE
WHEN mb.EXITTIME IS NOT NULL AND mb.ENTRYTIME IS NOT NULL WHEN mb.EXIT_TIME IS NOT NULL AND mb.ENTRY_TIME IS NOT NULL
THEN CAST((mb.EXITTIME - mb.ENTRYTIME) AS BIGINT) THEN CAST(EXTRACT(MINUTE FROM (mb.EXIT_TIME - mb.ENTRY_TIME))
+ EXTRACT(HOUR FROM (mb.EXIT_TIME - mb.ENTRY_TIME)) * 60 AS BIGINT)
ELSE 0 ELSE 0
END AS platformDuration, END AS platformDuration,
TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime, TO_CHAR(mb.CREATE_TIME, 'YYYY-MM-DD HH24:MI:SS') AS appointmentTime,
wi.PLATFORMFLOOR AS workFloor wi.PLATFORM_FLOOR AS workFloor
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS mb
LEFT JOIN NGWL_TEST_YMS.QMS_QUEUE_LIST ql ON ql.MAIN_BUSINESS_ID = mb.ID LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi
LEFT JOIN NGWL_TEST_YMS.QMS_WINDOW_INFO wi ON wi.WINDOW_NO = ql.WINDOWNAME ON wi.WINDOW_NAME = mb.WINDOW_NAME
WHERE 1=1
AND mb.DEL_FLAG = 1
ORDER BY mb.CREATE_TIME DESC ORDER BY mb.CREATE_TIME DESC
LIMIT 50 LIMIT 50
</select> </select>
@@ -37,49 +36,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO"> <select id="queryPlatformOverview" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealPlatformOverviewPO">
SELECT SELECT
COUNT(1) AS totalPlatforms, COUNT(1) AS totalPlatforms,
SUM(CASE WHEN STATUS = 2 THEN 1 ELSE 0 END) AS operatingPlatforms SUM(CASE WHEN JOB_STATUS = 2 THEN 1 ELSE 0 END) AS operatingPlatforms
FROM NGWL_TEST_YMS.QMS_WINDOW_INFO FROM NGWL_TEST_YMS.QMS_WINDOW_INFO
WHERE DEL_FLAG = 1
</select> </select>
<!-- 今日作业任务:实际进入时间是今日的 --> <!-- 今日作业任务:实际进入时间是今日的 -->
<select id="countTodayTasks" resultType="java.lang.Long"> <select id="countTodayTasks" resultType="java.lang.Long">
SELECT COUNT(1) SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1 WHERE ENTRY_TIME IS NOT NULL
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE) AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
</select> </select>
<!-- 车辆状态统计:今日的统计(按预约申请时间 / 流程状态) --> <!-- 车辆状态统计:今日的统计(按创建时间 / 流程状态) -->
<select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO"> <select id="queryVehicleStatusToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealVehicleStatusPO">
SELECT SELECT
SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles, SUM(CASE WHEN TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS todayReservedVehicles,
SUM(CASE WHEN FLOWSTATUS = '已预约' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn, SUM(CASE WHEN FLOW_STATUS = '已预约' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS notCheckedIn,
SUM(CASE WHEN FLOWSTATUS IN ('已进场','已称重','已装车','二次称重','已结算','已还卡') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles, SUM(CASE WHEN FLOW_STATUS IN ('已进场','已称重','已装车','二次称重','已结算','已还卡') AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS operatingVehicles,
SUM(CASE WHEN FLOWSTATUS = '已出场' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles SUM(CASE WHEN FLOW_STATUS = '已出场' AND TRUNC(CREATE_TIME) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS completedVehicles
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1
</select> </select>
<!-- 本月任务量:实际进入时间是本月的 --> <!-- 本月任务量:实际进入时间是本月的 -->
<select id="countMonthTasks" resultType="java.lang.Long"> <select id="countMonthTasks" resultType="java.lang.Long">
SELECT COUNT(1) SELECT COUNT(1)
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1 WHERE ENTRY_TIME IS NOT NULL
AND ENTRYTIME IS NOT NULL AND TO_CHAR(ENTRY_TIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
AND TO_CHAR(ENTRYTIME, 'YYYY-MM') = TO_CHAR(SYSDATE, 'YYYY-MM')
</select> </select>
<!-- 任务负荷(今日 24 小时时段):按 HOUR(ENTRYTIME) 统计 --> <!-- 任务负荷(今日 24 小时时段):按 EXTRACT(HOUR FROM ENTRY_TIME) 统计 -->
<select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO"> <select id="queryTaskLoadToday" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealTaskLoadPO">
SELECT SELECT
HOUR(ENTRYTIME) AS hourOfDay, EXTRACT(HOUR FROM ENTRY_TIME) AS hourOfDay,
COUNT(1) AS taskCount COUNT(1) AS taskCount
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
WHERE DEL_FLAG = 1 WHERE ENTRY_TIME IS NOT NULL
AND ENTRYTIME IS NOT NULL AND TRUNC(ENTRY_TIME) = TRUNC(SYSDATE)
AND TRUNC(ENTRYTIME) = TRUNC(SYSDATE) GROUP BY EXTRACT(HOUR FROM ENTRY_TIME)
GROUP BY HOUR(ENTRYTIME) ORDER BY EXTRACT(HOUR FROM ENTRY_TIME)
ORDER BY HOUR(ENTRYTIME)
</select> </select>
</mapper> </mapper>