| | |
| | | # Location of the SDK. This is only used by Gradle. |
| | | # For customization when using a Version Control System, please read the |
| | | # header note. |
| | | #Fri Jul 19 15:11:21 CST 2024 |
| | | sdk.dir=D\:\\android\\sdk |
| | | #Mon Aug 12 12:34:59 CST 2024 |
| | | sdk.dir=D\:\\AndroidStudio\\sdk |
| | |
| | | <activity android:name="com.dayu.qiheonlinelibrary.activity.RegionActivity" /> |
| | | <activity android:name="com.dayu.qiheonlinelibrary.activity.ManagerListActivity" /> |
| | | <activity |
| | | android:name="com.dayu.qiheonlinelibrary.activity.ManagerWriteActivity" |
| | | android:exported="true" |
| | | android:launchMode="singleTop"> |
| | | <intent-filter> |
| | | <action android:name="android.nfc.action.ACTION_NDEF_DISCOVERED" /> |
| | | <category android:name="android.intent.category.DEFAULT" /> |
| | | <data android:mimeType="text/plain" /> |
| | | </intent-filter> |
| | | </activity> |
| | | <activity |
| | | android:name="com.dayu.qiheonlinelibrary.activity.ManagerReadActivity" |
| | | android:exported="true" |
| | | android:launchMode="singleTop"> |
| | |
| | | }); |
| | | } else if (type == BaseCommon.REPLACE_NO_CARD) { |
| | | startNFCActivit(iccardInfoId); |
| | | } else if (type == BaseCommon.REPLACE_HAS_CARD) { |
| | | startNFCActivit(iccardInfoId); |
| | | } |
| | | |
| | | } else { |
| | |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 已关泵补卡 |
| | | * |
| | | * @param iccardInfoId |
| | | */ |
| | | private void startNFCActivit(String iccardInfoId) { |
| | | //直接补卡的方式 |
| | | Intent intent = new Intent(CardSearchActivity.this, NFCWreatActivity.class); |
| | |
| | | CardSearchActivity.this.finish(); |
| | | } |
| | | |
| | | /** |
| | | * 未关泵补卡 |
| | | * |
| | | * @param iccardInfoId |
| | | * @param oldCardNumber |
| | | */ |
| | | private void startManagerActivity(String iccardInfoId, String oldCardNumber) { |
| | | Intent intent = new Intent(CardSearchActivity.this, ManagerReadActivity.class); |
| | | Intent intent = new Intent(CardSearchActivity.this, ManagerWriteActivity.class); |
| | | intent.putExtra("iccardInfoId", iccardInfoId); |
| | | intent.putExtra("replaceType", type); |
| | | intent.putExtra("oldCardNumber", oldCardNumber); |
| | |
| | | intent.putExtra("type", BaseCommon.REPORT_LOSS_CARD); |
| | | startActivity(intent); |
| | | }); |
| | | //补卡写卡 |
| | | homeBinding.homeReplacement.setOnClickListener(v -> { |
| | | replacementDialog = new ChooseReplacementDialog(this, type -> { |
| | | Intent intent = new Intent(HomeActivity.this, UserSearchActivity.class); |
| | |
| | | }); |
| | | replacementDialog.show(); |
| | | }); |
| | | //补卡写卡 |
| | | homeBinding.homeReplacementWrite.setOnClickListener(v -> { |
| | | Intent intent = new Intent(HomeActivity.this, ManagerReadActivity.class); |
| | | intent.putExtra("replaceType", BaseCommon.REPLACE_HAS_CARD); |
| | | startActivity(intent); |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | if (cardData != null) { |
| | | setData(cardData); |
| | | } else { |
| | | binding.electricOldNumber.setText(new ManageCard().getCardData()); |
| | | binding.electricOldNumber.setText(new ManageCard().getUserCard()); |
| | | } |
| | | break; |
| | | case "清零卡": |
| | |
| | | import android.content.Intent; |
| | | import android.nfc.NfcAdapter; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.view.LayoutInflater; |
| | | |
| | | import com.dayu.baselibrary.utils.BaseCommon; |
| | | import com.dayu.baselibrary.utils.TipUtil; |
| | | import com.dayu.qiheonlinelibrary.card.ManageCard; |
| | | import com.dayu.qiheonlinelibrary.QHOnLineApplication; |
| | | import com.dayu.qiheonlinelibrary.bean.CardInfoResult; |
| | | import com.dayu.qiheonlinelibrary.card.ManagerToUserCard; |
| | | import com.dayu.qiheonlinelibrary.databinding.ActivityManagerReadQhlBinding; |
| | | import com.dayu.qiheonlinelibrary.tools.NFCWriteHelper; |
| | | import com.dayu.qiheonlinelibrary.net.ApiManager; |
| | | import com.dayu.qiheonlinelibrary.net.BaseResponse; |
| | | import com.dayu.qiheonlinelibrary.net.subscribers.SubscriberListener; |
| | | import com.dayu.qiheonlinelibrary.tools.NfcReadHelper; |
| | | import com.dayu.qiheonlinelibrary.utils.CardCommon; |
| | | import com.dayu.qiheonlinelibrary.view.ProgressDialog; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * Created by Android Studio. |
| | | * author: zuo |
| | | * Date: 2024-05-09 |
| | | * Time: 11:05 |
| | | * 备注:制作管理卡 |
| | | * Date: 2024-08-12 |
| | | * Time: 20:10 |
| | | * 备注: |
| | | */ |
| | | public class ManagerReadActivity extends BaseNfcActivity { |
| | | |
| | | ActivityManagerReadQhlBinding binding; |
| | | Intent intent; |
| | | |
| | | String oldCardNumber; |
| | | boolean isCreatManagerCard; |
| | | String iccardInfoId; |
| | | String cardNumber; |
| | | |
| | | int type; |
| | | boolean isReadSuccess; |
| | | |
| | | CardInfoResult cardInfoResult; |
| | | ManagerToUserCard managerToUserCard; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | binding = ActivityManagerReadQhlBinding.inflate(LayoutInflater.from(this)); |
| | | setContentView(binding.getRoot()); |
| | | oldCardNumber = this.getIntent().getStringExtra("oldCardNumber"); |
| | | iccardInfoId = this.getIntent().getStringExtra("iccardInfoId"); |
| | | type = this.getIntent().getIntExtra("replaceType", 0); |
| | | initView(); |
| | | } |
| | | |
| | | private void initView() { |
| | | binding.managerNext.setOnClickListener(v -> { |
| | | if (isCreatManagerCard) { |
| | | if (isReadSuccess) { |
| | | Intent intent = new Intent(ManagerReadActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("iccardInfoId", iccardInfoId); |
| | | intent.putExtra("replaceType", type); |
| | | intent.putExtra("iccardInfoId", cardInfoResult.getIccardInfoId()); |
| | | intent.putExtra("replaceType", BaseCommon.REPLACE_HAS_CARD); |
| | | startActivity(intent); |
| | | } else { |
| | | TipUtil.show("请先制作管理卡"); |
| | | ManagerReadActivity.this.finish(); |
| | | }else { |
| | | TipUtil.show(ManagerReadActivity.this,"请刷管理卡"); |
| | | } |
| | | }); |
| | | } |
| | |
| | | this.intent = intent; |
| | | ProgressDialog.show(this); |
| | | if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { |
| | | getCardNumber(); |
| | | String cardType = NfcReadHelper.getInstence(intent, this).getCradTypeAndCardNumber(); |
| | | |
| | | String[] cardTypes = cardType.split(","); |
| | | if (cardTypes != null && cardTypes.length == 2) { |
| | | cardNumber = cardType.split(",")[0]; |
| | | cardType = cardType.split(",")[1]; |
| | | } |
| | | |
| | | if (CardCommon.MANAGE_CRAD.equalsIgnoreCase(cardType)) { |
| | | managerToUserCard = NfcReadHelper.getInstence(intent, this).getManagerToUserCardData(); |
| | | if (managerToUserCard != null) { |
| | | if (QHOnLineApplication.getInstance().arerNumber.equalsIgnoreCase(String.valueOf(managerToUserCard.getArerNumber()))) { |
| | | getUserInfoAndCardInfo(managerToUserCard.getOldCardNumber()); |
| | | } else { |
| | | TipUtil.show(this, "不是本区域卡!"); |
| | | } |
| | | ProgressDialog.dismiss(); |
| | | } else { |
| | | ProgressDialog.dismiss(); |
| | | TipUtil.show(this, "读卡失败,请重试!"); |
| | | } |
| | | } else { |
| | | ProgressDialog.dismiss(); |
| | | TipUtil.show(this, "当前卡不是管理卡!!!"); |
| | | } |
| | | } |
| | | super.onNewIntent(intent); |
| | | } |
| | | |
| | | |
| | | private void getCardNumber() { |
| | | String cardNumber = NfcReadHelper.getInstence(intent, this).getCardNumber(); |
| | | if (!TextUtils.isEmpty(cardNumber)) { |
| | | ManageCard manageCard = new ManageCard(); |
| | | manageCard.setUserCard(oldCardNumber); |
| | | manageCard.setType((byte) 0); |
| | | if (NFCWriteHelper.getInstence(intent, this).writeData(manageCard.toByte(baseDao), 1, 0)) { |
| | | isCreatManagerCard = true; |
| | | } else { |
| | | isCreatManagerCard = false; |
| | | /** |
| | | * 获取卡信息和用户信息 |
| | | * |
| | | * @param iccardCode |
| | | */ |
| | | public void getUserInfoAndCardInfo(String iccardCode) { |
| | | Map<String, Object> data = new HashMap<>(); |
| | | //ic卡信息id |
| | | data.put("iccardNum", iccardCode); |
| | | ApiManager.getInstance().requestPostLoading(this, "api/sjgg/iccard/peasant/getIccardInfoVoByCardCode", CardInfoResult.class, data, new SubscriberListener<BaseResponse<CardInfoResult>>() { |
| | | @Override |
| | | public void onNext(BaseResponse<CardInfoResult> t) { |
| | | String state = ""; |
| | | if (t.isSuccess()) { |
| | | cardInfoResult = t.getData(); |
| | | isReadSuccess = true; |
| | | TipUtil.show(ManagerReadActivity.this, "读卡成功,下一步将写卡!", () -> { |
| | | Intent intent = new Intent(ManagerReadActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("iccardInfoId", cardInfoResult.getIccardInfoId()); |
| | | intent.putExtra("replaceType", BaseCommon.REPLACE_HAS_CARD); |
| | | startActivity(intent); |
| | | ManagerReadActivity.this.finish(); |
| | | }); |
| | | } |
| | | } |
| | | ProgressDialog.dismiss(); |
| | | TipUtil.show(this,"管理卡制卡成功,请在控制器端刷卡"); |
| | | } else { |
| | | TipUtil.show(this, "未读取到新卡卡号,请重新贴卡"); |
| | | } |
| | | }); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dayu.qiheonlinelibrary.activity; |
| | | |
| | | import android.content.Intent; |
| | | import android.nfc.NfcAdapter; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.view.KeyEvent; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | |
| | | import com.dayu.baselibrary.utils.BaseCommon; |
| | | import com.dayu.baselibrary.utils.TipUtil; |
| | | import com.dayu.baselibrary.view.ConfirmDialog; |
| | | import com.dayu.qiheonlinelibrary.QHOnLineApplication; |
| | | import com.dayu.qiheonlinelibrary.card.ManageCard; |
| | | import com.dayu.qiheonlinelibrary.card.ManagerToUserCard; |
| | | import com.dayu.qiheonlinelibrary.databinding.ActivityManagerReadQhlBinding; |
| | | import com.dayu.qiheonlinelibrary.databinding.ActivityManagerWriteQhlBinding; |
| | | import com.dayu.qiheonlinelibrary.tools.NFCWriteHelper; |
| | | import com.dayu.qiheonlinelibrary.tools.NfcReadHelper; |
| | | import com.dayu.qiheonlinelibrary.utils.CardCommon; |
| | | import com.dayu.qiheonlinelibrary.view.ProgressDialog; |
| | | |
| | | |
| | | /** |
| | | * author: zuo |
| | | * Date: 2024-05-09 |
| | | * Time: 11:05 |
| | | * 备注:制作管理卡 |
| | | */ |
| | | public class ManagerWriteActivity extends BaseNfcActivity { |
| | | |
| | | ActivityManagerWriteQhlBinding binding; |
| | | Intent intent; |
| | | |
| | | String oldCardNumber; |
| | | String cardNumber; |
| | | boolean isCreatManagerCard; |
| | | String iccardInfoId; |
| | | |
| | | //当前步骤 |
| | | int number = 1; |
| | | |
| | | int type; |
| | | ConfirmDialog confirmDialog; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | | binding = ActivityManagerWriteQhlBinding.inflate(LayoutInflater.from(this)); |
| | | setContentView(binding.getRoot()); |
| | | oldCardNumber = this.getIntent().getStringExtra("oldCardNumber"); |
| | | iccardInfoId = this.getIntent().getStringExtra("iccardInfoId"); |
| | | type = this.getIntent().getIntExtra("replaceType", 0); |
| | | binding.managerNext.setOnClickListener(v -> { |
| | | //已完成第二步 |
| | | if (number == 2) { |
| | | if (type == BaseCommon.REPLACE_NO_CARD) { |
| | | Intent intent = new Intent(ManagerWriteActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("iccardInfoId", iccardInfoId); |
| | | intent.putExtra("replaceType", type); |
| | | startActivity(intent); |
| | | ManagerWriteActivity.this.finish(); |
| | | } else { |
| | | TipUtil.show(this, "请在控制器端刷卡后在首页点击泵未关写卡后继续补卡!", () -> { |
| | | ManagerWriteActivity.this.finish(); |
| | | }); |
| | | } |
| | | |
| | | } else { |
| | | TipUtil.show("请先制作管理卡"); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onNewIntent(Intent intent) { |
| | | this.intent = intent; |
| | | ProgressDialog.show(this); |
| | | if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction())) { |
| | | getCardNumber(); |
| | | } |
| | | super.onNewIntent(intent); |
| | | } |
| | | |
| | | |
| | | private void getCardNumber() { |
| | | |
| | | String cardType = NfcReadHelper.getInstence(intent, this).getCradTypeAndCardNumber(); |
| | | |
| | | String[] cardTypes = cardType.split(","); |
| | | if (cardTypes != null && cardTypes.length == 2) { |
| | | cardNumber = cardType.split(",")[0]; |
| | | cardType = cardType.split(",")[1]; |
| | | } |
| | | ManageCard manageCard = new ManageCard(); |
| | | manageCard.setArerNumber(Integer.valueOf(QHOnLineApplication.getInstance().arerNumber)); |
| | | manageCard.setUserCard(oldCardNumber); |
| | | manageCard.setCardWriteState((byte) 0); |
| | | if (NFCWriteHelper.getInstence(intent, this).writeData(manageCard.toByte(baseDao), 1, 0)) { |
| | | isCreatManagerCard = true; |
| | | number = 2; |
| | | binding.number2.setVisibility(View.VISIBLE); |
| | | } else { |
| | | isCreatManagerCard = false; |
| | | } |
| | | |
| | | TipUtil.show(this, "管理卡制卡成功,请在控制器端刷卡"); |
| | | ProgressDialog.dismiss(); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 点击返回时提示用户还未写卡 |
| | | * |
| | | * @param keyCode |
| | | * @param event |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean onKeyDown(int keyCode, KeyEvent event) { |
| | | if (keyCode == KeyEvent.KEYCODE_BACK) { |
| | | back(); |
| | | return true; |
| | | } |
| | | return super.onKeyDown(keyCode, event); |
| | | } |
| | | |
| | | private void back() { |
| | | confirmDialog = new ConfirmDialog(ManagerWriteActivity.this, "正在补卡,确定退出吗?", v -> { |
| | | confirmDialog.dismiss(); |
| | | ManagerWriteActivity.this.finish(); |
| | | }); |
| | | confirmDialog.show(); |
| | | } |
| | | } |
| | |
| | | startActivity(new Intent(MyActivity.this, NewCardListActivity.class)); |
| | | } |
| | | }); |
| | | //开卡记录 |
| | | myBinding.myNewCardOut.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | beginDatePicker.show(System.currentTimeMillis()); |
| | | } |
| | | }); |
| | | //充值记录 |
| | | myBinding.myRechargeOut.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | |
| | | return; |
| | | } |
| | | if (isRechargeList) { |
| | | title = new String[]{"设备序列号", "用户名", "卡号", "充值日期", "充值金额(元)", "剩余金额(元)"}; |
| | | title = new String[]{"设备序列号", "用户名", "卡号", "充值日期", "充值金额(元)", "剩余金额(元)","充值电量(度)","剩余电量(度)","用户编号"}; |
| | | fileName = file.toString() + "/" + ExcelUtil.outRechargePathName; |
| | | } else { |
| | | title = new String[]{"设备序列号", "用户名", "身份证号", "卡号", "注册日期", "电话"}; |
| | | title = new String[]{"设备序列号", "用户名", "身份证号", "卡号", "注册日期", "电话","用户编号"}; |
| | | fileName = file.toString() + "/" + ExcelUtil.outUserPathName; |
| | | } |
| | | ExcelUtil.initExcel(fileName, title); |
| | |
| | | import com.dayu.qiheonlinelibrary.card.DomainCard; |
| | | import com.dayu.qiheonlinelibrary.card.ElectricPriceCard; |
| | | import com.dayu.qiheonlinelibrary.card.ManageCard; |
| | | import com.dayu.qiheonlinelibrary.card.ManagerToUserCard; |
| | | import com.dayu.qiheonlinelibrary.card.PassWordCard; |
| | | import com.dayu.qiheonlinelibrary.card.RegionCard; |
| | | import com.dayu.qiheonlinelibrary.card.RegisteredCard; |
| | |
| | | //补卡工本费用 |
| | | String rechargeCardMoney; |
| | | ReplacementPriceDialog replacementPriceDialog; |
| | | ManagerToUserCard managerToUserCard; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | |
| | | } |
| | | if (this.getIntent().hasExtra("iccardInfoId")) { |
| | | iccardInfoId = this.getIntent().getStringExtra("iccardInfoId"); |
| | | //补卡类型 |
| | | replaceType = this.getIntent().getIntExtra("replaceType", 0); |
| | | replacementPriceDialog = new ReplacementPriceDialog(this, data -> { |
| | | if (TextUtils.isEmpty(data)) { |
| | |
| | | if (rechargeBean != null) { |
| | | data.append("*****************************" + "\n"); |
| | | data.append("设备序列号:" + rechargeBean.getSerial() + "\n"); |
| | | data.append("用户名:" + rechargeBean.getUserName() + "\n"); |
| | | data.append("卡 号:" + rechargeBean.getCardNumber() + "\n"); |
| | | data.append("姓 名:" + rechargeBean.getUserName() + "\n"); |
| | | data.append("卡 号:" + rechargeBean.getCardNumber() + "\n"); |
| | | data.append("用户编号:" + rechargeBean.getUserCode() + "\n"); |
| | | data.append("充值金额:" + rechargeBean.getMorny() + " 元" + "\n"); |
| | | data.append("卡内余额:" + rechargeBean.getBalance() + " 元" + "\n"); |
| | | data.append("日 期:" + DateUtil.dateToStamp(rechargeBean.getRechargeDate(), DateUtil.type2) + "\n\n"); |
| | | data.append("充值电量:" + rechargeBean.getRechargeElectric() + " 度" + "\n"); |
| | | data.append("剩余电量:" + rechargeBean.getRechargeElectric() + " 度" + "\n"); |
| | | data.append("日 期:" + DateUtil.dateToStamp(rechargeBean.getRechargeDate(), DateUtil.type2) + "\n\n"); |
| | | data.append("*****************************"); |
| | | } |
| | | float size = 26; |
| | |
| | | } |
| | | } |
| | | |
| | | private void startDetailActivity(String userName, String statu) { |
| | | private void startDetailActivity(String statu) { |
| | | Intent detail = new Intent(this, RechargeDetailActivity.class); |
| | | detail.putExtra("userName", userName); |
| | | detail.putExtra("statu", statu); |
| | | detail.putExtra("userCard", userCard); |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | detail.putExtra("morny", morny); |
| | | detail.putExtra("rechargeBean", rechargeBean); |
| | | } else { |
| | | detail.putExtra("userCardBean", userCardBean); |
| | | } |
| | | if (!TextUtils.isEmpty(cardNumber)) { |
| | | detail.putExtra("cardNumber", cardNumber); |
| | | } |
| | | |
| | | startActivity(detail); |
| | | if (NewCardActivity.newCardActivity != null) { |
| | | NewCardActivity.newCardActivity.finish(); |
| | |
| | | public void onNext(BaseResponse<LoginResult> t) { |
| | | if (t.isSuccess()) { |
| | | //{"code":"0","msg":"操作成功","data":{"chargeMethod":"","iccardCancelTime":"","lastRechargeTime":"2024-08-05 17:04:15","thisSaleMoney":"","totalRechargeWaterAmount":0.00,"iccardBalanceAmonunt":0.00,"iccardInfoId":"1820385315354320898","iccardProtocolName":"","totalRechargeElectricAmount":0.00,"logicState":1,"username":"","state":1,"familySize":"","yearRechargeMoney":0.00,"thisSaleAmount":"","onlyRechargeMoney":"","identityCard":"","iccardBrand":"","iccardBalanceMoney":0.00,"openOperatorUsername":"","adName":"","rechargeWaterAmount":"","openOperatorUserId":"1816297106145103873","lastSwipeTime":"","address":"","yearCompensateMoney":0.00,"iccardProtocolOpenMoney":"","peasantId":"1820374742679953410","reissueTimes":0,"iccardProtocolReissueMoney":"","iccardProtocolId":"","yearRechargeWaterAmount":0.00,"iccardBalanceElectric":0.00,"iccardStatus":0,"phone":"","lastRechargeMoney":0.00,"iccardOpenTime":"","yearRechargeElectricAmount":0.00,"reissueRechargeRecordId":"","iccardPrice":1.50,"iccardNum":"3714251023011","accountType":0,"equipCode":"","rechargeWaterMoney":"","totalRechargeMoney":0.00,"executeWaterPrice":"","iccardType":1,"iccardCode":"BADA4044"}} |
| | | startDetailActivity(userCardBean.getUserName(), "终端写卡"); |
| | | startDetailActivity("终端写卡"); |
| | | } |
| | | } |
| | | }); |
| | |
| | | } |
| | | // 打印相关 |
| | | setPrinterData(rechargeBean); |
| | | startDetailActivity(rechargeBean.getUserName(), "终端写卡"); |
| | | startDetailActivity("终端写卡"); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 补卡逻辑 |
| | | */ |
| | | private void replaceCard() { |
| | | cardNumber = NfcReadHelper.getInstence(intent, this).getCardNumber(); |
| | | if (replaceType == BaseCommon.REPLACE_NO_CARD) { |
| | | replaceCardPost("", ""); |
| | | } else if (replaceType == BaseCommon.REPLACE_HAS_CARD) { |
| | | managerToUserCard = NfcReadHelper.getInstence(intent, NFCWreatActivity.this).getManagerToUserCardData(); |
| | | //判断是否已经在控制器端刷卡 |
| | | if (managerToUserCard.getCardWriteState() == 1) { |
| | | replaceCardPost(MornyUtil.changeF2Y(managerToUserCard.getBalance()), MornyUtil.changeF2Y(managerToUserCard.getSurplusElecticity())); |
| | | } else { |
| | | TipUtil.show("请在控制器端刷卡"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 补卡 |
| | |
| | | @Override |
| | | public void onNext(BaseResponse<LoginResult> t) { |
| | | if (t.isSuccess()) { |
| | | |
| | | try { |
| | | baseDao.rechargeDao().insert(rechargeBean); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // 打印相关 |
| | | setPrinterData(rechargeBean); |
| | | startDetailActivity(rechargeBean.getUserName(), "终端写卡"); |
| | | TipUtil.show(NFCWreatActivity.this, "补卡成功!", () -> { |
| | | NFCWreatActivity.this.finish(); |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | | * 补卡逻辑 |
| | | */ |
| | | private void replaceCard() { |
| | | cardNumber = NfcReadHelper.getInstence(intent, this).getCardNumber(); |
| | | if (replaceType == BaseCommon.REPLACE_NO_CARD) { |
| | | replaceCardPost("", ""); |
| | | } else if (replaceType == BaseCommon.REPLACE_HAS_CARD) { |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | private void initView() { |
| | | newCardBinding.newCardName.setFilters(new InputFilter[]{new ChineseInputFilter()}); |
| | | // newCardBinding.newCardName.setFilters(new InputFilter[]{new ChineseInputFilter()}); |
| | | newCardBinding.newCardId.setFilters(new InputFilter[]{new AlphaNumericXFilter(), new InputFilter.LengthFilter(18)}); |
| | | //身份证识别 |
| | | newCardBinding.newCardScanBtn.setOnClickListener(new View.OnClickListener() { |
| | |
| | | if (!TextUtils.isEmpty(userName) |
| | | && !TextUtils.isEmpty(phone) && !TextUtils.isEmpty(userID) |
| | | ) { |
| | | if (userName.length() <= 1 || !validateName(userName)) { |
| | | if (userName.length() <= 1) { |
| | | TipUtil.show(NewCardActivity.this, "请输入正确姓名"); |
| | | } else if (phone.length() < 11 || !isValidPhoneNumber(phone)) { |
| | | TipUtil.show(NewCardActivity.this, "请输入正确手机号"); |
| | |
| | | addUser(peasantIdNumber, peasantPhone, peasantName, QHOnLineApplication.getInstance().planId, morny); |
| | | } |
| | | } else { |
| | | startNFCWreatActivity(peasantIdNumber, peasantPhone, peasantName, t.getData().getRecords().get(0).getPeasantId(), morny); |
| | | startNFCWreatActivity(peasantIdNumber, t.getData().getRecords().get(0).getPeasantPhone(), t.getData().getRecords().get(0).getPeasantName(), t.getData().getRecords().get(0).getPeasantId(), morny); |
| | | } |
| | | }else { |
| | | } else { |
| | | ToastUtil.show(t.getMsg()); |
| | | } |
| | | } |
| | |
| | | userCard.setSurplusElecticity(0); |
| | | userCard.setTotalMorny(0); |
| | | userCard.setRechargeDate(Calendar.getInstance()); |
| | | |
| | | userCard.setElectricPrice(Float.valueOf(QHOnLineApplication.getInstance().electriclePriceStr)); |
| | | UserCardBean userCardBean = new UserCardBean(); |
| | | |
| | | userCardBean.setUserName(peasantName); |
| | |
| | | @Override |
| | | public void onNext(BaseResponse<AddUserResult> t) { |
| | | if (t.isSuccess()) { |
| | | startNFCWreatActivity(peasantIdNumber, peasantPhone, peasantName, t.getData().getPeasantId(), morny); |
| | | }else { |
| | | startNFCWreatActivity(peasantIdNumber, t.getData().getPeasantPhone(), t.getData().getPeasantName(), t.getData().getPeasantId(), morny); |
| | | } else { |
| | | ToastUtil.show(t.getMsg()); |
| | | } |
| | | } |
| | |
| | | userCardStr = manageCard.getUserCard().toUpperCase(); |
| | | redCardBinding.readCardTypeTV.setText("当前为管理卡" + "\n\n" |
| | | + "原始卡号:" + userCardStr); |
| | | if (manageCard.getType() == (byte) 1) { |
| | | //当01时将1扇区0块原管理卡信息改成用户卡内容 |
| | | confirmDialog = new ConfirmDialog(this, "是否确认补卡,该卡将成为新用户卡?并且不要移动卡片", new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | ProgressDialog.show(ReadCardAcitivy.this); |
| | | try { |
| | | confirmDialog.dismiss(); |
| | | |
| | | List<UserCardBean> userCardBeans = baseDao.userCardDao().findUserName(userCardStr); |
| | | if (userCardBeans != null && !userCardBeans.isEmpty()) { |
| | | UserCardBean userName = userCardBeans.get(0); |
| | | userName.setCardNumber(cardNumber); |
| | | baseDao.userCardDao().update(userName); |
| | | } |
| | | |
| | | NFCWriteHelper nfcWriteHelper = NFCWriteHelper.getInstence(intent, ReadCardAcitivy.this); |
| | | adminData = baseDao.adminDao().findFirst(); |
| | | ManagerToUserCard managerToUserCard = new ManagerToUserCard(); |
| | | managerToUserCard.setArerNumber(Integer.valueOf(adminData.getSerial())); |
| | | managerToUserCard.setDeviceNumberl(Integer.valueOf(adminData.getAddressCode())); |
| | | managerToUserCard.setTotalElectric(manageCard.getTotalElectric()); |
| | | 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(); |
| | | } |
| | | stopAnim(); |
| | | } |
| | | }); |
| | | confirmDialog.show(); |
| | | } |
| | | break; |
| | | case CardCommon.CLEAN_CARD_TYPE: |
| | | viweGone(false); |
| | |
| | | redCardBinding.redName.setText(cardInfoResult.getPeasantName()); |
| | | redCardBinding.redCardCode.setText(cardNumber); |
| | | redCardBinding.redUserCode.setText(cardInfoResult.getIccardCode()); |
| | | redCardBinding.redBlance.setText(MornyUtil.changeF2Y(userCard.getBalance())+"元"); |
| | | redCardBinding.redElectric.setText(MornyUtil.changeF2Y(userCard.getSurplusElecticity())+"度"); |
| | | redCardBinding.redTotalMorny.setText(MornyUtil.changeF2Y(userCard.getTotalMorny())+"元"); |
| | | redCardBinding.redBlance.setText(MornyUtil.changeF2Y(userCard.getBalance()) + "元"); |
| | | redCardBinding.redElectric.setText(MornyUtil.changeF2Y(userCard.getSurplusElecticity()) + "度"); |
| | | redCardBinding.redTotalMorny.setText(MornyUtil.changeF2Y(userCard.getTotalMorny()) + "元"); |
| | | redCardBinding.redPhone.setText(cardInfoResult.getPeasantPhone()); |
| | | redCardBinding.redCodeId.setText(cardInfoResult.getPeasantIdNumber()); |
| | | if (cardInfoResult.getIccardStatus() == 0) { |
| | |
| | | |
| | | CardInfoResult cardInfoResult; |
| | | |
| | | UserCard mOldUserCard; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | | super.onCreate(savedInstanceState); |
| | |
| | | cardNumber = cardType.split(",")[0]; |
| | | cardType = cardType.split(",")[1]; |
| | | } |
| | | //获取卡内信息 |
| | | mOldUserCard = NfcReadHelper.getInstence(intent, this).getUserCardData(); |
| | | getUserInfoAndCardInfo(cardNumber); |
| | | |
| | | } |
| | |
| | | binding.redStatu.setText(state); |
| | | binding.redInitCode.setText(cardNumber); |
| | | binding.redRechargeDate.setText("本卡最后购水日期:\n\n" + lastRechargeTime); |
| | | binding.redUserCode.setText(cardInfoResult.getIccardCode()); |
| | | if (userCard != null) { |
| | | |
| | | binding.redRemainderBlance.setText(String.valueOf(iccardBalanceMoney) + " 元"); |
| | |
| | | |
| | | |
| | | private void startNfcActivity(String morny, String balance, float rechargeElectric, float iccardBalanceElectric, float totalMorny, String iccardRechargeRecordId) { |
| | | //先处理补扣 |
| | | //充值补扣金额=充值金额+充值前读取的卡内余额-充值回调返回卡内余额 |
| | | int deductionMorny = MornyUtil.changeY2F(morny) + mOldUserCard.getBalance() - MornyUtil.changeY2F(balance); |
| | | |
| | | |
| | | //添加充值信息 |
| | | rechargeBean = new RechargeBean(); |
| | | rechargeBean.setCardNumber(cardNumber); |
| | | rechargeBean.setUserCode(userCard.getUserCode()); |
| | | rechargeBean.setUserName(""); |
| | | rechargeBean.setUserCode(userCard.getUserCode() + userCard.getUserCodeNumber()); |
| | | rechargeBean.setUserName(cardInfoResult.getPeasantName()); |
| | | rechargeBean.setPersonId(cardInfoResult.getPeasantId()); |
| | | rechargeBean.setSerial(DeviceUtils.getSN()); |
| | | rechargeBean.setArerNumber(QHOnLineApplication.getInstance().arerNumber); |
| | |
| | | rechargeBean.setTotalMorny(String.valueOf(totalMorny)); |
| | | rechargeBean.setState(1); |
| | | rechargeBean.setOrderId(iccardRechargeRecordId); |
| | | rechargeBean.setDeductionMorny(MornyUtil.changeF2Y(deductionMorny)); |
| | | |
| | | userCard.setCardWriteState(0); |
| | | userCard.setCardState(1); |
| | |
| | | String sumMorny = MornyUtil.sumPrice(Float.valueOf(MornyUtil.changeF2Y(userCard.getTotalMorny())), Float.valueOf(morny)); |
| | | userCard.setTotalMorny(MornyUtil.changeY2F(sumMorny)); |
| | | userCard.setRechargeDate(calendar); |
| | | userCard.setElectricPrice(Float.valueOf(QHOnLineApplication.getInstance().electriclePriceStr)); |
| | | if (deductionMorny == 0) { |
| | | Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("morny", morny); |
| | | intent.putExtra("userCard", userCard); |
| | | intent.putExtra("rechargeBean", rechargeBean); |
| | | startActivity(intent); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "挂失卡后有补交金额!补交金额为:" + MornyUtil.changeF2Y(deductionMorny) + "元,详情可在平台查询。", new TipUtil.TipListener() { |
| | | @Override |
| | | public void onCancle() { |
| | | Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("morny", morny); |
| | | intent.putExtra("userCard", userCard); |
| | | intent.putExtra("rechargeBean", rechargeBean); |
| | | startActivity(intent); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class); |
| | | intent.putExtra("morny", morny); |
| | | intent.putExtra("userCard", userCard); |
| | | intent.putExtra("rechargeBean", rechargeBean); |
| | | startActivity(intent); |
| | | } |
| | | |
| | | |
| | |
| | | import com.dayu.baselibrary.utils.MornyUtil; |
| | | import com.dayu.qiheonlinelibrary.card.UserCard; |
| | | import com.dayu.qiheonlinelibrary.databinding.ActivityRechargeDetailQhlBinding; |
| | | import com.dayu.qiheonlinelibrary.dbBean.RechargeBean; |
| | | import com.dayu.qiheonlinelibrary.dbBean.UserCardBean; |
| | | |
| | | |
| | | import java.util.Calendar; |
| | |
| | | ActivityRechargeDetailQhlBinding binding; |
| | | UserCard userCard; |
| | | String statu; |
| | | String userName; |
| | | String morny; |
| | | String rechageWater; |
| | | String cardNumber; |
| | | UserCardBean userCardBean; |
| | | RechargeBean rechargeBean; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle savedInstanceState) { |
| | |
| | | try { |
| | | userCard = (UserCard) getIntent().getSerializableExtra("userCard"); |
| | | statu = getIntent().getStringExtra("statu"); |
| | | userName = getIntent().getStringExtra("userName"); |
| | | if (getIntent().hasExtra("morny")) { |
| | | morny = getIntent().getStringExtra("morny"); |
| | | rechageWater = getIntent().getStringExtra("rechageWater"); |
| | | rechargeBean = (RechargeBean) getIntent().getSerializableExtra("rechargeBean"); |
| | | } |
| | | if (getIntent().hasExtra("cardNumber")) { |
| | | cardNumber = getIntent().getStringExtra("cardNumber"); |
| | | if (getIntent().hasExtra("userCardBean")) { |
| | | userCardBean = (UserCardBean) getIntent().getSerializableExtra("userCardBean"); |
| | | } |
| | | setUserData(userName, statu); |
| | | setUserData(statu); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | private void setUserData(String userName, String statu) { |
| | | private void setUserData(String statu) { |
| | | int balance = userCard.getBalance(); |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | binding.tip.setText("充值成功!"); |
| | | balance = userCard.getBalance(); |
| | | binding.redName.setText("姓名:" + rechargeBean.getUserName()); |
| | | binding.redRemainderMorny.setText("充值金额:" + morny + " 元"); |
| | | binding.redRechargeWater.setText("剩余金额:" + MornyUtil.changeF2Y(balance) + " 元"); |
| | | binding.redRechargeBalance.setText("剩余金额:" + MornyUtil.changeF2Y(balance) + " 元"); |
| | | binding.redRechargeElectric.setText("充值电量:" + rechargeBean.getRechargeElectric() + " 度"); |
| | | binding.redSurplusElectric.setText("剩余电量:" + rechargeBean.getSurplusElectic() + " 度"); |
| | | binding.redInitCode.setText("卡号:" + rechargeBean.getCardNumber()); |
| | | binding.redUserCode.setText("用户编号:" + rechargeBean.getUserCode()); |
| | | } else { |
| | | binding.redName.setText("姓名:" + userCardBean.getUserName()); |
| | | binding.tip.setText("开卡成功!"); |
| | | balance = userCard.getBalance(); |
| | | binding.redInitCode.setText("卡号:" + userCardBean.getCardNumber()); |
| | | binding.redUserCode.setText("用户编号:" + userCardBean.getUserCode()); |
| | | binding.redRemainderMorny.setVisibility(View.GONE); |
| | | binding.redRechargeWater.setVisibility(View.GONE); |
| | | binding.redRechargeBalance.setVisibility(View.GONE); |
| | | binding.redRechargeElectric.setVisibility(View.GONE); |
| | | binding.redSurplusElectric.setVisibility(View.GONE); |
| | | } |
| | | binding.redName.setText("用户姓名:" + userName); |
| | | // binding.redRemainderBlance.setText("剩余金额:" + MornyUtil.changeF2Y(balance) + " 元"); |
| | | // binding.redSurplusWater.setText("剩余水量:" + MornyUtil.changeF2Y(userCard.getSurplusWater()) + " 吨"); |
| | | binding.redStatu.setText("卡状态:" + statu); |
| | | if (userCard != null) { |
| | | binding.redInitCode.setText("当前卡号:" + cardNumber); |
| | | Calendar calendar = userCard.getRechargeDate(); |
| | | if (calendar != null) { |
| | | int year = calendar.get(Calendar.YEAR); |
| | | int month = calendar.get(Calendar.MONTH); // 月份从0开始,所以需要加1 |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | |
| | | binding.redRechargeDate.setText("本卡最后购水日期:" + year + month + day); |
| | | } else { |
| | | binding.redRechargeDate.setText("本卡最后购水日期:无"); |
| | | } |
| | | |
| | | // binding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + ""); |
| | | } |
| | | } |
| | | } |
| | |
| | | if (holder instanceof ViewHolder) { |
| | | if (rechargeList.size() > 0) { |
| | | ((ViewHolder) holder).getBinding().userName.setText("用户名:" + rechargeList.get(position).getUserName()); |
| | | // ((ViewHolder) holder).getBinding().cardNumber.setText("卡号:" + rechargeList.get(position).getCardNumber()); |
| | | ((ViewHolder) holder).getBinding().cardNumber.setText("卡号:" + rechargeList.get(position).getCardNumber()); |
| | | ((ViewHolder) holder).getBinding().userNo.setText("身份证号:" + rechargeList.get(position).getUserID()); |
| | | // ((ViewHolder) holder).getBinding().water.setText("电话:" + rechargeList.get(position).getPhone()); |
| | | ((ViewHolder) holder).getBinding().water.setText("电话:" + rechargeList.get(position).getPhone()); |
| | | ((ViewHolder) holder).getBinding().date.setText("日期:" + DateUtil.dateToStamp(rechargeList.get(position).getDate(), DateUtil.type1)); |
| | | } |
| | | } |
| | |
| | | |
| | | public String peasantId; |
| | | |
| | | public String peasantName; |
| | | |
| | | public String peasantPhone; |
| | | |
| | | public String getPeasantPhone() { |
| | | return peasantPhone; |
| | | } |
| | | |
| | | public void setPeasantPhone(String peasantPhone) { |
| | | this.peasantPhone = peasantPhone; |
| | | } |
| | | |
| | | public String getPeasantName() { |
| | | return peasantName; |
| | | } |
| | | |
| | | public void setPeasantName(String peasantName) { |
| | | this.peasantName = peasantName; |
| | | } |
| | | |
| | | public String getPeasantId() { |
| | | return peasantId; |
| | | } |
| | |
| | | */ |
| | | public class ManageCard extends BaseCard implements Serializable { |
| | | public String cardType = CardCommon.MANAGE_CRAD;//卡类型 |
| | | public int arerNumber;//区域号(底位在前高位在后) |
| | | |
| | | public String getCardData() { |
| | | return cardData; |
| | | } |
| | | |
| | | /** |
| | | * M1卡的0扇区0块通常用于存储一些基本的卡片信息 |
| | |
| | | */ |
| | | public String userCard; //用户卡号 |
| | | |
| | | public byte type;//当前状态 00:充值管理机写 01:控制器反写的 当01时将1扇区0块原管理卡信息改成用户卡内容 |
| | | public byte cardWriteState;//当前状态 00:充值管理机写 01:控制器反写的 当01时将1扇区0块原管理卡信息改成用户卡内容 |
| | | |
| | | public int totalElectric;//总用电量位 底位在前,高位在后 1位小数点 含1位小数点的整数 |
| | | |
| | | public int getTotalElectric() { |
| | | return totalElectric; |
| | | public int getArerNumber() { |
| | | return arerNumber; |
| | | } |
| | | |
| | | public byte getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(byte type) { |
| | | this.type = type; |
| | | public void setArerNumber(int arerNumber) { |
| | | this.arerNumber = arerNumber; |
| | | } |
| | | |
| | | public String getUserCard() { |
| | |
| | | this.userCard = userCard; |
| | | } |
| | | |
| | | public byte getCardWriteState() { |
| | | return cardWriteState; |
| | | } |
| | | |
| | | public void setCardWriteState(byte cardWriteState) { |
| | | this.cardWriteState = cardWriteState; |
| | | } |
| | | |
| | | public static ManageCard getBean(List<byte[]> data) { |
| | | |
| | | if (data != null) { |
| | | ManageCard manageCard = new ManageCard(); |
| | | |
| | | byte[] zero = data.get(0); |
| | | byte[] arerNumberByte = new byte[4]; |
| | | System.arraycopy(zero, 1, arerNumberByte, 0, arerNumberByte.length); |
| | | manageCard.arerNumber = HexUtil.get16To10LowHightByBytes(arerNumberByte); |
| | | byte[] passWordByte = new byte[4]; |
| | | System.arraycopy(zero, 5, passWordByte, 0, passWordByte.length); |
| | | manageCard.setUserCard(HexUtil.bytesToHex(passWordByte)); |
| | | manageCard.setType(zero[9]); |
| | | byte[] totalElectricByte = new byte[4]; |
| | | System.arraycopy(zero, 10, totalElectricByte, 0, totalElectricByte.length); |
| | | manageCard.totalElectric = HexUtil.get16To10LowHightByBytes(totalElectricByte); |
| | | manageCard.setCardWriteState(zero[13]); |
| | | return manageCard; |
| | | } |
| | | return null; |
| | |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | |
| | | byte[] cardDataByte = HexUtil.hexToByteArray(cardData); |
| | | System.arraycopy(cardDataByte, 0, data, 1, cardDataByte.length); |
| | | //区域号 |
| | | byte[] arerNumberBytes = new byte[4]; |
| | | byte[] arerNumberDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(arerNumber)); |
| | | System.arraycopy(arerNumberDatas, 0, arerNumberBytes, 0, arerNumberDatas.length); |
| | | if (arerNumberBytes != null) { |
| | | System.arraycopy(arerNumberBytes, 0, data, 1, arerNumberBytes.length); |
| | | } |
| | | |
| | | byte[] userCardByts = HexUtil.hexToByteArray(userCard); |
| | | if (userCard != null) { |
| | | System.arraycopy(userCardByts, 0, data, 5, userCardByts.length); |
| | | } |
| | | |
| | | data[13] = cardWriteState; |
| | | data[15] = getByteSum(data); |
| | | return data; |
| | | } |
| | |
| | | package com.dayu.qiheonlinelibrary.card; |
| | | |
| | | import com.dayu.baselibrary.tools.BcdUtil; |
| | | import com.dayu.baselibrary.tools.HexUtil; |
| | | import com.dayu.qiheonlinelibrary.utils.CardCommon; |
| | | import com.tencent.bugly.crashreport.CrashReport; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * Created by Android Studio. |
| | |
| | | |
| | | public int arerNumber;//区域号(底位在前高位在后) |
| | | |
| | | public int deviceNumberl;//设备编号(底位在前高位在后) |
| | | public short rechargeTimes;//充值次数 |
| | | public String oldCardNumber;//旧卡卡号 |
| | | |
| | | public int totalWater;//用户总用水量 底位在前,高位在后2位小数点 含两个小数点的整数 |
| | | public int cardWriteState;//管理卡返写机制 00:中心写01:控制器返写 |
| | | |
| | | public int totalElectric;//总用电量位 底位在前,高位在后 1位小数点 含1位小数点的整数 |
| | | public int cardState;//现场卡状态 00:旧卡 01:新卡 |
| | | |
| | | public int balance;//剩余金额 底位在前 2位小数点,单位分 |
| | | |
| | | public int surplusElecticity;//剩余电量 底位在前 2位小数点 单位立方米 (跟价格一样先乘以100) |
| | | |
| | | public int totalMorny;//累计充值金额 |
| | | |
| | | public Calendar rechargeDate;// 购水时间 BCD |
| | | |
| | | public Float electricPrice;//电单价,保留三位小数 |
| | | |
| | | /** |
| | | * 通过byte转bean |
| | | * |
| | | * @param data |
| | | */ |
| | | public static ManagerToUserCard getBean(List<byte[]> data) { |
| | | try { |
| | | ManagerToUserCard userCard = new ManagerToUserCard(); |
| | | //第0块解析 |
| | | byte[] zero = data.get(0); |
| | | userCard.cardType = HexUtil.byteToHex(zero[0]); |
| | | |
| | | byte[] arerNumberByte = new byte[4]; |
| | | System.arraycopy(zero, 1, arerNumberByte, 0, arerNumberByte.length); |
| | | userCard.arerNumber = HexUtil.get16To10LowHightByBytes(arerNumberByte); |
| | | |
| | | byte[] oldCardNumberByte = new byte[4]; |
| | | System.arraycopy(zero, 5, oldCardNumberByte, 0, oldCardNumberByte.length); |
| | | userCard.oldCardNumber = HexUtil.bytesToHex(oldCardNumberByte); |
| | | |
| | | byte[] cardWriteState = new byte[1]; |
| | | System.arraycopy(zero, 13, cardWriteState, 0, cardWriteState.length); |
| | | userCard.cardWriteState = HexUtil.get16To10LowHightByBytes(cardWriteState); |
| | | byte[] cardState = new byte[1]; |
| | | System.arraycopy(zero, 14, cardState, 0, cardState.length); |
| | | userCard.cardState = HexUtil.get16To10LowHightByBytes(cardState); |
| | | //第1块解析 |
| | | byte[] one = data.get(1); |
| | | byte[] balanceByte = new byte[4]; |
| | | System.arraycopy(one, 0, balanceByte, 0, balanceByte.length); |
| | | userCard.balance = HexUtil.get16To10LowHightByBytes(balanceByte); |
| | | byte[] surplusWaterByte = new byte[4]; |
| | | System.arraycopy(one, 4, surplusWaterByte, 0, surplusWaterByte.length); |
| | | userCard.surplusElecticity = HexUtil.get16To10LowHightByBytes(surplusWaterByte); |
| | | |
| | | byte[] totalMorny = new byte[4]; |
| | | System.arraycopy(one, 8, totalMorny, 0, totalMorny.length); |
| | | userCard.totalMorny = HexUtil.get16To10LowHightByBytes(totalMorny); |
| | | |
| | | byte[] rechargeDateByte = new byte[3]; |
| | | System.arraycopy(one, 12, rechargeDateByte, 0, rechargeDateByte.length); |
| | | int year = HexUtil.getBcdToInt(one[12]); |
| | | int month = HexUtil.getBcdToInt(one[13]); |
| | | int day = HexUtil.getBcdToInt(one[14]); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(2000 + year, month, day, 0, 0, 0); |
| | | userCard.rechargeDate = calendar; |
| | | |
| | | byte[] two = data.get(2); |
| | | byte[] electricPriceByte = new byte[4]; |
| | | System.arraycopy(two, 8, electricPriceByte, 0, electricPriceByte.length); |
| | | userCard.electricPrice = HexUtil.hexToFloatLowHigh(electricPriceByte); |
| | | |
| | | return userCard; |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | return null; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | //区域号 |
| | | byte[] arerNumberBytes = new byte[2]; |
| | | byte[] arerNumberBytes = new byte[4]; |
| | | byte[] arerNumberDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(arerNumber)); |
| | | System.arraycopy(arerNumberDatas, 0, arerNumberBytes, 0, arerNumberDatas.length); |
| | | if (arerNumberBytes != null) { |
| | | System.arraycopy(arerNumberBytes, 0, data, 1, arerNumberBytes.length); |
| | | } |
| | | //设备编号 |
| | | byte[] deviceNumberlBytes = new byte[2]; |
| | | byte[] deviceNumberlDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(deviceNumberl)); |
| | | System.arraycopy(deviceNumberlDatas, 0, deviceNumberlBytes, 0, deviceNumberlDatas.length); |
| | | if (deviceNumberlBytes != null) { |
| | | System.arraycopy(deviceNumberlBytes, 0, data, 3, deviceNumberlBytes.length); |
| | | //管理卡返写机制 00:中心写01:控制器返写 |
| | | byte[] cardWriteStateBytes = new byte[1]; |
| | | byte[] cardWriteStateDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(cardWriteState)); |
| | | System.arraycopy(cardWriteStateDatas, 0, cardWriteStateBytes, 0, cardWriteStateDatas.length); |
| | | if (cardWriteStateBytes != null) { |
| | | System.arraycopy(cardWriteStateBytes, 0, data, 13, cardWriteStateBytes.length); |
| | | } |
| | | //充值次数 |
| | | byte rechargeTimesByte = HexUtil.hexToByte(HexUtil.get10to16(rechargeTimes)); |
| | | data[5] = rechargeTimesByte; |
| | | |
| | | //用户总用水量 |
| | | byte[] totalWaterBytes = new byte[4]; |
| | | byte[] totalWaterDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(totalWater)); |
| | | System.arraycopy(totalWaterDatas, 0, totalWaterBytes, 0, totalWaterDatas.length); |
| | | if (totalWaterBytes != null) { |
| | | System.arraycopy(totalWaterBytes, 0, data, 6, totalWaterBytes.length); |
| | | //管理卡返写机制 00:中心写01:控制器返写 |
| | | byte[] cardStateBytes = new byte[1]; |
| | | byte[] cardStateDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(cardState)); |
| | | System.arraycopy(cardStateDatas, 0, cardStateBytes, 0, cardStateDatas.length); |
| | | if (cardStateBytes != null) { |
| | | System.arraycopy(cardStateBytes, 0, data, 14, cardStateBytes.length); |
| | | } |
| | | //总用电量位 |
| | | byte[] totalElectricBytes = new byte[4]; |
| | | byte[] totalElectricDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(totalElectric)); |
| | | System.arraycopy(totalElectricDatas, 0, totalElectricBytes, 0, totalElectricDatas.length); |
| | | if (totalElectricBytes != null) { |
| | | System.arraycopy(totalElectricBytes, 0, data, 10, totalElectricBytes.length); |
| | | } |
| | | |
| | | |
| | | data[15] = getByteSum(data); |
| | | return data; |
| | | } catch (Exception e) { |
| | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 用户卡1块 |
| | | */ |
| | | public class One extends BaseCard { |
| | | |
| | | public byte[] toBytes() { |
| | | byte[] data = new byte[16]; |
| | | |
| | | |
| | | try { |
| | | byte[] balanceBytes = new byte[4]; |
| | | byte[] balanceDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(balance)); |
| | | System.arraycopy(balanceDatas, 0, balanceBytes, 0, balanceDatas.length); |
| | | if (balanceBytes != null) { |
| | | System.arraycopy(balanceBytes, 0, data, 0, balanceBytes.length); |
| | | } |
| | | |
| | | byte[] surplusElecticityBytes = new byte[4]; |
| | | byte[] surplusElecticityDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(surplusElecticity)); |
| | | System.arraycopy(surplusElecticityDatas, 0, surplusElecticityBytes, 0, surplusElecticityDatas.length); |
| | | if (surplusElecticityBytes != null) { |
| | | System.arraycopy(surplusElecticityBytes, 0, data, 4, surplusElecticityBytes.length); |
| | | } |
| | | byte[] totalMornyBytes = new byte[4]; |
| | | byte[] totalMornyDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(totalMorny)); |
| | | System.arraycopy(totalMornyDatas, 0, totalMornyBytes, 0, totalMornyDatas.length); |
| | | if (totalMornyBytes != null) { |
| | | System.arraycopy(totalMornyBytes, 0, data, 8, totalMornyBytes.length); |
| | | } |
| | | |
| | | if (rechargeDate != null) { |
| | | // 获取年、月、日、时、分、秒 |
| | | int year = (rechargeDate.get(Calendar.YEAR)) % 1000; |
| | | int month = rechargeDate.get(Calendar.MONTH) + 1; // 月份从0开始,所以需要加1 |
| | | int day = rechargeDate.get(Calendar.DAY_OF_MONTH); |
| | | byte bcdYear = HexUtil.getIntToBCD(year)[0]; |
| | | byte bcdMonth = HexUtil.getIntToBCD(month)[0]; |
| | | byte bcdDay = HexUtil.getIntToBCD(day)[0]; |
| | | data[12] = bcdYear; |
| | | data[13] = bcdMonth; |
| | | data[14] = bcdDay; |
| | | } |
| | | |
| | | data[15] = getByteSum(data); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | CrashReport.postCatchedException(e); |
| | | } |
| | | return data; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 用户卡2块 |
| | | */ |
| | | public class Two extends BaseCard { |
| | | public byte[] toBytes() { |
| | | byte[] data = new byte[16]; |
| | | |
| | | |
| | | try { |
| | | byte[] balanceBytes = new byte[4]; |
| | | byte[] balanceDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(balance)); |
| | | System.arraycopy(balanceDatas, 0, balanceBytes, 0, balanceDatas.length); |
| | | if (balanceBytes != null) { |
| | | System.arraycopy(balanceBytes, 0, data, 0, balanceBytes.length); |
| | | } |
| | | |
| | | byte[] surplusElecticityBytes = new byte[4]; |
| | | byte[] surplusElecticityDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(surplusElecticity)); |
| | | System.arraycopy(surplusElecticityDatas, 0, surplusElecticityBytes, 0, surplusElecticityDatas.length); |
| | | if (surplusElecticityBytes != null) { |
| | | System.arraycopy(surplusElecticityBytes, 0, data, 4, surplusElecticityBytes.length); |
| | | } |
| | | |
| | | byte[] electricPriceBytes = new byte[4]; |
| | | byte[] electricPriceDatas = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(electricPrice)); |
| | | System.arraycopy(electricPriceDatas, 0, electricPriceBytes, 0, electricPriceDatas.length); |
| | | if (electricPriceBytes != null) { |
| | | System.arraycopy(electricPriceBytes, 0, data, 8, electricPriceBytes.length); |
| | | } |
| | | |
| | | if (rechargeDate != null) { |
| | | // 获取年、月、日、时、分、秒 |
| | | int year = (rechargeDate.get(Calendar.YEAR)) % 1000; |
| | | int month = rechargeDate.get(Calendar.MONTH) + 1; // 月份从0开始,所以需要加1 |
| | | int day = rechargeDate.get(Calendar.DAY_OF_MONTH); |
| | | byte bcdYear = HexUtil.getIntToBCD(year)[0]; |
| | | byte bcdMonth = HexUtil.getIntToBCD(month)[0]; |
| | | byte bcdDay = HexUtil.getIntToBCD(day)[0]; |
| | | data[12] = bcdYear; |
| | | data[13] = bcdMonth; |
| | | data[14] = bcdDay; |
| | | } |
| | | |
| | | |
| | | data[15] = getByteSum(data); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | CrashReport.postCatchedException(e); |
| | | } |
| | | return data; |
| | | } |
| | | } |
| | | |
| | | public byte[] getZeroBytes() { |
| | | ManagerToUserCard.Zero zero = new ManagerToUserCard.Zero(); |
| | | return zero.toByte(); |
| | | } |
| | | |
| | | public byte[] getOneBytes() { |
| | | ManagerToUserCard.One zero = new ManagerToUserCard.One(); |
| | | return zero.toBytes(); |
| | | } |
| | | |
| | | public byte[] getTwoBytes() { |
| | | ManagerToUserCard.Two zero = new ManagerToUserCard.Two(); |
| | | return zero.toBytes(); |
| | | } |
| | | |
| | | |
| | | public String getCardType() { |
| | | return cardType; |
| | | } |
| | | |
| | | public void setCardType(String cardType) { |
| | | this.cardType = cardType; |
| | | } |
| | | |
| | | public int getArerNumber() { |
| | | return arerNumber; |
| | | } |
| | | |
| | | public void setArerNumber(int arerNumber) { |
| | | this.arerNumber = arerNumber; |
| | | } |
| | | |
| | | public void setDeviceNumberl(int deviceNumberl) { |
| | | this.deviceNumberl = deviceNumberl; |
| | | |
| | | |
| | | public int getCardWriteState() { |
| | | return cardWriteState; |
| | | } |
| | | |
| | | public void setRechargeTimes(short rechargeTimes) { |
| | | this.rechargeTimes = rechargeTimes; |
| | | public void setCardWriteState(int cardWriteState) { |
| | | this.cardWriteState = cardWriteState; |
| | | } |
| | | |
| | | public void setTotalWater(int totalWater) { |
| | | this.totalWater = totalWater; |
| | | public int getCardState() { |
| | | return cardState; |
| | | } |
| | | |
| | | public void setTotalElectric(int totalElectric) { |
| | | this.totalElectric = totalElectric; |
| | | public void setCardState(int cardState) { |
| | | this.cardState = cardState; |
| | | } |
| | | public byte[] getZeroBytes() { |
| | | Zero zero = new Zero(); |
| | | return zero.toByte(); |
| | | |
| | | public int getBalance() { |
| | | return balance; |
| | | } |
| | | |
| | | public void setBalance(int balance) { |
| | | this.balance = balance; |
| | | } |
| | | |
| | | public int getSurplusElecticity() { |
| | | return surplusElecticity; |
| | | } |
| | | |
| | | public void setSurplusElecticity(int surplusElecticity) { |
| | | this.surplusElecticity = surplusElecticity; |
| | | } |
| | | |
| | | public int getTotalMorny() { |
| | | return totalMorny; |
| | | } |
| | | |
| | | public void setTotalMorny(int totalMorny) { |
| | | this.totalMorny = totalMorny; |
| | | } |
| | | |
| | | public Calendar getRechargeDate() { |
| | | return rechargeDate; |
| | | } |
| | | |
| | | public void setRechargeDate(Calendar rechargeDate) { |
| | | this.rechargeDate = rechargeDate; |
| | | } |
| | | |
| | | public Float getElectricPrice() { |
| | | return electricPrice; |
| | | } |
| | | |
| | | public void setElectricPrice(Float electricPrice) { |
| | | this.electricPrice = electricPrice; |
| | | } |
| | | |
| | | public String getOldCardNumber() { |
| | | return oldCardNumber; |
| | | } |
| | | |
| | | public void setOldCardNumber(String oldCardNumber) { |
| | | this.oldCardNumber = oldCardNumber; |
| | | } |
| | | } |
| | |
| | | System.arraycopy(zero, 5, userCodeByte, 0, userCodeByte.length); |
| | | userCard.userCode= BcdUtil.bcdToStr(userCodeByte); |
| | | byte[] userCodeNumber = new byte[2]; |
| | | System.arraycopy(zero, 10, userCodeNumber, 0, userCodeNumber.length); |
| | | System.arraycopy(zero, 11, userCodeNumber, 0, userCodeNumber.length); |
| | | userCard.userCodeNumber=HexUtil.get16To10LowHightByBytes(userCodeNumber); |
| | | byte[] cardWriteState = new byte[1]; |
| | | System.arraycopy(zero, 13, cardWriteState, 0, cardWriteState.length); |
| | |
| | | byte[] cardStateDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(cardState)); |
| | | System.arraycopy(cardStateDatas, 0, cardStateBytes, 0, cardStateDatas.length); |
| | | if (cardStateBytes != null) { |
| | | System.arraycopy(cardStateBytes, 0, data, 13, cardStateBytes.length); |
| | | System.arraycopy(cardStateBytes, 0, data, 14, cardStateBytes.length); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | import com.dayu.baselibrary.tools.HexUtil; |
| | | import com.dayu.baselibrary.utils.BaseCommon; |
| | | import com.dayu.qiheonlinelibrary.card.ManagerToUserCard; |
| | | import com.dayu.qiheonlinelibrary.card.UserCard; |
| | | import com.dayu.qiheonlinelibrary.utils.CardCommon; |
| | | |
| | |
| | | }).start(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取用户卡信息 |
| | | * |
| | | * @return |
| | | */ |
| | | public ManagerToUserCard getManagerToUserCardData() { |
| | | ManagerToUserCard managerToUserCard = null; |
| | | Map<String, List<byte[]>> map = new HashMap<>(); |
| | | MifareClassic mfc = MifareClassic.get(tag); |
| | | if (null != mfc) { |
| | | try { |
| | | //链接NFC |
| | | mfc.connect(); |
| | | //获取扇区数量 |
| | | int count = mfc.getSectorCount(); |
| | | //存储空间 |
| | | int size = mfc.getSize(); |
| | | //用于判断时候有内容读取出来 |
| | | boolean flag = false; |
| | | List<byte[]> list = new ArrayList<>(); |
| | | //验证扇区密码,否则会报错(链接失败错误) |
| | | boolean isOpen = mfc.authenticateSectorWithKeyA(1, defauleKey); |
| | | if (!isOpen) { |
| | | isOpen = mfc.authenticateSectorWithKeyA(1, companyKey); |
| | | } |
| | | if (isOpen) { |
| | | //获取扇区里面块的数量 |
| | | int bCount = mfc.getBlockCountInSector(1); |
| | | //获取扇区第一个块对应芯片存储器的位置(我是这样理解的,因为第0扇区的这个值是4而不是0) |
| | | int bIndex = mfc.sectorToBlock(1); |
| | | //String data1 = ""; |
| | | for (int j = 0; j < bCount; j++) { |
| | | //读取数据 |
| | | byte[] data = null; |
| | | try { |
| | | data = mfc.readBlock(bIndex); |
| | | bIndex++; |
| | | list.add(data); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | flag = true; |
| | | } |
| | | |
| | | if (flag) { |
| | | managerToUserCard = ManagerToUserCard.getBean(list); |
| | | return managerToUserCard; |
| | | } |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | try { |
| | | mfc.close(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 返回监听类 |
| | | */ |
| | |
| | | list.add(DateUtil.dateToStamp(projectBean.getRechargeDate(), DateUtil.type2)); |
| | | list.add(projectBean.getMorny()); |
| | | list.add(projectBean.getBalance()); |
| | | list.add(projectBean.getRechargeElectric()); |
| | | list.add(projectBean.getSurplusElectic()); |
| | | list.add(projectBean.getUserCode()); |
| | | } else { |
| | | UserCardBean userCardBean = (UserCardBean) objList.get(j); |
| | | list.add(userCardBean.getSerial()); |
| | |
| | | list.add(userCardBean.getCardNumber()); |
| | | list.add(DateUtil.dateToStamp(userCardBean.getDate(), DateUtil.type2)); |
| | | list.add(userCardBean.getPhone()); |
| | | list.add(userCardBean.getUserCode()); |
| | | } |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | |
| | | getWindow().setGravity(CENTER); |
| | | setContentView(R.layout.dialog_chose_type); |
| | | setCanceledOnTouchOutside(false); |
| | | setCancelable(false); |
| | | // setCancelable(false); |
| | | RadioGroup radioGroup = findViewById(com.dayu.baselibrary.R.id.radioLibrary); |
| | | |
| | | |
| | |
| | | import android.view.ViewGroup; |
| | | import android.view.WindowManager; |
| | | import android.widget.EditText; |
| | | import android.widget.ImageView; |
| | | import android.widget.TextView; |
| | | |
| | | import com.dayu.baselibrary.utils.ToastUtil; |
| | |
| | | |
| | | etName = findViewById(R.id.etName); |
| | | etCardId = findViewById(R.id.etCardId); |
| | | ImageView close = findViewById(R.id.closeDialog); |
| | | close.setOnClickListener(v -> UserSearchDialog.this.dismiss()); |
| | | TextView ok = findViewById(R.id.pw_ok); |
| | | ok.setOnClickListener(v -> { |
| | | String name = etName.getText().toString(); |
| | |
| | | android:layout_marginTop="20dp" |
| | | android:padding="5dp" |
| | | android:text="制作用户电量单价卡" |
| | | android:visibility="gone" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/text_size" /> |
| | | </LinearLayout> |
| | |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="50dp" |
| | | android:layout_gravity="center" |
| | | android:layout_marginTop="30dp" |
| | | android:orientation="horizontal"> |
| | | |
| | | <TextView |
| | | android:id="@+id/home_loss" |
| | | android:layout_width="0dp" |
| | |
| | | android:text="挂失" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/home_reportLoss" |
| | | android:layout_width="0dp" |
| | |
| | | android:gravity="center" |
| | | android:text="解除挂失" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | android:textSize="@dimen/home_text_size" |
| | | android:visibility="gone" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/home_replacement" |
| | | android:layout_width="0dp" |
| | |
| | | android:text="补卡" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/home_replacementWrite" |
| | | android:layout_width="0dp" |
| | | android:layout_height="match_parent" |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:text="泵未关写卡" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="50dp" |
| | |
| | | android:layout_weight="1" |
| | | android:gravity="center" |
| | | android:text="参数设置" |
| | | android:visibility="invisible" |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | android:textSize="@dimen/home_text_size" |
| | | android:visibility="gone" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/home_my" |
| | |
| | | android:textColor="@color/text_selecter_color" |
| | | android:textSize="@dimen/home_text_size" /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | |
| | | </LinearLayout> |
| | |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/dimen_title_height" |
| | | android:background="@color/title_bar_bg" |
| | | app:centerText="制作管理卡" |
| | | app:centerText="读取管理卡" |
| | | app:leftImage="@mipmap/icon_back" /> |
| | | |
| | | <ScrollView |
| | |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="40dp" |
| | | android:layout_marginRight="20dp" |
| | | android:text="第一步:刷卡制作管理卡" |
| | | android:gravity="center" |
| | | android:text="请在控制器刷卡后在此刷卡" |
| | | android:textColor="@color/red" |
| | | android:textSize="19sp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@id/titleBar" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="20dp" |
| | | android:text="第二步:在控制器端刷卡" |
| | | android:textColor="@color/red" |
| | | android:textSize="19sp" /> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@id/titleBar" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="20dp" |
| | | android:text="第三步:点击下一步按钮转换为用户卡" |
| | | android:textColor="@color/red" |
| | | android:textSize="19sp" /> |
| | | |
| | | <ImageView |
| | | android:layout_width="match_parent" |
New file |
| | |
| | | <?xml version="1.0" encoding="utf-8"?> |
| | | <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" |
| | | xmlns:app="http://schemas.android.com/apk/res-auto" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:orientation="vertical"> |
| | | |
| | | <com.dayu.baselibrary.view.TitleBar |
| | | android:id="@+id/titleBar" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="@dimen/dimen_title_height" |
| | | android:background="@color/title_bar_bg" |
| | | app:centerText="制作管理卡" |
| | | app:leftImage="@mipmap/icon_back" /> |
| | | |
| | | <ScrollView |
| | | android:id="@+id/read_userLL" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_below="@id/titleBar" |
| | | android:visibility="gone"> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_margin="20dp" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_name" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="姓名:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:orientation="horizontal"> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="卡号:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_initCode" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="" |
| | | android:textSize="@dimen/text_size" /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/red_remainder_blance" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="剩余金额:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_remainder_water" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="剩余水量:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_rechargeDate" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="最后购水日期:" |
| | | android:textSize="@dimen/text_size" |
| | | android:visibility="visible" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_rechargeNumber" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="充值次数:" |
| | | android:textSize="@dimen/text_size" |
| | | android:visibility="visible" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_total_water" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="总用水量:" |
| | | android:textSize="@dimen/text_size" |
| | | android:visibility="visible" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_total_power" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="总用电量:" |
| | | android:textSize="@dimen/text_size" |
| | | android:visibility="visible" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_statu" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="卡状态:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | </ScrollView> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/read_cardTypeLL" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_below="@id/titleBar" |
| | | android:gravity="center" |
| | | android:orientation="vertical" |
| | | android:visibility="visible"> |
| | | |
| | | <TextView |
| | | android:id="@+id/read_cardTypeTV" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_centerVertical="true" |
| | | android:layout_gravity="center" |
| | | android:gravity="center" |
| | | android:textSize="30sp" |
| | | android:textStyle="bold" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/read_cardDataTV" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_centerVertical="true" |
| | | android:layout_gravity="center" |
| | | android:layout_marginTop="20dp" |
| | | android:gravity="left" |
| | | android:textSize="20sp" |
| | | android:textStyle="bold" /> |
| | | </LinearLayout> |
| | | |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/read_imgLL" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_below="@id/titleBar" |
| | | android:background="#ffffff" |
| | | android:orientation="vertical" |
| | | android:visibility="visible"> |
| | | |
| | | <TextView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@id/titleBar" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="40dp" |
| | | android:layout_marginRight="20dp" |
| | | android:text="第一步:刷卡制作管理卡" |
| | | android:textColor="@color/red" |
| | | android:textSize="19sp" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/number2" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@id/titleBar" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="20dp" |
| | | android:visibility="gone" |
| | | android:text="第二步:在控制器端刷卡,完成后点击下一步" |
| | | android:textColor="@color/red" |
| | | android:textSize="19sp" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/number3" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_below="@id/titleBar" |
| | | android:layout_marginLeft="20dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="20dp" |
| | | android:visibility="gone" |
| | | android:text="第三步:转换为用户卡" |
| | | android:textColor="@color/red" |
| | | android:textSize="19sp" /> |
| | | |
| | | |
| | | <ImageView |
| | | android:layout_width="match_parent" |
| | | android:layout_height="match_parent" |
| | | android:layout_below="@id/textView" |
| | | android:scaleType="fitCenter" |
| | | android:src="@mipmap/nfc_write" /> |
| | | </LinearLayout> |
| | | |
| | | <com.wang.avi.AVLoadingIndicatorView |
| | | android:id="@+id/avi" |
| | | style="@style/AVLoadingIndicatorView" |
| | | android:layout_width="80dp" |
| | | android:layout_height="80dp" |
| | | android:layout_centerHorizontal="true" |
| | | android:layout_centerVertical="true" |
| | | android:visibility="gone" |
| | | app:indicatorColor="@color/title_bg" |
| | | app:indicatorName="BallClipRotatePulseIndicator" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/manager_next" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="50dp" |
| | | android:layout_alignParentBottom="true" |
| | | android:background="@color/title_bg" |
| | | android:gravity="center" |
| | | android:text="下一步" |
| | | android:textColor="#000000" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | </RelativeLayout> |
| | |
| | | android:id="@+id/red_name" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | |
| | | android:text="用户姓名:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/red_initCode" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="当前卡号:" |
| | | android:textSize="@dimen/text_size" /> |
| | | <TextView |
| | | android:id="@+id/red_userCode" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | |
| | | android:text="充值金额:" |
| | | android:textSize="@dimen/text_size" /> |
| | | <TextView |
| | | android:id="@+id/red_recharge_water" |
| | | android:id="@+id/red_recharge_balance" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="充值水量:" |
| | | android:text="剩余金额:" |
| | | android:textSize="@dimen/text_size" /> |
| | | <TextView |
| | | android:id="@+id/red_remainder_blance" |
| | |
| | | android:text="剩余金额:" |
| | | android:visibility="gone" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_surplusWater" |
| | | android:id="@+id/red_rechargeElectric" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="剩余水量:" |
| | | android:visibility="gone" |
| | | android:text="充值电量:" |
| | | android:visibility="visible" |
| | | android:textSize="@dimen/text_size" /> |
| | | <TextView |
| | | android:id="@+id/red_surplusElectric" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="剩余电量:" |
| | | android:visibility="visible" |
| | | android:textSize="@dimen/text_size" /> |
| | | <TextView |
| | | android:id="@+id/red_rechargeDate" |
| | |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:orientation="horizontal"> |
| | | |
| | | <TextView |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="用户编号:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_userCode" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:text="" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | </LinearLayout> |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | android:gravity="center" |
| | | android:orientation="vertical"> |
| | | |
| | | <ImageView |
| | | android:id="@+id/closeDialog" |
| | | android:layout_width="50dp" |
| | | android:layout_height="50dp" |
| | | android:padding="10dp" |
| | | android:src="@mipmap/icon_close_dialog" |
| | | /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | |
| | | </LinearLayout> |
| | | |