BI月台作业准时率计算

This commit is contained in:
秦鸿展
2026-09-09 22:02:31 +08:00
parent 3907b126d9
commit 0493030620
3 changed files with 10 additions and 12 deletions
@@ -194,9 +194,8 @@ public class BiPlatformRealDataService {
} }
/** /**
* 今日作业准时率 = 准时车辆数 / 今日预约车辆总数 × 100% * 今日作业准时率 = 今日准时车辆数 / 今日预约总数 × 100%(四舍五入取整)
* 准时:今日(TARGET_DATE=今天)已进场且实际进场时间不超过该预约的预约结束时间 bookingEndTime * 准时:实际进入时间 < 预约日期(TARGET_DATE) + 预约结束时间(BOOKING_END_TIME)。
* 实际进场时间超过 bookingEndTime 视为不准时。
* 今日预约总数为 0 时返回 0。 * 今日预约总数为 0 时返回 0。
*/ */
public int calcTodayOnTimeRate() { public int calcTodayOnTimeRate() {
@@ -206,7 +205,7 @@ public class BiPlatformRealDataService {
long total = po.getTotal() == null ? 0L : po.getTotal(); long total = po.getTotal() == null ? 0L : po.getTotal();
long onTime = po.getOnTimeCount() == null ? 0L : po.getOnTimeCount(); long onTime = po.getOnTimeCount() == null ? 0L : po.getOnTimeCount();
if (total <= 0) return 0; if (total <= 0) return 0;
// 四舍五入到整数百分比 // 四舍五入到整数百分比(取整)
return (int) Math.round(((double) onTime / (double) total) * 100.0); return (int) Math.round(((double) onTime / (double) total) * 100.0);
} catch (Exception e) { } catch (Exception e) {
log.error("【YMS】计算今日作业准时率失败: {}", e.getMessage(), e); log.error("【YMS】计算今日作业准时率失败: {}", e.getMessage(), e);
@@ -394,7 +393,7 @@ public class BiPlatformRealDataService {
template.getPlatformOverview().setCurrentOccupancyRate(rate); template.getPlatformOverview().setCurrentOccupancyRate(rate);
template.getPlatformOverview().setTodayTasks(todayTasks); template.getPlatformOverview().setTodayTasks(todayTasks);
// 作业准时率:准时车辆 / 今日预约总数 × 100%(今日总数为 0 时返回 0 // 作业准时率(实际进入时间 < 预约日期+预约结束时间 的车辆 / 今日预约总数 × 100% 取整
if (template.getEfficiencyStatistics() != null) { if (template.getEfficiencyStatistics() != null) {
template.getEfficiencyStatistics().setPlatformOnTimeRate(calcTodayOnTimeRate()); template.getEfficiencyStatistics().setPlatformOnTimeRate(calcTodayOnTimeRate());
} }
@@ -194,9 +194,7 @@ public class BiReportSnapshotSyncService {
template.getPlatformOverview().setCurrentOccupancyRate(rate); template.getPlatformOverview().setCurrentOccupancyRate(rate);
template.getPlatformOverview().setTodayTasks(todayTasks); template.getPlatformOverview().setTodayTasks(todayTasks);
// 作业准时率 = 准时车辆 / 今日预约总数 × 100% // 作业准时率 = 实际进入时间 < 预约日期+预约结束时间 的车辆 / 今日预约总数 × 100%(取整)
// 准时:今日(TARGET_DATE=今天)已进场且 ENTRY_TIME <= bookingEndTime(预约结束时间),超过视为不准时
// 今日预约总数 = 0 时返回 0
if (template.getEfficiencyStatistics() != null) { if (template.getEfficiencyStatistics() != null) {
template.getEfficiencyStatistics().setPlatformOnTimeRate(biPlatformRealDataService.calcTodayOnTimeRate()); template.getEfficiencyStatistics().setPlatformOnTimeRate(biPlatformRealDataService.calcTodayOnTimeRate());
} }
@@ -50,16 +50,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<!-- 今日作业准时率统计: <!-- 今日作业准时率统计:
total 今日预约总车辆数(TARGET_DATE = 今天) total 今日预约总车辆数(TARGET_DATE = 今天)
onTimeCount 今日准时车辆数(已进场且实际进时间不超过该预约的预约结束时间 BOOKING_END_TIME onTimeCount 今日准时车辆数(实际进时间 < 预约日期 + 预约结束时间 BOOKING_END_TIME,即 ENTRY_TIME < TRUNC(TARGET_DATE) + 预约时段结束时分
「准时= 今日(TARGET_DATE=今天)已进场且 ENTRY_TIME <= BOOKING_END_TIME;超过则视为不准时 「准时= 今日准时车辆数 / 今日预约总数 × 100%(四舍五入取整)」
准时率 = onTimeCount / total × 100% BOOKING_END_TIME 存纯时分(如 18:30),故用 TO_DATE 解析后取其时分间隔加到 TARGET_DATE 上
--> -->
<select id="queryTodayOnTimeStats" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealOnTimeStatPO"> <select id="queryTodayOnTimeStats" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealOnTimeStatPO">
SELECT SELECT
SUM(CASE WHEN TARGET_DATE IS NOT NULL AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS total, SUM(CASE WHEN TARGET_DATE IS NOT NULL AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) THEN 1 ELSE 0 END) AS total,
SUM(CASE WHEN ENTRY_TIME IS NOT NULL SUM(CASE WHEN ENTRY_TIME IS NOT NULL
AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE) AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE)
AND ENTRY_TIME &lt;= BOOKING_END_TIME AND ENTRY_TIME &lt; TRUNC(TARGET_DATE)
+ (TO_DATE(BOOKING_END_TIME, 'HH24:MI') - TRUNC(TO_DATE(BOOKING_END_TIME, 'HH24:MI')))
THEN 1 ELSE 0 END) AS onTimeCount THEN 1 ELSE 0 END) AS onTimeCount
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
</select> </select>