Browse Source

1.修改应用事件相关bean类数值。

master
wangwanlei 11 months ago
parent
commit
15cccfea4c

+ 17
- 15
app/src/main/java/com/xhly/manageapp/bean/EventLog.kt View File

@@ -4,62 +4,64 @@ object EventLog {
4 4
     /**
5 5
      * 更换SIM卡
6 6
      */
7
-    const val SIMEVENT = 1
7
+    const val SIMEVENT = 101
8 8
 
9 9
     /**
10 10
      * 违规开启蓝牙
11 11
      */
12
-    const val BLUETOOHEVENT = 2
12
+    const val BLUETOOHEVENT = 102
13 13
 
14 14
 
15 15
     /**
16 16
      * USB连接电脑
17 17
      */
18
-    const val USBCONNECTEVENT = 3
18
+    const val USBCONNECTEVENT = 103
19 19
 
20 20
     /**
21 21
      *  USB断开电脑
22 22
      */
23
-    const val USBDISCONNECTEVENT = 4
23
+    const val USBDISCONNECTEVENT = 104
24 24
 
25 25
     /**
26 26
      * 插入SD卡
27 27
      */
28
-    const val SDEMOUNTEDVENT = 5
28
+    const val SDEMOUNTEDVENT = 105
29 29
 
30 30
     /**
31 31
      * 拔出SD卡
32 32
      */
33
-    const val SDEJECTEVENT = 6
33
+    const val SDEJECTEVENT = 106
34 34
 
35 35
 
36 36
     /**
37 37
      * 账号登录
38 38
      */
39
-    const val ACCOUNTLOGINEVENT = 7
39
+    const val ACCOUNTLOGINEVENT =201
40
+
41
+
42
+    /**
43
+     * 首次使用
44
+     */
45
+    const val FIRSTEVENT = 202
40 46
 
41 47
     /**
42 48
      * 账号退出
43 49
      */
44
-    const val ACCOUNTQUITEVENT = 8
50
+    const val ACCOUNTQUITEVENT = 203
45 51
 
46 52
     /**
47 53
      * 安装应用
48 54
      */
49
-    const val APPINSTALLEVENT = 9
55
+    const val APPINSTALLEVENT = 211
50 56
 
51 57
     /**
52 58
      * 卸载应用
53 59
      */
54
-    const val APPUNINSTALLEVENT = 10
60
+    const val APPUNINSTALLEVENT = 212
55 61
 
56 62
     /**
57 63
      * 启动应用
58 64
      */
59
-    const val STARTAPPEVENT = 11
65
+    const val STARTAPPEVENT = 213
60 66
 
61
-    /**
62
-     * 首次使用
63
-     */
64
-    const val FIRSTEVENT = 12
65 67
 }

+ 2
- 2
app/src/main/java/com/xhly/manageapp/bean/log/LogdOperateBean.kt View File

