提交 | 用户 | 时间
|
149dd0
|
1 |
package com.iailab.netsdk.demo.frame.vto; |
H |
2 |
|
|
3 |
import java.awt.BorderLayout; |
|
4 |
import java.awt.EventQueue; |
|
5 |
import java.awt.event.MouseAdapter; |
|
6 |
import java.awt.event.MouseEvent; |
|
7 |
import java.awt.event.WindowAdapter; |
|
8 |
import java.awt.event.WindowEvent; |
|
9 |
|
|
10 |
import javax.swing.*; |
|
11 |
import javax.swing.border.EmptyBorder; |
|
12 |
import javax.swing.border.TitledBorder; |
|
13 |
import javax.swing.table.DefaultTableCellRenderer; |
|
14 |
import javax.swing.table.DefaultTableModel; |
|
15 |
|
|
16 |
import com.sun.jna.Memory; |
|
17 |
import com.sun.jna.Pointer; |
|
18 |
import com.sun.jna.ptr.IntByReference; |
|
19 |
|
|
20 |
import com.iailab.netsdk.common.Base64; |
|
21 |
import com.iailab.netsdk.common.Res; |
|
22 |
import com.iailab.netsdk.demo.module.LoginModule; |
|
23 |
import com.iailab.netsdk.lib.NetSDKLib; |
|
24 |
import com.iailab.netsdk.lib.ToolKits; |
|
25 |
|
7412dd
|
26 |
import static com.iailab.netsdk.lib.NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_ACCESSCTLCARD; |
H |
27 |
import static com.iailab.netsdk.lib.NetSDKLib.NET_DEVSTATE_DEV_RECORDSET_EX; |
149dd0
|
28 |
|
H |
29 |
public class OperateManager extends JDialog { |
|
30 |
|
|
31 |
private NetSDKLib.LLong lFindHandle; |
|
32 |
|
|
33 |
private JPanel contentPane; |
|
34 |
private OperateInfo info; |
|
35 |
private JTextField textField; |
|
36 |
private JTable table; |
|
37 |
private Object[][] data; |
|
38 |
private String[] tableTitle = { |
|
39 |
Res.string().getVTOOperateManagerRecNo(), |
|
40 |
Res.string().getVTOOperateManagerRoomNo(), |
|
41 |
Res.string().getVTOOperateManagerCardNo(), |
|
42 |
Res.string().getVTOOperateManagerFingerPrintData() |
|
43 |
}; |
|
44 |
|
|
45 |
/** |
|
46 |
* Launch the application. |
|
47 |
*/ |
|
48 |
public static void main(String[] args) { |
|
49 |
EventQueue.invokeLater(new Runnable() { |
|
50 |
public void run() { |
|
51 |
try { |
|
52 |
OperateManager dialogManager = new OperateManager(); |
|
53 |
dialogManager.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); |
|
54 |
dialogManager.setVisible(true); |
|
55 |
} catch (Exception e) { |
|
56 |
e.printStackTrace(); |
|
57 |
} |
|
58 |
} |
|
59 |
}); |
|
60 |
} |
|
61 |
|
|
62 |
/** |
|
63 |
* Create the frame. |
|
64 |
*/ |
|
65 |
public OperateManager() { |
|
66 |
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); |
|
67 |
setTitle(Res.string().getVTOOperateManagerTitle()); |
|
68 |
try { |
|
69 |
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); |
|
70 |
} catch (ClassNotFoundException e) { |
|
71 |
e.printStackTrace(); |
|
72 |
} catch (InstantiationException e) { |
|
73 |
e.printStackTrace(); |
|
74 |
} catch (IllegalAccessException e) { |
|
75 |
e.printStackTrace(); |
|
76 |
} catch (UnsupportedLookAndFeelException e) { |
|
77 |
e.printStackTrace(); |
|
78 |
} |
|
79 |
setBounds(100, 100, 547, 414); |
|
80 |
contentPane = new JPanel(); |
|
81 |
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); |
|
82 |
setContentPane(contentPane); |
|
83 |
contentPane.setLayout(null); |
|
84 |
|
|
85 |
JPanel panel = new JPanel(); |
|
86 |
panel.setBorder(new TitledBorder(null, Res.string().getCardInfo(), TitledBorder.LEFT, |
|
87 |
TitledBorder.TOP, null, null)); |
|
88 |
panel.setBounds(0, 10, 328, 356); |
|
89 |
contentPane.add(panel); |
|
90 |
panel.setLayout(new BorderLayout(0, 0)); |
|
91 |
|
|
92 |
JScrollPane scrollPane = new JScrollPane(); |
|
93 |
panel.add(scrollPane, BorderLayout.CENTER); |
|
94 |
data = new Object[0][5]; |
|
95 |
table = tableInit(data, tableTitle); |
|
96 |
scrollPane.setViewportView(table); |
|
97 |
|
|
98 |
JLabel lblNewLabel = new JLabel(Res.string().getVTORealLoadCardNo()); |
|
99 |
lblNewLabel.setBounds(338, 24, 95, 20); |
|
100 |
contentPane.add(lblNewLabel); |
|
101 |
|
|
102 |
textField = new JTextField(); |
|
103 |
textField.setBounds(338, 54, 136, 21); |
|
104 |
contentPane.add(textField); |
|
105 |
textField.setColumns(10); |
|
106 |
|
|
107 |
JButton btnSearch = new JButton(Res.string().getSearch()); |
|
108 |
btnSearch.setBounds(338, 85, 136, 23); |
|
109 |
contentPane.add(btnSearch); |
|
110 |
btnSearch.addMouseListener(new MouseAdapter() { |
|
111 |
@Override |
|
112 |
public void mouseClicked(MouseEvent e) { |
|
113 |
super.mouseClicked(e); |
|
114 |
search(); |
|
115 |
} |
|
116 |
}); |
|
117 |
|
|
118 |
JButton btnAdd = new JButton(Res.string().getAdd()); |
|
119 |
btnAdd.setBounds(338, 138, 136, 23); |
|
120 |
contentPane.add(btnAdd); |
|
121 |
|
|
122 |
btnAdd.addMouseListener(new MouseAdapter() { |
|
123 |
@Override |
|
124 |
public void mouseClicked(MouseEvent e) { |
|
125 |
super.mouseClicked(e); |
|
126 |
if (info == null) { |
|
127 |
info = new OperateInfo(); |
|
128 |
info.addWindowListener(new WindowAdapter() { |
|
129 |
@Override |
|
130 |
public void windowClosed(WindowEvent e) { |
|
131 |
super.windowClosed(e); |
|
132 |
search(); |
|
133 |
} |
|
134 |
}); |
|
135 |
} |
|
136 |
info.setVisible(true); |
|
137 |
//设置卡号可编辑 |
|
138 |
info.setCardNoTextFieldEditEnable(true); |
|
139 |
//设置房间号可编辑 |
|
140 |
info.setRoomNoTextFieldEditEnable(true); |
|
141 |
info.setFocusable(true); |
|
142 |
//新增卡 |
|
143 |
info.receiveData(0, "", "", ""); |
|
144 |
info.clearImage(); |
|
145 |
} |
|
146 |
}); |
|
147 |
JButton btnModify = new JButton(Res.string().getModify()); |
|
148 |
btnModify.setBounds(338, 193, 136, 23); |
|
149 |
contentPane.add(btnModify); |
|
150 |
btnModify.addMouseListener(new MouseAdapter() { |
|
151 |
@Override |
|
152 |
public void mouseClicked(MouseEvent e) { |
|
153 |
super.mouseClicked(e); |
|
154 |
//modify(); |
|
155 |
if (table.getSelectedRowCount() != 1) { |
|
156 |
JOptionPane.showMessageDialog(null, Res.string().getSelectCard(), Res.string().getErrorMessage(), |
|
157 |
JOptionPane.ERROR_MESSAGE); |
|
158 |
return; |
|
159 |
} |
|
160 |
if (table.getSelectedRowCount() == 1) { |
|
161 |
if (info == null) { |
|
162 |
info = new OperateInfo(); |
|
163 |
info.addWindowListener(new WindowAdapter() { |
|
164 |
@Override |
|
165 |
public void windowClosed(WindowEvent e) { |
|
166 |
super.windowClosed(e); |
|
167 |
search(); |
|
168 |
} |
|
169 |
}); |
|
170 |
} |
|
171 |
info.setVisible(true); |
|
172 |
//设置卡号不可编辑 |
|
173 |
info.setCardNoTextFieldEditEnable(false); |
|
174 |
//设置房间号不可编辑 |
|
175 |
info.setRoomNoTextFieldEditEnable(false); |
|
176 |
info.setFocusable(true); |
|
177 |
//修改卡信息 |
|
178 |
/** |
|
179 |
* 设置info的数据 |
|
180 |
*/ |
|
181 |
info.receiveData(1, ((String) table.getModel().getValueAt(table.getSelectedRow(), 1)).trim(), |
|
182 |
((String) table.getModel().getValueAt(table.getSelectedRow(), 2)).trim(), |
|
183 |
((String) table.getModel().getValueAt(table.getSelectedRow(), 3)).trim()); |
|
184 |
//清除人脸缓存数据 |
|
185 |
info.clearImage(); |
|
186 |
info.setVisible(true); |
|
187 |
info.setFocusable(true); |
|
188 |
} |
|
189 |
} |
|
190 |
}); |
|
191 |
|
|
192 |
JButton btnDelete = new JButton(Res.string().getDelete()); |
|
193 |
btnDelete.setBounds(338, 245, 136, 23); |
|
194 |
contentPane.add(btnDelete); |
|
195 |
btnDelete.addMouseListener(new MouseAdapter() { |
|
196 |
@Override |
|
197 |
public void mouseClicked(MouseEvent e) { |
|
198 |
super.mouseClicked(e); |
|
199 |
delete(); |
|
200 |
//更新卡数据显示 |
|
201 |
search(); |
|
202 |
} |
|
203 |
}); |
|
204 |
|
|
205 |
JButton btnClear = new JButton(Res.string().getClear()); |
|
206 |
btnClear.setBounds(338, 303, 136, 23); |
|
207 |
contentPane.add(btnClear); |
|
208 |
btnClear.addMouseListener(new MouseAdapter() { |
|
209 |
@Override |
|
210 |
public void mouseClicked(MouseEvent e) { |
|
211 |
super.mouseClicked(e); |
|
212 |
clear(); |
|
213 |
//更新卡数据显示 |
|
214 |
search(); |
|
215 |
} |
|
216 |
}); |
|
217 |
} |
|
218 |
|
|
219 |
/** |
|
220 |
* 表格初始化 |
|
221 |
* |
|
222 |
* @param data 表格数据 |
|
223 |
* @param columnName 表头名称 |
|
224 |
* @return |
|
225 |
*/ |
|
226 |
public JTable tableInit(Object[][] data, String[] columnName) { |
|
227 |
JTable table; |
|
228 |
DefaultTableModel model; |
|
229 |
model = new DefaultTableModel(data, columnName); |
|
230 |
table = new JTable(model) { |
|
231 |
@Override // 不可编辑 |
|
232 |
public boolean isCellEditable(int row, int column) { |
|
233 |
return false; |
|
234 |
} |
|
235 |
}; |
|
236 |
|
|
237 |
model = (DefaultTableModel) table.getModel(); |
|
238 |
|
|
239 |
/*DefaultTableCellHeaderRenderer titleRender = new DefaultTableCellHeaderRenderer(); |
|
240 |
titleRender.setHorizontalAlignment(JLabel.CENTER); |
|
241 |
table.getTableHeader().setDefaultRenderer(titleRender);*/ |
|
242 |
|
|
243 |
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // 只能选中一行 |
|
244 |
|
|
245 |
// 列表显示居中 |
|
246 |
DefaultTableCellRenderer dCellRenderer = new DefaultTableCellRenderer(); |
|
247 |
dCellRenderer.setHorizontalAlignment(JLabel.CENTER); |
|
248 |
table.setDefaultRenderer(Object.class, dCellRenderer); |
|
249 |
return table; |
|
250 |
} |
|
251 |
|
|
252 |
/** |
|
253 |
* 查询卡数据 |
|
254 |
*/ |
|
255 |
public void search() { |
|
256 |
if (lFindHandle != null && lFindHandle.longValue() != 0) { |
|
257 |
LoginModule.netsdk.CLIENT_FindRecordClose(lFindHandle); |
|
258 |
lFindHandle = null; |
|
259 |
} |
|
260 |
//清除table数据 |
|
261 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
|
262 |
model.setRowCount(0); |
|
263 |
|
|
264 |
//开始查询记录 |
|
265 |
NetSDKLib.NET_IN_FIND_RECORD_PARAM inParam = new NetSDKLib.NET_IN_FIND_RECORD_PARAM(); |
|
266 |
NetSDKLib.NET_OUT_FIND_RECORD_PARAM outParam = new NetSDKLib.NET_OUT_FIND_RECORD_PARAM(); |
|
267 |
//门禁卡 |
|
268 |
inParam.emType = NET_RECORD_ACCESSCTLCARD; |
|
269 |
NetSDKLib.FIND_RECORD_ACCESSCTLCARD_CONDITION condition = new NetSDKLib.FIND_RECORD_ACCESSCTLCARD_CONDITION(); |
|
270 |
if (textField.getText() != null && !textField.getText().equals("")) { |
|
271 |
//卡号非空,为条件查询 |
|
272 |
condition.abCardNo = 1; |
|
273 |
String cardNo = textField.getText(); |
|
274 |
System.arraycopy(cardNo.getBytes(), 0, condition.szCardNo, 0, cardNo.getBytes().length); |
|
275 |
inParam.pQueryCondition = new Memory(condition.size()); |
|
276 |
ToolKits.SetStructDataToPointer(condition, inParam.pQueryCondition, 0); |
|
277 |
} |
|
278 |
|
|
279 |
boolean bRet = LoginModule.netsdk.CLIENT_FindRecord(LoginModule.m_hLoginHandle, inParam, outParam, 10000); |
|
280 |
if (!bRet) { |
|
281 |
JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
282 |
JOptionPane.ERROR_MESSAGE); |
|
283 |
return; |
|
284 |
} |
|
285 |
lFindHandle = outParam.lFindeHandle; |
|
286 |
//Query查询所有数据 |
|
287 |
queryData(); |
|
288 |
//结束查询 |
|
289 |
boolean success = LoginModule.netsdk.CLIENT_FindRecordClose(lFindHandle); |
|
290 |
if (!success) { |
|
291 |
JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
292 |
JOptionPane.ERROR_MESSAGE); |
|
293 |
|
|
294 |
} |
|
295 |
} |
|
296 |
|
|
297 |
/** |
|
298 |
* 循环遍历获取卡数据 |
|
299 |
*/ |
|
300 |
public void queryData() { |
|
301 |
DefaultTableModel model = (DefaultTableModel) table.getModel(); |
|
302 |
while (true) { |
|
303 |
int max = 20; |
|
304 |
//query the next batch of data 查询下一组数据 |
|
305 |
NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM inParam = new NetSDKLib.NET_IN_FIND_NEXT_RECORD_PARAM(); |
|
306 |
NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM outParam = new NetSDKLib.NET_OUT_FIND_NEXT_RECORD_PARAM(); |
|
307 |
|
|
308 |
NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[] cards = new NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD[max]; |
|
309 |
for (int i = 0; i < max; i++) { |
|
310 |
cards[i] = new NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD(); |
|
311 |
} |
|
312 |
|
|
313 |
outParam.pRecordList = new Memory(cards[0].size() * max); |
|
314 |
outParam.nMaxRecordNum = max; |
|
315 |
inParam.lFindeHandle = lFindHandle; |
|
316 |
inParam.nFileCount = max; |
|
317 |
ToolKits.SetStructArrToPointerData(cards, outParam.pRecordList); |
|
318 |
boolean result = LoginModule.netsdk.CLIENT_FindNextRecord(inParam, outParam, 10000); |
|
319 |
//获取数据 |
|
320 |
ToolKits.GetPointerDataToStructArr(outParam.pRecordList, cards); |
|
321 |
NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD card; |
|
322 |
for (int i = 0; i < outParam.nRetRecordNum; i++) { |
|
323 |
//获取到卡数据 |
|
324 |
card = cards[i]; |
|
325 |
//有信息信息,则获取信息数据 |
|
326 |
String fingerPrint = ""; |
|
327 |
card.bEnableExtended = 1; |
|
328 |
card.stuFingerPrintInfoEx.nPacketLen = 2048; |
|
329 |
card.stuFingerPrintInfoEx.pPacketData = new Memory(2048); |
|
330 |
//获取信息信息 |
|
331 |
fingerPrint = getFingerPrint(card); |
|
332 |
|
|
333 |
//更新table数据显示 |
|
334 |
model.addRow(new Object[]{card.nRecNo, new String(card.szUserID).trim(), new String(card.szCardNo).trim(), fingerPrint.trim()}); |
|
335 |
} |
|
336 |
//当前查询数与最大查询数不同,则查询结束 |
|
337 |
if (outParam.nRetRecordNum != outParam.nMaxRecordNum || (outParam.nRetRecordNum == 0 && outParam.nMaxRecordNum == 0)) { |
|
338 |
break; |
|
339 |
} |
|
340 |
} |
|
341 |
|
|
342 |
} |
|
343 |
|
|
344 |
/** |
|
345 |
* 获取信息数据信息 |
|
346 |
* |
|
347 |
* @param card |
|
348 |
* @return |
|
349 |
*/ |
|
350 |
public String getFingerPrint(NetSDKLib.NET_RECORDSET_ACCESS_CTL_CARD card) { |
|
351 |
NetSDKLib.NET_CTRL_RECORDSET_PARAM inp = new NetSDKLib.NET_CTRL_RECORDSET_PARAM(); |
|
352 |
inp.emType = NET_RECORD_ACCESSCTLCARD; |
|
353 |
inp.pBuf = new Memory(card.size()); |
|
354 |
ToolKits.SetStructDataToPointer(card, inp.pBuf, 0); |
|
355 |
inp.nBufLen = card.size(); |
|
356 |
Pointer pointer = new Memory(inp.size()); |
|
357 |
ToolKits.SetStructDataToPointer(inp, pointer, 0); |
|
358 |
boolean re = LoginModule.netsdk.CLIENT_QueryDevState(LoginModule.m_hLoginHandle, NET_DEVSTATE_DEV_RECORDSET_EX, pointer, inp.size(), new IntByReference(0), 5000); |
|
359 |
if (re) { |
|
360 |
//提取信息数据 |
|
361 |
ToolKits.GetPointerDataToStruct(pointer, 0, inp); |
|
362 |
//获取门禁卡信息 |
|
363 |
ToolKits.GetPointerData(inp.pBuf, card); |
|
364 |
byte[] fpData = new byte[card.stuFingerPrintInfoEx.nRealPacketLen]; |
|
365 |
card.stuFingerPrintInfoEx.pPacketData.read(0, fpData, 0, fpData.length); |
|
366 |
//转成base64编码 |
|
367 |
return Base64.getEncoder().encodeToString(fpData); |
|
368 |
|
|
369 |
} else { |
|
370 |
/*JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
371 |
JOptionPane.ERROR_MESSAGE);*/ |
|
372 |
System.out.println("Get Finger print data error.there is no data"); |
|
373 |
} |
|
374 |
return ""; |
|
375 |
} |
|
376 |
|
|
377 |
/** |
|
378 |
* 删除卡相关信息 |
|
379 |
*/ |
|
380 |
public void delete() { |
|
381 |
if (table.getSelectedRowCount() != 1) { |
|
382 |
JOptionPane.showMessageDialog(null, "please select a card", Res.string().getErrorMessage(), |
|
383 |
JOptionPane.ERROR_MESSAGE); |
|
384 |
return; |
|
385 |
} |
|
386 |
int nRecNo = (Integer) table.getModel().getValueAt(table.getSelectedRow(), 0); |
|
387 |
//删除卡 |
|
388 |
if (!deleteCard(nRecNo)) { |
|
389 |
return; |
|
390 |
} |
|
391 |
//删除人脸 |
|
392 |
if (!deleteFaceInfo((String) table.getModel().getValueAt(table.getSelectedRow(), 1))) { |
|
393 |
return; |
|
394 |
} |
|
395 |
} |
|
396 |
|
|
397 |
/** |
|
398 |
* 删除卡信息 |
|
399 |
* |
|
400 |
* @param recNo |
|
401 |
* @return |
|
402 |
*/ |
|
403 |
public boolean deleteCard(int recNo) { |
|
404 |
|
|
405 |
NetSDKLib.NET_CTRL_RECORDSET_PARAM remove = new NetSDKLib.NET_CTRL_RECORDSET_PARAM(); |
|
406 |
remove.emType = NET_RECORD_ACCESSCTLCARD; |
|
407 |
remove.pBuf = new IntByReference(recNo).getPointer(); |
|
408 |
|
|
409 |
remove.write(); |
|
410 |
boolean result = LoginModule.netsdk.CLIENT_ControlDevice(LoginModule.m_hLoginHandle, |
|
411 |
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_REMOVE, remove.getPointer(), 5000); |
|
412 |
remove.read(); |
|
413 |
|
|
414 |
if (!result) { |
|
415 |
JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
416 |
JOptionPane.ERROR_MESSAGE); |
|
417 |
} |
|
418 |
return result; |
|
419 |
} |
|
420 |
|
|
421 |
/** |
|
422 |
* 删除人脸(单个删除) |
|
423 |
* |
|
424 |
* @param userId 用户ID |
|
425 |
*/ |
|
426 |
public boolean deleteFaceInfo(String userId) { |
|
427 |
int emType = NetSDKLib.EM_FACEINFO_OPREATE_TYPE.EM_FACEINFO_OPREATE_REMOVE; |
|
428 |
|
|
429 |
/** |
|
430 |
* 入参 |
|
431 |
*/ |
|
432 |
NetSDKLib.NET_IN_REMOVE_FACE_INFO inRemove = new NetSDKLib.NET_IN_REMOVE_FACE_INFO(); |
|
433 |
|
|
434 |
// 用户ID |
|
435 |
System.arraycopy(userId.getBytes(), 0, inRemove.szUserID, 0, userId.getBytes().length); |
|
436 |
|
|
437 |
/** |
|
438 |
* 出参 |
|
439 |
*/ |
|
440 |
NetSDKLib.NET_OUT_REMOVE_FACE_INFO outRemove = new NetSDKLib.NET_OUT_REMOVE_FACE_INFO(); |
|
441 |
|
|
442 |
inRemove.write(); |
|
443 |
outRemove.write(); |
|
444 |
boolean bRet = LoginModule.netsdk.CLIENT_FaceInfoOpreate(LoginModule.m_hLoginHandle, emType, inRemove.getPointer(), outRemove.getPointer(), 5000); |
|
445 |
inRemove.read(); |
|
446 |
outRemove.read(); |
|
447 |
if (!bRet) { |
|
448 |
JOptionPane.showMessageDialog(null, Res.string().getRemoveCardFaceFailed() + "," + ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
449 |
JOptionPane.ERROR_MESSAGE); |
|
450 |
} |
|
451 |
return bRet; |
|
452 |
} |
|
453 |
|
|
454 |
/** |
|
455 |
* 清除数据 |
|
456 |
*/ |
|
457 |
public void clear() { |
|
458 |
//清空人脸数据 |
|
459 |
if (!clearFace()) { |
|
460 |
return; |
|
461 |
} |
|
462 |
//清空卡信息 |
|
463 |
if (clearCard()) { |
|
464 |
return; |
|
465 |
} |
|
466 |
//重新查询,更新界面 |
|
467 |
search(); |
|
468 |
} |
|
469 |
|
|
470 |
/** |
|
471 |
* 清除人脸(清除所有) |
|
472 |
*/ |
|
473 |
private boolean clearFace() { |
|
474 |
int emType = NetSDKLib.EM_FACEINFO_OPREATE_TYPE.EM_FACEINFO_OPREATE_CLEAR; |
|
475 |
|
|
476 |
/** |
|
477 |
* 入参 |
|
478 |
*/ |
|
479 |
NetSDKLib.NET_IN_CLEAR_FACE_INFO inClear = new NetSDKLib.NET_IN_CLEAR_FACE_INFO(); |
|
480 |
|
|
481 |
/** |
|
482 |
* 出参 |
|
483 |
*/ |
|
484 |
NetSDKLib.NET_OUT_REMOVE_FACE_INFO outClear = new NetSDKLib.NET_OUT_REMOVE_FACE_INFO(); |
|
485 |
|
|
486 |
inClear.write(); |
|
487 |
outClear.write(); |
|
488 |
boolean bRet = LoginModule.netsdk.CLIENT_FaceInfoOpreate(LoginModule.m_hLoginHandle, emType, inClear.getPointer(), outClear.getPointer(), 5000); |
|
489 |
inClear.read(); |
|
490 |
outClear.read(); |
|
491 |
if (!bRet) { |
|
492 |
JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
493 |
JOptionPane.ERROR_MESSAGE); |
|
494 |
} |
|
495 |
return bRet; |
|
496 |
} |
|
497 |
|
|
498 |
/** |
|
499 |
* 清除卡信息 |
|
500 |
* |
|
501 |
* @return |
|
502 |
*/ |
|
503 |
private boolean clearCard() { |
|
504 |
NetSDKLib.NET_CTRL_RECORDSET_PARAM clear = new NetSDKLib.NET_CTRL_RECORDSET_PARAM(); |
|
505 |
clear.emType = NetSDKLib.EM_NET_RECORD_TYPE.NET_RECORD_ACCESSCTLCARD; // 记录集信息类型 |
|
506 |
|
|
507 |
clear.write(); |
|
508 |
boolean result = LoginModule.netsdk.CLIENT_ControlDevice(LoginModule.m_hLoginHandle, |
|
509 |
NetSDKLib.CtrlType.CTRLTYPE_CTRL_RECORDSET_CLEAR, clear.getPointer(), 5000); |
|
510 |
clear.read(); |
|
511 |
if (!result) { |
|
512 |
JOptionPane.showMessageDialog(null, ToolKits.getErrorCodeShow(), Res.string().getErrorMessage(), |
|
513 |
JOptionPane.ERROR_MESSAGE); |
|
514 |
} |
|
515 |
return result; |
|
516 |
} |
|
517 |
|
|
518 |
} |