Merge branch 'dev' into dev-bms-260826
This commit is contained in:
+1
-1
@@ -41,7 +41,7 @@ public interface BiPlatformRealDataMapper {
|
|||||||
/** 任务负荷(今日 24 小时) */
|
/** 任务负荷(今日 24 小时) */
|
||||||
List<RealTaskLoadPO> queryTaskLoadToday();
|
List<RealTaskLoadPO> queryTaskLoadToday();
|
||||||
|
|
||||||
/** 今日预约-租户统计(按 tenantName 分组统计今日预约数量) */
|
/** 今日预约-业务类型统计(按 businessName 分组统计今日预约数量) */
|
||||||
List<RealBusinessTypeStatPO> queryTodayBusinessTypeStats();
|
List<RealBusinessTypeStatPO> queryTodayBusinessTypeStats();
|
||||||
|
|
||||||
/** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */
|
/** 今日作业准时率统计(total 今日预约总数;onTimeCount 今日准时车辆数) */
|
||||||
|
|||||||
+4
-4
@@ -5,15 +5,15 @@ import lombok.Data;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 今日预约-租户统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS)
|
* 今日预约-业务类型统计(真实数据,来自 TEST_NGWL_YMS.QMS_MAIN_BUSINESS)
|
||||||
* 按租户名称分组统计今日预约数量
|
* 按业务类型分组统计今日预约数量
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class RealBusinessTypeStatPO implements Serializable {
|
public class RealBusinessTypeStatPO implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
/** 租户名称(qms_main_business.tenantName) */
|
/** 业务类型名称(qms_main_business.businessName) */
|
||||||
private String tenantName;
|
private String businessName;
|
||||||
|
|
||||||
/** 今日预约数量 */
|
/** 今日预约数量 */
|
||||||
private Long count;
|
private Long count;
|
||||||
|
|||||||
+8
-9
@@ -194,10 +194,9 @@ public class BiPlatformRealDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 今日作业准时率 = 准时车辆数 / 今日预约车辆总数 × 100%
|
* 今日作业准时率 = 今日准时车辆数 / 今日有入场时间的车辆数 × 100%(四舍五入取整)
|
||||||
* 准时:今日(TARGET_DATE=今天)已进场且实际进场时间不超过该预约的预约结束时间 bookingEndTime;
|
* 准时:实际进入时间 < 预约日期(TARGET_DATE) + 预约结束时间(BOOKING_END_TIME)。
|
||||||
* 实际进场时间超过 bookingEndTime 视为不准时。
|
* 分子分母都只统计有入场时间(ENTRY_TIME 不为空)的车辆;分母为 0 时返回 0。
|
||||||
* 今日预约总数为 0 时返回 0。
|
|
||||||
*/
|
*/
|
||||||
public int calcTodayOnTimeRate() {
|
public int calcTodayOnTimeRate() {
|
||||||
try {
|
try {
|
||||||
@@ -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);
|
||||||
@@ -307,14 +306,14 @@ public class BiPlatformRealDataService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 今日预约-租户统计:按租户名称分组统计今日预约数量。
|
* 今日预约-业务类型统计:按业务类型分组统计今日预约数量。
|
||||||
* 例:今日预约某租户 3 条 → 返回 {tenantName:"某租户", count:3}
|
* 例:今日预约航空打板 3 条 → 返回 {businessName:"航空打板", count:3}
|
||||||
*/
|
*/
|
||||||
public List<RealBusinessTypeStatPO> queryTodayBusinessTypeStats() {
|
public List<RealBusinessTypeStatPO> queryTodayBusinessTypeStats() {
|
||||||
try {
|
try {
|
||||||
return biPlatformRealDataMapper.queryTodayBusinessTypeStats();
|
return biPlatformRealDataMapper.queryTodayBusinessTypeStats();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("【YMS】统计今日租户预约失败: {}", e.getMessage(), e);
|
log.error("【YMS】统计今日业务类型失败: {}", e.getMessage(), e);
|
||||||
return java.util.Collections.emptyList();
|
return java.util.Collections.emptyList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -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());
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-3
@@ -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());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,9 +122,9 @@ public class BiReportApi extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 今日预约-租户统计(实时查 YMS 库,不落库)
|
* 今日预约-业务类型统计(实时查 YMS 库,不落库)
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "今日预约租户统计", notes = "按租户名称分组统计今日预约数量,实时查询 YMS 库,不落库;例:某租户 3 条")
|
@ApiOperation(value = "今日预约业务类型统计", notes = "按业务类型分组统计今日预约数量,实时查询 YMS 库,不落库;例:航空打板 3 条")
|
||||||
@GetMapping("/businessTypeStats")
|
@GetMapping("/businessTypeStats")
|
||||||
public BiApiResult<List<RealBusinessTypeStatPO>> businessTypeStats() {
|
public BiApiResult<List<RealBusinessTypeStatPO>> businessTypeStats() {
|
||||||
List<RealBusinessTypeStatPO> data = biPlatformRealDataService.queryTodayBusinessTypeStats();
|
List<RealBusinessTypeStatPO> data = biPlatformRealDataService.queryTodayBusinessTypeStats();
|
||||||
|
|||||||
@@ -19,14 +19,14 @@ spring:
|
|||||||
# username: nacos
|
# username: nacos
|
||||||
# password: manhuoda@2023
|
# password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
server-addr: 10.102.192.30:6848
|
server-addr: 10.102.192.31:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
config:
|
config:
|
||||||
# server-addr: 127.0.0.1:8848
|
# server-addr: 127.0.0.1:8848
|
||||||
# 线上测试环境配置 容器名+端口号
|
# 线上测试环境配置 容器名+端口号
|
||||||
# server-addr: 10.33.0.129:6010
|
# server-addr: 10.33.0.129:6010
|
||||||
server-addr: 10.102.192.30:6848
|
server-addr: 10.102.192.31:6848
|
||||||
username: nacos
|
username: nacos
|
||||||
password: manhuoda@2023
|
password: manhuoda@2023
|
||||||
#线上正式环境
|
#线上正式环境
|
||||||
|
|||||||
@@ -49,17 +49,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 今日作业准时率统计:
|
<!-- 今日作业准时率统计:
|
||||||
total 今日预约总车辆数(TARGET_DATE = 今天)
|
total 今日有入场时间的预约车辆数(ENTRY_TIME 不为空 且 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 ENTRY_TIME IS NOT NULL
|
||||||
|
AND 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 <= BOOKING_END_TIME
|
AND ENTRY_TIME < 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>
|
||||||
@@ -111,15 +114,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 今日预约-租户统计:按 TENANT_NAME(租户名称)分组统计今日预约数量,按预约日期 TARGET_DATE 过滤 -->
|
<!-- 今日预约-业务类型统计:按 BUSINESS_NAME(业务类型名称)分组统计今日预约数量,按预约日期 TARGET_DATE 过滤 -->
|
||||||
<select id="queryTodayBusinessTypeStats" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO">
|
<select id="queryTodayBusinessTypeStats" resultType="com.mhd.bi.domain.biPlatformRealData.repository.po.RealBusinessTypeStatPO">
|
||||||
SELECT
|
SELECT
|
||||||
TENANT_NAME AS tenantName,
|
BUSINESS_NAME AS businessName,
|
||||||
COUNT(1) AS count
|
COUNT(1) AS count
|
||||||
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
FROM NGWL_TEST_YMS.QMS_MAIN_BUSINESS
|
||||||
WHERE TENANT_NAME IS NOT NULL
|
WHERE BUSINESS_NAME IS NOT NULL
|
||||||
AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE)
|
AND TRUNC(TARGET_DATE) = TRUNC(SYSDATE)
|
||||||
GROUP BY TENANT_NAME
|
GROUP BY BUSINESS_NAME
|
||||||
ORDER BY COUNT(1) DESC
|
ORDER BY COUNT(1) DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user