File was renamed from qiheonlinelibrary/src/main/java/com/dayu/qiheonlinelibrary/activity/RechargeActivity.java |
| | |
| | | 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.RechargeBean; |
| | | import com.dayu.qiheonlinelibrary.net.ApiManager; |
| | |
| | | * Date: 2023-11-5 09:52 |
| | | * Description: 充值界面 |
| | | */ |
| | | public class RechargeActivity extends BaseNfcActivity { |
| | | public class RechargeActivityQHOline extends QHOlineBaseNfcActivity { |
| | | |
| | | Intent intent; |
| | | |
| | | ActivityRechargeQhlBinding binding; |
| | | public static RechargeActivity rechargeActivity; |
| | | public static RechargeActivityQHOline rechargeActivity; |
| | | |
| | | |
| | | String cardNumber = null;//实体卡号 |
| | |
| | | } |
| | | } |
| | | |
| | | public void onNewIntent(Intent intent) { |
| | | |
| | | |
| | | @Override |
| | | public void onNfcBack(Intent intent) { |
| | | this.intent = intent; |
| | | try { |
| | | readAllData(); |
| | |
| | | e.printStackTrace(); |
| | | CrashReport.postCatchedException(e); |
| | | } |
| | | super.onNewIntent(intent); |
| | | } |
| | | |
| | | |
| | |
| | | binding.redStatu.setTextColor(this.getResources().getColor(R.color.black)); |
| | | } else if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_2)) { |
| | | setCardState("未刷卡关泵,当前不可充值"); |
| | | TipUtil.show(RechargeActivity.this, "未刷卡关泵,当前不可充值"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "未刷卡关泵,当前不可充值"); |
| | | } else if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_3)) { |
| | | setCardState("叠加充值"); |
| | | } else { |
| | |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | rechaege(morny); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "请输入充值金额"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "请输入充值金额"); |
| | | } |
| | | }); |
| | | } |
| | |
| | | int deductionMorny = MornyUtil.changeY2F(morny) + userCard.getBalance() - MornyUtil.changeY2F(balance); |
| | | |
| | | if (MornyUtil.changeY2F(morny) < deductionMorny) { |
| | | TipUtil.show(RechargeActivity.this, "当前充值金额小于补扣金额,补扣金额为" + MornyUtil.changeF2Y(deductionMorny) + "元,充值金额应大于补扣金额!"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "当前充值金额小于补扣金额,补扣金额为" + MornyUtil.changeF2Y(deductionMorny) + "元,充值金额应大于补扣金额!"); |
| | | return; |
| | | } |
| | | |
| | |
| | | userCard.setRechargeDate(calendar); |
| | | userCard.setElectricPrice(Float.valueOf(QHOnLineApplication.getInstance().electriclePriceStr)); |
| | | if (deductionMorny == 0) { |
| | | Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class); |
| | | Intent intent = new Intent(RechargeActivityQHOline.this, NFCWreatActivityQHOline.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() { |
| | | TipUtil.show(RechargeActivityQHOline.this, "挂失卡后有补交金额!补交金额为:" + MornyUtil.changeF2Y(deductionMorny) + "元,详情可在平台查询。", new TipUtil.TipListener() { |
| | | @Override |
| | | public void onCancle() { |
| | | Intent intent = new Intent(RechargeActivity.this, NFCWreatActivity.class); |
| | | Intent intent = new Intent(RechargeActivityQHOline.this, NFCWreatActivityQHOline.class); |
| | | intent.putExtra("morny", morny); |
| | | intent.putExtra("userCard", userCard); |
| | | intent.putExtra("rechargeBean", rechargeBean); |
| | |
| | | RechargeResult rechargeResult = t.getData(); |
| | | startNfcActivity(morny, rechargeResult.getIccardBalanceMoney(), rechargeResult.getRechargeElectricAmount(), rechargeResult.getIccardBalanceElectric(), rechargeResult.getTotalRechargeMoney(), rechargeResult.getIccardRechargeRecordId()); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "充值失败请重试!"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "充值失败请重试!"); |
| | | } |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, t.getMsg()); |
| | | TipUtil.show(RechargeActivityQHOline.this, t.getMsg()); |
| | | } |
| | | } |
| | | }); |
| | |
| | | cardInfoResult = t.getData(); |
| | | setUserData(cardNumber, cardInfoResult.getPeasantName(), cardInfoResult.getLastRechargeTime()); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "读取卡片失败,请重新贴卡"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "读取卡片失败,请重新贴卡"); |
| | | } |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "卡片识别错误,请重试!"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "卡片识别错误,请重试!"); |
| | | } |
| | | } else if (t.getData().getIccardStatus() == 1) { |
| | | TipUtil.show(RechargeActivity.this, "当前卡已注销"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "当前卡已注销"); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "当前卡已挂失"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "当前卡已挂失"); |
| | | } |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "当前卡片错误,未能查到该卡信息!"); |
| | | TipUtil.show(RechargeActivityQHOline.this, "当前卡片错误,未能查到该卡信息!"); |
| | | } |
| | | |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, t.getMsg()); |
| | | TipUtil.show(RechargeActivityQHOline.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.setTextColor(RechargeActivityQHOline.this.getResources().getColor(com.dayu.baselibrary.R.color.red)); |
| | | binding.redStatu.setText(state); |
| | | } |
| | | |