zhangzengfei
2020-07-30 512cae0fd797fac428f07d9d955f880e9ee353c1
app/src/main/java/com/basic/security/manager/AlarmManager.java
@@ -76,9 +76,9 @@
            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.get("gender") + " " + apiModel.get("ageDescription") + " " + apiModel.get("race"));
                    apiModel.put("property", apiModel.remove("showLabels"));
                    apiModel.put("alarmPerson", apiModel.remove("tableName") + " " + apiModel.remove("idcard"));
                }
            }
            apiModel.put("alarmVideo", apiModel.get("videoNum"));
@@ -86,10 +86,10 @@
                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 +135,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 +162,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 +178,7 @@
        }
        newAlarmIdSetLock.unlock();
    }
    public static boolean removeNewAlarmIdSet(Map<String, String> alarm) {
        newAlarmIdSetLock.lock();
        boolean success = false;
@@ -200,7 +206,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 +229,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 +281,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);