|  |  | 
 |  |  | package com.dayu.qiheonlinelibrary.activity; | 
 |  |  |  | 
 |  |  | import android.annotation.SuppressLint; | 
 |  |  | import android.content.Intent; | 
 |  |  | import android.os.Bundle; | 
 |  |  | import android.text.Editable; | 
 |  |  | 
 |  |  | import android.view.View; | 
 |  |  | import android.widget.EditText; | 
 |  |  |  | 
 |  |  | import com.dayu.baselibrary.tools.HexUtil; | 
 |  |  | import com.dayu.baselibrary.utils.DeviceUtils; | 
 |  |  | import com.dayu.baselibrary.utils.MornyUtil; | 
 |  |  | import com.dayu.baselibrary.utils.TipUtil; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | import com.dayu.qiheonlinelibrary.QHOnLineApplication; | 
 |  |  | import com.dayu.qiheonlinelibrary.R; | 
 |  |  | import com.dayu.qiheonlinelibrary.bean.CardInfoResult; | 
 |  |  | import com.dayu.qiheonlinelibrary.bean.RechargeResult; | 
 |  |  | import com.dayu.qiheonlinelibrary.card.UserCard; | 
 |  |  | import com.dayu.qiheonlinelibrary.databinding.ActivityRechargeQhlBinding; | 
 |  |  | import com.dayu.qiheonlinelibrary.dbBean.AdminDataBean; | 
 |  |  | import com.dayu.qiheonlinelibrary.dbBean.ElectricPriceBean; | 
 |  |  | import com.dayu.qiheonlinelibrary.dbBean.UserCardBean; | 
 |  |  | import com.dayu.qiheonlinelibrary.dbBean.RechargeBean; | 
 |  |  | 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.tencent.bugly.crashreport.CrashReport; | 
 |  |  |  | 
 |  |  | import java.util.Calendar; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.HashMap; | 
 |  |  | import java.util.Map; | 
 |  |  |  | 
 |  |  |  | 
 |  |  | /** | 
 |  |  | 
 |  |  |     ActivityRechargeQhlBinding binding; | 
 |  |  |     public static RechargeActivity rechargeActivity; | 
 |  |  |  | 
 |  |  |     AdminDataBean adminData; | 
 |  |  |     String userName; | 
 |  |  |     String cardNumber = null; | 
 |  |  |     UserCardBean userCardBean; | 
 |  |  |     int waterPrice; | 
 |  |  |  | 
 |  |  |     String cardNumber = null;//实体卡号 | 
 |  |  |     RechargeBean rechargeBean; | 
 |  |  |  | 
 |  |  |     String rechageWater;//充值的水量 | 
 |  |  |     ElectricPriceBean priceBean; | 
 |  |  |  | 
 |  |  |     String cardType;//卡状态 | 
 |  |  |  | 
 |  |  |     CardInfoResult cardInfoResult; | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Override | 
 |  |  |     protected void onCreate(Bundle savedInstanceState) { | 
 |  |  | 
 |  |  |             setContentView(binding.getRoot()); | 
 |  |  |             setPricePoint(binding.rechargeWater); | 
 |  |  |             rechargeActivity = this; | 
 |  |  |             waterPrice = baseDao.adminDao().findFirst().getWaterPrice(); | 
 |  |  |             initView(); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void readAllData() { | 
 |  |  |         String cardType = NfcReadHelper.getInstence(intent, this).getCradTypeAndCardNumber(); | 
 |  |  |         cardType = NfcReadHelper.getInstence(intent, this).getCradTypeAndCardNumber(); | 
 |  |  |  | 
 |  |  |         String[] cardTypes = cardType.split(","); | 
 |  |  |         if (cardTypes != null && cardTypes.length == 2) { | 
 |  |  |             cardNumber = cardType.split(",")[0]; | 
 |  |  |             cardNumber = HexUtil.spaceHex(cardNumber); | 
 |  |  |             cardNumber = HexUtil.HighLowHex(cardNumber); | 
 |  |  |             cardType = cardType.split(",")[1]; | 
 |  |  |         } | 
 |  |  |         List<byte[]> data = NfcReadHelper.getInstence(intent, this).getOnesectorData(); | 
 |  |  |  | 
 |  |  |         if (!data.isEmpty()) { | 
 |  |  |             if (!TextUtils.isEmpty(cardNumber)) { | 
 |  |  |                 setUserData(cardType, cardNumber, data); | 
 |  |  |                 if(priceBean!=null){ | 
 |  |  |                     binding.redRechargeElectric.setText("电量单价:"+priceBean.getPrice()+"元/度"); | 
 |  |  |                 } | 
 |  |  |             } else { | 
 |  |  |                 TipUtil.show(this, "读取卡片失败,请重新贴卡"); | 
 |  |  |         //获取卡内信息 | 
 |  |  |         userCard = NfcReadHelper.getInstence(intent, this).getUserCardData(); | 
 |  |  |         if (userCard != null) { | 
 |  |  |             try { | 
 |  |  |                 getUserInfoAndCardInfo(cardNumber, userCard.getMyUserCode()); | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |                 CrashReport.postCatchedException(e); | 
 |  |  |                 TipUtil.show(this, "读卡失败,请刷卡后不要立即移开"); | 
 |  |  |             } | 
 |  |  |         } else { | 
 |  |  |             TipUtil.show(this, "卡片识别错误,请重试!"); | 
 |  |  |             TipUtil.show(this, "读卡失败,请刷卡后不要立即移开"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @SuppressLint("ResourceAsColor") | 
 |  |  |     private void setUserData(String cardType, String cardNumber, List<byte[]> data) { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         String state = ""; | 
 |  |  |     private void setUserData(String cardNumber, String userName, String lastRechargeTime) { | 
 |  |  |         if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_1)) { | 
 |  |  |             state = "终端写卡"; | 
 |  |  |             setCardState("终端写卡"); | 
 |  |  |             binding.rechargeLL.setVisibility(View.VISIBLE); | 
 |  |  |             binding.rechargeRegistBtn.setVisibility(View.VISIBLE); | 
 |  |  |             binding.redStatu.setTextColor(R.color.black); | 
 |  |  |             binding.redStatu.setTextColor(this.getResources().getColor(R.color.black)); | 
 |  |  |         } else if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_2)) { | 
 |  |  |             state = "未刷卡关泵,当前不可充值"; | 
 |  |  |             binding.rechargeLL.setVisibility(View.GONE); | 
 |  |  |             binding.rechargeRegistBtn.setVisibility(View.GONE); | 
 |  |  |             binding.redStatu.setTextColor(com.dayu.baselibrary.R.color.red); | 
 |  |  |             setCardState("未刷卡关泵,当前不可充值"); | 
 |  |  |             TipUtil.show(RechargeActivity.this, "未刷卡关泵,当前不可充值"); | 
 |  |  |         } else if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_3)) { | 
 |  |  |             state = "叠加充值"; | 
 |  |  |             binding.rechargeLL.setVisibility(View.GONE); | 
 |  |  |             binding.rechargeRegistBtn.setVisibility(View.GONE); | 
 |  |  |             setCardState("叠加充值"); | 
 |  |  |         } else { | 
 |  |  |             TipUtil.show(this, "非用户卡,不能充值"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |         if (userCard != null) { | 
 |  |  |             try { | 
 |  |  |                 if (Integer.valueOf(QHOnLineApplication.getInstance().arerNumber) == userCard.getArerNumber()) { | 
 |  |  |                     binding.rechargeReadLL.setVisibility(View.GONE); | 
 |  |  |                     binding.rechargeTextLL.setVisibility(View.VISIBLE); | 
 |  |  |                     binding.userName.setText(userName); | 
 |  |  |                     binding.redInitCode.setText(cardNumber); | 
 |  |  |                     binding.redRechargeDate.setText("本卡最后购水日期:\n\n" + lastRechargeTime); | 
 |  |  |                     binding.redUserCode.setText(cardInfoResult.getIccardCode()); | 
 |  |  |                     if (userCard != null) { | 
 |  |  |                         binding.redRemainderBlance.setText(MornyUtil.changeF2Y(userCard.getBalance()) + " 元"); | 
 |  |  |                         binding.redBalanceElectric.setText("充值后剩余电量:" + MornyUtil.changeF2Y(userCard.getSurplusElecticity()) + " 度"); | 
 |  |  |                     } | 
 |  |  |                     binding.redRechargeElectric.setText("电量单价:" + QHOnLineApplication.getInstance().electriclePriceStr + "元/度"); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         userCard = UserCard.getBean(data); | 
 |  |  |         List<UserCardBean> userCardBeans = baseDao.userCardDao().findUserName(cardNumber); | 
 |  |  |         AdminDataBean adminDataBean = baseDao.adminDao().findFirst(); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         if (Integer.valueOf(adminDataBean.getAddressCode()) == userCard.getArerNumber()) { | 
 |  |  |             if (!userCardBeans.isEmpty()) { | 
 |  |  |                 userCardBean = userCardBeans.get(0); | 
 |  |  |                 this.userName = userCardBean.getUserName(); | 
 |  |  |             } else { | 
 |  |  |                 userCardBean = new UserCardBean(); | 
 |  |  |                 userCardBean.setCardNumber(cardNumber); | 
 |  |  |                 userCardBean.setUserName("未知用户"); | 
 |  |  |                 userCardBean.setPhone("未知"); | 
 |  |  |                 userCardBean.setUserID("未知"); | 
 |  |  |                 userCardBean.setAddressCode(String.valueOf(userCard.getArerNumber())); | 
 |  |  |                 userCardBean.setSerial(String.valueOf(userCard.getArerNumber())); | 
 |  |  |                 this.userName = "未知用户"; | 
 |  |  |             } | 
 |  |  |             binding.rechargeReadLL.setVisibility(View.GONE); | 
 |  |  |             binding.rechargeTextLL.setVisibility(View.VISIBLE); | 
 |  |  |             binding.userName.setText(userName); | 
 |  |  |             binding.redStatu.setText(state); | 
 |  |  |             if (userCard != null) { | 
 |  |  |                 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("本卡最后购水日期:无"); | 
 |  |  |                     TipUtil.show(this, "非本区域卡\n不能充值!!!"); | 
 |  |  |                 } | 
 |  |  |                 binding.redInitCode.setText(cardNumber); | 
 |  |  | //                binding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + " 次"); | 
 |  |  | //                binding.redTotalWater.setText("总用水量:" + MornyUtil.changeF2Y(userCard.getTotalWater()) + " 吨"); | 
 |  |  | //                binding.redTotalPower.setText("总用电量:" + MornyUtil.changeF2Y(userCard.getTotalElectric()) + " 度"); | 
 |  |  |                 binding.redRemainderBlance.setText(MornyUtil.changeF2Y(userCard.getBalance()) + " 元"); | 
 |  |  |                 binding.redRemainderWater.setText("剩余水量:" + MornyUtil.changeF2Y(userCard.getSurplusWater()) + " 吨"); | 
 |  |  | //                binding.redWaterPrice.setText("每立方米水价格:" + MornyUtil.changeF2Y(adminData.getWaterPrice()) + " 元"); | 
 |  |  |             } catch (Exception e) { | 
 |  |  |                 e.printStackTrace(); | 
 |  |  |                 CrashReport.postCatchedException(e); | 
 |  |  |                 TipUtil.show(this, "读卡失败,请刷卡后不要立即移开"); | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |         } else { | 
 |  |  |             TipUtil.show(this, "非本区域卡\n不能充值!!!"); | 
 |  |  |             TipUtil.show(this, "读卡失败,请刷卡后不要立即移开"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void initView() { | 
 |  |  |         try { | 
 |  |  |             adminData = baseDao.adminDao().findFirst(); | 
 |  |  |             priceBean = baseDao.electricPriceDao().findFirst(); | 
 |  |  |         } catch (Exception e) { | 
 |  |  |             e.printStackTrace(); | 
 |  |  |             CrashReport.postCatchedException(e); | 
 |  |  |         } | 
 |  |  |         binding.rechargeRegistBtn.setOnClickListener(v -> { | 
 |  |  |             String morny = binding.rechargeWater.getText().toString(); | 
 |  |  |             if (!TextUtils.isEmpty(morny)) { | 
 |  |  |                 Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class); | 
 |  |  |                 //当前金额单位为元 | 
 |  |  |                 intent.putExtra("morny", morny); | 
 |  |  |                 intent.putExtra("userName", userName); | 
 |  |  |                 intent.putExtra("cardNumber", cardNumber); | 
 |  |  |                 intent.putExtra("userCard", userCard); | 
 |  |  |                 intent.putExtra("userCardBean", userCardBean); | 
 |  |  | //                intent.putExtra("rechageWater", rechageWater); | 
 |  |  |                 startActivity(intent); | 
 |  |  |                 rechaege(morny); | 
 |  |  |             } else { | 
 |  |  |                 TipUtil.show(RechargeActivity.this, "请输入充值金额(元)"); | 
 |  |  |                 TipUtil.show(RechargeActivity.this, "请输入充值金额"); | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  | 
 |  |  |                 } | 
 |  |  |                 String morny = editText.getText().toString(); | 
 |  |  |                 if (!TextUtils.isEmpty(morny)) { | 
 |  |  |                     rechageWater = MornyUtil.intDiv(MornyUtil.changeY2F(editText.getText().toString()), waterPrice); | 
 |  |  | //                    rechageWater = MornyUtil.intDiv(MornyUtil.changeY2F(editText.getText().toString()), waterPrice); | 
 |  |  | //                    binding.redRechargeWater.setText("充值水量:" + rechageWater + " 立方米(吨)"); | 
 |  |  |                 } | 
 |  |  |  | 
 |  |  | 
 |  |  |         super.onDestroy(); | 
 |  |  |         rechargeActivity = null; | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void startNfcActivity(String morny, String balance, float rechargeElectric, float iccardBalanceElectric, float totalMorny, String iccardRechargeRecordId) { | 
 |  |  |         //先处理补扣 | 
 |  |  |         //充值补扣金额=充值金额+充值前读取的卡内余额-充值回调返回卡内余额 | 
 |  |  |         int deductionMorny = MornyUtil.changeY2F(morny) + userCard.getBalance() - MornyUtil.changeY2F(balance); | 
 |  |  |  | 
 |  |  |         if (MornyUtil.changeY2F(morny) < deductionMorny) { | 
 |  |  |             TipUtil.show(RechargeActivity.this, "当前充值金额小于补扣金额,补扣金额为" + MornyUtil.changeF2Y(deductionMorny) + "元,充值金额应大于补扣金额!"); | 
 |  |  |             return; | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         //添加充值信息 | 
 |  |  |         rechargeBean = new RechargeBean(); | 
 |  |  |         rechargeBean.setCardNumber(cardNumber); | 
 |  |  |         rechargeBean.setUserCode(userCard.getUserCode() + userCard.getUserCodeNumber()); | 
 |  |  |         rechargeBean.setUserName(cardInfoResult.getPeasantName()); | 
 |  |  |         rechargeBean.setPersonId(cardInfoResult.getPeasantId()); | 
 |  |  |         rechargeBean.setSerial(DeviceUtils.getSN()); | 
 |  |  |         rechargeBean.setArerNumber(QHOnLineApplication.getInstance().arerNumber); | 
 |  |  |         rechargeBean.setMorny(morny); | 
 |  |  |         rechargeBean.setBalance(balance); | 
 |  |  |         rechargeBean.setRechargeElectric(String.valueOf(rechargeElectric)); | 
 |  |  |         rechargeBean.setPrice(QHOnLineApplication.getInstance().electriclePriceStr); | 
 |  |  |         rechargeBean.setSurplusElectic(String.valueOf(iccardBalanceElectric)); | 
 |  |  |         long time = System.currentTimeMillis(); | 
 |  |  |         rechargeBean.setRechargeDate(time); | 
 |  |  |         rechargeBean.setUserId(""); | 
 |  |  |         rechargeBean.setTotalMorny(String.valueOf(totalMorny)); | 
 |  |  |         rechargeBean.setState(1); | 
 |  |  |         rechargeBean.setOrderId(iccardRechargeRecordId); | 
 |  |  |         rechargeBean.setDeductionMorny(MornyUtil.changeF2Y(deductionMorny)); | 
 |  |  |         rechargeBean.setAdminId(QHOnLineApplication.getInstance().adminId); | 
 |  |  |  | 
 |  |  |  | 
 |  |  |         userCard.setCardWriteState(0); | 
 |  |  |         userCard.setCardState(1); | 
 |  |  |         Calendar calendar = Calendar.getInstance(); | 
 |  |  |         calendar.setTimeInMillis(time); | 
 |  |  |         userCard.setBalance(MornyUtil.changeY2F(String.valueOf(balance))); | 
 |  |  |         userCard.setSurplusElecticity(MornyUtil.changeY2F(String.valueOf(iccardBalanceElectric))); | 
 |  |  |         userCard.setTotalMorny(MornyUtil.changeY2F(String.valueOf(totalMorny))); | 
 |  |  |         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); | 
 |  |  |                 } | 
 |  |  |             }); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * IC卡充值 | 
 |  |  |      * | 
 |  |  |      * @param morny | 
 |  |  |      */ | 
 |  |  |     public void rechaege(String morny) { | 
 |  |  |         Map<String, Object> data = new HashMap<>(); | 
 |  |  |         //终端设备号 | 
 |  |  |         data.put("equipCode", DeviceUtils.getSN()); | 
 |  |  |         //ic卡信息id | 
 |  |  |         data.put("iccardNum", cardNumber); | 
 |  |  |         //交易水费金额(元) | 
 |  |  |         data.put("rechargeWaterMoney", morny); | 
 |  |  |         //卡内剩余金额(元) | 
 |  |  |         data.put("iccardBalanceMoney", MornyUtil.changeF2Y(userCard.getBalance())); | 
 |  |  |         //卡内剩余水量(m³) | 
 |  |  |         data.put("iccardBalanceAmonunt", "0"); | 
 |  |  |         //卡内剩余电量 | 
 |  |  |         data.put("iccardBalanceElectric", MornyUtil.changeF2Y(userCard.getSurplusElecticity())); | 
 |  |  |         ApiManager.getInstance().requestPostLoading(this, "iccard/recharge/rechargeCard", RechargeResult.class, data, new SubscriberListener<BaseResponse<RechargeResult>>() { | 
 |  |  |             @Override | 
 |  |  |             public void onNext(BaseResponse<RechargeResult> t) { | 
 |  |  |                 if (t.isSuccess()) { | 
 |  |  |                     if (t.getData() != null) { | 
 |  |  |                         RechargeResult rechargeResult = t.getData(); | 
 |  |  |                         startNfcActivity(morny, rechargeResult.getIccardBalanceMoney(), rechargeResult.getRechargeElectricAmount(), rechargeResult.getIccardBalanceElectric(), rechargeResult.getTotalRechargeMoney(), rechargeResult.getIccardRechargeRecordId()); | 
 |  |  |                     } else { | 
 |  |  |                         TipUtil.show(RechargeActivity.this, "充值失败请重试!"); | 
 |  |  |                     } | 
 |  |  |                 } else { | 
 |  |  |                     TipUtil.show(RechargeActivity.this, t.getMsg()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     /** | 
 |  |  |      * 获取卡信息和用户信息 | 
 |  |  |      * | 
 |  |  |      * @param iccardCode | 
 |  |  |      */ | 
 |  |  |     public void getUserInfoAndCardInfo(String iccardNum, String iccardCode) { | 
 |  |  |         Map<String, Object> data = new HashMap<>(); | 
 |  |  |         //ic卡信息id | 
 |  |  |         data.put("iccardNum", iccardNum); | 
 |  |  |         data.put("iccardCode", iccardCode); | 
 |  |  |         ApiManager.getInstance().requestPostLoading(this, "iccard/peasant/getIccardInfoVoByCardCode", CardInfoResult.class, data, new SubscriberListener<BaseResponse<CardInfoResult>>() { | 
 |  |  |             @Override | 
 |  |  |             public void onNext(BaseResponse<CardInfoResult> t) { | 
 |  |  |                 String state = ""; | 
 |  |  |                 if (t.isSuccess()) { | 
 |  |  |                     if (t.getData() != null) { | 
 |  |  |                         //ic卡状态 0 正常 1 已注销 2 已挂失 | 
 |  |  |                         if (t.getData().getIccardStatus() == 0) { | 
 |  |  | //                            List<byte[]> data = NfcReadHelper.getInstence(intent, RechargeActivity.this).getOnesectorData(); | 
 |  |  |                             if (!data.isEmpty()) { | 
 |  |  |                                 if (!TextUtils.isEmpty(cardNumber)) { | 
 |  |  |                                     cardInfoResult = t.getData(); | 
 |  |  |                                     setUserData(cardNumber, cardInfoResult.getPeasantName(), cardInfoResult.getLastRechargeTime()); | 
 |  |  |                                 } else { | 
 |  |  |                                     TipUtil.show(RechargeActivity.this, "读取卡片失败,请重新贴卡"); | 
 |  |  |                                 } | 
 |  |  |                             } else { | 
 |  |  |                                 TipUtil.show(RechargeActivity.this, "卡片识别错误,请重试!"); | 
 |  |  |                             } | 
 |  |  |                         } else if (t.getData().getIccardStatus() == 1) { | 
 |  |  |                             TipUtil.show(RechargeActivity.this, "当前卡已注销"); | 
 |  |  |                         } else { | 
 |  |  |                             TipUtil.show(RechargeActivity.this, "当前卡已挂失"); | 
 |  |  |                         } | 
 |  |  |                     } else { | 
 |  |  |                         TipUtil.show(RechargeActivity.this, "当前卡片错误,未能查到该卡信息!"); | 
 |  |  |                     } | 
 |  |  |  | 
 |  |  |                 } else { | 
 |  |  |                     TipUtil.show(RechargeActivity.this, t.getMsg()); | 
 |  |  |                 } | 
 |  |  |             } | 
 |  |  |         }); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     private void setCardState(String state) { | 
 |  |  |         binding.rechargeLL.setVisibility(View.GONE); | 
 |  |  |         binding.rechargeRegistBtn.setVisibility(View.GONE); | 
 |  |  |         binding.redStatu.setTextColor(RechargeActivity.this.getResources().getColor(com.dayu.baselibrary.R.color.red)); | 
 |  |  |         binding.redStatu.setText(state); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  | } |