任务数据计算参数问题修复。修复无任务数据时未进行位置距离计算的问题。
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Tue Oct 28 13:36:57 HKT 2025
|
||||
#Tue Oct 28 06:06:00 GMT 2025
|
||||
stageCount=16
|
||||
libraryProject=
|
||||
baseVersion=15.0
|
||||
publishVersion=15.0.15
|
||||
buildCount=0
|
||||
buildCount=6
|
||||
baseBetaVersion=15.0.16
|
||||
|
||||
@@ -111,17 +111,15 @@ public class DistanceCalculatorUtil {
|
||||
LogUtils.d(TAG, "传入坐标参数为空,退出函数。");
|
||||
return;
|
||||
}
|
||||
if (mGpsPositionCalculated == null) {
|
||||
mGpsPositionCalculated = currentGpsPosition;
|
||||
LogUtils.d(TAG, "最后计算位置记录为空,现在使用新坐标为初始化。");
|
||||
}
|
||||
|
||||
// 计算频率控制模块
|
||||
//
|
||||
// 计算与最近一次GPS计算的时间间隔
|
||||
long nCalculatedTimeBettween = System.currentTimeMillis() - mLastCalculatedTime;
|
||||
// 计算跳跃距离
|
||||
double jumpDistance = calculateHaversineDistance(mGpsPositionCalculated.getLatitude(), mGpsPositionCalculated.getLongitude(), currentGpsPosition.getLatitude(), currentGpsPosition.getLongitude());
|
||||
double gpsPositionCalculatedLatitude = mGpsPositionCalculated == null ?0.0f: mGpsPositionCalculated.getLatitude();
|
||||
double gpsPositionCalculatedLongitude = mGpsPositionCalculated == null ?0.0f: mGpsPositionCalculated.getLongitude();
|
||||
double jumpDistance = calculateHaversineDistance(gpsPositionCalculatedLatitude, gpsPositionCalculatedLongitude, currentGpsPosition.getLatitude(), currentGpsPosition.getLongitude());
|
||||
if (jumpDistance < mMinjumpDistance) {
|
||||
LogUtils.d(TAG, String.format("checkAllTaskTriggerCondition:跳跃距离%f,小于50米。", jumpDistance));
|
||||
// 跳跃距离小于最小有效跳跃值
|
||||
@@ -132,22 +130,33 @@ public class DistanceCalculatorUtil {
|
||||
}
|
||||
}
|
||||
|
||||
LogUtils.d(TAG, String.format("checkAllTaskTriggerCondition:跳跃距离%f,与上次计算间隔%d,启动任务数据计算。", jumpDistance, nCalculatedTimeBettween));
|
||||
if (mGpsPositionCalculated == null) {
|
||||
mGpsPositionCalculated = currentGpsPosition;
|
||||
LogUtils.d(TAG, "最后计算位置记录为空,现在使用新坐标为初始化。");
|
||||
}
|
||||
|
||||
LogUtils.d(TAG, String.format("checkAllTaskTriggerCondition:跳跃距离%f,与上次计算间隔%d,现在启动任务数据计算。", jumpDistance, nCalculatedTimeBettween));
|
||||
|
||||
// 获取位置任务基础数据
|
||||
MainService mainService = MainService.getInstance(mContext);
|
||||
mPositionList = mainService.getPositionList();
|
||||
mAllTasks = mainService.getAllTasks();
|
||||
|
||||
// 任务为空,跳过校验。
|
||||
if (mPositionList.isEmpty() || mAllTasks.isEmpty()) {
|
||||
LogUtils.d(TAG, "checkAllTaskTriggerCondition:任务数据为空,跳过校验。");
|
||||
// 位置数据为空,跳过校验。
|
||||
if (mPositionList.isEmpty()) {
|
||||
LogUtils.d(TAG, "checkAllTaskTriggerCondition:位置数据为空,跳过距离计算。");
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新所有位置点的位置距离数据
|
||||
refreshRealPositionDistance(currentGpsPosition);
|
||||
|
||||
// 任务数据为空,跳过校验。
|
||||
if (mAllTasks.isEmpty()) {
|
||||
LogUtils.d(TAG, "checkAllTaskTriggerCondition:任务数据为空,跳过任务提醒检查计算。");
|
||||
return;
|
||||
}
|
||||
|
||||
// 迭代器遍历任务(Java 7 安全遍历,避免并发修改异常)
|
||||
Iterator<PositionTaskModel> taskIter = mAllTasks.iterator();
|
||||
while (taskIter.hasNext()) {
|
||||
|
||||
Reference in New Issue
Block a user