|  |  |  | 
|---|
|  |  |  | * Date: 2023-11-10 19:52 | 
|---|
|  |  |  | * Description: 读卡界面 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | public class ReadCardAcitivy extends BaseNfcActivity { | 
|---|
|  |  |  | public class ReadCardAcitivy extends QHAloneBaseNfcActivity { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | volatile UserCard userCard; | 
|---|
|  |  |  | ActivityRedCardQhaBinding redCardBinding; | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void onNewIntent(Intent intent) { | 
|---|
|  |  |  | public void onNfcBack(Intent intent) { | 
|---|
|  |  |  | this.intent = intent; | 
|---|
|  |  |  | ProgressDialog.show(this); | 
|---|
|  |  |  | if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { | 
|---|
|  |  |  | readAllData(intent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | super.onNewIntent(intent); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if (!data.isEmpty()) { | 
|---|
|  |  |  | if (!TextUtils.isEmpty(cardNumber)) { | 
|---|
|  |  |  | userCard = UserCard.getBean(data); | 
|---|
|  |  |  | userCard = new UserCard().getBean(data); | 
|---|
|  |  |  | List<UserCardBean> userCardBeans = baseDao.userCardDao().findUserName(cardNumber); | 
|---|
|  |  |  | if (userCardBeans != null && !userCardBeans.isEmpty()) { | 
|---|
|  |  |  | UserCardBean userName = userCardBeans.get(0); | 
|---|
|  |  |  | 
|---|
|  |  |  | userCardStr = HexUtil.spaceHex(userCardStr); | 
|---|
|  |  |  | userCardStr = HexUtil.HighLowHex(userCardStr); | 
|---|
|  |  |  | redCardBinding.readCardTypeTV.setText("当前为管理卡" + "\n\n" | 
|---|
|  |  |  | + "原始卡号:" + userCard); | 
|---|
|  |  |  | + "原始卡号:" + userCardStr); | 
|---|
|  |  |  | if (manageCard.getType()==(byte) 1){ | 
|---|
|  |  |  | //当01时将1扇区0块原管理卡信息改成用户卡内容 | 
|---|
|  |  |  | confirmDialog=new ConfirmDialog(this, "是否确认补卡,该卡将成为新用户卡?并且不要移动卡片", new View.OnClickListener() { | 
|---|
|  |  |  | 
|---|
|  |  |  | managerToUserCard.setArerNumber(Integer.valueOf(adminData.getSerial())); | 
|---|
|  |  |  | managerToUserCard.setDeviceNumberl(Integer.valueOf(adminData.getAddressCode())); | 
|---|
|  |  |  | managerToUserCard.setTotalElectric(manageCard.getTotalElectric()); | 
|---|
|  |  |  | nfcWriteHelper.writeData(managerToUserCard.getZeroBytes(),1,0); | 
|---|
|  |  |  | TipUtil.show(ReadCardAcitivy.this, "补卡成功", () -> ReadCardAcitivy.this.finish()); | 
|---|
|  |  |  | if (nfcWriteHelper.writeData(managerToUserCard.getZeroBytes(),1,0)){ | 
|---|
|  |  |  | TipUtil.show(ReadCardAcitivy.this, "补卡成功", () -> ReadCardAcitivy.this.finish()); | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | TipUtil.show(ReadCardAcitivy.this, "补卡失败,请重新刷卡", () -> ReadCardAcitivy.this.finish()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } catch (Exception e) { | 
|---|
|  |  |  | e.printStackTrace(); | 
|---|
|  |  |  | } | 
|---|