3377635c83029c376f7e2L205">205

206
    /**
207
     * 获取IPV6地址
208
     */
209
    public String getIPV6() throws SocketException {
210
        String ipv6 = null;
211
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
212
            NetworkInterface intf = en.nextElement();
213
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
214
                InetAddress inetAddress = enumIpAddr.nextElement();
215
                String ipv6s = inetAddress.getHostAddress();
216
                if (ipv6s.contains("::") && ipv6s.contains("%")) {
217
                    ipv6 = ipv6s.substring(0, ipv6s.indexOf("%"));
218
                    if (InetAddressUtils.isIPv6Address(ipv6)) {
219
                        return ipv6;
220
                    }
221
                }
222
            }
223
        }
224
        return null;
225
    }
226
    
227
    /**
228
     * 获取IPV4地址
229
     */
230
    public String getIPV4() throws SocketException {
231
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
232
            NetworkInterface intf = en.nextElement();
233
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
234
                InetAddress inetAddress = enumIpAddr.nextElement();
235
                if (!inetAddress.isLoopbackAddress() && InetAddressUtils.isIPv4Address(inetAddress.getHostAddress())) {
236
                    return inetAddress.getHostAddress().toString();
237
                }
238
            }
239
        }
240
        return null;
241
    }
242

243
       }