@@ -7,8 +7,8 @@ class LogdOperateBean {
7 7
     var sn: String = ""
8 8
 
9 9
     /**
10
-     * 事件:1更换SIM卡 2违规开启蓝牙 3USB连接电脑 4USB拔出电脑 5插入SD卡 6拔出SD卡 (1-6为违规)
11
-     * 7账号登录 8账号退出 9安装应用(安装了非应用商店应用违规) 10卸载应用(卸载强制安装应用违规) 11启动应用 12首次使
10
+     * 事件:101更换SIM卡 102违规开启蓝牙 103USB连接电脑 104USB拔出电脑 105插入SD卡 1066拔出SD卡 (1-6为违规)
11
+     * 201账号登录 202首次使用 203账号退出 211安装应用(安装了非应用商店应用违规) 212卸载应用(卸载强制安装应用违规) 213启动应
12 12
      */
13 13
     var doEvent: Int = 0
14 14
 

+ 4
- 3
app/src/main/java/com/xhly/manageapp/bean/strategy/AppTimeManageBean.kt View File

@@ -5,15 +5,16 @@ class AppTimeManageBean {
5 5
     /**
6 6
      * 周几1-7
7 7
      */
8
-    private var week = 1
8
+    var week = 1
9 9
 
10 10
     /**
11 11
      * 开始时间
12 12
      */
13
-    private var starttime: String? = ""
13
+    var starttime: String? = ""
14 14
 
15 15
     /**
16 16
      * 结束时间
17 17
      */
18
-    private var stoptime: String? = ""
18
+    var stoptime: String? = ""
19
+
19 20
 }

+ 2
- 2
corelib/src/main/java/com/xhly/corelib/Const.kt View File

@@ -8,10 +8,10 @@ object Const {
8 8
     //接口地址
9 9
     const val WSURL: String = "wss://mcwstest.xhkjedu.com/ws"
10 10
 
11
-    //标记平板禁用
11
+    //标记平板禁用(来源于socket)
12 12
     const val DISABLEPAD= "DISABLEPAD"
13 13
 
14
-    //标记平板在禁用或者使用的事件
14
+    //标记平板在禁用的事件范围(来源于策略)
15 15
     const val DISABLEPADTIME= "DISABLEPADTIME"
16 16
 
17 17
     //作为存储白名单应用的key

+ 32
- 13
corelib/src/main/java/com/xhly/corelib/utils/baseUtils.kt View File

@@ -1,5 +1,6 @@
1 1
 package com.xhly.corelib.utils
2 2
 
3
+import android.annotation.SuppressLint
3 4
 import android.content.Context
4 5
 import android.graphics.Bitmap
5 6
 import android.graphics.BitmapFactory
@@ -8,6 +9,7 @@ import android.util.Base64
8 9
 import java.lang.reflect.ParameterizedType
9 10
 import java.text.DecimalFormat
10 11
 import java.text.SimpleDateFormat
12
+import java.time.format.DateTimeFormatter
11 13
 import java.util.Calendar
12 14
 import java.util.Date
13 15
 
@@ -47,12 +49,12 @@ fun Long.toFormat(format: String = "yyyy-MM-dd HH:mm:ss"): String {
47 49
 
48 50
 fun String.hourToCurrentDate(formatType: String = "HH:mm:ss"): Date {
49 51
     try {
50
-        var simpleDateFormat = SimpleDateFormat(formatType)
51
-        var parse = simpleDateFormat.parse(this)
52
-        var hours = parse.hours
53
-        var minutes = parse.minutes
54
-        var seconds = parse.seconds
55
-        var calendar = Calendar.getInstance()
52
+        val simpleDateFormat = SimpleDateFormat(formatType)
53
+        val parse = simpleDateFormat.parse(this)
54
+        val hours = parse.hours
55
+        val minutes = parse.minutes
56
+        val seconds = parse.seconds
57
+        val calendar = Calendar.getInstance()
56 58
         calendar.set(Calendar.DAY_OF_MONTH, calendar.get(Calendar.DAY_OF_MONTH))
57 59
         calendar.set(Calendar.HOUR_OF_DAY, hours)
58 60
         calendar.set(Calendar.MINUTE, minutes)
@@ -63,6 +65,22 @@ fun String.hourToCurrentDate(formatType: String = "HH:mm:ss"): Date {
63 65
     }
64 66
 }
65 67
 
68
+fun String.hourToCurrentDateLong(formatType: String = "HH:mm:ss"): Long {
69
+    try {
70
+        val simpleDateFormat = SimpleDateFormat(formatType)
71
+        val parse = simpleDateFormat.parse(this)
72
+        val calendar = Calendar.getInstance()
73
+        val year= calendar.get(Calendar.YEAR)
74
+        val day = calendar.get(Calendar.DAY_OF_YEAR)
75
+        calendar.timeInMillis=parse.time
76
+        calendar.set(Calendar.YEAR,year)
77
+        calendar.set(Calendar.DAY_OF_YEAR,day)
78
+        return calendar.time.time
79
+    } catch (e: Exception) {
80
+        return Date().time
81
+    }
82
+}
83
+
66 84
 fun Date.getBetweenDay(date: Date): String {
67 85
     try {
68 86
         var l = (this.time - date.time) / 1000 / 60 / 60 / 24
@@ -256,19 +274,20 @@ fun Context.getVersionName(): String {
256 274
 }
257 275
 
258 276
 //判断是否是链接
259
-fun String.isUrl():Boolean{
260
-    var rgex="^http(s)?:\\/\\/([\\w-]+\\.)+[\\w-]+(\\/[\\w- .\\/?%&=]*)?".toRegex()
261
-   return  rgex.containsMatchIn(this)
277
+fun String.isUrl(): Boolean {
278
+    var rgex = "^http(s)?:\\/\\/([\\w-]+\\.)+[\\w-]+(\\/[\\w- .\\/?%&=]*)?".toRegex()
279
+    return rgex.containsMatchIn(this)
262 280
 }
281
+
263 282
 //移除标点
264
-fun String.removePunctuation():String{
283
+fun String.removePunctuation(): String {
265 284
     return try {
266
-        if (this.isNotBlank()){
285
+        if (this.isNotBlank()) {
267 286
             this.replace(Regex("[^\\w\\s]"), "")
268
-        }else{
287
+        } else {
269 288
             ""
270 289
         }
271
-    }catch (e:java.lang.Exception){
290
+    } catch (e: java.lang.Exception) {
272 291
         ""
273 292
     }
274 293
 }

Loading…
Cancel
Save