| package com.dayu.henanlibrary.activity; | 
|   | 
| import android.os.Bundle; | 
| import android.text.TextUtils; | 
| import android.view.LayoutInflater; | 
| import android.view.View; | 
|   | 
| import com.dayu.baselibrary.utils.MornyUtil; | 
| import com.dayu.henanlibrary.card.UserCard; | 
| import com.dayu.henanlibrary.databinding.ActivityRechargeDetailHnBinding; | 
|   | 
| import java.util.Calendar; | 
|   | 
| /** | 
|  * Created by Android Studio. | 
|  * author: zuo | 
|  * Date: 2023-11-21 | 
|  * Time: 15:01 | 
|  * 备注:写卡后的详情页 | 
|  */ | 
| public class RechargeDetail extends HNBaseActivity { | 
|   | 
|     ActivityRechargeDetailHnBinding binding; | 
|     UserCard userCard; | 
|     String statu; | 
|     String userName; | 
|     String morny; | 
|   | 
|     @Override | 
|     protected void onCreate(Bundle savedInstanceState) { | 
|         super.onCreate(savedInstanceState); | 
|   | 
|         binding = ActivityRechargeDetailHnBinding.inflate(LayoutInflater.from(this)); | 
|         setContentView(binding.getRoot()); | 
|   | 
|         try { | 
|             userCard = (UserCard) getIntent().getSerializableExtra("userCard"); | 
|             statu = getIntent().getStringExtra("statu"); | 
|             userName = getIntent().getStringExtra("userName"); | 
|             if (getIntent().hasExtra("morny")) { | 
|                 morny = getIntent().getStringExtra("morny"); | 
|             } | 
|             setUserData(userName, statu); | 
|         } catch (Exception e) { | 
|             throw new RuntimeException(e); | 
|         } | 
|   | 
|     } | 
|   | 
|     private void setUserData(String userName, String statu) { | 
|         int balance; | 
|         if (!TextUtils.isEmpty(morny)) { | 
|             binding.tip.setText("充值成功!"); | 
|             balance = userCard.getBalance() ; | 
|             binding.redRemainderMorny.setText("充值金额:" + morny + " 元"); | 
|         } else { | 
|             binding.tip.setText("开卡成功!"); | 
|             balance = userCard.getBalance(); | 
|             binding.redRemainderMorny.setVisibility(View.GONE); | 
|         } | 
|         binding.redName.setText("用户姓名:" + userName); | 
|         binding.redRemainderBlance.setText("剩余金额:" + MornyUtil.changeF2Y(balance) + " 元"); | 
|         binding.redStatu.setText("卡状态:" + statu); | 
|         if (userCard != null) { | 
|             binding.redInitCode.setText("用户注册编号:" + userCard.getInitPeasantCode()); | 
|             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); | 
|                 int hour = calendar.get(Calendar.HOUR_OF_DAY); | 
|                 int minute = calendar.get(Calendar.MINUTE); | 
|                 int second = calendar.get(Calendar.SECOND); | 
|                 binding.redRechargeDate.setText("本卡最后购水日期:" + year + month + day + " " + hour + ":" + minute + ":" + second); | 
|             } else { | 
|                 binding.redRechargeDate.setText("本卡最后购水日期:无"); | 
|             } | 
|   | 
|             binding.redRechargeNumber.setText("本卡充值次数:" + userCard.getRechargeTimes() + ""); | 
|         } | 
|     } | 
| } |