1
package com.ai.ipu.mobile.plugin;
2
3
import java.net.InetAddress;
4
import java.net.NetworkInterface;
5
import java.net.SocketException;
6
import java.util.Enumeration;
7
import java.util.TimeZone;
8
9
import org.json.JSONArray;
10
11
import android.content.Context;
12
import android.net.wifi.WifiInfo;
13
import android.net.wifi.WifiManager;
14
import android.provider.Settings;
15
import android.telephony.TelephonyManager;
16
17
import com.ai.ipu.mobile.frame.IIpuMobile;
18
import com.ai.ipu.mobile.frame.plugin.Plugin;
19
import com.ai.ipu.mobile.ui.UiTool;
20
import com.ai.ipu.mobile.util.FuncConstant;
21
import com.ai.ipu.mobile.util.Messages;
22
import com.ailk.common.data.IData;
23
import com.ailk.common.data.impl.DataMap;
24
import com.mashape.relocation.conn.util.InetAddressUtils;
25
26
public class MobileInfo extends Plugin {
27
    public String platform = "Android";
28
29
    public MobileInfo(IIpuMobile ipumobile) {
30
        super(ipumobile);
31
    }
32
33
    public void getTerminalType(JSONArray params) throws Exception {
34
        callback("a");// 终端类型为android
35
    }
36
37
    /**
38
     * 获取系统信息
39
     * 
40
     * @param key
41
     * @return
42
     * @throws Exception
43
     */
44
    public void getSysInfo(JSONArray params) throws Exception {
45
        if (params.length() < 1) {
46
            throw new Exception(Messages.EXCEPTION_PARAM);
47
        }
48
        String key = params.getString(0).toUpperCase();
49
        if (key.equals(FuncConstant.PLATFORM)) {
50
            callback(this.getPlatform());
51
        }
52
        else if (key.equals(FuncConstant.IMEI)) {
53
            callback(this.getImei());
54
        }
55
        else if (key.equals(FuncConstant.UUID)) {
56
            callback(this.getUuid());
57
        }
58
        else if (key.equals(FuncConstant.SIMNUMBER)) {
59
            callback(this.getSimNumber());
60
        }
61
        else if (key.equals(FuncConstant.IMSI)) {
62
            callback(this.getImsi());
63
        }
64
        else if (key.equals(FuncConstant.OSVERSION)) {
65
            callback(this.getOSVersion());
66
        }
67
        else if (key.equals(FuncConstant.SDKVERSION)) {
68
            callback(this.getSDKVersion());
69
        }
70
        else if (key.equals(FuncConstant.TIMEZONEID)) {
71
            callback(this.getTimeZoneID());
72
        }
73
        else if (key.equals(FuncConstant.MODEL)) {
74
            callback(this.getModel());
75
        }
76
        else if (key.equals(FuncConstant.MANUFACTURER)) {
77
            callback(this.getManufacturer());
78
        }
79
        else if (key.equals(FuncConstant.BRAND)) {
80
            callback(this.getBrand());
81
        }
82
        else if (key.equals(FuncConstant.PRODUCTNAME)) {
83
            callback(this.getProductName());
84
        }
85
        else if(key.equals(FuncConstant.STATUSBARHEIGHT)){
86
        	callback(this.getStatusBarHeight());
87
        }
88
        else if (key.equals(FuncConstant.ALL)) {
89
            callback(this.getAll());
90
        }
91
        else {
92
            callback(Messages.NO_INFO);
93
        }
94
    }
95
96
    public String getAll() throws SocketException {
97
        IData data = new DataMap();
98
        data.put(FuncConstant.PLATFORM, this.getPlatform());
99
        data.put(FuncConstant.IMEI, this.getImei());
100
        data.put(FuncConstant.UUID, this.getUuid());
101
        data.put(FuncConstant.SIMNUMBER, this.getSimNumber());
102
        data.put(FuncConstant.IMSI, this.getImsi());
103
        data.put(FuncConstant.OSVERSION, this.getOSVersion());
104
        data.put(FuncConstant.SDKVERSION, this.getSDKVersion());
105
        data.put(FuncConstant.TIMEZONEID, this.getTimeZoneID());
106
        data.put(FuncConstant.MODEL, this.getModel());
107
        data.put(FuncConstant.MANUFACTURER, this.getManufacturer());
108
        data.put(FuncConstant.MAC, this.getMac());
109
        data.put(FuncConstant.IP, this.getIP());
110
        data.put(FuncConstant.IPV6, this.getIPV6());
111
        data.put(FuncConstant.BRAND, this.getBrand());
112
        data.put(FuncConstant.PRODUCTNAME, this.getProductName());
113
        return data.toString();
114
    }
115
116
    public String getPlatform() {
117
        return platform;
118
    }
119
120
    public String getUuid() {
121
        String uuid = Settings.Secure.getString(this.context.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID);
122
        return uuid;
123
    }
124
125
    public String getTelNumber() {
126
        TelephonyManager manager = (TelephonyManager) this.context.getSystemService(Context.TELEPHONY_SERVICE);
127
        return manager.getLine1Number();
128
    }
129
130
    public String getImei() {
131
        TelephonyManager manager = (TelephonyManager) this.context.getSystemService(Context.TELEPHONY_SERVICE);
132
        return manager.getDeviceId();
133
    }
134
135
    public String getSimNumber() {
136
        TelephonyManager manager = (TelephonyManager) this.context.getSystemService(Context.TELEPHONY_SERVICE);
137
        return manager.getSimSerialNumber();
138
    }
139
140
    public String getImsi() {
141
        TelephonyManager manager = (TelephonyManager) this.context.getSystemService(Context.TELEPHONY_SERVICE);
142
        return manager.getSubscriberId();
143
    }
144
145
    public String getOSVersion() {
146
        String osversion = android.os.Build.VERSION.RELEASE;
147
        return osversion;
148
    }
149
150
    public String getSDKVersion() {
151
        String sdkversion = android.os.Build.VERSION.SDK;
152
        return sdkversion;
153
    }
154
155
    public String getTimeZoneID() {
156
        TimeZone tz = TimeZone.getDefault();
157
        return (tz.getID());
158
    }
159
160
    public String getManufacturer() {
161
        String manufacturer = android.os.Build.MANUFACTURER;
162
        return manufacturer;
163
    }
164
165
    public String getBrand() {
166
        String brand = android.os.Build.BRAND;
167
        return brand;
168
    }
169
170
    public String getModel() {
171
        String model = android.os.Build.MODEL;
172
        return model;
173
    }
174
175
    public String getProductName() {
176
        String productname = android.os.Build.PRODUCT;
177
        return productname;
178
    }
179
180
    /***************** network *************************/
181
    public void getNetInfo(JSONArray params) throws Exception {
182
        if (params.length() < 1) {
183
            throw new Exception(Messages.EXCEPTION_PARAM);
184
        }
185
        String key = params.getString(0).toUpperCase();
186
        if (key.equals(FuncConstant.MAC)) {
187
            callback(getMac());
188
        }
189
        else if (key.equals(FuncConstant.IP)) {
190
            callback(getIP());
191
        }
192
        else if (key.equals(FuncConstant.IPV4)) {
193
            callback(getIPV4());
194
        }
195
        else if (key.equals(FuncConstant.IPV6)) {
196
            callback(getIPV6());
197
        }
198
    }
199
200
    public String getMac() {
201
        WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
202
        WifiInfo info = wifi.getConnectionInfo();
203
        return info.getMacAddress();
204
    }
205
206
    public String getIP() throws SocketException {
207
        return getIPV4();
208
    }
209
210
    /**
211
     * 获取IPV6地址
212
     */
213
    public String getIPV6() throws SocketException {
214
        String ipv6 = null;
215
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
216
            NetworkInterface intf = en.nextElement();
217
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
218
                InetAddress inetAddress = enumIpAddr.nextElement();
219
                String ipv6s = inetAddress.getHostAddress();
220
                if (ipv6s.contains("::") && ipv6s.contains("%")) {
221
                    ipv6 = ipv6s.substring(0, ipv6s.indexOf("%"));
222
                    if (InetAddressUtils.isIPv6Address(ipv6)) {
223
                        return ipv6;
224
                    }
225
                }
226
            }
227
        }
