| | |
| | | package com.dayu.baselibrary.utils; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.text.DecimalFormat; |
| | | |
| | | /** |
| | | * Copyright (C), 2022, |
| | |
| | | return BigDecimal.valueOf(Long.valueOf(price)).divide(new BigDecimal(100)).toString(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 精确除法,保留两位小数 |
| | | * @param dividend |
| | | * @param divisor |
| | | * @return |
| | | */ |
| | | public static String intDiv(int dividend, int divisor) { |
| | | double result = (double) dividend / divisor; |
| | | // 使用 DecimalFormat 格式化结果,保留两位小数 |
| | | DecimalFormat df = new DecimalFormat("#.##"); |
| | | return df.format(result); |
| | | } |
| | | |
| | | } |
| | |
| | | android { |
| | | namespace 'com.dayu.henanlibrary' |
| | | compileSdk 33 |
| | | ndkPath 'D:\\android\\sdk\\ndk\\android-ndk-r21' |
| | | defaultConfig { |
| | | minSdk 23 |
| | | targetSdk 26 |
| | |
| | | |
| | | dependencies { |
| | | |
| | | implementation fileTree(include: ['*.jar','*.aar'], dir: 'libs') |
| | | implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') |
| | | |
| | | compileOnly 'com.android.support:appcompat-v7:28.0.0' |
| | | compileOnly 'com.android.support.constraint:constraint-layout:1.1.3' |
| | |
| | | android:layout_marginLeft="15dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="15dp" |
| | | android:onClick="@{ activity.itemClick}" |
| | | android:onClick="@{ activity::itemClick}" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | |
| | | # Location of the SDK. This is only used by Gradle. |
| | | # For customization when using a Version Control System, please read the |
| | | # header note. |
| | | #Fri Mar 15 09:00:13 CST 2024 |
| | | ndk.dir=D\:\\android\\sdk\\ndk\\android-ndk-r21 |
| | | sdk.dir=D\:\\android\\sdk |
| | | #Mon May 13 11:15:58 CST 2024 |
| | | #ndk.dir=D\:\\android\\sdk\\ndk\\android-ndk-r21 |
| | | sdk.dir=D\:\\AndroidStudio\\sdk |
| | |
| | | android { |
| | | namespace 'com.dayu.qihealonelibrary' |
| | | compileSdk 33 |
| | | |
| | | ndkPath 'D:\\android\\sdk\\ndk\\android-ndk-r21' |
| | | defaultConfig { |
| | | minSdk 23 |
| | | targetSdk 33 |
| | |
| | | package com.dayu.qihealonelibrary.activity; |
| | | |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.view.LayoutInflater; |
| | | import android.widget.EditText; |
| | | |
| | | import com.dayu.baselibrary.utils.MornyUtil; |
| | | import com.dayu.baselibrary.utils.TipUtil; |
| | | import com.dayu.qihealonelibrary.databinding.ActivityAdminSetupQhaBinding; |
| | | import com.dayu.qihealonelibrary.dbBean.AdminDataBean; |
| | |
| | | adminBinding.setupOk.setOnClickListener(v -> { |
| | | String strSerial = adminBinding.adminAddressCode.getText().toString(); |
| | | String strAddressCode = adminBinding.adminAddressCode.getText().toString(); |
| | | String strWaterPrice = adminBinding.adminWaterPrice.getText().toString(); |
| | | if (!TextUtils.isEmpty(strAddressCode) |
| | | && !TextUtils.isEmpty(strSerial)) { |
| | | |
| | | // if (Integer.valueOf(strSerial) <= 65535) { |
| | | && !TextUtils.isEmpty(strSerial) && !TextUtils.isEmpty(strWaterPrice)) { |
| | | int wtaterPrice = MornyUtil.changeY2F(strWaterPrice); |
| | | if (Integer.valueOf(wtaterPrice) > 0) { |
| | | if (Integer.valueOf(strAddressCode) <= 65535) { |
| | | adminData.setAddressCode(strAddressCode); |
| | | adminData.setSerial(strSerial); |
| | | adminData.setWaterPrice(wtaterPrice); |
| | | baseDao.adminDao().insert(adminData); |
| | | TipUtil.show(AdminSetupActivity.this, "设置成功", new TipUtil.TipListener() { |
| | | @Override |
| | |
| | | TipUtil.show(AdminSetupActivity.this, "输入的区域号不能超过65535"); |
| | | } |
| | | |
| | | // } else { |
| | | // TipUtil.show(AdminSetupActivity.this, "输入的设备编号不能超过65535"); |
| | | // } |
| | | } else { |
| | | TipUtil.show(AdminSetupActivity.this, "单价不能为0"); |
| | | } |
| | | } else { |
| | | TipUtil.show(AdminSetupActivity.this, "请输入完整内容"); |
| | | } |
| | | }); |
| | | |
| | | setPricePoint(adminBinding.adminWaterPrice); |
| | | |
| | | } |
| | | |
| | | |
| | |
| | | this.adminData = adminData; |
| | | adminBinding.adminSerial.setText(adminData.getSerial()); |
| | | adminBinding.adminAddressCode.setText(adminData.getAddressCode()); |
| | | adminBinding.adminWaterPrice.setText(MornyUtil.changeF2Y(adminData.getWaterPrice())); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | |
| | | } |
| | | } |
| | | |
| | | //水单价校验 |
| | | public static void setPricePoint(final EditText editText) { |
| | | editText.addTextChangedListener(new TextWatcher() { |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, |
| | | int count) { |
| | | if (s.toString().contains(".")) { |
| | | if (s.length() - 1 - s.toString().indexOf(".") > 2) { |
| | | s = s.toString().subSequence(0, |
| | | s.toString().indexOf(".") + 3); |
| | | editText.setText(s); |
| | | editText.setSelection(s.length()); |
| | | } |
| | | } |
| | | if (s.toString().trim().substring(0).equals(".")) { |
| | | s = "0" + s; |
| | | editText.setText(s); |
| | | editText.setSelection(2); |
| | | } |
| | | |
| | | if (s.toString().startsWith("0") |
| | | && s.toString().trim().length() > 1) { |
| | | if (!s.toString().substring(1, 2).equals(".")) { |
| | | editText.setText(s.subSequence(0, 1)); |
| | | editText.setSelection(1); |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, |
| | | int after) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) { |
| | | // TODO Auto-generated method stub |
| | | |
| | | } |
| | | |
| | | }); |
| | | |
| | | } |
| | | |
| | | } |
| | |
| | | public void onClick(View v) { |
| | | AdminDataBean adminData = baseDao.adminDao().findFirst(); |
| | | if (adminData != null) { |
| | | startActivity(new Intent(HomeActivity.this, RechargeActivity.class)); |
| | | if (adminData.getWaterPrice()!=0){ |
| | | startActivity(new Intent(HomeActivity.this, RechargeActivity.class)); |
| | | }else { |
| | | TipUtil.show(HomeActivity.this,"请先在个人中心内设置水价"); |
| | | } |
| | | } else { |
| | | TipUtil.show("请先在个人中心内设置区域号"); |
| | | } |
| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | |
| | | import com.dayu.baselibrary.utils.MornyUtil; |
| | | import com.dayu.baselibrary.utils.TipUtil; |
| | | import com.dayu.baselibrary.view.PassWordDialog; |
| | | import com.dayu.baselibrary.view.datepicker.CustomDatePicker; |
| | |
| | | PassWordDialog passWordDialog = new PassWordDialog(MyActivity.this, new Intent(MyActivity.this, AdminSetupActivity.class)); |
| | | passWordDialog.show(); |
| | | // startActivity(new Intent(MyActivity.this, AdminSetupActivity.class)); |
| | | } |
| | | }); |
| | | myBinding.myWaterPriceLL.setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | PassWordDialog passWordDialog = new PassWordDialog(MyActivity.this, new Intent(MyActivity.this, AdminSetupActivity.class)); |
| | | passWordDialog.show(); |
| | | } |
| | | }); |
| | | myBinding.myPsw.setOnClickListener(new View.OnClickListener() { |
| | |
| | | if (adminData != null) { |
| | | myBinding.myAdminName.setText(adminData.getAddressCode()); |
| | | myBinding.myVillageNum.setText(adminData.getSerial()); |
| | | myBinding.myWaterPrice.setText(MornyUtil.changeF2Y(adminData.getWaterPrice())); |
| | | } else { |
| | | myBinding.myAdminName.setText("请点击设置区域号"); |
| | | myBinding.myVillageNum.setText("请点击设置区域号"); |
| | | myBinding.myAdminName.setText("请点击区域号进行设置"); |
| | | myBinding.myVillageNum.setText("请点击区域号进行设置"); |
| | | myBinding.myWaterPrice.setText("请点击区域号进行设置"); |
| | | } |
| | | StringBuilder msgData = new StringBuilder(); |
| | | |
| | |
| | | UserCard olduserCard; |
| | | |
| | | String morny; |
| | | String rechageWater;//充值的水量 |
| | | String userName; |
| | | AdminDataBean adminData; |
| | | RechargeBean rechargeBean; |
| | |
| | | } |
| | | if (this.getIntent().hasExtra("electricPriceCard")) { |
| | | electricPriceCard = (ElectricPriceCard) this.getIntent().getSerializableExtra("electricPriceCard"); |
| | | binding.cardData.setText("制作用户电量单价卡\n当前单价:" + electricPriceCard.getElectricPrice().toString() + "元"); |
| | | |
| | | binding.cardData.setText("制作用户电量单价卡\n当前单价:" + electricPriceCard.getElectricPrice().toString() + " 元"); |
| | | } |
| | | if (this.getIntent().hasExtra("passWordCard")) { |
| | | passWordCard = (PassWordCard) this.getIntent().getSerializableExtra("passWordCard"); |
| | |
| | | userName = this.getIntent().getStringExtra("userName"); |
| | | cardNumber = this.getIntent().getStringExtra("cardNumber"); |
| | | userCardBean = (UserCardBean) this.getIntent().getSerializableExtra("userCardBean"); |
| | | binding.cardData.setText("充值金额:" + morny + "元"); |
| | | rechageWater = this.getIntent().getStringExtra("rechageWater"); |
| | | binding.cardData.setText("充值金额:" + morny + " 元\n充值水量:" + rechageWater + " 立方米(吨)"); |
| | | } |
| | | |
| | | try { |
| | |
| | | String cardNumberThis = NfcReadHelper.getInstence(intent, this).getCardNumber(); |
| | | //判断是否充值的是一个卡 |
| | | if (cardNumberThis.equalsIgnoreCase(cardNumber)) { |
| | | //余额 |
| | | int balance = userCard.getBalance() + MornyUtil.changeY2F(morny); |
| | | userCard.setBalance(balance); |
| | | //剩余水量 |
| | | int surplusWater = userCard.getSurplusWater() + MornyUtil.changeY2F(rechageWater); |
| | | userCard.setSurplusWater(surplusWater); |
| | | |
| | | int rechageTims = userCard.getRechargeTimes() + 1; |
| | | if (rechageTims == 256) { |
| | | rechageTims = 0; |
| | |
| | | rechargeBean.setMorny(morny); |
| | | rechargeBean.setBalance(MornyUtil.changeF2Y(balance)); |
| | | rechargeBean.setCardNumber(cardNumber); |
| | | rechargeBean.setSurplusWater(MornyUtil.changeF2Y(surplusWater)); |
| | | rechargeBean.setRechargeWater(rechageWater); |
| | | try { |
| | | baseDao.rechargeDao().insert(rechargeBean); |
| | | } catch (Exception e) { |
| | |
| | | detail.putExtra("userCard", userCard); |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | detail.putExtra("morny", morny); |
| | | detail.putExtra("rechageWater", rechageWater); |
| | | } |
| | | if (!TextUtils.isEmpty(cardNumber)) { |
| | | detail.putExtra("cardNumber", cardNumber); |
| | | } |
| | | |
| | | startActivity(detail); |
| | | if (NewCardActivity.newCardActivity != null) { |
| | | NewCardActivity.newCardActivity.finish(); |
| | |
| | | package com.dayu.qihealonelibrary.activity; |
| | | |
| | | import android.os.Bundle; |
| | | import android.text.Editable; |
| | | import android.text.InputFilter; |
| | | import android.text.Spanned; |
| | | import android.text.TextUtils; |
| | | import android.text.TextWatcher; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | |
| | |
| | | } |
| | | } |
| | | }); |
| | | // 设置输入过滤器 |
| | | binding.villageNewNum.addTextChangedListener(new TextWatcher() { |
| | | @Override |
| | | public void beforeTextChanged(CharSequence s, int start, int count, int after) { |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, int count) { |
| | | } |
| | | |
| | | @Override |
| | | public void afterTextChanged(Editable s) { |
| | | if (!isValidInput(s.toString())) { |
| | | // 如果输入的字符不符合要求,则将 EditText 的内容设置为最后一次合法的输入 |
| | | binding.villageNewNum.setText(s.subSequence(0, s.length() - 1).toString().toUpperCase()); |
| | | binding.villageNewNum.setSelection(binding.villageNewNum.getText().length()); // 将光标移动到末尾 |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | } |
| | | // 检查输入的字符是否符合要求 |
| | | private boolean isValidInput(String input) { |
| | | return input.matches("[0-9a-fA-F]*"); // 包含 0-9 和 a-f 的字符 |
| | | } |
| | | } |
| | |
| | | redCardBinding.redRechargeDate.setText("本卡最后购水日期:无"); |
| | | } |
| | | redCardBinding.redInitCode.setText(cardNumber); |
| | | redCardBinding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + ""); |
| | | redCardBinding.redTotalWater.setText("总用水量:" + userCard.getTotalWater()); |
| | | redCardBinding.redTotalPower.setText("总用电量:" + userCard.getTotalElectric()); |
| | | redCardBinding.redRemainderBlance.setText("剩余金额:" + MornyUtil.changeF2Y(userCard.getBalance()) + "元"); |
| | | redCardBinding.redRemainderWater.setText("剩余水量:" + userCard.getSurplusWater()); |
| | | redCardBinding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + " 次"); |
| | | redCardBinding.redTotalWater.setText("总用水量:" + MornyUtil.changeF2Y(userCard.getTotalWater()) + " 吨"); |
| | | redCardBinding.redTotalPower.setText("总用电量:" + MornyUtil.changeF2Y(userCard.getTotalElectric())+" 度"); |
| | | redCardBinding.redRemainderBlance.setText("剩余金额:" + MornyUtil.changeF2Y(userCard.getBalance()) + " 元"); |
| | | redCardBinding.redRemainderWater.setText("剩余水量:" + MornyUtil.changeF2Y(userCard.getSurplusWater())+" 吨"); |
| | | } |
| | | } |
| | | |
| | |
| | | String userName; |
| | | String cardNumber = null; |
| | | UserCardBean userCardBean; |
| | | int waterPrice; |
| | | String rechageWater;//充值的水量 |
| | | |
| | | @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(); |
| | |
| | | String state = ""; |
| | | if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_1)) { |
| | | state = "终端写卡"; |
| | | binding.rechargeTextLL.setVisibility(View.VISIBLE); |
| | | binding.rechargeRegistBtn.setVisibility(View.VISIBLE); |
| | | } else if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_2)) { |
| | | state = "刷卡开泵后,当前状态不能充值"; |
| | | binding.rechargeLL.setVisibility(View.GONE); |
| | | binding.rechargeRegistBtn.setVisibility(View.GONE); |
| | | } else if (cardType.equalsIgnoreCase(CardCommon.USER_CARD_TYPE_3)) { |
| | | state = "叠加充值"; |
| | | binding.rechargeLL.setVisibility(View.GONE); |
| | | binding.rechargeRegistBtn.setVisibility(View.GONE); |
| | | } else { |
| | | TipUtil.show(this, "非用户卡,不能充值"); |
| | | return; |
| | |
| | | AdminDataBean adminDataBean = baseDao.adminDao().findFirst(); |
| | | |
| | | |
| | | if (adminDataBean.addressCode.equalsIgnoreCase(String.valueOf(userCard.getArerNumber()))) { |
| | | if (Integer.valueOf(adminDataBean.getAddressCode()) == userCard.getArerNumber()) { |
| | | if (!userCardBeans.isEmpty()) { |
| | | userCardBean = userCardBeans.get(0); |
| | | this.userName = userCardBean.getUserName(); |
| | |
| | | } |
| | | |
| | | binding.rechargeReadLL.setVisibility(View.GONE); |
| | | binding.rechargeTextLL.setVisibility(View.VISIBLE); |
| | | binding.rechargeRegistBtn.setVisibility(View.VISIBLE); |
| | | binding.userName.setText(userName); |
| | | binding.redStatu.setText(state); |
| | | if (userCard != null) { |
| | |
| | | binding.redRechargeDate.setText("本卡最后购水日期:无"); |
| | | } |
| | | binding.redInitCode.setText(cardNumber); |
| | | binding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + ""); |
| | | binding.redTotalWater.setText("总用水量:" + userCard.getTotalWater()); |
| | | binding.redTotalPower.setText("总用电量:" + userCard.getTotalElectric()); |
| | | binding.redRemainderBlance.setText(MornyUtil.changeF2Y(userCard.getBalance()) + "元"); |
| | | binding.redRemainderWater.setText("剩余水量:" + userCard.getSurplusWater()); |
| | | 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()) + " 元"); |
| | | } |
| | | |
| | | } else { |
| | |
| | | intent.putExtra("cardNumber", cardNumber); |
| | | intent.putExtra("userCard", userCard); |
| | | intent.putExtra("userCardBean", userCardBean); |
| | | intent.putExtra("rechageWater", rechageWater); |
| | | startActivity(intent); |
| | | } else { |
| | | TipUtil.show(RechargeActivity.this, "请输入充值金额(元)"); |
| | |
| | | |
| | | |
| | | //校验金额 |
| | | public static void setPricePoint(final EditText editText) { |
| | | public void setPricePoint(final EditText editText) { |
| | | editText.addTextChangedListener(new TextWatcher() { |
| | | @Override |
| | | public void onTextChanged(CharSequence s, int start, int before, |
| | |
| | | editText.setSelection(1); |
| | | } |
| | | } |
| | | String morny = editText.getText().toString(); |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | rechageWater = MornyUtil.intDiv(MornyUtil.changeY2F(editText.getText().toString()), waterPrice); |
| | | binding.redRechargeWater.setText("充值水量:" + rechageWater + " 立方米(吨)"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | @Override |
| | |
| | | String statu; |
| | | String userName; |
| | | String morny; |
| | | String rechageWater; |
| | | String cardNumber; |
| | | |
| | | @Override |
| | |
| | | userName = getIntent().getStringExtra("userName"); |
| | | if (getIntent().hasExtra("morny")) { |
| | | morny = getIntent().getStringExtra("morny"); |
| | | rechageWater = getIntent().getStringExtra("rechageWater"); |
| | | } |
| | | if (getIntent().hasExtra("cardNumber")) { |
| | | cardNumber = getIntent().getStringExtra("cardNumber"); |
| | |
| | | int balance = userCard.getBalance(); |
| | | if (!TextUtils.isEmpty(morny)) { |
| | | binding.tip.setText("充值成功!"); |
| | | balance = userCard.getBalance() ; |
| | | balance = userCard.getBalance(); |
| | | binding.redRemainderMorny.setText("充值金额:" + morny + " 元"); |
| | | binding.redRechargeWater.setText("充值水量:" + rechageWater + " 吨"); |
| | | } else { |
| | | binding.tip.setText("开卡成功!"); |
| | | balance = userCard.getBalance(); |
| | | binding.redRemainderMorny.setVisibility(View.GONE); |
| | | binding.redRechargeWater.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); |
| | |
| | | int month = calendar.get(Calendar.MONTH); // 月份从0开始,所以需要加1 |
| | | int day = calendar.get(Calendar.DAY_OF_MONTH); |
| | | |
| | | binding.redRechargeDate.setText("本卡最后购水日期:" + year + month + day ); |
| | | binding.redRechargeDate.setText("本卡最后购水日期:" + year + month + day); |
| | | } else { |
| | | binding.redRechargeDate.setText("本卡最后购水日期:无"); |
| | | } |
| | |
| | | |
| | | import com.dayu.baselibrary.utils.DateUtil; |
| | | |
| | | import com.dayu.baselibrary.utils.MornyUtil; |
| | | import com.dayu.qihealonelibrary.R; |
| | | import com.dayu.qihealonelibrary.databinding.QiheItemRechargeBinding; |
| | | import com.dayu.qihealonelibrary.dbBean.RechargeBean; |
| | |
| | | if (rechargeList.size() > 0) { |
| | | ((ViewHolder) holder).getBinding().userName.setText("姓名:" + rechargeList.get(position).getUserName()); |
| | | ((ViewHolder) holder).getBinding().userNo.setText("卡号:" + rechargeList.get(position).getCardNumber()); |
| | | ((ViewHolder) holder).getBinding().morny.setText("充值金额:" + rechargeList.get(position).getMorny()); |
| | | ((ViewHolder) holder).getBinding().morny.setText("充值金额:" + rechargeList.get(position).getMorny() + " 元"); |
| | | ((ViewHolder) holder).getBinding().rachagerWater.setText("充值水量:" + rechargeList.get(position).getRechargeWater() + " 吨"); |
| | | ((ViewHolder) holder).getBinding().balance.setText("余额:" + rechargeList.get(position).getBalance() + " 元"); |
| | | ((ViewHolder) holder).getBinding().surplusWater.setText("剩余水量:" + rechargeList.get(position).getSurplusWater() + " 吨"); |
| | | ((ViewHolder) holder).getBinding().date.setText("日期:" + DateUtil.dateToStamp(rechargeList.get(position).getDate(), DateUtil.type1)); |
| | | } |
| | | } |
| | |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | |
| | | byte[] regionBytes = HexUtil.hexToByteArray(cardData); |
| | | byte[] regionBytes = new byte[4]; |
| | | byte[] regionDatas = HexUtil.hexToByteArray(cardData); |
| | | System.arraycopy(regionDatas, 0, regionBytes, 0, regionDatas.length); |
| | | if (regionBytes != null) { |
| | | System.arraycopy(regionBytes, 0, data, 1, regionBytes.length); |
| | | } |
| | | |
| | | byte[] controllerCodelBytes = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(electricPrice)); |
| | | byte[] controllerCodelBytes = new byte[4]; |
| | | byte[] controllerCodelDatas = HexUtil.hexToByteArray(HexUtil.floatToHexLowHigh(electricPrice)); |
| | | System.arraycopy(controllerCodelDatas, 0, controllerCodelBytes, 0, controllerCodelDatas.length); |
| | | if (controllerCodelBytes != null) { |
| | | System.arraycopy(controllerCodelBytes, 0, data, 5, controllerCodelBytes.length); |
| | | } |
| | |
| | | public byte[] toByte() { |
| | | byte[] data = new byte[16]; |
| | | data[0] = HexUtil.hexToByte(cardType); |
| | | |
| | | byte[] regionBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(region)); |
| | | byte[] regionBytes = new byte[2]; |
| | | byte[] regionDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(region)); |
| | | System.arraycopy(regionDatas, 0, regionBytes, 0, regionDatas.length); |
| | | if (regionBytes != null) { |
| | | System.arraycopy(regionBytes, 0, data, 1, regionBytes.length); |
| | | } |
| | | |
| | | byte[] controllerCodelBytes = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(controllerCodel)); |
| | | byte[] controllerCodelBytes = new byte[2]; |
| | | byte[] controllerCodelDatas = HexUtil.hexToByteArray(HexUtil.get10To16LowHigh(controllerCodel)); |
| | | System.arraycopy(controllerCodelDatas, 0, controllerCodelBytes, 0, controllerCodelDatas.length); |
| | | if (controllerCodelBytes != null) { |
| | | System.arraycopy(controllerCodelBytes, 0, data, 3, controllerCodelBytes.length); |
| | | } |
| | |
| | | |
| | | public int balance;//剩余金额 底位在前 2位小数点,单位分 |
| | | |
| | | public int surplusWater;//剩余水量 底位在前 2位小数点 单位立方米 |
| | | public int surplusWater;//剩余水量 底位在前 2位小数点 单位立方米 (跟价格一样先乘以100) |
| | | |
| | | public Calendar rechargeDate;// 购水时间 BCD |
| | | |
| | |
| | | |
| | | public String addressCode;//区域号 |
| | | |
| | | public int waterPrice;//水价(保存的时候乘以100显示的时候除以100跟余额一样处理) |
| | | |
| | | public int getWaterPrice() { |
| | | return waterPrice; |
| | | } |
| | | |
| | | public void setWaterPrice(int waterPrice) { |
| | | this.waterPrice = waterPrice; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | } |
| | |
| | | public String userId;//用户身份证号 |
| | | public long date; |
| | | public String morny;//充值金额 单位元 |
| | | public String rechargeWater;//充值水量 |
| | | public String balance;//余额 单位元 |
| | | public String total_morn;//总充值金额 |
| | | //状态 0未上传 1成功上传 |
| | | public int state = 0; |
| | | |
| | | public String cardNumber;//卡号 |
| | | public String surplusWater;//剩余水量 底位在前 2位小数点 单位元/立方米 () |
| | | |
| | | public String getRechargeWater() { |
| | | return rechargeWater; |
| | | } |
| | | |
| | | public void setRechargeWater(String rechargeWater) { |
| | | this.rechargeWater = rechargeWater; |
| | | } |
| | | |
| | | public String getSurplusWater() { |
| | | return surplusWater; |
| | | } |
| | | |
| | | public void setSurplusWater(String surplusWater) { |
| | | this.surplusWater = surplusWater; |
| | | } |
| | | |
| | | public String getCardNumber() { |
| | | return cardNumber; |
| | |
| | | byte[] data = mfc.readBlock(bIndex + 0); |
| | | if (data != null && data.length > 0) { |
| | | String hex = HexUtil.bytesToHex(Arrays.copyOfRange(data, 0, 4)); |
| | | hex = HexUtil.spaceHex(hex); |
| | | hex = HexUtil.HighLowHex(hex); |
| | | Log.i("NFCWreatActivity", "hex===" + hex); |
| | | return hex; |
| | | return hex.toUpperCase(); |
| | | } |
| | | } |
| | | |
| | |
| | | byte[] data = mfc.readBlock(bIndex + 0); |
| | | if (data != null && data.length > 0) { |
| | | String hex = HexUtil.bytesToHex(Arrays.copyOfRange(data, 0, 4)); |
| | | hex = HexUtil.spaceHex(hex); |
| | | hex = HexUtil.HighLowHex(hex); |
| | | strData.append(hex); |
| | | strData.append(","); |
| | | Log.i("NFCWreatActivity", "hex===" + hex); |
| | |
| | | String hex = HexUtil.byteToHex(data[0]); |
| | | strData.append(hex); |
| | | Log.i("NFCWreatActivity", "hex===" + hex); |
| | | return strData.toString(); |
| | | return strData.toString().toUpperCase(); |
| | | } |
| | | } else { |
| | | Log.i("NFCWreatActivity", "isOpen===" + isOpen); |
| | |
| | | android:inputType="number" |
| | | android:lines="1" |
| | | android:maxLength="5" |
| | | |
| | | android:paddingLeft="10dp" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | style="@style/newCardLL" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:visibility="visible"> |
| | | |
| | | <TextView |
| | | android:layout_width="0dp" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1.5" |
| | | android:text="水单价(元/吨)" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | <EditText |
| | | android:id="@+id/admin_waterPrice" |
| | | android:layout_width="0dp" |
| | | android:layout_height="@dimen/edt_height" |
| | | android:layout_weight="2" |
| | | android:background="@drawable/editbg" |
| | | android:inputType="numberDecimal" |
| | | android:lines="1" |
| | | android:paddingLeft="10dp" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/chose_address" |
| | | style="@style/newCardLL" |
| | | android:layout_width="match_parent" |
| | |
| | | |
| | | </LinearLayout> |
| | | |
| | | <LinearLayout |
| | | android:id="@+id/my_waterPriceLL" |
| | | 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:textColor="@color/text_selecter" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/my_waterPrice" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:textColor="@color/text_selecter" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <RelativeLayout |
| | | |
| | |
| | | android:layout_marginEnd="20dp" |
| | | android:layout_marginBottom="20dp" |
| | | android:hint="请输入新设置的12位16进制卡密码" |
| | | android:inputType="number|numberDecimal" |
| | | android:lines="1" |
| | | android:maxLength="12" /> |
| | | |
| | |
| | | android:layout_marginTop="15dp" |
| | | android:text="充值金额:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_recharge_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_remainder_blance" |
| | | android:layout_width="match_parent" |
| | |
| | | android:layout_marginTop="15dp" |
| | | android:text="剩余金额:" |
| | | android:textSize="@dimen/text_size" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_surplusWater" |
| | | 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:textSize="@dimen/new_card_size" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_remainder_water" |
| | | android:layout_width="match_parent" |
| | |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | <TextView |
| | | android:id="@+id/red_waterPrice" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:text="每立方米水价格:" |
| | | android:textSize="@dimen/text_size" |
| | | android:visibility="visible" /> |
| | | <LinearLayout |
| | | android:id="@+id/recharge_LL" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_marginTop="15dp" |
| | | android:orientation="horizontal"> |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |
| | | android:id="@+id/recharge_tx" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="金额(元):" |
| | | android:textColor="@color/red" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | <EditText |
| | | android:id="@+id/recharge_water" |
| | | android:id="@+id/red_recharge_water" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:hint="请输入充值的金额" |
| | | android:inputType="numberDecimal" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | android:layout_marginTop="15dp" |
| | | android:text="充值水量:" |
| | | android:textSize="@dimen/text_size" |
| | | android:visibility="visible" /> |
| | | |
| | | <LinearLayout |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="match_parent" |
| | | android:orientation="horizontal"> |
| | | |
| | | |
| | | <TextView |
| | | android:id="@+id/recharge_tx" |
| | | android:layout_width="wrap_content" |
| | | android:layout_height="wrap_content" |
| | | android:text="金额(元):" |
| | | android:textColor="@color/red" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | <EditText |
| | | android:id="@+id/recharge_water" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:hint="请输入充值的金额" |
| | | android:inputType="numberDecimal" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | |
| | | </LinearLayout> |
| | | |
| | | |
| | | </LinearLayout> |
| | | </LinearLayout> |
| | | |
| | |
| | | android:id="@+id/recharge_registBtn" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="50dp" |
| | | android:visibility="gone" |
| | | android:layout_alignParentBottom="true" |
| | | android:background="@color/title_bg" |
| | | android:gravity="center" |
| | | android:text="充值" |
| | | android:textColor="#000000" |
| | | android:textSize="@dimen/new_card_size" /> |
| | | android:textSize="@dimen/new_card_size" |
| | | android:visibility="gone" /> |
| | | </RelativeLayout> |
| | |
| | | android:layout_weight="1" |
| | | android:text="金额:" |
| | | android:textSize="14sp" /> |
| | | <TextView |
| | | android:id="@+id/rachagerWater" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="充值水量:" |
| | | android:textSize="14sp" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/balance" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="余额:" |
| | | android:textSize="14sp" /> |
| | | <TextView |
| | | android:id="@+id/surplusWater" |
| | | android:layout_width="match_parent" |
| | | android:layout_height="wrap_content" |
| | | android:layout_weight="1" |
| | | android:text="剩余水量:" |
| | | android:textSize="14sp" /> |
| | | |
| | | <TextView |
| | | android:id="@+id/date" |
| | |
| | | android:layout_marginLeft="15dp" |
| | | android:layout_marginTop="10dp" |
| | | android:layout_marginRight="15dp" |
| | | android:onClick="@{ activity.itemClick}" |
| | | android:onClick="@{ activity::itemClick}" |
| | | android:orientation="vertical"> |
| | | |
| | | <TextView |