From c6e38b6c66de5f5a8df5b8b2ab03a82c3b605db8 Mon Sep 17 00:00:00 2001
From: wlzboy <66905212@qq.com>
Date: 星期三, 03 十二月 2025 00:48:44 +0800
Subject: [PATCH] feat:优化同步
---
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/VehicleGpsSegmentMileageTask.java | 42 +++++++++++++++++++++++++++++++++++++++++-
1 files changed, 41 insertions(+), 1 deletions(-)
diff --git a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/VehicleGpsSegmentMileageTask.java b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/VehicleGpsSegmentMileageTask.java
index e1713ce..a317652 100644
--- a/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/VehicleGpsSegmentMileageTask.java
+++ b/ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/VehicleGpsSegmentMileageTask.java
@@ -22,6 +22,44 @@
@Autowired
private ISysConfigService configService;
+
+ /**
+ * 鎵цGPS鍒嗘閲岀▼琛ュ伩璁$畻
+ * 妫�鏌ユ渶杩慛澶╁唴鏈澶勭悊鐨凣PS鍧愭爣骞惰繘琛岃ˉ鍋胯绠�
+ * 寤鸿閰嶇疆涓烘瘡澶╂墽琛屼竴娆�,渚嬪鍑屾櫒2鐐�
+ */
+ public void executeCompensationCalculation() {
+ executeCompensationCalculation("7");
+ }
+
+ /**
+ * 鎵цGPS鍒嗘閲岀▼琛ュ伩璁$畻(甯﹀弬鏁�)
+ *
+ * @param params 鍙傛暟瀛楃涓�,鏍煎紡:鍥炴函澶╂暟(濡�:7琛ㄧず鍥炴函7澶�)
+ */
+ public void executeCompensationCalculation(String params) {
+ try {
+ // 瑙f瀽鍙傛暟:鍥炴函澶╂暟
+ int lookbackDays = 7; // 榛樿7澶�
+ if (params != null && !params.trim().isEmpty()) {
+ try {
+ lookbackDays = Integer.parseInt(params.trim());
+ } catch (NumberFormatException e) {
+ logger.warn("鍙傛暟鏍煎紡閿欒,浣跨敤榛樿鍊�7澶�: {}", params);
+ }
+ }
+
+ logger.info("========== 寮�濮嬫墽琛孏PS鍒嗘閲岀▼琛ュ伩璁$畻 - 鍥炴函{}澶� ==========", lookbackDays);
+
+ // 鎵ц琛ュ伩璁$畻
+ int successCount = segmentMileageService.compensateCalculation(lookbackDays);
+
+ logger.info("========== GPS鍒嗘閲岀▼琛ュ伩璁$畻瀹屾垚 - 鎴愬姛澶勭悊 {} 杈嗚溅 ==========", successCount);
+
+ } catch (Exception e) {
+ logger.error("GPS鍒嗘閲岀▼琛ュ伩璁$畻澶辫触", e);
+ }
+ }
/**
* 璁$畻鏈�杩戜竴娈垫椂闂寸殑GPS鍒嗘閲岀▼
@@ -59,12 +97,14 @@
}
}
- // 璁$畻鏃堕棿鑼冨洿
+ // 璁$畻鏃堕棿鑼冨洿锛堝悜鍓嶅洖婧寚瀹氬垎閽熸暟锛�
Calendar cal = Calendar.getInstance();
Date endTime = cal.getTime();
cal.add(Calendar.MINUTE, -minutes);
Date startTime = cal.getTime();
+ // 娉ㄦ剰锛氭鏂规硶鍙绠楁渶杩戞椂闂存鐨勬暟鎹紝鍘嗗彶閬楁紡鏁版嵁鐢辫ˉ鍋挎満鍒跺鐞�
+
logger.info("寮�濮嬭绠桮PS鍒嗘閲岀▼ - 鏃堕棿鑼冨洿: {} 鍒� {}, 鏃堕棿娈甸棿闅�: {}鍒嗛挓",
startTime, endTime, segmentMinutes);
--
Gitblit v1.9.1