228
        return null;
229
    }
230
    
231
    /**
232
     * 获取IPV4地址
233
     */
234
    public String getIPV4() throws SocketException {
235
        for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) {
236
            NetworkInterface intf = en.nextElement();
237
            for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr.hasMoreElements();) {
238
                InetAddress inetAddress = enumIpAddr.nextElement();
239
                if (!inetAddress.isLoopbackAddress() && InetAddressUtils.isIPv4Address(inetAddress.getHostAddress())) {
240
                    return inetAddress.getHostAddress().toString();
241
                }
242
            }
243
               }
244
        return null;
245
    }
246
	
247
	public String getStatusBarHeight(){
248
		return String.valueOf(UiTool.getStatusBarHeight(context));
249
	}
250
251
}

+ 30 - 29
ipu-plugin-basic/src/main/java/com/ai/ipu/mobile/util/FuncConstant.java

@ -1,29 +1,30 @@
1
package com.ai.ipu.mobile.util;
2

3
public class FuncConstant {
4
	public static final String PLATFORM = "PLATFORM";
5
	public static final String IMEI = "IMEI";
6
	public static final String UUID = "UUID";
7
	public static final String SIMNUMBER = "SIMNUMBER";
8
	public static final String IMSI = "IMSI";
9
	public static final String OSVERSION = "OSVERSION";
10
	public static final String SDKVERSION = "SDKVERSION";
11
	public static final String TIMEZONEID = "TIMEZONEID";
12
	public static final String MODEL = "MODEL";
13
	public static final String MANUFACTURER = "MANUFACTURER";
14
	public static final String BRAND = "BRAND";
15
	public static final String PRODUCTNAME = "PRODUCTNAME";
16
	public static final String ALL = "ALL";
17

18
	public static final String MAC = "MAC";
19
	public static final String IP = "IP";
20
	public static final String IPV4 = "IPV4";
21
	public static final String IPV6 = "IPV6";
22
	
23
	public static final String CONTENT = "CONTENT";
24
	public static final String SENDER = "SENDER";
25
	public static final String TIME = "TIME";
26

27
	public static final int APP_FILES = 0;
28
	public static final int SDCARD_APP_FILES = 1;
29
}
1
package com.ai.ipu.mobile.util;
2
3
public class FuncConstant {
4
	public static final String PLATFORM = "PLATFORM";
5
	public static final String IMEI = "IMEI";
6
	public static final String UUID = "UUID";
7
	public static final String SIMNUMBER = "SIMNUMBER";
8
	public static final String IMSI = "IMSI";
9
	public static final String OSVERSION = "OSVERSION";
10
	public static final String SDKVERSION = "SDKVERSION";
11
	public static final String TIMEZONEID = "TIMEZONEID";
12
	public static final String MODEL = "MODEL";
13
	public static final String MANUFACTURER = "MANUFACTURER";
14
	public static final String BRAND = "BRAND";
15
	public static final String PRODUCTNAME = "PRODUCTNAME";
16
	public static final String STATUSBARHEIGHT = "STATUSBARHEIGHT";
17
	public static final String ALL = "ALL";
18
19
	public static final String MAC = "MAC";
20
	public static final String IP = "IP";
21
	public static final String IPV4 = "IPV4";
22
	public static final String IPV6 = "IPV6";
23
	
24
	public static final String CONTENT = "CONTENT";
25
	public static final String SENDER = "SENDER";
26
	public static final String TIME = "TIME";
27
28
	public static final int APP_FILES = 0;
29
	public static final int SDCARD_APP_FILES = 1;
30
}

[FE]进出记录详情页面添加识别方框 · 232317f8d4 - Nuosi Git Service
Explorar el Código

[FE]进出记录详情页面添加识别方框

liuwenxun %!s(int64=4) %!d(string=hace) años
padre
commit
232317f8d4
Se han modificado 1 ficheros con 54 adiciones y 3 borrados
  1. 54 3
      security-protection-platform/src/modules/access/index.vue

+ 54 - 3
security-protection-platform/src/modules/access/index.vue

82
          <div class="detail_item1">
82
          <div class="detail_item1">
