zhangzengfei
2020-11-05 cbdaa0559af3b8ae9c8cf8287d30916d5f81ee3c
app/src/main/java/com/basic/security/manager/AlarmManager.java
@@ -75,21 +75,18 @@
            String sdkType = apiModel.get("sdkType");
            if (sdkType != null) {
                apiModel.put("alarmType", apiModel.remove("sdkType"));
                if (sdkType.equals("人脸")) {
                    apiModel.put("property", apiModel.get("gender") + " " + apiModel.get("ageDescription") + " " + apiModel.get("race"));
                    apiModel.put("alarmPerson",
                            apiModel.remove("tableName")+" "+               apiModel.remove("idcard"));
                }
                apiModel.put("property", apiModel.remove("showLabels"));
                apiModel.put("alarmPerson", apiModel.remove("tableName") + " " + apiModel.remove("idcard"));
            }
            apiModel.put("alarmVideo", apiModel.get("videoNum"));
            if (picDate != null) {
                apiModel.put("alarmPicture", apiModel.remove("picDate"));
            }
            apiModel.put("alarmPicture",
                    apiModel.get("picSmUrl")
                    "http://" + apiModel.get("picSmUrl")
            );
            apiModel.put("alarmLargePicture",
                    apiModel.get("picMaxUrl")
                    "http://" + apiModel.get("picMaxUrl")
            );
            apiModel.put(Alarm.picDate, picDate);
            String picAddress = apiModel.get("picAddress");
@@ -135,22 +132,25 @@
                e.printStackTrace();
            }
            if (alarmVideo != null && alarmVideo.startsWith("http:")) {
//            if (alarmVideo != null && alarmVideo.startsWith("http:")) {
            if (alarmVideo != null) {
                alarm.put("alarmVideoValid", "true");
            } else {
                alarm.put("alarmVideoValid", "false");
            }
            if (alarmPicture != null && alarmPicture.startsWith("http:")) {
//            if (alarmPicture != null && alarmPicture.startsWith("http:")) {
            if (alarmPicture != null) {
                alarm.put("alarmPictureValid", "true");
            } else {
                alarm.put("alarmPictureValid", "false");
            }
            if (alarmLargePicture != null && alarmLargePicture.startsWith("http:")) {
//            if (alarmLargePicture != null && alarmLargePicture.startsWith("http:")) {
            if (alarmLargePicture != null) {
                alarm.put("alarmLargePictureValid", "true");
            } else {
                alarm.put("alarmLargePictureValid", "false");
            }
            if (alarmTime < keepStartTime ) {
            if (alarmTime < keepStartTime) {
                alarm.put("canClose", "true");
            } else {
                alarm.put("canClose", "false");
@@ -159,8 +159,10 @@
        }
        return sqliteAlarmList;
    }
    public static Set<String> newAlarmIdSet = new HashSet<>();
    public static Lock newAlarmIdSetLock = new ReentrantLock();
    public static void putNewAlarmIdSet(Map<String, String> newRemoteAlarm) {
        newAlarmIdSetLock.lock();
        try {
@@ -173,6 +175,7 @@
        }
        newAlarmIdSetLock.unlock();
    }
    public static boolean removeNewAlarmIdSet(Map<String, String> alarm) {
        newAlarmIdSetLock.lock();
        boolean success = false;
@@ -200,7 +203,7 @@
                newRemoteAlarm.put("table", "alarm");
                newRemoteAlarm.put("closeAlarm", "false");
                newRemoteAlarm.put("mute", "false");
                newRemoteAlarm.put("createTime", new Date().getTime()+"");
                newRemoteAlarm.put("createTime", new Date().getTime() + "");
                save(newRemoteAlarm);
                putNewAlarmIdSet(newRemoteAlarm);
                savedCount++;
@@ -223,9 +226,11 @@
            e.printStackTrace();
        }
    }
    public static List<Map<String, String>> newSqliteAlarmListBackup = new ArrayList<>();
    public static void updateVideoUrl() {
        HomeFragment homeFragment = ((MainActivity)BaseApplication.getApplication().activity).fragment_home;
        HomeFragment homeFragment = ((MainActivity) BaseApplication.getApplication().activity).fragment_home;
        if (homeFragment == null) {
            return;
        }
@@ -273,7 +278,7 @@
            String id = alarm.get(Alarm.id);
            if (!TextUtils.isEmpty(id)) {
                if (state) {
                    System.out.println("AlarmManager.putAlarmPlaying " + state + " " +id + FrameUtil.getFrames());
                    System.out.println("AlarmManager.putAlarmPlaying " + state + " " + id + FrameUtil.getFrames());
                }
                alarmPlayingMapLock.lock();
                alarmPlayingMap.put(id, state ? Constants.TRUE : Constants.FALSE);