package com.basic.security.manager;
|
|
import com.basic.security.dao.SqliteManager;
|
|
import java.util.Date;
|
|
public class HomeManager extends SqliteManager {
|
|
public static String getTodayEnters() {
|
int TodayEnters = (RealTimeMetricsManager.getTotalEnters() - TodayBeginManager.getTotalEnters());
|
TodayEnters = TodayEnters > 0 ? TodayEnters : 0;
|
return TodayEnters+"";
|
}
|
|
public static String getTodayExits() {
|
int TodayExits = (RealTimeMetricsManager.getTotalExits() - TodayBeginManager.getTotalExits());
|
TodayExits = TodayExits > 0 ? TodayExits : 0;
|
return TodayExits+"";
|
}
|
|
public static String getTodayRemaining() {
|
int subtractResult = Integer.parseInt(getTodayEnters()) - Integer.parseInt(getTodayExits());
|
if (subtractResult < 0) {
|
subtractResult = 0;
|
}
|
int result = (
|
subtractResult
|
+
|
SettingManager.getInitPerson()
|
+
|
SettingManager.getAdjustEnters()
|
);
|
if (result < 0) {
|
result = 0;
|
}
|
return result+"";
|
}
|
|
public static String getTodayRemaining(Date date) {
|
int subtractResult = (RealTimeMetricsManager.getTotalEnters(date) - TodayBeginManager.getTotalEnters(date))
|
-
|
(RealTimeMetricsManager.getTotalExits(date) - TodayBeginManager.getTotalExits(date));
|
if (subtractResult < 0) {
|
subtractResult = 0;
|
}
|
int result = (
|
subtractResult
|
+
|
SettingManager.getInitPerson()
|
+
|
SettingManager.getAdjustEnters()
|
);
|
if (result < 0) {
|
result = 0;
|
}
|
return result+"";
|
}
|
|
public static String getEntersSinceLastClear() {
|
int result = (
|
RealTimeMetricsManager.getTotalEnters()
|
-
|
ClearBeginManager.getTotalEnters()
|
);
|
if (result < 0) {
|
ClearBeginManager.setTotalEnters(RealTimeMetricsManager.getTotalEnters());
|
result = 0;
|
}
|
return result+"";
|
}
|
|
public static String getExitsSinceLastClear() {
|
int result = (
|
RealTimeMetricsManager.getTotalExits()
|
-
|
ClearBeginManager.getTotalExits()
|
);
|
if (result < 0) {
|
ClearBeginManager.setTotalExits(RealTimeMetricsManager.getTotalExits());
|
result = 0;
|
}
|
return result+"";
|
}
|
|
}
|