83
            <div>抓拍图片</div>
83
            <div>抓拍图片</div>
84
            <div>
84
            <div>
85
              <img :src="rowdata.pictureInfo.fileUrl" alt="" srcset="" style="width:100%;height:100%">
86

85
              <!-- <img :src="rowdata.pictureInfo.fileUrl" alt="" srcset="" style="width:100%;height:100%"> -->
86
              <!--处理图片里的方框-->
87
              <img :src="mainimage" alt="" srcset="" style="width:100%;height:100%">
87
            </div>
88
            </div>
88
          </div>
89
          </div>
89
          <div class="detail_item2">
90
          <div class="detail_item2">
185

186

186
      // }
187
      // }
187
      // 截取后的图片
188
      // 截取后的图片
188
      newimage: ''
189
      newimage: '',
190
      // 详情的主图片
191
      mainimage: ''
189

192

190
    }
193
    }
191
  },
194
  },
215
      // this.rowdata = scope.row
218
      // this.rowdata = scope.row
216
      // console.log(this.rowdata)
219
      // console.log(this.rowdata)
217
      // console.log('id是', scope.row.aiIdenLogId)
220
      // console.log('id是', scope.row.aiIdenLogId)
221
      this.newimage = ''
222
      this.mainimage = ''
218
      var res = await accessapi.getOneInAndOutRecord({ params: { aiIdenLogId: scope.row.aiIdenLogId } })
223
      var res = await accessapi.getOneInAndOutRecord({ params: { aiIdenLogId: scope.row.aiIdenLogId } })
219

224

220
      if (res.data.success) {
225
      if (res.data.success) {
226
        // this.rowdata.alarmInfo.newImg = this.rowdata.pictureInfo.fileUrl
231
        // this.rowdata.alarmInfo.newImg = this.rowdata.pictureInfo.fileUrl
227

232

228
        this.getImage()
233
        this.getImage()
234
        this.getmainimage()
229
        // var loadTimer
235
        // var loadTimer
230
        // var imgObject = new Image()
236
        // var imgObject = new Image()
231
        // imgObject.setAttribute('crossOrigin', 'anonymous')
237
        // imgObject.setAttribute('crossOrigin', 'anonymous')
360
        return true
366
        return true
361
      }
367
      }
362
    },
368
    },
369
    // 处理截图图片
363
    async getImage () {
370
    async getImage () {
364
      var loadTimer
371
      var loadTimer
365
      var imgObject = new Image()
372
      var imgObject = new Image()
392
        // console.log(tnCanvas.toDataURL())
399
        // console.log(tnCanvas.toDataURL())
393
        return tnCanvas.toDataURL()
400
        return tnCanvas.toDataURL()
394
      }
401
      }
402
    },
403

404
    // 处理主图片
405
    async getmainimage () {
406
      var that = this
407

408
      var x = this.rowdata.alarmInfo.face_box[0]
409
      var y = this.rowdata.alarmInfo.face_box[1]
410
      var width = this.rowdata.alarmInfo.face_box[2] - this.rowdata.alarmInfo.face_box[0]
411
      var height = this.rowdata.alarmInfo.face_box[3] - this.rowdata.alarmInfo.face_box[1]
412
      function getBase64Image (img) {
413
        var canvas = document.createElement('canvas')
414
        canvas.width = img.width
415
        canvas.height = img.height
416
        var ctx = canvas.getContext('2d')
417
        ctx.drawImage(img, 0, 0, img.width, img.height)
418
        ctx.beginPath()
419
        ctx.moveTo(x, y)
420
        ctx.lineTo(x + width, y)
421
        ctx.lineTo(x + width, y + height)
422
        ctx.lineTo(x, y + height)
423
        ctx.lineTo(x, y) // 绘制最后一笔使图像闭合
424
        ctx.lineWidth = 5
425
        ctx.strokeStyle = 'red'
426
        ctx.stroke()
427

428
        var dataURL = canvas.toDataURL('image/png') // 可选其他值 image/jpeg
429
        return dataURL
430
      }
431

432
      function main (src, cb) {
433
        var image = new Image()
434
        image.src = src + '?v=' + Math.random() // 处理缓存
435
        image.crossOrigin = '*' // 支持跨域图片
436
        image.onload = function () {
437
          var base64 = getBase64Image(image)
438
          cb && cb(base64)
439
        }
440
      }
441

442
      main(this.rowdata.pictureInfo.fileUrl, function (base64) {
443
        // console.log(base64, '是否成功打印base64')
444
        that.mainimage = base64
445
      })
395
    }
446
    }
396

447

397
  }
448
  }