remove same item of ped item.
authorTrillGates <williamtrillgates@gmail.com>
Tue, 31 Aug 2021 09:32:29 +0000 (17:32 +0800)
committerTrillGates <williamtrillgates@gmail.com>
Tue, 31 Aug 2021 09:32:29 +0000 (17:32 +0800)
app/src/main/java/com/ic/work/hardware/PedBaseRunnable.java

index d9d242d..dfe6471 100644 (file)
@@ -84,23 +84,13 @@ public class PedBaseRunnable {
             //2.去查询数据中是否有记录。
             List<PedEntity> todayPed = queryTimePedEntity(dateTime);
             if (todayPed != null && todayPed.size() > 0) {
-                //3.如果数据中有当天的数据,并更新数据
-                if (ped > 0 && ped > todayPed.get(0).getPedNumber()) {
-                    PedEntity pedEntity = todayPed.get(0);
-                    pedEntity.setPedNumber(ped);
-                    String calorieValue = getCalorieValue(ped);
-                    ICLogger.d("calorieValue ==> " + calorieValue);
-                    ICLogger.d("ped ==> " + ped);
-                    pedEntity.setPedCalorie(calorieValue);
-                    String distanceValue = getDistanceValue(ped);
-                    ICLogger.d("distanceValue ==> " + distanceValue);
-                    pedEntity.setPedDistance(distanceValue);
-                    mPedInjection.updateDBPedDate(pedEntity);
+                //根据日期删除,然后创建即可
+                for (PedEntity pedEntity : todayPed) {
+                    mPedInjection.deletePedEntity(pedEntity.getId());
                 }
-            } else {
-                //直接 插入今天的数据
-                insertDBPedEntity(ped, dateTime, size);
             }
+            //直接 插入今天的数据
+            insertDBPedEntity(ped, dateTime, size);
         }
     }